Upgrade interface defines purchasable enhancements that boost character stats and abilities. Upgrades can be purchased with gold or prestige cores and scale in cost and effect as they level up.
Interface definition
Properties
Identity
Unique identifier for the upgrade (e.g.,
"gold_strength_flat")Display name of the upgrade shown to players
Human-readable description of what the upgrade does
Cost calculation
Initial cost to purchase the first level of this upgrade
Exponential scaling factor applied to cost per level. Cost formula:
baseCost * (costScaling ^ currentLevel)Effect system
The type of effect this upgrade provides (see UpgradeEffectType)
Base value of the effect before scaling is applied
How the effect scales with upgrade level (see UpgradeScalingType)
Progress
Current level of this upgrade (0 if never purchased)
UpgradeEffectType enum
Defines the different types of effects an upgrade can provide:Values
Adds a flat amount to a character stat (strength, intelligence, or endurance)
Multiplies a character stat by a percentage
Increases the character’s attack speed
Reduces enemy health values
Effect scales based on the number of prestige cores owned
Increases critical hit chance (additive percentage)
Increases critical hit damage multiplier (additive percentage)
UpgradeScalingType enum
Defines how upgrade effects scale with level:Values
Effect scales linearly:
effectValue * currentLevelEffect scales exponentially:
effectValue ^ currentLevelEffect is a fixed value if level > 0:
effectValue * (currentLevel > 0 ? 1 : 0)Usage examples
Defining an upgrade
Calculating upgrade cost
Calculating upgrade effect
Getting total effect by type
Purchasing an upgrade
Related services
- GoldUpgradeService - Manages gold-purchased upgrades
- PrestigeUpgradeService - Manages prestige core upgrades
- BaseUpgradeService - Abstract base class for upgrade systems
The
Upgrade interface is used by both gold upgrades and prestige upgrades. The currency type (gold vs prestige cores) is determined by the service managing the upgrade, not by the upgrade definition itself.Cost scaling should be carefully balanced. A
costScaling value of:- 1.0 = No scaling (flat cost)
- 1.1-1.3 = Gentle scaling (early game upgrades)
- 1.5-2.0 = Moderate scaling (mid game upgrades)
- 2.0+ = Aggressive scaling (prestige upgrades)