LTTP: Key Drop Shuffle (#282)

Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
Co-authored-by: Bondo <38083232+BadmoonzZ@users.noreply.github.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
This commit is contained in:
Alchav
2023-09-26 23:24:10 -04:00
committed by GitHub
parent 4aed2be93b
commit 812dc413e5
25 changed files with 808 additions and 706 deletions

View File

@@ -25,7 +25,7 @@ from Utils import local_path, user_path, int16_as_bytes, int32_as_bytes, snes_to
from .Shops import ShopType, ShopPriceType
from .Dungeons import dungeon_music_addresses
from .Regions import old_location_address_to_new_location_address
from .Regions import old_location_address_to_new_location_address, key_drop_data
from .Text import MultiByteTextMapper, text_addresses, Credits, TextTable
from .Text import Uncle_texts, Ganon1_texts, TavernMan_texts, Sahasrahla2_texts, Triforce_texts, \
Blind_texts, \
@@ -428,6 +428,18 @@ def patch_enemizer(world, rom: LocalRom, enemizercli, output_directory):
rom.write_byte(0x04DE81, 6)
rom.write_byte(0x1B0101, 0) # Do not close boss room door on entry.
# Moblins attached to "key drop" locations crash the game when dropping their item when Key Drop Shuffle is on.
# Replace them with a Slime enemy if they are placed.
if multiworld.key_drop_shuffle[player]:
key_drop_enemies = {
0x4DA20, 0x4DA5C, 0x4DB7F, 0x4DD73, 0x4DDC3, 0x4DE07, 0x4E201,
0x4E20A, 0x4E326, 0x4E4F7, 0x4E686, 0x4E70C, 0x4E7C8, 0x4E7FA
}
for enemy in key_drop_enemies:
if rom.read_byte(enemy) == 0x12:
logging.debug(f"Moblin found and replaced at {enemy} in world {player}")
rom.write_byte(enemy, 0x8F)
for used in (randopatch_path, options_path):
try:
os.remove(used)
@@ -897,6 +909,25 @@ def patch_rom(world: MultiWorld, rom: LocalRom, player: int, enemized: bool):
credits_total += 30 if 'w' in world.shop_shuffle[player] else 27
rom.write_byte(0x187010, credits_total) # dynamic credits
if world.key_drop_shuffle[player]:
rom.write_byte(0x140000, 1) # enable key drop shuffle
credits_total += len(key_drop_data)
# update dungeon counters
rom.write_byte(0x187001, 12) # Hyrule Castle
rom.write_byte(0x187002, 8) # Eastern Palace
rom.write_byte(0x187003, 9) # Desert Palace
rom.write_byte(0x187004, 4) # Agahnims Tower
rom.write_byte(0x187005, 15) # Swamp Palace
rom.write_byte(0x187007, 11) # Misery Mire
rom.write_byte(0x187008, 10) # Skull Woods
rom.write_byte(0x187009, 12) # Ice Palace
rom.write_byte(0x18700B, 10) # Thieves Town
rom.write_byte(0x18700C, 14) # Turtle Rock
rom.write_byte(0x18700D, 31) # Ganons Tower
# collection rate address: 238C37
first_top, first_bot = credits_digit((credits_total / 100) % 10)
mid_top, mid_bot = credits_digit((credits_total / 10) % 10)
@@ -1824,10 +1855,10 @@ def apply_oof_sfx(rom, oof: str):
# (We need to insert the second sigil at the end)
rom.write_bytes(0x12803A, oof_bytes)
rom.write_bytes(0x12803A + len(oof_bytes), [0xEB, 0xEB])
#Enemizer patch: prevent Enemizer from overwriting $3188 in SPC memory with an unused sound effect ("WHAT")
rom.write_bytes(0x13000D, [0x00, 0x00, 0x00, 0x08])
def apply_rom_settings(rom, beep, color, quickswap, menuspeed, music: bool, sprite: str, oof: str, palettes_options,
world=None, player=1, allow_random_on_event=False, reduceflashing=False,