Class GuardMove

java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
com.csse3200.game.components.combat.move.GuardMove

public class GuardMove extends CombatMove
The GuardMove class represents a move where the attacker guards, reducing damage from incoming attacks. The move uses hunger and does not inflict damage but is used to mitigate damage from opponents.
  • Constructor Details

    • GuardMove

      public GuardMove(String moveName, int hungerCost)
      Constructor to initialize the GuardMove with its name and hunger cost.
      Parameters:
      moveName - the name of the guard move.
      hungerCost - the hunger cost required to execute the guard move.
  • Method Details

    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats)
      Executes the guard move, consuming hunger. This variant is used when there is no target, such as a defensive maneuver.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the guard move.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats)
      Executes the guard move, which simply consumes hunger. The target is ignored in this case.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the move.
      targetStats - the combat stats of the target (ignored for guard moves).
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded)
      Executes the guard move, consuming hunger. The target's guarding status is ignored in this context.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the move.
      targetStats - the combat stats of the target (ignored for guard moves).
      targetIsGuarded - whether the target is guarding (ignored for guard moves).
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded)
      Executes the guard move, consuming hunger. The number of hits landed is ignored for guard moves.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the move.
      targetStats - the combat stats of the target (ignored for guard moves).
      targetIsGuarded - whether the target is guarding (ignored for guard moves).
      numHitsLanded - the number of hits landed (ignored for guard moves).
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.