Bug: Cannot restart Raw Mana Mastery or Mana Circulation after stopping #144

Closed
opened 2026-05-27 10:22:51 +02:00 by Anexim · 2 comments
Owner

Bug Description

When the player clicks "Stop Practicing" on the Raw Mana Mastery or Mana Circulation disciplines, they cannot start practicing again afterward.

Root Cause

Two interacting issues in discipline-slice.ts and discipline-math.ts:

  1. deactivate(id) sets disc.paused = true and removes the ID from activeIds
  2. When re-activating, activate(id) falls through to line 107: if (!canProceedDiscipline(def, existing, gameState)) return s;
  3. canProceedDiscipline in discipline-math.ts line 71 unconditionally returns false when disciplineState.paused === true, blocking re-activation

The re-activation bypass at lines 83-86 only works when the discipline is still in activeIds, but deactivate removes it.

Fix Required

Remove the if (disciplineState.paused) return false; guard from canProceedDiscipline in src/lib/game/utils/discipline-math.ts line 71. The activate method already handles re-activation of paused disciplines correctly via the code path at lines 83-86.

Affected Files

  • src/lib/game/utils/discipline-math.tscanProceedDiscipline function (line 71)
  • src/lib/game/stores/discipline-slice.tsactivate method (lines 83-107)
## Bug Description When the player clicks "Stop Practicing" on the **Raw Mana Mastery** or **Mana Circulation** disciplines, they cannot start practicing again afterward. ## Root Cause Two interacting issues in `discipline-slice.ts` and `discipline-math.ts`: 1. `deactivate(id)` sets `disc.paused = true` and removes the ID from `activeIds` 2. When re-activating, `activate(id)` falls through to line 107: `if (!canProceedDiscipline(def, existing, gameState)) return s;` 3. `canProceedDiscipline` in `discipline-math.ts` line 71 unconditionally returns `false` when `disciplineState.paused === true`, blocking re-activation The re-activation bypass at lines 83-86 only works when the discipline is still in `activeIds`, but `deactivate` removes it. ## Fix Required Remove the `if (disciplineState.paused) return false;` guard from `canProceedDiscipline` in `src/lib/game/utils/discipline-math.ts` line 71. The `activate` method already handles re-activation of paused disciplines correctly via the code path at lines 83-86. ## Affected Files - `src/lib/game/utils/discipline-math.ts` — `canProceedDiscipline` function (line 71) - `src/lib/game/stores/discipline-slice.ts` — `activate` method (lines 83-107)
Anexim added the ai:todo label 2026-05-27 10:22:51 +02:00
n8n-gitea was assigned by Anexim 2026-05-27 10:22:51 +02:00
Author
Owner

Fixed #144 — Can now restart Raw Mana Mastery and Mana Circulation after stopping.

Root cause: canProceedDiscipline in discipline-math.ts unconditionally returned false when disciplineState.paused === true. This blocked re-activation because:

  1. deactivate(id) sets paused: true and removes the ID from activeIds
  2. On re-activate, canProceedDiscipline rejected it due to the paused flag

Fix: Removed the if (disciplineState.paused) return false; guard from canProceedDiscipline. The activate method already handles re-activation of paused disciplines correctly (un-pausing them if they're in activeIds, or fully re-activating them if they were drained — per #143 fix).

Changed files:

  • src/lib/game/utils/discipline-math.ts — removed paused guard from canProceedDiscipline
  • src/lib/game/__tests__/discipline-math.test.ts — updated test to expect true for paused disciplines

All 885 tests pass. Committed and pushed as 7962a4f.

Fixed #144 — Can now restart Raw Mana Mastery and Mana Circulation after stopping. **Root cause**: `canProceedDiscipline` in `discipline-math.ts` unconditionally returned `false` when `disciplineState.paused === true`. This blocked re-activation because: 1. `deactivate(id)` sets `paused: true` and removes the ID from `activeIds` 2. On re-activate, `canProceedDiscipline` rejected it due to the paused flag **Fix**: Removed the `if (disciplineState.paused) return false;` guard from `canProceedDiscipline`. The `activate` method already handles re-activation of paused disciplines correctly (un-pausing them if they're in `activeIds`, or fully re-activating them if they were drained — per #143 fix). ### Changed files: - `src/lib/game/utils/discipline-math.ts` — removed paused guard from canProceedDiscipline - `src/lib/game/__tests__/discipline-math.test.ts` — updated test to expect `true` for paused disciplines All 885 tests pass. Committed and pushed as 7962a4f.
Author
Owner

Closing — fixed in commit 7962a4f

Closing — fixed in commit 7962a4f
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#144