// swing_across.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @augments {adventurejs.Verb}
* @class swing_across
* @ajsnode game.dictionary.verbs.swing_across
* @ajsconstruct MyGame.createVerb({ "name": "swing_across", [...] });
* @ajsconstructedby adventurejs.Dictionary#createVerb
* @hideconstructor
* @ajsinstanceof Verb
* @ajsnavheading DeprecatedVerbs
* @summary Summary.
* @tutorial Scripting_VerbSubscriptions
* @tutorial Verbs_VerbAnatomy
* @tutorial Verbs_VerbProcess
* @tutorial Verbs_ModifyVerbs
* @tutorial Verbs_WriteVerbs
* @classdesc
* <pre class="display border outline">
* <span class="input">> swing across marsh</span>
* You swing across the crocodile infested marsh. The crocodiles
* grumpf with disappointment.
* </pre>
* <p>
* <strong>Swing across</strong> a
* {@link adventurejs.Tangible|Tangible}
* {@link adventurejs.Asset|Asset}.
* Requires that the Asset has its
* <a class="code" href="/doc/adventurejs.Tangible.html#property_can_swing_across">can.swing_across</a>
* property set to true.
* The verb is intended for statements like
* <code class="property">swing across chasm<code>,
* but no special logic is provided.
* 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>
*/
A.Preverbs.swing_across = {
name: "swing_across",
prettyname: "swing across",
synonyms: [],
verb_prep_noun: ["swing across", "swing over"],
player_must_be: {
not_on_floor: true,
not_constrained: true,
not_under: true,
not_behind: true,
},
phrase1: {
accepts_noun: true,
requires_noun: true,
//accepts_preposition: true,
//requires_preposition: true,
//accepts_these_prepositions: [ 'across', 'over', 'to' ], /* @todo */
noun_must_be: {
known: true,
tangible: true,
present: true,
visible: true,
//reachable: true,
},
},
doTry: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var player = this.game.getPlayer();
var nest_preposition = player.getNestPreposition();
var nest_parent_id = player.getNestId();
var nest_parent_object = player.getNestAsset();
// not something you could be on anyway
if (false === direct_object.can.swing_across) {
var msg =
"$(We) can't swing across " + direct_object.articlename + ". ";
this.handleFailure(msg);
return null;
}
// nested
//if( player.isNested() )
// {
// is player's nest in direct_object's list of
//}
// not nested
return true;
},
doSuccess: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var player = this.game.getPlayer();
var nest_preposition = player.getNestPreposition();
var nest_parent_id = player.getNestId();
var nest_parent_object = player.getNestAsset();
var results;
var msg = "$(We) swing across " + direct_object.articlename + ". ";
//var msg = "Perhaps $(we) should try swinging swinging to or from something. ";
// nested
// results = player.onUnnestThisFromThat( nest_parent_object );
// if( false === results ) { return false; }
// else if ( null === results ) { return null; }
// not nested
this.handleSuccess(msg, direct_object);
return true;
},
};
})(); // swing_across