Adv 2.0 D&D Phase 11 D9: !zone lore subcommand

Wires the existing GMLore narration pool (zone-specific LoreLines* +
generic LoreLines fallback, all prewritten) into a !zone lore command.
Deterministic per (run, room) — re-asking in the same room yields the
same line; cross-room calls vary. No mood or state side-effects.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-08 14:34:42 -07:00
parent 7bb922ae62
commit 4638cb83a1
2 changed files with 69 additions and 1 deletions

View File

@@ -318,6 +318,47 @@ func TestZoneCmd_TauntWithoutRunNoCrash(t *testing.T) {
}
}
// Phase 11 D9 — !zone lore.
func TestZoneCmd_LoreWithoutRunNoCrash(t *testing.T) {
setupAuditTestDB(t)
uid := id.UserID("@zone-cmd-lore-norun:example")
zoneCmdTestCharacter(t, uid, 1)
defer cleanupZoneRuns(uid)
p := &AdventurePlugin{}
if err := p.handleDnDZoneCmd(MessageContext{Sender: uid}, "lore"); err != nil {
t.Fatalf("lore no-run: %v", err)
}
}
func TestZoneCmd_LoreWithActiveRunNoSideEffects(t *testing.T) {
setupAuditTestDB(t)
uid := id.UserID("@zone-cmd-lore-run:example")
zoneCmdTestCharacter(t, uid, 1)
defer cleanupZoneRuns(uid)
p := &AdventurePlugin{}
if err := p.handleDnDZoneCmd(MessageContext{Sender: uid}, "enter goblin_warrens"); err != nil {
t.Fatalf("enter: %v", err)
}
before, err := getActiveZoneRun(uid)
if err != nil || before == nil {
t.Fatalf("active run after enter: %v", err)
}
if err := p.handleDnDZoneCmd(MessageContext{Sender: uid}, "lore"); err != nil {
t.Fatalf("lore: %v", err)
}
after, err := getActiveZoneRun(uid)
if err != nil || after == nil {
t.Fatalf("active run after lore: %v", err)
}
if after.GMMood != before.GMMood {
t.Errorf("lore should not move mood: before %d, after %d", before.GMMood, after.GMMood)
}
if after.CurrentRoom != before.CurrentRoom {
t.Errorf("lore should not advance room: before %d, after %d", before.CurrentRoom, after.CurrentRoom)
}
}
func TestTauntComplimentResponseLines_Deterministic(t *testing.T) {
const runID = "run-d7-test"
t1 := tauntResponseLine(runID, 0)