Class EnemyBase

java.lang.Object
wizardquest.entity.EnemyBase
All Implemented Interfaces:
EntityInterface
Direct Known Subclasses:
FishMan, Goblin

public abstract class EnemyBase extends Object implements 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 Details

    • EnemyBase

      public EnemyBase(int maxHealth)
      Constructor with specified max health.
      Parameters:
      maxHealth - the maximum health for this enemy
  • Method Details

    • getAbilities

      public abstract List<AbilityEnum> getAbilities()
      Description copied from interface: EntityInterface
      List the abilities that are currently usable by the entity.
      Specified by:
      getAbilities in interface EntityInterface
      Returns:
      a list of abilities.
    • getHealth

      public int getHealth()
      Description copied from interface: EntityInterface
      Gets an entity's current health.
      Specified by:
      getHealth in interface EntityInterface
      Returns:
      the entity's current health.
    • loseHealth

      public void loseHealth(int amount, DamageEnum type) throws IllegalArgumentException
      Description copied from interface: EntityInterface
      Decrements an entity's health by a given amount, as a result of a certain damage type being inflicted upon them.
      Specified by:
      loseHealth in interface EntityInterface
      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

      public int calcDamage(int base, DamageEnum type)
      Description copied from interface: EntityInterface
      Calculate the damage inflicted by one entity onto another. Applies damage type modifiers to the base damage to calculate the final amount.
      Specified by:
      calcDamage in interface EntityInterface
      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: EntityInterface
      Gets an entity's maximum health.
      Specified by:
      getMaxHealth in interface EntityInterface
      Returns:
      the entity's maximum health.
    • resetHealth

      public void resetHealth()
      Description copied from interface: EntityInterface
      Reset an entity's health to its starting value.
      Specified by:
      resetHealth in interface EntityInterface