using System.Collections.Generic; namespace MazeGen { public enum CombatEventKind { FightStart, RoundStart, MovementStart, // Actor begins moving MovementComplete, // Actor completes movement OutOfRange, // Attack failed: target out of weapon range TooFarForMelee, // Attack failed: not adjacent for melee TargetUnreachable, // Movement failed: destination unreachable Hit, Miss, Death, FightEnd, HealthPotionUsed } /// /// One atomic thing that happened during a battle. A resolved battle is nothing but an /// ordered list of these. /// /// This is the seam that lets "just log it" and "watch it on a grid" share one outcome: the /// resolver runs to completion up front and emits this list, log-only mode prints it, and the /// arena replays the exact same list as animation. The view therefore cannot desync from the /// simulation, and switching modes can never change who wins. /// public class CombatEvent { public CombatEventKind Kind; public int Round; /// Combatant id of whoever acted, or -1 for battle/round-level events. public int ActorId = -1; /// Combatant id of whoever was acted upon, or -1. public int TargetId = -1; /// Damage dealt (Hit), or the target's remaining health (Death). public float Amount; /// Pre-rendered log line, so the log/thought/feed surfaces don't each re-describe it. public string Text; /// Starting position for movement events (grid coordinates). public UnityEngine.Vector2Int SourcePosition = UnityEngine.Vector2Int.zero; /// Destination position for movement events, or target position for attacks (grid coordinates). public UnityEngine.Vector2Int TargetPosition = UnityEngine.Vector2Int.zero; /// Distance moved in squares (for MovementComplete events). public int MovementDistance = 0; } public enum BattleOutcome { AgentsVictory, MonstersVictory, Stalemate } /// The complete, already-decided result of one battle. public class BattleResult { public BattleOutcome Outcome; public int Rounds; public readonly List Events = new List(); public IReadOnlyList Combatants; /// Agents who were reduced to 0 health in this battle. public readonly List FallenAgents = new List(); /// Monsters killed in this battle. public readonly List FallenMonsters = new List(); /// Agents still standing when the battle ended. public readonly List SurvivingAgents = new List(); public string Summary { get { switch (Outcome) { case BattleOutcome.AgentsVictory: return $"Agents won in {Rounds} round(s) - {FallenMonsters.Count} monster(s) killed, {FallenAgents.Count} agent(s) lost."; case BattleOutcome.MonstersVictory: return $"Monsters won in {Rounds} round(s) - all {FallenAgents.Count} agent(s) died."; default: return $"Stalemate after {Rounds} round(s) - both sides still standing, everyone disengages."; } } } } }