public class CommanderUnit extends CavalryUnit
Class CommanderUnit that inherits from CavalryUnit. CommanderUnit objects does not implement methods from the superclass Unit as they are defined in CavalryUnit.
Version:
1.4 01.05.2022
Author:
Carl Gützkow
  • Constructor Details

    • CommanderUnit

      public CommanderUnit(String name, int health, int attack, int armor)
      Instantiates a new CommanderUnit unit. Uses the constructor of its superclass CavalryUnit
      Parameters:
      name - String - a short name of the unit that can't be left with whitespace or empty.
      health - int - HP - amount of health unit has. If it hits zero or more, the unit is dead.
      attack - int - damage done, excluding attack bonus, on an enemy unit.
      armor - int - damage resisted, excluding resist bonus, from an enemy unit.
    • CommanderUnit

      public CommanderUnit(String name, int health)
      Instantiates a new CommanderUnit unit with a simplified constructor. Attack is set to 25 and health is set to 15 Uses the constructor of its superclass CavalryUnit since the constructor gives no other value.
      Parameters:
      name - String - a short name of the unit that can't be left with whitespace or empty.
      health - int - HP - amount of health unit has. If it hits zero or more, the unit is dead.