'use client'; import { useGameStore, fmt, fmtDec } from '@/lib/game/store'; import { ELEMENTS } from '@/lib/game/constants'; import { SKILL_EVOLUTION_PATHS, getTierMultiplier } from '@/lib/game/skill-evolution'; import { useManaStats, useCombatStats, useStudyStats } from '@/lib/game/hooks/useGameDerived'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { Droplet, Swords, BookOpen, FlaskConical, RotateCcw, Trophy, Star } from 'lucide-react'; import type { SkillUpgradeChoice } from '@/lib/game/types'; export function StatsTab() { const store = useGameStore(); const { upgradeEffects, maxMana, baseRegen, clickMana, meditationMultiplier, incursionStrength, manaCascadeBonus, manaWaterfallBonus, effectiveRegen, hasSteadyStream, hasManaTorrent, hasDesperateWells, hasManaWaterfall, hasFlowSurge, hasManaOverflow, hasEternalFlow } = useManaStats(); const { activeSpellDef, pactMultiplier, pactInsightMultiplier } = useCombatStats(); const { studySpeedMult, studyCostMult } = useStudyStats(); // Compute element max const elemMax = (() => { const ea = store.skillTiers?.elemAttune || 1; const tieredSkillId = ea > 1 ? `elemAttune_t${ea}` : 'elemAttune'; const level = store.skills[tieredSkillId] || store.skills.elemAttune || 0; const tierMult = getTierMultiplier(tieredSkillId); return 10 + level * 50 * tierMult + (store.prestigeUpgrades.elementalAttune || 0) * 25; })(); // Get all selected skill upgrades const getAllSelectedUpgrades = () => { const upgrades: { skillId: string; upgrade: SkillUpgradeChoice }[] = []; for (const [skillId, selectedIds] of Object.entries(store.skillUpgrades)) { const baseSkillId = skillId.includes('_t') ? skillId.split('_t')[0] : skillId; const path = SKILL_EVOLUTION_PATHS[baseSkillId]; if (!path) continue; for (const tier of path.tiers) { if (tier.skillId === skillId) { for (const upgradeId of selectedIds) { const upgrade = tier.upgrades.find(u => u.id === upgradeId); if (upgrade) { upgrades.push({ skillId, upgrade }); } } } } } return upgrades; }; const selectedUpgrades = getAllSelectedUpgrades(); return (