Files
isaac-port/notes/entities/beast_famine_pestilence.md
T
2026-10-24 23:00:36 -04:00

38 KiB

Ultra Famine and Ultra Pestilence (Beast fight harbingers, 2026-10-24)

Per-tick port spec read from isaac-ng.exe v1.9.7.17 (decompile + asm/objdump for dropped arguments) plus the game's anm2 / entities2.xml / sounds.xml. The arena, the fight order and how the Beast brings each harbinger in are in beast.md; this file corrects two of its summary lines (see the end). Arena numbers used below: TL = (-49.23, 72.31), BR = (689.23, 487.69), lava line L = BR.y - 30 = 457.69, Room::GetCenterPos = (320, 280).

conventions (both bosses)

  • Tick order in Entity_NPC::Update (0x6c4b30): phase 0 (normal AI, +0xb74 = 0) -> phase 1 (+0xb74 = 1, only when +0xf18 & 1, also during the death clip) -> Entity::Update physics -> phase 4 (+0xf18 & 8). Phase 2 (Interpolate, +0xf18 & 2) and phase 3 (collision, +0xf18 & 4, HandleCollision asm 0x6cdad9) never run for these AIs: Famine and Pestilence set +0xf18 = 1, their flies/maggot/ball 1 or nothing.
  • Death clip: once _dead is set a boss gets state 0x12 and "Death" from Entity_NPC::Update (0x6c4b30, after the dispatch). In state 0x12/0x11 the phase-0 AI is not called (the branch at LAB_006c68c7 skips the dispatch), so code that tests _dead in phase 0 runs exactly once, on the first tick after the killing blow. The generic clip multiplies friction by 0.01 every tick before phase 1, plays Death (63 frames: BloodStart@1 BloodStop@56 Explosion@62), spawns blood gibs along the BloodGuide null between BloodStart and BloodStop (Entity_NPC::update_blood_guide_gibs 0x6d7520) and a 1000.2 blood explosion on Explosion: generic, visual.
  • Physics (Entity::Update 0x6aeb95): vel *= friction (speed-adjusted: f / (f + s - f s) when SpeedMultiplier s != 1), pos += vel * s, then friction (+0x36c) is reset to the base (+0x368 = entities2 friction 1). So "friction 0.8" in a state = this tick only, applied after the AI's velocity changes: v' = 0.8 (v + dv).
  • Clock: +0x3a4 is a float accumulator (+= SpeedMultiplier each Entity::Update, +0x3a0 = its previous value); t below = +0x3a4, ticks = int(+0x3a4) - int(+0x3a0) (1 normally, 0 or 2 when slowed / sped up). "Every N" via int(prev / -N) != int(now / -N) is skipped when FLAG_INTERPOLATION_UPDATE (0x4000) is set or the game is paused. Entity::GetIntervalTicks(n, 0) (0x6ac760) = true once every n ticks.
  • RNG: Rnd = Random() / 2^32 in [0, 1); RandomVector = MusicManager::RandomVector 0x67f070 (random unit vector, its own draws); draw order is given where it matters. ProjectileParams() (0x43ef30) itself draws one Random() (CircleAngle = pi Rnd); defaults: HeightModifier 0, FallingSpeedModifier 0, FallingAccelModifier 0, VelocityMulti 1, Scale 1, HomingStrength 1, CurvingStrength 0.005, Acceleration 1.01, Spread 1, Color identity, BulletFlags 0, DotProductLimit -1000, ChangeTimeout 30, Variant 0.
  • Anims: Play(X) = ANM2::Play(X, false) (0x40a380) or its inlined copy: SetAnimation(X) + Rewind unless X is already current and (X does not loop or it is playing). So a finished non-looping X is not restarted and a call every tick is harmless. "finished" = current anim null or _isPlaying (+0x8c) false; "looping" = the current anim's Loop flag (anim+0x34, AnimationState::IsLoopingAnimation). Event names are anm2 triggers; IsEventTriggered = on its frame, WasEventTriggered = at or after it in the current clip. The sprites face left; FlipX = face right.
  • Sounds: SoundEffects::Play(id, volume 1, delay 2, loop false, pitch 1, pan 0) or Entity_NPC::PlaySound(id, 1, 2, false, 1) unless noted. Names are the Lua SoundEffect enum, files from sounds.xml.
  • Projectiles: Entity_NPC::FireProjectiles(pos, vel, mode 0 = one shot, params) returns the projectile; its +0x414 is FallingSpeed and +0x418 FallingAccel (Lua EntityProjectile getters, ICF-named Entity_Tear::*). See "projectiles in this room" at the end for what those mean in the Beast arena.

Ultra Famine (NpcAI::ENTITY_BEAST_ultra_famine 0x444cc0, 951.10)

entities2: HP 2000, mass 500, radius 70, shieldStrength 30, friction 1, no grid collision, gibs 40 (blood, huge). Spawned by the Beast at (880, 280) with no spawner: its state 0 runs inside the spawn call, then the Beast sets state 99. Fields: hover anchor A = +0x418/+0x41c, drift D = +0x420/+0x424, retarget timer T = +0x43c.

anm2 951.010_ultra famine.anm2 (30 fps; nulls BloodGuide, OverlayEffect): Idle 64 loop; DashStart 30 Turn@5 Shoot@28; DashLoop 4 loop; DashEnd 13; Reverse 70 Shoot@23 Turn@42; Summon 32 loop; Transition 42 Shoot@18; HeadLoop 16 loop; Death 63 BloodStart@1 BloodStop@56 Explosion@62.

Sounds: 651 SOUND_FAMINE_APPEAR (famine/Famine appears from off screen 1/2.wav), 652 SOUND_FAMINE_DEATH_1 (famine/Famine_BodyDie1.wav), 653 SOUND_FAMINE_DEATH_2 (famine/Famine death.wav), 654 SOUND_FAMINE_DASH_START (Famine dash start 1/2.wav), 655 SOUND_FAMINE_DASH (Famine dashing 1/2.wav), 656 SOUND_FAMINE_SHOOT (Famine_SpitAttack1-3.wav), 657 SOUND_FAMINE_BURST (Famine_BurstAttack1-3.wav), 658 SOUND_FAMINE_GURGLE (famine/Famine_GurgleLoop.wav), 817 SOUND_FAMINE_GRUNT (Famine shoot 1-4.wav), 307 SOUND_GRROOWL (growl.wav), 178 SOUND_BLOODSHOOT (blood fire 1-4.wav), 153 SOUND_TEARS_FIRE (tear fire 4/5.wav).

