Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// DOVsetWithClass.js
(function() {
	/*global adventurejs A*/ 
  "use strict";
  var p = adventurejs.Asset.prototype;	
  /**
   * <strong>DOVsetWithClass</strong> is a method to add an indirect object 
   * class to asset.dov[verb].with_classes.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#DOVsetWithClass
   * @param {String} verb
   * @param {String} clas
   * @returns {Boolean}
   */

  p.DOVsetWithClass = function Asset_DOVsetWithClass(verb, clas)
  { 
    var object_of = 'dov';
    if( !verb || !this.game.dictionary.verbs[verb] ) return false;
    if( !adventurejs[clas] ) return false;
    if(!this.isDOV(verb))
    {
      this.setDOV(verb);
    }
    if( -1 === this[object_of][verb].with_classes.indexOf( clas ) )
    {
      this[object_of][verb].with_classes.push( clas );
    }
    return true;
  }
}());