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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Furniture.Bed
   * @augments adventurejs.Furniture
   * @class adventurejs.Bed
   * @ajsconstruct MyGame.createAsset({ "class":"Bed", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading FurnitureClasses
   * @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 Zzzzzzzbuhbuhbuhbuhbuhzzzzz.
   * @tutorial Tangibles_AboutTangibles
   * @ajstangiblecontainer on
   * @ajstangiblecontainer under
   * @classdesc
   * <p>
   * <strong>Bed</strong> is child class of
   * {@link adventurejs.Furniture|Furniture}. Player can sit on it, lie on it,
   * go under it, jump on it, put things on it, etc. By default,
   * beds are set so that
   * "lie in" and "lie on" are interchangeable, via the
   * <a href="#quirks.in_means_on">quirks.in_means_on</a>
   * property.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Bed",
   *   name: "uncomfortable looking bed",
   *   place: { in: "cell" },
   *   descriptions: { look: "It's a thin, uncomfortable looking bed. ", },
   *   adjectives: "uncomfortable, thin",
   *   things_player_can_jump_to_from_this: [ "grate" ],
   *   indefinite_article: "an", // so it's listed as 'an uncomfortable looking bed'
   *   behind: {
   *     // by default, Bed class hasn't got a behind {@link adventurejs.Aspect|Aspect}
   *     // this is a shortcut method to create a custom Aspect
   *     // on a class instance
   *     "class": "Aspect",
   *     "parent_id": "uncomfortable_looking_bed",
   *     "list_in_examine": true,
   *     "list_in_room": true,
   *   }
   * });
   * </code></pre>
   **/
  class Bed extends adventurejs.Furniture {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Bed";

      this.noun = "bed";
      this.plural = "beds";
      this.singlePluralPairs = [["bed", "beds"]];

      this.default_aspect = "on";
      this.quirks.in_means_on = true;
      this.quirks.get_up_means_get_off = true;
      this.quirks.stand_means_get_off = true;

      this.can.jump_to = true;
      this.can.jump_from = true;
      this.aspects.on.set({
        list_in_room: true,
        list_in_examine: true,
        maxheight: 1,
        maxwidth: 6,
        maxdepth: 3,
        maxcount: 10,
        maxsize: 10,
        maxweight: 100,
        player: {
          posture: "lie",
          preposition: "on",
          can: {
            bounce: true,
            crawl: true,
            enter: true,
            exit: false,
            hide: true,
            jump: true,
            kneel: true,
            lie: true,
            sit: true,
            stand: true,
          },
        },
      });

      this.aspects.under = new adventurejs.Aspect("under", this.game_name).set({
        parent_id: this.id,
        list_in_room: false,
        list_in_examine: true,
        maxheight: 1,
        maxwidth: 6,
        maxdepth: 3,
        maxcount: 10,
        maxsize: 10,
        maxweight: 100,
        player: {
          posture: "lie",
          can: {
            bounce: true,
            crawl: true,
            enter: true,
            exit: false,
            hide: true,
            jump: true,
            kneel: true,
            lie: true,
            sit: true,
            stand: true,
          },
        },
      });
    }
  }

  adventurejs.Bed = Bed;
})();