From a599fce84a89fceb6fd071c007fe1efe548af79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=A2=E3=83=AA=E3=82=B9?= Date: Sat, 20 Jul 2024 20:26:26 +0100 Subject: [PATCH] Pokemon Crystal: Fix non-local locations being added to phone traps --- worlds/pokemon_crystal/client.py | 4 ++-- worlds/pokemon_crystal/phone.py | 2 +- worlds/pokemon_crystal/rom.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/worlds/pokemon_crystal/client.py b/worlds/pokemon_crystal/client.py index f07b64c2185b..fde30a136cc7 100644 --- a/worlds/pokemon_crystal/client.py +++ b/worlds/pokemon_crystal/client.py @@ -193,13 +193,13 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None: if not len(self.phone_trap_locations): phone_result = await bizhawk.guarded_read( ctx.bizhawk_ctx, - [(data.rom_addresses["AP_Setting_Phone_Trap_Locations"], 0x80, "ROM")], + [(data.rom_addresses["AP_Setting_Phone_Trap_Locations"], 0x20, "ROM")], [overworld_guard] ) if phone_result is not None: read_locations = [] for i in range(0, 16): - loc = int.from_bytes(phone_result[0][i * 8:(i + 1) * 8], "little") + loc = int.from_bytes(phone_result[0][i * 2:(i + 1) * 2], "little") read_locations.append(loc) self.phone_trap_locations = read_locations else: diff --git a/worlds/pokemon_crystal/phone.py b/worlds/pokemon_crystal/phone.py index c3db5b5e4987..3e3fd34fdf06 100644 --- a/worlds/pokemon_crystal/phone.py +++ b/worlds/pokemon_crystal/phone.py @@ -16,7 +16,7 @@ def generate_phone_traps(world: "PokemonCrystalWorld"): else: psychic_location = world.multiworld.get_location(data.locations["TM29_PSYCHIC"].label, world.player) remote_locs = [] - for location in world.multiworld.get_locations(): + for location in world.multiworld.get_locations(world.player): if len(remote_locs) > 3: break if (location.address is not None and location.item and location.item.player != world.player diff --git a/worlds/pokemon_crystal/rom.py b/worlds/pokemon_crystal/rom.py index 9c0c06ad080a..546f338a692b 100644 --- a/worlds/pokemon_crystal/rom.py +++ b/worlds/pokemon_crystal/rom.py @@ -367,7 +367,7 @@ def generate_output(world: "PokemonCrystalWorld", output_directory: str, patch: phone_location_bytes = [] for loc in world.generated_phone_indices: - phone_location_bytes += list(loc.to_bytes(8, "little")) + phone_location_bytes += list(loc.to_bytes(2, "little")) phone_location_address = data.rom_addresses["AP_Setting_Phone_Trap_Locations"] write_bytes(patch, phone_location_bytes, phone_location_address)