fix: resolve elemental mana conversion pause bug (#348)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m22s
Two root causes fixed:
1. gameStore.ts: computeRegen now receives actual attunements instead of empty {}, so rawGrossRegen includes attunement contributions (was ~2/hr, now correct 3000+/hr)
2. gameStore.ts buildConversionParams: use rawManaRegen with level scaling (1.5^(level-1)) instead of conversionRate for per-element grossRegen
3. LeftPanel.tsx: same grossRegen fix + include attunement regen in rawGrossRegen display
4. ElementStatsSection.tsx: same grossRegen fix
5. useGameDerived.ts: pass actual attunements to computeRegen for baseRegen calculation
Added regression test: conversion-pause-bug-regression.test.ts (7 tests)
This commit is contained in:
@@ -15,7 +15,7 @@ import { computeTotalMaxMana, computeTotalRegen, computeTotalClickMana } from '@
|
||||
import { computeDisciplineEffects } from '@/lib/game/effects/discipline-effects';
|
||||
import { computeConversionRates } from '@/lib/game/utils/conversion-rates';
|
||||
import { getGuardianForFloor } from '@/lib/game/data/guardian-encounters';
|
||||
import { ATTUNEMENTS_DEF } from '@/lib/game/data/attunements';
|
||||
import { ATTUNEMENTS_DEF, getTotalAttunementRegen } from '@/lib/game/data/attunements';
|
||||
import type { ElementRegenBreakdown } from '@/components/game/ManaDisplay';
|
||||
|
||||
export function LeftPanel() {
|
||||
@@ -80,12 +80,15 @@ export function LeftPanel() {
|
||||
for (const [id, state] of Object.entries(attunements)) {
|
||||
if (!state.active) continue;
|
||||
const def = ATTUNEMENTS_DEF[id];
|
||||
if (def?.primaryManaType) {
|
||||
if (def?.primaryManaType && def.rawManaRegen) {
|
||||
const levelMult = Math.pow(1.5, (state.level || 1) - 1);
|
||||
grossRegen[def.primaryManaType] = (grossRegen[def.primaryManaType] || 0)
|
||||
+ (def.conversionRate || 0);
|
||||
+ def.rawManaRegen * levelMult;
|
||||
}
|
||||
}
|
||||
const invokerLevel = attunements.invoker?.active ? (attunements.invoker.level || 1) : 0;
|
||||
const attunementRegen = getTotalAttunementRegen(attunements);
|
||||
const totalRawGrossRegen = baseRegen + attunementRegen;
|
||||
const conversionResult = computeConversionRates({
|
||||
disciplineEffects,
|
||||
attunements,
|
||||
@@ -94,7 +97,7 @@ export function LeftPanel() {
|
||||
invokerLevel,
|
||||
meditationMultiplier,
|
||||
grossRegen,
|
||||
rawGrossRegen: baseRegen,
|
||||
rawGrossRegen: totalRawGrossRegen,
|
||||
});
|
||||
const breakdown: Record<string, ElementRegenBreakdown> = {};
|
||||
for (const [elem, entry] of Object.entries(conversionResult.rates)) {
|
||||
|
||||
Reference in New Issue
Block a user