// canSetVerbState.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Asset.prototype;
/**
* <strong>canSetVerbState</strong> is a method to check whether
* the specified verb can set state on this asset. Assumes that
* asset.dov[verb].enabled is true
* @memberOf adventurejs.Asset
* @method adventurejs.Asset#canSetVerbState
* @param {String} verb
* @returns {Boolean}
*/
p.canSetVerbState = function Asset_canSetVerbState(verb) {
if (!this.game.dictionary.verbs[verb]) return false;
if (
!this.game.dictionary.verbs[verb].state &&
!this.game.dictionary.verbs[verb].unstate
)
return false;
if (!this.dov[verb]?.enabled) return false;
verb = this.game.dictionary.verbs[verb];
// ex: do verb close to this and this.is.closed
if (verb.state && this.is[verb.state]) return false;
// ex: do verb open to this and !this.is.closed
if (verb.unstate && !this.is[verb.unstate]) return false;
return true;
};
})();