[High] [Bug] Auto-paused disciplines never auto-resume when mana regenerates + still give full bonuses while paused #380

Closed
opened 2026-06-12 12:05:44 +02:00 by Anexim · 2 comments
Owner

Bug Summary

Two related bugs:

  1. When a discipline is auto-paused due to insufficient mana, it never auto-resumes when mana regenerates — the player must manually click "Start Practicing"
  2. Auto-paused disciplines still contribute full stat bonuses (conversion rates, regen bonuses, damage bonuses) despite being "paused"

Expected Behavior

  • Disciplines should automatically resume practicing once enough mana is available
  • Auto-paused disciplines should NOT contribute stat bonuses

Root Cause

Bug 1 (No auto-resume): In src/lib/game/stores/discipline-slice.ts:210:

if (disc.autoPaused) continue; // already auto-paused, don't re-process

This unconditionally skips all auto-paused disciplines every tick. No code anywhere in the tick pipeline checks whether mana has been restored and clears autoPaused. Note: mana regeneration happens BEFORE discipline processing in the tick pipeline (gameStore.ts), so the data is available — the logic just doesn't check it.

Bug 2 (Bonuses while paused): In src/lib/game/effects/discipline-effects.ts:81:

.filter(([, disc]) => disc && disc.xp > 0)

This filter only checks xp > 0, not autoPaused. So paused disciplines still contribute effects.

Severity

High — This is an idle game. Having to manually resume disciplines every time mana regenerates defeats the purpose of idle progression. The secondary bug (free bonuses while paused) further breaks game balance.

Files Involved

File Lines Issue
src/lib/game/stores/discipline-slice.ts 210 if (disc.autoPaused) continue prevents auto-resume
src/lib/game/stores/discipline-slice.ts 84-100 activate() can clear autoPaused but only via manual UI click
src/lib/game/effects/discipline-effects.ts 81 Missing autoPaused filter — paused disciplines still give bonuses
src/lib/game/stores/gameStore.ts 231-236 Tick calls processTick after mana regen — no auto-resume check

Fix Direction

  1. In processTick, instead of if (disc.autoPaused) continue, check if mana is now sufficient and if so, clear autoPaused and process normally
  2. In discipline-effects.ts, add && !disc.autoPaused to the filter
## Bug Summary Two related bugs: 1. When a discipline is auto-paused due to insufficient mana, it **never auto-resumes** when mana regenerates — the player must manually click "Start Practicing" 2. Auto-paused disciplines **still contribute full stat bonuses** (conversion rates, regen bonuses, damage bonuses) despite being "paused" ## Expected Behavior - Disciplines should automatically resume practicing once enough mana is available - Auto-paused disciplines should NOT contribute stat bonuses ## Root Cause **Bug 1 (No auto-resume):** In `src/lib/game/stores/discipline-slice.ts:210`: ```typescript if (disc.autoPaused) continue; // already auto-paused, don't re-process ``` This unconditionally skips all auto-paused disciplines every tick. No code anywhere in the tick pipeline checks whether mana has been restored and clears `autoPaused`. Note: mana regeneration happens BEFORE discipline processing in the tick pipeline (gameStore.ts), so the data is available — the logic just doesn't check it. **Bug 2 (Bonuses while paused):** In `src/lib/game/effects/discipline-effects.ts:81`: ```typescript .filter(([, disc]) => disc && disc.xp > 0) ``` This filter only checks `xp > 0`, not `autoPaused`. So paused disciplines still contribute effects. ## Severity **High** — This is an idle game. Having to manually resume disciplines every time mana regenerates defeats the purpose of idle progression. The secondary bug (free bonuses while paused) further breaks game balance. ## Files Involved | File | Lines | Issue | |------|-------|------| | `src/lib/game/stores/discipline-slice.ts` | 210 | `if (disc.autoPaused) continue` prevents auto-resume | | `src/lib/game/stores/discipline-slice.ts` | 84-100 | `activate()` can clear `autoPaused` but only via manual UI click | | `src/lib/game/effects/discipline-effects.ts` | 81 | Missing `autoPaused` filter — paused disciplines still give bonuses | | `src/lib/game/stores/gameStore.ts` | 231-236 | Tick calls `processTick` after mana regen — no auto-resume check | ## Fix Direction 1. In `processTick`, instead of `if (disc.autoPaused) continue`, check if mana is now sufficient and if so, clear `autoPaused` and process normally 2. In `discipline-effects.ts`, add `&& !disc.autoPaused` to the filter
Anexim added the ai:todo label 2026-06-12 12:05:44 +02:00
n8n-gitea was assigned by Anexim 2026-06-12 12:05:44 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-12 18:57:33 +02:00
Author
Owner

Starting investigation of auto-paused disciplines auto-resume bug.

Starting investigation of auto-paused disciplines auto-resume bug.
Anexim added ai:done and removed ai:in-progress labels 2026-06-12 19:01:05 +02:00
Author
Owner

Fixed both sub-bugs:

  1. Auto-resume when mana restored: Replaced if (disc.autoPaused) continue with a check that computes the drain cost against current mana. If sufficient, clears autoPaused and processes the tick normally. Since mana regen runs before discipline processing in the tick pipeline, the updated mana values are already available.

  2. No more bonuses while paused: Added && !disc.autoPaused to the effect filter in discipline-effects.ts so auto-paused disciplines no longer contribute stat bonuses, conversion rates, or perk effects.

All 1196 tests pass. Pre-commit checks OK.

✅ Fixed both sub-bugs: 1. **Auto-resume when mana restored:** Replaced `if (disc.autoPaused) continue` with a check that computes the drain cost against current mana. If sufficient, clears `autoPaused` and processes the tick normally. Since mana regen runs before discipline processing in the tick pipeline, the updated mana values are already available. 2. **No more bonuses while paused:** Added `&& !disc.autoPaused` to the effect filter in `discipline-effects.ts` so auto-paused disciplines no longer contribute stat bonuses, conversion rates, or perk effects. All 1196 tests pass. Pre-commit checks OK.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#380