Deduct mana conversion rates from raw regen (Bug 10)
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 4m35s
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:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user