# brownie (402.0), Repentance AI 0048c3b0 (`./decompile.sh 0x0048c3b0`) I rewrote the attacks and phases for the base record and for colors.black. Art, death, death_burst, spawn_clip, shot_sounds and the existing sound cues are unchanged. **The patch needs two new anm2 events** (NEW_EVENTS = True at the top of the patch). Add them in both gfx/bosses/brownie/brownie.anm2 and brownie_black.anm2, animation SpinStart, frames counted from 1: - `Jump` at frame 10, the first Shoot frame (AtFrame 9). - `ShootEnd` at frame 21, the first frame after the last Shoot (AtFrame 20). This is the tick Repentance "lands". If you would rather not add them, set NEW_EVENTS = False. The lunge, spiral and creep then run to Land (frame 24) and there is no untouchable window. ## What the decompile does (M = max hp, s = hp / M) - **Idle (state 3):** friction *= .7 every tick. Nothing happens until stateFrame reaches 31. The idle face is Idle_Happy, Upset or Angry by the hp fraction inside the current 10% band (<.667 Upset, <.333 Angry). - **Threshold:** T = M - (k+1) * M/10, where k (i1 byte 1) counts the attack picks. - **hp > T (no new 10% lost):** - If s > .95 and it is being hit this tick (field_0x14 > 0): Fart (state 9). - Otherwise: on IsFrame(30, index), `rand&3==0` picks Spinning, state 4 or state 11 at 1/2 each. - **hp <= T (pick, k++):** `rand%100 < int(80 - 50s)` (halved when the last pick was 10) gives SpinStart (state 10) with `rand%10+3` restarts. Otherwise DashStart (state 8). - **State 10 (SpinStart, looped):** friction .7. - On entry it draws `i2 = rand%12` and `n = 3 + rand%3 + int(6(1-s))`. - On every Shoot frame (frames 10..20, counted from 1): - Velocity is pushed by 2.5 along a random heading. The heading reflects off walls. - It becomes intangible (collision class 0). - If `fmod(i2, 12/n) < 1` (asm 0048d536..0048d580), it fires one shot at angle `i2 * -30deg`, speed 10: FireProjectiles mode 0, variant 5 (corn), Scale 1.1, HeightModifier -35, FallingSpeedModifier +4. Then i2++. - The first non-Shoot frame after that is the landing: - Sound 72 plays. - Creep spawns at sprite scale 3: effect 94, slippery brown, or 26, black slowing, for subtype 1. - Every corn dip (217.x) in its query is removed and its hp is added to Brownie's. - It becomes tangible again and draws a new random heading. - Loop ends: when the restarts run out it returns to idle. - **State 8 (DashStart then Dashing):** - **DashStart:** friction .7. On Dash, a push of 2.5 toward Isaac and sound 301. - **Dashing (92 ticks):** it steers toward a random room spot, or toward the first dip (217) or charger alive in the room. - Steering speed is v2 = 5 + 5 rand, redrawn every 60 ticks. Each tick: `vel = lerp(vel, dir * v2, .2)`, then friction .88. That settles at .595 * v2. - On a wall it picks a new spot, shakes the screen (4) and makes a splat. - Every 8 ticks: creep at scale 3. - Every 20 ticks, 60% of the time: corn mine 295.0 at a random point within its size. - On IsFrame(30, 0), 1 in 5: a burst of `rand%5+3` aimed shots every 3 ticks. Each is speed 10 times (unit + .3 * random vector), Scale 1.1, variant 5, and each multiplies v2 by .95. - **States 4 and 11 (Spinning):** the same steering. State 11 halves v2, sets field_0x14c = 2 (probably CollisionDamage) and also drops the creep and mines. State 4 drops neither. - State 4 ends past 45 ticks, back on clip frame 0, which makes 57 ticks. State 11 ends at 47 ticks. - **End of Dashing or Spinning:** - 70%: a pick with the same odds, and k++. SpinStart then gets `rand%5+2` restarts. - 30%: Fart. - **State 9 (Fart):** friction .7. On Fart: ButterBeanFart radius 160 plus a fart (50). When the clip ends it goes back to idle, and k catches up to the hp without attacking. - **Every 2% of hp lost** (i1 byte 0), in any state, it spawns dips at a free spot (size + 5) moving 7 away from it: - 5 dips per step while s > .95, otherwise 1. - At most 15 alive, as 217.2 (brownie_corn). - Subtype 1 (black) spawns 1 charger (23) per step instead, at most 3 alive. - **s <= .25:** state 16, the Death clip. When it ends it Morphs into 261.1 (Dangle) with hp = max = .2M = 80. Subtype 1 instead spawns two 220.1 (dank squirt) at +(0,0) and +(0,10) and is removed. ## What changed | Attack | Data | Decompile | |---|---|---| | 0 SpinStart (idle pick) | `when [{hp_steps 10, chance p}]`, repeat limit 3 + limit_random 10, cooldown 31 | the 10% threshold pick, `rand%10+3` restarts, idle 31 | | 1 DashStart | `when [{hp_steps 10}]` (gets the pick when spin's chance fails), retention .7, impulse 2.5 on Dash | push 2.5 on Dash | | 2 Dashing | ticks 92, retention .704, lunge .88 + spread .88 (lunge_ticks 92), random heading, wall bounce | .595 * v2, v2 5..10 | | 3 Fart | hurt (with `hurt_tick: true`) + hp_share_above .95, release Fart, gas radius 160 (was 85), cooldown 31 | ButterBeanFart 160 | | 4/5 dips | hurt tick: above .95 count 5 one_in 3, below .95 count 1 one_in 2; cap 15 brownie_corn, spawn_offset 40 | 5 or 1 per 2% step, cap 15, size + 5 | | 6 Spinning (state 4) | period 30, one_in 4, pick_next 1 (half the time state 11), ticks 57, lunge .88 + .88, no creep/mines | IsFrame(30), rand&3, 1/2 | | 7 Spinning (state 11) | ticks 47, lunge .44 + .44, creep on Trail and Spawn (about every 7 ticks), corn mine spawn_most 1 | v2 halved, creep every 8, mines .6 per 20 ticks | | 8 SpinStart (after spin/dash) | repeat 2 + limit_random 5 | `rand%5+2` | - **Dash/spin exits:** next is a 20-entry list. 6 entries go to Fart (30%). The other 14 split between SpinStart (8) and DashStart (1) by p. - **Per-phase values:** each phase sets the idle pose, p, that split and the spiral step: - s >= .66: Happy, p .38, 5 SpinStart + 9 DashStart, every 3. - .33..66: Upset, p .55, 8 + 6, every 2. - .25..33: Angry, p .65, 9 + 5, every 2. - p is int(80 - 50s) at each band's middle. - **Phase gates:** the .66 and .33 phase changes now wait for the current attack to end (`idle`). Each gate also has an extra open gate for s < .25, so death still comes at once. - **SpinStart volley:** a spiral shot on Shoot until ShootEnd, every k frames with spread k * 30 degrees and fan [[1,0,0,1]]. It is speed 10, scale 1.1, fall_velocity 1 (-3 + FallingSpeedModifier 4), with the corn look. - k = 3 approximates n = 3..5 (4 shots a hop against Repentance's 3.7..4.6). k = 2 approximates n = 5..9 (6 against 5.5..7.3). - The angle step per shot is exactly Repentance's for n = 4 and n = 6. - It replaces the old single boss_volley. - **SpinStart movement and landing:** - Retention .7 (was .9). - Lunge 2.5 from Shoot to ShootEnd, random heading, wall bounce. - Untouchable from Jump to ShootEnd (collision class 0). - Landing creep on ShootEnd at scale 3. - **Dashing details:** - Creep on Trail at scale 3. - Corn mines on Spawn with spawn_most 3, about 2.8 per dash in Repentance. I removed the spawn_cap, which Repentance does not have. - One aimed corn shot per Spawn (every 11 ticks) with a shot gate one_in 3, speed 10, scale 1.1, fall_velocity -3. That averages about 2.8 shots per dash; Repentance averages about 3. It was an aimed speed 8 shot on every loop. - **Removed:** - DashEnd (Repentance never plays it). - The old period-6/4/3 one_in phases. - **Retention:** the behaviour's is now .7 (Rep idle friction). It was .85. - **Death:** become dangle health 80 (was 75; .2 * 400). For black, the extra dank_squirt now spawns at spawn_at [0, 10] instead of a random 30 offset. - **Black:** the same structure, with: - creep `slowing` instead of slippery (Repentance's effect 26 is black creep); - 1 charger per dip roll, cap 3. ## Open gaps (proposed generic features) 1. **`hp_steps` opens one step early.** The gate opens while `(1 - s) * n > begun`, so the first pick comes on the first hit. Repentance opens at `(1 - s) * n >= begun + 1` (s <= .9). - Proposal: gate `hp_steps_lag: 1`, subtracted from `(1 - s) * n`. - Also proposed: an attack flag `hp_step: true` on attacks reached by next, so they also count a step. Repentance's spin/dash-exit picks do k++, and so does the fart end's catch-up loop. 2. **Dips per hp step in any state.** - Proposal: behaviour `hp_spawn {share: .02, type, count: 1, count_above: {share: .95, count: 5}, cap: 15, offset: size + 5, speed: 7, sounds}`. Each time hp drops past another `share` of M, in any state, it spawns `count` (stopping once `cap` of type are alive), moving `speed` away from the actor plus a random unit vector. - For now it is two hurt-tick idle attacks, which are rarer than Repentance's and only happen while idle. 3. **Landing eats dips.** - Proposal: attack `absorb {type: brownie_corn, on: ShootEnd}`. On that event, every live actor of type is removed (no death) and its current hp is added to the actor's. - The `revive` field cannot do this: it turns the remains into another type and heals a fixed amount. 4. **Redraw a random heading on each repeat and hand-over.** - Proposal: `lunge_redraw: true`. Each repeat restart, and each hand-over into this attack, redraws the random lunge heading, as the attack start does. - Repentance draws a new heading at every SpinStart landing. Here a repeat keeps its heading, only bounced by walls. - Dashing reached from DashStart keeps DashStart's heading. For that reason DashStart is lunge_random, so its 2.5 impulse goes the same random way. Repentance aims that impulse at Isaac and then steers to a random spot. 5. **Steer to a spot or the first live dip.** - Proposal: attack `steer {speed: [5, 10], redraw: 60, lerp: .2, toward_type: brownie_corn, arrive: radius}`. It heads to a random room spot (a new one on arrival or a wall), or to the first live actor of toward_type, at a speed redrawn every 60 ticks. - Black's toward_type is charger. 6. **Random bursts.** - Proposal: `shots[].burst.one_in` and `burst.count_random`, rolled once when the burst would start. It would be paired with an attack-level clock: shot `period: 30` (room tick, not serial) to stand in for IsFrame(30, 0). Repentance: every 30 ticks, 1 in 5, a burst of 3..7 shots every 3 ticks. - A shot gate rolls on every burst tick, so the patch uses single gated shots. - The aim jitter is unit + .3 * random vector, which gives speed 7..13. The engine's aim_jitter is in pixels, so it is not ported. 7. **Spiral without the shooter's motion.** - Proposal: `shots[].still: true`, which drops the `+ velocity` term of the spiral kind. Repentance's mode 0 shot does not add Brownie's velocity, and it moves up to about 8 px a tick while shooting. - The spiral also starts at angle 0, not `rand%12 * 30` degrees. 8. **Idle face by band fraction.** Repentance shows Happy, Upset or Angry by `(hp - T) / (M / 10)`: how close the next pick is. - Proposal: `idle_poses_by_step: [[.333, Idle_Angry], [.667, Idle_Upset], [1, Idle_Happy]]`, read from the hp_steps counter. - The patch keeps overall-hp faces at .66 and .33. 9. **The halved odds after a SpinStart pick** (the remembered last pick, i2 byte 2 == 10) are not modelled. - Proposal: gate `last_attack_not: [0, 8]`, or `chance_after: {attack, share}`. 10. **Not ported:** - Projectile HeightModifier -35 on the SpinStart shots. - State 11's field_0x14c = 2, probably double contact damage. Proposal: attack `contact_damage`. - v2 being shared across states and shrinking by .95 per dash shot. - The landing and dip-spawn sounds (72, 237) and the Spinning start sound (420); the existing cues were kept. - Corn mines taking the boss colour. - The first SpinStart hop using a stale heading. 11. **The 60% mine chance is given as spawn_most.** Dashing gets 3, front-loaded; Spinning 11 gets 1. Proposal: `spawn_one_in` / `spawn_chance` per spawn event. ## brownie: gaps closed (rif/brownie, 2026-10-24). Changed All open gaps above are ported as generic fields; the record now has only the death phase. - **Friction.** Every push (SpinStart 2.5 per Shoot frame, DashStart 2.5 on Dash) is `vel += push * speedMul / friction` with friction (Entity+0x36c) already *.7 that tick, so the port's lunge/impulse is 2.5 / .7 = 3.5714. - **Absorb radius.** The landing query is `EntityList::QueryRadius(pos, size * 1.1)` (0048d700: xmm3 = Entity+0x370 * DAT_00baa490 1.1), so only dips within 38.5 px are eaten, any 217 variant. - **field_0x14c is not CollisionDamage** (that is Entity+0x388). 0x14c = sprite (Entity+0x48) + 0x104 = ANM2 PlaybackSpeed: state 11 plays Spinning at double speed, reset to 1 on exit. Visual only; not ported. - **Steering formula (0048e2xx).** `want = normalize(vel + .15 v2 (unit(target - pos) + unit(vel))) * v2`, `vel += (want - vel) * (1 - .8)` (the .8 adjusted by speedMultiplier when != 1), then friction .88. The "nearest dip" loop compares `dist < 0.0`, so it takes the first 217 (or 23 for black) in the list. - **Dash burst.** `IsFrame(30, 0)` is (game frame) % 30; arms i1 byte 3 = 3 + rand%5 with i2 = 0; fires on i2 % 3 == 0 from the next tick, stopping once (i2 + 1) / 3 >= count: count shots 3 ticks apart. Only in state 8. - **Sound ids** (sounds.xml by id): 72 meat jumps (landing, wall hit), 237 plop (each dip), 301 fart gurg (Dash), 420 BrownieLaugh (spin picks, Spinning/Dashing start). Laughs not ported (a cue would repeat on every clip loop). - **Not ported:** HeightModifier -35 on the spin shots, the launch offset cos(2 pi i2 / 12) * size along x, the wall shake/splat, mines' boss colour, the stale first hop heading, creep exactly every 8 ticks (the port uses the clip's Trail/Spawn events), dips' velocity scale (0x39c / 0x36c of the new dip). Port fields (isaac-classic MODDING.md): gate `hp_steps_lag`, `chance_hp`, `chance_after`; attack `hp_step`, `hp_steps_sync`, `next_roll`, `lunge_redraw`, `steer`, `spawn_period`, `spawn_chance`, `spawn_outward`, revive `absorb`; shot `burst.period/one_in/count/count_random`, `aim_scatter`, `still`, `wheel`; behaviour `hp_spawn`, `step_poses`.