Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// port.js
// OK 09 2023
(function () {
  /*global adventurejs A*/

  /**
   * @augments {adventurejs.Verb}
   * @class port
   * @ajsnode game.dictionary.verbs.port
   * @ajsconstruct MyGame.createVerb({ "name": "port", [...] });
   * @ajsconstructedby adventurejs.Dictionary#createVerb
   * @hideconstructor
   * @ajsinstanceof Verb
   * @ajsnavheading DirectionVerbs
   * @summary Verb meaning travel to port direction.
   * @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; port</span>
   * Against all common sense, you move to port, capsizing the small boat.
   * </pre>
   * <p>
   * Direction verb: go <strong>port</strong>.
   * To learn about {@link adventurejs.Exit|Exits},
   * see <a href="/doc/GetStarted_CreateAnExit.html">Create an Exit</a>.
   * </p>
   * @ajsverbreactions doRemoveThisFromThat, doRemoveThatFromThis, doMoveThisToThat, doMoveThatToThis
   * @ajsverbphases doBeforeTry, doAfterTry, doBeforeSuccess, doAfterSuccess
   */
  A.Preverbs.port = {
    name: "port",
    is_direction: true,
    is_relative_direction: true,
    synonyms: ["port"],
    type: { direction: true },
    adjective: "portward",

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

    doTry: function () {
      var results = this.game.tryTravel(this.name);
      if (!results) {
        this.handleFailure();
      }
      return results;
    },

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