From 981b3e24e2ab9760dfbf3f4c05490130869dc470 Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 24 Oct 2026 22:52:01 -0400 Subject: [PATCH] notes: the Beast's fight, stalactites, rocks, souls, background riders --- notes/entities/beast_fight.md | 400 ++++++++++++++++++++++++++++++++++ 1 file changed, 400 insertions(+) create mode 100644 notes/entities/beast_fight.md diff --git a/notes/entities/beast_fight.md b/notes/entities/beast_fight.md new file mode 100644 index 0000000..ccbc2eb --- /dev/null +++ b/notes/entities/beast_fight.md @@ -0,0 +1,400 @@ +# The Beast's own fight: per-tick spec (2026-10-24) + +Read from isaac-ng.exe v1.9.7.17 (decompile plus `--asm` for every dropped argument and float) and the anm2/xml +resources. Arena, scroll mechanism, lava, bounds and the harbinger cast are in [beast.md](beast.md); this file adds the +numbers. Written for a 30 Hz port with 1:1 units, arena TL (-49.23, 72.31), BR (689.23, 487.69), lava line +`L = BR.y - 30` = 457.69, `S` = the boss-owned scroll speed (BeastArena +0x120 = Room+0x788c). + +Conventions: +- `u` = one `Random()` draw (global MT19937, 0x6eef60) as `uint / 2^32` in [0,1); `R` = the raw uint (used as spawn + seed or `R % n`). Draws are listed in call order. +- `n` = ticks advanced this update = `int(time +0x3a4) - int(prevTime +0x3a0)`: 1 at normal speed. Loops "n times" + below are 1 iteration for a port. +- Facing: `flip` = Entity+0x148 (FlipX). **Not flipped = faces left** (mouth at x - 60, runs make the world scroll right, + S > 0). Flipped faces right, mouth x + 60, S < 0. +- Phase = NPC +0xb74 when the AI is called: 0 normal update, 1 pre-physics (+0xf18 bit 1), 2 interpolation half-step + (bit 2), 3 collision callback, other entity at +0xb7c (bit 4), 4 post-physics (bit 8). (Bit-to-phase map inferred from + which phases each AI handles: Beast 0xf, stalactite 1, rock 4, soul 10.) +- ShakeScreen(k) = Game::ShakeScreen(k) (k pushed on the stack); "sound X" = played at volume 1, pitch 1 (frame delay 2) + unless stated. Sound table at the end. +- anm2 frames advance 1 per tick (AnimationState::Update 0x409030 adds PlaybackSpeed; the files' Fps 45/30 is unused). + "IsEvent(E)" fires on the tick the frame with E is reached; "WasEvent(E)" stays true from then to the clip's end. + +## The Beast (NpcAI::ENTITY_BEAST 0x592460, 951.0) + +entities2: HP 10000, radius 166 (Y x1.3), mass 1000, contact damage 1, no grid collision, shieldStrength 60. +State switch: jump table 0x5960c4 (states 0..16; 1, 2, 14, 15 = nothing; 12 = same code as 7, never set). +Fields used: I1 (+0xbc0) attack-cycle step / harbinger counter; I2 (+0xbc4) HP third at the last run start (2 = endless +run); V1 (+0xbb0/+0xbb4) per-state counters; ProjectileCooldown (+0xba0) blink timer; ProjectileDelay (+0xba4) +stored HP phase `p`; StateFrame (+0x410); TargetPosition (+0x334); SizeMulti (+0x374). + +### every phase-0 tick, before the state switch + +1. HP phase: `f = clamp(hp / maxHp, 0, 1)`, `p = int(2.999 - 2.999 f)` (0 above 66.66 %, 1 above 33.32 %, else 2); + when p == 2: `p = int(5.999 - 3.999 clamp(hp / (maxHp * 0.3333), 0, 1))` (2 down to 25 % of max, 3 below 25 %, 4 + below 16.7 %, 5 below 8.3 %). +2. If `p > ProjectileDelay` (stored phase): + - p >= 2 and stored < 2 (**TransitionDive**): sound 141 and 815; gibs (spawn_gibs flags 0x2001, count 10, spread 40) + at pos + (0, -120); play "TransitionDive"; state = 5. Every room entity: 951.1 and 951.3 get Kill (vtable +0x24, + source = the Beast); every projectile (9) or laser (7) whose SpawnerType is 951 gets `_dead` (+0x173) = 1. + - p >= 3: play "Damage1/2/3" for p = 3/4/5 (no state change; state 4 replaces it with MoveLoopDamageN when it ends); + sound 141; the same gibs; ShakeScreen(15); `S *= 0.8`. + - ProjectileDelay = p. (A jump over several phases does all of it in one tick.) +3. If `_dead` (death clip running): layer 9 ("ray") blend mode 2, layer 9 +0x28/+0x2c = 1, PlayOverlay("DeathRay"); + and the same kill sweep as TransitionDive (951.1/951.3 killed, 951-spawned projectiles/lasers `_dead`), every tick. + +### state 0: init (0x592dcb) + +TargetPosition = pos; +0xf18 = 0xf; I2 = 0; ProjectileDelay = 0; flags: clear FLAG_APPEAR, set FLAG_NO_KNOCKBACK | +FLAG_NO_PHYSICS_KNOCKBACK; ProjectileCooldown = `R % 60 + 30`; layer 9 +0x8c |= 1. +- Room variant 666 (the Beast room): "BGIdle" (loop), FLAG_DONT_COUNT_BOSS_HP, collision class 0, invisible (+0x171 = 0), + invincible (+0x3b0 = 1), state 0x10, StateFrame 30, `ENTITY_BEAST_spawn_background` (below). +- Other rooms (test room): "Idle", state 3, music layer 3 on. +- The TargetPosition stays the spawn position for the whole fight on y (no code writes target.y). By src/rooms' (x+1, + y+1) rule the stb spawn (11,4) is grid 87 = (520, 320); the Beast later surfaces at (480, 280) and drifts toward it + (unconfirmed which y the engine really spawns it at). + +### state 0x10: harbinger handover (0x592efd) + +Per tick, with StateFrame `sf`: +- `sf == 1000`: wait until the Beast has no Child (+0x3c0; the riding background NPC removed itself). Then (Room+0x12d0 + = 0) by I1: 0..3 spawn `951.(10, 20, 30, 40)[I1]` at `GetGridPosition(width*4 + 11) + (400, 0)` = (880, 280) + (spawner none, subtype 0, seed R), clear its FLAG_APPEAR, Update it once, its state = 99, SetChild(it), I1++, sf = 30. + I1 >= 4 (no spawn): **the Beast surfaces**: clear FLAG_DONT_COUNT_BOSS_HP, visible, collision class 0 (stays 0 until + the first MoveStart's Shoot), not invincible, I1 = 0, music layer 3 on, pos = (480, 280), state 7, "Surface", sound + 704, V1.y = -2, sf = 0. +- `sf <= 0`: if I1 > 0, PlayerManager::trigger_room_clear (0x9bb840) twice (two active-item charges). I1 < 4: background + slot I1 + 1 (Famine..Death) becomes the Child (slot cleared), its state = 4, "LeaveStart"; I1 >= 4: slot 0 (the + background Beast), state 4, "Leave". sf = 1000. +- else, only while there is no Child and `Room::GetAliveEnemiesCount() == 1`: sf -= n. +So: 30 ticks after the room is down to the Beast, a rider leaves; once it is gone the harbinger dashes in; 30 ticks after +it dies the next rider leaves; after Death, the background Beast plays Leave (130 frames) and then the Beast surfaces. + +### state 3: idle and attack choice (0x593291) + +- ProjectileCooldown -= n while > 0 (floor 0). +- sf <= 60: sf += n; when the clip is not playing (no anim, or AnimState +0x8c isPlaying == 0): cooldown < 1 -> "Blink" + and cooldown = `R % 60 + 30`, else "Idle". (So idle lasts 61 ticks from sf 0.) +- sf > 60, by I1 (then sf = 0): + - I1 0: "MoveStart", state 4, I1 = 1, I2 = p, ProjectileCooldown = `R % 20 + 30`, every 951.1 Removed (vtable +0x28, + no rocks), V1.x = 0. + - I1 1: `R % 3`: 0 "SuckStart" state 8; 1 "DoubleShot" state 10; 2 "SoulCall" state 13; I1 = 2. + - I1 2: I2 == 0 -> "MoveStart", sound 713, state 11 (charge); else "Dive", state 6. I1 = 0. + Cycle: run -> one of suck/double shot/soul call -> charge (first third) or dive (second third) -> run ... + +### state 4: run with stalactites (0x5934e1) + +Per tick: +- clip not playing -> "MoveLoop" (p 0..2), "MoveLoopDamage1/2/3" (p 3/4/5). +- ProjectileCooldown -= n while > 0 and the clip loops (no other use). +- IsEvent("Shoot") (MoveStart frame 17, TransitionSurface frame 37): collision class 4. +- WasEvent("Shoot") or the clip loops: `cap = 7` (7.5 if I2 == 2); not flipped `S = min(S + 0.2, cap)`, flipped + `S = max(S - 0.2, -cap)`; `V1.x -= |S|`; if V1.x <= 0 (stalactite due, x = TL.x - 100 - V1.x not flipped, BR.x + 100 + + V1.x flipped, i.e. the overshoot carried): + - `R % 3 == 0` and I2 != 2: a pair. `r = 60u - 30`; 951.1.0 (Top) at (x, TL.y - 55 + r) seed R; 951.1.1 (Bottom) at + (x, BR.y + 55 + r) seed R. + - else `R & 1 == 0`: 951.1.1 Bottom at (x, BR.y + 20 - 60u) (draws: seed R, then u); + else if I2 == 1 and `R & 1 == 0`: 951.1.2 TopCracked at (x, TL.y - 20 + 60u); + else 951.1.0 Top at (x, TL.y - 20 + 60u). + - All spawned with velocity 0, spawner the Beast, then Updated once. `V1.x += 150 + 60u` (I2 1 or 2) or `200 + 60u`. +- `sf % 60 == 0`: sound 816. +- I2 != 2 and sf > 239: state 3, "MoveEnd", sf = 0 (240 ticks of run). Else sf += n. I2 == 2 never ends. + +### states 5 / 6: TransitionDive / Dive (0x595072) + +- IsEvent("Shoot") (TransitionDive 23, Dive 19): collision class 0. +- Clip finished: V1 = (60, 0). + - state 6 (Dive): state 7; Lava Spawner 1000.181.2 at (TL.x + 20 + u (BR.x - TL.x - 40), BR.y) (draws: seed R, then u), + spawner the Beast, Timeout (+0x45c) = LifeSpan (+0x460) = 60, Updated; Room::RaiseGridPathAtPos(its pos, 900); + target.x = TL.x + 120 (not flipped) / BR.x - 120 (flipped); flip toggled. + - state 5: "TransitionSurface", V1.y = -1, sf = 0, target.x = pos.x = TL.x + 120 / BR.x - 120 (teleport), state 4, + flip toggled, I1 = 0, **I2 = 2**, V1.x = 120 (first stalactite after 120 units scrolled). + +### states 7 / 12: under the lava, eruptions, Surface (0x59529b) + +V1.y >= 0 (submerged sequence; V1.x = countdown, V1.y = eruption count): +- V1.y == 0: ShakeScreen(int((60 - V1.x) * 0.125)) (0 rising to 7 over the first 60 ticks). +- n times: V1.x -= 1; if V1.x <= 0: V1.y += 1, V1.x = max(30 - 2 V1.y, 12); then V1.y == 30: V1.x = 60 (no spawn); + V1.y == 31: "Surface", V1.y = -1, sf = 0; else a Lava Spawner: candidate x = TL.x + 20 + u (BR.x - TL.x - 40), y = + BR.y - 20, then up to 20 retries keeping the candidate with the lowest Room grid-path mark; spawn 1000.181.2 there + (seed R, spawner the Beast), Timeout = LifeSpan = 30, Updated, RaiseGridPathAtPos(pos, 900). + Note: y = BR.y - 20 is grid row 9 of a 15x9 room, so Room::GetGridPathFromPos returns 0 and RaiseGridPathAtPos does + nothing (0x812c10 / 0x4cdd80 bound checks): the retry loop exits at once and every x is a single uniform draw. +- Timeline from the dive end: 1 spawner then (60 ticks) eruptions k = 1..29 at t = 60, 88, 114, 138, 160, 180, 198, + 214, 228, 240, then every 12 to 468; Surface at t = 540. Each spawner erupts 30 ticks after it appears (60 for the + first). + +V1.y < 0 (Surface clip, 65 frames): +- IsEvent("Shoot") (frame 35): V1.y == -2 (first surfacing): sound 712. Else: sound 706, collision class 4, 8 lava balls: + ProjectileParams (defaults) Variant 14, +0x98 = 1; for i = 0..7: `a = (50u - 100)` deg (up, +-25 deg), `v = (cos a, + sin a) * (10 + i)`, x mirrored when not flipped (`v.x = -v.x`), Scale = 0.8 + 0.2u (draw after the angle), position + `(pos.x + 3 v.x, L + 3 v.y)`, FireProjectiles(mode 0); the projectile's SubType (+0x30) = 1. Both cases ShakeScreen(14). +- Clip finished: "Idle". sf += n; sf > 90: state 3 with sf = 45 if V1.y == -2 (shorter first idle) else 0. + +### state 8: suck (0x5939e0) + +- Ambient: `v = SFXManager::GetAmbientSoundVolume(705)`; 0 < v < 1 -> SetAmbientSound(705, v + 0.05). +- "SuckStart" playing and IsEvent("Shoot") (frame 38): sound 710, SetAmbientSound(705, 0.05). +- Clip finished -> "SuckLoop". +- n times: + - If WasEvent("Shoot") or the clip loops (i.e. from SuckStart frame 38 on): ShakeScreen(4); mouth `M = pos + (flip ? + 60 : -60, 0)`; + - `sf % 3 == 0`: attract ring 1000.151.0 at (pos.x - (flip ? -800 : 800), pos.y), no spawner, seed R, posOffset (0, + -24), TargetPosition = M, Updated (visual). + - `sf % 6 == 0`: every live 951.1 (QuerySublist 951.1, any subtype) with x > TL.x - 100 (not flipped) / x < BR.x + 100 + (flipped): TakeDamage(`(1 - 0.8 clamp((d - 500) / 1500)) * (14 + 14u)`, flags 0, source the Beast, countdown 30), + d = distance Beast - stalactite. + - `sf > 20 and sf % 30 == 0` (so sf 60, 90 .. 360): a converging fire fan. `k = R % 20`, `c = 2k - 20`; for angle + `a = -90, -88 .. 58` deg with `j = a - c`, only `|j| >= 10` (a 20-degree gap centred on c): 9.2 (purple fire + projectile) at `M + (580 cos a * (flip ? 1 : -1), 580 sin a)`, velocity 0, spawner the Beast, seed R; +0x414 + FallingSpeed 0, +0x418 FallingAccel -0.1, +0x42c Acceleration 0.95, ProjectileFlags ACCELERATE; with `m = |j| - 10`, + `t = (m / 2) % 4`: t 1 or 3 add CHANGE_FLAGS_AFTER_TIMEOUT, ChangeFlags ACCELERATE | FADEOUT, ChangeTimeout 30; t 2 + the same with ChangeTimeout 60; t 0 nothing more. Each Updated. (They only move by the pull below.) + - `sf` even: attract trail 1000.151.1 at M, posOffset (0, -24), seed R (visual). + - The pull, over every entity of the room list (Room+0x125c) except itself, kept if: projectile 9, tear 2, bomb 4, + player 1, effect 1000.66 with SortingLayer 2 (embers), rock 951.2, pickup 5 with +0x534 == 0 that is not an empty + chest (IsChest and SubType 0 excluded); and pos != M and Friction (+0x36c) != 0 and `d2 = |M - pos|^2 < 1.96e6` + (d < 1400). `u = (M - pos) / d`; strength `F`: 400 if (Game+0x26614 >= 2, i.e. co-op, and a player) or an NPC type + 10..999 (this catches 951.2) or a bomb; 300 tears and projectiles; else 160 (solo player, pickups, embers). + `k = d < 8 ? d / 64 : 1 / d`; tears and projectiles `k *= min(age / 30, 1)` (age = +0x3a4). `pull = F k / Friction`. + - tear: `velocity *= max(1 - 20k, 0.4)`; if it has TEAR_ORBIT and |v|^2 < 1 the flag is cleared; `velocity.y += + max(-16k, -16) * speedMult`; not dead, `d2 < (0.6 * size)^2` (size = the Beast's +0x370) and age > 15 and not + TEAR_LUDOVICO -> Remove. + - projectile, rock: `velocity *= max(1 - 20k, 0.4)`; not dead, `d2 < (0.6 size)^2`, age > 15 -> Remove; rock only: + `velocity.y += max(-60k, -36) * speedMult`. + - ember: `velocity *= max(1 - 20k, 0.4)`; `d2 < (0.4 size)^2` -> Remove. + - all kept: `velocity += u * pull * speedMult`. + - `sf > 360`: sf = 0, "SuckEnd", state 9, sound 709, ambient 705 volume -0.05; stop. Else sf += 1. + +### state 9: the beam (0x594879) + +- Every tick: ambient 705 volume -0.05. +- Clip finished (SuckEnd, 43 frames): "BlastLoop", sound 698, `Entity_Laser::ShootAngle(13 /*BEAST*/, (pos.x, pos.y + + 20), angle flip ? 0 : 180, timeout 70, offset (0, -20), source the Beast)`; then every projectile (type 9) in the room + gets `_dead` = 1. No other laser field is written. +- WasEvent("Shoot") or looping: ShakeScreen(8). sf += n; sf > 90: sf = 0, state 3, "BlastEnd". (sf counts from SuckEnd's + start: ~47 ticks of BlastLoop; the laser's 70-tick timeout outlives it.) + +### state 10: DoubleShot (0x594a37) + +Clip 139 frames, Shoot 25, Sound 85. +- IsEvent("Shoot"): sound 711. +- From WasEvent("Shoot") on, n times (sf counts only here): mouth M as above; + - Sound not yet reached: `sf % 22 == 0 and sf < 70` (sf 0, 22, 44 = frames 25, 47, 69): 9 shots, ProjectileParams: + Variant 2, FallingAccelModifier -0.1, BulletFlags HIT_ENEMIES | CHANGE_FLAGS_AFTER_TIMEOUT | ACCELERATE_EX, ChangeFlags + HIT_ENEMIES, ChangeTimeout 12, Acceleration 0.7, +0x98 = 1; for i = -4..4: velocity `20 (d cos(18 i), d sin(18 i))` + deg with d = -1 not flipped / +1 flipped; FireProjectiles(M, v, mode 0). + - after Sound: `sf % 4 == 0 and 1000 <= sf < 1024` (6 fans, frames 86..106): 10 shots, ProjectileParams: Variant 0, + FallingAccelModifier -0.1, Scale 2.5, Color tint (1,1,1,1) offset (1, 0.3, 0) (0xc33d54..), BulletFlags HIT_ENEMIES, + +0x98 = 1; for i = -9, -7 .. 9: velocity `15 (d cos(9 i), d sin(9 i))`; after each shot `R & 1 == 0` -> a blood + explosion at M (velocity dir * (8 + 4u), variant 3 + (~R & 1)) (visual). + - sf += 1. +- IsEvent("Sound"): sf = 1000. Clip finished: sf = 0, state 3. + +### state 11: charge across (0x594ef9) + +- sf == 0 (MoveStart then MoveLoopFast): IsEvent("Shoot") (frame 17): target.x = TL.x - 100 (not flipped) / BR.x + 100; + SizeMulti.y *= 0.8. When WasEvent("Shoot") or looping and `|target.x - pos.x| < 80`: sf = 1, "MoveEndTurn". MoveStart + finished: "MoveLoopFast". +- sf == 1 (MoveEndTurn, Shoot 9): IsEvent("Shoot"): SizeMulti = the config's (+0x330 -> +0x3c/+0x40); target.x = TL.x + + 120 / BR.x - 120. Finished: flip toggled, "Idle", state 3, sf = 0. +- Movement is the kinematic step below with cap 15 (I2 == 0 here, no doubling). + +### state 13: SoulCall (0x595846) + +Clip 79 frames: Roar 8, Shoot 38, Sound 67. +- IsEvent("Roar"): sound 707. IsEvent("Shoot"): sound 702. +- WasEvent("Shoot") and not WasEvent("Sound") (frames 38..66): ShakeScreen(4); n times: + - sf even: the stalactite damage of state 8 (same formula, countdown 30). + - `sf % 8 == 0` (sf 0, 8, 16, 24: 4 souls): 951.3.0 at (TL.x + 50 + u (BR.x - TL.x - 100), BR.y - 20) (seed R first), + spawner the Beast, Updated. + - sf even: shockwave ring 1000.151.10 at pos (spawner the Beast, seed R): posOffset (0, -14), SetColor((1, 0.2, 0.2, + 1), -1, 255), MinRadius (+0x454) 10, MaxRadius (+0x458) 150, Timeout = LifeSpan = 36; then `b = 360u`; 3 trails + 1000.151.11: same pos/offset/colour, rotation (+0xec) `b + 120 i + (60u - 30)`, Timeout = LifeSpan = 18, MinRadius 10, + MaxRadius `(0.15 + 0.15u) * 500`, layer 0 +0x38 = 0.6 + 0.4u (visual). + - sf += 1. +- Clip finished: state 3, sf = 0. + +### state 0x12: death clip (phase 1, while the engine plays "Death") + +Camera focus ring buffer pushed once (Room+0x11f8 camera, +0x8c flag). Every tick `S *= 0.95`. Events: Sound1 (frame 1) +sound 697; Sound2 (19) sound 731; Sound3 (33) sound 732; from Sound3 on ShakeScreen(10) every tick; Shoot (65) +BossOverlay::play(4) (Whiteout). (BloodStart 34 / BloodStop 95 are not read here.) The DeathRay overlay comes from the +`_dead` block above. + +### phase-0 epilogue (every state) + +- `_dead` or state not 8/9: SFXManager::Stop(705) (the suction loop). +- state not 4 and not 0x10: `S = max(S - 0.05, 0)`. **As read, a negative S (flipped run) snaps to 0 at once**, a + positive one decays 0.05 a tick (140 ticks from 7). Port it as written or decide. + +### phases 4 and 2: kinematic movement (0x595f22) + +If TargetPosition != (0, 0): `g = (target - pos) * 0.06`; I2 > 0: `g *= 2` and cap 12, else cap 8; state 11: cap 15; +`|g| > cap` -> resized to cap; phase 2 halves it; `pos += g`; velocity = 0. Phase 4 runs after physics each tick, phase 2 +on the interpolation half-step, so a 30 Hz port applies the full step then a half step (each from the new gap). The +BeastArena slide also moves the Beast itself by S (or S x 0.1 if its SortingLayer is 0), so while S != 0 it lags its +target by about S / 0.09 (S / 0.18 with I2 > 0). + +### phase 3: collision callback + +Other entity 951.1 with SubType != 3 (not a cracked base): its state = 5, its V2 = (-S, -8), ShakeScreen(10), `S *= 0.9`. ++0xb80 = 0 in every 951.1 case (the collision result; presumably "no physical push"). + +### anm2 951.000_beast.anm2 (Fps 45 unused) + +Idle 22, Blink 22, MoveStart 49 (Shoot 17), MoveLoop 23 loop, MoveLoopFast 15 loop, MoveEnd 25 (Shoot 9, unread), +MoveEndTurn 25 (Shoot 9), SoulCall 79 (Roar 8, Shoot 38, Sound 67), SuckStart 71 (Shoot 38), SuckLoop 27 loop, +SuckEnd 43 (Sound 18, unread), BlastLoop 14 loop, BlastEnd 38 (Shoot 25, unread), Dive 32 (Shoot 19), Surface 65 +(Shoot 35), DoubleShot 139 (Shoot 25, Sound 85), TransitionDive 33 (Sound 5 unread, Shoot 23), TransitionSurface 84 +(Shoot 37), Damage1/2/3 23, MoveLoopDamage1/2/3 23 loop, Death 98 (Sound1 1, Sound2 19, Sound3 33, BloodStart 34, Shoot +65, BloodStop 95), DeathRay 98 (overlay). "BGIdle" is played but not in this file (falls back). Layers 0 head .. 8 +horn_l, 9 ray (sheet 1); nulls BloodGuide, OverlayEffect. + +### sounds (sounds.xml id: name, sample) + +141 ROCKET_BLAST_DEATH (rocket blast death 1.wav), 697 BEAST_DEATH (beast/Beast Death 1), 698 BEAST_LASER (beast/Brimstone +Lazer Big x4), 699 BEAST_BACKGROUND_DIVE (Beast_DistantSplash), 702 BEAST_GHOST_RISE (Beast_GhostRise1-3), 701 +BEAST_GHOST_DASH (Beast_GhostDash1-4), 704 BEAST_LAVA_RISE (Beast_LavaSurface), 705 BEAST_SUCTION_LOOP (Beast_PullInLoop, +ambient), 706 BEAST_FIRE_BARF (Beast_Vocal_FireBarf1-4), 707 BEAST_GHOST_ROAR (Beast_Vocal_GhostAttackRoar1-3), 708 +BEAST_INTRO_SCREAM (Beast_Vocal_IntroScream), 709 BEAST_SUCTION_END (Beast_Vocal_PullInClose), 710 BEAST_SUCTION_START +(Beast_Vocal_PullInOpen), 711 BEAST_SPIT (Beast_Vocal_SpitAttack1-3), 712 BEAST_SURFACE_GROWL (Beast_Vocal_SurfaceGrowl), +713 BEAST_SWITCH_SIDES (Beast_Vocal_SwitchSide1-3), 731 BEAST_DEATH_2 (Beast Death 2), 732 BEAST_ANGELIC_BLAST (SFX +Brimstone Angelic Blast_1), 814 BEAST_LAVABALL_RISE (Beast_Lavaball_Rise1-6), 815 BEAST_GROWL (Beast_Vocal_AngryGrowl1-4), +816 BEAST_GRUMBLE (Beast_Vocal_Grumble1-7), 137 ROCK_CRUMBLE (rock crumble 0/2/3), 487 STONE_IMPACT (stone_impact1-3), +477 DEMON_HIT (demon_hit01/06/07/11). + +## spawn background (NpcAI::ENTITY_BEAST_spawn_background 0x592280, 951.0) + +Clears and resizes the Beast's 5-slot EntityPtr deque (+0xbf0). 951.100 at ((TL.x + BR.x) / 2, BR.y - 58) = (320, +429.69), spawner the Beast, seed R, Updated, slot 0. Then 951.101..104 at that position + (-150, -140), (-50, -200), +(50, -200), (150, -140) = (170, 289.69), (270, 229.69), (370, 229.69), (470, 289.69), seed R each, Updated, slots 1-4. + +## background riders (NpcAI::ENTITY_BEAST_background 0x440630, 951.100) + +951.100 Beast, 101 Famine, 102 Pestilence, 103 War, 104 Death; entities2 HP 1000, radius 0, contact 0. Phase 0 only. +- Every tick: `_dead` cleared (cannot die). At the end: Friction *= 0.8; colour = tint (c, c, c, 1), offsets 0, with + `c = 1 - Game+0x2651c * Game+0x26518 * 0.96` (the backdrop darkness). +- state 0: flags |= NO_STATUS_EFFECTS, NO_BLOOD_SPLASH, NO_DEATH_TRIGGER, NO_KNOCKBACK, NO_PHYSICS_KNOCKBACK, + DONT_COUNT_BOSS_HP, HIDE_HP_BAR, clear APPEAR; "Idle" (loop) unless already; collision 0, grid collision 0, + **SortingLayer 0** (so the arena slides them at S x 0.1: parallax), invincible; state 3. +- state 3: nothing (Idle loops). +- state 8 (cheer, set by Entity_NPC::on_player_damaged 0x6d6d20 when any player takes damage: 102-104 in state 3 get + state 8, StateFrame = `R % 15 + 2`): sf > 0: sf -= n, reaching < 1 -> "Cheer", sf = 0. sf == 0 and the clip ended: + "Idle", state 3. (Famine has no Cheer and is not chosen.) +- state 4, variant 100 (set by the Beast with "Leave", 130 frames): IsEvent("ScreamStart") (32) sound 708; IsEvent("Dive") + (78) sound 699; WasEvent("ScreamStart") and not WasEvent("ScreamStop") (frames 32..55): ShakeScreen(8) and every 2nd + tick (Entity::GetIntervalTicks(2, 0)) a red shockwave burst like SoulCall's at pos with posOffset (0, -80): ring + 1000.151.10 (MinRadius 10, MaxRadius 150, Timeout = LifeSpan 36, colour (1, 0.2, 0.2, 1)) and 3 trails 1000.151.11 + (rotation `b + 120 i + 60u - 30`, b = 360u, Timeout 18, MaxRadius (0.15 + 0.15u) * 500, layer 0 +0x38 0.6 + 0.4u). + Clip ended: Remove. +- state 4, 101-104 (set with "LeaveStart"): when the clip ends, "Leave" (loop). WasEvent("Shoot") (LeaveStart frame + Famine 30, Pestilence 30, War 43, Death 52) or looping: `velocity.x += V1.x * speedMult`, then V1.x: Famine/War + `max(V1.x - 0.8 sm, -8)`, Pestilence `max(V1.x - 0.4 sm, -5)`, Death `min(V1.x + 0.3 sm, 5)`; with the 0.8 friction + that tends to 4 x V1.x a tick. Removed once x < TL.x - 200 or x > BR.x + 200. +- anm2: 951.100 Idle 45 loop, Laugh 90, IsaacFirstRevived 84, IsaacRevived 71 (unused here), Leave 130 (ScreamStart 32, + ScreamStop 56, Dive 78). 101 Idle 26 loop, LeaveStart 34 (Shoot 30), Leave 10 loop. 102 Idle 31 loop, Cheer 32, + LeaveStart 31 (Shoot 30), Leave 14 loop. 103 Idle 20 loop, Cheer 32, LeaveStart 47 (Shoot 43), Leave 8 loop. 104 Idle + 20 loop, Cheer 27, LeaveStart 71 (Shoot 52), Leave 24 loop. + +## stalactite (NpcAI::ENTITY_BEAST_stalactite 0x596120, 951.1) + +entities2: HP 100, radius 220 with X x0.1, mass 1000, contact damage 1, no grid collision. +0xf18 = 1. +SubType: 0 Top, 1 Bottom, 2 TopCracked, 3 TopCrackedBase, 4 TopCrackedTip (anim table 0xb62284; posOffset.y table +0xb62298: -10, -10, -10, -10, -110). Every anm2 clip is 1 frame; nulls Hit0, Hit1, Hit2 (the burst capsules). +- Phase 1: if `pos.y + 60 > L`: Friction *= 0.5. SubType 4: nothing more. Else velocity = TargetPosition - pos (pinned; + BeastArena moves pos and TargetPosition by S). +- state 0: state 3; anim by SubType; flags |= NO_STATUS_EFFECTS, NO_TARGET, NO_BLOOD_SPLASH, NO_DEATH_TRIGGER, + NO_KNOCKBACK, NO_PHYSICS_KNOCKBACK, HIDE_HP_BAR, NO_REWARD, NO_PLAYER_CONTROL, clear APPEAR; posOffset.y from the table; + TargetPosition = pos. +- states 3 and 5: posOffset.x (hit wobble) `*= -0.8`, zeroed below 0.3. + - SubType 2 cracks by itself when `S > 0 and x > TL.x + 200` or `S < 0 and x < BR.x - 200`: crack (below). + - SubType 4: `velocity.y += 1.5 * speedMult` (falls; Friction 0.5 near the lava). + - state 5 (bumped by the Beast): state 3; SubType 0 or 2: crack, and the new tip is made invisible (+0x171 = 0), gets V2 + = this V2 and is Killed at once (source this) before its first Update, so its rocks fly with the Beast's (-S, -8); + other SubTypes (1 Bottom, 3 base, 4 tip): Kill self. + - crack: sound 137; SubType = 3, "TopCrackedBase", SetSize(config size, SizeMulti (x, y * 0.25)); tip 951.1.4 at pos + + (0, 100), velocity 0, no spawner, seed R, SetSize(config size, (x, y * 0.5)), FlipX copied, Updated. +- every phase-0 tick (also state 0): Entity +0x14 > 0 (recently hit; assumed the damage-flash timer): posOffset.x = -3 if + >= 0 else 3. +- Removed (vtable +0x28, no burst) when `S > 0 and x > BR.x + 200` or `S < 0 and x < TL.x - 200`. +- `_dead` (killed by damage, the Beast, the TransitionDive sweep): sounds 137 and 487, ShakeScreen(4); for each null + capsule (GetNullCapsule over the anm2 nulls; r = radius +0x20, L = half length +0x24) with r > 0, `count = ceil((L + + r) * r * 4 / 3800)` times: draws R, R, R (unused), R (seed), u1, u2, u3, u4, then rock 951.2 at the capsule centre, + spawner this, velocity `(cos(2*3.14 u1), sin(2*3.14 u1)) * 5 u2 + rot((40 u3 - 20) deg) V2 * (0.7 + 0.3 u4)`; its + +0xc38 (scale) = 0.8 + u, SpriteScale = scale * (+0x3b4) (* 1, 1), TargetPosition = (0.25, 0) (its gravity), Updated; + then dust 1000.59 at the centre (seed R), velocity `(cos 2*3.14u, sin 2*3.14u) * 5u`, posOffset = this, SpriteScale (1, + 1), +0x474 = 2 + 10u, Timeout = LifeSpan = `R % 15 + 15` (visual). + +## rock projectile (NpcAI::ENTITY_BEAST_rock_projectile 0x596c60, 951.2) + +entities2: HP 2.5, radius 5, mass 30, contact damage 1. +0xf18 = 4. +- Phase 3: other is a player (1) or familiar (3): `_dead` = 1. +- state 0: state 3; "Rotate%d" with `min(int(2 * scale + 1), 6)` (scale = +0xc38 from the stalactite, 0.8..1.8 -> + Rotate2..4; each 16 frames, loop); then +0xc38 = 1 and SpriteScale (1, 1) (so the size survives only in the clip + choice, if the spawner's immediate Update reaches state 0 first); flags NO_STATUS_EFFECTS, NO_TARGET, NO_BLOOD_SPLASH, + NO_KNOCKBACK, NO_PHYSICS_KNOCKBACK, HIDE_HP_BAR, NO_REWARD, NO_PLAYER_CONTROL; **entity collision class 0** (as read + this makes the phase-3 break unreachable and the rock harmless unless something restores the class: unconfirmed). +- else every tick: posOffset.y = -22; `velocity.y += TargetPosition.x (0.25) * speedMult`; Removed if outside x in [TL.x + - 200, BR.x + 200], y in [TL.y - 600, BR.y + 200] (Room::GetClampedPositionImpl margins); in the Beast room, older + than 2 frames, falling and below L: Removed with splash 1000.16 subtype 66 (no spawner). +- `_dead`: colour = own * (0.549, 0.482, 0.482, 1); rock poof 1000.145 at pos (spawner this, posOffset copied, SpriteScale + = scale, rotation 0); if inside the room (margin -20): sound 137 and `clamp(int((1 + 0.5u) * scale * 4), 1, 16)` rock + gibs 1000.35.1 at pos + dir * u * size with velocity dir * (1 + 2u) (dir from 360u), coloured (visual). + +## soul (NpcAI::ENTITY_BEAST_soul 0x5971e0, 951.3) + +entities2: HP 100, radius 8, mass 30, contact damage 1. +0xf18 = 10 (phases 2 and 4 = trail only). +- state 0: posOffset.y = -15; `a = 20u - 10` deg; dir = up rotated by a = (sin a, -cos a); V2 = dir, velocity = 10 dir; + "Idle" frame `RNG(InitSeed).RandomInt(4)` (static); invincible; V1.x = 1; flags NO_STATUS_EFFECTS, NO_TARGET, + NO_DEATH_TRIGGER, HIDE_HP_BAR, NO_PLAYER_CONTROL; state 3. +- state 3 (rise and sway): `V1.x -= 0.002 sm`; `w = velocity resized to V1.x^2`; `th = sin((0.4 + 0.1u) * time) * 90` deg + (time = +0x3a4); `v' = velocity + rot(th) w`, resized back to |velocity|; `f = max(V1.x, 0.95)` (timescale-corrected + when sm != 1: `f / (sm + f - sm f)`); velocity = v' f; |velocity|^2 > 1 -> V2 = normalized velocity. V1.x < 0.9 (after + 51 ticks): state 8, sound 701, Target = GetPlayerTarget, sf = 0. +- state 8 (homing): with a target: `velocity += 2 V2 sm`, capped at 20; sf < 40: `V2 += (target - pos) resized to min(0.25 + sf, 20) * sm`, V2 normalized. sf += n; sf > 60 (or no target): state 5. +- state 5 (burst): enemy ghost 1000.144.2 at pos (spawner this, seed R, rotation 360u, SpriteScale (1,1), vtable +0x40 + (SetCollisionDamage) 20, Updated; its Entity_Effect case 0x5d78ee only draws a fart-cloud "Explode"/"Poof_Large2" + burst); Game::DamageRadius(pos, source this, flags 0, damage 1.0 (XMM2), radius 60 (XMM3, passed through to + QueryRadius; inferred), 50 pushed): players and familiars in range take 1 (2 only when damage >= that 50), countdown 30; + NPCs are not hit; sound 477 at pitch 1.2 + 0.2u; Remove. +- Phases 4 and 2 (k = 1 / 0.5): the trail deque (+0xc08.. / +0xc1c..): each node += k * its velocity, velocity * 0.98 + (timescale), alpha - 0.1 floored; push (1.4, 0), a wobble vector (velocity at 8 rotated by sin(0.4 time) * 30 deg, + negated) and the render position; pop expired; sprite rotation (+0xec) = atan2(velocity) + 90 (visual). +- anm2: Idle 4 frames. + +## lava spawner (Entity_Effect::Update case 0x5e1f3a, 1000.181) + +Effect jump table 0x606f8c[variant - 1]. The Beast uses SubType 2; SubType 1 (War's bombs) and 0 (parent chains) are +other code. +- SubType 2, State (+0x450) 0, each tick: sprite colour channel = 1 - clamp(Timeout / LifeSpan) (fades in); + RaiseGridPathAtPos(pos, 900) (no-op in this room, see state 7). When its Timeout runs out (`_dead` set): sound 814; + **lava ball 9.14** at (x, Room::get_lava_line_y 0x8279c0 = L), velocity (0, -20), spawner = the effect's SpawnerEntity + (the Beast), subtype 0, seed R; ProjectileFlags NO_WALL_COLLIDE; FallingAccel (+0x418) 0.5; Updated. Then a 1000.1 + explosion visual at the same point (no spawner, State 1), ShakeScreen(6), "Disappear" (8 frames), State 1. State 1: + Removed when the clip ends. +- SubType 1: same eruption when the scroll carries it past its TargetPosition.x (S > 0 and x > target.x, or S < 0 and + x < target.x); its colour = 1 - clamp(|x - target.x| / 200). +- anm2 1000.181_lava spawner: Idle 1 loop, Disappear 8. +- 9.14 in Entity_Projectile::Update (0x653070): `_dead` cleared every tick (indestructible), embers while young; side-view + rule in type-16 rooms: `velocity.y += FallingAccel * sm` when FallingAccel >= 0.001 (so the ball rises 20 and falls back + at 0.5 a tick), else `+= 0.5 sm` while height > -10; in the Beast room, falling below L: removed with sound and splash + 1000.16 subtype 67 (66 for other projectiles). + +## rings (Entity_Effect::Update case 0x5d9ba9, 1000.151) + +No gameplay. SubType 10/11 (shockwave ring/trail): progress `t = time / LifeSpan`, `+0x478 = 1 - (t - 1)^2`, removed +at t >= 1; scale between MinRadius and MaxRadius, alpha and rotation from it. SubType 0/1 (attract ring/trail): the ring +moves toward TargetPosition with velocity `(target - pos) * min(time * 0.01, 1)`. DepthOffset (+0x358, Entity::DepthOffset 0x435d10) = 1000 every tick. +anm2: 1000.151_attract ring / attract trail, Idle 1 frame each (10 uses the ring, 11 the trail sheet). + +## engine requirements and open points + +- Spawned by the Beast fight: 951.1 (subtypes 0-4), 951.2, 951.3, 9.2 (fan, suck), 9.0 scale 2.5 (DoubleShot fans), 9.14 + (Surface, lava spawners), laser variant 13, effects 1000.181.2, 1000.151.0/1/10/11, 1000.144.2, 1000.145, 1000.59, + 1000.35.1, 1000.16.66/67, 1000.1, gibs, blood explosions. +- Unconfirmed: the y the Beast is spawned at (its TargetPosition.y for the whole fight); the rock's collision class 0 + (harmless as read); whether WasEventTriggered includes the event frame itself (shifts SoulCall's window by one tick); + DamageRadius taking radius 60 from XMM3; the meaning of ProjectileParams +0x98 (bool, set 1 by every Beast pattern); + the negative-S snap in the epilogue (read twice in the asm at 0x595efd, MAXSS against 0).