Skip to content

Commit

Permalink
Core: add specific can_reach helpers to CollectionState (ArchipelagoM…
Browse files Browse the repository at this point in the history
  • Loading branch information
alwaysintreble authored and EmilyV99 committed Apr 15, 2024
1 parent 4973d7f commit 6736095
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,14 +717,23 @@ def can_reach(self,
assert isinstance(player, int), "can_reach: player is required if spot is str"
# try to resolve a name
if resolution_hint == 'Location':
spot = self.multiworld.get_location(spot, player)
return self.can_reach_location(spot, player)
elif resolution_hint == 'Entrance':
spot = self.multiworld.get_entrance(spot, player)
return self.can_reach_entrance(spot, player)
else:
# default to Region
spot = self.multiworld.get_region(spot, player)
return self.can_reach_region(spot, player)
return spot.can_reach(self)

def can_reach_location(self, spot: str, player: int) -> bool:
return self.multiworld.get_location(spot, player).can_reach(self)

def can_reach_entrance(self, spot: str, player: int) -> bool:
return self.multiworld.get_entrance(spot, player).can_reach(self)

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:
if locations is None:
locations = self.multiworld.get_filled_locations()
Expand Down

0 comments on commit 6736095

Please sign in to comment.