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
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.
-
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
ConstructorsConstructorDescriptionSpecialMove
(String moveName, int hungerCost) Constructs a SpecialMove with the specified name and hunger cost. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
applyBuffs
(CombatStatsComponent attackerStats) Abstract method to apply buffs to the attacker.protected abstract void
applyDebuffs
(CombatStatsComponent targetStats) Abstract method to apply debuffs to the target.execute
(CombatStatsComponent attackerStats) Special moves generally require additional arguments, so this method provides a default error message if invoked with insufficient parameters.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats) Executes the special move with the attacker and target.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded) Executes the special move, applying buffs to the attacker and debuffs to the target if unguarded.execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded) Executes the special move, treating the target as unguarded.Methods inherited from class com.csse3200.game.components.combat.move.CombatMove
getHungerCost, getMoveName
-
Constructor Details
-
SpecialMove
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
Special moves generally require additional arguments, so this method provides a default error message if invoked with insufficient parameters.- Specified by:
execute
in classCombatMove
- 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 callsexecute(CombatStatsComponent, CombatStatsComponent, boolean)
with the target not being guarded.- Specified by:
execute
in classCombatMove
- 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 classCombatMove
- 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 classCombatMove
- 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
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
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.
-