fix: auto-unlock element types when attunement conversion begins — Fabricator now unlocks earth
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m26s

This commit is contained in:
2026-05-28 12:28:27 +02:00
parent aba1265cbc
commit 268baf3916
4 changed files with 17 additions and 23 deletions
+11 -17
View File
@@ -167,37 +167,31 @@ export const useGameStore = create<GameCoordinatorStore>()(
meditateTicks = 0;
}
// Calculate total attunement conversion per tick
// Calculate total attunement conversion and apply to element pools
let totalConversionPerTick = 0;
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);
totalConversionPerTick += scaledRate * HOURS_PER_TICK;
});
// Calculate effective regen
const effectiveRegen = Math.max(0, baseRegen * (1 - incursionStrength) * meditationMultiplier - totalConversionPerTick);
// Mana regeneration
let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana);
let elements = { ...ctx.mana.elements };
// Apply attunement conversion
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;
if (elements[def.primaryManaType]) {
if (!elements[def.primaryManaType].unlocked) {
elements[def.primaryManaType] = { ...elements[def.primaryManaType], unlocked: true };
}
elements[def.primaryManaType].current = Math.min(
elements[def.primaryManaType].max,
elements[def.primaryManaType].current + conversionThisTick
elements[def.primaryManaType].current + conversionThisTick,
);
}
});
const effectiveRegen = Math.max(0, baseRegen * (1 - incursionStrength) * meditationMultiplier - totalConversionPerTick);
// Mana regeneration
let rawMana = Math.min(ctx.mana.rawMana + effectiveRegen * HOURS_PER_TICK, maxMana);
let totalManaGathered = ctx.mana.totalManaGathered;
// Convert action