fix: address multiple bugs (1,2,3,5,6,9,10,11,12,13) - partial fix for 4, remaining 7,8
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 2m9s

This commit is contained in:
2026-05-07 12:28:16 +02:00
parent 54d5e576ab
commit 7851d8c7cb
10 changed files with 136 additions and 22 deletions
+5 -4
View File
@@ -8,10 +8,11 @@ import { useGameStore } from '@/lib/game/stores';
interface GameOverScreenProps {
day: number;
hour: number;
insight: number;
insightGained: number;
totalInsight: number;
}
export function GameOverScreen({ day, hour, insight }: GameOverScreenProps) {
export function GameOverScreen({ day, hour, insightGained, totalInsight }: GameOverScreenProps) {
const startNewLoop = () => {
useGameStore.getState().startNewLoop();
};
@@ -31,7 +32,7 @@ export function GameOverScreen({ day, hour, insight }: GameOverScreenProps) {
<div className="grid grid-cols-2 gap-3">
<div className="p-3 bg-gray-800 rounded">
<div className="text-xl font-bold text-amber-400 game-mono">{fmt(insight)}</div>
<div className="text-xl font-bold text-amber-400 game-mono">{fmt(insightGained)}</div>
<div className="text-xs text-gray-400">Insight Gained</div>
</div>
<div className="p-3 bg-gray-800 rounded">
@@ -43,7 +44,7 @@ export function GameOverScreen({ day, hour, insight }: GameOverScreenProps) {
<div className="text-xs text-gray-400">Hour</div>
</div>
<div className="p-3 bg-gray-800 rounded">
<div className="text-xl font-bold text-green-400 game-mono">{insight}</div>
<div className="text-xl font-bold text-green-400 game-mono">{fmt(totalInsight)}</div>
<div className="text-xs text-gray-400">Total Insight</div>
</div>
</div>
+7 -12
View File
@@ -49,7 +49,7 @@ import { LeftPanel } from './components/LeftPanel';
const SpireTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.SpireTab })));
const SkillsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.SkillsTab })));
const SpellsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.SpellsTab })));
const LabTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.LabTab })));
const StatsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.StatsTab })));
const EquipmentTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.EquipmentTab })));
const AttunementsTab = lazy(() => import('@/components/game/tabs').then(module => ({ default: module.AttunementsTab })));
@@ -72,7 +72,7 @@ function GrimoireTab() {
}
return [];
});
const loaded = grimoireSpells.length > 0 || (typeof window !== 'undefined' && !SPELLS_DEF);
const loaded = typeof window !== 'undefined';
if (!loaded) {
return <div className="p-4 text-center text-gray-400">Loading grimoire...</div>;
@@ -142,6 +142,7 @@ export default function ManaLoopGame() {
const prestigeUpgrades = usePrestigeStore((s) => s.prestigeUpgrades);
const insight = usePrestigeStore((s) => s.insight);
const loopInsight = usePrestigeStore((s) => s.loopInsight);
const rawMana = useManaStore((s) => s.rawMana);
const meditateTicks = useManaStore((s) => s.meditateTicks);
@@ -221,7 +222,7 @@ export default function ManaLoopGame() {
// Conditional returns AFTER all hooks
if (gameOver) {
return <GameOverScreen store={{ day, hour, insight }} />;
return <GameOverScreen day={day} hour={hour} insightGained={loopInsight} totalInsight={insight} />;
}
if (!mounted) return <div className="p-4 text-center text-gray-400">Loading...</div>;
@@ -256,7 +257,7 @@ export default function ManaLoopGame() {
<TabsTrigger value="crafting" className="text-xs px-2 py-1">🔧 Craft</TabsTrigger>
<TabsTrigger value="loot" className="text-xs px-2 py-1">💎 Loot</TabsTrigger>
<TabsTrigger value="achievements" className="text-xs px-2 py-1">🏆 Achieve</TabsTrigger>
<TabsTrigger value="lab" className="text-xs px-2 py-1">🔬 Lab</TabsTrigger>
<TabsTrigger value="stats" className="text-xs px-2 py-1">📊 Stats</TabsTrigger>
<TabsTrigger value="debug" className="text-xs px-2 py-1">🐛 Debug</TabsTrigger>
<TabsTrigger value="grimoire" className="text-xs px-2 py-1">📖 Grimoire</TabsTrigger>
@@ -265,7 +266,7 @@ export default function ManaLoopGame() {
<TabsContent value="spire">
<ErrorBoundary fallback={<div className="p-4 text-red-400">spire tab failed to load.</div>}>
<Suspense fallback={<TabLoadingFallback />}>
<SpireTab />
<SpireTab simpleMode={spireMode} />
</Suspense>
</ErrorBoundary>
</TabsContent>
@@ -334,13 +335,7 @@ export default function ManaLoopGame() {
</ErrorBoundary>
</TabsContent>
<TabsContent value="lab">
<ErrorBoundary fallback={<div className="p-4 text-red-400">lab tab failed to load.</div>}>
<Suspense fallback={<TabLoadingFallback />}>
<LabTab />
</Suspense>
</ErrorBoundary>
</TabsContent>
<TabsContent value="stats">
<ErrorBoundary fallback={<div className="p-4 text-red-400">stats tab failed to load.</div>}>
+1 -2
View File
@@ -29,7 +29,6 @@ export function GameStateDebug() {
// Get actions from stores
const resetGame = useGameStore((s) => s.resetGame);
const setTime = useCombatStore((s) => s.debugSetTime);
const setFloor = useCombatStore((s) => s.debugSetFloor);
const resetHP = useCombatStore((s) => s.resetFloorHP);
@@ -184,7 +183,7 @@ export function GameStateDebug() {
Current: Day {day}, Hour {hour}
</div>
<div className="flex gap-2 flex-wrap">
<Button size="sm" variant="outline" onClick={() => setTime?.(1, 0)}>
<Button size="sm" variant="outline" onClick={() => useGameStore.setState({ day: 1, hour: 0 })}>
Day 1
</Button>
<Button size="sm" variant="outline" onClick={() => setTime?.(10, 0)}>
@@ -13,7 +13,8 @@ export const RAW_SPELLS: Record<string, SpellDef> = {
castSpeed: 3,
unlock: 0,
studyTime: 0,
desc: "A weak bolt of pure mana. Costs raw mana instead of elemental."
desc: "A weak bolt of pure mana. Costs raw mana instead of elemental.",
grimoire: true
},
manaStrike: {
name: "Mana Strike",
@@ -24,6 +25,7 @@ export const RAW_SPELLS: Record<string, SpellDef> = {
castSpeed: 2.5,
unlock: 50,
studyTime: 1,
desc: "A concentrated strike of raw mana. Slightly stronger than Mana Bolt."
desc: "A concentrated strike of raw mana. Slightly stronger than Mana Bolt.",
grimoire: true
},
};
+1
View File
@@ -17,6 +17,7 @@ import { useSkillStore } from './skillStore';
import { useGameStore } from './gameStore';
import { useManaStore } from './manaStore';
import { useCombatStore } from './combatStore';
import { createStartingEquipment } from '../store/crafting-modules/starting-equipment';
import { useUIStore } from './uiStore';
// Import action modules
+28 -1
View File
@@ -24,6 +24,8 @@ import { usePrestigeStore } from './prestigeStore';
import { useManaStore } from './manaStore';
import { useSkillStore } from './skillStore';
import { useCombatStore, makeInitialSpells } from './combatStore';
import { useAttunementStore } from './attunementStore';
import { ATTUNEMENTS_DEF, getAttunementConversionRate } from '../data/attunements';
import { createResetGame, createGatherMana } from './gameActions';
import { createStartNewLoop } from './gameLoopActions';
@@ -146,9 +148,34 @@ export const useGameStore = create<GameCoordinatorStore>()(
// Mana regeneration
let rawMana = Math.min(manaState.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana);
let totalManaGathered = manaState.totalManaGathered;
let elements = { ...manaState.elements };
// Apply attunement conversion (raw mana to primary mana types)
const attunementState = useAttunementStore.getState();
Object.entries(attunementState.attunements).forEach(([id, state]) => {
if (!state.active) return;
const def = ATTUNEMENTS_DEF[id];
if (!def || def.conversionRate <= 0 || !def.primaryManaType) return;
const scaledRate = getAttunementConversionRate(id, state.level || 1);
const conversionThisTick = scaledRate * HOURS_PER_TICK; // per tick
// Cap conversion to available raw mana
const actualConversion = Math.min(conversionThisTick, rawMana);
// Subtract from raw mana
rawMana = Math.max(0, rawMana - actualConversion);
// Add to primary mana type
if (elements[def.primaryManaType]) {
elements[def.primaryManaType].current = Math.min(
elements[def.primaryManaType].max,
elements[def.primaryManaType].current + actualConversion
);
}
});
let totalManaGathered = manaState.totalManaGathered;
// Study progress - handled by skillStore
if (combatState.currentAction === 'study' && skillState.currentStudyTarget) {
const studySpeedMult = getStudySpeedMultiplier(skillState.skills);