'use client'; import React from 'react'; import { CORES, ALL_CORES, FRAMES, ALL_FRAMES, MIND_CIRCUITS, ALL_MIND_CIRCUITS, GOLEM_ENCHANTMENTS, ALL_GOLEM_ENCHANTMENTS, } from '@/lib/game/data/golems'; import type { CoreDefinition, FrameDefinition, MindCircuitDefinition, GolemEnchantmentDefinition, ComputedGolemStats, } from '@/lib/game/data/golems/types'; import { ELEMENTS } from '@/lib/game/constants/elements'; import { ScrollArea } from '@/components/ui/scroll-area'; import clsx from 'clsx'; import { formatRequirement } from './golemancy-utils'; import { ComponentSelector, StatsPreview } from './GolemancySharedComponents'; export interface GolemDesignBuilderProps { selectedCoreId: string | null; selectedFrameId: string | null; selectedCircuitId: string | null; selectedEnchantmentIds: string[]; designName: string; selectedManaTypes: string[]; unlockedCoreIds: Set; unlockedFrameIds: Set; unlockedCircuitIds: Set; computedStats: ComputedGolemStats | null; affordability: { canAfford: boolean; missing: string }; enchantmentCapacity: number; usedEnchantmentCapacity: number; golemSlots: number; enabledCount: number; onSelectCore: (id: string) => void; onSelectFrame: (id: string) => void; onSelectCircuit: (id: string) => void; onToggleEnchantment: (id: string) => void; onDesignNameChange: (name: string) => void; onSaveDesign: () => void; } export const GolemDesignBuilder: React.FC = ({ selectedCoreId, selectedFrameId, selectedCircuitId, selectedEnchantmentIds, designName, selectedManaTypes, unlockedCoreIds, unlockedFrameIds, unlockedCircuitIds, computedStats, affordability, enchantmentCapacity, usedEnchantmentCapacity, onSelectCore, onSelectFrame, onSelectCircuit, onToggleEnchantment, onDesignNameChange, onSaveDesign, }) => { const canSaveDesign = selectedCoreId && selectedFrameId && selectedCircuitId && affordability.canAfford; const selectedCore = selectedCoreId ? CORES[selectedCoreId] ?? null : null; const selectedFrame = selectedFrameId ? FRAMES[selectedFrameId] ?? null : null; const selectedCircuit = selectedCircuitId ? MIND_CIRCUITS[selectedCircuitId] ?? null : null; return (
onDesignNameChange(e.target.value)} placeholder="Enter a name for this golem..." className="w-full rounded bg-gray-800 border border-gray-700 px-3 py-1.5 text-xs text-gray-200 placeholder-gray-600 focus:outline-none focus:border-blue-500" />
(
{core.name} T{core.tier}

{core.description}

Cap: {core.manaCapacity}Regen: {core.manaRegen}/hDuration: {core.maxRoomDuration}r
{!unlocked &&

🔒 {formatRequirement(core.unlockRequirement)}

}
)} /> (
{frame.name} {frame.element && {ELEMENTS[frame.element]?.sym ?? ''} {frame.element}}

{frame.description}

DMG: {frame.baseDamage}SPD: {frame.attackSpeed}/h AP: {Math.round(frame.armorPierce * 100)}%MA: {Math.round(frame.magicAffinity * 100)}% {frame.aoeTargets > 1 && AoE: {frame.aoeTargets}} {frame.specialEffect !== 'none' && {frame.specialEffect}}
{!unlocked &&

🔒 {formatRequirement(frame.unlockRequirement)}

}
)} /> (
{circuit.name} Slots: {circuit.spellSlots}

{circuit.description}

Behavior: {circuit.behavior}
{!unlocked &&

🔒 {formatRequirement(circuit.unlockRequirement)}

}
)} /> {selectedCore && selectedFrame && selectedCircuit && (

4. Enchantments (Optional) {usedEnchantmentCapacity}/{Math.round(enchantmentCapacity)} capacity

{usedEnchantmentCapacity > enchantmentCapacity &&

Over capacity! Remove enchantments to save design.

}
{ALL_GOLEM_ENCHANTMENTS.map(enchant => { const isSelected = selectedEnchantmentIds.includes(enchant.id); const canAdd = !isSelected && usedEnchantmentCapacity + enchant.capacityCost <= enchantmentCapacity; return ( ); })}
)}

Stats Preview

); }; GolemDesignBuilder.displayName = 'GolemDesignBuilder';