6. Hp_potion

The Hp_potion class is used to create consumables. These potions restore a set amount of HP per use. The instances are used in conjunction with the Player.use_potionto consume the potion and restore HP. The Player.use_potion function handles removing the potion from the players inventory. After a potion is consumed, it cannot be used again, however, modifications to the engine (Chapter 8) can allow consuming potions to result in different effects or return specific items on a specific case to case basis.

More potions types along with results when consuming the potion will be in newer versions of the engine.

When creating an instance, two parameters are required:

  • name

    • The name of the potion

  • hp

    • The amount of HP the potion restores upon consumption

An instance can be created like this:

hp_potion = TARBSengine.Hp_potion("Healing Potion", 5)
# A potion with the name "Healing Potion" that restores 5 HP upon consumption

Last updated