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

  /**
   * @class adventurejs.Outrocard
   * @ajsinternal
   * @param {Game} game A reference to the game instance.
   * @ajsnavheading FrameworkClasses
   * @summary Manages the outrocard for a {@link adventurejs.Game|Game} instance.
   * @classdesc
   * <p>
   * <strong>Outrocard</strong> can be used to print a completion screen
   * when a player reaches an end state of the game (win, lose, or draw).
   * Outrocard is created
   * automatically by {@link adventurejs.Game|Game}. This is an internal
   * class that authors should not need to construct. However, authors
   * can set title options from their game file as shown below.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
   * MyGame.Outrocard.set({
   * });
   * </code></pre>
   */
  class Outrocard {
    constructor(game) {
      this.game = game;
      this.text = ``;
      this.prompt_text = ``;
      this.prompt_to_continue = false;
      this.clear_on_continue = false;
      this.hide_statusbar = false;
      this.show_statusbar_on_continue = false;
      this.hide_titlebar = false;
      this.show_titlebar_on_continue = false;
    }

    /**
     * Provides a chainable shortcut method for setting a number of properties on the instance.
     * @method adventurejs.Outrocard#set
     * @param {Object} props A generic object containing properties to copy to the instance.
     * @returns {adventurejs.Outrocard} Returns the instance the method is called on (useful for chaining calls.)
     * @chainable
     */
    set(outrocard) {
      for (let prop in outrocard) {
        this[prop] = outrocard[prop];
      }

      return this;
    }
  }
  adventurejs.Outrocard = Outrocard;
})();