Class SpecialMove

java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
com.csse3200.game.components.combat.move.SpecialMove
Direct Known Subclasses:
SpecialAirMove, SpecialKangaMove, SpecialWaterMove

public abstract class SpecialMove extends CombatMove
The SpecialMove class defines an abstract base for all special combat moves in the game. Special moves generally buff the attacker's stats and may debuff the target's stats. Each special move is responsible for defining specific debuffs and buffs via abstract methods.
  • Constructor Details

    • SpecialMove

      public SpecialMove(String moveName, int hungerCost)
      Constructs a SpecialMove with the specified name and hunger cost.
      Parameters:
      moveName - the name of the special move.
      hungerCost - the hunger cost required to perform the special move.
  • Method Details

    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats)
      Special moves generally require additional arguments, so this method provides a default error message if invoked with insufficient parameters.
      Specified by:
      execute in class CombatMove
      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 CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats)
      Executes the special move with the attacker and target. By default, this calls execute(CombatStatsComponent, CombatStatsComponent, boolean) with the target not being guarded.
      Specified by:
      execute in class CombatMove
      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 CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded)
      Executes the special move, treating the target as unguarded.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the attacker.
      targetStats - the combat stats of the target.
      targetIsGuarded - whether the target is guarded.
      numHitsLanded - the number of hits landed (not used in this implementation).
      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 special move, applying buffs to the attacker and debuffs to the target if unguarded. If the target is guarded, debuffs are not applied.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the attacker.
      targetStats - the combat stats of the target.
      targetIsGuarded - whether the target is guarded.
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
    • applyDebuffs

      protected abstract void applyDebuffs(CombatStatsComponent targetStats)
      Abstract method to apply debuffs to the target. Each special move must implement this to define specific debuffs to be applied.
      Parameters:
      targetStats - the combat stats of the target.
    • applyBuffs

      protected abstract void applyBuffs(CombatStatsComponent attackerStats)
      Abstract method to apply buffs to the attacker. Each special move must implement this to define specific buffs to be applied.
      Parameters:
      attackerStats - the combat stats of the attacker.