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.Assets.Potable
   * @class AdventureJS.Assets.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.Assets.Potable {
    constructor(name, game_name, context_id = "", id = "") {
      super(name, game_name, context_id, id);
      this.class = "Potion";
      this.singular = "potion";
      this.plural = "potions";
      this.singularPluralPairs = [["potion", "potions"]];

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

  AdventureJS.Assets.Potion = Potion;
})();