fix: resolve runtime issues with game loop, tabs, and error handling
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m46s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m46s
- Fix game loop store mismatch (page.tsx now uses modular stores matching gameHooks.ts) - Fix StatsTab.tsx type errors (signedPacts now from usePrestigeStore) - Fix React hooks violations (all hooks called before conditional returns) - Add ErrorBoundary to page.tsx for better error handling - Fix getStudySpeedMultiplier called with correct arguments - Build succeeds consistently
This commit is contained in:
@@ -5,7 +5,6 @@ import { getTierMultiplier } from '@/lib/game/skill-evolution';
|
||||
import { hasSpecial, SPECIAL_EFFECTS } from '@/lib/game/effects';
|
||||
import { getUnifiedEffects } from '@/lib/game/effects';
|
||||
import { fmt, fmtDec, computeMaxMana, computeRegen, computeClickMana, getMeditationBonus, getIncursionStrength, getStudySpeedMultiplier, getStudyCostMultiplier } from '@/lib/game/stores';
|
||||
import type { UnifiedEffects } from '@/lib/game/types';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
@@ -30,13 +29,13 @@ export function StatsTab() {
|
||||
const insight = usePrestigeStore((s) => s.insight);
|
||||
const totalInsight = usePrestigeStore((s) => s.totalInsight);
|
||||
const memorySlots = usePrestigeStore((s) => s.memorySlots);
|
||||
const signedPacts = usePrestigeStore((s) => s.signedPacts);
|
||||
|
||||
const elements = useManaStore((s) => s.elements);
|
||||
const totalManaGathered = useManaStore((s) => s.totalManaGathered);
|
||||
const rawMana = useManaStore((s) => s.rawMana);
|
||||
const meditateTicks = useManaStore((s) => s.meditateTicks);
|
||||
|
||||
const signedPacts = useCombatStore((s) => s.signedPacts);
|
||||
const maxFloorReached = useCombatStore((s) => s.maxFloorReached);
|
||||
const spells = useCombatStore((s) => s.spells);
|
||||
|
||||
@@ -46,8 +45,8 @@ export function StatsTab() {
|
||||
skillTiers,
|
||||
equippedInstances: {},
|
||||
equipmentInstances: {}
|
||||
}) as UnifiedEffects;
|
||||
|
||||
});
|
||||
|
||||
// Compute derived stats
|
||||
const maxMana = computeMaxMana({
|
||||
skills,
|
||||
@@ -70,17 +69,15 @@ export function StatsTab() {
|
||||
skillTiers
|
||||
});
|
||||
|
||||
// Get meditation multiplier
|
||||
const meditationMultiplier = getMeditationBonus(meditateTicks, skills, upgradeEffects.meditationEfficiency);
|
||||
|
||||
// Get incursion strength
|
||||
const day = useGameStore((s) => s.day);
|
||||
const hour = useGameStore((s) => s.hour);
|
||||
const incursionStrength = getIncursionStrength(day, hour);
|
||||
|
||||
|
||||
// Effective regen with incursion penalty
|
||||
const effectiveRegenWithSpecials = baseRegen * (1 - incursionStrength);
|
||||
|
||||
|
||||
// Mana Cascade bonus
|
||||
const manaCascadeBonus = hasSpecial(upgradeEffects, SPECIAL_EFFECTS.MANA_CASCADE)
|
||||
? Math.floor(maxMana / 100) * 0.1
|
||||
@@ -93,11 +90,11 @@ export function StatsTab() {
|
||||
|
||||
// Effective regen
|
||||
const effectiveRegen = (effectiveRegenWithSpecials + manaCascadeBonus + manaWaterfallBonus) * meditationMultiplier;
|
||||
|
||||
|
||||
// Get study speed/cost multipliers
|
||||
const studySpeedMult = getStudySpeedMultiplier(skills);
|
||||
const studyCostMult = getStudyCostMultiplier(skills);
|
||||
|
||||
|
||||
// Check special effects
|
||||
const hasManaWaterfall = hasSpecial(upgradeEffects, SPECIAL_EFFECTS.MANA_WATERFALL);
|
||||
const hasFlowSurge = hasSpecial(upgradeEffects, SPECIAL_EFFECTS.FLOW_SURGE);
|
||||
|
||||
Reference in New Issue
Block a user