From 25109c920abb68fafc84f0df3185293914d3f397 Mon Sep 17 00:00:00 2001 From: n8n-gitea Date: Mon, 25 May 2026 11:51:10 +0200 Subject: [PATCH] refactor: remove memory slot system and Memories section from PrestigeTab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove deepMemory prestige upgrade from constants/prestige.ts - Remove Memory interface from types.ts - Remove memorySlots, memories, addMemory, removeMemory, clearMemories from prestigeStore.ts - Remove deepMemory/memory references from gameLoopActions.ts - Remove MemoriesCard component and its usage from PrestigeTab.tsx - Remove memorySlots display from LoopStatsSection.tsx - Update tests: store-actions-combat-prestige.test.ts, PrestigeTab.test.ts, tick-integration.test.ts The memory slot system was fully wired but had no gameplay mechanic — addMemory() was never called outside tests. This removes dead code across 9 files. --- docs/circular-deps.txt | 14 +++--- docs/dependency-graph.json | 16 +++++-- src/components/game/tabs/PrestigeTab.test.ts | 6 +-- src/components/game/tabs/PrestigeTab.tsx | 40 ++-------------- .../game/tabs/StatsTab/LoopStatsSection.tsx | 7 +-- .../store-actions-combat-prestige.test.ts | 46 +------------------ .../game/__tests__/tick-integration.test.ts | 2 - src/lib/game/constants/prestige.ts | 1 - src/lib/game/stores/gameLoopActions.ts | 2 - src/lib/game/stores/prestigeStore.ts | 39 +--------------- src/lib/game/types.ts | 7 --- 11 files changed, 29 insertions(+), 151 deletions(-) diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index 1d6ed30..316f6dc 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,11 +1,13 @@ # Circular Dependencies -Generated: 2026-05-23T17:29:49.986Z -Found: 4 circular chain(s) — these MUST be fixed before modifying involved files. +Generated: 2026-05-24T12:34:53.927Z +Found: 6 circular chain(s) — these MUST be fixed before modifying involved files. -1. Processed 132 files (1.4s) (3 warnings) -2. 1) stores/gameStore.ts > stores/gameActions.ts -3. 2) stores/gameStore.ts > stores/gameLoopActions.ts -4. 3) stores/gameStore.ts > stores/tick-pipeline.ts +1. Processed 132 files (1.4s) (2 warnings) +2. 1) utils/floor-utils.ts > utils/room-utils.ts > utils/enemy-utils.ts +3. 2) utils/floor-utils.ts > utils/room-utils.ts +4. 3) stores/gameStore.ts > stores/gameActions.ts +5. 4) stores/gameStore.ts > stores/gameLoopActions.ts +6. 5) stores/gameStore.ts > stores/tick-pipeline.ts ## How to fix 1. Identify which import in the chain can be extracted to a shared types/utils file. diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index 844efb5..2a77195 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-05-23T17:29:48.378Z", + "generated": "2026-05-24T12:34:52.317Z", "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." }, @@ -203,6 +203,7 @@ "types/disciplines.ts" ], "data/enchantment-effects.ts": [ + "data/enchantment-types.ts", "data/enchantments/index.ts" ], "data/enchantment-types.ts": [ @@ -361,7 +362,9 @@ "data/golems/types.ts", "data/golems/utils.ts" ], - "data/golems/types.ts": [], + "data/golems/types.ts": [ + "types.ts" + ], "data/golems/utils.ts": [ "data/golems/golems-data.ts", "data/golems/types.ts" @@ -374,7 +377,7 @@ "types.ts" ], "data/loot-drops.ts": [ - "types.ts" + "types/game.ts" ], "effects.ts": [ "data/enchantment-effects.ts", @@ -441,7 +444,8 @@ "utils/safe-persist.ts" ], "stores/crafting-initial-state.ts": [ - "crafting-utils.ts" + "crafting-utils.ts", + "types.ts" ], "stores/craftingStore.ts": [ "crafting-actions/application-actions.ts", @@ -472,6 +476,7 @@ "data/disciplines/enchanter.ts", "data/disciplines/fabricator.ts", "data/disciplines/invoker.ts", + "types.ts", "types/disciplines.ts", "utils/discipline-math.ts", "utils/safe-persist.ts" @@ -631,7 +636,8 @@ ], "utils/floor-utils.ts": [ "constants.ts", - "data/guardian-encounters.ts" + "data/guardian-encounters.ts", + "utils/room-utils.ts" ], "utils/formatting.ts": [], "utils/index.ts": [ diff --git a/src/components/game/tabs/PrestigeTab.test.ts b/src/components/game/tabs/PrestigeTab.test.ts index 88bc23a..cd6483e 100644 --- a/src/components/game/tabs/PrestigeTab.test.ts +++ b/src/components/game/tabs/PrestigeTab.test.ts @@ -28,9 +28,9 @@ describe('Tab barrel export', () => { // ─── Test: Prestige upgrade definitions ──────────────────────────────────────── describe('Prestige upgrade definitions', () => { - it('has exactly 14 prestige upgrades', async () => { + it('has exactly 13 prestige upgrades', async () => { const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige'); - expect(Object.keys(PRESTIGE_DEF).length).toBe(14); + expect(Object.keys(PRESTIGE_DEF).length).toBe(13); }); it('all upgrades have required fields', async () => { @@ -46,7 +46,7 @@ describe('Prestige upgrade definitions', () => { it('all 14 expected upgrade IDs are present', async () => { const { PRESTIGE_DEF } = await import('@/lib/game/constants/prestige'); const expectedIds = [ - 'manaWell', 'manaFlow', 'deepMemory', 'insightAmp', 'spireKey', + 'manaWell', 'manaFlow', 'insightAmp', 'spireKey', 'temporalEcho', 'steadyHand', 'ancientKnowledge', 'elementalAttune', 'spellMemory', 'guardianPact', 'quickStart', 'elemStart', 'unlockedManaTypeCapacity', diff --git a/src/components/game/tabs/PrestigeTab.tsx b/src/components/game/tabs/PrestigeTab.tsx index 9cc0b0b..b94f65a 100644 --- a/src/components/game/tabs/PrestigeTab.tsx +++ b/src/components/game/tabs/PrestigeTab.tsx @@ -56,33 +56,6 @@ function InsightSummary({ insight, totalInsight, loopCount, loopInsight }: { ); } -// ─── Memories Card ──────────────────────────────────────────────────────────── - -function MemoriesCard({ memories, memorySlots }: { memories: { skillId: string; level: number; tier: number }[]; memorySlots: number }) { - return ( - - - -

