Skip to content

Commit

Permalink
Pokemon Emerald: Clean up free fly blacklist (#4552)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zunawe authored Jan 27, 2025
1 parent c432331 commit b570aa2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion worlds/pokemon_emerald/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
}

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",
"Mauville City": "EVENT_VISITED_MAUVILLE_CITY",
"Verdanturf Town": "EVENT_VISITED_VERDANTURF_TOWN",
Expand All @@ -46,6 +51,9 @@
"Ever Grande City": "EVENT_VISITED_EVER_GRANDE_CITY",
}

VISITED_EVENTS = frozenset(BLACKLIST_OPTION_TO_VISITED_EVENT.values())


class PokemonEmeraldLocation(Location):
game: str = "Pokemon Emerald"
item_address: Optional[int]
Expand Down Expand Up @@ -142,7 +150,7 @@ def set_free_fly(world: "PokemonEmeraldWorld") -> None:
fly_location_name = "EVENT_VISITED_LITTLEROOT_TOWN"
if world.options.free_fly_location:
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:
fly_location_name = world.random.choice(free_fly_locations)

Expand Down
15 changes: 15 additions & 0 deletions worlds/pokemon_emerald/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,20 @@ class FreeFlyLocation(Toggle):
"""
display_name = "Free Fly Location"


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


class HmRequirements(Choice):
"""
Expand Down

0 comments on commit b570aa2

Please sign in to comment.