Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// exits.js
// OK 09 2023
/**
 *
 */
(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @augments {adventurejs.Verb}
   * @class exits
   * @ajsnode game.dictionary.verbs.exits
   * @ajsconstruct MyGame.createVerb({ "name": "exits", [...] });
   * @ajsconstructedby adventurejs.Dictionary#createVerb
   * @hideconstructor
   * @ajsinstanceof Verb
   * @ajsnavheading UtilityVerbs
   * @summary Verb that returns a list of available verbs.
   * @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; exits</span>
   * You can go out to the Playground, north to the
   * North Room, down through the hole in the ground,
   * south, east to the East Room, or west.
   * </pre>
   * <p>
   * <strong>Exits</strong> prints a list of available Exits.
   * </p>
   */
  A.Preverbs.exits = {
    name: "exits",
    synonyms: ["exits"],

    /**
     * @ajsverbstructures
     * @memberof exits
     */
    accepts_structures: ["verb"],

    do: function () {
      var input = this.game.getInput();
      var exits = this.game.getCurrentRoomExits();
      if (exits) {
        this.game.print(exits, input.output_class);
      }
      return true;
    },
  };
})();