Skip to content

Commit

Permalink
Rework token patch + expose weaknesses to a rom table
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLX5 committed May 25, 2024
1 parent 7084c9a commit 868964b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 38 deletions.
87 changes: 49 additions & 38 deletions worlds/mmx/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ def adjust_boss_damage_table(world: World, patch: MMXProcedurePatch):
# Fix second anglerge having different weakness
patch.write_byte(0x12E62, 0x01)

# Write weaknesses to a table
offset = 0x17EC00
for _, entries in world.boss_weaknesses.items():
data = [0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]
i = 0
for entry in entries:
data[i] = entry[1]
i += 1
patch.write_bytes(offset, bytearray(data))
offset += 8


def adjust_boss_hp(world: World, patch: MMXProcedurePatch):
option = world.options.boss_randomize_hp
Expand All @@ -138,44 +149,44 @@ def adjust_boss_hp(world: World, patch: MMXProcedurePatch):

def patch_rom(world: World, patch: MMXProcedurePatch):
# Prepare some ROM locations to receive the basepatch output
patch.write_bytes(0x00098C, bytearray([0x85,0xB3,0x8A]))
patch.write_bytes(0x0009AE, bytearray([0x85,0xB3,0x8A]))
patch.write_bytes(0x001261, bytearray([0xA9,0x10,0x20,0xE1,0x89]))
patch.write_bytes(0x001271, bytearray([0xA5,0xAC,0x89,0x08,0xF0,0x09,0xA5,0x3C,
0x3A,0x10,0x11,0xA9,0x02,0x80,0x0D,0x89,
0x24,0xF0,0x1E,0xA5,0x3C,0x1A,0xC9,0x03,
0xD0,0x02,0xA9,0x00,0x85,0x3C,0xAA,0xBD,
0x75,0x88,0x8D,0xB0,0x0B,0xA5,0x3C,0x18,
0x69,0x10,0x20,0xE1,0x89,0xA9,0xF0,0x85,
0x3B]))
patch.write_bytes(0x00131F, bytearray([0x9C,0xA9,0x0B,0x9C,0xAA,0x0B]))
patch.write_bytes(0x00132E, bytearray([0x90,0x8B]))
patch.write_bytes(0x001352, bytearray([0x64,0x38,0x64,0x39]))
patch.write_bytes(0x0025CA, bytearray([0xA9,0xF6,0xA0,0x02]))
patch.write_bytes(0x0046F3, bytearray([0x38,0xE9,0x0A]))
patch.write_bytes(0x006A61, bytearray([0xFB,0xEC]))
patch.write_bytes(0x006D67, bytearray([0x85,0x00,0x0A]))
patch.write_bytes(0x006F97, bytearray([0x9F,0xCB,0xFF,0x7E]))
patch.write_bytes(0x00700F, bytearray([0x55,0xDB]))
patch.write_bytes(0x007BF0, bytearray([0x90,0x8B]))
patch.write_bytes(0x00EB4A, bytearray([0xEE,0xCF,0x0B,0xA9,0x80]))
patch.write_bytes(0x011646, bytearray([0xA9,0x0A,0x85,0x01]))
patch.write_bytes(0x01B392, bytearray([0xA9,0x02,0x85,0x03]))
patch.write_bytes(0x01C67E, bytearray([0xA9,0x04,0x85,0x01]))
patch.write_bytes(0x01D84F, bytearray([0xA9,0x3C,0x9D,0x0A,0x00]))
patch.write_bytes(0x021D51, bytearray([0xED,0x00,0x00,0x8D,0xCF,0x0B]))
patch.write_bytes(0x021E94, bytearray([0x64,0x27,0xA9,0xFF]))
patch.write_bytes(0x021F5A, bytearray([0xED,0x00,0x00,0x8D,0xCF,0x0B]))
patch.write_bytes(0x02268C, bytearray([0xE6,0x03,0xE6,0x03]))
patch.write_bytes(0x03D0B2, bytearray([0x0C,0x99,0x1F,0x4C,0xBD,0xD0]))
patch.write_bytes(0x03D0D9, bytearray([0xA9,0x80,0x0C,0x7E]))
patch.write_bytes(0x044BEC, bytearray([0xA9,0x12,0x85,0x01]))
patch.write_bytes(0x0457CC, bytearray([0xA9,0x02,0x0C,0x99,0x1F]))

patch.write_bytes(0x0312B0, bytearray([0x20,0xC6,0x09,0x40,0x14,0x20,0x06,0x0A,
0x4C,0x49,0x43,0x45,0x4E,0x53,0x45,0x44,
0x20,0x42,0x59,0x20,0x4E,0x49,0x4E,0x54,
0x45,0x4E,0x44,0x4F,0x00]))
patch.write_bytes(0x00098C, bytearray([0xFF,0xFF,0xFF]))
patch.write_bytes(0x0009AE, bytearray([0xFF,0xFF,0xFF]))
patch.write_bytes(0x001261, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x001271, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF]))
patch.write_bytes(0x00131F, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x00132E, bytearray([0xFF,0xFF]))
patch.write_bytes(0x001352, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x0025CA, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x0046F3, bytearray([0xFF,0xFF,0xFF]))
patch.write_bytes(0x006A61, bytearray([0xFF,0xFF]))
patch.write_bytes(0x006D67, bytearray([0xFF,0xFF,0xFF]))
patch.write_bytes(0x006F97, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x00700F, bytearray([0xFF,0xFF]))
patch.write_bytes(0x007BF0, bytearray([0xFF,0xFF]))
patch.write_bytes(0x00EB4A, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x011646, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x01B392, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x01C67E, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x01D84F, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x021D51, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x021E94, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x021F5A, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x02268C, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x03D0B2, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x03D0D9, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x044BEC, bytearray([0xFF,0xFF,0xFF,0xFF]))
patch.write_bytes(0x0457CC, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF]))

patch.write_bytes(0x0312B0, bytearray([0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF]))

adjust_boss_damage_table(world, patch)

Expand Down
Binary file modified worlds/mmx/data/mmx_basepatch.bsdiff4
Binary file not shown.

0 comments on commit 868964b

Please sign in to comment.