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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.WritingSurface.Blackboard
   * @augments adventurejs.WritingSurface
   * @class adventurejs.Blackboard
   * @ajsconstruct MyGame.createAsset({ "class":"Blackboard", "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 blackboard that can be written on and erased.
   * @classdesc
   * <p>
   * <strong>Blackboard</strong> is a subclass of
   * {@link adventurejs.WritingSurface|WritingSurface} with
   * <code class="property">asset.dov.write.enabled</code> and its
   * <code class="property">asset.dov.erase.enabled</code> properties 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">asset.dov.erase.enabled</code>
   * allows it to be erased and
   * <code class="property">asset.dov.erase.with_nothing</code>
   * allows it to be erased without an eraser.
   * With Blackboard's
   * <code class="property">append_written_strings_to_description</code>
   * property set to true, anything written
   * on it can be included in the Blackboard's description.
   * </p>
   * <pre class="display border outline">
   * <span class="input">&gt; write "I will not poop in class" on blackboard
   * You write "I will not poop in class" on the blackboard with the chalk.
   *
   * <span class="input">&gt; examine blackboard
   * It's a big blackboard. Written on it is a phrase: "I will not poop in class".
   * </pre>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Blackboard",
   *   name: "blackboard",
   *   descriptions: { look: "It's a big gradeschool-style blackboard. ", },
   *   place: { in: "Schoolroom" },
   * });
   * </code></pre>
   **/
  class Blackboard extends adventurejs.WritingSurface {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Blackboard";

      this.synonyms = [
        "blackboard",
        "chalkboard",
        "black board",
        "chalk board",
      ];
      this.setDOV({ erase: { with_nothing: true } });
      this.setDOV({ write: { with_classes: "Chalk" } });
      this.unsetDOV("take");
    }
  }
  adventurejs.Blackboard = Blackboard;
})();