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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Paper
   * @augments adventurejs.Thing
   * @class adventurejs.Paper
   * @ajsconstruct MyGame.createAsset({ "class":"Paper", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading WritingClasses
   * @param {String} game_name The name of the top level game object.
   * @param {String} name A name for the object, to be serialized and used as ID.
   * @summary A sheet of paper that can be typed on or written on.
   * @classdesc
   * <p>
   * <strong>Paper</strong> is a subclass of
   * {@link adventurejs.Thing|Thing} with
   * <code class="property">asset.dov.write.enabled</code> and
   * <code class="property">can.be_typed_on</code> set to true.
   * <code class="property">asset.dov.write.enabled</code> allows it to receive
   * strings using the
   * {@link adventurejs.Verb|Verb} {@link write}.
   * <code class="property">can.be_typed_on</code> allows it to receive
   * strings typed on a
   * {@link adventurejs.Typewriter|Typewriter}
   * using the Verb {@link type}.
   * With Paper's
   * <code class="property">append_written_strings_to_description</code>
   * property set to true, anything written or typed
   * on it can be included in the Paper's description.
   * </p>
   * <pre class="display border outline">
   * <span class="input">&gt; write "cordon bleu" on blue sheet
   * You write "cordon bleu" on the blue sheet with the blue pencil.
   *
   * <span class="input">&gt; examine blue sheet
   * It's a blue sheet of paper. Written on the blue sheet is a phrase: "cordon bleu".
   * </pre>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Paper",
   *   name: "blue sheet",
   *   descriptions: { look: "It's a blue sheet of paper. ", },
   *   place: { in: "middle drawer" },
   * });
   * MyGame.createAsset({
   *   class: "Paper",
   *   name: "goldenrod sheet",
   *   descriptions: { look: "It's a goldenrod sheet of paper. ", },
   *   place: { in: "bottom drawer" },
   * });
   * MyGame.createAsset({
   *   class: "Paper",
   *   name: "pink sheet",
   *   descriptions: { look: "It's a pink sheet of paper. ", },
   *   place: { in: "top drawer" },
   * });
   * MyGame.createAsset({
   *   class: "Typewriter",
   *   name: "typewriter",
   *   place: { on: "desk" },
   *   descriptions: { look: "It's a top of the line IBM Selectric typewriter. ", },
   *   dov: { take: false, },
   * });
   * </code></pre>
   **/
  class Paper extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Paper";

      this.synonyms = ["paper"];
      this.setDOVs(["take", "give", "tear", "write"]);
      this.setIOV("type"); // ?

      this.append_written_strings_to_description = true;
    }
  }

  adventurejs.Paper = Paper;
})();