[High] [Bug] Cast progress meter counts above 100% after enemy defeat on last descent room (floor 1, room 0) #381
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug Summary
When descending the spire and defeating the enemy on the last room (floor 1, room 0), the cast progress meter keeps counting up past 100% because combat processing continues after
isDescentCompleteis set.Expected Behavior
Cast progress should stop accumulating when the descent is complete. The meter should never exceed 100%.
Root Cause
Multiple missing guards:
combat-descent-actions.ts:55-58:advanceRoomOrFloor()early-returns withisDescentComplete: truebut does NOT resetcastProgress: 0orweaponCastProgress: {}combat-actions.ts:142: Cast progress is incremented unconditionally every tick — no check forisDescentCompletecombat-actions.ts:98: Early-exit guard only checkscurrentAction !== 'climb', does NOT checkisDescentCompletegameStore.ts: Combat processing block does NOT checkisDescentCompletebefore running combat, and writescr.castProgressback unconditionallyOnce
isDescentCompleteis true,processCombatTickstill runs every tick, incrementingweaponCastProgress['primary']byprogressPerTickeach time with no cap.Severity
High — Visual/UX bug that cascades: cast progress exceeding 1.0 triggers the spell-casting while loop on subsequent ticks, potentially causing phantom spell casts with stale floorHP values and unexpected mana consumption.
Fix Direction (defense in depth)
combat-descent-actions.ts:55, addcastProgress: 0andweaponCastProgress: {}to theset()callprocessCombatTick(), addisDescentCompleteto the early-exit guardFiles Involved
src/lib/game/stores/combat-descent-actions.tssrc/lib/game/stores/combat-actions.tssrc/lib/game/stores/combat-actions.tsisDescentCompletecheckStarting investigation of cast progress meter bug.
✅ Fixed with defense-in-depth approach:
combat-descent-actions.ts: Added
castProgress: 0andweaponCastProgress: {}to theisDescentCompleteset() call so the meter resets immediately when descent completes.combat-actions.ts: Added
isDescentCompleteto the early-exit guard inprocessCombatTick(if (state.currentAction !== 'climb' || state.isDescentComplete)), preventing any combat processing (and phantom spell casts) after descent is complete.All 1196 tests pass. Pre-commit checks OK.