using Theriapolis.Core.Data;
using Theriapolis.Core.Entities;
using Theriapolis.Core.Rules.Reputation;
namespace Theriapolis.Core.Rules.Dialogue;
///
/// Phase 6 M3 — read/write window into player + npc state used by
/// to evaluate conditions and apply effects.
/// Keeps the runner free of direct PlayScreen / ActorManager references
/// so the runner can be unit-tested with a synthetic context.
///
public sealed class DialogueContext
{
public NpcActor Npc { get; }
public Rules.Character.Character Pc { get; }
public PlayerReputation Reputation { get; }
public Dictionary Flags { get; }
public ContentResolver Content { get; }
/// Player position for tagging RepEvent origins. Optional; defaults to (0, 0) in tests.
public int PlayerWorldTileX { get; set; }
public int PlayerWorldTileY { get; set; }
public long WorldClockSeconds { get; set; }
/// Set true by when an option fires the open_shop effect.
public bool ShopRequested { get; set; }
///
/// Phase 6 M3 — quest hook stub. set_flag-only for M3; the real quest
/// engine wires in M4 and consumes .
///
public List StartQuestRequests { get; } = new();
public DialogueContext(NpcActor npc, Rules.Character.Character pc,
PlayerReputation rep, Dictionary flags,
ContentResolver content)
{
Npc = npc;
Pc = pc;
Reputation = rep;
Flags = flags;
Content = content;
}
/// Effective disposition for the current NPC vs the player. Cached per dialogue turn — recomputed on demand.
public int EffectiveDispositionScore()
=> EffectiveDisposition.For(Npc, Pc, Reputation, Content);
}