// verifyAdverbs.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Parser.prototype;
/**
* Verify that any adverb received is accepted by current verb.
* @memberOf adventurejs.Parser
* @method adventurejs.Parser#verifyAdverbs
*/
p.verifyAdverbs = function Parser_verifyAdverbs() {
var this_turn = this.input_history[0];
this.game.log(
"L1238",
"log",
"high",
"verifyAdverbs.js > " + this_turn.verified_sentence_structure,
"Parser"
);
let verb_name = this_turn.getVerb(1);
let verb = this.game.dictionary.verbs[verb_name];
let adverb = this_turn.getAdverb(1);
if (
verb &&
adverb &&
verb.accepts_adverbs.indexOf(adverb) === -1 &&
verb.accepts_adverbs.indexOf("*") === -1
) {
this.game.debug(
`D1592 | verifySentenceStructure.js | ${verb_name} doesn't accept adverb > ${adverb} `
);
let msg = `$(We) $(don't) know how to ${verb.name} ${adverb}. `;
this.game.print(msg);
return false;
}
return true;
};
})(); // verifyAdverb