Respawn-As

What it is

Respawn-As is a boss-flavored affix that swaps the host’s body to a different enemy type when the host’s HP fraction crosses each of a configured ordered list of thresholds. On each crossing the affix despawns the current host silently, spawns a fresh enemy of the next configured type at the same position, and transplants the carry-over identity (HP, max HP, display name, bar color, boss flags) onto the replacement. Optional per-phase affix and ability lists let the new body inherit a fresh affix loadout and a fresh ability — typically the next phase’s signature attack — without firing the standard boss-death pipeline. The pattern is what drives Awakened Mech’s three-stage shape change (Loader, Drillbot, Bigbot) on a single shared health bar.

Identity

FieldValue
Affix IDrespawn_as
Categoryboss-flavored
Priority95
HooksonUpdate
Roll poolnone (never appears on world-roaming elites)
Halo palette entrynone

The affix has no damage-filter hook, so it never modifies incoming damage. The priority position (95) sits between shielded variants (100) and gated (90); it has no ordering interaction with them because it does not participate in the damage chain.

What it does

Required state

The affix requires a phases block on the per-host instance state. The block must contain two index-aligned arrays plus two optional alignment arrays:

State keyTypeRequiredPurpose
phases.thresholdsnumber[]yesHP fractions (0..1) that trigger swaps, in cross order
phases.nextTypesstring[]yesReplacement enemy type per threshold, by index
phases.nextAffixIdsstring[][]noAffix IDs for the replacement body, per threshold
phases.nextAbilityIdsstring[][]noAbility IDs for the replacement body, per threshold

The thresholds and nextTypes arrays must have the same length. A missing phases block, a non-array thresholds, a non-array nextTypes, or a length mismatch throws on the first hook tick. The phaseIndex counter and the prevHpFrac tracker are seeded automatically to 0 and 1 respectively if not already set.

Update loop

Each frame the onUpdate hook reads the host’s current HP fraction (hp / hpMax) and compares it against the threshold at the current phaseIndex. A threshold is considered crossed when the previous frame’s fraction was above it and the current frame’s fraction is at or below it. After the comparison the previous-fraction tracker advances to the current value.

CheckAction
hpMax 0Skip the frame (no swap)
Threshold not crossedHold and advance prev-fraction
Threshold crossedSwap host body to nextTypes at phaseIndex, increment phaseIndex
Multiple thresholds crossed in one frameWalk thresholds in order, swap once per crossing, until phaseIndex reaches the array end or a threshold is not crossed

The walk handles heavy-hit chunks that drop the host past two thresholds in a single frame — the loop fires both swaps in sequence on the same tick.

Body swap

The swap is a silent replacement at the host’s exact position. The original body is marked not-alive, has its HP zeroed, has its dying flag cleared, and has a silent-removal flag set so the enemy reaper drops it next frame without emitting any of the standard death signals (no boss-kill signal, no boss-body-kill signal, no death VFX). A new enemy of the configured next type is spawned at the same coordinates through the shared enemy spawner. If the spawner returns null (pool cap or unknown type) the swap throws.

The replacement inherits these slots from the old body:

SlotSource
hpold body’s current hp
hpMaxold body’s hpMax
isBossold body’s isBoss flag
sharesHealthWithBossold body’s sharing flag
untargetableold body’s untargetable flag
displayNameold body’s displayName (if set)
barColorold body’s barColor (if set)
phaseIndexpost-increment phase index on the replacement body

HP carry-over keeps the boss bar continuous through the swap — the bar reads the replacement’s hp and hpMax on the next render and lands on the same value the old body held the instant before the swap.

Affix and ability inheritance

If a nextAffixIds entry exists for the just-crossed threshold, the replacement body’s affixes array is rebuilt from that list. The new affix instances start with empty state, except for the respawn_as case: when respawn_as appears in the next-affixes list, the runtime carries the original phases configuration forward onto the replacement and pre-stamps the next phase index, so subsequent thresholds can fire. The previous-fraction tracker on the carried respawn_as instance is reset to the replacement’s current HP fraction, which prevents an immediate re-cross of the just-crossed threshold.

