// selectIntangible.js
(function () {
/* global adventurejs A */
var p = adventurejs.Parser.prototype;
/**
* Exclude from a list of assets all non-intangible assets.
* @method adventurejs.Parser#selectIntangible
* @memberOf adventurejs.Parser
* @param {Array} list
* @returns {Array}
*/
p.selectIntangible = function Parser_selectIntangible(list) {
if ("string" === typeof list) list = [list];
if (!Array.isArray(list)) {
this.game.log(
"L1224",
"error",
"critical",
["[selectIntangible.js] selectIntangible() received non-array", list],
"Parser"
);
return [];
}
this.game.log(
"L1126",
"log",
"high",
`[selectIntangible.js] selectIntangible() receive:\n${list}`,
"Parser"
);
var foundObjects = [];
for (var i = 0; i < list.length; i++) {
var object = this.game.getAsset(list[i]);
if (object instanceof adventurejs.Intangible) {
foundObjects.push(list[i]);
}
}
return foundObjects;
};
})();