fix: recovery room 10× regen/conversion multiplier double-counting bug
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m18s
This commit is contained in:
@@ -274,13 +274,18 @@ export const useGameStore = create<GameCoordinatorStore>()(
|
||||
const roomType = ctx.combat.currentRoom?.roomType;
|
||||
if (roomType === 'library' || roomType === 'recovery' || roomType === 'treasure' || roomType === 'puzzle') {
|
||||
if (roomType === 'recovery') {
|
||||
// Recovery room grants 10× regen/conversion multiplier.
|
||||
// Normal regen was already applied above, so we apply only
|
||||
// the delta (9× additional) to avoid double-counting.
|
||||
const boostedRegen = baseRegen * 10;
|
||||
const netBoostedRegen = Math.max(0, boostedRegen * (1 - incursionStrength) * meditationMultiplier - conversionResult.totalRawDrain);
|
||||
rawMana = Math.min(rawMana + netBoostedRegen * HOURS_PER_TICK, maxMana);
|
||||
const regenDelta = netBoostedRegen - netRawRegen;
|
||||
rawMana = Math.min(rawMana + regenDelta * HOURS_PER_TICK, maxMana);
|
||||
for (const [elem, entry] of Object.entries(conversionResult.rates)) {
|
||||
if (entry.paused || entry.finalRate <= 0 || !elements[elem]) continue;
|
||||
if (!elements[elem].unlocked) elements[elem] = { ...elements[elem], unlocked: true };
|
||||
elements[elem] = { ...elements[elem], current: Math.min(elements[elem].max, elements[elem].current + entry.finalRate * 10 * HOURS_PER_TICK) };
|
||||
// Normal conversion already applied above; add only the 9× delta
|
||||
elements[elem] = { ...elements[elem], current: Math.min(elements[elem].max, elements[elem].current + entry.finalRate * 9 * HOURS_PER_TICK) };
|
||||
}
|
||||
}
|
||||
useCombatStore.getState().tickNonCombatRoom(HOURS_PER_TICK);
|
||||
|
||||
Reference in New Issue
Block a user