Class SleepMove
java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
com.csse3200.game.components.combat.move.SleepMove
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.csse3200.game.components.combat.move.CombatMove
CombatMove.StatsChange
-
Field Summary
Fields inherited from class com.csse3200.game.components.combat.move.CombatMove
hungerCost, moveName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute
(CombatStatsComponent attackerStats) Executes the sleep move, restoring 25% of the user's maximum hunger and 10% of their maximum health.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats) Executes the sleep move, ignoring the target's stats since it is a self-healing action.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.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.Methods inherited from class com.csse3200.game.components.combat.move.CombatMove
getHungerCost, getMoveName
-
Constructor Details
-
SleepMove
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
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 classCombatMove
- 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 classCombatMove
- 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 classCombatMove
- 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 classCombatMove
- 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.
-