[Medium] [Bug] Mana conversion: spec substantially implemented, but discipline pool-drain model still coexists with new regen-deduction system #334

Closed
opened 2026-06-08 16:31:41 +02:00 by Anexim · 2 comments
Owner

Spec: docs/specs/mana-conversion-spec.md

Status: The new unified conversion system is substantially implemented — all core files exist, formulas match, and the tick pipeline uses the regen deduction model. The discrepancies below are remaining gaps.

DISC-2 [MEDIUM] — Discipline processTick() still drains mana from pools via old model

  • File: src/lib/game/stores/discipline-slice.tsprocessTick()
  • Still calls calculateManaDrain() and deducts directly from rawMana and elements[manaType].current
  • This is the old discipline XP drain model — disciplines cost mana to practice by draining pools
  • The new spec's philosophy is that disciplines contribute via stat bonuses to conversion rates, with costs deducted from regen (not pools)
  • Impact: Two conflicting mana cost models coexist: the new regen-deduction system (for attunement/discipline conversion rates) AND the old pool-drain system (for discipline XP gain)
  • Fix: Decide whether discipline practice should cost mana at all under the new model. If it should, the drain should come from regen, not from pools. If it shouldn't, remove the pool drain from processTick().

DISC-4 [MEDIUM] — Crafting pipeline may still have composite crafting logic

  • Files: src/lib/game/crafting-fabricator.ts, src/lib/game/crafting-design.ts
  • The new passive conversion system should replace manual composite crafting
  • craftComposite was removed from manaStore.ts but composite crafting logic in the crafting pipeline was not fully audited
  • Fix: Audit crafting pipeline for any craftComposite or manual composite crafting logic and remove/replace with passive conversion

DISC-5 [LOW] — No collapsible formula reference in Stats tab

  • Spec §11: Describes a collapsible formula reference at the top of the conversion stats section
  • Code: ElementStatsSection.tsx has no formula reference
  • Fix: Add collapsible formula summary to conversion stats

DISC-6 [LOW] — No per-element net regen summary line in Stats tab

  • Spec §11: Shows "Net Fire Regen: +0.50 - 0.15 - 0.10 = +0.25/hr"
  • Code: ConversionRow shows downstream drain but doesn't compute a single net regen summary
  • Fix: Add net regen summary line to per-element breakdown

DISC-7 [LOW] — Conversion stats not in dedicated section

  • Spec §11: Describes a dedicated "Conversion Stats" section
  • Code: Conversion data is embedded inside ElementStatsSection under "Conversion Breakdown"
  • Fix: Create dedicated Conversion Stats section or update spec

DISC-8 [LOW] — ManaDisplay shows only net regen, not detailed breakdown

  • Spec §8: Shows detailed per-element regen with individual line items
  • Code (ManaDisplay.tsx): Only shows net regen rate per element
  • Fix: Add detailed breakdown or update spec to reflect net-only display

What IS implemented correctly (for reference):

  • element-distance.ts — distance table
  • conversion-costs.ts — cost ratios
  • conversion-rates.ts — unified formula
  • All discipline base rates, difficulty/scaling factors
  • Attunement contributions and level multiplier
  • Guardian pact contributions
  • Meditation multiplier with distance attenuation
  • Regen deduction model in tick pipeline
  • Auto-pause on insufficient regen
  • Manual conversion actions removed
  • Stats tab conversion display (partial)
**Spec:** `docs/specs/mana-conversion-spec.md` **Status:** The new unified conversion system is **substantially implemented** — all core files exist, formulas match, and the tick pipeline uses the regen deduction model. The discrepancies below are remaining gaps. ### DISC-2 [MEDIUM] — Discipline `processTick()` still drains mana from pools via old model - **File:** `src/lib/game/stores/discipline-slice.ts` → `processTick()` - Still calls `calculateManaDrain()` and deducts directly from `rawMana` and `elements[manaType].current` - This is the **old** discipline XP drain model — disciplines cost mana to practice by draining pools - The new spec's philosophy is that disciplines contribute via stat bonuses to conversion rates, with costs deducted from regen (not pools) - **Impact:** Two conflicting mana cost models coexist: the new regen-deduction system (for attunement/discipline conversion rates) AND the old pool-drain system (for discipline XP gain) - **Fix:** Decide whether discipline practice should cost mana at all under the new model. If it should, the drain should come from regen, not from pools. If it shouldn't, remove the pool drain from `processTick()`. ### DISC-4 [MEDIUM] — Crafting pipeline may still have composite crafting logic - **Files:** `src/lib/game/crafting-fabricator.ts`, `src/lib/game/crafting-design.ts` - The new passive conversion system should replace manual composite crafting - `craftComposite` was removed from `manaStore.ts` but composite crafting logic in the crafting pipeline was not fully audited - **Fix:** Audit crafting pipeline for any `craftComposite` or manual composite crafting logic and remove/replace with passive conversion ### DISC-5 [LOW] — No collapsible formula reference in Stats tab - **Spec §11:** Describes a collapsible formula reference at the top of the conversion stats section - **Code:** `ElementStatsSection.tsx` has no formula reference - **Fix:** Add collapsible formula summary to conversion stats ### DISC-6 [LOW] — No per-element net regen summary line in Stats tab - **Spec §11:** Shows "Net Fire Regen: +0.50 - 0.15 - 0.10 = +0.25/hr" - **Code:** `ConversionRow` shows downstream drain but doesn't compute a single net regen summary - **Fix:** Add net regen summary line to per-element breakdown ### DISC-7 [LOW] — Conversion stats not in dedicated section - **Spec §11:** Describes a dedicated "Conversion Stats" section - **Code:** Conversion data is embedded inside `ElementStatsSection` under "Conversion Breakdown" - **Fix:** Create dedicated Conversion Stats section or update spec ### DISC-8 [LOW] — ManaDisplay shows only net regen, not detailed breakdown - **Spec §8:** Shows detailed per-element regen with individual line items - **Code (`ManaDisplay.tsx`):** Only shows net regen rate per element - **Fix:** Add detailed breakdown or update spec to reflect net-only display **What IS implemented correctly (for reference):** - `element-distance.ts` — distance table ✅ - `conversion-costs.ts` — cost ratios ✅ - `conversion-rates.ts` — unified formula ✅ - All discipline base rates, difficulty/scaling factors ✅ - Attunement contributions and level multiplier ✅ - Guardian pact contributions ✅ - Meditation multiplier with distance attenuation ✅ - Regen deduction model in tick pipeline ✅ - Auto-pause on insufficient regen ✅ - Manual conversion actions removed ✅ - Stats tab conversion display (partial) ✅
Anexim added the ai:todo label 2026-06-08 16:31:41 +02:00
n8n-gitea was assigned by Anexim 2026-06-08 16:31:41 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-09 10:42:20 +02:00
Author
Owner

