Files
isaac-port/notes/_tools/fbtools/mega_satan.py
T
shweetandClaude Opus 5.5 ad8f933086 Salvage Repentance+ 1.9.7.17 decompilation toolkit, notes and name database
Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes
indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that
build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:08:19 -04:00

151 lines
12 KiB
Python

import math, sys; sys.path.insert(0, '../../b5tools'); from rec import upsert; from snd import snd
def rot(deg):
r = deg * math.pi / 180; c, s = round(math.cos(r), 4), round(math.sin(r), 4)
return [c, -s, s, c]
def ways(n, offset=0, isMirrored=False):
return [[-m[0], m[1], -m[2], m[3]] if isMirrored else m for m in (rot(offset + 360 * i / n) for i in range(n))]
ROCK = {"art": {"anm2": "gfx/effects/rock_explosion/rock_explosion.anm2", "animation": "Break", "scale": 1, "offset_y": 0},
"period": 3, "radius": 14, "enemy_damage": 2, "player_damage": 0.5, "friendly": False,
"wave": {"spacing": 30, "period": 3, "breaking": True}}
FIRE = {"anm2": "gfx/projectiles/fire/fire.anm2", "animation": "Flickering"}
TEAR = {"anm2": "gfx/projectiles/tear/tear.anm2", "animation": "RegularTear6"}
def spiral(n, speed, turn, every=None, **extra):
"""An n-way spiral turning turn radians a launch: once a 9-tick loop, or every few ticks of it."""
shot = {"shot": "spiral", "on": "Start", "speed": speed, "spread": abs(round(turn, 4)), "fan": ways(n, 0, turn < 0)}
if every:
shot.update({"until": "Back", "every": every})
return dict(shot, **extra)
# The head's Shoot2 table (pattern = 2 + random(9), each a FireProjectiles(9) n-way volley, i.e. a ring, launched
# every period ticks for 60-120 ticks, its rings turning rate radians a tick).
def patterns(speedScale, isSecond):
s = speedScale
table = [
(6, [spiral(6, 6 * s, 0.0209 * 9), spiral(6, 6 * s, 0.0105 * 9)]), # 2: two six-way rings, turning
(6, [spiral(5, 6 * s, 0.0157 * 8), spiral(5, 6 * s, -0.0157 * 8)]), # 3: five-ways turning both ways
(6, [spiral(3, 6 * s, 0.1466 * 2, 2)]), # 4: three lines, fast round
(6, [spiral(6, 12 * s, 0.13, 2)]), # 5: six lines swinging
(10, [spiral(8, 9 * s, 0.1, 2)]), # 6: eight lines
(13, [spiral(9, 8 * s, 0.08, 2)]), # 7: nine lines
(13, [spiral(12, 7 * s, 0.06, 2)]), # 8: twelve lines
(6, [{"shot": "ring", "on": "Start", "count": 20, "speed": 8 * s}]), # 9: dense rings in threes
(8, [{"shot": "ring", "on": "Start", "count": 12, "speed": 4 * s, "speed_scale": 1.03, "speed_limit": 9 * s,
"landing": [{"effect": "enemy_shots", "count": 4, "speed": 5}]}]), # 10: brown bursting spreads
]
if isSecond: # Mega Satan 2's own (11-27): orbiting, curving and fire patterns.
table += [
(10, [spiral(4, 5, 0.05, orbit="clockwise"), spiral(4, 5, -0.05, orbit="counterclockwise")]),
(10, [dict(spiral(6, 6, 0.08, 2), curve=0.02, curve_alternate=True)]),
(10, [dict(spiral(10, 5, 0.03), curve=0.015), dict(spiral(10, 5, -0.03), curve=-0.015)]),
(13, [dict(spiral(8, 6, 0.1, 3), look=FIRE)]),
(10, [{"shot": "ring", "on": "Start", "count": 16, "speed": 6, "curve": 0.025},
{"shot": "ring", "on": "Start", "count": 16, "speed": 6, "curve": -0.025}]),
(13, [dict(spiral(6, 7, 0.2, 3), speed_scale=0.97, speed_limit=4)]),
]
return table
def shoot(clip, isSecond, speedScale, end):
table = patterns(speedScale, isSecond)
out = [{"animation": f"{clip}Loop", "rolled": False, "loop": {"at": "Back", "to": "Start", "count": loops},
"shots": shots, "next": end} for loops, shots in table]
return out
BLAST = {"animation": "Shoot1", "rolled": False, "release": "Shoot",
"laser": {"beams": [{"direction": [0, 1], "offset": [0, 40]}], "width": 80, "player_damage": 1, "from": "Shoot",
"sounds": ["rebirth/v2/blood_laser_long_loop.mp3"], "sound_period": 30},
"sounds": [snd(0xef, "Shoot")], "cooldown": 30}
def smash(clip, count):
return {"animation": clip, "rolled": False,
"shots": [{"shot": "boss_volley", "on": "Smash", "count": count, "speed": 10, "scale": 1.5,
"fall_velocity": -6, "fall_acceleration": 0.3}],
"sounds": [snd(0x34, "Smash")], "cooldown": 30}
SUMMONS = [["gluttony", "envy"], ["sloth", "pride"], ["wrath", "greed"], ["lust"], [19.1]] # 19.1: The Hollow, Larry Jr.'s form.
head = [
# 0-1 State 8: eyes shut, then the Mega Blast straight down.
{"animation": "Charging", "rolled": False, "sounds": [snd(0xf0, "Start")], "next": 1}, BLAST,
# 2-3 State 9: eyes shut, Shoot2Start, then a pattern (4-12), then 13.
{"animation": "Charging", "rolled": False, "sounds": [snd(0xf0, "Start")], "next": 3},
{"animation": "Shoot2Start", "rolled": False, "next": list(range(4, 13))},
] + shoot("Shoot2", False, 1, 13) + [
{"animation": "Shoot2End", "rolled": False, "cooldown": 30},
# 14-16 State 7: the head slams 1, 3 or 5 times, each a burst of 50, 25 or 20 boss shots.
smash("SmashHead", 50), smash("SmashHead3", 25), smash("SmashHead5", 20),
# 17-21 State 14: a set of mini-bosses (Gluttony and Envy, Sloth and Pride, Wrath and Greed, Lust or The Hollow).
] + [{"animation": "Summon", "rolled": False, "release": "Summon", "spawn": pair, "spawn_in_order": True, "count": len(pair),
"spawn_at": [[-140, 160], [140, 160]], "sounds": [snd(0xf3, "Summon")], "cooldown": 60} for pair in SUMMONS] + [
# 22-23 A lost hand back 30 seconds on.
] + [{"animation": "NoseBlow", "rolled": False, "spawn": [hand], "count": 1, "spawn_at": [[side * 120, 100]],
"release": "Start", "when": [{"type_count": {"type": hand, "below": 1}}], "cooldown": 30}
for hand, side in (("mega_satans_right_hand", -1), ("mega_satans_left_hand", 1))]
OPTIONS = [0, 2, 2, 2, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
WEIGHTS = [{"weight": 3}, {"weight": 4}, {"weight": 4}, {"weight": 4}, {"weight": 2}, {"weight": 2}, {"weight": 2},
{"weight": 1, "rest": 600, "rest_weight": 0}, {"weight": 1, "rest": 600, "rest_weight": 0},
{"weight": 1, "rest": 600, "rest_weight": 0}, {"weight": 1, "rest": 600, "rest_weight": 0},
{"weight": 1, "rest": 600, "rest_weight": 0},
{"weight": 30, "rest": 900, "rest_weight": 0}, {"weight": 30, "rest": 900, "rest_weight": 0}]
FIGHT = {"idle_pose": "Idle", "hidden": False, "untouchable": False, "attacks": head,
"choice": {"one_in": 100, "options": OPTIONS, "weights": WEIGHTS}}
# Its withdrawals (750, 1500 and 2250 damage taken): hidden behind the dark until each wave of bosses is beaten.
WAVES = [[["famine", "pestilence"], ["war", "death"]],
[["super_envy"], ["super_lust", "super_wrath"], ["super_sloth", "super_gluttony", "super_pride", "super_greed"]]]
def hide(wave, isFirst):
clip = "Hide" if isFirst else "Hiding"
return {"idle_pose": "Hiding", "hidden": True, "untouchable": True, "choice": None,
"attacks": [{"animation": clip, "rolled": False, "release": "Start", "spawn": wave, "spawn_in_order": True,
"count": len(wave), "spawn_at": [[-120, 200], [120, 200], [-120, 280], [120, 280]],
"sounds": [snd(0xf3, "Start")]}]}
REVEAL = {"animation": "Reveal", "rolled": False, "sounds": [snd(0xf1, "Start")], "cooldown": 30}
def chain(gates):
"""fight, then each withdrawal's waves one by one, each opened once the last is beaten, then the fight again."""
phases = []
for share, waves in gates:
phases.append({"when": [{"hp_share_below": share}], "attack": 0, "patch": hide(waves[0], True)})
for wave in waves[1:]:
phases.append({"when": [{"others_below": 1, "idle": True}], "attack": 0, "patch": hide(wave, False)})
phases.append({"when": [{"others_below": 1, "idle": True}], "attack": len(head),
"patch": dict(FIGHT, attacks=head + [REVEAL])})
return phases
upsert({"key": "mega_satan", "name": "Mega Satan", "flash_id": 27400000, "hp": 3000, "mass": 400, "radius": 50, "contact_damage": 1,
"explosion_response": {"manned_damage": 0}, "boss_bar": {"eligibility": "never"}, "gibs": {"count": 0},
"behavior": dict(FIGHT, kind="scripted", move="anchor", spawn_clip={"animation": "Appear"},
phases=chain([(0.75, WAVES[0]), (0.5, WAVES[1])])),
# Beaten, it sinks and rises again as Mega Satan 2.
"death": {"animation": "Death"},
"death_spawn": {"overkill_limit": 1000000, "count": 1, "crowd_scale": 0, "count_step": 1, "radius": 0,
"pool": [{"create_type": "mega_satan_2", "weight": 1}]},
"art": "gfx/bosses/mega_satan/mega_satan.anm2"})
def hand(key, name, flash, isRight):
side = -1 if isRight else 1
return {"key": key, "name": name, "flash_id": flash, "hp": 600, "mass": 400, "radius": 45, "contact_damage": 1,
"door_lock": "never", "boss_bar": {"eligibility": "never"}, "explosion_response": {"manned_damage": 0},
"death_link": {"target_type": "mega_satan", "animation": "Idle"},
"behavior": {"kind": "scripted", "move": "anchor", "idle_pose": "Idle", "spawn_clip": {"animation": "Appear"},
"mirrored": False,
"attacks": [
# Raised, then slammed onto Isaac in a ring of rock waves.
{"animation": "SmashHand1", "period": 1, "one_in": 260, "release": "Smash", "pounce": True,
"untouchable": {"from": "Start", "to": "Smash"},
"effects": [{"effect": "bolts", "directions": {"count": 8}, "offset": 30, "bolt": ROCK}],
"sounds": [snd(0x34, "Smash")], "cooldown": 60},
# Slammed three times, rock waves running down the room.
{"animation": "SmashQuake", "period": 1, "one_in": 400, "release": "Smash",
"loop": {"at": "Back", "to": "Start", "count": 2},
"effects": [{"effect": "bolts", "directions": {"count": 1, "angle": 90}, "offset": 40, "bolt": ROCK}],
"sounds": [snd(0x34, "Smash")], "cooldown": 60}]},
"death": {"animation": "Death"}, "death_burst": {"boss_sounds": ["rocket_blast_death_1.mp3"]},
"art": f"gfx/bosses/{key}/{key}.anm2"}
upsert(hand("mega_satans_right_hand", "Mega Satan's Right Hand", 27400100, True),
hand("mega_satans_left_hand", "Mega Satan's Left Hand", 27400200, False))
def second(clip):
"""Mega Satan 2's Shoot<n> patterns (2 + random(26)), its idle and shots by the third of its health left."""
return [{"animation": f"{clip}Start", "rolled": False, "next": list(range(1, 16))}] + shoot(clip, True, 1.5, 16) + \
[{"animation": f"{clip}End", "rolled": False, "cooldown": 20}]
upsert({"key": "mega_satan_2", "name": "Mega Satan 2", "flash_id": 27500000, "hp": 2000, "mass": 400, "radius": 50, "contact_damage": 1,
"boss_bar": {"eligibility": "never"}, "gibs": {"count": 0},
"behavior": {"kind": "scripted", "move": "anchor", "idle_pose": "Idle1", "spawn_clip": {"animation": "Appear"},
"attacks": second("Shoot1"), "choice": {"one_in": 30, "options": [0]},
"phases": [{"when": [{"hp_share_below": 0.667, "idle": True}],
"patch": {"idle_pose": "Idle2", "attacks": second("Shoot2")},
},
{"when": [{"hp_share_below": 0.333, "idle": True}],
"patch": {"idle_pose": "Idle3", "attacks": second("Shoot3")}}]},
"death": {"animation": "Death"}, "death_burst": {"boss_sounds": ["rocket_blast_death_1.mp3"]},
"art": "gfx/bosses/mega_satan_2/mega_satan_2.anm2"})