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:
@@ -1,4 +1,4 @@
|
|||||||
# Circular Dependencies
|
# Circular Dependencies
|
||||||
Generated: 2026-05-31T14:13:00.373Z
|
Generated: 2026-05-31T18:23:54.984Z
|
||||||
|
|
||||||
No circular dependencies found. ✅
|
No circular dependencies found. ✅
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"generated": "2026-05-31T14:12:58.516Z",
|
"generated": "2026-05-31T18:23:53.253Z",
|
||||||
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
||||||
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import {
|
|||||||
RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye,
|
RotateCcw, AlertTriangle, Zap, Clock, Settings, Eye,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { DebugName, useDebug } from '@/components/game/debug/debug-context';
|
import { DebugName, useDebug } from '@/components/game/debug/debug-context';
|
||||||
import { useGameStore, useManaStore, useUIStore } from '@/lib/game/stores';
|
import { useGameStore, useManaStore, useUIStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores';
|
||||||
import { computeMaxMana } from '@/lib/game/stores';
|
import { computeTotalMaxMana } from '@/lib/game/effects';
|
||||||
|
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||||
|
|
||||||
// ─── Warning Banner ──────────────────────────────────────────────────────────
|
// ─── Warning Banner ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -101,14 +102,12 @@ function GameResetSection({ confirmReset, onReset }: { confirmReset: boolean; on
|
|||||||
|
|
||||||
// ─── Mana Debug Section ──────────────────────────────────────────────────────
|
// ─── Mana Debug Section ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
function ManaDebugSection({ rawMana, onAddMana, onFillMana }: {
|
function ManaDebugSection({ rawMana, maxMana, onAddMana, onFillMana }: {
|
||||||
rawMana: number;
|
rawMana: number;
|
||||||
|
maxMana: number;
|
||||||
onAddMana: (amount: number) => void;
|
onAddMana: (amount: number) => void;
|
||||||
onFillMana: () => void;
|
onFillMana: () => void;
|
||||||
}) {
|
}) {
|
||||||
const maxMana = computeMaxMana(
|
|
||||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="bg-gray-900/80 border-gray-700">
|
<Card className="bg-gray-900/80 border-gray-700">
|
||||||
@@ -228,6 +227,10 @@ export function GameStateDebug() {
|
|||||||
const togglePause = useUIStore((s) => s.togglePause);
|
const togglePause = useUIStore((s) => s.togglePause);
|
||||||
const resetGame = useGameStore((s) => s.resetGame);
|
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 = () => {
|
const handleReset = () => {
|
||||||
if (confirmReset) {
|
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 handleFillMana = () => {
|
||||||
const maxMana = computeMaxMana(
|
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, computedMaxMana) }));
|
||||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
|
||||||
) || 100;
|
|
||||||
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, maxMana) }));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSetDay = (d: number) => {
|
const handleSetDay = (d: number) => {
|
||||||
@@ -280,7 +286,7 @@ export function GameStateDebug() {
|
|||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<GameResetSection confirmReset={confirmReset} onReset={handleReset} />
|
<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} />
|
<TimeControlSection day={day} hour={hour} paused={paused} onSetDay={handleSetDay} onTogglePause={togglePause} />
|
||||||
<QuickActionsSection
|
<QuickActionsSection
|
||||||
onUnlockBase={handleUnlockBase}
|
onUnlockBase={handleUnlockBase}
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import {
|
|||||||
RotateCcw, AlertTriangle, Zap, Clock, Eye,
|
RotateCcw, AlertTriangle, Zap, Clock, Eye,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { DebugName, useDebug } from '@/components/game/debug/debug-context';
|
import { DebugName, useDebug } from '@/components/game/debug/debug-context';
|
||||||
import { useGameStore, useManaStore, useUIStore } from '@/lib/game/stores';
|
import { useGameStore, useManaStore, useUIStore, usePrestigeStore, useCraftingStore } from '@/lib/game/stores';
|
||||||
import { computeMaxMana } from '@/lib/game/stores';
|
import { computeTotalMaxMana } from '@/lib/game/effects';
|
||||||
|
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||||
|
|
||||||
// ─── Display Options ─────────────────────────────────────────────────────────
|
// ─── Display Options ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -83,14 +84,12 @@ function GameResetSection({ confirmReset, onReset }: { confirmReset: boolean; on
|
|||||||
|
|
||||||
// ─── Mana Debug Section ──────────────────────────────────────────────────────
|
// ─── Mana Debug Section ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
function ManaDebugSection({ rawMana, onAddMana, onFillMana }: {
|
function ManaDebugSection({ rawMana, maxMana, onAddMana, onFillMana }: {
|
||||||
rawMana: number;
|
rawMana: number;
|
||||||
|
maxMana: number;
|
||||||
onAddMana: (amount: number) => void;
|
onAddMana: (amount: number) => void;
|
||||||
onFillMana: () => void;
|
onFillMana: () => void;
|
||||||
}) {
|
}) {
|
||||||
const maxMana = computeMaxMana(
|
|
||||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="bg-gray-900/80 border-gray-700">
|
<Card className="bg-gray-900/80 border-gray-700">
|
||||||
@@ -204,6 +203,10 @@ export function GameStateDebugSection() {
|
|||||||
const resetGame = useGameStore((s) => s.resetGame);
|
const resetGame = useGameStore((s) => s.resetGame);
|
||||||
const gatherMana = useGameStore((s) => s.gatherMana);
|
const gatherMana = useGameStore((s) => s.gatherMana);
|
||||||
|
|
||||||
|
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
|
||||||
|
const equippedInstances = useCraftingStore((s) => s.equippedInstances);
|
||||||
|
const equipmentInstances = useCraftingStore((s) => s.equipmentInstances);
|
||||||
|
|
||||||
const elements = useManaStore((s) => s.elements);
|
const elements = useManaStore((s) => s.elements);
|
||||||
const unlockElement = useManaStore((s) => s.unlockElement);
|
const unlockElement = useManaStore((s) => s.unlockElement);
|
||||||
|
|
||||||
@@ -223,11 +226,14 @@ export function GameStateDebugSection() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const upgradeEffects = getUnifiedEffects({ skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances });
|
||||||
|
const computedMaxMana = computeTotalMaxMana(
|
||||||
|
{ skills: {}, prestigeUpgrades, skillUpgrades: {}, skillTiers: {}, equippedInstances, equipmentInstances },
|
||||||
|
upgradeEffects
|
||||||
|
);
|
||||||
|
|
||||||
const handleFillMana = () => {
|
const handleFillMana = () => {
|
||||||
const maxMana = computeMaxMana(
|
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, computedMaxMana) }));
|
||||||
{ skills: {}, prestigeUpgrades: {}, skillUpgrades: {}, skillTiers: {} }
|
|
||||||
) || 100;
|
|
||||||
useManaStore.setState((s) => ({ rawMana: Math.max(s.rawMana, maxMana) }));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSetDay = (d: number) => {
|
const handleSetDay = (d: number) => {
|
||||||
@@ -249,7 +255,7 @@ export function GameStateDebugSection() {
|
|||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<GameResetSection confirmReset={confirmReset} onReset={handleReset} />
|
<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} />
|
<TimeControlSection day={day} hour={hour} paused={paused} onSetDay={handleSetDay} onTogglePause={togglePause} />
|
||||||
<QuickActionsSection
|
<QuickActionsSection
|
||||||
onUnlockBase={handleUnlockBase}
|
onUnlockBase={handleUnlockBase}
|
||||||
|
|||||||
Reference in New Issue
Block a user