'use client'; import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { Switch } from '@/components/ui/switch'; import { Label } from '@/components/ui/label'; import { RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye, } from 'lucide-react'; import { DebugName, useDebug } from '@/components/game/debug/debug-context'; import { useGameStore, useManaStore, useUIStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores'; import { computeTotalMaxMana } from '@/lib/game/effects'; import { getUnifiedEffects } from '@/lib/game/effects'; // ─── Warning Banner ────────────────────────────────────────────────────────── function WarningBanner() { return ( Debug Mode These tools are for development and testing. Using them may break game balance or save data. ); } // ─── Display Options ───────────────────────────────────────────────────────── function DisplayOptions() { const { showComponentNames, toggleComponentNames } = useDebug(); return ( Display Options Show Component Names Display component names at the top of each component for debugging ); } // ─── Game Reset Section ────────────────────────────────────────────────────── function GameResetSection({ confirmReset, onReset }: { confirmReset: boolean; onReset: () => void }) { return ( Game Reset Reset all game progress and start fresh. This cannot be undone. {confirmReset ? ( <> Click Again to Confirm Reset > ) : ( <> Reset Game > )} ); } // ─── Mana Debug Section ────────────────────────────────────────────────────── function ManaDebugSection({ rawMana, maxMana, onAddMana, onFillMana }: { rawMana: number; maxMana: number; onAddMana: (amount: number) => void; onFillMana: () => void; }) { return ( Mana Debug Current: {rawMana} / {maxMana || '?'} onAddMana(10)}> +10 onAddMana(100)}> +100 onAddMana(1000)}> +1K onAddMana(10000)}> +10K Fill to max: Fill Mana ); } // ─── Time Control Section ──────────────────────────────────────────────────── function TimeControlSection({ day, hour, paused, onSetDay, onTogglePause }: { day: number; hour: number; paused: boolean; onSetDay: (day: number) => void; onTogglePause: () => void; }) { return ( Time Control Current: Day {day}, Hour {Number.isFinite(hour) ? hour.toFixed(2) : '0.00'} onSetDay(1)}>Day 1 onSetDay(10)}>Day 10 onSetDay(20)}>Day 20 onSetDay(30)}>Day 30 {paused ? '▶ Resume' : '⏸ Pause'} ); } // ─── Quick Actions Section ─────────────────────────────────────────────────── function QuickActionsSection({ onUnlockBase, onUnlockUtility }: { onUnlockBase: () => void; onUnlockUtility: () => void; }) { return ( Quick Actions Unlock All Base Elements Unlock Utility Elements ); } // ─── Main Component ─────────────────────────────────────────────────────────── export function GameStateDebug() { const [confirmReset, setConfirmReset] = useState(false); const { showComponentNames, toggleComponentNames } = useDebug(); const rawMana = useManaStore((s) => s.rawMana); const elements = useManaStore((s) => s.elements); const unlockElement = useManaStore((s) => s.unlockElement); const gatherMana = useGameStore((s) => s.gatherMana); const day = useGameStore((s) => s.day); const hour = useGameStore((s) => s.hour); const paused = useUIStore((s) => s.paused); const togglePause = useUIStore((s) => s.togglePause); const resetGame = useGameStore((s) => s.resetGame); const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades); const equippedInstances = useCraftingStore((s) => s.equippedInstances); const equipmentInstances = useCraftingStore((s) => s.equipmentInstances); const handleReset = () => { if (confirmReset) { resetGame(); setConfirmReset(false); } else { setConfirmReset(true); setTimeout(() => setConfirmReset(false), 3000); } }; const handleAddMana = (amount: number) => { for (let i = 0; i < amount; i++) { gatherMana(); } }; const upgradeEffects = getUnifiedEffects({ skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances }); const computedMaxMana = computeTotalMaxMana( { skills: {}, prestigeUpgrades, skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances }, upgradeEffects ); const handleFillMana = () => { useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, computedMaxMana) })); }; const handleSetDay = (d: number) => { useGameStore.setState({ day: d, hour: 0 }); }; const handleUnlockBase = () => { ['fire', 'water', 'air', 'earth', 'light', 'dark', 'death'].forEach(e => { if (!elements[e]?.unlocked) { unlockElement(e, 500); } }); }; const handleUnlockUtility = () => { ['transference'].forEach(e => { if (!elements[e]?.unlocked) { unlockElement(e, 500); } }); }; return ( ); } GameStateDebug.displayName = 'GameStateDebug';
These tools are for development and testing. Using them may break game balance or save data.
Display component names at the top of each component for debugging
Reset all game progress and start fresh. This cannot be undone.