diff --git a/worlds/landstalker/Hints.py b/worlds/landstalker/Hints.py index 93274f1d68bb..5309e85032ea 100644 --- a/worlds/landstalker/Hints.py +++ b/worlds/landstalker/Hints.py @@ -30,6 +30,9 @@ def generate_lithograph_hint(world: "LandstalkerWorld"): jewel_items = world.jewel_items for item in jewel_items: + if item.location is None: + continue + # Jewel hints are composed of 4 'words' shuffled randomly: # - the name of the player whose world contains said jewel (if not ours) # - the color of the jewel (if relevant) @@ -61,7 +64,7 @@ def generate_random_hints(world: "LandstalkerWorld"): excluded_items = ["Life Stock", "EkeEke"] progression_items = [item for item in multiworld.itempool if item.advancement and - item.name not in excluded_items] + item.name not in excluded_items and item.location is not None] local_own_progression_items = [item for item in progression_items if item.player == this_player and item.location.player == this_player] diff --git a/worlds/landstalker/Locations.py b/worlds/landstalker/Locations.py index 5e42fbecda72..b0148269eab3 100644 --- a/worlds/landstalker/Locations.py +++ b/worlds/landstalker/Locations.py @@ -1,8 +1,9 @@ from typing import Dict, Optional -from BaseClasses import Location +from BaseClasses import Location, ItemClassification, Item from .Regions import LandstalkerRegion from .data.item_source import ITEM_SOURCES_JSON +from .data.world_path import WORLD_PATHS_JSON BASE_LOCATION_ID = 4000 BASE_GROUND_LOCATION_ID = BASE_LOCATION_ID + 256 @@ -28,6 +29,18 @@ def create_locations(player: int, regions_table: Dict[str, LandstalkerRegion], n new_location = LandstalkerLocation(player, data["name"], name_to_id_table[data["name"]], region, data["type"]) region.locations.append(new_location) + # Create fake event locations that will be used to determine if some key regions has been visited + regions_with_entrance_checks = [] + for data in WORLD_PATHS_JSON: + if "requiredNodes" in data: + regions_with_entrance_checks.extend([region_id for region_id in data["requiredNodes"]]) + regions_with_entrance_checks = list(set(regions_with_entrance_checks)) + for region_id in regions_with_entrance_checks: + region = regions_table[region_id] + location = LandstalkerLocation(player, 'event_visited_' + region_id, None, region, "event") + location.place_locked_item(Item("event_visited_" + region_id, ItemClassification.progression, None, player)) + region.locations.append(location) + # Create a specific end location that will contain a fake win-condition item end_location = LandstalkerLocation(player, "End", None, regions_table["end"], "reward") regions_table["end"].locations.append(end_location) diff --git a/worlds/landstalker/Regions.py b/worlds/landstalker/Regions.py index 21704194f157..27e5e2e993d0 100644 --- a/worlds/landstalker/Regions.py +++ b/worlds/landstalker/Regions.py @@ -37,7 +37,7 @@ def create_regions(world: "LandstalkerWorld"): for code, region_data in WORLD_NODES_JSON.items(): random_hint_name = None if "hints" in region_data: - random_hint_name = multiworld.random.choice(region_data["hints"]) + random_hint_name = world.random.choice(region_data["hints"]) region = LandstalkerRegion(code, region_data["name"], player, multiworld, random_hint_name) regions_table[code] = region multiworld.regions.append(region) diff --git a/worlds/landstalker/Rules.py b/worlds/landstalker/Rules.py index 51357c9480b0..94171944d7b2 100644 --- a/worlds/landstalker/Rules.py +++ b/worlds/landstalker/Rules.py @@ -10,7 +10,7 @@ def _landstalker_has_visited_regions(state: CollectionState, player: int, regions): - return all([state.can_reach(region, None, player) for region in regions]) + return all(state.has("event_visited_" + region.code, player) for region in regions) def _landstalker_has_health(state: CollectionState, player: int, health): diff --git a/worlds/landstalker/__init__.py b/worlds/landstalker/__init__.py index baa1deb620a4..2b3dc41239c3 100644 --- a/worlds/landstalker/__init__.py +++ b/worlds/landstalker/__init__.py @@ -204,6 +204,9 @@ def set_rules(self): for location in self.multiworld.get_locations(self.player): if location.parent_region.name in excluded_regions: location.progress_type = LocationProgressType.EXCLUDED + # We need to make that event non-progression since it would crash generation in reach_kazalt goal + if location.item is not None and location.item.name == "event_visited_king_nole_labyrinth_raft_entrance": + location.item.classification = ItemClassification.filler def get_starting_health(self): spawn_id = self.options.spawn_region.current_key