Class Monster

java.lang.Object
characters.DungeonCharacter
characters.monsters.Monster
All Implemented Interfaces:
java.lang.Comparable<java.lang.Object>
Direct Known Subclasses:
Gremlin, Ogre, Skeleton

public abstract class Monster
extends DungeonCharacter
Abstract base class for a hierarchy of Monsters. It is derived from DungeonCharacter.
  • Field Details

    • chanceToHeal

      protected double chanceToHeal
    • minHeal

      protected int minHeal
    • maxHeal

      protected int maxHeal
  • Constructor Details

    • Monster

      protected Monster​(java.lang.String name, int hitPoints, int attackSpeed, double chanceToHit, double chanceToHeal, int damageMin, int damageMax, int minHeal, int maxHeal)
      Constructor.
      Parameters:
      name - Name of character.
      hitPoints - Points of damage a character can take before killed.
      attackSpeed - How fast the character can attack.
      chanceToHit - Chance an attack will strike the opponent.
      chanceToHeal - Chance a character has to heal.
      damageMin - Minimum amount of damage a character can inflict.
      damageMax - Maximum amount of damage a character can inflict.
      minHeal - The minimum amount of health to be restored.
      maxHeal - The maximum amount of health to be restored...
  • Method Details

    • heal

      public void heal()
      Monsters have a chance to heal themselves.
    • subtractHitPoints

      public void subtractHitPoints​(int hitPoints)
      Additionally calls the heal method.
      Overrides:
      subtractHitPoints in class DungeonCharacter
      Parameters:
      hitPoints - The number of hit points to subtract.
    • battleChoices

      public void battleChoices​(DungeonCharacter theMonster)
      Description copied from class: DungeonCharacter
      Abstract of the battleChoices class, to be implemented by the Hero class.
      Specified by:
      battleChoices in class DungeonCharacter
      Parameters:
      theMonster - The opponent to be fought.