fix: resolve TS compilation errors and all 7 circular dependencies
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m25s
TypeScript fixes: - gameStore.ts: replace result.ok with result.success (Result<void> uses success not ok) - gameStore.ts: fix undefined newProgress variable → ctx.prestige.pactRitualProgress + HOURS_PER_TICK - prestigeStore.ts: replace result.ok with result.success Circular dependency fixes: - Extract GameCoordinatorState to stores/gameStore.types.ts to break gameStore↔tick-pipeline/gameActions/gameLoopActions cycle - Remove getDodgeChance re-export from floor-utils.ts to break floor-utils↔room-utils↔enemy-utils cycle - Replace direct combatStore import in discipline-slice.ts with callback pattern to break discipline-slice↔combatStore↔combat-actions↔discipline-effects cycle Verification: tsc --noEmit clean, madge --circular clean (0 circular deps)
This commit is contained in:
@@ -31,14 +31,7 @@ import { createSafeStorage } from '../utils/safe-persist';
|
||||
import { createStartNewLoop } from './gameLoopActions';
|
||||
import { buildTickContext, applyTickWrites } from './tick-pipeline';
|
||||
import type { TickContext, TickWrites } from './tick-pipeline';
|
||||
|
||||
export interface GameCoordinatorState {
|
||||
day: number;
|
||||
hour: number;
|
||||
incursionStrength: number;
|
||||
containmentWards: number;
|
||||
initialized: boolean;
|
||||
}
|
||||
import type { GameCoordinatorState } from './gameStore.types';
|
||||
|
||||
export interface GameCoordinatorStore extends GameCoordinatorState {
|
||||
tick: () => void;
|
||||
@@ -63,6 +56,11 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
...initialState,
|
||||
|
||||
initGame: () => {
|
||||
// Wire discipline store ↔ combat store callbacks (breaks circular dependency)
|
||||
useDisciplineStore.getState().setPracticingCallbacks({
|
||||
onStartPracticing: () => useCombatStore.getState().startPracticing(),
|
||||
onStopPracticing: () => useCombatStore.getState().stopPracticing(),
|
||||
});
|
||||
set({ initialized: true });
|
||||
},
|
||||
|
||||
@@ -234,7 +232,7 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
const manaStore = useManaStore.getState();
|
||||
for (const manaType of guardian.unlocksMana || []) {
|
||||
const result = manaStore.unlockElement(manaType, 0);
|
||||
if (result.ok) {
|
||||
if (result.success) {
|
||||
addLog(`✨ ${manaType.charAt(0).toUpperCase() + manaType.slice(1)} mana unlocked!`);
|
||||
}
|
||||
}
|
||||
@@ -249,7 +247,7 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
} else {
|
||||
writes.prestige = {
|
||||
...(writes.prestige || {}),
|
||||
pactRitualProgress: newProgress,
|
||||
pactRitualProgress: ctx.prestige.pactRitualProgress + HOURS_PER_TICK,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user