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:
@@ -21,7 +21,7 @@ import { enchanterSpecialDisciplines } from '../data/disciplines/enchanter-speci
|
||||
import { fabricatorDisciplines } from '../data/disciplines/fabricator';
|
||||
import { invokerDisciplines } from '../data/disciplines/invoker';
|
||||
import { MAX_CONCURRENT_DISCIPLINES } from '../types/disciplines';
|
||||
import { useCombatStore } from './combatStore';
|
||||
|
||||
|
||||
const ALL_DISCIPLINES = [
|
||||
...baseDisciplines,
|
||||
@@ -43,6 +43,7 @@ export interface DisciplineStoreState {
|
||||
concurrentLimit: number;
|
||||
totalXP: number;
|
||||
processedPerks: string[];
|
||||
practicingCallbacks: { onStartPracticing: () => void; onStopPracticing: () => void } | null;
|
||||
}
|
||||
|
||||
export interface DisciplineStoreActions {
|
||||
@@ -53,6 +54,7 @@ export interface DisciplineStoreActions {
|
||||
elements: Record<string, ElementState>;
|
||||
unlockedEffects: string[];
|
||||
};
|
||||
setPracticingCallbacks(callbacks: { onStartPracticing: () => void; onStopPracticing: () => void }): void;
|
||||
}
|
||||
|
||||
export type DisciplineStore = DisciplineStoreState & DisciplineStoreActions;
|
||||
@@ -65,6 +67,7 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
||||
concurrentLimit: MAX_CONCURRENT_DISCIPLINES,
|
||||
totalXP: 0,
|
||||
processedPerks: [],
|
||||
practicingCallbacks: null,
|
||||
|
||||
activate(id, gameState) {
|
||||
set((s) => {
|
||||
@@ -114,7 +117,7 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
||||
|
||||
const discState = existing || { id, xp: 0, paused: false };
|
||||
// Set currentAction to 'practicing' (only overrides 'meditate')
|
||||
useCombatStore.getState().startPracticing();
|
||||
get().practicingCallbacks?.onStartPracticing?.();
|
||||
return {
|
||||
disciplines: { ...s.disciplines, [id]: { ...discState, paused: false } },
|
||||
activeIds: [...s.activeIds, id],
|
||||
@@ -127,7 +130,7 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
||||
const newActiveIds = s.activeIds.filter((aid) => aid !== id);
|
||||
// If no more active disciplines, restore currentAction to 'meditate'
|
||||
if (newActiveIds.length === 0) {
|
||||
useCombatStore.getState().stopPracticing();
|
||||
get().practicingCallbacks?.onStopPracticing?.();
|
||||
}
|
||||
return {
|
||||
activeIds: newActiveIds,
|
||||
@@ -138,6 +141,10 @@ export const useDisciplineStore = create<DisciplineStore>()(
|
||||
});
|
||||
},
|
||||
|
||||
setPracticingCallbacks(callbacks) {
|
||||
set({ practicingCallbacks: callbacks });
|
||||
},
|
||||
|
||||
processTick(mana) {
|
||||
const s = get();
|
||||
let rawMana = mana.rawMana;
|
||||
|
||||
Reference in New Issue
Block a user