using UnityEngine; namespace MazeGen { /// /// Types of actions a combatant can take during their turn. /// public enum ActionType { Move, // Move towards/away from target or selected position Attack, // Attack a target (if in range) UseItem, // Use a consumable item (health potion, etc.) Defend, // Brace for impact (future: reduce damage taken) Pass // Do nothing this turn } /// /// Represents a single action a combatant can take during their turn in combat. /// This is decided by the AI (or eventually player input) and then executed by CombatResolver. /// public class CombatAction { /// ID of the combatant taking this action. public int ActorId { get; set; } /// Type of action being taken. public ActionType ActionType { get; set; } /// Target combatant (for Attack, Defend). Null for Move/UseItem/Pass. public Combatant TargetCombatant { get; set; } /// Target grid position (for Move actions). Zero for other action types. public Vector2Int TargetPosition { get; set; } /// Item to use (for UseItem actions). Null for other action types. public Consumable TargetItem { get; set; } public CombatAction() { ActorId = -1; ActionType = ActionType.Pass; TargetCombatant = null; TargetPosition = Vector2Int.zero; TargetItem = null; } public CombatAction(int actorId, ActionType actionType) { ActorId = actorId; ActionType = actionType; TargetCombatant = null; TargetPosition = Vector2Int.zero; TargetItem = null; } public CombatAction(int actorId, Combatant targetCombatant) { ActorId = actorId; ActionType = ActionType.Attack; TargetCombatant = targetCombatant; TargetPosition = Vector2Int.zero; TargetItem = null; } public CombatAction(int actorId, Vector2Int targetPosition) { ActorId = actorId; ActionType = ActionType.Move; TargetCombatant = null; TargetPosition = targetPosition; TargetItem = null; } public override string ToString() { return ActionType switch { ActionType.Move => $"Move to {TargetPosition}", ActionType.Attack => $"Attack {TargetCombatant?.Name ?? "null"}", ActionType.UseItem => $"Use {TargetItem?.ItemName ?? "null"}", ActionType.Defend => "Defend", ActionType.Pass => "Pass", _ => "Unknown action" }; } } }