Fill: remove sweep_for_events(key_only=True) (#2239)
This commit is contained in:
parent
34141f8de0
commit
b77805e5ee
|
@ -680,13 +680,13 @@ class CollectionState():
|
||||||
def can_reach_region(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)
|
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:
|
if locations is None:
|
||||||
locations = self.multiworld.get_filled_locations()
|
locations = self.multiworld.get_filled_locations()
|
||||||
reachable_events = True
|
reachable_events = True
|
||||||
# since the loop has a good chance to run more than once, only filter the events once
|
# 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
|
locations = {location for location in locations if location.advancement and location not in self.events}
|
||||||
not key_only or getattr(location.item, "locked_dungeon_item", False)}
|
|
||||||
while reachable_events:
|
while reachable_events:
|
||||||
reachable_events = {location for location in locations if location.can_reach(self)}
|
reachable_events = {location for location in locations if location.can_reach(self)}
|
||||||
locations -= reachable_events
|
locations -= reachable_events
|
||||||
|
@ -1291,8 +1291,6 @@ class Spoiler:
|
||||||
state = CollectionState(multiworld)
|
state = CollectionState(multiworld)
|
||||||
collection_spheres = []
|
collection_spheres = []
|
||||||
while required_locations:
|
while required_locations:
|
||||||
state.sweep_for_events(key_only=True)
|
|
||||||
|
|
||||||
sphere = set(filter(state.can_reach, required_locations))
|
sphere = set(filter(state.can_reach, required_locations))
|
||||||
|
|
||||||
for location in sphere:
|
for location in sphere:
|
||||||
|
|
1
Fill.py
1
Fill.py
|
@ -646,7 +646,6 @@ def balance_multiworld_progression(multiworld: MultiWorld) -> None:
|
||||||
|
|
||||||
def get_sphere_locations(sphere_state: CollectionState,
|
def get_sphere_locations(sphere_state: CollectionState,
|
||||||
locations: typing.Set[Location]) -> typing.Set[Location]:
|
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)}
|
return {loc for loc in locations if sphere_state.can_reach(loc)}
|
||||||
|
|
||||||
def item_percentage(player: int, num: int) -> float:
|
def item_percentage(player: int, num: int) -> float:
|
||||||
|
|
|
@ -76,10 +76,6 @@ class ALttPItem(Item):
|
||||||
if self.type in {"SmallKey", "BigKey", "Map", "Compass"}:
|
if self.type in {"SmallKey", "BigKey", "Map", "Compass"}:
|
||||||
return self.type
|
return self.type
|
||||||
|
|
||||||
@property
|
|
||||||
def locked_dungeon_item(self):
|
|
||||||
return self.location.locked and self.dungeon_item
|
|
||||||
|
|
||||||
|
|
||||||
class LTTPRegionType(IntEnum):
|
class LTTPRegionType(IntEnum):
|
||||||
LightWorld = 1
|
LightWorld = 1
|
||||||
|
|
Loading…
Reference in New Issue