java.lang.Object
com.adventure.models.Entity
Represents a generic entity.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangetAlive()Returns if the entity is alive.intReturns the damage done by a player when attacking.intReturns the number of the dodgeInventory getter.getName()Returns the name of the entity.getStats()Stats getter.voidheal(int points) Heals the entity.inthit(int damage) Damages the entity.voidResets the available dodges to the maximum amount.voidsetAlive(boolean alive) Setter used to kill or revive the entity.voidsetInventory(Inventory inventory) Inventory setter.voidSets entity name.voidSets entity stats.booleanuseDodge()Uses a dodge.
-
Field Details
-
inventory
Entity inventory. -
stats
Entity stats.
-
-
Constructor Details
-
Entity
Entity constructor.- Parameters:
inventory- Player inventory.stats- Player stats.name- Entity name.
-
-
Method Details
-
getInventory
Inventory getter.- Returns:
- The entity inventory.
-
getAlive
public boolean getAlive()Returns if the entity is alive.- Returns:
- True if the entity is alive, false otherwise.
-
getName
Returns the name of the entity.- Returns:
- name of the entoty.
-
getStats
Stats getter.- Returns:
- Entity stats.
-
getAvailableDodges
public int getAvailableDodges()Returns the number of the dodge- Returns:
- number of available dodges
-
setInventory
Inventory setter.- Parameters:
inventory- Inventory to set.
-
setAlive
public void setAlive(boolean alive) Setter used to kill or revive the entity.- Parameters:
alive- If is set to false, then the entity hp are set to 0. If is set to true and the entity was dead then the hp are set to maxHp.
-
setStats
Sets entity stats.- Parameters:
stats- Entity stats.
-
setName
Sets entity name.- Parameters:
name- Entity name.
-
useDodge
public boolean useDodge()Uses a dodge.- Returns:
- Returns true if the player had a dodge to consume, false otherwise.
-
resetDodge
public void resetDodge()Resets the available dodges to the maximum amount. -
getAttackDamage
public int getAttackDamage()Returns the damage done by a player when attacking.- Returns:
- Attack done by the player.
-
heal
public void heal(int points) Heals the entity.- Parameters:
points- Health points to gain.
-
hit
public int hit(int damage) Damages the entity.- Parameters:
damage- Health points to lose. This damage is mitigated by the entity defence.- Returns:
- Inflicted damage.
-
equals
-