import math, sys; sys.path.insert(0, '../../b5tools'); from rec import upsert; from snd import snd WHITE = [1, 1, 1, 0.6, 0.6, 0.6] GREEN = [0.7, 1, 0.7, 0.3, 0.5, 0.3] def turn(deg): r = math.radians(deg); c, s = round(math.cos(r), 4), round(math.sin(r), 4) return [c, -s, s, c] # Its white patterns (the wiki's eleven; their sizes drawn at random, here by scale_random-less picks). PATTERNS = [ [{"shot": "ring", "count": 20, "speed": 4, "curve": 0.02, "curve_alternate": True, "tint": WHITE}], [{"shot": "ring", "count": 16, "speed": 6, "tint": WHITE, "scale": 0.8}], [{"shot": "ring", "count": 14, "speed": 5, "curve": 0.035, "curve_alternate": True, "tint": WHITE, "scale": 1.2}], [{"shot": "ring", "count": 10, "speed": 6, "speed_scale": 0.97, "speed_limit": 2.5, "tint": WHITE, "scale": 1.4}], [{"shot": "ring", "count": 8, "speed": 3, "fall_velocity": -12, "fall_acceleration": 0.4, "tint": GREEN, "landing": [{"effect": "explosion", "manned": True}]}], [{"shot": "ring", "count": 6, "speed": 7, "curve": 0.08, "curve_alternate": True, "tint": WHITE}], [{"shot": "aimed", "speed": 7, "fan": [[1, 0], [0.1, 1], [-1, 0.1], [0, -1]], "tint": WHITE, "scale": 1.5}], [{"shot": "spiral", "on": "Start", "until": "End", "every": 4, "speed": 6, "spread": 0.3, "fan": [turn(a) for a in (0, 90, 180, 270)], "tint": WHITE}], [{"shot": "aimed", "count": 5, "spread": 0.25, "speed": 8, "tint": WHITE}], [{"shot": "boss_volley", "count": 12, "speed": 7, "tint": WHITE}], ] FORMS = ["gurgling_boss", "turdling", "dingle", "dangle", "little_horn", "the_stain", "mega_maw", "dark_one", "the_gate", "the_forsaken", "baby_plum", "rag_mega", "brownie"] def core(rest): attacks = [{"animation": "IdleNoLoop", "rolled": False, "release": "Start", "shots": shots, "cooldown": rest} for shots in PATTERNS] attacks += [ # Teleports erratically about the room, near Isaac. {"animation": "Blink", "rolled": False, "release": "End", "teleport": 20, "cooldown": rest}, # Takes the form of a boss for a while, on its own health (decompiled: _deliriumTransformationTimer). {"animation": "Scream", "rolled": False, "become": {"type": FORMS[0], "types": FORMS, "is_health_kept": True, "back_after": 300 + rest * 10}, "sounds": [snd(0x1a5, "Start")]}, ] return attacks LAST = len(PATTERNS) + 1 def choice(oneIn): return {"one_in": oneIn, "options": list(range(LAST + 1)), "weights": [{"weight": 4}] * len(PATTERNS) + [{"weight": 6}, {"weight": 4, "rest": 300, "rest_weight": 0}]} upsert({"key": "delirium", "name": "Delirium", "flash_id": 41200000, "hp": 10000, "mass": 100, "radius": 40, "contact_damage": 0.5, "gibs": {"count": 0}, "grid_collision": False, "floor_hazards": {"flight": "flying"}, "behavior": {"kind": "scripted", "move": "anchor", "flying": True, "idle_pose": "Idle", "teleport": {"poses": ["Blink"], "mode": "near", "tries": 10, "keep": True}, "attacks": core(30), "choice": choice(10), # Faster as it is hurt: halfway, and a quarter left. "phases": [{"when": [{"hp_share_below": 0.5, "idle": True}], "patch": {"attacks": core(20), "choice": choice(6)}}, {"when": [{"hp_share_below": 0.25, "idle": True}], "patch": {"attacks": core(10), "choice": choice(3)}}]}, "death": {"animation": "Scream"}, "death_burst": {"boss_sounds": ["rocket_blast_death_1.mp3"]}, "art": "gfx/bosses/delirium/delirium.anm2"})