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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Cap.PenCap
   * @augments adventurejs.Cap
   * @class adventurejs.PenCap
   * @ajsconstruct MyGame.createAsset({ "class":"PenCap", "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 cap for a pen.
   * @classdesc
   * <p>
   * <strong>PenCap</strong> is a subclass of Cap, with the idea
   * being that it only attaches to / detaches from a
   * {@link adventurejs.Pen|Pen}. However, the attachment is
   * determined by the Pen's
   * <code class="property">attached.with_classes</code>
   * property, which is set to PenCap. To learn more, see the
   * {@link adventurejs.Pen|Pen} class, or
   * <a href="/doc/Tangibles_Aspects.html">How to Use Aspects</a>.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Pen",
   *   name: "blue pen",
   *   article: "a",
   *   adjectives: "blue",
   *   place: { on: "table" },
   *   descriptions: { look: "It's a pen with blue ink. ", },
   * });
   * MyGame.createAsset({
   *   class: "Pen",
   *   name: "red pen",
   *   article: "a",
   *   adjectives: "red",
   *   place: { on: "table" },
   *   descriptions: { look: "It's a pen with red ink. ", },
   * });
   * MyGame.createAsset({
   *   class: "PenCap",
   *   name: "pen cap",
   *   article: "a",
   *   place: { on: "table" },
   *   descriptions: { look: "It's a cap for a pen. ", },
   * });
   * </code></pre>
   * <p>
   * The above example uses <code class="property">with_classes</code>
   * and <code class="property">with_assets</code> to limit what a
   * player can put in without having to write custom
   * failure code for every object. To learn more, see
   * <a href="/doc/Tangibles_Aspects.html">How to Use Aspects</a>.
   * </p>
   **/
  class PenCap extends adventurejs.Cap {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "PenCap";
    }
  }
  adventurejs.PenCap = PenCap;
})();