boss-scaling.ts
Multi-dimensional level scaling for bosses. Each stat has a per-level growth factor and one of three cap behaviors. Level 1 yields no scaling (multiplier = 1).
Overview
- Level input is
game._currentLevel, 1-based, clamped viaMath.max(1, level). - Raw growth is
dim.perLevel ^ (lvl - 1). - Cap behavior reshapes raw growth into the final multiplier.
Cap Types
CapType = 'uncapped' | 'soft_cap' | 'hard_cap'
- uncapped — returns
rawdirectly. Exponential, no ceiling. Used for HP, damage. - soft_cap — asymptotic approach to
capValue. Formula:1 + (capValue - 1) * (1 - exp(-capSteepness * (raw - 1))). HighercapSteepnessreaches cap faster. IfcapValue <= 1, returns 1. - hard_cap —
Math.min(raw, capValue). Brick-wall ceiling. Used for projectile speed.
Unknown cap type throws Unknown cap type: <value>.
Types
ScalingDimension
| Field | Type | Notes |
|---|---|---|
perLevel | number | Multiplicative growth per level. <1 shrinks (enrage timer). |
capValue | number | Soft cap asymptote or hard cap ceiling. Ignored for uncapped. |
capSteepness | number | Soft cap approach rate. Typical 0.15–0.5. |
capType | CapType | Cap behavior selector. |
BossScalingConfig
Nine ScalingDimension slots: hp, damage, turretFireRate, moveSpeed, limbSweepSpeed, spawnerFrequency, projectileSpeed, effectRadius, enrageTimer.
ResolvedBossScaling
Nine *Mult: number outputs, one per dimension above.
Functions
computeDimension(dim, level): number
Computes a single dimension’s final multiplier. Branches on capType.
resolveBossScaling(config, level): ResolvedBossScaling
Calls computeDimension for all nine slots. Returns the resolved mult object.
DEFAULT_BOSS_SCALING
| Dimension | perLevel | capValue | capSteepness | capType |
|---|---|---|---|---|
| hp | 2.0 | 0 | 0 | uncapped |
| damage | 2.15 | 0 | 0 | uncapped |
| turretFireRate | 1.25 | 3.0 | 0.3 | soft_cap |
| moveSpeed | 1.10 | 2.0 | 0.25 | soft_cap |
| limbSweepSpeed | 1.15 | 2.5 | 0.2 | soft_cap |
| spawnerFrequency | 1.20 | 3.0 | 0.25 | soft_cap |
| projectileSpeed | 1.12 | 2.0 | 0 | hard_cap |
| effectRadius | 1.10 | 2.5 | 0.2 | soft_cap |
| enrageTimer | 0.88 | 0.25 | 0.3 | soft_cap |
Constants
BASE_ENRAGE_TIMER_SEC = 120— base enrage timer in seconds at level 1. Per-boss defs may override.
Behavior Notes
- HP doubles each level (uncapped 2.0).
- Damage grows +115%/level (uncapped 2.15) — fastest stat.
- Projectile speed hard-caps at 2.0x — prevents unreadable shots.
- Enrage timer uses
perLevel < 1(0.88) shrinking toward 25% of base (30s) via soft cap.
EXTRACT-CANDIDATE
- Soft cap formula
1 + (capValue - 1) * (1 - exp(-k * (raw - 1)))could move tocode/math/soft-cap.mdif reused outside boss scaling. CapTypeenum semantics (uncapped / soft_cap / hard_cap) may generalize to a shared scaling primitives page if other systems adopt the pattern.BASE_ENRAGE_TIMER_SECis a tuning constant — could move to a central tuning constants page alongside other level-1 baselines.