[Critical] [Feature] Overhaul mana conversion system to unified regen-deduction model #263

Closed
opened 2026-06-04 13:23:57 +02:00 by Anexim · 2 comments
Owner

Summary

The current mana conversion system is fragmented across multiple inconsistent mechanisms (attunement conversions, discipline conversions, manual conversion, pact conversions). This issue overhauls everything into a single unified system.

Problem

  1. Attunement conversions and discipline conversions work differently — attunements drain from regen, disciplines drain from the mana pool directly. They should work the same way.
  2. Manual conversion exists as a separate mechanism that bypasses the passive system entirely.
  3. Guardian pacts don't contribute to conversion rates at all.
  4. Conversion efficiency is flat (e.g., 0.5/hr for all base elements) regardless of element tier. Higher-tier elements should be exponentially harder to produce.
  5. Meditation doesn't affect conversion rates.
  6. The stats tab doesn't show conversion breakdowns, so players can't understand why their mana regen is what it is.
  7. Conversions can drain more regen than available, silently producing negative regen with no warning.

Solution

See full specification at docs/specs/mana-conversion-spec.md.

Key Changes

1. Unified Conversion Formula

All three sources (disciplines, attunements, guardian pacts) contribute to a single rate:

finalRate = (disciplineRate + attunementBase + pactBase) × attunementMult × pactMult × meditationMult

2. Element Distance from Raw Mana

Every element has a distance (base=1, composite=2, exotic=3, time=4). Used for:

  • Cost ratios: raw cost = 10^(d+1), component cost = 10×(d+1) per unit of destination
  • Meditation strength: meditation boost is divided by distance

3. Tiered Conversion Costs

Tier Raw Cost Component Cost Example
Base (d=1) 100 100 raw → 1 fire
Composite (d=2) 1,000 30 each 1000 raw + 30 fire + 30 earth → 1 metal
Exotic (d=3) 10,000 40 each 10000 raw + 40 sand + 40 light → 1 crystal
Time (d=4) 100,000 50 each 100000 raw + 50 soul + 50 sand + 50 transference → 1 time

4. Regen Deduction Model

All conversion costs are deducted from mana regen, not from the mana pool. Each element shows:

  • Gross regen (from attunements, disciplines, etc.)
  • Produced by upstream conversions
  • Drained by downstream conversions
  • Net regen

5. Auto-Pause on Insufficient Regen

If conversion cost > gross regen for any source type, the conversion is completely disabled with a visible warning in the UI.

6. Attunement Level Multiplier

Each attunement level adds +50% to the multiplier for conversions involving the attunement's primary element (as destination or component).

7. Pact Conversion Bonus

Each signed pact grants +0.15/hr base rate for the guardian's element, plus a level bonus scaled by Invoker attunement level (pactCount × invokerLevel × 0.25).

8. Meditation Applies to Conversions

Meditation multiplier boosts conversion rates at full strength for distance-1 elements, half strength for distance-2, etc.

9. No Manual Conversion

Remove convertMana, processConvertAction, craftComposite, and the "convert" player action. All conversion is passive.

10. Stats Tab Overhaul

New Conversion Stats section showing per-element breakdown with formulas, sources, drains, net regen, and pause warnings.

Files to Modify

  • src/lib/game/utils/element-distance.ts (new)
  • src/lib/game/utils/conversion-rates.ts (new)
  • src/lib/game/data/conversion-costs.ts (new)
  • src/lib/game/data/disciplines/elemental-regen.ts
  • src/lib/game/data/disciplines/elemental-regen-advanced.ts
  • src/lib/game/data/attunements.ts
  • src/lib/game/effects/discipline-effects.ts
  • src/lib/game/stores/gameStore.ts
  • src/lib/game/stores/manaStore.ts
  • src/lib/game/stores/prestigeStore.ts
  • src/components/game/tabs/StatsTab/ElementStatsSection.tsx
  • src/components/game/ManaDisplay.tsx

