Deduct mana conversion rates from raw regen (Bug 10)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 4m35s

- Added getTotalAttunementConversionDrain function to calculate total conversion drain
- Updated computeRegen to include attunement regen bonus
- Added computeEffectiveRegenForDisplay function for UI display
- Added conversionDrains to GameState to track per-attunement drain
- Updated tick function to track and persist conversion drains
- Build passes successfully
This commit is contained in:
Refactoring Agent
2026-04-27 12:25:17 +02:00
parent 8261baab54
commit ebb9d15e9e
7 changed files with 121 additions and 12 deletions
+13
View File
@@ -101,6 +101,19 @@ export function getTotalAttunementRegen(attunements: Record<string, { active: bo
}, 0);
}
// Helper function to calculate total conversion drain from all active attunements (per hour)
export function getTotalAttunementConversionDrain(attunements: Record<string, { active: boolean; level: number; experience: number }>): number {
return Object.entries(attunements)
.filter(([, state]) => state.active)
.reduce((total, [id, state]) => {
const def = ATTUNEMENTS_DEF[id];
if (!def || def.conversionRate <= 0) return total;
// Use the same level scaling as getAttunementConversionRate
const scaledRate = getAttunementConversionRate(id, state.level || 1);
return total + scaledRate;
}, 0);
}
// Get conversion rate with level scaling
export function getAttunementConversionRate(attunementId: string, level: number): number {
const def = ATTUNEMENTS_DEF[attunementId];