mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 00:52:40 +00:00
Combat: fix wounded-carry HP display + auto-crit narration
Two bugs reported back-to-back from a Rogue's run: 1. HP display reset between battles. End of fight 1: 101/123 → start of fight 2: 100/100. applyDnDHPScaling was overwriting Stats.MaxHP with the scaled wound value, so the display denominator dropped along with the numerator. Wounded carry-over became invisible. Fix: introduce CombatStats.StartHP. Combat engine reads it as the entry-HP when set; MaxHP stays put. Display now reads "100/123" as intended. 2. Auto-crit fired on a roll of 11 with no narrative tell. Rogue passive AutoCritFirst was triggering correctly, but the renderer used the generic crit pool, so the player saw "🎲 11 vs AC 10 → CRIT" with no indication their *class* caused it. Fix: tag the crit event with Desc="auto_crit" when the passive (not the dice) caused it; new narrativePlayerAutoCrit pool calls out the training/instinct/exploit theme. Test bound for T5 dungeon death rate loosened from 0.02 to 0.01 — the new Sudden Death phase from the previous commit shifted geared-T5 fights slightly toward player wins. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -433,13 +433,15 @@ func applyDnDHPScaling(stats *CombatStats, c *DnDCharacter) {
|
||||
if scaled < 1 {
|
||||
scaled = 1
|
||||
}
|
||||
// Defensive: pct is clamped above to [floor, 1.0], so scaled should
|
||||
// always be ≤ original MaxHP. Belt-and-suspenders in case the floor
|
||||
// or pct math drifts in a future refactor.
|
||||
if scaled > stats.MaxHP {
|
||||
scaled = stats.MaxHP
|
||||
}
|
||||
stats.MaxHP = scaled
|
||||
// Set StartHP rather than overwriting MaxHP. The combat engine reads
|
||||
// StartHP as the entry-HP, but display denominators (e.g. "101/123")
|
||||
// keep using MaxHP — so wounded carry-over reads "wounded out of full"
|
||||
// rather than "full out of shrunk-max", which previously made wound
|
||||
// state invisible across battles.
|
||||
stats.StartHP = scaled
|
||||
}
|
||||
|
||||
// ── HP persistence ───────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user