Acceptance Criteria

  • All conversion types (attunement, discipline, pact) use the same formula
  • Conversion costs scale exponentially by element tier
  • Costs are deducted from regen, not from mana pool
  • Conversions auto-pause when source regen is insufficient, with UI warning
  • Meditation boosts conversion rates at reduced strength by distance
  • Attunement levels provide multiplicative bonus
  • Guardian pacts provide base rate + level bonus
  • Stats tab shows full conversion breakdown with formulas
  • Manual conversion is removed
  • No file exceeds 400 lines
  • All existing tests pass or are updated
## Summary The current mana conversion system is fragmented across multiple inconsistent mechanisms (attunement conversions, discipline conversions, manual conversion, pact conversions). This issue overhauls everything into a single unified system. ## Problem 1. **Attunement conversions** and **discipline conversions** work differently — attunements drain from regen, disciplines drain from the mana pool directly. They should work the same way. 2. **Manual conversion** exists as a separate mechanism that bypasses the passive system entirely. 3. **Guardian pacts** don't contribute to conversion rates at all. 4. **Conversion efficiency** is flat (e.g., 0.5/hr for all base elements) regardless of element tier. Higher-tier elements should be exponentially harder to produce. 5. **Meditation** doesn't affect conversion rates. 6. The **stats tab** doesn't show conversion breakdowns, so players can't understand why their mana regen is what it is. 7. Conversions can drain more regen than available, silently producing negative regen with no warning. ## Solution See full specification at `docs/specs/mana-conversion-spec.md`. ### Key Changes ### 1. Unified Conversion Formula All three sources (disciplines, attunements, guardian pacts) contribute to a single rate: ``` finalRate = (disciplineRate + attunementBase + pactBase) × attunementMult × pactMult × meditationMult ``` ### 2. Element Distance from Raw Mana Every element has a distance (base=1, composite=2, exotic=3, time=4). Used for: - **Cost ratios**: raw cost = 10^(d+1), component cost = 10×(d+1) per unit of destination - **Meditation strength**: meditation boost is divided by distance ### 3. Tiered Conversion Costs | Tier | Raw Cost | Component Cost | Example | |------|----------|----------------|---------| | Base (d=1) | 100 | — | 100 raw → 1 fire | | Composite (d=2) | 1,000 | 30 each | 1000 raw + 30 fire + 30 earth → 1 metal | | Exotic (d=3) | 10,000 | 40 each | 10000 raw + 40 sand + 40 light → 1 crystal | | Time (d=4) | 100,000 | 50 each | 100000 raw + 50 soul + 50 sand + 50 transference → 1 time | ### 4. Regen Deduction Model All conversion costs are deducted from **mana regen**, not from the mana pool. Each element shows: - Gross regen (from attunements, disciplines, etc.) - Produced by upstream conversions - Drained by downstream conversions - Net regen ### 5. Auto-Pause on Insufficient Regen If conversion cost > gross regen for any source type, the conversion is **completely disabled** with a visible warning in the UI. ### 6. Attunement Level Multiplier Each attunement level adds +50% to the multiplier for conversions involving the attunement's primary element (as destination or component). ### 7. Pact Conversion Bonus Each signed pact grants +0.15/hr base rate for the guardian's element, plus a level bonus scaled by Invoker attunement level (pactCount × invokerLevel × 0.25). ### 8. Meditation Applies to Conversions Meditation multiplier boosts conversion rates at full strength for distance-1 elements, half strength for distance-2, etc. ### 9. No Manual Conversion Remove `convertMana`, `processConvertAction`, `craftComposite`, and the "convert" player action. All conversion is passive. ### 10. Stats Tab Overhaul New Conversion Stats section showing per-element breakdown with formulas, sources, drains, net regen, and pause warnings. ## Files to Modify - `src/lib/game/utils/element-distance.ts` (new) - `src/lib/game/utils/conversion-rates.ts` (new) - `src/lib/game/data/conversion-costs.ts` (new) - `src/lib/game/data/disciplines/elemental-regen.ts` - `src/lib/game/data/disciplines/elemental-regen-advanced.ts` - `src/lib/game/data/attunements.ts` - `src/lib/game/effects/discipline-effects.ts` - `src/lib/game/stores/gameStore.ts` - `src/lib/game/stores/manaStore.ts` - `src/lib/game/stores/prestigeStore.ts` - `src/components/game/tabs/StatsTab/ElementStatsSection.tsx` - `src/components/game/ManaDisplay.tsx` ## Acceptance Criteria - [ ] All conversion types (attunement, discipline, pact) use the same formula - [ ] Conversion costs scale exponentially by element tier - [ ] Costs are deducted from regen, not from mana pool - [ ] Conversions auto-pause when source regen is insufficient, with UI warning - [ ] Meditation boosts conversion rates at reduced strength by distance - [ ] Attunement levels provide multiplicative bonus - [ ] Guardian pacts provide base rate + level bonus - [ ] Stats tab shows full conversion breakdown with formulas - [ ] Manual conversion is removed - [ ] No file exceeds 400 lines - [ ] All existing tests pass or are updated
Anexim added the ai:todo label 2026-06-04 13:23:57 +02:00
n8n-gitea was assigned by Anexim 2026-06-04 13:23:57 +02:00
Anexim added ai:in-progress and removed ai:todo labels 2026-06-04 13:45:36 +02:00
Author
Owner

