Bug: Attunement conversion produces free mana — no source mana consumed #218

Closed
opened 2026-05-30 21:10:31 +02:00 by Anexim · 1 comment
Owner

Bug Description

The attunement conversion system in the game tick generates element mana (e.g. transference, earth) out of nothing. It adds the converted amount to the target element but never subtracts raw mana (or any source) to pay for the conversion.

Code Location

src/lib/game/stores/gameStore.ts lines 165-179:

Object.entries(ctx.attunement.attunements).forEach(([id, state]) => {
  if (!state.active) return;
  const def = ATTUNEMENTS_DEF[id];
  if (!def || def.conversionRate <= 0 || !def.primaryManaType) return;
  const scaledRate = getAttunementConversionRate(id, state.level || 1);
  const conversionThisTick = scaledRate * HOURS_PER_TICK;
  totalConversionPerTick += conversionThisTick;
  // ... adds to element mana but NEVER subtracts rawMana
});

The variable totalConversionPerTick is only used to reduce effective regen, not to drain raw mana.

Impact

Critical — infinite free element mana. Each tick, active attunements generate their primary mana type without costing anything. At enchanter level 10, that's ~7.7 transference per hour, every tick, forever, for free. This completely trivializes the entire element economy and makes the mana conversion system meaningless.

Fix Required

Subtract raw mana equal to the conversion cost before adding the converted element mana:

rawMana -= conversionThisTick;  // or whatever the conversion cost should be

The conversion cost formula should match the attunement's design (e.g. 1:1 or at some penalty ratio).

## Bug Description The attunement conversion system in the game tick generates element mana (e.g. transference, earth) out of nothing. It adds the converted amount to the target element but **never subtracts raw mana** (or any source) to pay for the conversion. ## Code Location `src/lib/game/stores/gameStore.ts` lines 165-179: ```typescript Object.entries(ctx.attunement.attunements).forEach(([id, state]) => { if (!state.active) return; const def = ATTUNEMENTS_DEF[id]; if (!def || def.conversionRate <= 0 || !def.primaryManaType) return; const scaledRate = getAttunementConversionRate(id, state.level || 1); const conversionThisTick = scaledRate * HOURS_PER_TICK; totalConversionPerTick += conversionThisTick; // ... adds to element mana but NEVER subtracts rawMana }); ``` The variable `totalConversionPerTick` is only used to reduce effective regen, not to drain raw mana. ## Impact **Critical — infinite free element mana.** Each tick, active attunements generate their primary mana type without costing anything. At enchanter level 10, that's ~7.7 transference per hour, every tick, forever, for free. This completely trivializes the entire element economy and makes the mana conversion system meaningless. ## Fix Required Subtract raw mana equal to the conversion cost before adding the converted element mana: ```typescript rawMana -= conversionThisTick; // or whatever the conversion cost should be ``` The conversion cost formula should match the attunement's design (e.g. 1:1 or at some penalty ratio).
Anexim added the ai:todo label 2026-05-30 21:10:31 +02:00
n8n-gitea was assigned by Anexim 2026-05-30 21:10:31 +02:00
Author
Owner

Fixed: Attunement conversion now properly deducts raw mana before adding converted element mana. Added rawManaDelta tracking in the attunement conversion loop in gameStore.ts to prevent free element mana generation.

Fixed: Attunement conversion now properly deducts raw mana before adding converted element mana. Added rawManaDelta tracking in the attunement conversion loop in gameStore.ts to prevent free element mana generation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#218