'use client';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { ScrollArea } from '@/components/ui/scroll-area';
import { Separator } from '@/components/ui/separator';
import {
Golem, Zap, Clock, Swords, Shield, Target, Sparkles, Lock, Check, X
} from 'lucide-react';
import { GOLEMS_DEF, getGolemSlots, isGolemUnlocked, getGolemDamage, getGolemAttackSpeed, getGolemFloorDuration } from '@/lib/game/data/golems';
import { ELEMENTS } from '@/lib/game/constants';
import { fmt } from '@/lib/game/store';
import type { GameStore } from '@/lib/game/store';
import type { GolemancyState, AttunementState, ElementState } from '@/lib/game/types';
export interface GolemancyTabProps {
store: GameStore;
}
export function GolemancyTab({ store }: GolemancyTabProps) {
const attunements = store.attunements;
const elements = store.elements;
const skills = store.skills;
const golemancy = store.golemancy;
const currentFloor = store.currentFloor;
const currentRoom = store.currentRoom;
const toggleGolem = store.toggleGolem;
// Get Fabricator level and golem slots
const fabricatorLevel = attunements.fabricator?.level || 0;
const fabricatorActive = attunements.fabricator?.active || false;
const maxSlots = getGolemSlots(fabricatorLevel);
// Get unlocked elements
const unlockedElements = Object.entries(elements)
.filter(([, e]) => e.unlocked)
.map(([id]) => id);
// Get all unlocked golems
const unlockedGolems = Object.values(GOLEMS_DEF).filter(golem =>
isGolemUnlocked(golem.id, attunements, unlockedElements)
);
// Check if golemancy is available
const hasGolemancy = fabricatorActive && fabricatorLevel >= 2;
// Check if currently in combat (not puzzle)
const inCombat = currentRoom.roomType !== 'puzzle';
// Get element info helper
const getElementInfo = (elementId: string) => {
return ELEMENTS[elementId];
};
// Render a golem card
const renderGolemCard = (golemId: string, isUnlocked: boolean) => {
const golem = GOLEMS_DEF[golemId];
if (!golem) return null;
const isEnabled = golemancy.enabledGolems.includes(golemId);
const isSelected = golemancy.summonedGolems.some(g => g.golemId === golemId);
// Calculate effective stats
const damage = getGolemDamage(golemId, skills);
const attackSpeed = getGolemAttackSpeed(golemId, skills);
const floorDuration = getGolemFloorDuration(skills);
// Get element color
const primaryElement = getElementInfo(golem.baseManaType);
const elementColor = primaryElement?.color || '#888';
if (!isUnlocked) {
// Locked golem card
return (
{golem.description}
Unlock the Fabricator attunement and reach Level 2 to summon golems.
Golems are automatically summoned at the start of each combat floor. They cost mana to maintain and will be dismissed if you run out.