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:
@@ -1,4 +1,4 @@
|
||||
# Circular Dependencies
|
||||
Generated: 2026-06-07T12:48:17.619Z
|
||||
Generated: 2026-06-07T14:14:38.464Z
|
||||
|
||||
No circular dependencies found. ✅
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"_meta": {
|
||||
"generated": "2026-06-07T12:48:15.677Z",
|
||||
"generated": "2026-06-07T14:14:36.561Z",
|
||||
"description": "Import dependency graph for src/lib/game. Keys are files, values are arrays of files they import.",
|
||||
"usage": "To find what a file affects, search for its path in the VALUES. To find what a file depends on, look at its KEY entry."
|
||||
},
|
||||
|
||||
@@ -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