fix: debug panel shows correct max mana using full computeTotalMaxMana
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
- GameStateDebugSection.tsx: use real prestigeUpgrades, equipment, and unified effects instead of empty objects always returning base 100 - GameStateDebug.tsx (legacy): same fix - Both now compute max mana identically to LeftPanel.tsx Fixes #242 (closes incorrect #237 - mana wasn't exceeding cap)
This commit is contained in:
@@ -10,8 +10,9 @@ import {
|
||||
RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye,
|
||||
} from 'lucide-react';
|
||||
import { DebugName, useDebug } from '@/components/game/debug/debug-context';
|
||||
import { useGameStore, useManaStore, useUIStore } from '@/lib/game/stores';
|
||||
import { computeMaxMana } from '@/lib/game/stores';
|
||||
import { useGameStore, useManaStore, useUIStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores';
|
||||
import { computeTotalMaxMana } from '@/lib/game/effects';
|
||||
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||
|
||||
// ─── Warning Banner ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -101,14 +102,12 @@ function GameResetSection({ confirmReset, onReset }: { confirmReset: boolean; on
|
||||
|
||||
// ─── Mana Debug Section ──────────────────────────────────────────────────────
|
||||
|
||||
function ManaDebugSection({ rawMana, onAddMana, onFillMana }: {
|
||||
function ManaDebugSection({ rawMana, maxMana, onAddMana, onFillMana }: {
|
||||
rawMana: number;
|
||||
maxMana: number;
|
||||
onAddMana: (amount: number) => void;
|
||||
onFillMana: () => void;
|
||||
}) {
|
||||
const maxMana = computeMaxMana(
|
||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
||||
);
|
||||
|
||||
return (
|
||||
<Card className="bg-gray-900/80 border-gray-700">
|
||||
@@ -228,6 +227,10 @@ export function GameStateDebug() {
|
||||
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) {
|
||||
@@ -245,11 +248,14 @@ export function GameStateDebug() {
|
||||
}
|
||||
};
|
||||
|
||||
const upgradeEffects = getUnifiedEffects({ skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances });
|
||||
const computedMaxMana = computeTotalMaxMana(
|
||||
{ skills: {}, prestigeUpgrades, skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances },
|
||||
upgradeEffects
|
||||
);
|
||||
|
||||
const handleFillMana = () => {
|
||||
const maxMana = computeMaxMana(
|
||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
||||
) || 100;
|
||||
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, maxMana) }));
|
||||
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, computedMaxMana) }));
|
||||
};
|
||||
|
||||
const handleSetDay = (d: number) => {
|
||||
@@ -280,7 +286,7 @@ export function GameStateDebug() {
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<GameResetSection confirmReset={confirmReset} onReset={handleReset} />
|
||||
<ManaDebugSection rawMana={rawMana} onAddMana={handleAddMana} onFillMana={handleFillMana} />
|
||||
<ManaDebugSection rawMana={rawMana} maxMana={computedMaxMana} onAddMana={handleAddMana} onFillMana={handleFillMana} />
|
||||
<TimeControlSection day={day} hour={hour} paused={paused} onSetDay={handleSetDay} onTogglePause={togglePause} />
|
||||
<QuickActionsSection
|
||||
onUnlockBase={handleUnlockBase}
|
||||
|
||||
Reference in New Issue
Block a user