# Items sweep 14: familiar AIs, room systems ## Bob's Brain (Entity_Familiar::ai_charger 0x6174c0 case 0x3b, HandleCollision 0x6261f0, 3.59) - ai_charger: subtype != 0 is the "gone" state: FollowParent, +0xd88 counts; past 300 a poof (1000.15) at subtype 1 and subtype +1 each tick; past 3 subtype 0, +0xd4c (cooldown) = 60 for 0x3b (0 for the others), Appear. Fired (state < 1) only while no other Bob's Brain is flung (QuerySublist of familiars: +0x172 set, +0xd4c < 0, subtype 0), speed 10, velocity aim * 10 + player velocity * 0.6 * 2 (the off-axis part dropped), at least 10; no FloatShoot (only 3, 0x68, 0xdf play those). Generic stop: grid hit or out of room -> DamageGridWithSource, velocity * .5, +0xd4c - 1 a tick, below -10 -> 30. - HandleCollision: variants 3/0x3b/0x68/0x19 with subtype 0 and +0xd4c < 0 touching a grid-ish thing halve velocity (same countdown). Variant 0x3b/0x3a with subtype 0 and Room::GetFrameCount > 0x14 touching an enemy: explosion damage (mult - 1) * 25 + 100 (mult = BFFS multiplier) via the player's bomb flags, Game::BombExplosionEffects at its pos, subtype 1; 0x3b also Entity::AddPoison(enemy, mult * 80 ticks, damage arg lost in XMM). ## Lost Fly (FamiliarAI::lost_fly 0x62e9c0, 3.85) - First tick: targetPosition = pos, +0xd88 = its grid index. friction * 0.6; pos = targetPosition; direction +0xd54 (0 left, 1 up, 2 right, 3 down: Isaac::GetAxisAlignedUnitVectorFromDir), step 3.0 (0xbaa6fc). - If gridIndex(pos + step) != +0xd88: blocked (GetGridCollision not 0/1) -> dir = (dir + 3) & 3, return (no move); else side = dir + 1: if gridIndex(pos + side*3 + step) is free and GetGridCollisionAtPos(pos + side*3) blocked -> dir = (dir + 1) & 3. velocity = step, targetPosition += step. - Every collision interval (GetIntervalTicks; entities2 interval 7): QueryRadius(pos, 160.0 [0xbaaa5c], enemies), vulnerable NPCs without flags 0x20000010 and in CheckLine(mode 3) sight -> Entity_NPC::TryForceTarget(fly, 90). ## Angry Fly (Entity_Familiar::update_angry_fly 0x633500, 3.118) - Target +0x3c4: drawn again when none, when it is the player and IsFrame(30), or when not a vulnerable enemy and IsFrame(150): a random room entity of type 10..999 (not 0x21 fire, 0x11 shopkeeper, 0x124; 0x375 only variant 10; 0x3c0/0x3c5 never; 0xf5 yes) not friendly (+0x173); none -> the player. - angle offset = index * 360 / n among familiars with the same target; radius 65; when the target is an enemy (vtable +0x4c) and game frame % 150 < 30: radius = |f / 30 - .5| * 2 * 65. angle = frame * 3.6 + offset (degrees); velocity = (target + (cos, sin) * r - pos) * 0.22, capped at 10. entities2: 2 contact damage, interval 2. - Neither Lost Fly (0x55) nor Angry Fly (0x76) is in Entity_Familiar::CanBlockProjectiles 0x60d8e0. ## Boiled Baby (Entity_Familiar::Update case 0xd0, 3.208) - FollowParent; FloatDown. Every apply_forgotten_lullaby(4) frames (IsFrame) with alive enemies: QueryRadius 80 (180 with flag 0x100) counts vulnerable enemies; Isaac::Random(enemies ? 5 : 20) == 0 -> Play("Spawn") (0xb1de50). - On Spawn's Shoot event (0xb1d2dc): sound 0xb2; Random(3) + 4 tears, damage apply_tear_modifiers * 3.5; each RandomVector * 10 * (0.7 + 0.2 r); Random(2): scale (0.9 + .05 r) * .8 at that damage, else (1.3 + .05 r) * .8 at 1.5x. Random fall speed/accel (not read). - 0x640ca0 (named ai_boiled_baby by an earlier DB guess) is NOT Boiled Baby: it is invisible at the player unless the player's list +0x150c holds (0, 0x37), fires every 0x2d, and picks targets (PickEnemyTarget 1000) with a Shoot anim. ## Lil Abaddon (Entity_Familiar::ai_incubus_shot 0x62d300 case 0xe6, asm only; Update cases 0x3d/0x6c/0xe6) - 0xe6: sound 0x1aa (pitch 1.1); Game::SpawnEx(7, 1, pos, 0, familiar, subtype 3 [ring following parent], seed): +0x34c/+0x350 parent offset (0, -20), +0x358 = 3000.0, +0x4e0 = tear modifiers * 0.5, vtable+0x40 = modifiers * 3.5 (its damage), +0x428 tear flags from 0xc34890, _timeout (+0x458) = 30; +0xdc0 keeps the laser; +0xd50 = 30. After any shot +0xd4c = apply_forgotten_lullaby(30) (the charge), decremented while +0xd50 <= 8. - 0x6c (Seraphim?) fires 0x60 - ... FireProjectile loop and +0xd50 = 20; others FireBrimstone 0x638c10. ## Bumbo (FamiliarAI::bumbo 0x62f7f0, TriggerRoomClear 0x62aab0, 3.88) - Level by +_coins: < 6 state 0 (Level1Float), 6.. state 1 (Level2, sound 0x34b), 12.. state 2 (Level3, 0x34c), 24.. state 3 (Level4, 0x34d, moved to a free spot, grid class 5 / entity class 4, collision damage 2.5). - Every 5 frames with no target: the nearest coin (5.20, not dying, no +0x534 owner) within 200 (40000 squared; Level 4 needs a path). Toward it +1.1 a tick (not Level 4); within 10 FUN_006b2ee0 (takes it). No coin: follows Isaac (80) or the follower ahead of it of variants 0x18/0x40/0x5a/0x58/0x66 (50) at +0.8 a tick, friction 0.8; Level 3 Shoot() (friction .2 while its head delay > 0). - Level 4: PickEnemyTarget(300, 0xd), FindGridPath .75 when farther than 20 (an enemy) / 4 (a pickup) / 80 (none); IsFrame(60) and Random & 3 == 0 within 50: a bomb Game::Spawn(4, 0) at velocity 5; friction .85; Level4Walking/Idle. - Drops: +_counter pending; within 80 of Isaac in state 1 or 3 it plays Level2Spawn/Level4Spawn, on the Spawn event a random pickup 5.0 (drop RNG), counter - 1. TriggerRoomClear case 0x58: state 1 only, RandomInt(100) (80 with BFFS) (x 4/3 for player 0x24) < 33 -> counter + 1. The Level 4 per-coin drop is elsewhere (not found). ## Red Key (Entity_Player::UseRedKey 0x5b2360, Level::MakeRedRoomDoor 0x74d010, FUN_0074cea0) - UseRedKey: the first of the room's 8 door outline effects (room +0x7744, 1000.154) within 120 (14400 squared) of the player -> MakeRedRoomDoor(current room index, slot). - MakeRedRoomDoor: get_door_neighbor_room; none -> fails. Off the 13x13 map (row < 0) -> if IsNextStageAvailable the slot's door leads to -2 (I AM ERROR). Else RNG (dungeonPlacementSeed + row * 0x3a1) * (col + 1); stage 13 (Home): RoomConfig::GetRandomRoom(stage 0x23, type 0xb? difficulty 10, subtype 0xb) (the tainted closet); else the type from FUN_0074cea0 and GetRandomRoom (1x1, required doors 15; libraries/devil/angel subtypes special-cased), place_room, flag 0x400 (red room), doors to every existing neighbour both ways; FUN_00827550 adds the door to the current room. - FUN_0074cea0: rand & 0x1ff walked over (weight, type): (2 devil 14) (2 angel 15) (3 secret 7) (3 super secret 8) (6 shop 2) (4 treasure 4) (2 planetarium 24 -> treasure 4 while not unlocked) (9 curse 10) (8 sacrifice 13) (5 arcade 9) (2 vault 20) (2 dice 21) (4 library 12) (2 Isaac's bedroom 18) (2 barren bedroom 19) (7 miniboss 6); past them 1 (normal). Angel becomes devil while game +0x26568 > 0. ## Member Card (Room::TrySpawnSecretShop 0x7f8190, GridEntity_Stairs::Update 0x99bd50) - In a shop (room type 2) with a Member Card (0x25a) owner, or off the map: grid index width + 10 (a 2x room: twice that). On the map: sound 0x394 and GridEntity_Stairs (grid 0x12, variant 2) there; off the map (the secret shop itself) a tall ladder effect 1000.156 (0x9c) back up. - GridEntity_Stairs::Update: Closed until the room is clear (Open Animation then state 1); the nearest player within 21 (state 1, not mid-jump) goes to room -4 (variant 0, crawl space), -11 (1, Gideon's crawl space), -13 (2, the secret shop) or the level's +0x182d0 room (3), StartRoomTransition(.., 2). - The secret shop rooms are 00.special rooms' shops of subtype 10 / 11 (rare good / rare bad, weights 0.25 / 0.1); crawl space subtypes 1-3 are Gideon's crawl space and Rotgut's two rooms. The Stairway's angel shop is the angel rooms of subtype 1 (variants 40-45, room -18); Genesis' bedroom is bedroom subtype 99 (variant 1000, room -12, Level::InitializeGenesisRoom 0x8e11b0). No HasCollectible(0x24a) (Stairway) site was found in the dump. ## D1 (UseActiveItem case 0x28 @0x5bd9ca) - Room pickups that Entity_Pickup::CanReroll and are not variant 100: one drawn (the player's collectible RNG); a chest (FUN_006ee330) copies as variant 60 or 50 at even odds; a card (300) of subtype > 0 as ItemPool::GetCard of its card type (runes, type 4, kept as they are); anything else subtype 0. Spawned at Room::FindFreePickupSpawnPosition beside it. ## D infinity (UseActiveItem case 0x35 @0x5bfad0, Entity_Player::pockets_rotate 0x7a42b0) - varData >> 16 indexes the die table at 0xb1f450: D1 476, D4 284, D6 105, Eternal D6 609, D7 437, D8 406, D10 285, D12 386, D20 166, D100 283 (used from outside its slot: a random one, RNG % 10). After UseActiveItem(die) its low 16 bits = that die's maxCharges, which GetCollectibleMaxCharge (0x7911f0) returns for 0x1e9. - pockets_rotate (the drop key): after the pockets turn, with D infinity in slot 0 (itemState 0) the index goes (i + 1) % 10, HUD refreshed; only on wrapping to 0 does SwapActiveItems (Schoolbag) run. ## Glowing Hourglass (UseActiveItem case 0x21 @0x5bd61f, GetCollectibleMaxCharge 0x7911f0) - varData (uses this floor) < 3: Level::EnterDoor + StartRoomTransition(GetPreviousRoomIndex) in its rewind mode; else TemporaryEffects::AddCollectibleEffect(0x42) (The Hourglass) with the room's time scale and music pitch slide. - GetCollectibleMaxCharge: 0x1a6 returns 0 while varData < 3 (no charge needed), its items.xml 2 after. ## Bone Spurs (the NPC death drop beside Entity_Pickup::Update 0x6bbdc0; HandleCollision variant 0xea) - RandomCollectibleOwner(0x2ab): unless the death list holds a 3.234 already, 1 bone (2 when maxHP > 8 and the seed's bit (s ^ s >> 6) >> 9 ^ .. & 1 is 0); each flung at a random angle at 5 (later ones 3-5) plus the corpse's velocity, from pos + v * .25, Game::Spawn(3, 0xea). Update case 0xea: friction lerped while its loop plays. - HandleCollision 0xea: an enemy touching pushes both ways (AddVelocity +-10 along player->enemy), state += 3; past 5 (two touches) it dies. It is in CanBlockProjectiles. ## Lil Dumpy (FamiliarAI::lil_dumpy 0x6468a0) - Follows (pulled (d - 10)/d * .2 toward 10 px from Isaac, speed-multiplier-adjusted friction .8); Idle/IdleFast/ IdleFaster by distance (40/80). While Isaac can be hurt and it is within 100: QueryRadius(10, 14 in greed) at his next place; an enemy (types 10..999 or 9 shots, collision damage > 0) whose capsule collides -> Game::ButterBeanFart( Isaac, 120, ...), fart effect 1000.34, velocity 20 away from the threat, state 1, cooldown 45; asleep until the cooldown is over and Isaac is within 50. Collision damage = clamp((speed - 10) / 30, 0, 1)^2 * 25 * tear modifiers. ## Mystery Egg (FamiliarAI::mystery_egg 0x638170) - On the Spawn/"Crack" event: tier by _roomClearCount (<1, <4, <7, <10, <13, else) and a table of entity types (0xb6475c 7, 0xb64724 14, 0xb64698 35, 0xb645e0 32, 0xb645b0 12, 0xb64778 6), RNG::RandomInt(drop RNG); SpawnEx variant 0, AddCharmed(-1: permanent), BFFS -> MakeChampion, max HP and HP x1.5, sound 0xed, BloodExplode, roomClear count 0; hidden once Crack ends. - Tables: 0: 13 18 217 85 21 231 77 | 1-3: 80 14 214 249 61 256 94 29 11 12 281 244 92 40 | 4-6: 220 246 228 215 206 240 255 289 16 22 205 288 54 10 284 226 26 248 229 208 211 15 23 32 89 27 53 38 24 279 280 58 243 305 234 | 7-9: 238 251 253 25 278 227 221 252 57 59 55 56 259 258 257 254 41 216 210 224 219 86 90 300 283 286 35 34 304 303 301 242 | 10-12: 87 88 230 204 60 276 213 225 282 209 277 91 | 13+: 285 237 223 306 241 39. ## The Swarm (Entity_Player::AddSwarmFlyOrbital 0x759bf0, TriggerRoomClear 0x7a8fd0) - AddSwarmFlyOrbital: the player's 3.229 familiars queued, the oldest removed while more than 15, then Game::Spawn(3, 0xe5). TriggerRoomClear adds one with 0x2b5; update_effects adds one every IsFrame(n) in greed mode. ## Samson's Chains (Entity_Familiar::ai_samsons_chains 0x62e120) - Pull toward the player: unit * (max(0, (d - 70) * .1) + max(0, (d - 100) * 1.6)) (x only in room type 0x10), velocity * .8836; other familiars within 20 push it (20 - d) * .1; past 120 it is put 120 from the player when that cell's GetGridCollision is 0, else its speed capped at 5. In CanBlockProjectiles; entities2 5 damage, interval 14. ## Jaw Bone (ai_charger, variant 0x82) - Thrown at 10 (Throw anim); flying it attaches the first pickup (variants 10, 20, 90, 40, 30, 70, 300, 350, 69, 41, 42 without an owner; a Mom's-box-ish 20.6 coin plays Touched instead) at +0x3c4, dragging it; grid hit, out of room or carrying -> velocity .5, state -2: velocity = unit(player - pos) * 10 until within 40 (1600 squared): cooldown 30, the pickup let go (collision class back).