Pokemon Emerald: Clean up free fly blacklist (#4552)

This commit is contained in:
Bryce Wilson 2025-01-27 07:25:31 -08:00 committed by GitHub
parent c43233120a
commit b570aa2ec6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -34,6 +34,11 @@ VISITED_EVENT_NAME_TO_ID = {
} }
BLACKLIST_OPTION_TO_VISITED_EVENT = { BLACKLIST_OPTION_TO_VISITED_EVENT = {
"Littleroot Town": "EVENT_VISITED_LITTLEROOT_TOWN",
"Oldale Town": "EVENT_VISITED_OLDALE_TOWN",
"Petalburg City": "EVENT_VISITED_PETALBURG_CITY",
"Rustboro City": "EVENT_VISITED_RUSTBORO_CITY",
"Dewford Town": "EVENT_VISITED_DEWFORD_TOWN",
"Slateport City": "EVENT_VISITED_SLATEPORT_CITY", "Slateport City": "EVENT_VISITED_SLATEPORT_CITY",
"Mauville City": "EVENT_VISITED_MAUVILLE_CITY", "Mauville City": "EVENT_VISITED_MAUVILLE_CITY",
"Verdanturf Town": "EVENT_VISITED_VERDANTURF_TOWN", "Verdanturf Town": "EVENT_VISITED_VERDANTURF_TOWN",
@ -46,6 +51,9 @@ BLACKLIST_OPTION_TO_VISITED_EVENT = {
"Ever Grande City": "EVENT_VISITED_EVER_GRANDE_CITY", "Ever Grande City": "EVENT_VISITED_EVER_GRANDE_CITY",
} }
VISITED_EVENTS = frozenset(BLACKLIST_OPTION_TO_VISITED_EVENT.values())
class PokemonEmeraldLocation(Location): class PokemonEmeraldLocation(Location):
game: str = "Pokemon Emerald" game: str = "Pokemon Emerald"
item_address: Optional[int] item_address: Optional[int]
@ -142,7 +150,7 @@ def set_free_fly(world: "PokemonEmeraldWorld") -> None:
fly_location_name = "EVENT_VISITED_LITTLEROOT_TOWN" fly_location_name = "EVENT_VISITED_LITTLEROOT_TOWN"
if world.options.free_fly_location: if world.options.free_fly_location:
blacklisted_locations = set(BLACKLIST_OPTION_TO_VISITED_EVENT[city] for city in world.options.free_fly_blacklist.value) blacklisted_locations = set(BLACKLIST_OPTION_TO_VISITED_EVENT[city] for city in world.options.free_fly_blacklist.value)
free_fly_locations = sorted(set(BLACKLIST_OPTION_TO_VISITED_EVENT.values()) - blacklisted_locations) free_fly_locations = sorted(VISITED_EVENTS - blacklisted_locations)
if free_fly_locations: if free_fly_locations:
fly_location_name = world.random.choice(free_fly_locations) fly_location_name = world.random.choice(free_fly_locations)

View File

@ -725,13 +725,20 @@ class FreeFlyLocation(Toggle):
""" """
display_name = "Free Fly Location" display_name = "Free Fly Location"
class FreeFlyBlacklist(OptionSet): class FreeFlyBlacklist(OptionSet):
""" """
Disables specific locations as valid free fly locations. Disables specific locations as valid free fly locations.
Has no effect if Free Fly Location is disabled. Has no effect if Free Fly Location is disabled.
""" """
display_name = "Free Fly Blacklist" display_name = "Free Fly Blacklist"
valid_keys = [ valid_keys = [
"Littleroot Town",
"Oldale Town",
"Petalburg City",
"Rustboro City",
"Dewford Town",
"Slateport City", "Slateport City",
"Mauville City", "Mauville City",
"Verdanturf Town", "Verdanturf Town",
@ -743,6 +750,14 @@ class FreeFlyBlacklist(OptionSet):
"Sootopolis City", "Sootopolis City",
"Ever Grande City", "Ever Grande City",
] ]
default = [
"Littleroot Town",
"Oldale Town",
"Petalburg City",
"Rustboro City",
"Dewford Town",
]
class HmRequirements(Choice): class HmRequirements(Choice):
""" """