core/utils/economy_math library
Pure, Flutter-free economy math shared by EnergyService/
OfflineProgressionService and tool/economy_sim.dart (IDEA-36).
This file has ZERO dependency on flutter/, get, or StorageService
on purpose: it's the single source of truth both the real services and
the headless balancing simulator call, so the simulator can never drift
from the real game's math (no separately-maintained "close enough"
reimplementation to fall out of sync).
Classes
- EnergyRegenResult
- Result of one regenEnergy tick computation.
Functions
-
offlineEarnings(
{required int lastClaimedMs, required int nowMs, required int maxOfflineCapMs, required double productionRatePerSecond}) → double -
Same formula as
OfflineProgressionService._earningsAt(): earnings accrued betweenlastClaimedMsandnowMs, capped atmaxOfflineCapMselapsed, atproductionRatePerSecond. -
prestigeMultiplier(
{required int relics, required double bonusPerRelic}) → double -
Same formula as
PrestigeService.currentMultiplier: the permanent earn-rate multiplier a player's accumulated prestige meta-currency (relics) grants —1 + relics * bonusPerRelic, sorelics == 0(never prestiged) is exactly1(no change), and each relic owned adds a flatbonusPerRelicon top, forever (relics are never soft-reset by a prestige, only the low-tier currencies are). -
regenEnergy(
{required int count, required int maxEnergy, required int lastMs, required int nowMs, required int intervalMs}) → EnergyRegenResult -
Same formula as
EnergyService._regen(): credits wholeintervalMsticks earned betweenlastMsandnowMs, capped atmaxEnergy. A no-op (returnscount/lastMsunchanged) when already full or when no whole tick has elapsed yet.