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 between lastClaimedMs and nowMs, capped at maxOfflineCapMs elapsed, at productionRatePerSecond.
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, so relics == 0 (never prestiged) is exactly 1 (no change), and each relic owned adds a flat bonusPerRelic on 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 whole intervalMs ticks earned between lastMs and nowMs, capped at maxEnergy. A no-op (returns count/lastMs unchanged) when already full or when no whole tick has elapsed yet.