refactor: simplify ManaStatsSection props from 17 fields to single stats object
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s

This commit is contained in:
2026-05-26 18:28:24 +02:00
parent da4f9eccb3
commit ef850e98e2
9 changed files with 31 additions and 48 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
# Circular Dependencies # Circular Dependencies
Generated: 2026-05-26T15:02:41.168Z Generated: 2026-05-26T16:00:34.993Z
Found: 6 circular chain(s) — these MUST be fixed before modifying involved files. Found: 6 circular chain(s) — these MUST be fixed before modifying involved files.
1. Processed 135 files (1.5s) (2 warnings) 1. Processed 135 files (1.6s) (2 warnings)
2. 1) utils/floor-utils.ts > utils/room-utils.ts > utils/enemy-utils.ts 2. 1) utils/floor-utils.ts > utils/room-utils.ts > utils/enemy-utils.ts
3. 2) utils/floor-utils.ts > utils/room-utils.ts 3. 2) utils/floor-utils.ts > utils/room-utils.ts
4. 3) stores/gameStore.ts > stores/gameActions.ts 4. 3) stores/gameStore.ts > stores/gameActions.ts
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"_meta": { "_meta": {
"generated": "2026-05-26T15:02:39.505Z", "generated": "2026-05-26T16:00:33.141Z",
"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."
}, },
@@ -1,6 +1,5 @@
'use client'; 'use client';
import { useState } from 'react';
import { useAttunementStore } from '@/lib/game/stores'; import { useAttunementStore } from '@/lib/game/stores';
import { ATTUNEMENTS_DEF, ATTUNEMENT_SLOT_NAMES, getAttunementXPForLevel, MAX_ATTUNEMENT_LEVEL } from '@/lib/game/data/attunements'; import { ATTUNEMENTS_DEF, ATTUNEMENT_SLOT_NAMES, getAttunementXPForLevel, MAX_ATTUNEMENT_LEVEL } from '@/lib/game/data/attunements';
import type { AttunementDef, AttunementState } from '@/lib/game/types'; import type { AttunementDef, AttunementState } from '@/lib/game/types';
+1 -1
View File
@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useState, useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { useCraftingStore } from '@/lib/game/stores/craftingStore'; import { useCraftingStore } from '@/lib/game/stores/craftingStore';
import type { EquipmentSlot } from '@/lib/game/types'; import type { EquipmentSlot } from '@/lib/game/types';
import { DebugName } from '@/components/game/debug/debug-context'; import { DebugName } from '@/components/game/debug/debug-context';
+1 -1
View File
@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useState, useCallback } from 'react'; import { useCallback } from 'react';
import { useShallow } from 'zustand/react/shallow'; import { useShallow } from 'zustand/react/shallow';
import { usePrestigeStore, useGameStore } from '@/lib/game/stores'; import { usePrestigeStore, useGameStore } from '@/lib/game/stores';
import { PRESTIGE_DEF } from '@/lib/game/constants/prestige'; import { PRESTIGE_DEF } from '@/lib/game/constants/prestige';
+1 -1
View File
@@ -1,6 +1,6 @@
'use client'; 'use client';
import { useState, useMemo } from 'react'; import { useMemo } from 'react';
import { useShallow } from 'zustand/react/shallow'; import { useShallow } from 'zustand/react/shallow';
import { useCombatStore, usePrestigeStore, fmt } from '@/lib/game/stores'; import { useCombatStore, usePrestigeStore, fmt } from '@/lib/game/stores';
import { ELEMENT_OPPOSITES, FLOOR_ELEM_CYCLE } from '@/lib/game/constants'; import { ELEMENT_OPPOSITES, FLOOR_ELEM_CYCLE } from '@/lib/game/constants';
+1 -16
View File
@@ -22,23 +22,8 @@ export function StatsTab() {
return ( return (
<div className="space-y-4"> <div className="space-y-4">
<ManaStatsSection <ManaStatsSection
maxMana={manaStats.maxMana} stats={{ ...manaStats, rawMana: manaStats.maxMana }}
baseRegen={manaStats.baseRegen}
effectiveRegen={manaStats.effectiveRegen}
clickMana={manaStats.clickMana}
meditationMultiplier={manaStats.meditationMultiplier}
upgradeEffects={manaStats.upgradeEffects}
elemMax={elemMax} elemMax={elemMax}
incursionStrength={manaStats.incursionStrength}
rawMana={manaStats.maxMana}
hasSteadyStream={manaStats.hasSteadyStream}
hasManaTorrent={manaStats.hasManaTorrent}
hasDesperateWells={manaStats.hasDesperateWells}
manaCascadeBonus={manaStats.manaCascadeBonus}
manaWaterfallBonus={manaStats.manaWaterfallBonus}
hasFlowSurge={manaStats.hasFlowSurge}
hasManaOverflow={manaStats.hasManaOverflow}
hasEternalFlow={manaStats.hasEternalFlow}
/> />
<CombatStatsSection <CombatStatsSection
activeSpellDef={combatStats.activeSpellDef} activeSpellDef={combatStats.activeSpellDef}
@@ -5,15 +5,13 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Droplet } from 'lucide-react'; import { Droplet } from 'lucide-react';
import type { ComputedEffects } from '@/lib/game/effects/upgrade-effects.types'; import type { ComputedEffects } from '@/lib/game/effects/upgrade-effects.types';
interface ManaStatsSectionProps { export interface ManaStatsData {
maxMana: number; maxMana: number;
baseRegen: number; baseRegen: number;
effectiveRegen: number; effectiveRegen: number;
clickMana: number; clickMana: number;
meditationMultiplier: number; meditationMultiplier: number;
upgradeEffects: ComputedEffects; upgradeEffects: ComputedEffects;
elemMax: number;
// Special effect flags passed separately
incursionStrength: number; incursionStrength: number;
rawMana: number; rawMana: number;
hasSteadyStream: boolean; hasSteadyStream: boolean;
@@ -26,16 +24,19 @@ interface ManaStatsSectionProps {
hasEternalFlow: boolean; hasEternalFlow: boolean;
} }
interface ManaStatsSectionProps {
stats: ManaStatsData;
elemMax: number;
}
export function ManaStatsSection({ stats, elemMax }: ManaStatsSectionProps) {
export function ManaStatsSection({ const {
maxMana, maxMana,
baseRegen, baseRegen,
effectiveRegen, effectiveRegen,
clickMana, clickMana,
meditationMultiplier, meditationMultiplier,
upgradeEffects, upgradeEffects,
elemMax,
incursionStrength, incursionStrength,
rawMana, rawMana,
hasSteadyStream, hasSteadyStream,
@@ -46,7 +47,8 @@ export function ManaStatsSection({
hasFlowSurge, hasFlowSurge,
hasManaOverflow, hasManaOverflow,
hasEternalFlow, hasEternalFlow,
}: ManaStatsSectionProps) { } = stats;
return ( return (
<Card className="bg-[var(--bg-panel)] border-[var(--border-subtle)]"> <Card className="bg-[var(--bg-panel)] border-[var(--border-subtle)]">
<CardHeader className="pb-2"> <CardHeader className="pb-2">
-3
View File
@@ -7,8 +7,6 @@ import { SPECIAL_EFFECTS, hasSpecial } from './special-effects';
// Threshold ratios for mana-dependent effects (currentMana / maxMana) // Threshold ratios for mana-dependent effects (currentMana / maxMana)
const MANA_HIGH_THRESHOLD = 0.75; const MANA_HIGH_THRESHOLD = 0.75;
const MANA_OVERPOWER_THRESHOLD = 0.8;
const MANA_BERSERKER_THRESHOLD = 0.5;
const MANA_LOW_THRESHOLD = 0.25; const MANA_LOW_THRESHOLD = 0.25;
const MANA_CRITICAL_THRESHOLD = 0.1; const MANA_CRITICAL_THRESHOLD = 0.1;
@@ -87,4 +85,3 @@ export function computeDynamicClickMana(
return Math.floor((baseClickMana + effects.clickManaBonus) * effects.clickManaMultiplier); return Math.floor((baseClickMana + effects.clickManaBonus) * effects.clickManaMultiplier);
} }