Pokémon R/B: Door Shuffle fixes (#2314)

* Door shuffle fixes

* Add Rt 23's Victory Road exit door to list of unreachable outdoor entrances
This commit is contained in:
Alchav 2023-10-17 01:20:34 -04:00 committed by GitHub
parent e27aeac2e5
commit 13b68ecb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 12 deletions

View File

@ -795,7 +795,7 @@ location_data = [
LocationData("Pewter Gym", "Defeat Brock", "Defeat Brock", event=True), LocationData("Pewter Gym", "Defeat Brock", "Defeat Brock", event=True),
LocationData("Cerulean Gym", "Defeat Misty", "Defeat Misty", event=True), LocationData("Cerulean Gym", "Defeat Misty", "Defeat Misty", event=True),
LocationData("Vermilion Gym", "Defeat Lt. Surge", "Defeat Lt. Surge", event=True), LocationData("Vermilion Gym", "Defeat Lt. Surge", "Defeat Lt. Surge", event=True),
LocationData("Celadon Gym", "Defeat Erika", "Defeat Erika", event=True), LocationData("Celadon Gym-C", "Defeat Erika", "Defeat Erika", event=True),
LocationData("Fuchsia Gym", "Defeat Koga", "Defeat Koga", event=True), LocationData("Fuchsia Gym", "Defeat Koga", "Defeat Koga", event=True),
LocationData("Cinnabar Gym", "Defeat Blaine", "Defeat Blaine", event=True), LocationData("Cinnabar Gym", "Defeat Blaine", "Defeat Blaine", event=True),
LocationData("Saffron Gym-C", "Defeat Sabrina", "Defeat Sabrina", event=True), LocationData("Saffron Gym-C", "Defeat Sabrina", "Defeat Sabrina", event=True),

View File

@ -1456,7 +1456,9 @@ mansion_stair_destinations = [
unreachable_outdoor_entrances = [ unreachable_outdoor_entrances = [
"Route 4-C to Mt Moon B1F-NE", "Route 4-C to Mt Moon B1F-NE",
"Fuchsia City-Good Rod House Backyard to Fuchsia Good Rod House", "Fuchsia City-Good Rod House Backyard to Fuchsia Good Rod House",
"Cerulean City-Badge House Backyard to Cerulean Badge House" "Cerulean City-Badge House Backyard to Cerulean Badge House",
# TODO: This doesn't need to be forced if fly location is Pokemon League?
"Route 23-N to Victory Road 2F-E"
] ]
@ -2220,7 +2222,7 @@ def create_regions(self):
"Cinnabar Gym - Blaine Prize", "Viridian Gym - Giovanni Prize"]: "Cinnabar Gym - Blaine Prize", "Viridian Gym - Giovanni Prize"]:
badge_locs.append(multiworld.get_location(loc, player)) badge_locs.append(multiworld.get_location(loc, player))
multiworld.random.shuffle(badges) multiworld.random.shuffle(badges)
while badges[3].name == "Cascade Badge" and multiworld.badges_needed_for_hm_moves[player] == "on": while badges[3].name == "Cascade Badge" and multiworld.badges_needed_for_hm_moves[player]:
multiworld.random.shuffle(badges) multiworld.random.shuffle(badges)
for badge, loc in zip(badges, badge_locs): for badge, loc in zip(badges, badge_locs):
loc.place_locked_item(badge) loc.place_locked_item(badge)
@ -2266,10 +2268,10 @@ def create_regions(self):
] ]
def adds_reachable_entrances(entrances_copy, item): def adds_reachable_entrances(entrances_copy, item):
state.collect(item, False) state_copy = state.copy()
state_copy.collect(item, False)
ret = len([entrance for entrance in entrances_copy if entrance in reachable_entrances or ret = len([entrance for entrance in entrances_copy if entrance in reachable_entrances or
entrance.parent_region.can_reach(state)]) > len(reachable_entrances) entrance.parent_region.can_reach(state_copy)]) > len(reachable_entrances)
state.remove(item)
return ret return ret
def dead_end(entrances_copy, e): def dead_end(entrances_copy, e):
@ -2304,9 +2306,16 @@ def create_regions(self):
starting_entrances = len(entrances) starting_entrances = len(entrances)
dc_connected = [] dc_connected = []
event_locations = self.multiworld.get_filled_locations(player) event_locations = self.multiworld.get_filled_locations(player)
rock_tunnel_entrances = [entrance for entrance in entrances if "Rock Tunnel" in entrance.name]
entrances = [entrance for entrance in entrances if entrance not in rock_tunnel_entrances]
while entrances: while entrances:
state.update_reachable_regions(player) state.update_reachable_regions(player)
state.sweep_for_events(locations=event_locations) state.sweep_for_events(locations=event_locations)
if rock_tunnel_entrances and logic.rock_tunnel(state, player):
entrances += rock_tunnel_entrances
rock_tunnel_entrances = None
reachable_entrances = [entrance for entrance in entrances if entrance in reachable_entrances or reachable_entrances = [entrance for entrance in entrances if entrance in reachable_entrances or
entrance.parent_region.can_reach(state)] entrance.parent_region.can_reach(state)]
assert reachable_entrances, \ assert reachable_entrances, \
@ -2328,12 +2337,8 @@ def create_regions(self):
# entrances list is empty while it's being sorted, must pass a copy to iterate through # entrances list is empty while it's being sorted, must pass a copy to iterate through
entrances_copy = entrances.copy() entrances_copy = entrances.copy()
if multiworld.door_shuffle[player] == "decoupled": if multiworld.door_shuffle[player] == "decoupled":
if len(reachable_entrances) <= 8 and not logic.rock_tunnel(state, player): entrances.sort(key=lambda e: 1 if e.connected_region is not None else 2 if e not in
entrances.sort(key=lambda e: 1 if "Rock Tunnel" in e.name else 2 if e.connected_region is not reachable_entrances else 0)
None else 3 if e not in reachable_entrances else 0)
else:
entrances.sort(key=lambda e: 1 if e.connected_region is not None else 2 if e not in
reachable_entrances else 0)
assert entrances[0].connected_region is None,\ assert entrances[0].connected_region is None,\
"Ran out of valid reachable entrances in Pokemon Red and Blue door shuffle" "Ran out of valid reachable entrances in Pokemon Red and Blue door shuffle"
elif len(reachable_entrances) > (1 if multiworld.door_shuffle[player] == "insanity" else 8) and len( elif len(reachable_entrances) > (1 if multiworld.door_shuffle[player] == "insanity" else 8) and len(