Class AttackPotion
java.lang.Object
com.csse3200.game.inventory.items.AbstractItem
com.csse3200.game.inventory.items.ConsumableItem
com.csse3200.game.inventory.items.TimedUseItem
com.csse3200.game.inventory.items.potions.AttackPotion
-
Field Summary
Fields inherited from class com.csse3200.game.inventory.items.TimedUseItem
effectAmount, effectStartTime, gameTime, warn
Fields inherited from class com.csse3200.game.inventory.items.AbstractItem
description, itemCode, limit, name, onlyCombatItem, onlyMapItem, quantity
-
Constructor Summary
ConstructorsConstructorDescriptionAttackPotion
(int quantity) Constructs a newHealingPotion
with the specified quantity and a default healing effect. -
Method Summary
Modifier and TypeMethodDescriptionvoid
update
(ItemUsageContext context) Updates the potion state, checking if the effect duration has elapsed.void
useItem
(ItemUsageContext context) Uses the potion by applying its effects and decreasing its number of uses.Methods inherited from class com.csse3200.game.inventory.items.TimedUseItem
getDuration, getGameTime, getWarning
Methods inherited from class com.csse3200.game.inventory.items.AbstractItem
add, getDescription, getItemCode, getLimit, getName, getQuantity, getTexturePath, isEmpty, numAddable, onlyCombatItem, onlyMapItem, setDescription, setTexturePath
-
Constructor Details
-
AttackPotion
public AttackPotion(int quantity) Constructs a newHealingPotion
with the specified quantity and a default healing effect.- Parameters:
quantity
- the number of uses this potion has
-
-
Method Details
-
useItem
Uses the potion by applying its effects and decreasing its number of uses. If no uses are left, the potion is marked as empty.- Overrides:
useItem
in classTimedUseItem
- Parameters:
context
- the context in which the item is used (contains a Player to use on)
-
update
Updates the potion state, checking if the effect duration has elapsed.- Specified by:
update
in classTimedUseItem
- Parameters:
context
- the context in which the item is used (contains a Player to use on)
-