[High] [Bug] All 24 conversion disciplines skip mana drain entirely — zero cost for full benefits #379

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

Bug Summary

All 24 conversion disciplines (elemental-regen.ts and elemental-regen-advanced.ts) have zero mana drain when active, despite having drainBase values defined. This affects ~47% of all disciplines.

Expected Behavior

When a conversion discipline is active, it should drain mana from the pool specified by def.manaType using the formula: drainBase × (1 + (XP / difficultyFactor)^0.4). If insufficient mana exists, it should auto-pause.

Root Cause

In src/lib/game/stores/discipline-slice.ts:210-217, the processTick method explicitly skips mana drain for any discipline with sourceManaTypes defined:

const isConversionDiscipline = !!(def.sourceManaTypes && def.sourceManaTypes.length > 0);
if (!isConversionDiscipline) {
  const drain = calculateManaDrain(def.drainBase, disc.xp, def.difficultyFactor);
  // ... drain logic ...
}

The comment says "they contribute to conversion rates, not direct pool drain" — but this is incorrect. These disciplines have drainBase values (1-3) indicating the intent was for them to drain mana.

Affected Disciplines (24 total)

elemental-regen.ts (8): regen-fire, regen-water, regen-air, regen-earth, regen-light, regen-dark, regen-death, regen-transference
elemental-regen-advanced.ts (16): regen-metal, regen-sand, regen-lightning, regen-frost, regen-blackflame, regen-radiantflames, regen-miasma, regen-shadowglass, regen-crystal, regen-void, regen-stellar, regen-soul, regen-plasma, regen-time

Severity

High — Conversion disciplines provide mana generation (via conversion rates) while having zero cost, breaking game balance. The transference conversion discipline is one of the first disciplines a player encounters.

Fix Direction

Remove the isConversionDiscipline guard and apply mana drain to all disciplines. The drain is separate from the conversion mechanic — disciplines should both drain their mana type AND contribute to conversion rates.

Files Involved

File Lines Role
src/lib/game/stores/discipline-slice.ts 210-217 BUGisConversionDiscipline guard skips drain
src/lib/game/data/disciplines/elemental-regen.ts All 8 base/utility conversion disciplines with drainBase
src/lib/game/data/disciplines/elemental-regen-advanced.ts All 16 composite/exotic conversion disciplines with drainBase
## Bug Summary All 24 conversion disciplines (elemental-regen.ts and elemental-regen-advanced.ts) have zero mana drain when active, despite having `drainBase` values defined. This affects ~47% of all disciplines. ## Expected Behavior When a conversion discipline is active, it should drain mana from the pool specified by `def.manaType` using the formula: `drainBase × (1 + (XP / difficultyFactor)^0.4)`. If insufficient mana exists, it should auto-pause. ## Root Cause In `src/lib/game/stores/discipline-slice.ts:210-217`, the `processTick` method explicitly skips mana drain for any discipline with `sourceManaTypes` defined: ```typescript const isConversionDiscipline = !!(def.sourceManaTypes && def.sourceManaTypes.length > 0); if (!isConversionDiscipline) { const drain = calculateManaDrain(def.drainBase, disc.xp, def.difficultyFactor); // ... drain logic ... } ``` The comment says "they contribute to conversion rates, not direct pool drain" — but this is incorrect. These disciplines have `drainBase` values (1-3) indicating the intent was for them to drain mana. ## Affected Disciplines (24 total) **elemental-regen.ts** (8): regen-fire, regen-water, regen-air, regen-earth, regen-light, regen-dark, regen-death, regen-transference **elemental-regen-advanced.ts** (16): regen-metal, regen-sand, regen-lightning, regen-frost, regen-blackflame, regen-radiantflames, regen-miasma, regen-shadowglass, regen-crystal, regen-void, regen-stellar, regen-soul, regen-plasma, regen-time ## Severity **High** — Conversion disciplines provide mana generation (via conversion rates) while having zero cost, breaking game balance. The transference conversion discipline is one of the first disciplines a player encounters. ## Fix Direction Remove the `isConversionDiscipline` guard and apply mana drain to all disciplines. The drain is separate from the conversion mechanic — disciplines should both drain their mana type AND contribute to conversion rates. ## Files Involved | File | Lines | Role | |------|-------|------| | `src/lib/game/stores/discipline-slice.ts` | 210-217 | **BUG** — `isConversionDiscipline` guard skips drain | | `src/lib/game/data/disciplines/elemental-regen.ts` | All | 8 base/utility conversion disciplines with drainBase | | `src/lib/game/data/disciplines/elemental-regen-advanced.ts` | All | 16 composite/exotic conversion disciplines with drainBase |
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:54:10 +02:00
Author
Owner

Starting investigation of conversion discipline mana drain bug.

Starting investigation of conversion discipline mana drain bug.
Anexim added ai:done and removed ai:in-progress labels 2026-06-12 18:57:20 +02:00
Author
Owner

Fixed. Removed the isConversionDiscipline guard in discipline-slice.ts:processTick that was skipping mana drain for all 24 conversion disciplines. Updated tests to verify correct behavior — conversion disciplines now properly drain mana from their target element pool. Added regression tests for auto-pause and XP accrual. All 1196 tests pass.

✅ Fixed. Removed the `isConversionDiscipline` guard in `discipline-slice.ts:processTick` that was skipping mana drain for all 24 conversion disciplines. Updated tests to verify correct behavior — conversion disciplines now properly drain mana from their target element pool. Added regression tests for auto-pause and XP accrual. All 1196 tests pass.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#379