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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Cap
   * @augments adventurejs.Thing
   * @class adventurejs.Cap
   * @ajsconstruct MyGame.createAsset({ "class":"Cap", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading MiscAssetClasses
   * @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 Not the kind you wear, but the kind you attach to another thing.
   * @tutorial Tangibles_AboutTangibles
   * @classdesc
   * <p>
   * <strong>Cap</strong> is a subclass of
   * {@link adventurejs.Thing|Thing}
   * which can be attached to / detached from a parent.
   * {@link adventurejs.Asset|Assets}
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Cap",
   *   name: "pen cap",
   *   article: "a",
   *   place: { on: "table" },
   *   descriptions: { look: "It's a cap for a pen. ", },
   * });
   * </code></pre>
   **/
  class Cap extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Cap";
      this.singlePluralPairs = [["cap", "caps"]];

      this.is.listed_in_parent = true;

      this.setDOVs([
        "put",
        "give",
        "take",
        "drop",
        "throw",
        "attach",
        "detach",
      ]);
      this.setIOVs(["attach", "detach"]);

      this.descriptions.look = "It's a cap.";
    }
  }
  adventurejs.Cap = Cap;
})();