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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Aperture.Hole.Manhole
   * @augments adventurejs.Hole
   * @class adventurejs.Manhole
   * @ajsconstruct MyGame.createAsset({ "class":"Manhole", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading DoorExitClasses
   * @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 Best game of 1988. I just downloaded a copy for iOS!
   * @tutorial CreateExit
   * @classdesc
   * <p>
   * <strong>Manhole</strong> is a subclass of
   * {@link adventurejs.Aperture|Aperture} /
   * {@link adventurejs.Hole|Hole}. Manholes can be sealed
   * with a cover.
   * Manholes are singular, meaning they only exist in one Room.
   * To allow two-way travel between Rooms, you must have two
   * Manholes, each with its <a href="#linked_asset">linked_asset</a>
   * property set to the other Hole. Following is an example
   * with two Manholes + exits.
   * </p>
   * <h3 class="example">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Exit",
   *   direction: "down",
   *   place: { in: "Street" },
   *   destination: "Sewer",
   *   aperture: "spooky manhole"
   * });
   * MyGame.createAsset({
   *   class: "Manhole",
   *   name: "spooky manhole",
   *   place: { in: "Street" },
   *   direction: "down",
   *   linked_asset: "bright manhole",
   *   dov: {
   *     seal: { with_assets: [ 'manhole cover' ],
   *     unseal: { with_assets: [ 'manhole cover' ],
   *   }, },
   *   is: { closed: true },
   * });
   * MyGame.createAsset({
   *   class: "ManholeCover",
   *   name: "manhole cover",
   *   iov: {
   *     seal: { with_assets: [ 'spooky manhole' ],
   *     unseal: { with_assets: [ 'spooky manhole' ],
   *   }, },
   * });
   * MyGame.createAsset({
   *   class: "Exit",
   *   direction: "up",
   *   place: { in: "Sewer" },
   *   destination: "Street",
   *   aperture: "bright manhole"
   * });
   * MyGame.createAsset({
   *   class: "Manhole",
   *   name: "bright manhole",
   *   place: { in: "Sewer" },
   *   direction: "up",
   *   linked_asset: "spooky manhole"
   * });
   * </code></pre>
   **/
  class Manhole extends adventurejs.Aperture {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Manhole";

      this.noun = "manhole";
      this.plural = "manholes";
      this.singlePluralPairs = [
        ["manhole", "manholes"],
        ["hole", "holes"],
      ];

      this.setDOVs(["seal", "unseal"]);
    }
  }
  adventurejs.Manhole = Manhole;
})();