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
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m23s
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { useAttunementStore } from '@/lib/game/stores';
|
||||
import { ATTUNEMENTS_DEF, ATTUNEMENT_SLOT_NAMES, getAttunementXPForLevel, MAX_ATTUNEMENT_LEVEL } from '@/lib/game/data/attunements';
|
||||
import type { AttunementDef, AttunementState } from '@/lib/game/types';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useCallback, useMemo } from 'react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { useCraftingStore } from '@/lib/game/stores/craftingStore';
|
||||
import type { EquipmentSlot } from '@/lib/game/types';
|
||||
import { DebugName } from '@/components/game/debug/debug-context';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useCallback } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { usePrestigeStore, useGameStore } from '@/lib/game/stores';
|
||||
import { PRESTIGE_DEF } from '@/lib/game/constants/prestige';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useState, useMemo } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { useCombatStore, usePrestigeStore, fmt } from '@/lib/game/stores';
|
||||
import { ELEMENT_OPPOSITES, FLOOR_ELEM_CYCLE } from '@/lib/game/constants';
|
||||
|
||||
@@ -22,23 +22,8 @@ export function StatsTab() {
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<ManaStatsSection
|
||||
maxMana={manaStats.maxMana}
|
||||
baseRegen={manaStats.baseRegen}
|
||||
effectiveRegen={manaStats.effectiveRegen}
|
||||
clickMana={manaStats.clickMana}
|
||||
meditationMultiplier={manaStats.meditationMultiplier}
|
||||
upgradeEffects={manaStats.upgradeEffects}
|
||||
stats={{ ...manaStats, rawMana: manaStats.maxMana }}
|
||||
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
|
||||
activeSpellDef={combatStats.activeSpellDef}
|
||||
|
||||
@@ -5,15 +5,13 @@ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Droplet } from 'lucide-react';
|
||||
import type { ComputedEffects } from '@/lib/game/effects/upgrade-effects.types';
|
||||
|
||||
interface ManaStatsSectionProps {
|
||||
export interface ManaStatsData {
|
||||
maxMana: number;
|
||||
baseRegen: number;
|
||||
effectiveRegen: number;
|
||||
clickMana: number;
|
||||
meditationMultiplier: number;
|
||||
upgradeEffects: ComputedEffects;
|
||||
elemMax: number;
|
||||
// Special effect flags passed separately
|
||||
incursionStrength: number;
|
||||
rawMana: number;
|
||||
hasSteadyStream: boolean;
|
||||
@@ -26,27 +24,31 @@ interface ManaStatsSectionProps {
|
||||
hasEternalFlow: boolean;
|
||||
}
|
||||
|
||||
interface ManaStatsSectionProps {
|
||||
stats: ManaStatsData;
|
||||
elemMax: number;
|
||||
}
|
||||
|
||||
export function ManaStatsSection({ stats, elemMax }: ManaStatsSectionProps) {
|
||||
const {
|
||||
maxMana,
|
||||
baseRegen,
|
||||
effectiveRegen,
|
||||
clickMana,
|
||||
meditationMultiplier,
|
||||
upgradeEffects,
|
||||
incursionStrength,
|
||||
rawMana,
|
||||
hasSteadyStream,
|
||||
hasManaTorrent,
|
||||
hasDesperateWells,
|
||||
manaCascadeBonus,
|
||||
manaWaterfallBonus,
|
||||
hasFlowSurge,
|
||||
hasManaOverflow,
|
||||
hasEternalFlow,
|
||||
} = stats;
|
||||
|
||||
export function ManaStatsSection({
|
||||
maxMana,
|
||||
baseRegen,
|
||||
effectiveRegen,
|
||||
clickMana,
|
||||
meditationMultiplier,
|
||||
upgradeEffects,
|
||||
elemMax,
|
||||
incursionStrength,
|
||||
rawMana,
|
||||
hasSteadyStream,
|
||||
hasManaTorrent,
|
||||
hasDesperateWells,
|
||||
manaCascadeBonus,
|
||||
manaWaterfallBonus,
|
||||
hasFlowSurge,
|
||||
hasManaOverflow,
|
||||
hasEternalFlow,
|
||||
}: ManaStatsSectionProps) {
|
||||
return (
|
||||
<Card className="bg-[var(--bg-panel)] border-[var(--border-subtle)]">
|
||||
<CardHeader className="pb-2">
|
||||
|
||||
@@ -7,8 +7,6 @@ import { SPECIAL_EFFECTS, hasSpecial } from './special-effects';
|
||||
|
||||
// Threshold ratios for mana-dependent effects (currentMana / maxMana)
|
||||
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_CRITICAL_THRESHOLD = 0.1;
|
||||
|
||||
@@ -87,4 +85,3 @@ export function computeDynamicClickMana(
|
||||
return Math.floor((baseClickMana + effects.clickManaBonus) * effects.clickManaMultiplier);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user