Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// jump.js

(function () {
  /*global adventurejs A*/

  /**
   * @augments {adventurejs.Verb}
   * @class jump
   * @ajsnode game.dictionary.verbs.jump
   * @ajsconstruct MyGame.createVerb({ "name": "jump", [...] });
   * @ajsconstructedby adventurejs.Dictionary#createVerb
   * @hideconstructor
   * @ajsinstanceof Verb
   * @ajsnavheading LocomotionVerbs
   * @summary Verb meaning jump [preposition] asset, or travel [direction].
   * @ajssynonyms jump, hop
   * @todo if nested on thing like vine, let go/fall
   * @tutorial Scripting_VerbSubscriptions
   * @tutorial Verbs_VerbAnatomy
   * @tutorial Verbs_VerbProcess
   * @tutorial Verbs_ModifyVerbs
   * @tutorial Verbs_WriteVerbs
   * @classdesc
   * <pre class="display border outline">
   * <span class="input">&gt; jump</span>
   * You take a small jump!
   * </pre>
   * <p>
   * <strong>Jump</strong> behaves differently depending on player's
   * context, whether they're nested in another object.
   * Authors wanting to make use of it may want to modify the verb
   * to offer different results.
   * See
   * <a href="/doc/Verbs_ModifyVerbs.html">Modify Verbs</a>
   * to learn more.
   * </p>
   * @ajsverbreactions doRemoveThisFromThat, doRemoveThatFromThis, doMoveThisToThat, doMoveThatToThis
   * @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
   */
  A.Preverbs.jump = {
    name: "jump",
    prettyname: "jump",
    past_tense: "jumped",
    synonyms: ["jump"],
    verb_prep_noun: ["jump up"],
    extends: { go: true },
    gerund: "jumping",
    posture: "stand",
    override_aspect_scale_increments: { up: false, down: true },
    override_aspect_posture: true,
    can_span: true,
    default_direction: "off",

    player_must_be: {
      not_constrained: true,
      not_on_floor: true,
      //not_nested_elsewhere: true,
      able_to_jump: true,
    },

    /**
     * @ajsadverbs
     * @memberof jump
     */
    accepts_adverbs: ["left", "right", "around", "back", "towards", "over"],

    /**
     * @ajsverbstructures
     * @memberof jump
     */
    accepts_structures: [
      "verb", // jump
      "verb noun", // jump east, jump bed
      // "verb preposition", // jump up
      "verb preposition noun",
      // jump on bed, jump in lake, jump over puddle, jump to train
      "verb noun noun", // to accommodate phrasal patterns
      "verb preposition noun preposition noun", // jump from trellis to branch
    ],

    /**
     * @memberof jump
     * @ajsverbphrase
     * phrase1:
     * {
     *   accepts_noun:true,
     *   noun_must_be:
     *   {
     *     known: true,
     *     tangible: true,
     *     present: true,
     *     visible: true,
     *     reachable: true,
     *   },
     *   accepts_preposition: true,
     * },
     */
    phrase1: {
      accepts_noun: true,
      // requires_noun: true,
      noun_must_be: {
        known: true,
        tangible: true,
        present: true,
        visible: true,
        reachable: true,
      },
      accepts_preposition: true,
      // requires_preposition: true,
    },

    /**
     * @memberof jump
     * @ajsverbphrase
     * phrase2:
     * {
     *   accepts_noun:true,
     *   noun_must_be:
     *   {
     *     known: true,
     *     tangible: true,
     *     present: true,
     *     visible: true,
     *     reachable: true,
     *   },
     *   accepts_preposition: true,
     * },
     */
    phrase2: {
      accepts_noun: true,
      requires_noun: true,
      noun_must_be: {
        known: true,
        tangible: true,
        present: true,
        visible: true,
        reachable: true,
      },
      accepts_preposition: true,
      // requires_preposition: true,
    },

    in_can_mean_on: true,

    doTry: function () {
      return this.game.dictionary.doVerb("go");
    },

    doSuccess: function () {
      return this.handleSuccess();
    },
  }; // jump
})();