// tell.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @augments {adventurejs.Verb}
* @class tell
* @ajsnode game.dictionary.verbs.tell
* @ajsconstruct MyGame.createVerb({ "name": "tell", [...] });
* @ajsconstructedby adventurejs.Dictionary#createVerb
* @hideconstructor
* @ajsinstanceof Verb
* @ajsnavheading Conversation Verbs
* @summary Verb meaning tell, as in "tell anteater about anthill".
* @tutorial Scripting_VerbSubscriptions
* @tutorial Verbs_VerbAnatomy
* @tutorial Verbs_VerbProcess
* @tutorial Verbs_ModifyVerbs
* @tutorial Verbs_WriteVerbs
* @classdesc
* <pre class="display border outline">
* <span class="input">> </span>
*
* </pre>
* <p>
* Description of the verb.
* </p>
* @ajsverbreactions
* @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
*/
A.Preverbs.tell = {
name: "tell",
prettyname: "tell about",
past_tense: "told",
synonyms: ["tellabout"],
verb_prep_noun: ["tell about"], // tell about thing
verb_noun_prep_noun: ["tell about"], // tell person about thing
/**
* @memberof tell
* @ajsverbphrase
* phrase1:
* {
* accepts_noun: true,
* requires_noun: true,
* noun_must_be:
* {
* known: true,
* present: true,
* },
* },
*/
phrase1: {
accepts_noun: true,
requires_noun: true,
noun_must_be: {
known: true,
present: true,
},
},
/**
* @memberof tell
* @ajsverbphrase
* phrase2:
* {
* accepts_noun: true,
* requires_noun: true,
* noun_must_be:
* {
* known: true,
* },
* },
*/
phrase2: {
accepts_noun: true,
requires_noun: true,
noun_must_be: {
known: true,
},
},
/**
* @memberof tell
* @ajsverbparams
* with_params: {},
*/
with_params: {},
doTry: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var indirect_object = input.getAsset(2);
var msg = "";
// no indirect object given
// if( "undefined" === typeof input.parsedNoun2 )
// {
// input.parsedNoun2 = A.clone.call(this.game, input.parsedNoun1 );
// input.parsedNoun1 = undefined;
// input.setSoftPrompt({ noun1: true, verb: 'tell' });
// var msg = "To whom would you like to tell it? ";
// this.handleFailure(msg);
// return null;
// }
// can't talk to non-characters
if (!(direct_object instanceof adventurejs.Character)) {
this.game.debug(
`F1441 | ${this.name}.js | ${direct_object.id} is not class Character `
);
msg += `${direct_object.Articlename} doesn't listen. `;
this.handleFailure(msg);
return null;
}
return true;
},
doSuccess: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var indirect_object = input.getAsset(2);
var player;
var direct_object;
var msg = "";
this.game.debug(`F1442 | ${this.name}.js | print doSuccess `);
// tell x about y
msg += `$(We) tell ${direct_object.articlename} about ${indirect_object.articlename}. `;
// transfer of knowledge
this.handleSuccess(msg, direct_object);
return true;
},
};
})(); // tell