Merge branch 'main' into civ6-1.0

This commit is contained in:
Carter Hesterman
2024-08-22 20:05:27 -06:00
committed by GitHub
20 changed files with 77 additions and 72 deletions

View File

@@ -248,7 +248,7 @@ def fill_dungeons_restrictive(multiworld: MultiWorld):
pass
for item in pre_fill_items:
multiworld.worlds[item.player].collect(all_state_base, item)
all_state_base.sweep_for_events()
all_state_base.sweep_for_advancements()
# Remove completion condition so that minimal-accessibility worlds place keys properly
for player in {item.player for item in in_dungeon_items}:
@@ -262,8 +262,8 @@ def fill_dungeons_restrictive(multiworld: MultiWorld):
all_state_base.remove(item_factory(key_data[3], multiworld.worlds[player]))
loc = multiworld.get_location(key_loc, player)
if loc in all_state_base.events:
all_state_base.events.remove(loc)
if loc in all_state_base.advancements:
all_state_base.advancements.remove(loc)
fill_restrictive(multiworld, all_state_base, locations, in_dungeon_items, lock=True, allow_excluded=True,
name="LttP Dungeon Items")

View File

@@ -682,7 +682,7 @@ def get_pool_core(world, player: int):
if 'triforce_hunt' in goal:
if world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_extra:
treasure_hunt_total = (world.triforce_pieces_available[player].value
treasure_hunt_total = (world.triforce_pieces_required[player].value
+ world.triforce_pieces_extra[player].value)
elif world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_percentage:
percentage = float(world.triforce_pieces_percentage[player].value) / 100

View File

@@ -54,7 +54,7 @@ class TestDungeon(LTTPTestBase):
for item in items:
item.classification = ItemClassification.progression
state.collect(item, prevent_sweep=True) # prevent_sweep=True prevents running sweep_for_events() and picking up
state.sweep_for_events() # key drop keys repeatedly
state.collect(item, prevent_sweep=True) # prevent_sweep=True prevents running sweep_for_advancements() and picking up
state.sweep_for_advancements() # key drop keys repeatedly
self.assertEqual(self.multiworld.get_location(location, 1).can_reach(state), access, f"failed {self.multiworld.get_location(location, 1)} with: {item_pool}")

View File

@@ -85,7 +85,7 @@ class LingoWorld(World):
state.collect(self.create_item(self.player_logic.forced_good_item), True)
all_locations = self.multiworld.get_locations(self.player)
state.sweep_for_events(locations=all_locations)
state.sweep_for_advancements(locations=all_locations)
unreachable_locations = [location for location in all_locations
if not state.can_reach_location(location.name, self.player)]

View File

@@ -445,7 +445,7 @@ def shuffle_random_entrances(ootworld):
# Gather locations to keep reachable for validation
all_state = ootworld.get_state_with_complete_itempool()
all_state.sweep_for_events(locations=ootworld.get_locations())
all_state.sweep_for_advancements(locations=ootworld.get_locations())
locations_to_ensure_reachable = {loc for loc in world.get_reachable_locations(all_state, player) if not (loc.type == 'Drop' or (loc.type == 'Event' and 'Subrule' in loc.name))}
# Set entrance data for all entrances
@@ -791,8 +791,8 @@ def validate_world(ootworld, entrance_placed, locations_to_ensure_reachable, all
all_state = all_state_orig.copy()
none_state = none_state_orig.copy()
all_state.sweep_for_events(locations=ootworld.get_locations())
none_state.sweep_for_events(locations=ootworld.get_locations())
all_state.sweep_for_advancements(locations=ootworld.get_locations())
none_state.sweep_for_advancements(locations=ootworld.get_locations())
if ootworld.shuffle_interior_entrances or ootworld.shuffle_overworld_entrances or ootworld.spawn_positions:
time_travel_state = none_state.copy()

View File

@@ -228,7 +228,7 @@ def set_shop_rules(ootworld):
def set_entrances_based_rules(ootworld):
all_state = ootworld.get_state_with_complete_itempool()
all_state.sweep_for_events(locations=ootworld.get_locations())
all_state.sweep_for_advancements(locations=ootworld.get_locations())
for location in filter(lambda location: location.type == 'Shop', ootworld.get_locations()):
# If a shop is not reachable as adult, it can't have Goron Tunic or Zora Tunic as child can't buy these

View File

@@ -847,7 +847,7 @@ class OOTWorld(World):
# Make sure to only kill actual internal events, not in-game "events"
all_state = self.get_state_with_complete_itempool()
all_locations = self.get_locations()
all_state.sweep_for_events(locations=all_locations)
all_state.sweep_for_advancements(locations=all_locations)
reachable = self.multiworld.get_reachable_locations(all_state, self.player)
unreachable = [loc for loc in all_locations if
(loc.internal or loc.type == 'Drop') and loc.address is None and loc.locked and loc not in reachable]
@@ -875,7 +875,7 @@ class OOTWorld(World):
state = base_state.copy()
for item in self.get_pre_fill_items():
self.collect(state, item)
state.sweep_for_events(locations=self.get_locations())
state.sweep_for_advancements(locations=self.get_locations())
return state
# Prefill shops, songs, and dungeon items
@@ -887,7 +887,7 @@ class OOTWorld(World):
state = CollectionState(self.multiworld)
for item in self.itempool:
self.collect(state, item)
state.sweep_for_events(locations=self.get_locations())
state.sweep_for_advancements(locations=self.get_locations())
# Place dungeon items
special_fill_types = ['GanonBossKey', 'BossKey', 'SmallKey', 'HideoutSmallKey', 'Map', 'Compass']

View File

@@ -56,8 +56,8 @@ class OSRSWorld(World):
locations_by_category: typing.Dict[str, typing.List[LocationRow]]
def __init__(self, world: MultiWorld, player: int):
super().__init__(world, player)
def __init__(self, multiworld: MultiWorld, player: int):
super().__init__(multiworld, player)
self.region_name_to_data = {}
self.location_name_to_data = {}

View File

@@ -296,7 +296,7 @@ class PokemonRedBlueWorld(World):
if attempt > 1:
for mon in poke_data.pokemon_data.keys():
state.collect(self.create_item(mon), True)
state.sweep_for_events()
state.sweep_for_advancements()
self.multiworld.random.shuffle(badges)
self.multiworld.random.shuffle(badgelocs)
badgelocs_copy = badgelocs.copy()

View File

@@ -2439,7 +2439,7 @@ def door_shuffle(world, multiworld, player, badges, badge_locs):
state_copy = state.copy()
state_copy.collect(item, True)
state.sweep_for_events(locations=event_locations)
state.sweep_for_advancements(locations=event_locations)
new_reachable_entrances = len([entrance for entrance in entrances if entrance in reachable_entrances or
entrance.parent_region.can_reach(state_copy)])
return new_reachable_entrances > len(reachable_entrances)
@@ -2480,7 +2480,7 @@ def door_shuffle(world, multiworld, player, badges, badge_locs):
while entrances:
state.update_reachable_regions(player)
state.sweep_for_events(locations=event_locations)
state.sweep_for_advancements(locations=event_locations)
multiworld.random.shuffle(entrances)

View File

@@ -90,7 +90,7 @@ class WitnessWorld(World):
"laser_ids_to_hints": self.laser_ids_to_hints,
"progressive_item_lists": self.player_items.get_progressive_item_ids_in_pool(),
"obelisk_side_id_to_EPs": static_witness_logic.OBELISK_SIDE_ID_TO_EP_HEXES,
"precompleted_puzzles": [int(h, 16) for h in self.player_logic.EXCLUDED_LOCATIONS],
"precompleted_puzzles": [int(h, 16) for h in self.player_logic.EXCLUDED_ENTITIES],
"entity_to_name": static_witness_logic.ENTITY_ID_TO_NAME,
"panel_hunt_required_absolute": self.panel_hunt_required_count
}
@@ -219,7 +219,7 @@ class WitnessWorld(World):
# Only sweeps for events because having this behavior be random based on Tutorial Gate would be strange.
state = CollectionState(self.multiworld)
state.sweep_for_events(locations=event_locations)
state.sweep_for_advancements(locations=event_locations)
num_early_locs = sum(1 for loc in self.multiworld.get_reachable_locations(state, self.player) if loc.address)

View File

@@ -77,6 +77,7 @@ class EntityHuntPicker:
return (
self.player_logic.solvability_guaranteed(panel_hex)
and panel_hex not in self.player_logic.EXCLUDED_ENTITIES
and not (
# Due to an edge case, Discards have to be on in disable_non_randomized even if Discard Shuffle is off.
# However, I don't think they should be hunt panels in this case.

View File

@@ -44,7 +44,7 @@ class WitnessPlayerLocations:
self.CHECK_LOCATIONS = self.CHECK_LOCATIONS - {
static_witness_logic.ENTITIES_BY_HEX[entity_hex]["checkName"]
for entity_hex in player_logic.COMPLETELY_DISABLED_ENTITIES | player_logic.PRECOMPLETED_LOCATIONS
for entity_hex in player_logic.COMPLETELY_DISABLED_ENTITIES
}
self.CHECK_PANELHEX_TO_ID = {

View File

@@ -108,8 +108,7 @@ class WitnessPlayerLogic:
self.EVENT_ITEM_PAIRS: Dict[str, Tuple[str, str]] = {}
self.COMPLETELY_DISABLED_ENTITIES: Set[str] = set()
self.DISABLE_EVERYTHING_BEHIND: Set[str] = set()
self.PRECOMPLETED_LOCATIONS: Set[str] = set()
self.EXCLUDED_LOCATIONS: Set[str] = set()
self.EXCLUDED_ENTITIES: Set[str] = set()
self.ADDED_CHECKS: Set[str] = set()
self.VICTORY_LOCATION = "0x0356B"
@@ -659,7 +658,7 @@ class WitnessPlayerLogic:
self.COMPLETELY_DISABLED_ENTITIES.add(loc_obj["entity_hex"])
elif loc_obj["entityType"] == "Panel":
self.EXCLUDED_LOCATIONS.add(loc_obj["entity_hex"])
self.EXCLUDED_ENTITIES.add(loc_obj["entity_hex"])
for adjustment_lineset in adjustment_linesets_in_order:
current_adjustment_type = None

View File

@@ -23,7 +23,7 @@ class TestMaxPanelHuntMinChecks(WitnessTestBase):
for _ in range(100):
state_100.collect(panel_hunt_item, True)
state_100.sweep_for_events([self.world.get_location("Tutorial Gate Open Solved")])
state_100.sweep_for_advancements([self.world.get_location("Tutorial Gate Open Solved")])
self.assertTrue(self.multiworld.completion_condition[self.player](state_100))
@@ -33,7 +33,7 @@ class TestMaxPanelHuntMinChecks(WitnessTestBase):
for _ in range(99):
state_99.collect(panel_hunt_item, True)
state_99.sweep_for_events([self.world.get_location("Tutorial Gate Open Solved")])
state_99.sweep_for_advancements([self.world.get_location("Tutorial Gate Open Solved")])
self.assertFalse(self.multiworld.completion_condition[self.player](state_99))