diff --git a/BaseClasses.py b/BaseClasses.py index d32749f5..d91be28c 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -689,14 +689,14 @@ class CollectionState(): def sweep_for_events(self, key_only: bool = False, locations: Optional[Iterable[Location]] = None) -> None: if locations is None: locations = self.world.get_filled_locations() - new_locations = True + reachable_events = True # since the loop has a good chance to run more than once, only filter the events once locations = {location for location in locations if location.event and not key_only or getattr(location.item, "locked_dungeon_item", False)} - while new_locations: + while reachable_events: reachable_events = {location for location in locations if location.can_reach(self)} - new_locations = reachable_events - self.events - for event in new_locations: + locations -= reachable_events + for event in reachable_events: self.events.add(event) assert isinstance(event.item, Item), "tried to collect Event with no Item" self.collect(event.item, True, event)