[Medium] [Bug] Recovery room regen delta can be negative — mana loss instead of gain #363
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium
File:
src/lib/game/stores/gameStore.ts(lines 315-325)Description:
The recovery room code computes
regenDelta = netBoostedRegen - netRawRegen. IfconversionResult.totalRawDrainis very high (close to or exceedingboostedRegen * (1 - incursionStrength) * meditationMultiplier), thennetBoostedRegencould be 0 (clamped byMath.max(0, ...)), whilenetRawRegenwas already computed as a positive value. In that case,regenDeltawould be negative, and the code would subtract raw mana from the player.Impact: Players in recovery rooms with high conversion drains could lose raw mana instead of gaining it. This is incorrect behavior — recovery rooms should always provide a net benefit.
Fix needed: Clamp
regenDeltato a minimum of 0, or ensure the recovery room always provides net positive regen.Fixed: Added Math.max(0, ...) clamp to regenDelta in recovery room code to prevent negative mana drain.