Class GuardMove
java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
com.csse3200.game.components.combat.move.GuardMove
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.
-
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 guard move, consuming hunger.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats) Executes the guard move, which simply consumes hunger.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded) Executes the guard move, consuming hunger.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded) Executes the guard move, consuming hunger.Methods inherited from class com.csse3200.game.components.combat.move.CombatMove
getHungerCost, getMoveName
-
Constructor Details
-
GuardMove
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
Executes the guard move, consuming hunger. This variant is used when there is no target, such as a defensive maneuver.- Specified by:
execute
in classCombatMove
- 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 classCombatMove
- 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 classCombatMove
- 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 classCombatMove
- 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.
-