import math, sys; sys.path.insert(0, '../../b5tools'); from rec import upsert; from snd import snd BONE = {"anm2": "gfx/projectiles/bone/bone.anm2", "animation": "Move"} PUKE = {"anm2": "gfx/projectiles/puke/puke.anm2", "animation": "RegularTear6"} def turn(deg): r = deg * math.pi / 180 return [round(math.cos(r), 4), round(math.sin(r), 4)] MIRROR = [-1, 0, 0, 1] face = [ # 0-1 Attack1, rotating rings (state 8, variant 0): an 8-ring at 6 each loop, each turning the other way. {"animation": "Attack1Begin", "rolled": False, "sounds": [snd(0xb, "Sound1"), snd(0x10, "Shoot")], "next": 1}, {"animation": "Attack1Loop", "rolled": False, "release": "Start", "loop": {"at": "Back", "to": "Start", "count": 17}, "shots": [{"shot": "ring", "count": 8, "speed": 6, "curve": 0.035, "curve_alternate": True}], "next": 6}, # 2-3 Attack1, a cross (variant 1): four shots a quarter turn apart every third tick, swaying round. {"animation": "Attack1Begin", "rolled": False, "sounds": [snd(0xb, "Sound1"), snd(0x10, "Shoot")], "next": 3}, {"animation": "Attack1Loop", "rolled": False, "loop": {"at": "Back", "to": "Start", "count": 17}, "shots": [{"shot": "spiral", "on": "Fire", "speed": 6, "spread": 0.35, "fan": [[1, 0, 0, 1], [0, 1, -1, 0], [-1, 0, 0, -1], [0, -1, 1, 0]]}], "next": 6}, # 4-5 Attack1, the fans (variant 2): a shot each way (6 and 8) every third tick, sweeping 8 degrees a tick from # either side, mirrored. {"animation": "Attack1Begin", "rolled": False, "sounds": [snd(0xb, "Sound1"), snd(0x10, "Shoot")], "next": 5}, {"animation": "Attack1Loop", "rolled": False, "loop": {"at": "Back", "to": "Start", "count": 17}, "shots": [{"shot": "spiral", "on": "Fire", "speed": s, "spread": 0.419, "fan": [f]} for s in (6, 8) for f in ([1, 0, 0, 1], MIRROR)], "next": 6}, {"animation": "Attack1End", "rolled": False, "sounds": [snd(0xa7, "Sound1")], "cooldown": 45}, # 7-9 Attack2 (state 9): 90 ticks of a shot a tick thrown down the room 8-18 fast within 15 degrees, high, # then 240 ticks before another. {"animation": "Attack2Begin", "rolled": False, "sounds": [snd(0xb, "Sound1"), snd(0xa7, "Sound2"), snd(0x134, "Shoot")], "next": 8}, {"animation": "Attack2Loop", "rolled": False, "loop": {"at": "Back", "to": "Start", "count": 11}, "shots": [{"shot": "aimed", "on": "Fire", "direction": [0, 13], "direction_jitter": [0.27, 0.38], "fall_velocity": -20, "fall_acceleration": 0.8, "look": PUKE}], "next": 9}, {"animation": "Attack2End", "rolled": False, "sounds": [snd(0xa7, "Sound1")], "cooldown": 45}, # 10 Munch (state 10, variant 0): bites of shots, then 25 bones and maggots lobbed all round. {"animation": "Munch", "rolled": False, "release": "Shoot", "shots": [{"shot": "boss_volley", "count": 12, "speed": 9, "fall_velocity": -18, "fall_acceleration": 0.8}, {"shot": "boss_volley", "count": 10, "speed": 7, "fall_velocity": -26, "fall_acceleration": 0.9, "look": BONE}], "spawn": ["small_maggot"], "count": 2, "spawn_speed": 6, "sounds": [snd(0x134, "Shoot"), snd(0xa7, "Sound1")], "cooldown": 45}, # 11 Munch (variant 1): a cough of 20 shots each way, left and right within 15 degrees. {"animation": "Munch", "rolled": False, "release": "Shoot", "shots": [{"shot": "aimed", "count": 20, "direction": [d * 12, 0], "direction_jitter": [0.6, 0.27], "fall_velocity": -4, "fall_acceleration": 0.4, "scale": 1.2} for d in (1, -1)], "sounds": [snd(0x134, "Shoot"), snd(0xa7, "Sound1")], "cooldown": 45}, ] BEAT = [{"shot": "aimed", "speed": 7, "fan": [turn(t) for t in range(-90, 91, 30)]}] heart = [ # 0 A beat (state 3): half a ring of 12 (7 fast) toward Isaac's side, give or take 15 degrees. {"animation": "Heartbeat", "rolled": False, "release": "Shoot", "shots": BEAT, "sounds": [snd(0x141, "Shoot")]}, # 1 SpitDown (state 8): a big blood shot dropped below, bursting into shots that bounce off the walls. {"animation": "SpitDown", "rolled": False, "release": "Shoot", "shots": [{"shot": "aimed", "direction": [0, 5], "scale": 2.5, "fall_velocity": -6, "fall_acceleration": 0.5, "landing": [{"effect": "enemy_shots", "count": 8, "speed": 7}]}], "sounds": [snd(0xd5, "Shoot")]}, # 2-3 Summon (state 13): ten beats each dropping three yellow shots about the room, each splitting into two. {"animation": "Summon", "rolled": False, "sounds": [snd(0xa7, "Start")], "next": 3}, {"animation": "Heartbeat", "rolled": False, "release": "Shoot", "loop": {"at": "Back", "to": "Start", "count": 9}, "shots": [{"shot": "boss_volley", "count": 3, "speed": 4, "fall_velocity": -24, "fall_acceleration": 0.9, "scale": 1.5, "tint": [1, 1, 0.3, 0.2, 0.15, 0], "landing": [{"effect": "enemy_shots", "count": 2, "speed": 6}]}], "sounds": [snd(0x141, "Shoot")]}, # 4-6 Retract (state 4): up out of reach, leeches crawling in from the side far from Isaac every 15 ticks, then down. {"animation": "Retract", "rolled": False, "untouchable": {"from": "Sound", "to": "End"}, "sounds": [snd(0xd4, "Sound")], "next": 5}, {"animation": "HeartbeatRetracted", "rolled": False, "release": "Shoot", "loop": {"at": "Back", "to": "Start", "count": 5}, "untouchable": {"from": "Start", "to": "Back"}, "shots": BEAT, "spawn": ["leech"], "spawn_on": "Spawn", "spawn_at": [[-240, 40], [240, 100], [-240, 160], [240, 40], [-240, 100]], "spawn_cap": {"type": "leech", "below": 6}, "sounds": [snd(0x141, "Shoot"), snd(0xdd, "Spawn")], "next": 6}, {"animation": "ComeDown", "rolled": False, "sounds": [snd(0xd5, "Sound")], "cooldown": 30}, ] upsert({"key": "rotgut_heart", "name": "Rotgut (Heart)", "flash_id": 91100200, "hp": 600, "mass": 80, "radius": 40, "contact_damage": 0.5, "gibs": {"large": True}, "behavior": {"kind": "scripted", "move": "anchor", "idle_pose": "Heartbeat", "spawn_clip": {"animation": "Appear"}, "attacks": heart, # Each idle tick past 30, random(60) == 0 picks SpitDown 10, Summon 5 and Retract 5; else it beats. "choice": {"one_in": 1, "weights": [{"weight": 60}, {"weight": 10}, {"weight": 5}, {"weight": 5}], "options": [0, 1, 2, 4]}, "phases": [{"when": [{"hp_share_below": 0.5}], "patch": {"idle_pose": "HeartbeatFast", "attacks": [dict(heart[0], animation="HeartbeatFast", sounds=[snd(0x142, "Shoot")])] + heart[1:]}}]}, "death": {"animation": "Death"}, "death_burst": {"boss_sounds": ["rocket_blast_death_1.mp3"]}, "art": "gfx/bosses/rotgut_heart/rotgut_heart.anm2"}) upsert({"key": "rotgut", "name": "Rotgut", "flash_id": 91100000, "hp": 600, "mass": 80, "radius": 58, "contact_damage": 0.5, "gibs": {"large": True}, "behavior": {"kind": "scripted", "move": "anchor", "idle_pose": "Idle", "spawn_clip": {"animation": "Appear"}, "attacks": face, # After 45 idle ticks, random(20) == 0: Attack1 (one of three), Attack2 (resting 240 ticks after # it) or Munch (one of two), alike. "choice": {"one_in": 20, "options": [0, 2, 4, 7, 10, 11], "weights": [{"weight": 2}, {"weight": 2}, {"weight": 2}, {"weight": 6, "rest": 240, "rest_weight": 0}, {"weight": 3}, {"weight": 3}]}}, # Beaten, it swallows Isaac into its insides (the maggot's crawl space is left out): its heart, here. "death": {"animation": "Death"}, "death_spawn": {"overkill_limit": 1000000, "count": 1, "crowd_scale": 0, "count_step": 1, "radius": 0, "pool": [{"create_type": "rotgut_heart", "weight": 1}]}, "death_burst": {"boss_sounds": ["rocket_blast_death_1.mp3"]}, "art": "gfx/bosses/rotgut/rotgut.anm2"})