Class CombatMove
java.lang.Object
com.csse3200.game.components.combat.move.CombatMove
- Direct Known Subclasses:
AttackMove
,GuardMove
,ItemMove
,SleepMove
,SpecialMove
Represents an abstract combat move in the game. Concrete implementations of this class
define specific combat actions such as attacks, defenses, or special abilities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Represents changes to combat stats resulting from a move. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CombatMove
(String moveName, int hungerCost) Constructor to initialize the move name and hunger cost. -
Method Summary
Modifier and TypeMethodDescriptionabstract CombatMove.StatsChange[]
execute
(CombatStatsComponent attackerStats) Executes the move with only the attacker's combat stats.abstract CombatMove.StatsChange[]
execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats) Executes the move with both the attacker's and the target's combat stats.abstract CombatMove.StatsChange[]
execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded) Executes the move with both the attacker's and the target's combat stats, taking into account whether the target is guarded.abstract CombatMove.StatsChange[]
execute
(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded) Executes the move with both the attacker's and the target's combat stats, accounting for whether the target is guarded and the number of hits landed in a multi-hit attack.int
Gets the hunger cost required to perform the move.Gets the name of the move.
-
Field Details
-
moveName
-
hungerCost
protected int hungerCost
-
-
Constructor Details
-
CombatMove
Constructor to initialize the move name and hunger cost.- Parameters:
moveName
- the name of the move.hungerCost
- the amount of hunger required to execute the move.
-
-
Method Details
-
execute
Executes the move with only the attacker's combat stats.- 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 abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats) Executes the move with both the attacker's and the target's combat stats.- 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 abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded) Executes the move with both the attacker's and the target's combat stats, taking into account whether the target is guarded.- Parameters:
attackerStats
- the combat stats of the attacker.targetStats
- the combat stats of the target.targetIsGuarded
- whether the target is guarding, reducing the effectiveness of the attack.- Returns:
- an array of
CombatMove.StatsChange
representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
-
execute
public abstract CombatMove.StatsChange[] execute(CombatStatsComponent attackerStats, CombatStatsComponent targetStats, boolean targetIsGuarded, int numHitsLanded) Executes the move with both the attacker's and the target's combat stats, accounting for whether the target is guarded and the number of hits landed in a multi-hit attack.- Parameters:
attackerStats
- the combat stats of the attacker.targetStats
- the combat stats of the target.targetIsGuarded
- whether the target is guarding, reducing the effectiveness of the attack.numHitsLanded
- the number of hits landed during a multi-hit attack.- Returns:
- an array of
CombatMove.StatsChange
representing the changes to combat stats resulting from the move, such as health or hunger adjustments.
-
getMoveName
Gets the name of the move.- Returns:
- the name of the move.
-
getHungerCost
public int getHungerCost()Gets the hunger cost required to perform the move.- Returns:
- the hunger cost.
-