Skip to content

Commit

Permalink
Added dict to convert blacklist options to visited events based on fe…
Browse files Browse the repository at this point in the history
…edback
  • Loading branch information
SansSkill committed Nov 28, 2024
1 parent 0ef91f2 commit d1cb5b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
27 changes: 13 additions & 14 deletions worlds/pokemon_emerald/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@
"EVENT_VISITED_SOUTHERN_ISLAND": 17,
}

BLACKLIST_OPTION_TO_VISITED_EVENT = {
"Slateport City": "EVENT_VISITED_SLATEPORT_CITY",
"Mauville City": "EVENT_VISITED_MAUVILLE_CITY",
"Verdanturf Town": "EVENT_VISITED_VERDANTURF_TOWN",
"Fallarbor Town": "EVENT_VISITED_FALLARBOR_TOWN",
"Lavaridge Town": "EVENT_VISITED_LAVARIDGE_TOWN",
"Fortree City": "EVENT_VISITED_FORTREE_CITY",
"Lilycove City": "EVENT_VISITED_LILYCOVE_CITY",
"Mossdeep City": "EVENT_VISITED_MOSSDEEP_CITY",
"Sootopolis City": "EVENT_VISITED_SOOTOPOLIS_CITY",
"Ever Grande City": "EVENT_VISITED_EVER_GRANDE_CITY",
}

class PokemonEmeraldLocation(Location):
game: str = "Pokemon Emerald"
Expand Down Expand Up @@ -173,20 +185,7 @@ def set_free_fly(world: "PokemonEmeraldWorld") -> None:
# If not enabled, set it to Littleroot Town by default
fly_location_name = "EVENT_VISITED_LITTLEROOT_TOWN"
if world.options.free_fly_location:
free_fly_locations = [
"EVENT_VISITED_SLATEPORT_CITY" if "Slateport City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_MAUVILLE_CITY" if "Mauville City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_VERDANTURF_TOWN" if "Verdanturf Town" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_FALLARBOR_TOWN" if "Fallarbor Town" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_LAVARIDGE_TOWN" if "Lavaridge Town" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_FORTREE_CITY" if "Fortree City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_LILYCOVE_CITY" if "Lilycove City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_MOSSDEEP_CITY" if "Mossdeep City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_SOOTOPOLIS_CITY" if "Sootopolis City" not in world.options.free_fly_blacklist else None,
"EVENT_VISITED_EVER_GRANDE_CITY" if "Ever Grande City" not in world.options.free_fly_blacklist else None,
]

free_fly_locations = [location for location in free_fly_locations if location is not None]
free_fly_locations = sorted(map(lambda city: BLACKLIST_OPTION_TO_VISITED_EVENT[city], world.options.free_fly_blacklist.value))
if free_fly_locations:
fly_location_name = world.random.choice(free_fly_locations)

Expand Down
3 changes: 1 addition & 2 deletions worlds/pokemon_emerald/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,7 @@ class FreeFlyLocation(Toggle):
class FreeFlyBlacklist(OptionSet):
"""
Disables specific locations as valid free fly locations.
Does nothing if Free Fly Location is set to false.
If all locations are disabled free fly location will be set to Littleroot Town.
Has no effect if Free Fly Location is disabled.
"""
display_name = "Free Fly Blacklist"
valid_keys = [
Expand Down

0 comments on commit d1cb5b6

Please sign in to comment.