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

  /**
   * @augments {adventurejs.Verb}
   * @class quit
   * @ajsnode game.dictionary.verbs.quit
   * @ajsconstruct MyGame.createVerb({ "name": "quit", [...] });
   * @ajsconstructedby adventurejs.Dictionary#createVerb
   * @hideconstructor
   * @ajsinstanceof Verb
   * @ajsnavheading UtilityVerbs
   * @summary Verb meaning replace unknown word with new input.
   * @tutorial Verbs_Subscriptions
   * @tutorial AdvancedVerbs_VerbAnatomy
   * @tutorial AdvancedVerbs_VerbProcess
   * @tutorial AdvancedVerbs_ModifyVerbs
   * @tutorial AdvancedVerbs_ModifyVerbs
   * @classdesc
   * <pre class="display border outline">
   * <span class="ajs-player-input">&gt; quit</span>
   * You can't quit, you're fired!
   * </pre>
   * <p>
   * <strong>quit</strong> quits the game.
   * </p>
   * @TODO does quit auto-save?
   */
  A.Preverbs.quit = {
    name: "quit",
    synonyms: ["q"],

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

    /**
     * @memberof quit
     * @ajsverbphrase
     * phrase1:
     * {
     *   accepts_noun: true,
     *   requires_noun: true,
     * },
     */
    phrase1: {
      accepts_noun: true,
    },

    let_verb_handle_disambiguation: true,
    let_verb_handle_remaining_input: true,
    msgNoObject: "You can't quit, you're fired!",

    do: function () {
      var input = this.game.getInput();

      this.game.log("L1577", "log", "high", "quit ", "verbs");

      // @TODO

      let msg = `You can't quit, you're fired! `;
      return this.handleSuccess(msg);
    },
  };
})();