// pull.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @augments {adventurejs.Verb}
* @class pull
* @ajsnode game.dictionary.verbs.pull
* @ajsconstruct MyGame.createVerb({ "name": "pull", [...] });
* @ajsconstructedby adventurejs.Dictionary#createVerb
* @hideconstructor
* @ajsinstanceof Verb
* @ajsnavheading ManipulationVerbs
* @summary Verb meaning pull an asset.
* @tutorial Scripting_VerbSubscriptions
* @tutorial Verbs_VerbAnatomy
* @tutorial Verbs_VerbProcess
* @tutorial Verbs_ModifyVerbs
* @tutorial Verbs_WriteVerbs
* @classdesc
* <pre class="display border outline">
* <span class="input">> pull mask</span>
* You don't tug on Superman's cape.
* You don't spit into the wind.
* You don't pull the mask off that old Lone Ranger.
* And you don't mess around with Jim.
* </pre>
* <p>
* <strong>Pull</strong> requires that the
* {@link adventurejs.Tangible|Tangible}
* {@link adventurejs.Asset|Asset} to be pulled has
* asset.dov.pull.enabled
* set to true. No special logic is provided with the verb.
* Authors wanting to make use of it may need to use a method such
* as verb hooks. See
* <a href="/doc/Scripting_VerbPhases.html">Verb Phases</a>
* to learn more.
* </p>
* @ajsverbreactions
* @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
*/
A.Preverbs.pull = {
name: "pull",
prettyname: "pull",
past_tense: "pulled",
synonyms: ["pull"],
/**
* @memberof pull
* @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 pull
* @ajsverbparams
* with_params: {},
*/
with_params: {},
doTry: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var msg = "";
if (!direct_object.isDOV("pull")) {
this.game.debug(
`F1380 | ${this.name}.js | ${direct_object.id}.dov.pull.enabled is false `
);
msg += `$(We) can't pull ${direct_object.articlename}. `;
this.handleFailure(msg);
return null;
}
return true;
},
doSuccess: function () {
var input = this.game.getInput();
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 player = this.game.getPlayer();
var results;
var msg = "";
this.game.debug(`F1381 | ${this.name}.js | print doSuccess `);
msg = `$(We) pull ${direct_object.articlename}. `;
// print output
this.handleSuccess(msg, direct_object);
return true;
}, // pull
};
})();