BUG: getMeditationBonus called with wrong arguments in 3 locations (meditation shows 0x)
#212
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
getMeditationBonus()is called with 4 arguments in 3 locations, but the function only accepts 3 parameters. The second argument is{}(empty object) which coerces toNaN, causing the meditation multiplier to display as "0x" and effective regen to show "0/hr".Root Cause
The function signature in
src/lib/game/utils/mana-utils.ts:117-123:But it's called with 4 arguments:
The
{}empty object gets assigned tomeditationEfficiency(expects number), and all subsequent arguments are shifted. Since{}coerces toNaNin arithmetic, the entire function returnsNaN, which displays as0.Affected Files
src/lib/game/hooks/useGameDerived.tsline 59src/app/page.tsxline 94src/app/components/LeftPanel.tsxline 61Note:
src/lib/game/stores/gameHooks.tsline 77 andsrc/lib/game/stores/gameStore.tsline 155 call it correctly with 3 args.Fix
Change all 3 affected call sites from:
To:
Playwright Evidence
Playwright test found mana regen patterns:
["+0", "+1"]— the+0is the broken meditation/hourly regen value.Reproduction
Severity
High - Affects core mana regeneration display and likely the actual regen calculation.
Playwright Test Ref
The Playwright test
e2e/playtest.spec.ts→15 - Deep Bug Hunting → mana regen values in ManaDisplay are correctdetected the broken regen by scanning for regen patterns in the page body. It found["+0", "+1"]where the+0is the broken hourly regen.After fixing the 3 call sites, the test should be updated to verify the regen shows a positive value like
+2.00/hrat game start.✅ Fix Applied
Fixed
getMeditationBonuscalled with 4 arguments (including spurious{}as 2nd arg) in all 3 affected files:Files changed:
src/lib/game/hooks/useGameDerived.ts— removed extra{}argumentsrc/app/page.tsx— removed extra{}argumentsrc/app/components/LeftPanel.tsx— removed extra{}argumentThe meditation multiplier will now correctly show "1.00x" at game start instead of "0x", and effective regen will show proper values instead of "0/hr".
Build: ✅ passing
Fixed — removed erroneous
{}argument from all 3 getMeditationBonus call sites. Meditation multiplier now correctly shows 1.00x at game start.