// lick.js
(function () {
/* global adventurejs A */
/**
* @augments {adventurejs.Verb}
* @class lick
* @ajsnode game.dictionary.verbs.lick
* @ajsconstruct MyGame.createVerb({ "name": "lick", [...] });
* @ajsconstructedby adventurejs.Dictionary#createVerb
* @hideconstructor
* @ajsinstanceof Verb
* @ajsnavheading SensationVerbs
* @summary Verb meaning lick asset.
* @tutorial Verbs_Subscriptions
* @tutorial AdvancedVerbs_VerbAnatomy
* @tutorial AdvancedVerbs_VerbProcess
* @tutorial AdvancedVerbs_ModifyVerbs
* @tutorial AdvancedVerbs_ModifyVerbs
* @classdesc
* <pre class="display border outline">
* <span class="ajs-player-input">> lick toad</span>
* You lick the toad. It tastes disgusting, like wet dirt, but nothing happ... Oh. Oh. Something's definitely happening. It comes in a rush: a feeling of anxiety, followed by a lack of balance, things start spinning. Uh oh. This might have been the wrong trip. And then. And then. And then... ah, it's alright. You've settled in now. It's going to be an interesting night.
* </pre>
* <p>
* <strong>Lick</strong> requires that the
* {@link adventurejs.Tangible|Tangible}
* {@link adventurejs.Asset|Asset} to be licked has asset.dov.lick.enabled set to true. By default, no special results will occur.
* Authors wanting to make use of it may need to use a method such
* as verb hooks. See
* <a href="/doc/Verbs_PhaseHooks.html">Verb Phases</a>
* to learn more.
* </p>
* <p>
* Lick and {@link taste|taste} behave identically if they're
* not given any special reactions.
* </p>
* @ajsverbreactions
* @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
*/
A.Preverbs.lick = {
name: "lick",
prettyname: "lick",
past_tense: "licked",
synonyms: ["lick"],
gerund: "licking",
/**
* @ajsverbstructures
* @memberof lick
*/
accepts_structures: ["verb noun"],
/**
* @memberof lick
* @ajsverbphrase
* phrase1:
* {
* accepts_noun: true,
* requires_noun: true,
* noun_must_be:
* {
* known: true,
* tangible: true,
* present: true,
* visible: true,
* reachable: true,
* },
* },
*/
phrase1: {
accepts_noun: true,
requires_noun: true,
noun_must_be: {
known: true,
tangible: true,
present: true,
visible: true,
reachable: true,
},
},
/**
* @memberof lick
* @ajsverbparams
* with_params: {},
*/
with_params: {},
doTry: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var msg = "";
if (!direct_object.isDOV("lick")) {
this.game.debug(
`D1332 | ${this.name}.js | ${direct_object.id}.dov.lick.enabled is false `
);
msg += `{We} can't lick ${direct_object.articlename}. `;
this.handleFailure(msg);
return null;
}
// single use direct object?
if (
direct_object.allowVerbOnce(this.name, "dov") &&
direct_object.didVerb(this.name, "dov")
) {
this.game.debug(
`D1993 | ${this.name}.js | ${direct_object.id}.dov.${this.name}.once and ${direct_object.id}.did.${this.name}.directly `
);
msg += `{We've} already ${this.past_tense} ${direct_object.articlename} enough. `;
this.handleFailure(msg);
return false;
}
if (!direct_object.hasDescription("taste")) {
this.game.debug(
`D1333 | ${this.name}.js | ${direct_object.id}.descriptions.taste is unset `
);
msg += `${direct_object.Articlename} has no particular taste. `;
this.handleFailure(msg);
return null;
}
return true;
},
doSuccess: function () {
var input = this.game.getInput();
var subject = input.getSubject();
var direct_object = input.getAsset(1);
var direct_preposition = input.getPreposition(1);
var indirect_object = input.getAsset(2);
var indirect_preposition = input.getPreposition(2);
var results;
var msg = "";
// compose output
msg += `{We} lick ${direct_object.articlename}. `;
msg += this.game.getDescription({
asset: direct_object,
identifier: "taste",
});
// --------------------------------------------------
// print output
// --------------------------------------------------
return this.handleSuccess(msg);
},
};
})();