Package wizardquest.entity
Class EnemyBase
java.lang.Object
wizardquest.entity.EnemyBase
- All Implemented Interfaces:
EntityInterface
Abstract base Enemy class for all the enemies that occur in the game
This class provides ways to calculate health and damage caused
Should be extended by Concrete enemy classes with their own definitions of
stats, abilities and entity type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcalcDamage(int base, DamageEnum type) Calculate the damage inflicted by one entity onto another.abstract List<AbilityEnum> List the abilities that are currently usable by the entity.intGets an entity's current health.intGets an entity's maximum health.voidloseHealth(int amount, DamageEnum type) Decrements an entity's health by a given amount, as a result of a certain damage type being inflicted upon them.voidReset an entity's health to its starting value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface wizardquest.entity.EntityInterface
getType
-
Constructor Details
-
EnemyBase
public EnemyBase(int maxHealth) Constructor with specified max health.- Parameters:
maxHealth- the maximum health for this enemy
-
-
Method Details
-
getAbilities
Description copied from interface:EntityInterfaceList the abilities that are currently usable by the entity.- Specified by:
getAbilitiesin interfaceEntityInterface- Returns:
- a list of abilities.
-
getHealth
public int getHealth()Description copied from interface:EntityInterfaceGets an entity's current health.- Specified by:
getHealthin interfaceEntityInterface- Returns:
- the entity's current health.
-
loseHealth
Description copied from interface:EntityInterfaceDecrements an entity's health by a given amount, as a result of a certain damage type being inflicted upon them.- Specified by:
loseHealthin interfaceEntityInterface- Parameters:
amount- the total health that the entity will lose.type- the inflicted damage type that has caused this health loss.- Throws:
IllegalArgumentException- if amount is not a non-negative number.
-
calcDamage
Description copied from interface:EntityInterfaceCalculate the damage inflicted by one entity onto another. Applies damage type modifiers to the base damage to calculate the final amount.- Specified by:
calcDamagein interfaceEntityInterface- Parameters:
base- the base damage dealt by the entity's attack.type- the damage type of the entity's attack.- Returns:
- the total damage inflicted by this attack.
-
getMaxHealth
public int getMaxHealth()Description copied from interface:EntityInterfaceGets an entity's maximum health.- Specified by:
getMaxHealthin interfaceEntityInterface- Returns:
- the entity's maximum health.
-
resetHealth
public void resetHealth()Description copied from interface:EntityInterfaceReset an entity's health to its starting value.- Specified by:
resetHealthin interfaceEntityInterface
-