mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 17:02:42 +00:00
Adv 2.0 D&D Phase 12 E2c: Siege Mode effects + threat-70 warning
§8.3 siege economics: - applyDailyBurn now takes an explicit siege flag and enforces a 2× floor on supply burn even when HarshMod is below 2 (tier-1 zones still get starved out per spec). - currentBurn mirrors the same precedence so status/briefing readouts stay consistent. - Briefing rollover passes e.SiegeMode through, decoupling siege from the harsh-conditions composite. §8.3 threat-70 warning: applyDailyThreatDrift emits a one-time appendApproachingSiegeLog when the level crosses 70 (prevLevel<70 and new level≥70). Pulls from a new flavor.ThreatClockApproachingSiege pool seeded with the spec's verbatim warning beat plus two voice-matched alternates. Other siege effects (boss +20 HP / Legendary Resistance, cleared-room respawn, no-short-rest enforcement) stay deferred to the combat-link phase — ThreatBandInfo already exposes the flags that engine will read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,52 @@ func TestDeliverBriefing_AppliesThreatDrift(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyDailyThreatDrift_LogsApproachingSiegeOnceAt70(t *testing.T) {
|
||||
setupZoneRunTestDB(t)
|
||||
uid := id.UserID("@exp-threat-70warn:example")
|
||||
defer cleanupExpeditions(uid)
|
||||
|
||||
exp, err := startExpedition(uid, ZoneGoblinWarrens, "",
|
||||
ExpeditionSupplies{Current: 10, Max: 10, DailyBurn: 1, HarshMod: 1})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Seed to 68 — a +3 drift crosses 70.
|
||||
if err := applyThreatDelta(exp.ID, 68, "seed"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
exp, _ = getExpedition(exp.ID)
|
||||
if _, _, err := applyDailyThreatDrift(exp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
entries, _ := recentExpeditionLog(exp.ID, 20)
|
||||
count := 0
|
||||
for _, e := range entries {
|
||||
if e.Type == "threat" && strings.Contains(e.Summary, "past 70") {
|
||||
count++
|
||||
}
|
||||
}
|
||||
if count != 1 {
|
||||
t.Errorf("expected exactly one approaching-siege log, got %d", count)
|
||||
}
|
||||
|
||||
// A subsequent drift past 70 should not re-emit the warning.
|
||||
exp, _ = getExpedition(exp.ID)
|
||||
if _, _, err := applyDailyThreatDrift(exp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
entries, _ = recentExpeditionLog(exp.ID, 20)
|
||||
count = 0
|
||||
for _, e := range entries {
|
||||
if e.Type == "threat" && strings.Contains(e.Summary, "past 70") {
|
||||
count++
|
||||
}
|
||||
}
|
||||
if count != 1 {
|
||||
t.Errorf("expected approaching-siege log still 1 after second drift, got %d", count)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyBossDefeatThreat_DropsLevel(t *testing.T) {
|
||||
setupZoneRunTestDB(t)
|
||||
uid := id.UserID("@exp-boss-threat:example")
|
||||
|
||||
Reference in New Issue
Block a user