Skip to content

Commit

Permalink
Fix playthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi committed Sep 10, 2024
1 parent 430b71a commit 8d03e84
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,21 +1356,19 @@ def create_playthrough(self, create_paths: bool = True) -> None:

# in the second phase, we cull each sphere such that the game is still beatable,
# reducing each range of influence to the bare minimum required inside it
restore_later: Dict[Location, Item] = {}
required_locations = {location for sphere in collection_spheres for location in sphere}
for num, sphere in reversed(tuple(enumerate(collection_spheres))):
to_delete: Set[Location] = set()
for location in sphere:
# we remove the item at location and check if game is still beatable
# we remove the location from required_locations to sweep from, and check if the game is still beatable
logging.debug('Checking if %s (Player %d) is required to beat the game.', location.item.name,
location.item.player)
old_item = location.item
location.item = None
if multiworld.can_beat_game(state_cache[num]):
required_locations.remove(location)
if multiworld.can_beat_game(state_cache[num], required_locations):
to_delete.add(location)
restore_later[location] = old_item
else:
# still required, got to keep it around
location.item = old_item
required_locations.add(location)

# cull entries in spheres for spoiler walkthrough at end
sphere -= to_delete
Expand Down

0 comments on commit 8d03e84

Please sign in to comment.