diff --git a/notes/entities/beast_war_death.md b/notes/entities/beast_war_death.md new file mode 100644 index 0000000..fe5fe9b --- /dev/null +++ b/notes/entities/beast_war_death.md @@ -0,0 +1,394 @@ +# Ultra War and Ultra Death (Beast fight harbingers 3 and 4), per tick (2026-10-24) + +Read from isaac-ng.exe v1.9.7.17 (`decompile.sh` plus `--asm` for dropped arguments and the Entity_Effect cases) and +the game's anm2 / entities2.xml / sounds.xml. Arena, lava line, scroll and fight order: [beast.md](beast.md). Notation +and engine facts used throughout: + +- **Tick order** (Entity_NPC::Update 0x6c4b30): AI phase 0 (`+0xb74 = 0`), then phase 1 if `+0xf18 & 1`, then + Entity::Update physics, then phase 4 if `+0xf18 & 8`. Phase 2 (interpolation half-step) runs if `+0xf18 & 2`; phase 3 + (collision, other entity at `+0xb7c`) if `+0xf18 & 4` (Entity_NPC::HandleCollision 0x6cd410 at 0x6cdad9; the AI + writes the result to `+0xb80`: preset -1 = normal, 0 = ignore this contact, >0 = collide). During the engine's + death clip (state 0x12, anim "Death") only phase 1 runs. +- **Physics** (Entity::Update 0x6ae820): `v *= F` (F = Friction +0x36c, adjusted `F/(F+s-F*s)` for speed multiplier s + != 1), `pos += v * s`, then Friction is reset to the base friction (+0x368; 1.0 for every entity here). So "friction + 0.8" = this tick's velocity multiplier; `F *= k` stacks on it within the tick. +- `s` = `_speedMultiplier` (+0x39c, the time scale, 1 normally); `dt` = `(int)frame - (int)prevFrame` (+0x3a4/+0x3a0, + 1 normally); `frame` = FrameCount +0x3a4. `rnd` = Random() as float in [0,1); `rv` = MusicManager::RandomVector, + a random unit vector. `Every(n)` = Entity::GetIntervalTicks(n, 0) (XMM1 = n, XMM2 = 0). P = Entity_NPC::GetPlayerTarget + position, Pv its velocity. Room rect TL = (TL.x, TL.y) = (-49.23, 72.31), BR = (689.23, 487.69), lava line L = BR.y - 30 + (`Room::get_lava_line_y` 0x8279c0). "Play(a)" = ANM2::Play (restarts only if a different anim); "finished" = + `+0x7c == 0 || +0x8c == 0` (no anim or not playing; a looping anim never finishes); "looping" = current anim's + Loop flag (`[+0x7c]+0x34`). +- Sounds: id (hex) and the first sounds.xml sample. All Entity_NPC::PlaySound / play_sound_with_fart_seed / + SoundEffects::Play calls here are volume 1.0, frame delay 2, no loop, pitch 1.0 unless stated. +- Spawned NPC children: the spawner clears their FLAG_APPEAR (`flags &= ~4`) and calls their vtable Update (slot 3) + once at once, so their state-0 init (and, for 951.31, one physics step) happens in the spawn tick. +- EntityFlag names from the Lua enum: 0x44000000 = NO_KNOCKBACK (1<<26) | NO_PHYSICS_KNOCKBACK (1<<30); 0x1 = + NO_STATUS_EFFECTS; 0x10 = NO_TARGET; 0x10000 = NO_BLOOD_SPLASH; high dword 0x80 = AMBUSH (1<<39), 0x400 = NO_REWARD + (1<<42), 0x2000 = NO_PLAYER_CONTROL (1<<45). +- Colour args below: `Color(tint r,g,b,a; colorize r,g,b,a; offset r,g,b)`; SetColor(color, duration, priority, fadeout, + share) is vtable slot 15 (+0x3c). Visual-only spawns are named, not specified. + +Corrections to beast.md's summary: War's headless transition is at **50 %** HP (Famine's is 33 %); Death has **no HP +transition** at all; the bomb's chain blasts are BombDamage(damage 30, radius 45), not radius 30 / damage 45; the 5.40.7 +"pickup" is the Giga Bomb that a War bomb turns into under Safety Scissors; 1000.199 is thrown when Death **dies**, +not during Swing. + +## Ultra War (NpcAI::ENTITY_BEAST_ultra_war 0x44c070, 951.30) + +entities2: HP 2000, radius 70, mass 500, contact damage 1, no grid collision, shieldStrength 30. +anm2 951.030_ultra war.anm2 (30 fps; nulls BloodGuide, OverlayEffect, ShootPos; frames, `loop`, events@frame): +Idle 64 loop · ThrowBomb 40 Sound@5 Shoot@22 · DashStart 24 Sound@5 Shoot@22 · DashLoop 4 loop · DashEnd 28 Sound@5 · +Transition 60 Sound@6 Shoot@40 · Float 24 loop · ChaseStart 20 Shoot@8 · ChaseLoop 12 loop · Burst 33 Shoot@13 · +QuickBurst 25 Shoot@5 · Lunge 55 Sound@6 Shoot@18 · LungeShort 38 Sound@6 Shoot@18 · LungeBomb 46 Sound@6 Shoot@18 · +Knockback 16 loop · KnockbackEnd 11 · Death 63 BloodStart@1 BloodStop@56 Explosion@62 · Ref 2. +Unused by the AI: Burst, Lunge, KnockbackEnd, Ref; every "Sound" event is tested but ignored. + +Phases: `+0xf18 = 1`, so phase 0 and phase 1 only. Phase 1 does nothing unless state 0x12. Per-AI fields: G = +0x418 +(goal), D = +0x420 (drift vector, |D| <= 1), T = +0x43c (retarget timer). + +### every phase-0 tick, before the state switch + +- Headless set H = {0x10, 4, 6, 7, 0xd, 10, 5}. In H: headless = true. Otherwise, if `hp < 0.5 * maxHP` and War took + damage this tick (Entity +0x14 > 0, the per-tick hit amount, see brownie.md) and Room::IsPositionInRoom(pos, 0): + **transition**: state 0x10, Play "Transition", EntityCollisionClass 0; every projectile (type 9) in the room gets + `_dead = 1`; every other entity of type 10..999 not dead with SpawnerType 951 is Kill()ed (source War) (War bombs, + fires, anything the harbingers or the Beast spawned). The switch then runs case 0x10 the same tick. +- Not transitioning (both other paths): if `_dead`: sound 0x2a8 War Death.wav. + +### states + +- **0 init** (runs inside the Beast's spawn Update): state 3; TargetPosition = G = pos; D = (rv.x, rv.y * 0.5); T = 0; + flags |= 0x44000000; `+0xf18 = 1`; StateFrame 0; I1 0; music: the current track's layer mask (Manager+0x29fbc + slot +0x170) = 2 (layer 1 only). The Beast then sets state 99. +- **99 enter**: state 9, visible, EntityCollisionClass 4, Play "DashLoop", sound 0x2a2 War Appear.wav, StateFrame 4, + I1 0. So the first thing War does is the final dash leg (below) from its spawn point (880, 280). +- **3 idle (horse form)**: Play "Idle"; F = 0.8 (set); `v += D * 0.55 * s`. + - Retarget: if T < 1: T = 20 + rand % 20; side = +100 if P.x <= x else -100; G = (P.x + side + 100 * + sin(frame * (0.01 + 0.003 rnd)), P.y) + rv * 20. Else T -= dt. + - Steer: d = G - pos; if d != 0: a = sin(frame * 0.01) * 30 deg; `D += rotate(d, a) * 0.001 * s`. + - Walls: x < TL.x + 80: `D.x += (TL.x + 80 - x) * 0.001`; else x > BR.x - 80: `D.x += (BR.x - 80 - x) * 0.001`; + same for y with TL.y + 100 / BR.y - 100. Then |D| > 1: normalise. + - StateFrame += dt; at >= 60: I1 < 3: Play "ThrowBomb", sound 0x2ac War Pull out Bomb 1.wav, state 8, FlipX = + (P.x > x), I1++, StateFrame 0; else: Play "DashStart", sound 0x2a5 War Dashing 1.wav, state 9, FlipX = (P.x > x), + I1 0, StateFrame 0. Cycle: three throws, then one dash. +- **8 ThrowBomb**: `F *= 0.8`. On Shoot (frame 22): sounds 0x2a4 War bomb toss 1.wav and 0x2ae War_BombTicking.wav; + S = pos + null "ShootPos"; dx = P.x - S.x, dy = P.y - S.y, ax = |dx|; ballistic launch with vy0 = -18 and the bomb's + gravity g = 1.2: `vx = (sqrt(max(0, 2.4 ax^2 dy + 324 ax^2)) - 18 ax) / (2 dy)`, flight time t = ax / vx (t = 30 if + ax <= 0.1), vx negated if dx < 0 (dy = 0 divides by zero: unguarded); FlipX = (dx >= 0). Spawn 951.31.0 at S, + velocity (vx, -18), spawner War, Parent = War, StateFrame (its fuse) = (int)t + 15, then its Update. When the clip + ends: Play "Idle", state 3, StateFrame 0. +- **9 dash** (horse form; also the entry): StateFrame = the leg number k; I1 unused. + - k >= 0: cap = 40 if k < 4 else 30; F = 0.8 (set); if finished: Play "DashLoop" (after DashStart). On Shoot + (DashStart frame 22): v.y = 0. While looping (DashLoop) or WasEventTriggered("Shoot"): `v.x = clamp(v.x + (FlipX ? + +10 : -10) * s, -cap, cap)`, and Every(2) a dust cloud 1000.59 at pos + (0,-40), velocity 2 rv + 0.2 v (visual). + - Bomb drop: if ProjectileDelay == 0 and k in 1..3 and War has passed the drop point V1.x (moving left: x < V1.x + + 60; right: x > V1.x - 60): ProjectileDelay = 1; spawn 951.31.1 at pos, velocity (v.x * 0.06, -8), spawner War, + Parent War, then its Update. + - k < 4, leg end: E = 180 (k 0), 1000 (k 1, 2), 3200 (k 3); when x < TL.x - E (moving left) or x > BR.x + E + (right): k++; k < 4: sounds 0x2a6 War Dashing Start 1.wav and 0x2b1 War_LavaTravel1.wav, else sound 0x2a2 War + Appear.wav; x = BR.x + 180 (moving left) or TL.x - 180 (right) (same direction again, wrapping round); + y = BR.y - 20 (in the lava) for k 1..3, or (TL.y + 80 + BR.y - 120) / 2 = 260 for k 4; next drop point V1.x = for + k 1: TL.x + 160 + rnd * (BR.x - TL.x - 320); else `round((TL.x + 140 + rnd * (BR.x - TL.x - 280) - (V1.x + 70)) / + 140) * 140 + V1.x + 70`; ProjectileDelay 0; SetColor(Color(1,1,1,1; 0; 0.5,0.25,0), 15, 1, fade, share) (orange + flash). + - k >= 4: when x < BR.x - 20 (moving left) or x > TL.x + 20 (right): Play "DashEnd", StateFrame -1. + - StateFrame < 0 (braking): f = clamp((StateFrame + 1) / -29, 0, 1); StateFrame -= dt; `F *= 1 - 0.6 f`. When + DashEnd finishes: Play "Idle", state 3, StateFrame 0. + - So a dash = DashStart, run off the far side (leg 0), three lava legs at y = BR.y - 20 each dropping one bomb into + the lava (legs 1-3; legs 1/2 travel 1000 off-screen, leg 3 3200, i.e. a long pause), then a run back in at mid + height that brakes on screen. +- **0x10 Transition** (to headless): `F *= 0.6`. On Shoot (frame 40): sound 0x2a7 War Horse Dies.wav, gibs + (spawn_gibs, visual), sound 0x8d rocket blast death 1.wav, Game::ShakeScreen(10), fire burst + (NpcAI::ENTITY_BEAST_ultra_war_fire_burst 0x44ee60: sound 0x1e3 flame_burst.wav, pitch 1.5 / 0.5 for champion colour + 18 / 19, and 25 dust clouds 1000.59 in five fans around straight up; visual). When finished: EntityCollisionClass 4, + state 4, Play "Float", StateFrame 0, I1 0. +- **4 Float / 6 chase** (headless): if state 6 and finished: Play "ChaseLoop" (after ChaseStart). On Shoot (ChaseStart + frame 8): sound 0x2ad War Starts to chase you 1.wav. `F *= 0.8`; `v += D * k * s` with k = 0.55 (4) / 1.6 (6). + - Aim A: state 4: A = P. State 6: if P.y <= mid (= (TL.y + BR.y) / 2) or StateFrame >= 60: the two points + P + (-113.14, -113.14) and P + (113.14, -113.14) (160 up-left / up-right of the player), pick the one nearer War + (ties to the right one); f = clamp((|pos - P| - 160) / 180, 0, 1); A = P + (pick - P) * f; if StateFrame >= 60: + A.y = min(A.y, mid). Else (player in the lower half, early): A = P + Pv * |pos - P| * 0.1 (lead). + - d = A - pos; if d != 0: `D += normalize(d) * (state 6 ? 0.8 : 0.1) * s`; |D| > 1: normalise. FlipX = D.x > 0. + - StateFrame += dt. State 4: at >= 60: Play "ChaseStart", state 6, StateFrame 0. State 6: at >= 90 and not heading + into a near wall (D.x > 0 needs x < BR.x - 150; D.x <= 0 needs x > TL.x + 150): I1 < 2: Play "LungeShort", FlipX = + (P.x > x), I1++, state 7, StateFrame 0; else Play "LungeBomb", FlipX = (room centre x > x), state 10, StateFrame + 0, I1 0. +- **7 LungeShort / 10 LungeBomb**: `F *= 0.8`. On Shoot (frame 18): sound 0x2aa War Grabs at you 1.wav (state 7) or + 0x2ab War Holds onto bomb.wav (state 10); V1 = (FlipX ? 15 : -15, 12). From then (WasEventTriggered, including that + tick): `v += V1 * s`, V1 *= 0.7 (timescale-adjusted). When finished: + - state 10: spawn 951.31.2 at pos + rv, velocity 0, spawner War, then its Update; then `_visible = 0`, its + StateFrame = 0, and a second Update: it explodes at once (see the bomb). War: state 5, Play "Knockback", V1 = + (FlipX ? -15 : 15, -2), StateFrame 0. + - state 7: Play "QuickBurst", state 0xd, StateFrame 0. +- **5 Knockback** (sub-state in StateFrame): `F *= 0.6`. + - 0 flying: Entity::AddVelocity(V1) (V1 is not decayed: steady ~2.5 V1 per tick); FlipX = V1.x < 0. Hitting a side + (V1.x > 0 and x + size > BR.x, or V1.x < 0 and x - size < TL.x): sound 0x45 meat impact.wav, V1.x = -V1.x, and if + y < TL.y + 100: StateFrame 1, V1.y -= 4. Every(2) a dust cloud 1000.59 (visual). + - 1 falling (same tick onward, still adding V1 and bouncing): V1.x *= 0.94, V1.y += 0.5 s; when y > L + 80: + sounds 0xe2 meat head shoot.wav and 0x2b0 War_LavaSplash_In.wav; StateFrame 2; spawn 951.31.1 at pos, velocity 0, + spawner War, its Update, then `_visible = 0`, and it becomes War's Child (an invisible lava eruption under War). + - 2 in the lava: V1 *= 0.6, V1.y += 0.3 s (V1 not added). When the Child is gone or its StateFrame < 1 (fuse + burnt): Child cleared, StateFrame 3, V1 = (0, -18), y = L, Play "QuickBurst", sound 0x2a3 War Appears from + Lava.wav, SetFrame(5). + - 3 rising: AddVelocity(V1), V1 *= 0.8; when the clip ends: Play "Float", I1 0, StateFrame 0, state 4. +- **0xd QuickBurst**: `F *= 0.7`. On Shoot (frame 5): sounds 0x2a9 War Fire Scream 1.wav and 0x2af + War_FlameWhoosh.wav, the fire burst (0x44ee60), StateFrame 1, and 16 moving fires 33.10 (Moveable Fireplace), + spawner War, subtype 0: for i = 0..7, a = 45 i deg: one at pos + 20 (cos a, sin a) with velocity 5 (cos a, sin a), + HP = 1.2 MaxHP; one with velocity rotate(5 (cos a, sin a), 22.5 deg) * 0.6 (speed 3) at pos + 4 * that velocity, + HP = 0.8 MaxHP; both RenderZOffset -2000, Update, then GridCollisionClass 0. + Then while StateFrame > 0, once per dt tick: if StateFrame is even, 4 shots (FireProjectiles mode 0) for i = 0..3: + base = 16 (cos 90i, sin 90i); velocity = base * (0.8 + 0.2 rnd); position = pos + 4 * rotate(base, -45 + 90 rnd + deg) (up to 64 out); ProjectileParams: Variant 2 (fire projectile), FallingAccelModifier -0.2, Scale 0.7 + 0.4 rnd, + Color tint (1, 0.8, 0.8, 1); StateFrame++. So volleys on StateFrame 2, 4, ... until the clip ends (about 10 volleys + of 4). When finished: Play "ChaseStart", state 6, StateFrame 0. +- **headless neck smoke** (end of every phase-0 tick, headless, Transition only after its Shoot): Every(3) a 1000.59 at + layer 0's frame position / 0.65 * layer scale (x mirrored with FlipX) + pos + posOffset + rnd * rv * 40, velocity + (0.1 v.x, 0.1 v.y - 2 - 6 rnd), additive blend; visual. +- **0x12 death clip** (phase 1): F = 0.8 (set), `v.y += 0.4 s` (sinks into the lava). On "Explosion" (Death frame 62): + Game::BombExplosionEffects(pos, damage 80, no tear flags, default colour, source = War's SpawnerEntity (the Beast), + radiusMult 1.5, lineCheck false, DamageFlag 4 EXPLOSION, damageSource false) = BombDamage(pos, 80, radius 75 * 1.5 = + 112.5) plus the 1000.1 explosion sprite; 10 dust clouds 1000.59 (velocity (10 + 5 rnd) at ((i - 0.4 + 0.8 rnd) * 36) + deg; visual); Entity::MakeGroundPoof; ShakeScreen(50); Game::SetBloom(6, 1.0) (inlined: Game+0x2652c/+0x26528 = 6, + +0x26530 = 1.0); Room shockwave slot (Room+0x70fc ring, = Game::MakeShockwave(pos, 0.5, 0.07, 20) inlined; visual). + +## Ultra War Bomb (NpcAI::ENTITY_BEAST_ultra_war_bomb 0x44f2b0, 951.31) + +entities2: HP 200 (invincible), radius 34, mass 300, contact damage 1. anm2 951.031_ultra war bomb.anm2: Idle 24 loop · +Pulse 59 (no events). Subtypes: 0 thrown (ThrowBomb), 1 dropped into the lava (dash legs, Knockback), 2 held +(LungeBomb, invisible). `+0xf18 = 5`: phases 0, 1 and 3. + +- **phase 1** (pre-physics): if visible: `v.y += 1.2 s` (gravity); if then y > L: `F *= 0.5`, and subtype 1: v.x = 0. +- **phase 3** (collision): subtype 1 touching a player (type 1) or familiar (3): `+0xb80 = 0` (contact ignored: lava + bombs never touch the player). +- **0 init**: flags |= 0x44000011, invincible, Play "Idle", `+0xf18 = 5`, RenderZOffset -500; state 3 (subtype 1) or + 5 (subtypes 0, 2). +- **3 sinking** (subtype 1): when y > L: StateFrame (fuse) 15, state 5, and the lava glow: Lava Spawner 1000.181.0 + at (x, L), spawner the bomb, `+0xfc` (sprite alpha) 0, MinRadius 1.0, MaxRadius 0, Parent the bomb, becomes the + bomb's Child, Update; then for i = 1..4 two more at (x +- 140 i, L), State 3, MinRadius 1 - 0.2 i, MaxRadius 0, + Parent = the first spawner, Update. +- **5 fuse** (StateFrame > 0): if the current anim loops (Idle): switch to "Pulse" frame 0. Child (the glow) alpha = + 1 - clamp(StateFrame / 15). StateFrame = max(0, StateFrame - dt); Pulse frame = max(0, 59 - StateFrame) (so Pulse + ends exactly at 0); while StateFrame < 20: `F *= 0.5 + 0.4 * StateFrame / 20`. +- **5, StateFrame == 0: explode**: Child (glow) `_dead = 1`. + - Anyone holding TRINKET_SAFETY_SCISSORS (63): Remove (vtable +0x28), sound 0x384 bomb_fuse_fizzle.wav, spawn + pickup 5.40.7 (Giga Bomb) at pos with the bomb's velocity (no spawner), Poof01 1000.15.1. Nothing else. + - Else BombExplosionEffects(pos, 80, no flags, default colour, source = the bomb's SpawnerEntity (War), radiusMult + 1.5, DamageFlag 4 EXPLOSION) = BombDamage radius 112.5, damage 80, plus the 1000.1 sprite; ShakeScreen(10); 10 dust + clouds (as War's death); subtype 0 only: 48 shots, for 12 directions a = 30 j deg and i = 0..3: FireProjectiles + mode 0 at pos, velocity (10 - i) (cos a, sin a); ProjectileParams Scale 1 + 0.4 i, BulletFlags 0x2000 + (NO_WALL_COLLIDE), Color tint (2,2,2,1) offset (0.4, 0.12, -0.3) (Variant 0); each projectile then gets + `+0x414 = 0` (FallingSpeed) and `+0x418 = -0.1` (FallingAccel). MakeGroundPoof; SetBloom(6, 1.0). Then + StateFrame -1, V1.x = 0, invisible, EntityCollisionClass 0, velocity 0. +- **5, StateFrame < 0: aftermath**, once per dt tick, then StateFrame--: + - subtypes 0 and 2: a cross of blasts: when (-StateFrame) is even: V1.x += 80; for the 4 directions left, up, right, + down (table 0xc5c57c): p = pos + dir * V1.x; if p is inside the room rect: spawn 1000.1 Bomb Explosion at p + (State 1, no spawner) and Game::BombDamage(p, damage 30, radius 45, lineCheck false, source = War, no tear flags, + DamageFlag 4 EXPLOSION, damageSource false). If none of the 4 was inside: Remove. So rings 80 farther every 2 + ticks until all four arms leave the room. + - subtype 1: lava eruptions: when (-StateFrame) % 4 == 0: for offsets +V1.x and -V1.x (only one when V1.x == 0) at + y = L: if inside the room: FireProjectiles mode 0 at (x +- V1.x, L), velocity (0, -20), ProjectileParams Variant 14 + (Lava Projectile), FallingAccelModifier 0.5, BulletFlags 0x2000 (NO_WALL_COLLIDE); and a 1000.1 sprite there + (State 1). Then V1.x += 140. At StateFrame < -16: Remove. So eruptions at StateFrame -4, -8, -12, -16 at offsets + 0, +-140, +-280, +-420 (the glows reach +-560). + +## Lava Spawner (Entity_Effect::Update case 0x5e1f3a, 1000.181) + +Effect case selected by the variant jump table (`[0x606f8c + 180*4]`), ends at the common tail 0x606e88 (timeout +countdown, `_dead` at 0; dogma_effects.md). anm2 1000.181_lava spawner.anm2: Idle 1 loop · Disappear 8. + +- **subtype 0 (War's glow; no gameplay)**: if it has no Parent and is not dead: Die. If its Parent is another 1000.181 + (the children): when the parent is dead, its own LifeSpan <= 0 and its State > 0: SetTimeout(State) (= 3 ticks, then + `_dead`); each tick it copies the parent's sprite colour and sets alpha = parent alpha * MinRadius. When `_dead`: + Play "Disappear", Remove when it ends. The first spawner's alpha is driven by the bomb (fade in over the 15-tick + fuse), and the bomb kills it at the explosion. +- **subtype 2 (the Beast's Dive sequence)**: State 0: alpha = 1 - clamp(Timeout / LifeSpan); every tick + Room::RaiseGridPathAtPos(pos, 900). When `_dead` (timeout ran out): eruption at (x, L): sound 0x32e + Beast_Lavaball_Rise1.wav (via the effect, volume 1); Spawn 9.14 (Lava Projectile) at (x, L), velocity (0, -20), + spawner = the effect's SpawnerEntity, projectile flags |= 0x2000 (NO_WALL_COLLIDE), FallingAccel 0.5, its Update; + Spawn 1000.1 there with State 1, its Update; ShakeScreen(6); Play "Disappear", State 1. State 1: Remove when the clip + ends. +- **subtype 1 (the Beast's scrolling ones)**: State 0: alpha = 1 - clamp(|x - TargetPosition.x| / 200); erupts (same + as subtype 2) once the arena scroll has carried it past its TargetPosition (speed > 0 and x > target.x, or speed < 0 + and x < target.x). State 1 as above. + +## Ultra Death (NpcAI::ENTITY_BEAST_ultra_death 0x440f00, 951.40) + +entities2: HP 2000, radius 70, mass 500, contact damage 1, shieldStrength 30. **No HP threshold anywhere**: Death keeps +one moveset to the end. Fires no projectiles. anm2 951.040_ultra death.anm2 (nulls BloodGuide, OverlayEffect, Hit, +Eye): Idle 64 loop · Summon 34 Shoot@12 · SummonStart 15 Shoot@12 · SummonLoop 8 loop · SummonEnd 16 · SwingPrepare 17 +Shoot@13 · SwingPrepareLoop 10 loop · Swing 37 Shoot@9 · SwingAlt 37 Shoot@9 · Death 63 BloodStart@1 BloodStop@56 +Explosion@62 · Ref 16. Unused: Summon, SwingAlt, Ref. + +`+0xf18 |= 0xb`: phases 0, 1, 2, 4. Fields: G +0x418, D +0x420, T +0x43c (as War), C = +0xc34 (dash acceleration +scalar), trail = +0xbec (EntityPtr to its 1000.166), A = layer alpha factor (1.0 unless set below). + +- **phase 1**: only state 0x12: F = 0.8 (set), `v.y += 0.4 s` (sinks). The "Explosion" event is tested and ignored + (no blast for Death). +- **phases 2 and 4** (trail): no trail: nothing. State 0x10 and the "Eye" null offset non-zero: trail alpha (+0xfc) = + sprite layer 4's alpha, trail position = pos + Eye offset. Otherwise trail alpha 0 (hidden). +- **phase 0, first**: if `_dead`: sound 0x2b2 Death Dies.wav; spawn 1000.199 (the dropped scythe) at pos + (0, -60), + velocity (-8, -13), no spawner; if P.x < x: velocity (8, -13) and its FlipX = 1 (it flies away from the player); + its Update. + +### states + +- **0 init**: state 3; TargetPosition = G = pos; D = (rv.x, rv.y * 0.5); T 0; `+0xf18 |= 0xb`; flags |= 0x44000000; + StateFrame 0, I1 0; music: layer mask 0 then MusicManager::EnableLayer(2, 0). Trail: Spawn 1000.166 (Sprite Trail) at + pos, spawner Death; sprite colour (1, 0.1, 0.1, 1) (red); MinRadius = MaxRadius = 0.11; sprite scale (2, 2); Parent = + Death; Death's trail = it. +- **99 enter**: state 7, V1 = (-1, 0), visible, EntityCollisionClass 4, I1 0, Play "Idle". (C keeps its spawn value 0, + so the first tick adds nothing.) +- **7 glide in**: Play "Idle"; `v += V1 * C * s`; C = max(C - 0.07 s, 0.2) (so 0.2 a tick after the first); F stays + 1.0 (no friction: accelerates). Until inside the far margin (moving left (FlipX 0): x < BR.x - 200; right: x > TL.x + + 200), then: sound 0x2b4 Death Growl_2.wav, state 3, I1 0, StateFrame 0. +- **3 hover**: if finished: Play "Idle". F = 0.8 (set). m = min(|P.x - x|, |P.y - y|); c = clamp((160 - m) / |pos - + P|, 0, 1) (closeness, mainly when lined up with the player); `v += D * (0.55 + 0.8 c) * s`. + - Retarget: if T < 1: T = (int)((1 - 0.6 c) * (20 + rand % 20)); G = the nearest to Death of P + (+-180, +-120) + (table 0xc5c55c: (-1.5,-1), (1.5,-1), (-1.5,1), (1.5,1) * 120) that lies within [TL.x + 60, BR.x - 60] x + [TL.y + 60, BR.y - 60] (if none, P itself); G += rv * 20 * (1 - c). Else T -= dt. + - Steer: d = G - pos; if d != 0: a = sin(frame * 0.01) * 30 deg; `D += rotate(d, a) * (0.001 + 0.002 c^2) * s`. + - Walls (stronger than War's): x < TL.x + 80: `D.x += (TL.x + 80 - x) * 0.01 * s`; x > BR.x - 80 likewise; y with + TL.y + 100 / BR.y - 100. |D| > 1: normalise. + - Facing: P.x > x + 10: FlipX 1; P.x < x - 10: FlipX 0. + - StateFrame += dt; at >= 60: I1 > 2: V1 = (-1, 0) if x <= room centre x else (1, 0) (toward the nearer side), C = + 0.1, FlipX = V1.x > 0, state 9, I1 0, StateFrame 0. Else: Play "SummonStart", state 8, FlipX = (P.x > x), I1++, + StateFrame 0. Cycle: three summons, then the skull run and the swings. +- **8 summon scythes**: `F *= 0.8`. + - StateFrame >= 0: if finished: Play "SummonLoop". On Shoot (SummonStart frame 12): V1 = normalize(P - pos) * 500, + StateFrame 1, sounds 0x2b7 Death Summon Scythes 1.wav and 0x109 Feedback/summonsound.wav. + While StateFrame > 0, once per dt tick: dir = rotate(V1, (StateFrame - 6) * 20 deg); E = + Entity_Laser::CalculateEndPoint(pos, dir, offset 0, no laser, margin -50) = where the ray leaves the room rect + inset by 50; spawn 951.41.0 at E, velocity 0, spawner Death; u = normalize(pos - E); its flags &= ~4, high |= + 0x80 (AMBUSH); its TargetPosition = u * (1 + 0.2 rnd) (its launch direction); SetColor(Color(1,1,1,0; 0; 1,1,1), 8, + 255, fade, share) (fades in from white); its Update; its StateFrame (wait) = 16 - StateFrame. If StateFrame > 10: + StateFrame -1, Play "SummonEnd", stop; else StateFrame++. So 11 scythes on 11 consecutive ticks along rays at + -100..+100 deg (step 20) round the aim at the player, all launching together 16 ticks after the first. + - StateFrame < 0: when SummonEnd finishes: Play "Idle", state 3, StateFrame 0. +- **9 skull run**: `F *= 0.8`. If finished: Play "SummonLoop" (it keeps the looping Idle from state 3, so this only + matters after the explicit Play below). While "SummonLoop" plays: ambient sound 0x2d9 Death_SkullsAttackLoop.wav + volume += 0.05 up to 1. + - I1 0 (out): `v += V1 * C * s`, C = min(C + 0.1 s, 4) (terminal about 16 a tick). StateFrame 0 and near the exit + edge (V1.x > 0: x > BR.x - 100; < 0: x < TL.x + 100): StateFrame 1. Past BR.x + 200 / TL.x - 200: I1 1, x clamped + to that line, FlipX toggled, y = (TL.y + BR.y) / 2, Play "SummonLoop", sound 0x2b8 Death Summon Skulls 1.wav. + - I1 1 (back): `v -= V1 * C * s`, C = max(C - 0.07 s, 0.2) (V1 is not flipped: it re-crosses from the same edge, + slowing to a 0.8 a tick drift). + - On Shoot: sounds 0x70 monster grunt 4a.wav and 0x109, five 951.41.0 at angles -45..+45 (step 22.5) from P, + speed 8, TargetPosition = velocity * 0.1, RenderZOffset 1000, StateFrame 15. **Unreachable** with the shipped + anm2: neither Idle nor SummonLoop has a Shoot event. + - While StateFrame > 0, once per dt tick: StateFrame % 45 == 0: x0 = BR.x + 100 if V1.x > 0 else TL.x - 100; sound + 0x2b8; 4 skulls 951.42.0 for i = 0..3 at (x0 + (i odd ? 80 V1.x : 0), 120 + 110 i), velocity V1 * -40 (flying + back into the room the way Death returns), RenderZOffset 1000 (even i) / -1000 (odd i, behind), TargetPosition = + (StateFrame * pi / 180 + i * 3 pi / 4, 0) (its bob phase), spawner Death, Update. At StateFrame > 365 while the + current anim loops: Play "SummonEnd". At StateFrame > 380: Play "SwingPrepare" (unless already), StateFrame 0, I1 + 0, state 10, TargetPosition = pos. Else StateFrame++. So 8 waves of 4 skulls (StateFrame 45..360). +- **10 SwingPrepare**: `F *= 0.8`; `v += (TargetPosition - pos) * 0.1 * s` (held in place). If finished: Play + "SwingPrepareLoop". On Shoot (SwingPrepare frame 13): sound 0x2da Death_SkullsAttackEnd.wav; every 951.42 whose + SpawnerEntity is Death: state 5, Play "DieStart"; sound 0x2b3 Death Destroy Skulls.wav; 3 orbit scythes 951.41.1 at + pos, velocity 0, spawner Death: SetColor(Color(0.8,0.8,0.8,1; 0; -0.1,-0.1,-0.1), -1, 255, no fade, share) and a + black 8-tick fade-in, flags &= ~4, EntityCollisionClass 0 (they never touch the player), TargetPosition = (60, 120 i + - 90) (orbit radius 60, angle -90 / 30 / 150 deg), Update, RenderZOffset 1000; StateFrame 1. + A = clamp((60 - StateFrame) / 60). While StateFrame > 0: StateFrame += dt; at > 60: state 0x10, + EntityCollisionClass 0, invisible, V2 = (0.5, 0.5), I1 0, StateFrame 0. +- **0x10 darkness swings** (I1 = swings done, V2.x = darkness now, V2.y = darkness goal): `F *= 0.8`. Game darkness + request: Game+0x2651c = V2.x, Game+0x26514 = 300 (re-armed each tick; the product with Game+0x26518 darkens the + backdrop, beast.md). V2.x moves toward V2.y by at most 0.02 s. A = -StateFrame / 10 if StateFrame < 1 else + (StateFrame - 30) / 30, clamped 0..1. + Once per dt tick, StateFrame++, then: + - == 30 (appear): visible, EntityCollisionClass 4, Play "SwingPrepareLoop", sound 0x2b5 Death Scythe Swipe Windup + 1.wav, pos = (P.x + (FlipX ? -280 : 280) * (I1 == 0 ? 1.8 : 1), P.y + Pv.y * 15), velocity 0. + - == 60 (first swing) / 52 (later): Play "Swing" (unless already), sound 0x2b6 Death Scythe Swipe 1.wav. + - == 0 (a swing just ended): I1++, invisible, EntityCollisionClass 0. I1 < 4: FlipX toggled (next from the other + side); the count goes on. I1 == 4: Game+0x2651c = V2.x, Game+0x26514 = 30 (darkness fades out); pos = (FlipX 0: + BR.x + 200, else TL.x - 200; mid height), velocity 0, state 7, visible, collision 4, V1 = (FlipX 0 ? -1 : 1, 0), C + = 0.1; every 951.42 spawned by Death removed; stop. + - On Shoot (Swing frame 9): V2.y = min(V2.y + 0.2, 1); sounds 0xfc shell game 0.wav (pitch 0.8) and 0x1fa + tooth_and_nail_01.wav; ShakeScreen(4); StateFrame -10; V1 = (FlipX ? 18 : -18, 0). + - Hit (visible and the "Hit" null capsule active): every entity in its query with EntityCollisionClass != 0, + GridCollisionClass != 4, not Death, whose collision capsule touches it: `v += normalize(them - Death) * 10`; + TakeDamage(2.0 for players and familiars, 35.0 for anything else; flags 0; source Death; countdown 30). This is + the attack's only damage (every frame the null is active). + - StateFrame < -5 (the first 5 ticks after Shoot): `v += V1 * s`, V1 *= 0.8 (timescale-adjusted). + - StateFrame > 0 and visible (homing from 30 to the swing): b = 1 - clamp((StateFrame - 40) / 20); target point = + P + Pv * 15 b + (FlipX ? -20 : 20, 0); v = (target - pos) * 0.09 b, y halved, |v| <= 30 (set, not added). +- **end of every phase-0 tick**: + - state 10 with StateFrame >= 1: Every(3) while A > 0: dark smoke 1000.59 at pos + size * sqrt(rnd) * rv + (visual). Then (state 10 with StateFrame >= 1, state 0x10, or state 7 while Game+0x26518 > 0.5): Every(2) a black + smoke 1000.59 at Room::GetRandomPosition(0), RenderZOffset 1000 (visual). + - Layer alpha: layers 0..3 = A; layers 4+ (glow) = min(2A, 1) * Game+0x26518 * Game+0x2651c. + - Not state 9: if 0x2d9 is playing, its ambient volume -= 0.05. + - `_dead`: if Game+0x26518 > 0: Game+0x2651c = Game+0x26518, Game+0x26514 = 30; Kill every entity of type 10..999 + whose SpawnerEntity is Death; stop sound 0x2d9. + +## Ultra Death Scythe (NpcAI::ENTITY_BEAST_ultra_death_scythe 0x443e50, 951.41) + +entities2: HP 100, radius 26, mass 300, contact damage 1. anm2 951.041_ultra death scythe.anm2: Rotate, Rotate1..6, all +10-frame loops (default Rotate); the AI uses Rotate3-6. + +- **phases 2 and 4** (subtype 1 only: `+0xf18 = 10`): phase 4 and not dead and (no SpawnerEntity or it is dead): + Kill. Otherwise its trail: position = pos + posOffset, alpha = min(frame * 0.05, 1). +- **0 init**: state 3, StateFrame 15; SetAnimation("Rotate3") at a random frame; flags |= 0x44010001, high |= 0x2400 + (NO_REWARD, NO_PLAYER_CONTROL); posOffset (0, -18); V1 = pos (its orbit centre). Subtype 1: `+0xf18 = 10`; a + 1000.166 trail (spawner the scythe), colour (0,0,0,0.75), MinRadius = MaxRadius = 0.11, sprite scale 6, Parent the + scythe. +- **3, subtype 0 (thrown from the room edge)**: StateFrame > 0: StateFrame -= dt; `F *= 0.8`; reaching < 1: + SetAnimation("Rotate3") keeping the frame, `+0x14c` = 0.01, F = 1.0. StateFrame < 1: `v += TargetPosition * 0.2 * + s` (straight back across the room at 0.2-0.24 a tick^2, no friction), `+0x14c = clamp(|v| / 10)` (a visual factor). + Removed when outside the room by 200 (Room::IsPositionInRoom(pos, -200) false). It hurts by contact (damage 1). +- **3, subtype 1 (orbit, from SwingPrepare)**: TargetPosition = (r, theta deg). v = V1 + r (cos theta, sin theta) - pos, + clamped to length (0.15 frame)^2 (set as velocity). V2.x += 0.1 s; r += V2.x s; theta += min(V2.x, 1) * 8 s + (normalised). Anim Rotate3 / 4 / 5 / 6 for r < 100 / 200 / 300 / more (frame kept). Every(2) after frame 10: dust + 1000.59 (visual). After frame 30: every enemy within size + 40 = 66 (EntityList::QueryRadius partition 8) that is a + live 951.42: Kill. Removed at r > 1000. EntityCollisionClass 0 (set by Death): harmless to the player; it is the + skull-cutter. + +## Ultra Death Head (NpcAI::ENTITY_BEAST_ultra_death_head 0x444900, 951.42) + +entities2: HP 100, radius 40, mass 300, contact damage 1. anm2 951.042_ultra death head.anm2 (nulls OverlayEffect, +BloodGuide): Idle 20 loop · Idle_old 14 loop · DieStart 11 · DieLoop 4 loop. + +- Every tick, first: not dead and (no SpawnerEntity or it is dead): Kill (empty source), stop sound 0x2d9, return. +- **0 init**: state 3; V1 = normalize(velocity) (+-1, 0); flags |= 0x10000 (NO_BLOOD_SPLASH), high |= 0x2000; + invincible. +- **3 fly**: `F *= 0.8`; `v.x += V1.x * s` (from the spawn 40 down to about 4 a tick); v.y = 6 sin(frame * 0.05 + + TargetPosition.x) (set before friction); FlipX = V1.x > 0; Play "Idle". No off-screen removal; hurts by contact. +- **5 dying** (set by Death with "DieStart"): FlipX 0, EntityCollisionClass 3 (ENEMIES: no longer touches the player), + `F *= 0.7`; when DieStart finishes: Play "DieLoop". +- Killed by an orbit scythe, Death's last swing, or Death's death. When `_dead`: sound 0x50 V2/black_heart_burst.wav + (volume 0.8; pitch 1.5 / 0.5 for champion colour 18 / 19), MakeGroundPoof colour (0.2,0.2,0.2,1), + Game::start_poop_cloud_screen_effect (visual). + +## Ultra Death's dropped scythe (Entity_Effect::Update case 0x5e7cc9, 1000.199) + +anm2 1000.199_ultra death scythe.anm2: Spin 8 loop. Every tick `v.y += 0.7 s`; once falling (v.y > 0) and y > BR.y + +120: Remove. No collision, no damage: a visual thrown on Death's death (velocity (+-8, -13) from pos + (0, -60)). + +## Moveable fires spawned by War (NpcHelper::fireplace_moveable_update 0x6d0ec0, 33.10) + +Gameplay of the QuickBurst fires (NpcAI::ENTITY_FIREPLACE 0x6d18d0 hands variants 10/12/13 to the helper): with +SpawnerType 951 no friction is applied (spawned by anything else, `v *= 0.95` a tick), so War's fires keep their 5 / 3 +speed; Every(30) with a 1/4 chance they take 1 damage (DamageFlag 0x20000) from themselves; variant 10 Disappears once +Game+0x264f8 - its +0x328 exceeds 300 (180 with a grid collision class; War sets 0) (read as frames since spawn: +unconfirmed); the Disappear state 0x10 drains HP and removes +it when the clip ends. HP from War: 1.2 / 0.8 x MaxHP. Contact with the fire hurts the player through the normal +fireplace collision (not read here). anm2 033.010_movable fireplace.anm2: Appear 12 · Idle 12 loop · Disappear 17. + +## visual-only effects these AIs spawn + +1000.59 Dust Cloud (dust trails, fire plumes, smoke; fields set: Rotation +0x474 = 2 + 10 rnd, Timeout = LifeSpan, +sprite scale, colour, DepthOffset +0x358), 1000.1 Bomb Explosion (the sprite; damage is the separate BombDamage call), +1000.15.1 Poof01, 1000.166 Sprite Trail (Death's red trail and the orbit scythes' dark trails; case 0x5dbcfd), ground +poofs, gibs, the poop-cloud screen effect, bloom and the Room shockwave. + +## engine requirements + +- AI phases 0 / 1 / 3 / 4 as above, the death-clip-only phase 1, per-tick Friction reset to 1, `+0xb80` "ignore + contact" from phase 3. +- Ballistic thrown bomb (g = 1.2, vy0 -18, solve vx), BombDamage(pos, damage, radius, source) with the + BombExplosionEffects radius rule (Game::BombExplosionEffects 0x700060: damage <= 140: 75; 140 < damage < 175: 90; + >= 175: 105; times radiusMult), Safety Scissors. +- ProjectileParams fields used: Variant, Scale, FallingAccelModifier, Color, BulletFlags (NO_WALL_COLLIDE); projectile + FallingSpeed / FallingAccel writes. +- Entity_Laser::CalculateEndPoint against the room rect with a margin; named null offsets ("ShootPos", "Eye") and a null + capsule ("Hit") hit query; per-layer alpha; Game darkness (strength, duration, current factor); ambient-sound volume + ramps; Kill-all-by-spawner; layer-mask music.