Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// DOVhasMaxConnections.js
(function() {
	/*global adventurejs A*/ 
  "use strict";
  var p = adventurejs.Asset.prototype;	
  /**
   * Get whether the DOV has maximum connections.
   * @memberOf adventurejs.Asset
	 * @method adventurejs.Asset#DOVhasMaxConnections
   * @param {String} verb The name of a verb.
   * @return {Boolean}
   */
  p.DOVhasMaxConnections = function Asset_DOVhasMaxConnections(verb) 
  {
    // no verb or not DOV, not max
    if( !verb || !this.game.dictionary.verbs[verb] ) return true;
    if( !this.dov[verb] ) return true;

    // no connections at all? is max
    if( !this.dov[verb].with_params.connections ) return true;

    // no max connections set? not max
    if( "undefined" === typeof this.dov[verb].with_params.max_connections ) return false;

    // max greater than actual? not max
    if( this.dov[verb].with_params.max_connections >= 
      this.dov[verb].with_params.connections.length )
    {
      return false;
    }

    // assume it's max
    return true;
  }
}());