From 05232ae03b985ad8ce9849cac9df8bce503d7b3b Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Wed, 10 Jun 2026 22:57:34 +0200 Subject: [PATCH] fix: check victory condition before game-over on day overflow --- docs/circular-deps.txt | 2 +- docs/dependency-graph.json | 2 +- src/lib/game/stores/gameStore.ts | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index afcaa47..dc200a9 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-06-10T19:51:19.886Z +Generated: 2026-06-10T20:56:06.167Z Found: 3 circular chain(s) — these MUST be fixed before modifying involved files. 1. 1) stores/golem-combat-actions.ts > stores/golem-combat-helpers.ts diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index bda0bdb..ef51e63 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-06-10T19:51:17.712Z", + "generated": "2026-06-10T20:56:04.043Z", "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/gameStore.ts b/src/lib/game/stores/gameStore.ts index 399933f..7a57b06 100644 --- a/src/lib/game/stores/gameStore.ts +++ b/src/lib/game/stores/gameStore.ts @@ -136,21 +136,22 @@ export const useGameStore = create()( prestigeUpgrades: ctx.prestige.prestigeUpgrades, }; - if (day > MAX_DAY) { - const insightGained = calcInsight(insightParams, disciplineEffects); - addLog('The loop ends. Gained ' + insightGained + ' Insight.'); - writes.ui = { ...(writes.ui || {}), gameOver: true, victory: false }; + if (ctx.combat.maxFloorReached >= 100 && ctx.prestige.signedPacts.includes(100)) { + const insightGained = calcInsight(insightParams, disciplineEffects) * 3; + addLog('VICTORY! The Awakened One falls! Gained ' + insightGained + ' Insight!'); + writes.ui = { ...(writes.ui || {}), gameOver: true, victory: true }; writes.prestige = { ...(writes.prestige || {}), loopInsight: insightGained }; writes.game = { day, hour }; applyTickWrites(writes, storeSetters); return; } - if (ctx.combat.maxFloorReached >= 100 && ctx.prestige.signedPacts.includes(100)) { - const insightGained = calcInsight(insightParams, disciplineEffects) * 3; - addLog('VICTORY! The Awakened One falls! Gained ' + insightGained + ' Insight!'); - writes.ui = { ...(writes.ui || {}), gameOver: true, victory: true }; + if (day > MAX_DAY) { + const insightGained = calcInsight(insightParams, disciplineEffects); + addLog('The loop ends. Gained ' + insightGained + ' Insight.'); + writes.ui = { ...(writes.ui || {}), gameOver: true, victory: false }; writes.prestige = { ...(writes.prestige || {}), loopInsight: insightGained }; + writes.game = { day, hour }; applyTickWrites(writes, storeSetters); return; }