Class CombatMove

java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
Direct Known Subclasses:
AttackMove, GuardMove, ItemMove, SleepMove, SpecialMove

public abstract class CombatMove extends Object
Represents an abstract combat move in the game. Concrete implementations of this class define specific combat actions such as attacks, defenses, or special abilities.
  • Field Details

    • moveName

      protected String moveName
    • hungerCost

      protected int hungerCost
  • Constructor Details

    • CombatMove

      protected CombatMove(String moveName, int hungerCost)
      Constructor to initialize the move name and hunger cost.
      Parameters:
      moveName - the name of the move.
      hungerCost - the amount of hunger required to execute the move.
  • Method Details

    • execute

      public abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats)
      Executes the move with only the attacker's combat stats.
      Parameters:
      attackerStats - the combat stats of the attacker.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats)
      Executes the move with both the attacker's and the target's combat stats.
      Parameters:
      attackerStats - the combat stats of the attacker.
      targetStats - the combat stats of the target.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded)
      Executes the move with both the attacker's and the target's combat stats, taking into account whether the target is guarded.
      Parameters:
      attackerStats - the combat stats of the attacker.
      targetStats - the combat stats of the target.
      targetIsGuarded - whether the target is guarding, reducing the effectiveness of the attack.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • execute

      public abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded)
      Executes the move with both the attacker's and the target's combat stats, accounting for whether the target is guarded and the number of hits landed in a multi-hit attack.
      Parameters:
      attackerStats - the combat stats of the attacker.
      targetStats - the combat stats of the target.
      targetIsGuarded - whether the target is guarding, reducing the effectiveness of the attack.
      numHitsLanded - the number of hits landed during a multi-hit attack.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • getMoveName

      public String getMoveName()
      Gets the name of the move.
      Returns:
      the name of the move.
    • getHungerCost

      public int getHungerCost()
      Gets the hunger cost required to perform the move.
      Returns:
      the hunger cost.