fix: cap cast progress at 100% after descent completion (bug #381)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m20s

Defense-in-depth fix across 2 files:

1. combat-descent-actions.ts: Added castProgress: 0 and weaponCastProgress: {}
   to the isDescentComplete set() call so the meter resets immediately.

2. combat-actions.ts: Added isDescentComplete to the early-exit guard in
   processCombatTick so combat processing stops entirely once descent is
   complete, preventing phantom spell casts from stale castProgress values.

All 1196 tests pass.
This commit is contained in:
2026-06-12 19:03:02 +02:00
parent 0add3d6260
commit 99a5f498c0
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ export function processCombatTick(
const logMessages: string[] = [];
let totalManaGathered = 0;
if (state.currentAction !== 'climb') {
if (state.currentAction !== 'climb' || state.isDescentComplete) {
return makeDefaultCombatTickResult(rawMana, elements, state, golemancyState.activeGolems);
}
@@ -52,7 +52,7 @@ export function advanceRoomOrFloor(get: GetFn, set: SetFn): void {
get().addActivityLog('floor_transition', `Room ${s.currentRoomIndex + 1} passed`);
if (s.currentFloor <= s.exitFloor && s.currentRoomIndex <= 0) {
set({ isDescentComplete: true });
set({ isDescentComplete: true, castProgress: 0, weaponCastProgress: {} });
get().addActivityLog('floor_transition',
'Descent complete — Exit Spire is now available');
return;