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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Eraser
   * @augments adventurejs.Thing
   * @class adventurejs.Eraser
   * @ajsconstruct MyGame.createAsset({ "class":"Eraser", "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 Fixes all mistakes. Or at least the ones in pencil.
   * @todo Erase specific writing?
   * @classdesc
   * <p>
   * <strong>Eraser</strong> is a subclass of
   * {@link adventurejs.Thing|Thing}, and is chiefly notable
   * in that it has
   * <code class="property">dov.erase</code>
   * set to true, which allows a player to erase things
   * they have written on Assets that have
   * <code class="property">dov.write</code>
   * set to true, such as {@link adventurejs.Paper|Paper}.
   * </p>
   * <p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Eraser",
   *   name: "frog eraser",
   *   article: "the",
   *   place: { on: "table" },
   *   descriptions: { look: "It's an eraser in the shape of a frog. ", },
   * });
   * MyGame.createAsset({
   *   class: "Pencil",
   *   name: "chewed pencil",
   *   article: "a",
   *   place: { on: "table" },
   *   descriptions: { look: "It's a #2 pencil with teeth marks and a worn out eraser. ", },
   * });
   * MyGame.createAsset({
   *   class: "Paper",
   *   name: "construction paper",
   *   descriptions: { look: "It's a yellow sheet of construction paper. ", },
   *   adjectives: ["yellow"],
   *   place: { on: "table" },
   * });
   * </code></pre>
   **/
  class Eraser extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Eraser";

      this.singlePluralPairs = [["eraser", "erasers"]];

      this.setDOVs(["take", "give", "put"]);
      this.setIOV("erase");
    }
  }

  adventurejs.Eraser = Eraser;
})();