Pokemon Emerald: Fix Latios KeyError (#6056)

This commit is contained in:
Bryce Wilson
2026-03-29 14:10:16 -07:00
committed by GitHub
parent 36cf86f2e8
commit 5ca50cd8d3
3 changed files with 11 additions and 3 deletions

View File

@@ -263,6 +263,14 @@ class PokemonEmeraldWorld(World):
if self.options.hms == RandomizeHms.option_shuffle:
self.options.local_items.value.update(self.item_name_groups["HM"])
# Manually enable Latios as a dexsanity location if we're doing legendary hunt (which confines Latios to
# the roamer encounter), the player allows Latios as a valid legendary hunt target, and they didn't also
# blacklist Latios to remove its dexsanity location
if self.options.goal == Goal.option_legendary_hunt and self.options.dexsanity \
and "Latios" in self.options.allowed_legendary_hunt_encounters.value \
and emerald_data.constants["SPECIES_LATIOS"] not in self.blacklisted_wilds:
self.allowed_dexsanity_species.add(emerald_data.constants["SPECIES_LATIOS"])
def create_regions(self) -> None:
from .regions import create_regions
all_regions = create_regions(self)

View File

@@ -376,10 +376,10 @@ def randomize_wild_encounters(world: "PokemonEmeraldWorld") -> None:
# Actually create the new list of slots and encounter table
new_slots: List[int] = []
if encounter_type in enabled_encounters:
world.allowed_dexsanity_species.update(table.slots)
for species_id in table.slots:
new_slots.append(species_old_to_new_map[species_id])
if encounter_type in enabled_encounters:
world.allowed_dexsanity_species.update(new_slots)
new_encounters[encounter_type] = EncounterTableData(new_slots, table.address)

View File

@@ -1559,7 +1559,7 @@ def set_rules(world: "PokemonEmeraldWorld") -> None:
# Legendary hunt prevents Latios from being a wild spawn so the roamer
# can be tracked, and also guarantees that the roamer is a Latios.
if world.options.goal == Goal.option_legendary_hunt and \
data.constants["SPECIES_LATIOS"] not in world.blacklisted_wilds:
data.constants["SPECIES_LATIOS"] in world.allowed_dexsanity_species:
set_rule(
get_location(f"Pokedex - Latios"),
lambda state: state.has("EVENT_ENCOUNTER_LATIOS", world.player)