- Skills carried between loops. Slots: {memories.length}/{memorySlots} -

- {memories.length === 0 ? ( -

No memories stored yet.

- ) : ( -
- {memories.map((m) => ( -
- {m.skillId} - Lv.{m.level} T{m.tier} -
- ))} -
- )} -
-
- ); -} - // ─── Pacts Card ─────────────────────────────────────────────────────────────── function PactsCard({ signedPacts, pactSlots, defeatedGuardians }: { @@ -177,7 +150,7 @@ function ResetLoopSection({ loopInsight, onReset }: { loopInsight: number; onRes

Reset Loop

- End the current loop and gain {fmt(loopInsight)} insight. Your prestige upgrades, memories, and pacts are preserved. + End the current loop and gain {fmt(loopInsight)} insight. Your prestige upgrades and pacts are preserved.

@@ -191,7 +164,7 @@ function ResetLoopSection({ loopInsight, onReset }: { loopInsight: number; onRes Reset the Loop? This will end your current loop and award you {fmt(loopInsight)} insight. - Your prestige upgrades, memories, and pacts will be preserved. + Your prestige upgrades and pacts will be preserved.

Day, hour, mana, floor progress, and combat state will be reset.
@@ -221,8 +194,6 @@ export function PrestigeTab() { loopInsight, loopCount, prestigeUpgrades, - memorySlots, - memories, pactSlots, signedPacts, defeatedGuardians, @@ -233,8 +204,6 @@ export function PrestigeTab() { loopInsight: s.loopInsight, loopCount: s.loopCount, prestigeUpgrades: s.prestigeUpgrades, - memorySlots: s.memorySlots, - memories: s.memories, pactSlots: s.pactSlots, signedPacts: s.signedPacts, defeatedGuardians: s.defeatedGuardians, @@ -275,10 +244,7 @@ export function PrestigeTab() { loopInsight={loopInsight} /> -
- - -
+ diff --git a/src/components/game/tabs/StatsTab/LoopStatsSection.tsx b/src/components/game/tabs/StatsTab/LoopStatsSection.tsx index 405f34f..8ab1d0f 100644 --- a/src/components/game/tabs/StatsTab/LoopStatsSection.tsx +++ b/src/components/game/tabs/StatsTab/LoopStatsSection.tsx @@ -14,7 +14,6 @@ export function LoopStatsSection() { const maxFloorReached = useCombatStore((s) => s.maxFloorReached); const totalManaGathered = useManaStore((s) => s.totalManaGathered); const loopCount = usePrestigeStore((s) => s.loopCount); - const memorySlots = usePrestigeStore((s) => s.memorySlots); const spellsLearned = Object.values(spells || {}).filter((s: SpellState) => s.learned).length; @@ -46,7 +45,7 @@ export function LoopStatsSection() { -
+
{spellsLearned}
Spells Learned
@@ -55,10 +54,6 @@ export function LoopStatsSection() {
{fmt(totalManaGathered)}
Total Mana Gathered
-
-
{memorySlots}
-
Memory Slots
-
diff --git a/src/lib/game/__tests__/store-actions-combat-prestige.test.ts b/src/lib/game/__tests__/store-actions-combat-prestige.test.ts index 0d83f06..30edba0 100644 --- a/src/lib/game/__tests__/store-actions-combat-prestige.test.ts +++ b/src/lib/game/__tests__/store-actions-combat-prestige.test.ts @@ -38,9 +38,7 @@ function resetPrestigeStore() { totalInsight: 500, loopInsight: 0, prestigeUpgrades: {}, - memorySlots: 3, pactSlots: 1, - memories: [], defeatedGuardians: [], signedPacts: [], signedPactDetails: {}, @@ -211,46 +209,6 @@ describe('PrestigeStore', () => { } }); - it('should increase memorySlots with deepMemory', () => { - usePrestigeStore.setState({ insight: 2000 }); - const before = usePrestigeStore.getState().memorySlots; - const deepResult = usePrestigeStore.getState().doPrestige('deepMemory'); - expect(deepResult.success).toBe(true); - expect(usePrestigeStore.getState().memorySlots).toBe(before + 1); - }); - }); - - describe('addMemory / removeMemory', () => { - it('should add a memory when slots available', () => { - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 3, tier: 1, upgrades: [] }); - expect(usePrestigeStore.getState().memories.length).toBe(1); - }); - - it('should not add duplicate memory', () => { - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 3, tier: 1, upgrades: [] }); - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 5, tier: 1, upgrades: [] }); - expect(usePrestigeStore.getState().memories.length).toBe(1); - }); - - it('should not exceed memory slots', () => { - usePrestigeStore.setState({ memorySlots: 1 }); - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 1, tier: 1, upgrades: [] }); - usePrestigeStore.getState().addMemory({ skillId: 'manaSpring', level: 1, tier: 1, upgrades: [] }); - expect(usePrestigeStore.getState().memories.length).toBe(1); - }); - - it('should remove memory by skillId', () => { - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 3, tier: 1, upgrades: [] }); - usePrestigeStore.getState().removeMemory('manaFlow'); - expect(usePrestigeStore.getState().memories.length).toBe(0); - }); - - it('should clear all memories', () => { - usePrestigeStore.getState().addMemory({ skillId: 'manaFlow', level: 1, tier: 1, upgrades: [] }); - usePrestigeStore.getState().addMemory({ skillId: 'manaSpring', level: 1, tier: 1, upgrades: [] }); - usePrestigeStore.getState().clearMemories(); - expect(usePrestigeStore.getState().memories.length).toBe(0); - }); }); describe('defeatGuardian / signedPacts', () => { @@ -362,10 +320,10 @@ describe('PrestigeStore', () => { describe('resetPrestigeForNewLoop', () => { it('should preserve insight and upgrades, reset loop state', () => { - usePrestigeStore.getState().resetPrestigeForNewLoop(200, { manaWell: 2 }, [], 4); + usePrestigeStore.getState().resetPrestigeForNewLoop(200, { manaWell: 2 }); expect(usePrestigeStore.getState().insight).toBe(200); expect(usePrestigeStore.getState().prestigeUpgrades).toEqual({ manaWell: 2 }); - expect(usePrestigeStore.getState().memorySlots).toBe(4); + expect(usePrestigeStore.getState().defeatedGuardians).toEqual([]); }); }); diff --git a/src/lib/game/__tests__/tick-integration.test.ts b/src/lib/game/__tests__/tick-integration.test.ts index 5850391..53111a7 100644 --- a/src/lib/game/__tests__/tick-integration.test.ts +++ b/src/lib/game/__tests__/tick-integration.test.ts @@ -64,9 +64,7 @@ function resetAllStores() { totalInsight: 0, loopInsight: 0, prestigeUpgrades: {}, - memorySlots: 3, pactSlots: 1, - memories: [], defeatedGuardians: [], signedPacts: [], signedPactDetails: {}, diff --git a/src/lib/game/constants/prestige.ts b/src/lib/game/constants/prestige.ts index 85aedbe..87aa7d1 100644 --- a/src/lib/game/constants/prestige.ts +++ b/src/lib/game/constants/prestige.ts @@ -4,7 +4,6 @@ import type { PrestigeDef } from '../types'; export const PRESTIGE_DEF: Record = { manaWell: { name: "Mana Well", desc: "+500 starting max mana", max: 5, cost: 500 }, manaFlow: { name: "Mana Flow", desc: "+0.5 regen/sec permanently", max: 10, cost: 750 }, - deepMemory: { name: "Deep Memory", desc: "+1 memory slot", max: 5, cost: 1000 }, insightAmp: { name: "Insight Amp", desc: "+25% insight gain", max: 4, cost: 1500 }, spireKey: { name: "Spire Key", desc: "Start at floor +2", max: 5, cost: 4000 }, temporalEcho: { name: "Temporal Echo", desc: "+10% mana generation", max: 5, cost: 3000 }, diff --git a/src/lib/game/stores/gameLoopActions.ts b/src/lib/game/stores/gameLoopActions.ts index af9f966..913f90e 100644 --- a/src/lib/game/stores/gameLoopActions.ts +++ b/src/lib/game/stores/gameLoopActions.ts @@ -39,8 +39,6 @@ export const createStartNewLoop = (set: (state: Partial) = usePrestigeStore.getState().resetPrestigeForNewLoop( total, pu, - prestigeState.memories, - 3 + (pu.deepMemory || 0) ); usePrestigeStore.getState().incrementLoopCount(); diff --git a/src/lib/game/stores/prestigeStore.ts b/src/lib/game/stores/prestigeStore.ts index 1d63651..9aa934a 100755 --- a/src/lib/game/stores/prestigeStore.ts +++ b/src/lib/game/stores/prestigeStore.ts @@ -1,10 +1,9 @@ // ─── Prestige Store ─────────────────────────────────────────────────────────── -// Handles insight, prestige upgrades, memories, loops, pacts +// Handles insight, prestige upgrades, loops, pacts import { create } from 'zustand'; import { persist } from 'zustand/middleware'; import { createSafeStorage } from '../utils/safe-persist'; -import type { Memory } from '../types'; import { PRESTIGE_DEF } from '../constants'; import { getGuardianForFloor } from '../data/guardian-encounters'; import { ok, okVoid, fail, ErrorCode } from '../utils/result'; @@ -23,12 +22,8 @@ export interface PrestigeState { // Prestige upgrades prestigeUpgrades: Record; - memorySlots: number; pactSlots: number; - // Memories (skills preserved across loops) - memories: Memory[]; - // Guardian pacts defeatedGuardians: number[]; signedPacts: number[]; @@ -46,9 +41,6 @@ export interface PrestigeState { export interface PrestigeActions { doPrestige: (id: string) => Result; - addMemory: (memory: Memory) => void; - removeMemory: (skillId: string) => void; - clearMemories: () => void; startPactRitual: (floor: number, rawMana: number) => Result; cancelPactRitual: () => void; completePactRitual: (addLog: (msg: string) => void) => void; @@ -65,8 +57,6 @@ export interface PrestigeActions { resetPrestigeForNewLoop: ( totalInsight: number, prestigeUpgrades: Record, - memories: Memory[], - memorySlots: number ) => void; // Loop management @@ -98,9 +88,7 @@ const initialState: PrestigeState = { totalInsight: 0, loopInsight: 0, prestigeUpgrades: {}, - memorySlots: 3, pactSlots: 1, - memories: [], defeatedGuardians: [], signedPacts: [], signedPactDetails: {}, @@ -126,30 +114,11 @@ export const usePrestigeStore = create()( set({ insight: state.insight - pd.cost, prestigeUpgrades: newPU, - memorySlots: id === 'deepMemory' ? state.memorySlots + 1 : state.memorySlots, pactSlots: id === 'pactBinding' ? state.pactSlots + 1 : state.pactSlots, }); return okVoid(); }, - addMemory: (memory: Memory) => { - const state = get(); - if (state.memories.length >= state.memorySlots) return; - if (state.memories.some(m => m.skillId === memory.skillId)) return; - - set({ memories: [...state.memories, memory] }); - }, - - removeMemory: (skillId: string) => { - set((state) => ({ - memories: state.memories.filter(m => m.skillId !== skillId), - })); - }, - - clearMemories: () => { - set({ memories: [] }); - }, - startPactRitual: (floor: number, rawMana: number) => { const state = get(); const guardian = getGuardianForFloor(floor); @@ -242,14 +211,10 @@ export const usePrestigeStore = create()( resetPrestigeForNewLoop: ( totalInsight: number, prestigeUpgrades: Record, - memories: Memory[], - memorySlots: number ) => { set({ insight: totalInsight, prestigeUpgrades, - memories, - memorySlots, // Reset loop-specific state defeatedGuardians: [], signedPacts: [], @@ -304,9 +269,7 @@ export const usePrestigeStore = create()( totalInsight: state.totalInsight, loopInsight: state.loopInsight, prestigeUpgrades: state.prestigeUpgrades, - memorySlots: state.memorySlots, pactSlots: state.pactSlots, - memories: state.memories, defeatedGuardians: state.defeatedGuardians, signedPacts: state.signedPacts, signedPactDetails: state.signedPactDetails, diff --git a/src/lib/game/types.ts b/src/lib/game/types.ts index dff73f7..c3db6d1 100755 --- a/src/lib/game/types.ts +++ b/src/lib/game/types.ts @@ -73,10 +73,3 @@ export interface SkillUpgradeChoice { }; } -// ─── New: Memory Type Definition ───────────────────────────────────────────── -export interface Memory { - skillId: string; - level: number; - tier: number; - upgrades: string[]; -}