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:
@@ -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
|
||||
@@ -56,7 +58,7 @@ function GuardianPactList({ signedPacts, onForceSign, onRemove }: {
|
||||
onForceSign: (floor: number) => void;
|
||||
onRemove: (floor: number) => void;
|
||||
}) {
|
||||
const guardianFloors = Object.keys(GUARDIANS || {}).map(Number).sort((a, b) => a - b);
|
||||
const guardianFloors = getAllGuardianFloors();
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2">
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user