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

- 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:
2026-05-19 13:53:33 +02:00
parent ebcaab62bf
commit 50a9a62060
17 changed files with 215 additions and 154 deletions
+7
View File
@@ -6,6 +6,8 @@ import type { CombatState } from './combat-state.types';
import type { SpellState } from '../types';
import { getFloorMaxHP, getFloorElement, calcDamage, canAffordSpellCost, deductSpellCost } from '../utils';
import { usePrestigeStore } from './prestigeStore';
import { computeDisciplineEffects } from '../effects/discipline-effects';
import { useDisciplineStore } from './discipline-slice';
export function processCombatTick(
get: () => CombatState,
@@ -35,6 +37,9 @@ export function processCombatTick(
return { rawMana, elements, logMessages, totalManaGathered };
}
// Compute discipline bonuses once per tick
const disciplineEffects = computeDisciplineEffects(useDisciplineStore.getState() as any);
// Calculate cast speed (no skill bonus)
const totalAttackSpeed = attackSpeedMult;
const spellCastSpeed = spellDef.castSpeed || 1;
@@ -57,6 +62,7 @@ export function processCombatTick(
{ skills: {}, signedPacts: usePrestigeStore.getState().signedPacts },
spellId,
floorElement,
disciplineEffects,
);
// Let gameStore apply damage modifiers (executioner, berserker)
@@ -111,6 +117,7 @@ export function processCombatTick(
{ skills: {}, signedPacts: usePrestigeStore.getState().signedPacts },
eSpell.spellId,
eFloorElement,
disciplineEffects,
);
const eResult = onDamageDealt(eDamage);