Bug: totalManaGathered doesn't count meditation regen mana #217

Closed
opened 2026-05-30 19:46:59 +02:00 by Anexim · 1 comment
Owner

Bug Description

The totalManaGathered stat is used in the insight calculation (totalManaGathered / 500), but it only tracks mana from active clicking (gatherMana) and combat loot. The primary source of mana income — passive meditation regen — is completely uncounted.

Code Location

  • src/lib/game/stores/manaStore.ts lines 85-88 and 99-102: addRawMana and gatherMana increment totalManaGathered
  • src/lib/game/stores/gameStore.ts line 182: Passive regen adds to rawMana directly without incrementing totalManaGathered
// In gameStore.ts tick():
let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana);
// totalManaGathered is NOT incremented here

Impact

Players who primarily gather mana through meditation (the core gameplay loop) get significantly less insight on loop restart than intended. The insight formula expects totalManaGathered to represent all mana gained, but meditation-derived mana — which is the majority of income — is excluded.

Note

The test in tick-integration.test.ts line 132 says "expected behavior — totalManaGathered tracks active gathering", suggesting this may be intentional design. If so, the insight formula should be adjusted to not depend on totalManaGathered as a measure of "all mana ever gathered."

Fix Options

  1. Count meditation regen: Add totalManaGathered += effectiveRegen * HOURS_PER_TICK in the tick pipeline
  2. Adjust insight formula: Use rawMana + sum(element.current) instead of totalManaGathered for insight calculation
  3. Rename the stat: Rename to totalManaGatheredActive to clarify it only tracks active gathering
## Bug Description The `totalManaGathered` stat is used in the insight calculation (`totalManaGathered / 500`), but it only tracks mana from active clicking (`gatherMana`) and combat loot. The primary source of mana income — passive meditation regen — is completely uncounted. ## Code Location - `src/lib/game/stores/manaStore.ts` lines 85-88 and 99-102: `addRawMana` and `gatherMana` increment `totalManaGathered` - `src/lib/game/stores/gameStore.ts` line 182: Passive regen adds to `rawMana` directly without incrementing `totalManaGathered` ```typescript // In gameStore.ts tick(): let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana); // totalManaGathered is NOT incremented here ``` ## Impact Players who primarily gather mana through meditation (the core gameplay loop) get significantly less insight on loop restart than intended. The insight formula expects `totalManaGathered` to represent all mana gained, but meditation-derived mana — which is the majority of income — is excluded. ## Note The test in `tick-integration.test.ts` line 132 says "expected behavior — totalManaGathered tracks active gathering", suggesting this may be intentional design. If so, the insight formula should be adjusted to not depend on `totalManaGathered` as a measure of "all mana ever gathered." ## Fix Options 1. **Count meditation regen**: Add `totalManaGathered += effectiveRegen * HOURS_PER_TICK` in the tick pipeline 2. **Adjust insight formula**: Use `rawMana + sum(element.current)` instead of `totalManaGathered` for insight calculation 3. **Rename the stat**: Rename to `totalManaGatheredActive` to clarify it only tracks active gathering
Anexim added the ai:todo label 2026-05-30 19:46:59 +02:00
n8n-gitea was assigned by Anexim 2026-05-30 19:46:59 +02:00
Author
Owner

Fixed: totalManaGathered now counts meditation regen. Also fixes #224 by only counting regen that fits below the mana cap.

Fixed: totalManaGathered now counts meditation regen. Also fixes #224 by only counting regen that fits below the mana cap.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#217