// jumpTo.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @augments {adventurejs.Verb}
* @class jumpTo
* @ajsnode game.dictionary.verbs.jumpTo
* @ajsconstruct MyGame.createVerb({ "name": "jumpTo", [...] });
* @ajsconstructedby adventurejs.Dictionary#createVerb
* @hideconstructor
* @ajsinstanceof Verb
* @ajsnavheading DeprecatedVerbs
* @summary Summary.
* @todo check can.jump_to and things_player_can_jump_to_from_this
* @tutorial Scripting_VerbSubscriptions
* @tutorial Verbs_VerbAnatomy
* @tutorial Verbs_VerbProcess
* @tutorial Verbs_ModifyVerbs
* @tutorial Verbs_WriteVerbs
* @classdesc
* <pre class="display border outline">
* <span class="input">> jump to parapet</span>
* You jump to the parapet. Beyond the low wall sprawls a rolling
* landscape of fields and dells. Deer graze in the fields.
* A nearby path leads to distant foothills.
* </pre>
* <p>
* <strong>Jump to</strong> a
* {@link adventurejs.Tangible|Tangible}
* {@link adventurejs.Asset|Asset}
* <strong>Jump to</strong> is a catchall that redirects to
* {@link jumpOn} or
* {@link jumpFrom_to}
* depending on whether player is nested in another Asset.
* </p>
*/
A.Preverbs.jumpTo = {
name: "jumpTo",
prettyname: "jump to",
synonyms: [],
verb_prep_noun: ["jump to"],
verb_prep_prep_noun: ["jump over to"],
player_must_be: {
not_constrained: true,
not_on_floor: true,
not_nested_elsewhere: true,
},
phrase1: {
accepts_noun: true,
requires_noun: true,
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 output_class = input.output_class;
var player = this.game.getPlayer();
var nest_preposition = player.getNestPreposition();
var nest_parent_id = player.getNestId();
var nest_parent_object = player.getNestAsset();
if (false === player.isNested()) {
this.game.dictionary.doVerb("jumpOn");
return null;
}
// if player is nested, redirect to jumpfromto
if (player.isNested()) {
input.parsedNoun2 = A.clone.call(this.game, input.parsedNoun1);
input.parsedNoun1 = new adventurejs.ParsedNoun(nest_parent_object);
input.input_verb = "jumpTo";
this.game.dictionary.doVerb("jumpFrom_to");
return null;
}
return true;
},
doSuccess: function () {
var input = this.game.getInput();
var direct_object = input.getAsset(1);
var output_class = input.output_class;
var player = this.game.getPlayer();
var nest_parent_id = player.getNestId();
var nest_parent_object = player.getNestAsset();
// If direct_object is an exit/aperture, we already shunted to "enter".
/**
* The phrase "get on" is less vague than its partner phrase
* "get in", but still a bit vague about the preposition,
* which could mean "in" or "on" in the case of a chair,
* and the posture which could mean "sit" or "lie" or "stand"
* in the case of a bed.
* So we check default_aspect_for_go_on
* and default_posture_for_go_on for context.
*/
// var posture;
// if( direct_object.can_stand_on ) {
// posture = "stand";
// }
// else {
// posture = direct_object.default_posture_for_go_on.toLowerCase();
// }
// var preposition = direct_object.default_aspect_for_go_on.toLowerCase();
// var msg = "$(We) ";
// if( player.isOnFloor() ) {
// msg += "get up and ";
// }
// msg += "jump to "
// + direct_object.articlename
// + ". ";
// // DO THE THING!
// var results;
// if( player.isNested() )
// {
// results = player.onUnnestThisFromThat( nest_parent_object );
// if( false === results ) { return false; }
// else if ( null === results ) { return null; }
// }
// results = player.onNestThisToThat( direct_object, preposition );
// if( false === results ) { return false; }
// else if ( null === results ) { return null; }
// player.posture = posture;
// this.handleSuccess( msg, direct_object );
// return params
},
};
})(); // jumpTo