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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.FloorChasm
   * @augments adventurejs.Thing
   * @class adventurejs.FloorChasm
   * @ajsconstruct MyGame.createAsset({ "class":"FloorChasm", "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 A chasm or gap or pit in the floor.
   * @todo Does this need to be more thoroughly implemented?
   * @classdesc
   * <p>
   * <strong>FloorChasm</strong> is a chasm or gap or pit in the floor,
   * intended as an obstacle which a player might need to puzzle out a
   * way to cross.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <p>
   * This example shows a FloorChasm separating two
   * {@link adventurejs.Platform|Platforms}, with the
   * idea that a player might swing across the chasm.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "FloorChasm",
   *   name: "deep chasm",
   *   place: { in: "Bottomless Chasm" },
   *   descriptions: { look: "It's a deep chasm. ", },
   *   is: { listed_in_room: false },
   *   things_player_can_swing_to_across_this: [
   *     "east side of chasm",
   *     "west side of chasm"
   *   ],
   *   can: { swing_across: true },
   * });
   *
   * MyGame.createAsset({
   *   class: "Platform",
   *   name: "east side of the chasm",
   *   place: { in: "Bottomless Chasm" },
   *   descriptions: { look: "The east side of the deep chasm.", },
   *   things_player_can_swing_to_from_this: "west side of the chasm",
   * });
   *
   * MyGame.createAsset({
   *   class: "Platform",
   *   name: "west side of the chasm",
   *   place: { in: "Bottomless Chasm" },
   *   descriptions: { look: "The west side of the deep chasm.", },
   *   things_player_can_swing_to_from_this: "east side of the chasm",
   *   things_player_can_reach_from_this: [ "vine" ],
   * });
   * </code></pre>
   **/
  class FloorChasm extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "FloorChasm";

      this.can.float_over = true;
      this.can.fly_over = true;
      this.can.hover_over = true;
      this.can.jump_in = true;
      this.can.jump_across = true;
      this.can.jump_over = true;
      this.can.swing_across = true;

      this.is_bottomless = true;
    }
  }

  adventurejs.FloorChasm = FloorChasm;
})();