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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Potion
   * @augments adventurejs.Thing
   * @class adventurejs.Potion
   * @ajsconstruct MyGame.createAsset({ "class":"Potion", "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 Thing to put things in.
   * @classdesc
   * <p>
   * <strong>Potion</strong> that does not actually contain
   * any substance but which can be drunk and is destroyed
   * on drinking.
   * </p>
   **/
  class Potion extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Potion";

      this.setDOV({ drink: { then_destroy: true } });
      this.setDOVs(["take", "give"]);
      this.on_drink_destroy = true;
    }
  }

  adventurejs.Potion = Potion;
})();