fix: unify guardian system references across pact-utils, SpireSummaryTab, PactDebug, and PactDebugSection

- pact-utils.ts: Replace GUARDIANS[floor] with getGuardianForFloor() so pact multipliers work for extended guardians (floors 110+)
- SpireSummaryTab.tsx: Use getGuardianForFloor()/getAllGuardianFloors() instead of static GUARDIANS constant; update type annotations to GuardianDef
- PactDebug.tsx: Use unified guardian lookup; add null guards for getGuardianForFloor return type
- PactDebugSection.tsx: Use unified guardian lookup; add null guards for getGuardianForFloor return type
This commit is contained in:
2026-05-23 14:53:12 +02:00
parent feca7549ad
commit d7b822d965
6 changed files with 39 additions and 31 deletions
@@ -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 (
<div
@@ -65,10 +67,10 @@ export function PactDebugSection() {
const addLog = useUIStore((s) => 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 = () => {