using Theriapolis.Core.Data;
using Theriapolis.Core.Items;
namespace Theriapolis.Core.Dungeons;
///
/// Phase 7 M2 — pre-instantiated population of a generated dungeon. Holds:
/// - The list of entries (one per encounter
/// slot in any room) — coordinates + template + role tag.
/// - The list of entries (one per
/// container slot) — coordinates + table id + pre-rolled item drops.
///
/// Generated alongside (and from) a via
/// . Living combatants and item
/// pickups derive from these records on first dungeon entry; the
///
/// persists which entries have been resolved (cleared / looted) so
/// re-entry doesn't re-spawn them.
///
public sealed class DungeonPopulation
{
public DungeonSpawn[] Spawns { get; }
public DungeonContainer[] Containers { get; }
public DungeonPopulation(DungeonSpawn[] spawns, DungeonContainer[] containers)
{
Spawns = spawns;
Containers = containers;
}
}
///
/// One @ encounter slot in a generated dungeon — resolved to the
/// concrete NPC template that fills it. The dungeon coords are absolute
/// (within the dungeon's tile array, not template-local).
///
public readonly record struct DungeonSpawn(
/// Index into the spawn lives in.
int RoomId,
/// Dungeon-local tile-X.
int X,
/// Dungeon-local tile-Y.
int Y,
/// The chosen NPC template. Caller instantiates from this.
NpcTemplateDef Template,
/// Spawn-kind tag the slot declared (PoiGuard / WildAnimal / Brigand / Boss).
string Kind);
///
/// One C container slot in a generated dungeon — resolved to the
/// concrete loot drop. Populated at generation time so the same
/// (worldSeed, poiId, slotIdx) always rolls identical items.
///
public readonly record struct DungeonContainer(
/// Index into the container is in.
int RoomId,
/// Dungeon-local tile-X.
int X,
/// Dungeon-local tile-Y.
int Y,
/// Loot-table id consulted at populate time.
string TableId,
/// Pre-rolled item drops, ready to transfer on player loot.
ItemInstance[] Drops,
/// True when the slot's grid char declared locked.
bool Locked,
/// Lock difficulty tier ("trivial"/"easy"/"medium"/"hard"; empty when unlocked).
string LockTier);