Skip to content

Commit

Permalink
Fill: remove sweep_for_events(key_only=True) (ArchipelagoMW#2239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 authored Jul 27, 2024
1 parent 34141f8 commit b77805e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
8 changes: 3 additions & 5 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,13 @@ def can_reach_entrance(self, spot: str, player: int) -> bool:
def can_reach_region(self, spot: str, player: int) -> bool:
return self.multiworld.get_region(spot, player).can_reach(self)

def sweep_for_events(self, key_only: bool = False, locations: Optional[Iterable[Location]] = None) -> None:
def sweep_for_events(self, locations: Optional[Iterable[Location]] = None) -> None:
if locations is None:
locations = self.multiworld.get_filled_locations()
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.advancement and location not in self.events and
not key_only or getattr(location.item, "locked_dungeon_item", False)}
locations = {location for location in locations if location.advancement and location not in self.events}

while reachable_events:
reachable_events = {location for location in locations if location.can_reach(self)}
locations -= reachable_events
Expand Down Expand Up @@ -1291,8 +1291,6 @@ def create_playthrough(self, create_paths: bool = True) -> None:
state = CollectionState(multiworld)
collection_spheres = []
while required_locations:
state.sweep_for_events(key_only=True)

sphere = set(filter(state.can_reach, required_locations))

for location in sphere:
Expand Down
1 change: 0 additions & 1 deletion Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ def balance_multiworld_progression(multiworld: MultiWorld) -> None:

def get_sphere_locations(sphere_state: CollectionState,
locations: typing.Set[Location]) -> typing.Set[Location]:
sphere_state.sweep_for_events(key_only=True, locations=locations)
return {loc for loc in locations if sphere_state.can_reach(loc)}

def item_percentage(player: int, num: int) -> float:
Expand Down
4 changes: 0 additions & 4 deletions worlds/alttp/SubClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ def dungeon_item(self) -> Optional[str]:
if self.type in {"SmallKey", "BigKey", "Map", "Compass"}:
return self.type

@property
def locked_dungeon_item(self):
return self.location.locked and self.dungeon_item


class LTTPRegionType(IntEnum):
LightWorld = 1
Expand Down

0 comments on commit b77805e

Please sign in to comment.