[priority: critical] Discipline bonuses lost when discipline is paused/deactivated #129
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?
Bug: Discipline bonuses are lost when discipline is no longer active
Description
When a discipline is paused or deactivated, all stat bonuses from that discipline are lost. The bonuses should persist based on accumulated XP even after the discipline is no longer actively being practiced.
Root Cause
In
src/lib/game/effects/discipline-effects.ts, thecomputeDisciplineEffects()function only iterates over active (non-paused) disciplines:This means any discipline that has been paused (i.e.
disc.paused === true) contributes zero bonuses, regardless of how much XP was earned. The XP is still stored in the discipline state, but it's simply not used for bonus calculation.Expected Behavior
Files Involved
src/lib/game/effects/discipline-effects.ts—computeDisciplineEffects()only looks at non-paused disciplinessrc/lib/game/stores/discipline-slice.ts— discipline state management (paused flag)src/lib/game/utils/discipline-math.ts—calculateStatBonus()is correct, just not called for paused disciplinesSuggested Fix
Change
computeDisciplineEffects()to iterate over all disciplines withxp > 0instead of only non-paused ones. The paused flag should only control whether the discipline drains mana and accrues XP (already handled inprocessTick), not whether its earned bonuses apply.Impact
This is a critical bug because it fundamentally breaks the progression loop — players lose all progress from disciplines when they pause them, which discourages players from ever stopping a discipline. This makes the concurrent limit feel punishing rather than strategic.
Starting work on the critical bug: discipline bonuses lost when paused/deactivated.
Root cause identified in
computeDisciplineEffects()— it filters to!disc.paused, so paused disciplines contribute zero bonuses despite having earned XP.Fix: Change the filter to include all disciplines with
xp > 0, not just non-paused ones. The paused flag should only control mana drain and XP accrual (already handled inprocessTick), not earned stat bonuses.✅ Fixed. Changed
computeDisciplineEffects()insrc/lib/game/effects/discipline-effects.tsto iterate over all disciplines withxp > 0instead of only non-paused ones.Change: Line 19 filter changed from
.filter(([, disc]) => disc && !disc.paused)to.filter(([, disc]) => disc && disc.xp > 0)What this fixes:
processTick)Tests: All 42 discipline-math tests and 11 store-actions-discipline tests pass. The 20 pre-existing failures in room-utils/floor-utils/combat-utils are unrelated.