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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Potable.Potion
   * @augments adventurejs.Potable
   * @class adventurejs.Potion
   * @ajsconstruct MyGame.createAsset({ "class":"Potion", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading FoodDrinkClasses
   * @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 potion to be drunk.
   * @classdesc
   * <strong>Potion</strong> that does not actually contain
   * any substance but which can be drunk and is destroyed
   * on drinking.
   **/
  class Potion extends adventurejs.Potable {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Potion";

      this.setDOV({ drink: { then_destroy: true } });
    }
  }

  adventurejs.Potion = Potion;
})();