From 99a5f498c041497ffa986f02e6b07427a804e06d Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Fri, 12 Jun 2026 19:03:02 +0200 Subject: [PATCH] fix: cap cast progress at 100% after descent completion (bug #381) 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. --- docs/circular-deps.txt | 2 +- docs/dependency-graph.json | 2 +- src/lib/game/stores/combat-actions.ts | 2 +- src/lib/game/stores/combat-descent-actions.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index c879161..fef05fd 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-06-12T16:57:09.913Z +Generated: 2026-06-12T17:00:42.616Z Found: 4 circular chain(s) — these MUST be fixed before modifying involved files. 1. 1) data/guardian-encounters.ts > data/guardian-procedural.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index 58155b3..2d925c5 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-06-12T16:57:07.675Z", + "generated": "2026-06-12T17:00:40.332Z", "description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.", "usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry." }, diff --git a/src/lib/game/stores/combat-actions.ts b/src/lib/game/stores/combat-actions.ts index 03ee568..7fc60e6 100644 --- a/src/lib/game/stores/combat-actions.ts +++ b/src/lib/game/stores/combat-actions.ts @@ -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); } diff --git a/src/lib/game/stores/combat-descent-actions.ts b/src/lib/game/stores/combat-descent-actions.ts index 575fd69..6cd4443 100644 --- a/src/lib/game/stores/combat-descent-actions.ts +++ b/src/lib/game/stores/combat-descent-actions.ts @@ -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;