Class CombatMoveComponent

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.combat.move.CombatMoveComponent

public class CombatMoveComponent extends Component
The CombatMoveComponent class manages a set of combat moves for an entity. It allows for the execution of specific combat moves based on the action type and target.
  • Constructor Details

    • CombatMoveComponent

      public CombatMoveComponent(List<CombatMove> moveSet)
      Constructor to initialize the combat move component with a set of moves.
      Parameters:
      moveSet - the list of combat moves available to this entity.
  • Method Details

    • executeMove

      public CombatMove.StatsChange[] executeMove(CombatManager.Action action)
      Executes a move based on the provided action. Uses the entity's own stats as the attacker.
      Parameters:
      action - the action that specifies which move to execute.
      Returns:
      an array of CombatMove.StatsChange, representing the changes in stats after the move execution. If no valid move is found, an empty array is returned.
    • executeMove

      public CombatMove.StatsChange[] executeMove(CombatManager.Action action, CombatStatsComponent target)
      Executes a move based on the provided action and target. Uses the entity's own stats as the attacker.
      Parameters:
      action - the action that specifies which move to execute.
      target - the target's combat stats component.
      Returns:
      an array of CombatMove.StatsChange, representing the changes in stats after the move execution. If no valid move is found, an empty array is returned.
    • executeMove

      public CombatMove.StatsChange[] executeMove(CombatManager.Action action, CombatStatsComponent target, boolean targetIsGuarded)
      Executes a move based on the provided action, target, and whether the target is guarding. Uses the entity's own stats as the attacker.
      Parameters:
      action - the action that specifies which move to execute.
      target - the target's combat stats component.
      targetIsGuarded - whether the target is guarding, reducing the effectiveness of the attack.
      Returns:
      an array of CombatMove.StatsChange, representing the changes in stats after the move execution. If no valid move is found, an empty array is returned.
    • executeMove

      public CombatMove.StatsChange[] executeMove(CombatManager.Action action, CombatStatsComponent target, boolean targetIsGuarded, int numHitsLanded)
      Executes a move based on the provided action, target, guarding status, and number of hits landed. Uses the entity's own stats as the attacker.
      Parameters:
      action - the action that specifies which move to execute.
      target - the target's combat stats component.
      targetIsGuarded - whether the target is guarding.
      numHitsLanded - the number of hits landed in a multi-hit move.
      Returns:
      an array of CombatMove.StatsChange, representing the changes in stats after the move execution. If no valid move is found, an empty array is returned.
    • getMoveAction

      public CombatMove getMoveAction(CombatManager.Action action)
      Retrieves the appropriate combat move based on the action type.
      Parameters:
      action - the action that specifies which move to retrieve.
      Returns:
      the combat move corresponding to the action, or null if none is found.
    • hasSpecialMove

      public boolean hasSpecialMove()
      Checks if the entity has a special move in its move set.
      Returns:
      true if the entity has a special move, false otherwise.
    • getMoveSet

      public List<CombatMove> getMoveSet()
      Gets the list of combat moves associated with this component.
      Returns:
      the list of combat moves.