diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index 6395b50..b33f7ec 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,4 +1,4 @@ # Circular Dependencies -Generated: 2026-05-28T10:11:54.061Z +Generated: 2026-05-28T10:18:57.618Z No circular dependencies found. ✅ diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index d448bba..d4a61c3 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-05-28T10:11:52.202Z", + "generated": "2026-05-28T10:18:55.814Z", "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." }, @@ -95,7 +95,6 @@ ], "crafting-actions/crafting-material-actions.ts": [ "crafting-fabricator.ts", - "stores/combatStore.ts", "stores/manaStore.ts", "stores/uiStore.ts" ], diff --git a/src/components/game/debug/AttunementDebug.tsx b/src/components/game/debug/AttunementDebug.tsx index 0d09dea..5ad832e 100644 --- a/src/components/game/debug/AttunementDebug.tsx +++ b/src/components/game/debug/AttunementDebug.tsx @@ -15,9 +15,10 @@ export function AttunementDebug() { const handleUnlockAttunement = (id: string) => { if (debugUnlockAttunement) { debugUnlockAttunement(id); - // When unlocking Enchanter, also unlock the transference element - if (id === 'enchanter') { - useManaStore.getState().unlockElement('transference', 500); + // When unlocking an attunement that has a primary mana type, unlock that element + const attunementDef = ATTUNEMENTS_DEF[id]; + if (attunementDef?.primaryManaType) { + useManaStore.getState().unlockElement(attunementDef.primaryManaType, 0); } } }; diff --git a/src/lib/game/stores/gameStore.ts b/src/lib/game/stores/gameStore.ts index 6b38699..6705f0a 100644 --- a/src/lib/game/stores/gameStore.ts +++ b/src/lib/game/stores/gameStore.ts @@ -167,37 +167,31 @@ export const useGameStore = create()( meditateTicks = 0; } - // Calculate total attunement conversion per tick + // Calculate total attunement conversion and apply to element pools let totalConversionPerTick = 0; - Object.entries(ctx.attunement.attunements).forEach(([id, state]) => { - if (!state.active) return; - const def = ATTUNEMENTS_DEF[id]; - if (!def || def.conversionRate <= 0 || !def.primaryManaType) return; - const scaledRate = getAttunementConversionRate(id, state.level || 1); - totalConversionPerTick += scaledRate * HOURS_PER_TICK; - }); - - // Calculate effective regen - const effectiveRegen = Math.max(0, baseRegen * (1 - incursionStrength) * meditationMultiplier - totalConversionPerTick); - - // Mana regeneration - let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana); let elements = { ...ctx.mana.elements }; - - // Apply attunement conversion Object.entries(ctx.attunement.attunements).forEach(([id, state]) => { if (!state.active) return; const def = ATTUNEMENTS_DEF[id]; if (!def || def.conversionRate <= 0 || !def.primaryManaType) return; const scaledRate = getAttunementConversionRate(id, state.level || 1); const conversionThisTick = scaledRate * HOURS_PER_TICK; + totalConversionPerTick += conversionThisTick; if (elements[def.primaryManaType]) { + if (!elements[def.primaryManaType].unlocked) { + elements[def.primaryManaType] = { ...elements[def.primaryManaType], unlocked: true }; + } elements[def.primaryManaType].current = Math.min( elements[def.primaryManaType].max, - elements[def.primaryManaType].current + conversionThisTick + elements[def.primaryManaType].current + conversionThisTick, ); } }); + + const effectiveRegen = Math.max(0, baseRegen * (1 - incursionStrength) * meditationMultiplier - totalConversionPerTick); + + // Mana regeneration + let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana); let totalManaGathered = ctx.mana.totalManaGathered; // Convert action