BUG: Stats tab "Total Max Mana" ignores discipline bonuses #210
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The Stats tab shows "Total Max Mana: 100" even when disciplines provide +Max Mana bonuses. Meanwhile the LeftPanel mana bar correctly shows the increased max (e.g. 111). This is because
StatsTabandLeftPanelcompute max mana using different code paths.Root Cause
StatsTabusesuseManaStats()fromsrc/lib/game/hooks/useGameDerived.ts, which calls:But the
upgradeEffectsis computed viagetUnifiedEffects({...})which does NOT include discipline stat bonuses — it only merges equipment and upgrade effects. ThedisciplineEffectsare passed butcomputeMaxManaonly usesdiscipline.bonuses.maxManaBonuswhich isn't properly aggregated through this path.Meanwhile
LeftPanelusescomputeTotalMaxMana(...)fromsrc/lib/game/effects.tswhich correctly merges:Affected Files
src/components/game/tabs/StatsTab.tsx- passesmaxManatoManaStatsSectionsrc/lib/game/hooks/useGameDerived.ts-useManaStatscomputes maxManaFix
Make
StatsTabuse the samecomputeTotalMaxManafunction thatLeftPaneluses, or pass themaxManavalue fromLeftPaneldown to the tabs.Reproduction
✅ Playwright Confirmation (QA Run 2026-05-30)
Status: CONFIRMED - Stats tab max mana inconsistency verified.
Playwright Evidence
Root Cause Verified
Confirmed in code:
useManaStats()inuseGameDerived.tsline 56 computesdisciplineEffectsbut does NOT pass it tocomputeMaxMana()on line 58. The discipline bonus is silently dropped.Note
The LeftPanel uses a different code path (
computeTotalMaxManafromeffects.ts) which correctly includes discipline bonuses. This creates the discrepancy described in the issue.Fix Applied
Root Cause
In
useManaStats()(src/lib/game/hooks/useGameDerived.ts),disciplineEffectswas referenced in themaxManauseMemo (line 57) before it was defined (line 66). This meantdisciplineEffectswas effectivelyundefinedwhen passed tocomputeMaxMana(), causing discipline bonuses to be silently dropped.Changes Made
src/lib/game/hooks/useGameDerived.ts:disciplineEffectscomputation (wrapped inuseMemo) before theupgradeEffectsandmaxManauseMemo calls, so it's properly defined when referencedcomputeDisciplineEffects()call that was below the return statementdisciplineMaxManaBonusto the returned stats object so it can be displayed in the UIsrc/components/game/tabs/StatsTab/ManaStatsSection.tsx:disciplineMaxManaBonusto theManaStatsDatainterfaceTests
spire-utils.test.tsare unrelated — guardian element mapping)Result
Stats tab "Total Max Mana" now matches LeftPanel's mana bar — both correctly include discipline bonuses.