fix: resolve priority 4 issues — discipline mutation, skill→discipline migration, uiStore persistence, game loop interval, toast listener leak, page re-renders
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m21s
- Issue 70: Fix discipline-slice.ts nested element mutation (use immutable spread) - Issue 71: Add persist middleware to uiStore for paused/gameOver/victory - Issue 72: Wire discipline effects into calcDamage (spell-casting, void-manipulation) - Issue 73: Fix useGameLoop interval recreation (use getState() + empty deps) - Issue 74: Fix use-toast.ts listener leak (change [state] dep to []) - Issue 75: Reduce page.tsx re-renders with useShallow for multi-field subscriptions - Issue 76: Fix createGatherMana hardcoded click mana (use computeClickMana with discipline effects) - Issue 77: Pass discipline effects to computeMaxMana/computeRegen/calcInsight in tick() - Export DisciplineBonuses type and useDisciplineStore from barrel exports - Update tests to match new function signatures
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { computeMaxMana } from '../utils';
|
||||
import { computeMaxMana, computeClickMana } from '../utils';
|
||||
import { useUIStore } from './uiStore';
|
||||
import { usePrestigeStore } from './prestigeStore';
|
||||
import { useManaStore } from './manaStore';
|
||||
import { useCombatStore } from './combatStore';
|
||||
import { computeDisciplineEffects } from '../effects/discipline-effects';
|
||||
import { useDisciplineStore } from './discipline-slice';
|
||||
|
||||
export const createResetGame = (set: (state: any) => void, initialState: any) => () => {
|
||||
// Clear all persisted state
|
||||
@@ -14,6 +16,7 @@ export const createResetGame = (set: (state: any) => void, initialState: any) =>
|
||||
localStorage.removeItem('mana-loop-game-storage');
|
||||
localStorage.removeItem('mana-loop-crafting-storage');
|
||||
localStorage.removeItem('mana-loop-attunement-storage');
|
||||
localStorage.removeItem('mana-loop-discipline-store');
|
||||
}
|
||||
|
||||
const startFloor = 1;
|
||||
@@ -30,11 +33,14 @@ export const createResetGame = (set: (state: any) => void, initialState: any) =>
|
||||
};
|
||||
|
||||
export const createGatherMana = () => () => {
|
||||
const manaState = useManaStore.getState();
|
||||
const prestigeState = usePrestigeStore.getState();
|
||||
const disciplineEffects = computeDisciplineEffects(useDisciplineStore.getState() as any);
|
||||
|
||||
// Base click mana (no skill bonuses)
|
||||
const cm = 1;
|
||||
// Compute click mana with discipline bonuses (mana-channeling → clickManaMultiplier)
|
||||
const cm = computeClickMana(
|
||||
{ skills: {} },
|
||||
disciplineEffects,
|
||||
);
|
||||
|
||||
const max = computeMaxMana(
|
||||
{
|
||||
@@ -43,7 +49,8 @@ export const createGatherMana = () => () => {
|
||||
skillUpgrades: {},
|
||||
skillTiers: {}
|
||||
},
|
||||
undefined
|
||||
undefined,
|
||||
disciplineEffects,
|
||||
);
|
||||
|
||||
useManaStore.getState().gatherMana(cm, max);
|
||||
|
||||
Reference in New Issue
Block a user