Starting work on issue #334. Will address all 8 sub-items (DISC-2 through DISC-8). First reading the spec and relevant source files.

Starting work on issue #334. Will address all 8 sub-items (DISC-2 through DISC-8). First reading the spec and relevant source files.
Anexim added ai:done and removed ai:in-progress labels 2026-06-09 11:20:16 +02:00
Author
Owner

All 8 sub-items of issue #334 have been addressed and committed (3ad919a):

DISC-2 [MEDIUM] — Removed old pool-drain model from discipline-slice.ts processTick()

  • Disciplines no longer drain rawMana or element pools
  • canProceedDiscipline() no longer gates on mana sufficiency
  • Removed auto-pause on insufficient mana
  • Removed drain display from DisciplineCard.tsx
  • Removed auto-paused log from gameStore.ts tick()

DISC-4 [MEDIUM] — Crafting pipeline audit complete

  • No composite crafting logic remains in any crafting pipeline file
  • craftComposite was already removed (only a comment reference in manaStore.ts)

DISC-5 [LOW] — Added collapsible formula reference to Conversion Stats section

  • Shows unified formula, multipliers, cost formulas, and constraints per spec §11

DISC-6 [LOW] — Added per-element net regen summary line

  • Shows "Net Fire Regen: +0.50/hr − 0.15/hr = +0.35/hr" per element

DISC-7 [LOW] — Created dedicated "Conversion Stats" section in Stats tab

  • Renamed from "Conversion Breakdown" to dedicated section per spec §11

DISC-8 [LOW] — Added detailed per-element regen breakdown to ManaDisplay

  • Each element card expandable to show produced rate and downstream drains
  • New ElementRegenBreakdown type and elementRegenBreakdown prop

Tests: Updated 4 test files to reflect new no-drain behavior. All 1090 tests pass.
Pre-commit: All checks passed (file sizes, tests, dependency graph).

All 8 sub-items of issue #334 have been addressed and committed (3ad919a): **DISC-2 [MEDIUM] ✅** — Removed old pool-drain model from discipline-slice.ts processTick() - Disciplines no longer drain rawMana or element pools - canProceedDiscipline() no longer gates on mana sufficiency - Removed auto-pause on insufficient mana - Removed drain display from DisciplineCard.tsx - Removed auto-paused log from gameStore.ts tick() **DISC-4 [MEDIUM] ✅** — Crafting pipeline audit complete - No composite crafting logic remains in any crafting pipeline file - craftComposite was already removed (only a comment reference in manaStore.ts) **DISC-5 [LOW] ✅** — Added collapsible formula reference to Conversion Stats section - Shows unified formula, multipliers, cost formulas, and constraints per spec §11 **DISC-6 [LOW] ✅** — Added per-element net regen summary line - Shows "Net Fire Regen: +0.50/hr − 0.15/hr = +0.35/hr" per element **DISC-7 [LOW] ✅** — Created dedicated "Conversion Stats" section in Stats tab - Renamed from "Conversion Breakdown" to dedicated section per spec §11 **DISC-8 [LOW] ✅** — Added detailed per-element regen breakdown to ManaDisplay - Each element card expandable to show produced rate and downstream drains - New ElementRegenBreakdown type and elementRegenBreakdown prop **Tests:** Updated 4 test files to reflect new no-drain behavior. All 1090 tests pass. **Pre-commit:** All checks passed (file sizes, tests, dependency graph).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#334