Starting implementation of unified mana conversion system overhaul. Plan: 10 tasks covering new utility files, updated discipline/attunement data, store changes, and UI updates.

Starting implementation of unified mana conversion system overhaul. Plan: 10 tasks covering new utility files, updated discipline/attunement data, store changes, and UI updates.
Anexim added ai:done and removed ai:in-progress labels 2026-06-04 18:13:52 +02:00
Author
Owner

Implementation complete. All 10 acceptance criteria met:

  • All conversion types (attunement, discipline, pact) use unified formula: finalRate = (discBase + attBase + pactBase) × attMult × pactMult × medMult
  • Conversion costs scale exponentially by tier: raw = 10^(d+1), component = 10×(d+1)
  • Costs deducted from regen, not mana pool
  • Conversions auto-pause when source regen is insufficient (with UI warning in Stats tab)
  • Meditation boosts conversion rates at reduced strength by distance
  • Attunement levels provide +50% multiplicative bonus per level for relevant elements
  • Guardian pacts provide +0.15/hr base rate + (pactCount × invokerLevel × 0.25) level bonus
  • Stats tab shows full per-element conversion breakdown with formulas, sources, drains, and pause warnings
  • Manual conversion (convertMana, processConvertAction, craftComposite) removed from manaStore
  • All 916 tests pass, all files under 400 lines
  • Committed and pushed as ab3afae
Implementation complete. All 10 acceptance criteria met: - All conversion types (attunement, discipline, pact) use unified formula: `finalRate = (discBase + attBase + pactBase) × attMult × pactMult × medMult` - Conversion costs scale exponentially by tier: raw = 10^(d+1), component = 10×(d+1) - Costs deducted from regen, not mana pool - Conversions auto-pause when source regen is insufficient (with UI warning in Stats tab) - Meditation boosts conversion rates at reduced strength by distance - Attunement levels provide +50% multiplicative bonus per level for relevant elements - Guardian pacts provide +0.15/hr base rate + (pactCount × invokerLevel × 0.25) level bonus - Stats tab shows full per-element conversion breakdown with formulas, sources, drains, and pause warnings - Manual conversion (convertMana, processConvertAction, craftComposite) removed from manaStore - All 916 tests pass, all files under 400 lines - Committed and pushed as ab3afae
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#263