Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokemon Emerald: Clean up free fly blacklist #4552

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading