namespace Theriapolis.Core.Persistence; /// /// Mid-encounter snapshot. Present in only when the /// player saved during combat. On load, the live PlayScreen re-creates a /// with the same participants and /// calls ResumeRolls(RollCount) so the dice stream continues from /// the same sequence point — see Phase 5 plan §5. /// public sealed class EncounterState { public ulong EncounterId { get; set; } public int RollCount { get; set; } public int CurrentTurnIndex { get; set; } public int RoundNumber { get; set; } public int[] InitiativeOrder { get; set; } = System.Array.Empty(); public CombatantSnapshot[] Combatants { get; set; } = System.Array.Empty(); } /// One combatant in the saved encounter. public sealed class CombatantSnapshot { public int Id { get; set; } /// Display name (used to verify the same combatant on resume). public string Name { get; set; } = ""; /// True if this combatant is the player. False = NPC. public bool IsPlayer { get; set; } /// For NPC combatants: the chunk + spawn index that produced them, used to find the live NpcActor on resume. public int? NpcChunkX { get; set; } public int? NpcChunkY { get; set; } public int? NpcSpawnIndex { get; set; } /// For NPC combatants: the template id (used as fallback identity if chunk lookup fails). public string NpcTemplateId { get; set; } = ""; public int CurrentHp { get; set; } public float PositionX { get; set; } public float PositionY { get; set; } /// Active conditions as enum byte values. public byte[] Conditions { get; set; } = System.Array.Empty(); } /// /// Per-chunk roster delta — which spawn indices have been killed (or /// otherwise consumed). Layered on top of the chunk's deterministic spawn /// list so reloading a chunk doesn't resurrect dead enemies. /// public sealed class NpcRosterState { public List ChunkDeltas { get; set; } = new(); } public sealed class NpcChunkDelta { public int ChunkX { get; set; } public int ChunkY { get; set; } /// Spawn-list indices in this chunk whose NPC has died. public int[] KilledSpawnIndices { get; set; } = System.Array.Empty(); }