diff --git a/docs/circular-deps.txt b/docs/circular-deps.txt index 05ce645..fdccfc5 100644 --- a/docs/circular-deps.txt +++ b/docs/circular-deps.txt @@ -1,5 +1,5 @@ # Circular Dependencies -Generated: 2026-05-22T16:18:31.266Z +Generated: 2026-05-23T11:46:22.135Z Found: 4 circular chain(s) — these MUST be fixed before modifying involved files. 1. Processed 129 files (1.5s) (3 warnings) diff --git a/docs/dependency-graph.json b/docs/dependency-graph.json index d7ea8a6..bd7c21f 100644 --- a/docs/dependency-graph.json +++ b/docs/dependency-graph.json @@ -1,6 +1,6 @@ { "_meta": { - "generated": "2026-05-22T16:18:29.615Z", + "generated": "2026-05-23T11:46:20.479Z", "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." }, @@ -359,6 +359,7 @@ "data/golems/types.ts" ], "data/guardian-encounters.ts": [ + "constants/guardians.ts", "types.ts" ], "data/loot-drops.ts": [ diff --git a/src/components/game/debug/PactDebug.tsx b/src/components/game/debug/PactDebug.tsx index 667a24b..661858d 100644 --- a/src/components/game/debug/PactDebug.tsx +++ b/src/components/game/debug/PactDebug.tsx @@ -4,7 +4,8 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Bug } from 'lucide-react'; import { usePrestigeStore, useManaStore, useUIStore, useGameStore } from '@/lib/game/stores'; -import { GUARDIANS, ELEMENTS } from '@/lib/game/constants'; +import { ELEMENTS } from '@/lib/game/constants'; +import { getGuardianForFloor, getAllGuardianFloors } from '@/lib/game/data/guardian-encounters'; // ─── Guardian Pact Row ─────────────────────────────────────────────────────── @@ -14,7 +15,8 @@ function GuardianPactRow({ floor, isSigned, onForceSign, onRemove }: { onForceSign: () => void; onRemove: () => void; }) { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); + if (!guardian) return null; return (
void; onRemove: (floor: number) => void; }) { - const guardianFloors = Object.keys(GUARDIANS || {}).map(Number).sort((a, b) => a - b); + const guardianFloors = getAllGuardianFloors(); return (
@@ -90,11 +92,11 @@ export function PactDebug() { const addLog = useUIStore((s) => s.addLog); const forcePact = (floor: number) => { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); if (!guardian) return; if (signedPacts.includes(floor)) { - addLog(`⚠️ Already signed pact with ${guardian.name}!`); + addLog(`\u26a0\ufe0f Already signed pact with ${guardian.name}!`); return; } @@ -121,7 +123,7 @@ export function PactDebug() { }; const removePactHandler = (floor: number) => { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); removePact(floor); @@ -129,7 +131,7 @@ export function PactDebug() { delete newSignedPactDetails[floor]; debugSetPactDetails(newSignedPactDetails); - addLog(`📜 DEBUG: Removed pact with ${guardian?.name || 'Unknown'}!`); + addLog(`\ud83d\udcdc DEBUG: Removed pact with ${guardian ? guardian.name : 'Unknown'}!`); }; const clearAllPacts = () => { diff --git a/src/components/game/tabs/DebugTab/PactDebugSection.tsx b/src/components/game/tabs/DebugTab/PactDebugSection.tsx index fb6e937..201f492 100644 --- a/src/components/game/tabs/DebugTab/PactDebugSection.tsx +++ b/src/components/game/tabs/DebugTab/PactDebugSection.tsx @@ -4,7 +4,8 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Bug } from 'lucide-react'; import { usePrestigeStore, useManaStore, useUIStore, useGameStore } from '@/lib/game/stores'; -import { GUARDIANS, ELEMENTS } from '@/lib/game/constants'; +import { ELEMENTS } from '@/lib/game/constants'; +import { getGuardianForFloor, getAllGuardianFloors } from '@/lib/game/data/guardian-encounters'; // ─── Guardian Pact Row ─────────────────────────────────────────────────────── @@ -14,7 +15,8 @@ function GuardianPactRow({ floor, isSigned, onForceSign, onRemove }: { onForceSign: () => void; onRemove: () => void; }) { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); + if (!guardian) return null; return (
s.addLog); - const guardianFloors = Object.keys(GUARDIANS || {}).map(Number).sort((a, b) => a - b); + const guardianFloors = getAllGuardianFloors(); const forcePact = (floor: number) => { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); if (!guardian) return; if (signedPacts.includes(floor)) { @@ -99,7 +101,7 @@ export function PactDebugSection() { }; const removePactHandler = (floor: number) => { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); removePact(floor); @@ -107,7 +109,7 @@ export function PactDebugSection() { delete newSignedPactDetails[floor]; debugSetPactDetails(newSignedPactDetails); - addLog(`📜 DEBUG: Removed pact with ${guardian?.name || 'Unknown'}!`); + addLog(`\ud83d\udcdc DEBUG: Removed pact with ${guardian ? guardian.name : 'Unknown'}!`); }; const signAllPacts = () => { diff --git a/src/components/game/tabs/SpireSummaryTab.tsx b/src/components/game/tabs/SpireSummaryTab.tsx index c5cb633..3a57b90 100644 --- a/src/components/game/tabs/SpireSummaryTab.tsx +++ b/src/components/game/tabs/SpireSummaryTab.tsx @@ -3,7 +3,9 @@ import { useState, useEffect, useMemo } from 'react'; import { useShallow } from 'zustand/react/shallow'; import { useCombatStore, usePrestigeStore, fmt } from '@/lib/game/stores'; -import { GUARDIANS, ELEMENT_OPPOSITES, FLOOR_ELEM_CYCLE } from '@/lib/game/constants'; +import { ELEMENT_OPPOSITES, FLOOR_ELEM_CYCLE } from '@/lib/game/constants'; +import { getGuardianForFloor, getAllGuardianFloors } from '@/lib/game/data/guardian-encounters'; +import type { GuardianDef } from '@/lib/game/types'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; @@ -14,9 +16,7 @@ import { Mountain } from 'lucide-react'; // ─── Guardian Data ──────────────────────────────────────────────────────────── -const GUARDIAN_FLOORS = Object.keys(GUARDIANS) - .map(Number) - .sort((a, b) => a - b); +const GUARDIAN_FLOORS = getAllGuardianFloors(); // ─── Helper: Get Counter Element ───────────────────────────────────────────── @@ -56,7 +56,7 @@ function FloorProgressBar({ maxFloor, clearedFloors }: { maxFloor: number; clear
{row.map((floor) => { const isCleared = clearedSet.has(floor); - const isGuardian = !!GUARDIANS[floor]; + const isGuardian = !!getGuardianForFloor(floor); const isCurrent = floor === maxFloor; let bgClass = 'bg-gray-800'; @@ -76,8 +76,8 @@ function FloorProgressBar({ maxFloor, clearedFloors }: { maxFloor: number; clear isGuardian ? 'font-bold' : '' }`} title={ - GUARDIANS[floor] - ? `Floor ${floor} — ${GUARDIANS[floor].name} (${GUARDIANS[floor].element})` + getGuardianForFloor(floor) + ? `Floor ${floor} — ${getGuardianForFloor(floor)!.name} (${getGuardianForFloor(floor)!.element})` : `Floor ${floor}${isCleared ? ' (cleared)' : ''}` } > @@ -148,7 +148,7 @@ function StatCell({ value, label, color }: { value: number | string; label: stri // ─── Next Guardian Card ────────────────────────────────────────────────────── -function NextGuardianCard({ nextGuardian, nextGuardianData }: { nextGuardian: number; nextGuardianData: (typeof GUARDIANS)[number] }) { +function NextGuardianCard({ nextGuardian, nextGuardianData }: { nextGuardian: number; nextGuardianData: GuardianDef }) { const counterElement = getCounterElement(nextGuardianData.element); const nextFloorElement = FLOOR_ELEM_CYCLE[(nextGuardian - 1) % FLOOR_ELEM_CYCLE.length]; @@ -244,16 +244,19 @@ function GuardianRoster({ clearedFloors }: { clearedFloors: Record
- {GUARDIAN_FLOORS.map((floor) => ( - - ))} + {GUARDIAN_FLOORS.map((floor) => { + const guardian = getGuardianForFloor(floor); + return guardian ? ( + + ) : null; + })}
); } -function GuardianRosterItem({ floor, guardian, isDefeated }: { floor: number; guardian: (typeof GUARDIANS)[number]; isDefeated: boolean }) { +function GuardianRosterItem({ floor, guardian, isDefeated }: { floor: number; guardian: GuardianDef; isDefeated: boolean }) { return (
!clearedFloors[floor]) || null; }, [clearedFloors]); - const nextGuardianData = nextGuardian ? GUARDIANS[nextGuardian] : null; + const nextGuardianData = nextGuardian ? getGuardianForFloor(nextGuardian) : null; const totalFloorsCleared = useMemo(() => { return Object.values(clearedFloors).filter(Boolean).length; diff --git a/src/lib/game/utils/pact-utils.ts b/src/lib/game/utils/pact-utils.ts index ad9542c..f75587d 100644 --- a/src/lib/game/utils/pact-utils.ts +++ b/src/lib/game/utils/pact-utils.ts @@ -1,6 +1,6 @@ // ─── Pact Utility Functions ─────────────────────────────────────────────────── -import { GUARDIANS } from '../constants'; +import { getGuardianForFloor } from '../data/guardian-encounters'; export function computePactMultiplier(state: { signedPacts: number[]; @@ -12,7 +12,7 @@ export function computePactMultiplier(state: { let baseMult = 1.0; for (const floor of signedPacts) { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); if (guardian) { baseMult *= guardian.damageMultiplier; } @@ -43,7 +43,7 @@ export function computePactInsightMultiplier(state: { let mult = 1.0; for (const floor of signedPacts) { - const guardian = GUARDIANS[floor]; + const guardian = getGuardianForFloor(floor); if (guardian) { mult *= guardian.insightMultiplier; }