Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// swing_on_to.js

(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @augments {adventurejs.Verb}
   * @class swing_on_to
   * @ajsnode game.dictionary.verbs.swing_on_to
   * @ajsconstruct MyGame.createVerb({ "name": "swing_on_to", [...] });
   * @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">&gt; swing on vine to branch</span>
   * You swing on the vine to the branch.
   * </pre>
   * <p>
   * <strong>Swing on to</strong> is a catchall that redirects to
   * {@link swing_to_on}.
   * </p>
   */
  A.Preverbs.swing_on_to = {
    name: "swing_on_to",
    prettyname: "swing",
    synonyms: [],
    verb_prep_noun_prep_noun: ["swing on to"],

    player_must_be: {
      not_on_floor: true,
      not_constrained: true,
      not_under: true,
      not_behind: true,
      not_nested_elsewhere: true,
    },

    phrase1: {
      accepts_noun: true,
      requires_noun: true,
      //accepts_preposition: true,
      //requires_preposition: true,
      //accepts_these_prepositions: [ 'on' ], /* @todo */
      noun_must_be: {
        known: true,
        tangible: true,
        present: true,
        visible: true,
        reachable: true,
      },
    },

    phrase2: {
      accepts_noun: true,
      requires_noun: true,
      //accepts_preposition: true,
      //requires_preposition: true,
      //accepts_these_prepositions: [ 'to' ], /* @todo */
      noun_must_be: {
        known: true,
        tangible: true,
        present: true,
        visible: true,
        //reachable: true,
        not_player_parent: true,
      },
    },

    doTry: function () {
      var input = this.game.getInput();
      var parsedNoun1 = A.clone.call(this.game, input.parsedNoun2);
      var parsedNoun2 = A.clone.call(this.game, input.parsedNoun1);
      input.parsedNoun1 = A.clone.call(this.game, parsedNoun1);
      input.parsedNoun2 = A.clone.call(this.game, parsedNoun2);
      this.game.dictionary.doVerb("swing_to_on");
      return null;
    },
  };
})(); // swing_on_to