Pokemon Emerald: Fix client crash if 0.4.6 client connects to 0.4.5 seed (#3146)

This commit is contained in:
Bryce Wilson 2024-04-18 10:39:28 -06:00 committed by GitHub
parent 2d3f3fcc2d
commit ee1e578201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -87,7 +87,7 @@ class PokemonEmeraldWorld(World):
location_name_groups = LOCATION_GROUPS
data_version = 2
required_client_version = (0, 4, 5)
required_client_version = (0, 4, 6)
badge_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]
hm_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]

View File

@ -87,7 +87,8 @@ KEY_LOCATION_FLAGS = [
]
KEY_LOCATION_FLAG_MAP = {data.locations[location_name].flag: location_name for location_name in KEY_LOCATION_FLAGS}
LEGENDARY_NAMES = {
# .lower() keys for backward compatibility between 0.4.5 and 0.4.6
LEGENDARY_NAMES = {k.lower(): v for k, v in {
"Groudon": "GROUDON",
"Kyogre": "KYOGRE",
"Rayquaza": "RAYQUAZA",
@ -100,7 +101,7 @@ LEGENDARY_NAMES = {
"Deoxys": "DEOXYS",
"Ho-Oh": "HO_OH",
"Lugia": "LUGIA",
}
}.items()}
DEFEATED_LEGENDARY_FLAG_MAP = {data.constants[f"FLAG_DEFEATED_{name}"]: name for name in LEGENDARY_NAMES.values()}
CAUGHT_LEGENDARY_FLAG_MAP = {data.constants[f"FLAG_CAUGHT_{name}"]: name for name in LEGENDARY_NAMES.values()}
@ -311,7 +312,7 @@ class PokemonEmeraldClient(BizHawkClient):
num_caught = 0
for legendary, is_caught in caught_legendaries.items():
if is_caught and legendary in [LEGENDARY_NAMES[name] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
if is_caught and legendary in [LEGENDARY_NAMES[name.lower()] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
num_caught += 1
if num_caught >= ctx.slot_data["legendary_hunt_count"]: