Class Food
java.lang.Object
org.progettoedids.entities.Entity
org.progettoedids.entities.items.Item
org.progettoedids.entities.items.food.Food
- All Implemented Interfaces:
InteractiveItem
An instance of
Food is an Item that restores a certain amount of health to the Player.
The amount of health to restore is specified by a subclass of Food.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the amount of health this food Instance can restorevoidinteractWithItem(CommandLogger commandLogger, Labyrinth labyrinth, String args) Interacts with the user and add a certain amount of health to the Player.toString()Methods inherited from class org.progettoedids.entities.items.Item
canBeCollected, getWeightMethods inherited from class org.progettoedids.entities.Entity
getName, getSystemName, getUUID, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.progettoedids.entities.items.InteractiveItem
getName
-
Field Details
-
restoredHealth
protected int restoredHealth
-
-
Constructor Details
-
Food
Initializes Food.- Parameters:
systemName- The system name is used to uniquely identify a certain type of Food. Must not be nullname- The name is displayed to the user and is used to identify an instance of Food by the user. Must not be nullweight- The weight of the Food. It must be a positive or zero integer
-
-
Method Details
-
getRestoredHealth
public int getRestoredHealth()Returns the amount of health this food Instance can restore- Returns:
- The amount of health that can be restored
-
toString
-
interactWithItem
Interacts with the user and add a certain amount of health to the Player.No arguments are expected and no health will be given to the Player if args is not empty.
- Specified by:
interactWithItemin interfaceInteractiveItem- Parameters:
commandLogger- The CommandLogger onto which the user typed responses are recordedlabyrinth- The labyrinth on which the interaction actions are performedargs- The arguments for the command to interpret
-