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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Key.SkeletonKey
   * @augments adventurejs.Key
   * @class adventurejs.SkeletonKey
   * @ajsconstruct MyGame.createAsset({ "class":"SkeletonKey", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading KeyClasses
   * @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 SkeletonKeys can be used to unlock...anything?
   * @tutorial CreateKey
   * @classdesc
   * <p>
   * <strong>SkeletonKey</strong> is a subclass of
   * {@link adventurejs.Key|Key}
   * that can be used to unlock any locked
   * {@link adventurejs.Asset|Assets}.
   * Of course it can't actually unlock anything by default.
   * Verb subscriptions can be set to allow entire classes
   * to apply verbs to each other. In this case, either the
   * assets to be unlocked will need an indirect verb
   * subscription:
   * <code class="property">asset.dov.unlock.with_classes = ["SkeletonKey"]</code>;
   * or the key asset will need a direct verb subscription:
   * <code class="property">asset.iov.unlock.with_classes = ["Lock"]</code>.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "SkeletonKey",
   *   name: "skeleton key",
   *   place: { in: "Treasure Room" },
   *   iov: { pick: { with_classes: ['Door'], }, },
   * });
   * MyGame.createAsset({
   *   class: "Door",
   *   name: "iron door",
   *   place: { in: "Treasure Room" },
   *   is: {
   *     closed: true,
   *     locked: true,
   *   },
   *   dov: { unlock: { with_classes: ['SkeletonKey'], }, },
   * });
   * </code></pre>
   **/
  class SkeletonKey extends adventurejs.Key {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "SkeletonKey";

      this.singlePluralPairs = [["skeleton key", "skeleton keys"]];
    }
  }
  adventurejs.SkeletonKey = SkeletonKey;
})();