// categorizeAssets.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Parser.prototype;
/**
* Categorize a list of asset ids for use with handleSentence.
* @memberOf AdventureJS.Parser
* @method AdventureJS.Parser#categorizeAssets
* @returns {object}
*/
p.categorizeAssets = function Parser_categorizeAssets(list) {
console.warn(`categorizeAssets`, list);
const a = {
present_assets: [],
absent_assets: [],
carried_assets: [],
uncarried_assets: [],
local_assets: [],
global_assets: [],
excludable_assets: [],
reservoir_assets: [],
room_assets: [],
emitter_assets: [],
platonic_assets: [],
fungible_assets: [],
dispenser_assets: [],
};
for (let i = 0; i < list.length; i++) {
let match = list[i];
let asset = this.game.getAsset(match);
if (asset.is.platonic) {
a.platonic_assets.push(match);
continue;
}
if (asset.is.fungible) {
a.fungible_assets.push(match);
}
if (match.includes("fungible:")) {
a.dispenser_assets.push(match);
}
if (asset.$is("present")) {
a.present_assets.push(match);
if (!asset.$is("global")) {
a.local_assets.push(match);
}
} else {
a.absent_assets.push(match);
}
if (asset.$is("global")) {
a.global_assets.push(match);
}
if (asset.$is("carried")) {
a.carried_assets.push(match);
}
if (!asset.$is("carried")) {
a.uncarried_assets.push(match);
}
if (asset.exclude_from_disambiguation) {
a.excludable_assets.push(match);
}
if (asset.$is("reservoir")) {
a.reservoir_assets.push(match);
}
if (asset.$is("emitting")) {
a.emitter_assets.push(match);
}
if (asset.hasClass("Room")) {
a.room_assets.push(match);
}
}
return a;
}; // categorizeAssets
})();