If a nextAbilityIds entry exists, the replacement’s abilities are rebuilt through the standard ability factory so the next phase’s ability respects its configured start delay. Without the factory path the new ability would fire instantly at the swap point instead of waiting out its warmup.

Phase-changed dispatch

After the replacement is wired, the runtime looks up the active boss definition by ID. If the def exposes an onPhaseChanged callback and a boss arena is active, the runtime calls the callback with the replacement body, a one-based phase number (the just-crossed transition), the world, the boss arena, and the shared boss VFX kit. This is the hook used by per-boss code to retire old persistent VFX layers and bind new ones, swap arena palettes, or trigger phase-tied spawn-profile waves.

Per-tier values

The affix has no tunable defaults. Every value comes from the per-host phases configuration in the boss roster entry; there is no fallback. The Awakened Mech configuration is the only v1 user:

FieldValue
thresholds[0.66, 0.33]
nextTypes[industria_drillbot, industria_bigbot]
nextAffixIds[0][respawn_as]
nextAffixIds[1][] (terminal phase, no carry)
nextAbilityIds[0][mech_phase2_spiral_vortex]
nextAbilityIds[1][mech_phase3_cone_slam]

The boss spawns as the Loader phase, crosses 66% to swap to the Drillbot (with respawn_as carried so the next threshold can fire), and crosses 33% to swap to the Bigbot (terminal, no further affixes).

How it interacts

With the boss bar

The transplanted hp and hpMax keep the bar continuous across swaps. The bar color is carried unless the new body sets its own barColor at the boss-def level; in practice Awakened Mech uses the roster bar color (phase 1 palette) on the initial body and lets onPhaseChanged repaint the visual layers for later phases, while the bar color itself remains the value transplanted from the previous body.

With other affixes

The affix participates only in onUpdate, so it has no entry in the damage-filter chain. It does not gate, reduce, or reflect damage. The replacement body’s affix list is whatever nextAffixIds names — there is no automatic carry of any affix other than respawn_as itself when it appears in the list. Existing affix instances on the old body are dropped along with the old body.

With the spawn profile

The replacement body’s phaseIndex slot is stamped to the post-crossing value (1 for the first swap, 2 for the second, and so on). The boss spawn profile reads this counter to fire phase-tied add waves — for Awakened Mech, the crescendo profile uses the slot to gate the 15-second and 12-second add cadences to phases 2 and 3.

With the standard death pipeline

The swap is silent by design. The old body’s removal does not emit a boss-kill signal, a boss-body-kill signal, or any reward-drop event. The only events on a swap frame are the onPhaseChanged callback (if defined) and whatever telemetry the runtime layer above records. The reward pipeline is only reached when the final phase’s body is killed through the normal damage path, after the affix has exhausted all thresholds.

Failure modes

ConditionResult
phases block missing or malformedThrows on first hook tick
thresholds and nextTypes length mismatchThrows on first hook tick
Replacement type ID not registeredThrows at swap time
Spawner returns null at swapThrows at swap time
Multiple thresholds crossed in one frameEach fires in order on the same tick
HP regenerated above a crossed threshold then re-crossedDoes not re-fire (phaseIndex only advances)

EXTRACT-CANDIDATE

  • The silent-removal pattern (alive=false, hp=0, silent-remove flag) used to retire the old body without firing the death pipeline is candidate for a shared “silent enemy removal” concept page; respawn_as is its first consumer and any future body-swap mechanic will need the same primitive.
  • The HP-fraction crossing detector (previous-fraction tracker plus prev>t && currt comparison, with multi-cross walking) is a reusable threshold-crossing pattern; candidate for an affix-system concept page rather than re-derivation per affix.
  • The onPhaseChanged dispatch path tying a body-swap to per-boss VFX rebinding is shared infrastructure between respawn_as and any future phase-shifting affix; candidate for the bosses concept page.
  • The factory-routed ability rebuild (preserving start-delay warmups across swap) is a general lesson for any code that swaps abilities mid-encounter; candidate for the abilities concept page.