Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// selectDOV.js

(function () {
  /*global adventurejs A*/

  var p = adventurejs.Parser.prototype;

  /**
   * Exclude from a list of assets all assets that are not direct objects of verb.
   * @method adventurejs.Parser#selectDOV
   * @memberOf adventurejs.Parser
   * @param {Array} list
   * @returns {Array}
   */
  p.selectDOV = function Parser_selectDOV(list, verb) {
    if (typeof list !== "object") {
      console.warn("selectDOV received non-array", list);
      return [];
    }
    var foundObjects = [];
    for (var i = 0; i < list.length; i++) {
      console.log("selectDOV list[i]", list[i]);
      var object = this.game.getAsset(list[i]);
      if (object.isDOV(verb)) {
        foundObjects.push(list[i]);
      }
    }
    return foundObjects;
  };
})();