Class SleepMove

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

public class SleepMove extends CombatMove
The SleepMove class represents a defensive move where the entity takes a rest, restoring a percentage of both hunger and health. This move is generally used to recover and does not target or attack opponents.
  • Constructor Details

    • SleepMove

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

    • execute

      public CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats)
      Executes the sleep move, restoring 25% of the user's maximum hunger and 10% of their maximum health. Health will not be restored if the Poisoned status effect is applied.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the sleep 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 sleep move, ignoring the target's stats since it is a self-healing action.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the sleep move.
      targetStats - the combat stats of the target (ignored for sleep 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 sleep move, ignoring whether the target is guarded or not since it is a self-healing action.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the sleep move.
      targetStats - the combat stats of the target (ignored for sleep moves).
      targetIsGuarded - whether the target is guarding (ignored for sleep 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 sleep move, ignoring the number of hits landed since it is a self-healing action.
      Specified by:
      execute in class CombatMove
      Parameters:
      attackerStats - the combat stats of the entity performing the sleep move.
      targetStats - the combat stats of the target (ignored for sleep moves).
      targetIsGuarded - whether the target is guarding (ignored for sleep moves).
      numHitsLanded - the number of hits landed (ignored for sleep moves).
      Returns:
      an array of CombatMove.StatsChange representing the changes to combat stats resulting from the move, such as health or hunger adjustments.