Cycle: hover 90 ticks (3) -> DashStart: line up with the player, dash off-screen (8) -> five peek-in passes from a random side, each with a 25-shot spread (9) -> sweep across the screen dropping a fly every 10 ticks (10) -> 90 ticks off-screen -> dash back in and brake (7) -> hover. Below 33 % on a hit: the headless form (0x10) parks at the centre and fires pairs and rings forever.

phase 1 (pre-physics)

Only state 0x12 (death clip): friction 0.8, vel.y += 0.4 * speed (after the generic x0.01: v.y' = 0.8 (v.y + 0.4), terminal 1.6 down a tick: it sinks ~100 units into the lava during the 63-frame Death). Nothing else in phase 1.

every phase-0 tick, before the state switch

  • Transition when all of: state != 0x10, health < 0.33 * MaxHP (strict), pending damage this tick (Entity +0x14, the sum of the queued damage entries at +0x8, reset by Entity::Update) > 0, and Room::IsPositionInRoom(pos, 0). So it triggers on the first hit that lands below 33 %, from any state, but only while on screen. Then: spawn_gibs (0x6b31b0, its entities2 gibs; visual); sound 652; Game::ShakeScreen(10); pos.y -= 40 (the head pops up); state 0x10; Play("Transition"). Then over every room entity: projectiles (type 9) _dead = 1 (all of them, anyone's); every alive NPC (type 10..999, or a player when Game+0x26614 > 1) with SpawnerType 951: vtable Kill (slot 9) with an EntityRef to Famine. That kills every 951.11 fly (Famine has no spawner, so it survives).
  • else, if _dead (once, see conventions): SFXManager::Stop(658) and sound 653.

states

  • 0 init: state 3; TargetPosition = A = pos; D = RandomVector scaled (1, 0.5); +0xf18 = 1; flags |= FLAG_NO_KNOCKBACK | FLAG_NO_PHYSICS_KNOCKBACK (0x44000000); T = 0; StateFrame 0; music: the current track slot's layer mask (Manager+0x2a12c + slot * 0x184) = 0 (track 45 "Boss (Beast)", base layer only).
  • 99 dash in (set by the Beast after the spawn): sound 651; state 7; visible; EntityCollisionClass 4 (ALL); Play("DashLoop"); vel = (FlipX ? 40 : -40, 0) (FlipX is 0: -40); I1 = 0. Continues as state 7 next tick.
  • 3 hover (shared code with Pestilence's hover, different constants):
    1. Play("Idle"); friction 0.8; vel += D * 0.55 * speed (D from last tick; |D| <= 1, terminal speed 2.2).
    2. P = GetPlayerTarget. T < 1: T = 20 + Random() % 20; side = +100 if P.x <= pos.x else -100; f = 0.01 + 0.003 Rnd; A = (P.x + side + 100 sin(t * f), P.y) + 20 RandomVector (it hovers on its own side of the player, swaying +-100). Else T -= ticks.
    3. Steer, if A != pos: rot = sin(t * 0.01) * 30 degrees; d = A - pos; D += (d.x cos rot - d.y sin rot, d.x sin rot + d.y cos rot) * 0.001 * speed.
    4. Keep-in: x < TL.x + 80 (30.77) or x > BR.x - 80 (609.23): D.x += (edge - x) * 0.001; y < TL.y + 100 (172.31) or y > BR.y - 100 (387.69): D.y += (edge - y) * 0.001. |D| > 1 -> D normalised.
    5. StateFrame += ticks; StateFrame >= 90: sound 654, Play("DashStart"), state 8 (StateFrame not reset).
  • 8 DashStart -> dash off-screen: friction 0.8.
    • DashStart finished: sound 655, Play("DashLoop") (once; DashLoop loops).
    • event Turn (DashStart f5): FlipX = pos.x < P.x (face the player).
    • event Shoot (DashStart f28): PlaySound 656 and 817; vel.y = 0 (no projectile).
    • before Shoot (current clip not looping and !WasEventTriggered("Shoot")): D.y += (P.y - pos.y) * 0.003; vel += D * 0.3 * speed (homes onto the player's row; terminal ~1.2 per unit of D).
    • from Shoot on and in DashLoop: vel.x = clamp(vel.x + (FlipX ? 8 : -8) * speed, -30, 30) (24 a tick after the friction); vel.y only decays. Every 2 ticks a dust puff (see effects).
    • exit: facing left and pos.x < TL.x - 180 (-229.23), or right and pos.x > BR.x + 180 (869.23): V1 = (0, 0), state 9, I1 = 5.
  • 9 peek-in passes (I1 = passes left), friction 0.8 every tick:
    1. V1 == (0, 0) (new pass): V1.x = Random() & 1 ? -1 : +1 (the side it enters from); if (D.x < 0) == (V1.x < 0) redraw once (so 3/4 of passes come from the other side than the last exit); y = TL.y + 80 + (BR.y - TL.y - 160) Rnd ([152.31, 407.69]); V1.y = y; pos = (V1.x >= 0 ? BR.x + 200 : TL.x - 200, y) (889.23 / -249.23); vel = (-40 V1.x, 0); D = (-10 V1.x, 0); SetAnimation("DashLoop", true) + Rewind (forced restart); FlipX = V1.x < 0.
    2. vel += D * speed; |vel| > 40 -> resized to 40.
    3. DashLoop (looping clip): once inside the edge by 40 (V1.x < 0 and pos.x > TL.x - 160 = -209.23, or V1.x > 0 and pos.x < BR.x + 160 = 849.23): Play("Reverse"), D *= 0.5. That is 2 ticks after the entry; it then coasts in (~110 units onto the screen, to x ~580 / ~60) while braking.
    4. Reverse (not looping): event Shoot (f23): PlaySound 656 and 817; S = (pos.x + (FlipX ? 20 : -20), pos.y - 50); MakeBloodCloud(S, tint (1, 1, 1, 0.8), scale 1) (1000.16.5, visual); ProjectileParams() with Scale 1.5; aim = unit(P - S); for k = -2..2 (aim rotated by 30 k degrees) and j = 0..4: FireProjectiles(S, dir * (10 - 2 j), mode 0); FallingSpeed 0, FallingAccel -0.1. = 25 shots: 5 rays (-60..60 degrees) x speeds 10, 8, 6, 4, 2. Before event Turn (f42): D *= 0.8 and stop for this tick. From Turn on: D.x = clamp(D.x + V1.x * 0.3 * speed, -10, 10) (backs out the side it came in). Leaving (pos.x < TL.x - 180 or > BR.x + 180): V1 = (0, 0), I1--; I1 < 1: state 10, Play("Summon"), V1 = (0, 2 pi Rnd), FlipX = Random() & 1.
  • 10 summon sweep:
    • visible: from = BR.x + 120 (809.23), to = TL.x - 120 (-169.23), swapped when FlipX. A.x = from + (to - from) * V1.x / 240 (not clamped); A.y = TL.y - 80 + (BR.y - TL.y + 160) * clamp((sin(0.1 V1.x + V1.y) + 1) / 2, 0, 1) (a 62.8-tick sine from 80 above the top to 80 below the bottom). V1.x == 0: pos = A, vel = 0 (snap to the start). friction 0.8; vel += (A - pos) * 0.01 * speed (a soft spring: it lags ~100 units behind A and the sine is damped). Past to (facing left: pos.x < to; right: pos.x > to): invisible, EntityCollisionClass 0, I1 = 90. Flies: once every 10 on the clock (n = int(prev / -10) - int(now / -10), skipped as in conventions), each: seed = Random(); sub = Random() % 3; a = 2 * 3.14 Rnd; r = 20 Rnd; SpawnEx(951, 11, (pos.x + r cos a, pos.y + r sin a + 0.2 (pos.y - 280)), vel 0, spawner Famine, sub, seed); its HitPoints (+0x380) = 100 (max stays 10); its Update is called at once. V1.x += speed. (~25 flies per sweep.)
    • invisible: friction 0.8; I1 -= ticks; I1 < 1: state 7, visible, EntityCollisionClass 4, Play("DashLoop"), sound 651; pos.x = FlipX ? TL.x - 200 : BR.x + 200; pos.y = TL.y + (BR.y - TL.y) (0.3 + 0.4 Rnd) ([196.9, 363.1]); vel = (FlipX ? 40 : -40, 0); I1 = 0. So it re-enters from the side opposite to where the sweep left.
  • 7 dash in and brake: friction 0.8.
    • I1 0, still outside the entry edge by 40 (facing left: pos.x > BR.x + 40 = 729.23; right: pos.x < TL.x - 40 = -89.23): vel.x = clamp(vel.x + (FlipX ? 10 : -10) * speed, -40, 40) (32 a tick); every 2 ticks a dust puff (Game::Spawn, same as state 8, see effects). Otherwise I1 = 1.
    • I1 1: friction 0.88; |vel| < 8: Play("DashEnd") (~11 ticks after the edge, ~175 units in).
    • current clip not looping (DashEnd): friction *= 0.9 (0.792).
    • clip finished (DashEnd done): Play("Idle"), StateFrame 0, state 3, A = pos, T = 0, D = vel * 0.1.
  • 0x10 headless:
    • not dead and 658 not playing: SFXManager::SetAmbientSound(658, 1, 1) (the gurgle loop; stopped on death).
    • event Shoot (Transition f18): FlipX = 0, PlaySound 307.
    • clip finished (Transition done): Play("HeadLoop"), StateFrame 0, V1 = (-90, -90) (degrees).
    • friction 0.8. HeadLoop, or Transition after its Shoot: `vel += clamp_length((280 room centre - pos) * 0.005, 1)
      • speed` (it settles at (320, 280)).
    • HeadLoop, ticks times: StateFrame++; if StateFrame % 8 == 0: V1.x = wrap180(V1.x + 26.96), V1.y = wrap180(V1.y
      • 30.48), then
      • StateFrame % 32 == 0, ring: o = 0 if StateFrame % 64 == 0 else 30 degrees; ProjectileParams() with BulletFlags WIGGLE (0x20); for i = 0..5, dir = (cos, sin)(60 i + o), for j = 0..5: Scale = 1 + 0.2 j; FireProjectiles(pos + 16 dir, dir * (8 + j), mode 0); WiggleFrameOffset (+0x448) = 10 j; FallingSpeed 0, FallingAccel -0.1. = 36 shots (6 rays x speeds 8..13, scale 1..2). Then MakeBloodCloud((pos.x, pos.y - 16), tint (1, 1, 1, 0.8), scale 1) with DepthOffset 100 (visual); PlaySound 178 at volume 1.2; sound 657.
      • else, pair: ProjectileParams() once; k = -1: angle V1.y - 25, speed 7, Scale 1; k = +1: angle V1.y + 25, speed 11, Scale 1.2 (Scale is set to 1.2 after the first shot); each FireProjectiles(pos + 30 dir, dir * speed, mode 0), FallingSpeed 0, FallingAccel -0.1. Two blood explosions 1000.2.4 and 1000.2.3 at pos (SpriteOffset (0, -16), tint (1, 1, 1, 0.8), DepthOffset 100) with velocity 6 (cos, sin)(V1.x) and 6 (cos, sin)(V2.x) (V2 is never set, so the second always goes right; visual only); PlaySound 153. So every 8 ticks: a pair whose centre turns by -30.48 degrees each time (starting near straight up), every 4th slot replaced by a 36-shot ring alternating 0 / 30 degree offsets. It never leaves this state until it dies.
  • 0x12 death: phase 1 sinking above; the generic boss death clip does the rest.

effects Famine spawns (all visual)

  • 1000.59 DUST_CLOUD (states 7 and 8, every 2 ticks): RNG seed = Random(), then Spawn(1000, 59, (pos.x, pos.y - 40), 2 RandomVector + 0.2 vel, spawner Famine, 0, seed); spin (+0x474) = 2 + 10 Rnd degrees a tick; Timeout = LifeSpan = 15 + Random() % 15; SetColor(tint (0.8, 0.68, 0.65, 0.6), duration -1, priority 255, no fadeout, shared); DepthOffset (+0x358) -5; SpriteScale (2, 2). Its Entity_Effect::Update case (jump table 0x606f8c[58] -> 0x5f4749) only spins, damps (friction 0.9) and fades it: no gameplay.
  • 1000.16.5 (Entity_NPC::MakeBloodCloud 0x6b6830: Spawn(1000, 16, pos, 0, npc, 5), SpriteScale = XMM2 = 1 here, the colour, random FlipX/FlipY), 1000.2.3 / 1000.2.4 (spawn_blood_explosion 0x6d7cf0: ECX = subtype, EDX = pos, args SpriteOffset, colour, velocity; Spawn(1000, 2, pos, vel, no spawner, subtype), SetColor(colour, -1, 255), DepthOffset 10 (Famine overrides 100)), gibs (spawn_gibs 0x6b31b0).

Ultra Famine Fly (NpcAI::ENTITY_BEAST_ultra_famine_fly 0x447180, 951.11)

entities2: HP 10, mass 10, radius 10, tag fly, collisionDamage 1. anm2 951.011: Idle / Idle2 / Idle3, 4 frames, loop, no events (subtype picks it through the table 0xb1d444 {Idle, Idle2, Idle3}; subtype >= 3 would read past it, never happens). No +0xf18: phase 0 only. Spawned only by Famine's sweep (HitPoints 100).

  • 0 init: Play(Idle / Idle2 / Idle3 by subtype); state 3; StateFrame 70.
  • 3 jitter-seek (StateFrame >= 1): friction *= 0.8 + 0.1 Rnd (so 0.8..0.9); g = CalcTargetPosition(0) - pos resized to length Rnd; rotated by (60 Rnd - 30) degrees; vel += g_rot * speed (RNG order: friction, length, angle); above TL.y + 80 (y < 152.31): vel.y += (TL.y + 80 - pos.y) * 0.4 * speed (kept out of the top band); StateFrame -= ticks. StateFrame < 1: state 8, StateFrame 10.
  • 8 wind-up then dash: StateFrame >= 1: friction 0.8, StateFrame -= ticks; on reaching < 1 (the same tick): V1 = unit(CalcTargetPosition(0) - pos) * 6. StateFrame < 1: friction 0.86, vel += V1 * 0.4 * speed (terminal 14.7 a tick in a straight line; it never turns again).
  • every tick (all states): !Room::IsPositionInRoom(pos, -100) (more than 100 outside the bounds: x outside [-149.23, 789.23] or y outside [-27.69, 587.69]) -> Remove (vtable slot 10). HitPoints > MaxHitPoints (10): once every 15 on the clock hp = max(hp - 10, 10) (100 -> 10 in 135 ticks).
  • So each fly: 70 ticks of jittery drifting toward the player, 10 ticks braking, then a 14.7/tick dash at where the player was, leaving the screen. Famine's transition kills all of them.

Ultra Pestilence (NpcAI::ENTITY_BEAST_ultra_pestilence 0x4477b0, 951.20)

entities2: HP 1800, mass 500, radius 70, shieldStrength 30, friction 1, no grid collision, gibs 40 (blood, huge). anm2 951.020_ultra pestilence.anm2 (30 fps, also 951.22's sheet): Idle 64 loop; Spit 53 Shoot@27; MaggotAttack 60 Sound@13 Sound2@27 Shoot@46; MaggotBack 15 Sound@7; Transition 17; HeadlessIdle 64 loop; HeadlessSpit 60 Shoot@16; Death 63 BloodStart@1 BloodStop@56 Explosion@62; HorseSpit 25 Shoot@14; Maggot 4 loop; Ref 2 loop. Nulls BloodGuide, OverlayEffect, ShootPos. ShootPos at the frames used (anm2 px): Spit f27 (-8,-47), MaggotAttack/MaggotBack (-19,-52), HeadlessSpit (6,-35), HorseSpit (-65,25). Entity::GetNullOffset (0x6b6af0) turns that into world units as px / 0.65 * SpriteScale, x negated when FlipX: Spit (-12.3,-72.3), MaggotAttack (-29.2,-80), HeadlessSpit (9.2,-53.8), HorseSpit (-100,38.5) for an unflipped (left-facing) sprite. The sprite faces left; FlipX = face right.

Notes (see the shared conventions at the top): "face target" = FlipX = pos.x < target.x (GetPlayerTarget). "champ pitch" = 1.5 for champion colour 18, 0.5 for 19, 1 otherwise (the horsemen are never champions here). Spawned by the Beast with no spawner (Beast 0x592460 Game::Spawn(951, 20, (880,280), 0, NULL, ...)): its first Update runs state 0, then the Beast overwrites state = 99. +0xf18 = 1: AI phases 0 (normal) and 1 (pre-physics, also during the death clip).

every phase-0 tick, before the state switch

  1. Transition check (only in states 3, 8, 9): health < MaxHP * 0.4 (40 %, not 33 %) -> spawn_gibs (0x6b31b0; its xml gibs, splat colour), Game::ShakeScreen(10), state 0x10, Play("Transition"), sounds 663 SOUND_PESTILENCE_HEAD_DEATH (Pestilence head dies.wav, champ pitch) and 668 SOUND_PESTILENCE_HEAD_EXPLODE (Pestilence_HeadExplode.wav, champ pitch); fly-ball threshold +0xc34 = MaxHP * 0.4. Then over every room entity: projectiles (type 9): ProjectileFlags (+0x438) = 0 and _dead = 1; effects 1000.141 (SMOKE_CLOUD): _dead = 1; NPCs (type 10..999, or players in co-op) alive with SpawnerType 951, except 951.21 flies: vtable Kill(EntityRef to Pestilence). That kills its maggot 951.22 and any 951.23 (Pestilence itself has no spawner, so it survives). No transition this tick and _dead set -> sound 664 SOUND_PESTILENCE_DEATH (Pestilence Death.wav), once (phase 0 is not called in the death clip).
  2. Fly trickle: n = 16 in state 0; otherwise n = int(prev / -30) - int(now / -30) on the +0x3a0/+0x3a4 clock (= 1 every 30 ticks; 0 when FLAG_INTERPOLATION_UPDATE (0x4000) is set or the game is paused). c = number of 951.21 in the room (any parent). Repeat n times, stopping once c > 23 (cap 24 flies): RNG order a = 23.14Rnd; seed = Random(); subtype = Random() % 3; s = 2 + 4 Rnd; d = 10 + 20 Rnd; SpawnEx(951, 21, pos + d (cos a, sin a), s (cos a, sin a), spawner = Pestilence, subtype, seed); HitPoints = 50 (max stays 10, see the fly); Parent = Pestilence; FLAG_APPEAR cleared; SetColor((1,1,1,0) tint, 15 ticks, priority 1, fadeout, shared) = fades in from transparent; SpriteScale = (0.8 + 0.4 Rnd) x (1,1); its Update is called at once (so its state 0 runs this tick). c++.

states

  • 0 init (runs inside the Beast's spawn call): Play("Idle"); sound 667 SOUND_PESTILENCE_APPEAR (Pestilence appear.wav); state 3; TargetPosition = pos; hover anchor A (+0x418) = pos; a = 23.14Rnd; drift D (+0x420) = (cos a, 0.5 sin a); retarget timer T (+0x43c) = 0; SplatColor (+0x1e4) = Color(tint 1,1,1,1; colorize 0.63,0.85, 0.32,1; offset 0) (0xc34e80, green; the field order tint/colorize/offset is assumed); flags |= FLAG_NO_KNOCKBACK | FLAG_NO_PHYSICS_KNOCKBACK (0x44000000); StateFrame 0; ProjectileCooldown 0; +0xf18 = 1; music (MusicManager current slot +0x2a12c) layer mask = 1 (bit 0; music 45 Boss (Beast) layers, see beast.md).
  • 99 dash in (from x = 880): Play("Idle"). I1 0: vel.x = clamp(vel.x - 2 speed, -15, 15) (friction stays 1); once pos.x < BR.x + 40 (729.23): I1 = 1. I1 1: friction 0.95; once |vel| < 8: state 3, I1 0. StateFrame is not touched.
  • 3 horse hover / 4 headless hover (shared code):
    • anim: Play("Idle") / Play("HeadlessIdle") only when the current clip has finished (so MaggotBack, played on it by the maggot, runs to its end).
    • friction 0.8; vel += D * 0.55 * speed (terminal speed ~2.75).
    • T < 1: T = 20 + Random() % 20; b = 23.14Rnd; r = 20 + 60 Rnd; A = Room::GetClampedPositionImpl(A + r (cos b, sin b), margins 60 all four sides) (0x812f50); else T -= ticks.
    • steer: if A != pos: rot = sin(t * 0.01) * 30 degrees (t = +0x3a4); D += rotate(A - pos, rot) * 0.001 * speed (rotate = standard CCW: x cos - y sin, x sin + y cos).
    • walls: x outside [TL.x + 180, BR.x - 180] = [130.77, 509.23] -> D.x += (edge - x) * 0.002; y outside [TL.y + 180, BR.y - 180] = [252.31, 307.69] (state 4: [252.31, TL.y + 260 = 332.31]) -> D.y += (edge - y) * 0.002. |D| > 1 -> D normalised.
    • StateFrame += ticks.
    • state 3 decisions: anim event "Sound" (MaggotBack f7) -> sound 29 SOUND_DEATH_REVERSE (death_reverse*.wav, champ pitch). If it has a Child (its maggot or fly ball) and StateFrame > 60 -> StateFrame = 60 (no attack while the maggot is out). StateFrame >= 90: ProjectileCooldown < 3 -> state 8, Play("Spit"), sound 673 SOUND_PESTILENCE_PUKE_START (Pestilence_PukeStart1-3.wav) (no facing yet); else state 9, Play("MaggotAttack"), ProjectileCooldown = 0, face target. So: Spit, Spit, Spit, MaggotAttack, repeat.
    • state 4 decisions: health < +0xc34 and StateFrame > 59 -> state 0xd, Play("HorseSpit"), face target, +0xc34 -= MaxHP * 0.2. Else StateFrame >= 120 -> state 7, Play("HeadlessSpit"), sounds 662 SOUND_PESTILENCE_BODY_SHOOT (Pestilence Body shoots.wav) and 672 SOUND_PESTILENCE_NECK_PUKE (Pestilence_NeckPuke.wav) at once, face target. +0xc34 starts at 0.4 MaxHP and the headless form starts below it, so a fly ball comes as soon as StateFrame > 59 (StateFrame is not reset by states 0x10 -> 4, so after a transition from 8/9 it is already >= 90: immediately); the second below 20 %; then +0xc34 = 0 and never again.
  • 8 Spit (friction 0.8): event Shoot (f27): sound 666 SOUND_PESTILENCE_BARF (Pestilence Spit Blob Barf_1/2.wav); P = pos + ShootPos; Entity_NPC::MakeBloodCloud(P, SplatColor * Color(1,1,1,0.8)) (1000.16.5 poof, scale 1, random flips: visual); face target. One shot, FireProjectiles(P, v, mode 0, params): ProjectileParams Scale 3, Color colorize (0.4, 2, 0.5, 1) (0xc34eac), BulletFlags EXPLODE | NO_WALL_COLLIDE (0x2002); after the call FallingSpeed (+0x414) = 0, FallingAccel (+0x418) = 1.0. v is a lob that lands on the player's x at the lava line with gravity 1/tick: dx = |target.x - P.x|, h = (BR.y - 30) - P.y, v.y = -20, v.x = sign(target.x - P.x) * (sqrt(2 dx^2 h + 400 dx^2) - 20 dx) / (2 h) (= dx / t with t = 20 + sqrt(400 + 2h)). Clip done: ProjectileCooldown++, Play("Idle"), state 3, StateFrame 0.
  • 9 MaggotAttack (friction 0.8): event Sound (f13): sounds 659 SOUND_PESTILENCE_MAGGOT_START (Pestilence Maggot Primes.wav) and 670 SOUND_PESTILENCE_MAGGOT_POPOUT (Pestilence_Maggot_Popout.wav). Event Shoot (f46): sounds 660 SOUND_PESTILENCE_MAGGOT_SHOOT (Pestilence Maggot Fires.wav) and 671 SOUND_PESTILENCE_MAGGOT_SHOOT2 (Pestilence_Maggot_Shoot.wav); P = pos + ShootPos; f = -10 facing left / +10 facing right; V1 = (-f/2, 0) (recoil); blood explosion 1000.2.3 at P, velocity (f/2, 0), green, RenderZOffset 500 (visual); SpawnEx(951, 22, P, (f, 0), spawner Pestilence, 0): its TargetPosition = (0.75 f, 0) (= its push), FLAG_APPEAR cleared, Parent = Pestilence and Pestilence's Child = it, Update called. Then 8 small maggots (853, debris, see below): a = 23.14Rnd, s = 3 Rnd, b = 23.14Rnd, r = Rnd; spawn_small_maggot(pos P + 6 r (cos b, sin b), vel (f + s cos a, s sin a), -8, height 0); EntityCollisionClass 0; mass (+0x37c) 15. While WasEventTriggered("Shoot") (frames 46..59): vel += V1 * speed, V1 *= 0.5 (speed-adjusted). Clip done: Play("Idle"), state 3, StateFrame 0.
  • 7 HeadlessSpit (friction 0.8): event Shoot (f16): StateFrame = 0. While WasEventTriggered("Shoot"), every tick (ticks times) while StateFrame <= 29: P = pos + ShootPos; ProjectileParams (built each tick) Scale 1 + 0.8 Rnd (drawn once per tick), Acceleration 0.96, Color colorize (1.5, 2, 1, 1) (0xc34ed8), BulletFlags NO_WALL_COLLIDE | HIT_ENEMIES | CHANGE_FLAGS_AFTER_TIMEOUT (0x1_00002080), ChangeFlags ACCELERATE | NO_WALL_COLLIDE | HIT_ENEMIES (0x8002080), ChangeTimeout 30; a = 23.14Rnd; v = (6 cos a + f, min(6 sin a - 16, -6)) with f = -5 facing left, +5 right; FireProjectiles(P, v, mode 0); FallingSpeed 0, FallingAccel 0.5. If StateFrame % 4 == 0: blood explosion 1000.2.2 at P, velocity v * 0.4, green. StateFrame++. = 30 shots in 30 ticks, an upward neck fountain that rains down. Clip done (60 frames): Play("HeadlessIdle"), state 4, StateFrame 0.
  • 0xd HorseSpit (friction 0.8): event Shoot (f14): sound 665 SOUND_PESTILENCE_COUGH (Pestilence Fly Cough*.wav); P = pos + ShootPos; f = -8 facing left / +8 right; SpawnEx(951, 23, P, (f, 3), spawner Pestilence, 0): FLAG_APPEAR cleared, Parent = Pestilence, Pestilence's Child = it, Update called. 4 dust puffs 1000.59 (DUST_CLOUD, visual): seed Random(); a = 23.14Rnd, r = Rnd: velocity (f + 1.5 r cos a, 3 + 1.5 r sin a); b, r2: position P + 10 r2 (cos b, sin b); spin (+0x474) = 2 + 10 Rnd deg/tick; Timeout = LifeSpan = 15 + Random() % 15; tint (0.7, 0.8, 0.65, 0.6); DepthOffset (+0x358) -5; SpriteScale (2, 2). Clip done: Play("HeadlessIdle"), state 4, StateFrame 0.
  • 0x10 Transition (friction 0.8): clip done -> Play("HeadlessIdle"), state 4 (StateFrame kept).

phase 1 (pre-physics, every tick)

Only state 0x12 (its death clip, "Death"): friction 0.8, vel.y += 0.4 * speed (it sinks into the lava). Event Explosion (f62): every projectile _dead = 1; every live NPC with SpawnerType 951 (flies included) Kill(EntityRef to Pestilence); 12 small maggots: a = 23.14Rnd, s = 8 + 10 Rnd, spawn_small_maggot(pos + 2 s (cos a, sin a), vel (s cos a, s sin a - 8 - 4 Rnd), -8, 0), EntityCollisionClass 0, mass 15, SpriteScale (1 + 0.5 Rnd) x (1,1).

small maggot debris (spawn_small_maggot 0x4d8b50 -> NpcAI::ENTITY_SMALL_MAGGOT 0x4d77b0, 853.0)

spawn_small_maggot(vel, v1x, height) (ECX = pos; the float height comes in XMM2 and is 0 at both call sites): Spawn(853, 0, pos, 0, no spawner), FLAG_APPEAR cleared, V1.x = -8, TargetPosition = velocity = vel, state 0x10, I1 1; in a type-16 room pos.y += height and vel.y += -8; Update; +0x418 = unit(vel); +0x43c = (seed xorshift) % 30 + 10. In the Beast room its state 0x10 (I1 1) has entity and grid collision 0, gains 0.7 * speed on vel.y a tick, plays "Bullet", and once falling below the lava line (BR.y - 30) it is removed with a lava splash 1000.16.66 (its own Beast-room check at the end of 0x4d77b0). So these are harmless falling gore.

Pestilence fly (NpcAI::ENTITY_BEAST_pestilence_fly 0x44a040, 951.21)

entities2: HP 10, mass 10, radius 10, tag fly. anm2 951.021: Idle/Idle2/Idle3, 4 frames, loop, no events. Pestilence's and the fly ball's free flies are given HitPoints 50 at spawn.

Phase 1 (pre-physics, every tick):

  • SpawnerEntity (+0x3c8) gone and !Room::IsPositionInRoom(pos, 0) -> Kill.
  • pos.y > BR.y - 30 (lava): vel *= 0.9; if (room+0 byte set and) (GameFrame - Room+0x11f0) % 8 == 0 (every 8 frames since room entry): TakeDamage(10, DAMAGE_FIRE (2), no source, countdown 30) and AddBurn(no source, 90 ticks, damage 0.0).
  • HitPoints > MaxHitPoints: every 15 ticks (GetIntervalTicks(15, 0)) hp = max(hp - 10, max): 50 -> 10 in 60 ticks.

Phase 0:

  • 0 init: Play(Idle / Idle2 / Idle3 by subtype 0/1/2; subtype >= 3 would index past the 3-entry table 0xb1d444); state 3; heading H (TargetPosition) = random unit vector (a = 23.14Rnd); RenderZOffset -1000; +0xf18 = 1; SplatColor green (0xc34e80). If Parent is a 951.23 fly ball: flags |= 0x11 (bit 0 and FLAG_NO_TARGET), state 0x10, EntityCollisionClass 0, invincible, RenderZOffset 0. Then (always) b = 23.14Rnd, V2 = pos + 40 (cos b, sin b).
  • 3 swarm: friction 0.8 (net: v = 0.8 v + push, the push is divided by friction before the physics multiply).
    • Parent (Pestilence) alive: k = clamp(dot(Parent.pos - pos, H) * 0.01, 1, 4); push = H * k * (0.5 + 0.5 Rnd) * speed; H += ((Parent.pos - pos) * 0.001 + RandomVector * 0.75) * speed. The swarm circles Pestilence, not the player.
    • no Parent: 1 in 16 (Random() & 15 == 0): V2 = pos + 40 RandomVector; k = clamp(dot(V2 - pos, H) * 0.005, 1, 2); push = H * k * Rnd * speed; H += ((V2 - pos) * 0.004 + RandomVector * 0.75) * speed.
    • lava: L = BR.y - 30; pos.y > L - 80 -> H.y -= 4 / max(10, L - pos.y); H normalised. (RandomVector = MusicManager::RandomVector 0x67f070, a random unit vector.)
  • 0x10 orbiting a fly ball: Parent gone -> layer 0 colour reset, flags &= ~0x11, state 3, EntityCollisionClass 4, not invincible, H = unit(velocity), V2 = pos + 40 RandomVector, RenderZOffset -1000, return. Else: an RNG seeded from its InitSeed (+0x3ec, shifts 5/9/7) gives the same RandomFloat every tick: V2.x = normalize_deg(V2.x + (8 RF - 4) * speed) (a constant per-fly spin of -4..+4 deg/tick); A = V1.x (cos V2.x, sin V2.x), B = V1.y (cos(V2.x + 90), sin(V2.x + 90)) (degrees); ph = StateFrame / 30 * 2pi (before the increment); StateFrame += ticks, wrapped to <= 30; friction 1; vel = Parent.pos + cos(ph) A + sin(ph) B - pos (snaps onto a 30-tick ellipse); its layer 0 colour = the ball's sprite colour (Parent+0xf0), so the ball's damage flash shows on them. Note the init above overwrites V2.x with pos.x + 40 cos b after the ball set it to Rnd * 360, so the start angle is that value in degrees.

Pestilence maggot (NpcAI::ENTITY_BEAST_ultra_pestilence_maggot 0x44b6f0, 951.22)

entities2: HP 0, mass 200, radius 18, collisionDamage 1; uses Pestilence's anm2 ("Maggot" 4 frames loop). No phase test and no +0xf18: phase 0 only. Pass counter = ProjectileCooldown (+0xba0), lane y = V2.y, push = TargetPosition (set by Pestilence to (+-7.5, 0)).

  • 0 init: Play("Maggot"), state 3, RenderZOffset 400, V2 = (0, 0).
  • 3 every tick: V2.y == 0 -> V2.y = pos.y. friction 0.8; v = 0.8 v + T * speed (terminal |v.x| 37.5). FlipX = T.x > 0. Pass 3: T.x moves toward V2.x by 0.26 * speed a tick (the U-turn: 7.5 -> -7.5 in ~58 ticks).
    • pass 6 and Parent alive: S = Parent.pos + Parent ShootPos; vel.y = (S.y - pos.y) * 0.1; once it reaches S.x (moving right: pos.x >= S.x; left: pos.x <= S.x): blood explosion 1000.2.2 at S, velocity -vel/2, green, DepthOffset 400; if Parent is in state 3 its sprite gets SetAnimation("MaggotBack") + Rewind (its Sound@7 then plays 29 through Pestilence); PlaySound 72 SOUND_MEAT_JUMPS (meat jumps*.wav); sounds 661 SOUND_PESTILENCE_MAGGOT_RETURN (Pestilence Maggot returns.wav) and 669 SOUND_PESTILENCE_MAGGOT_ENTER (Pestilence_Maggot_Enter.wav); Parent.vel += 2 T * Parent.speed; Remove.
    • otherwise vel.y = (V2.y - pos.y) * 0.5 (holds its lane).
    • exit: moving right (T.x >= 0) and pos.x > BR.x + 80, or left and pos.x < TL.x - 80: if pass >= 6 or no Parent -> Remove. y = the player target's y, or TL.y + 120 (192.31) when pass is 0 or 4; pass++; pass 6 with a Parent: y = Parent.y (+ its ShootPos.y if Parent IsEnemy). Re-enter at x = TL.x - 80 (moving right) / BR.x + 80 (left), pos = (x, y), V2.y = y; pass 3: V2.x = -T.x. Sequence: out of the mouth along its y; then the top lane (TL.y + 120); the player's row; the player's row with a U-turn back out the side it came in; the player's row; the top lane; then back along the mouth's row into the mouth. Pestilence holds its attacks (StateFrame clamp 60) while this Child exists; its transition kills it. HP 0 / damage handling: not read (unconfirmed whether it can be hurt).

Pestilence fly ball (NpcAI::ENTITY_BEAST_ultra_pestilence_fly_ball 0x44aad0, 951.23)

entities2: HP 200, mass 10, radius 28, tag fly; anm2 951.023 "Idle" 8 frames loop. Spawned by HorseSpit with velocity (+-8, 3). EntityPtr deque at +0xbf0 (its orbiters).

  • Phase 1 (every tick): lava exactly as the fly (vel * 0.9 below BR.y - 30; every 8 room frames TakeDamage(10, DAMAGE_FIRE, countdown 30) + AddBurn(90, 0)). Shell: n = max(0, floor(6 hp / max + 0.5)); while n < deque size: every orbiter in slots n.. gets Kill(EntityRef to the ball), slots cleared, deque resized to n (0x44bd80). So it keeps round(6 hp/max) orbiters (6 at full, the 6th lost below 183.3 HP, the last below 16.7). Release: m = max(0, ceil(14 hp / max)); if m < I1: I1-- and one free fly: a = 23.14Rnd, seed, subtype Random() % 3, s = 5 + 5 Rnd, d = 10 + 10 Rnd, SpawnEx(951, 21, pos + d (cos a, sin a), s (cos a, sin a), spawner ball, subtype, seed), HitPoints 50, Update (no Parent, so it wanders freely). At most one per tick: 14 over its HP.
  • 0 init (phase 0): deque resized to 6; for i = 0..5: seed, subtype Random() % 3, SpawnEx(951, 21, pos, 0, spawner ball, subtype, seed); r = 0.1 Rnd + 0.05 i + 0.2; its V1 = (40 r, 8 r) (ellipse radii, 8..22 by 1.6..4.4); its V2.x = 360 Rnd; its StateFrame = Random() % 30 (orbit phase); FLAG_APPEAR cleared; Parent = ball; deque[i] = it; Update (-> fly state 0x10). SplatColor green; Play("Idle"); +0xf18 = 1; EntityCollisionClass 2; state 3; V1 = unit(velocity) (or a random unit vector if 0; unused afterwards); I1 = 14.
  • 3 (phase 0): friction 0.8 and vel *= 1/0.85 first (speed-adjusted), so the net retention is 0.941; vel += unit(CalcTargetPosition(0) - pos) * 0.5 * Scale (+0xc38) * speed (through /friction; terminal ~8.5 at Scale 1). Mass (+0x37c) = 8. Separation from every other 951.23 within 100: vel += (pos - o) * (100 - d) / d * 0.003 * speed. Lava: pos.y > L - 80 -> vel.y += -10 / max(10, L - pos.y) * speed. No death code of its own; orbiters left at its death fall back to fly state 3.

effects these spawn

  • 1000.2 BLOOD_EXPLOSION subtypes 2/3 (spawn_blood_explosion 0x6d7cf0: Spawn(1000, 2, pos, vel, no spawner, subtype), SetColor(color, -1, 255), SpriteOffset 0, DepthOffset 10): visual.
  • 1000.16.5 POOF02 (Entity_NPC::MakeBloodCloud 0x6b6830, scale from XMM2 = 1.0 here, random FlipX/FlipY): visual.
  • 1000.59 DUST_CLOUD (Entity_Effect::Update variant table 0x606f8c[58] -> 0x5f4749): rotation += +0x474 a tick, friction 0.9, alpha/scale by Timeout/LifeSpan: visual.
  • 1000.16.66 lava splash (small maggots, and projectiles in Entity_Projectile::Update): visual.
  • Gibs (spawn_gibs 0x6b31b0): visual.

projectiles in this room (Entity_Projectile::Update 0x653070)

Shared by both bosses. Per tick the projectile integrates its height first (asm 0x65a25e: FallingSpeed = 0.9^s FallingSpeed + 0.1 s + FallingAccel s, Height += FallingSpeed s; it dies (_dead) once Height > -5, asm 0x65aaf3; FireProjectiles starts NPC shots at Height -23). Then, in a type-16 room (Room+8 == 16, 0x7ea190, flag read at 0x653bd2):

  • vel.y += FallingAccel * s when FallingAccel >= 0.001, else vel.y += 0.5 s while Height > -10, else nothing (asm 0x65a34a-0x65a376). FallingAccel is the gravity of the side-view arena.
  • Removed (vtable Remove) once outside the bounds widened by margins (-200 in XMM3, -600, -200, -200 on the stack to Room::GetClampedPositionImpl 0x812f50; which side gets 600 is unconfirmed) and still moving outward (dot(clamped - pos, vel) < 0) (asm 0x65a386-0x65a410).
  • In the Beast room (Room::IsBeastDungeon 0x8279a0), once older than 2 frames, falling (vel.y > 0) and below the lava line: an EXPLODE shot gets _dead = 1 (it bursts), any other is removed with splash 1000.16.66 (1000.16.67 for the Beast's variant 14) (asm 0x65a413-0x65a4d6). Outside the Beast room a type-16 room strips EXPLODE shots of GHOST and NO_WALL_COLLIDE (&= ~0x2010) at frame 1; the Beast room keeps them (asm 0x653c59-0x653c84).

Famine's shots all get FallingSpeed 0 and FallingAccel -0.1: FallingSpeed stays 0 (0.9 * 0 + 0.1 - 0.1), Height stays -23 (never dies of height) and, being <= -10 with FallingAccel < 0.001, they get no gravity: they fly in straight lines at their launch velocity until they leave the widened bounds (WIGGLE ones weave around that line).

Pestilence's shots (FallingAccel 0.5 / 1.0) do fall, which is what its Spit lob is computed for. Unconfirmed: read literally, the same height integration makes them die after ~9 ticks (Height -23 -> -5 with FallingAccel 0.5), which contradicts the lob landing on the lava line; nothing found skips it in this room (the jumps between 0x65a503 and 0x65aaf3 all land on the check). For the port, let them fly until the lava line or the widened bounds, and verify in game.

corrections to beast.md

  • Ultra Famine's headless form starts on the first hit below 33 % while on screen (pending damage > 0 and IsPositionInRoom); Ultra Pestilence's starts below 40 % and only from states 3, 8 and 9 (no hit needed).
  • The transition kill loop kills every NPC spawned by a 951 (SpawnerType 951) plus every projectile; Pestilence spares its 951.21 flies, Famine spares nothing.
  • Famine's states (beast.md: "7/8 horizontal dashes, 9 DashLoop + projectile bursts + Summon/Reverse, 10 summons"): 8 = DashStart and the dash off-screen, 9 = five peek-in passes (Reverse with a 25-shot spread), 10 = the Summon sweep that drops a fly every 10 ticks then 90 ticks off-screen, 7 = the dash back in and brake. The flies have one subtype-picked look each (Idle/Idle2/Idle3), no behaviour difference.
  • Pestilence's fly balls (state 0xd) come only in the headless form (at most two); flies trickle from Pestilence every 30 ticks throughout (cap 24), not only at the transition.