Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// IOVsetWithClass.js
(function() {
	/*global adventurejs A*/ 
  "use strict";
  var p = adventurejs.Asset.prototype;	
  /**
   * <strong>IOVsetWithClass</strong> is a method to add a direct object 
   * class to asset.iov[verb].with_classes.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#IOVsetWithClass
   * @param {String} verb
   * @param {String} clas
   * @returns {Boolean}
   */
  p.IOVsetWithClass = function Asset_IOVSetWithClass(verb, clas)
  { 
    var object_of = 'iov';
    if( !verb || !this.game.dictionary.verbs[verb] ) return false;
    if( !adventurejs[clas] ) return false;
    if(!this.isIOV(verb))
    {
      this.setIOV(verb);
    }
    if( -1 === this[object_of][verb].with_classes.indexOf( clas ) )
    {
      this[object_of][verb].with_classes.push( clas );
    }
    return true;
  }
}());