some cleanup

This commit is contained in:
alwaysintreble
2024-03-06 17:37:38 -06:00
parent 89f8f0ff1f
commit f885dc7aff
2 changed files with 10 additions and 17 deletions

View File

@@ -67,7 +67,6 @@ class MultiWorld():
state: CollectionState
plando_options: PlandoOptions
accessibility: Dict[int, Options.Accessibility]
early_items: Dict[int, Dict[str, int]]
local_early_items: Dict[int, Dict[str, int]]
local_items: Dict[int, Options.LocalItems]
@@ -578,26 +577,20 @@ class MultiWorld():
"items": set(),
"full": set()
}
for player, access in self.accessibility.items():
players[access.current_key].add(player)
for player, world in self.worlds.items():
players[world.options.accessibility.current_key].add(player)
beatable_fulfilled = False
def location_condition(location: Location):
def location_condition(location: Location) -> bool:
"""Determine if this location has to be accessible, location is already filtered by location_relevant"""
if location.player in players["locations"] or (location.item and location.item.player not in
players["minimal"]):
return True
return False
return location.player in players["full"] or \
(location.item and location.item.player not in players["minimal"])
def location_relevant(location: Location):
def location_relevant(location: Location) -> bool:
"""Determine if this location is relevant to sweep."""
if __debug__ \
and location.progress_type != LocationProgressType.EXCLUDED \
and (location.player in players["full"] or location.event
or (location.item and location.item.advancement)):
return True
return False
return location.progress_type != LocationProgressType.EXCLUDED \
and (location.player in players["full"] or location.event)
def all_done() -> bool:
"""Check if all access rules are fulfilled"""
@@ -1234,7 +1227,7 @@ class Spoiler:
logging.debug('The following items could not be reached: %s', ['%s (Player %d) at %s (Player %d)' % (
location.item.name, location.item.player, location.name, location.player) for location in
sphere_candidates])
if any([multiworld.accessibility[location.item.player] != 'minimal' for location in sphere_candidates]):
if any([multiworld.worlds[location.item.player].options.accessibility != 'minimal' for location in sphere_candidates]):
raise RuntimeError(f'Not all progression items reachable ({sphere_candidates}). '
f'Something went terribly wrong here.')
else:

View File

@@ -219,7 +219,7 @@ def stage_set_rules(multiworld):
multiworld.accessibility[player] == "minimal"]) * 3):
for player in no_enemies_players:
for location in vendor_locations:
if multiworld.accessibility[player] == "locations":
if multiworld.accessibility[player] == "full":
multiworld.get_location(location, player).progress_type = LocationProgressType.EXCLUDED
else:
multiworld.get_location(location, player).access_rule = lambda state: False