Phase 5b: player power floor + Phase-3 winners shipped to live

Closes the 'fairly breezy with some death' target the user picked
for Phase 5. Five-piece ship; Phase 1 matrix lands T1 88%, T2 74%,
T4 72%, T5 ~57% in or above band. T3 remains the design hump at
~45% (manor 39, underforge 47) — Wraith promotion to elite was
already done in Phase 4-B, the remaining standard-pool deaths are
the irreducible part of T3.

Pieces:
  1. computeMaxHP × 1.5 (phase5BHPMult in dnd.go). Uniform across
     class/level so the class-balance harness's in-tier parity
     assertion stays green. Bootstrap (bootstrap_phase5b_hp.go)
     refreshes hp_max for existing characters at startup;
     idempotent via db.JobCompleted. hp_current is bumped by the
     same delta so a full-HP character stays at full.
  2. applyPhase5BPlayerFloor (dnd_combat.go): +3 AC, +3 AttackBonus,
     +3 weapon.MagicBonus (damage). Applied at the END of
     applyDnDEquipmentLayer (after computeArmorAC's AC override)
     and inside buildHarnessPlayer so live and harness measurement
     match.
  3. Elite bracket 19 → 23 (resolveCombatInterrupt). Case order
     puts Elite (≥23) before Patrol (≥22) so a 23+ total prefers
     the single dangerous fight. Elite is now effectively a
     high-threat event reachable only via the +1-per-20-threat-
     above-40 mod — Phase 4-B's elite-pool monsters still appear,
     just less often.
  4. dailyThreatDrift base 3 → 1. Slows the threat clock so
     players have the days they need before threat tips zones
     into the new 23+ elite band.
  5. applyDailyBurn default → 50% (phase5BDailyBurnRatePct). Also
     applied in the temporal-override branch in
     dnd_expedition_cycle.go so tidal / unraveling days scale by
     the same 0.5× — otherwise those days would be
     disproportionately harsh against the new baseline.

The harness's expedition_balance.go reads phase5BDailyBurnRatePct
as the default-burn fallback when the override knob is zero, so
Phase 1 matrix measurements now reflect what live players
experience.

Test debt: 13 pinned-numbers unit tests across combat_stats_test,
dnd_test, dnd_xp_test, dnd_equipment_profiles_test,
dnd_expedition_supplies_test, dnd_expedition_cycle_test,
dnd_expedition_extract_test, dnd_expedition_region_cmd_test,
dnd_expedition_combat_test, dnd_expedition_threat_test,
dnd_expedition_temporal_test, expedition_balance_test were
pinning pre-Phase-5-B baselines; updated with comments noting
the cause. Class-balance suite stayed green (uniform buff
preserves spread).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-15 12:11:27 -07:00
parent d0a8505c76
commit 5ef10e35dc
23 changed files with 627 additions and 94 deletions

View File

@@ -134,36 +134,44 @@ func TestMakeSupplies_FillsFromTier(t *testing.T) {
}
func TestApplyDailyBurn_DrainsAndClamps(t *testing.T) {
// Phase 5-B (shipped): applyDailyBurn now scales by
// phase5BDailyBurnRatePct = 50 by default — every expected value
// here is halved relative to the pre-Phase-5-B baseline. The
// math-pure shape (harsh-mult, siege-floor) is unchanged; only
// the final multiplier is new. See applyDailyBurn doc for the
// difficulty-pass motivation.
s := ExpeditionSupplies{Current: 5, Max: 10, DailyBurn: 2, HarshMod: 1.5, ForagedToday: true}
s, burn := applyDailyBurn(s, false, false)
if burn != 2 {
t.Errorf("burn = %v, want 2", burn)
if burn != 1 { // 2 × 50%
t.Errorf("burn = %v, want 1", burn)
}
if s.Current != 3 {
t.Errorf("current = %v, want 3", s.Current)
if s.Current != 4 { // 5 - 1
t.Errorf("current = %v, want 4", s.Current)
}
if s.ForagedToday {
t.Error("forage flag should reset on day rollover")
}
// Harsh active doubles via mult.
// Harsh active applies HarshMod (1.5), then phase5B halves: 2*1.5*0.5 = 1.5.
s, burn = applyDailyBurn(s, true, false)
if burn != 3 { // 2 × 1.5
t.Errorf("harsh burn = %v, want 3", burn)
if burn != 1.5 {
t.Errorf("harsh burn = %v, want 1.5", burn)
}
// Siege forces a 2× floor even when HarshMod is below 2 (tier 1).
// Siege forces a 2× floor even when HarshMod is below 2 (tier 1);
// phase5B halves: 1 × 2 × 0.5 = 1.
t1 := ExpeditionSupplies{Current: 10, Max: 10, DailyBurn: 1, HarshMod: 1}
_, sb := applyDailyBurn(t1, false, true)
if sb != 2 {
t.Errorf("siege tier1 burn = %v, want 2 (forced floor)", sb)
if sb != 1 {
t.Errorf("siege tier1 burn = %v, want 1 (forced 2× floor × phase5B 50%%)", sb)
}
// Siege at higher tier still uses HarshMod when it exceeds 2.
// Siege at higher tier still uses HarshMod when it exceeds 2:
// 1 × 3 × 0.5 = 1.5.
t5 := ExpeditionSupplies{Current: 10, Max: 10, DailyBurn: 1, HarshMod: 3}
_, sb5 := applyDailyBurn(t5, false, true)
if sb5 != 3 {
t.Errorf("siege tier5 burn = %v, want 3 (HarshMod)", sb5)
if sb5 != 1.5 {
t.Errorf("siege tier5 burn = %v, want 1.5 (HarshMod × phase5B)", sb5)
}
// Drain to floor.
for i := 0; i < 5; i++ {
for i := 0; i < 10; i++ {
s, _ = applyDailyBurn(s, false, false)
}
if s.Current != 0 {