Adv 2.0 D&D polish: GM→DM rename, streamed zone combat, end-to-end scenario test

GM→DM rename across docs and code (GMNarrationType→DMNarrationType,
GMState→DMState, narration constants, comments) so the system reads as
"Dungeon Master" everywhere. Player-visible "GM mood" wording stays
where it appears in flavor.

Streamed zone/expedition combat: zone advance now stages patrol →
patrol play-by-play → patrol resolution → room intro → room play-by-play
→ final outcome through sendZoneCombatMessages with 2–3s pacing
(arena keeps its 5–8s window). Combat narrative lines pick up a compact
d20-vs-AC roll annotation for hit/crit/miss/block events.

Combat outcome polish: dndHPSnapshot lets narration show sheet HP
rather than legacy combat-engine HP, and markAdventureDead clears the
zombie state where hp_current was 0 but the legacy alive flag stayed
true after a D&D-layer KO.

Adv 2.0 announcement (ADVENTURE_2.0_ANNOUNCEMENT.md), README rewrite
covering the new layer, and adv2_scenario_test.go — a full
zone-run + expedition + harvest playthrough against a copy of the prod
DB asserting persisted state end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-09 07:43:11 -07:00
parent 83a71173b1
commit dfa7beeb96
32 changed files with 1262 additions and 334 deletions

View File

@@ -192,14 +192,14 @@ func (p *AdventurePlugin) Init() error {
if err := lockCoopCombatActions(); err != nil {
slog.Error("adventure: startup coop combat lock failed", "err", err)
}
// Phase R1 — archive any active dnd_zone_run rows that aren't linked to
// an active expedition. Idempotent: re-running it does nothing once the
// orphan set is empty.
if n, err := archiveOrphanZoneRuns(); err != nil {
slog.Error("adventure: R1 orphan zone-run archive failed", "err", err)
} else if n > 0 {
slog.Info("adventure: R1 archived orphan zone runs", "count", n)
}
// Phase R1 orphan-archive used to run here on every Init, but it
// over-archived: it treats any active dnd_zone_run row not linked to
// an active expedition as a legacy `!adventure dungeon` orphan, which
// also kills legitimate `!zone enter` single-session runs every time
// the bot restarts. That migration's job was done on its first
// execution; leaving it on Init was eating live runs. The function is
// preserved for one-off invocation if a future schema change ever
// needs it again.
// Revive any characters whose DeadUntil has expired
p.catchUpRespawns(chars)