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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Climbable.Tree
   * @augments adventurejs.Climbable
   * @class adventurejs.Tree
   * @ajsconstruct MyGame.createAsset({ "class":"Tree", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading ForestClasses
   * @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 One grows in Brooklyn.
   * @ajstangiblecontainer on
   * @classdesc
   * <p>
   * <strong>Tree</strong> is a subclass of
   * {@link adventurejs.Climbable|Climbable}.
   * Player can climb on/to/from, and swing to.
   * </p>
   **/
  class Tree extends adventurejs.Climbable {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Tree";

      this.singlePluralPairs = [["tree", "trees"]];
      this.group = [];
      this.dimensions.height = 3;
      this.can.jump_to = true;
      this.can.jump_from = true;
      this.can.swing_to = true;
      this.is.climbable = true;

      this.default_posture_for_swing_to = "hang";

      this.setDOV("hang");

      this.aspects.on.set({
        list_in_room: true,
        player: { posture: "hang" },
      });

      this.aspects.hung = new adventurejs.Aspect("hung", this.game_name).set({
        parent_id: this.id,
        list_in_room: true,
      });
    }
  }
  adventurejs.Tree = Tree;
})();