feat: unify guardian system — merge static GUARDIANS with extended procedural guardians in Pacts tab

- guardian-encounters.ts: add getGuardianForFloor() and getAllGuardianFloors()
  unified lookup functions that merge static GUARDIANS (floors 10-100) with
  extended system (compound 110, exotic 120-140, combo 150+)
- GuardianPactsTab.tsx: use unified system, update tiers to cover all floors
  (Early 10-40, Mid 50-80, Late 90-100, Compound 110, Exotic 120-140,
  Transcendent 150+)
- guardian-pacts-components.tsx: handle combo guardians with dual-element
  display (symbols + names + '✦ Combo' badge)
- docs/circular-deps.txt, docs/dependency-graph.json: auto-generated updates
- craftingStore.ts: extract initial equipment instances to crafting-initial-state.ts
This commit is contained in:
2026-05-23 13:46:17 +02:00
parent 5bc05ded6f
commit feca7549ad
7 changed files with 171 additions and 78 deletions
+25 -9
View File
@@ -5,7 +5,8 @@ import { useShallow } from 'zustand/react/shallow';
import { usePrestigeStore } from '@/lib/game/stores/prestigeStore';
import { useManaStore } from '@/lib/game/stores/manaStore';
import { useUIStore } from '@/lib/game/stores/uiStore';
import { GUARDIANS } from '@/lib/game/constants';
import { getGuardianForFloor, getAllGuardianFloors } from '@/lib/game/data/guardian-encounters';
import type { GuardianDef } from '@/lib/game/types';
import { DebugName } from '@/components/game/debug/debug-context';
import { ScrollArea } from '@/components/ui/scroll-area';
import {
@@ -32,13 +33,19 @@ interface FloorTier {
function groupFloorsByTier(floors: number[]): FloorTier[] {
const tiers: FloorTier[] = [
{ label: 'Early Spire (1040)', floors: [] },
{ label: 'Mid Spire (5060)', floors: [] },
{ label: 'Late Spire (80100)', floors: [] },
{ label: 'Mid Spire (5080)', floors: [] },
{ label: 'Late Spire (90100)', floors: [] },
{ label: 'Compound (110)', floors: [] },
{ label: 'Exotic (120140)', floors: [] },
{ label: 'Transcendent (150+)', floors: [] },
];
for (const f of floors) {
if (f <= 40) tiers[0].floors.push(f);
else if (f <= 60) tiers[1].floors.push(f);
else tiers[2].floors.push(f);
else if (f <= 80) tiers[1].floors.push(f);
else if (f <= 100) tiers[2].floors.push(f);
else if (f <= 110) tiers[3].floors.push(f);
else if (f <= 140) tiers[4].floors.push(f);
else tiers[5].floors.push(f);
}
return tiers.filter(t => t.floors.length > 0);
}
@@ -73,10 +80,19 @@ export const GuardianPactsTab: React.FC = () => {
}, []);
const guardianFloors = useMemo(
() => Object.keys(GUARDIANS).map(Number).sort((a, b) => a - b),
() => getAllGuardianFloors(),
[],
);
const guardianMap = useMemo(() => {
const map: Record<number, GuardianDef> = {};
for (const floor of guardianFloors) {
const g = getGuardianForFloor(floor);
if (g) map[floor] = g;
}
return map;
}, [guardianFloors]);
const tiers = useMemo(() => groupFloorsByTier(guardianFloors), [guardianFloors]);
const filteredFloors = useMemo(() => {
@@ -86,7 +102,7 @@ export const GuardianPactsTab: React.FC = () => {
}, [activeTier, guardianFloors, tiers]);
const handleStartRitual = useCallback((floor: number) => {
const guardian = GUARDIANS[floor];
const guardian = getGuardianForFloor(floor);
if (!guardian) return;
const result = startPactRitual(floor, rawMana);
@@ -100,7 +116,7 @@ export const GuardianPactsTab: React.FC = () => {
const cumulativeBoons = useMemo(() => {
const boonMap: Record<string, number> = {};
for (const floor of signedPacts) {
const guardian = GUARDIANS[floor];
const guardian = getGuardianForFloor(floor);
if (!guardian) continue;
for (const boon of guardian.boons) {
boonMap[boon.type] = (boonMap[boon.type] || 0) + boon.value;
@@ -137,7 +153,7 @@ export const GuardianPactsTab: React.FC = () => {
<ScrollArea className="h-[500px] rounded border border-gray-700 p-3">
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
{filteredFloors.map((floor) => {
const guardian = GUARDIANS[floor];
const guardian = guardianMap[floor];
if (!guardian) return null;
return (
<GuardianCard
@@ -12,11 +12,32 @@ import clsx from 'clsx';
export type GuardianStatus = 'undefeated' | 'defeated' | 'signed';
interface FloorTier {
export interface FloorTier {
label: string;
floors: number[];
}
// ─── Element Display Helper ──────────────────────────────────────────────────
interface ElementDisplay {
sym: string;
name: string;
color: string;
}
function getElementDisplays(element: string): ElementDisplay[] {
// Combo guardians have elements like "fire+water"
const parts = element.split('+');
return parts.map((el) => {
const def = ELEMENTS[el];
return {
sym: def?.sym ?? '?',
name: def?.name ?? el,
color: def?.color ?? '#888',
};
});
}
// ─── Guardian Card ───────────────────────────────────────────────────────────
interface GuardianCardProps {
@@ -40,9 +61,9 @@ export const GuardianCard: React.FC<GuardianCardProps> = React.memo(({
ritualProgress,
onStartRitual,
}) => {
const elemDef = ELEMENTS[guardian.element];
const elemColor = elemDef?.color ?? '#888';
const elemSym = elemDef?.sym ?? '';
const elemDisplays = getElementDisplays(guardian.element);
const primaryColor = elemDisplays[0]?.color ?? '#888';
const isCombo = elemDisplays.length > 1;
const statusConfig: Record<GuardianStatus, { label: string; color: string; bg: string }> = {
undefeated: { label: 'Undefeated', color: 'text-gray-400', bg: 'bg-gray-800/50' },
@@ -54,6 +75,11 @@ export const GuardianCard: React.FC<GuardianCardProps> = React.memo(({
const ritualTime = guardian.pactTime;
const ritualComplete = ritualProgress >= ritualTime;
// Build element label: single element name, or "Fire + Water" for combos
const elementLabel = isCombo
? elemDisplays.map(e => e.name).join(' + ')
: elemDisplays[0]?.name ?? guardian.element;
return (
<Card
className={clsx(
@@ -66,11 +92,18 @@ export const GuardianCard: React.FC<GuardianCardProps> = React.memo(({
<CardHeader className="pb-2">
<div className="flex items-start justify-between gap-2">
<div className="min-w-0">
<CardTitle className="text-sm flex items-center gap-2" style={{ color: elemColor }}>
<span>{elemSym}</span>
<CardTitle className="text-sm flex items-center gap-2" style={{ color: primaryColor }}>
<span className="flex items-center gap-0.5">
{elemDisplays.map((e, i) => (
<span key={i}>{e.sym}</span>
))}
</span>
<span className="truncate">{guardian.name}</span>
</CardTitle>
<div className="text-xs text-gray-500 mt-0.5">Floor {floor} · {elemDef?.name ?? guardian.element}</div>
<div className="text-xs text-gray-500 mt-0.5">
Floor {floor} · {elementLabel}
{isCombo && <span className="ml-1 text-purple-400"> Combo</span>}
</div>
</div>
<Badge className={clsx('text-[10px] px-1.5 py-0 shrink-0', sc.bg, sc.color)}>
{sc.label}