Pre-release
AdventureJS Docs Downloads Bundler Devlog Score: 0 Moves: 0
// Waterbody.js
(function () {
  /* global AdventureJS A */

  /**
   * @ajspath AdventureJS.Atom.Asset.Tangible.Entity.Reservoir.Waterbody
   * @augments AdventureJS.Assets.Reservoir
   * @class AdventureJS.Assets.Waterbody
   * @ajsconstruct MyGame.createAsset({ "class": "Waterbody", "name": "foo", [...] })
   * @ajsconstructedby AdventureJS.Game#createAsset
   * @ajsnavheading ReservoirClasses
   * @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 base class for all kinds of containers which hold liquid.
   * @ajssubstancecontainer in
   * @ajstangiblecontainer in
   * @classdesc <strong>Waterbody</strong> is a child class
   * of {@link AdventureJS.Assets.Reservoir|Reservoir}, an infinite substance
   * container that is part of the landscape.
   * It can be filled from, drunk from, and have things poured into it.
   * Unlike with smaller substance containers, no substance mixing will
   * occur if other substances are poured into it.
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Waterbody",
   *   name: "Dog Ocean",
   *   descriptions: { look: "It's unclear why the ocean was named Dog Ocean. ", },
   *   contains: "salt water",
   * });
   * </code></pre>
   **/
  class Waterbody extends AdventureJS.Assets.Reservoir {
    constructor(name, game_name, context_id = "", id = "") {
      super(name, game_name, context_id, id);
      this.class = "Waterbody";

      this.setDOVs(["drink", "enter", "swim", "jump", "exit"]);
      this.setIOVs(["fill", "empty", "pour", "dip"]);

      this.aspects.in.nest.set({
        posture: "float",
        can: {
          // travel
          enter: true,
          exit: true,

          // locomotion
          swim: true,

          // posture
          float: true,

          // sensory
        },
      });

      this.contains = "water";
    }

    initialize(game) {
      super.initialize(game);
      return this;
    }
  }
  AdventureJS.Assets.Waterbody = Waterbody;
})();