From be550ff6fb6d8ca4832e0ba7401d069f6c88b3d4 Mon Sep 17 00:00:00 2001 From: Dinopony Date: Mon, 10 Mar 2025 16:35:58 +0100 Subject: [PATCH] Landstalker: Several small fixes (#4675) * Landstalker: Fixed duplicate entrance names when using the "No teleport tree requirements" option * Landstalker: Fixed more cases of duplicate entrance names when using "Shuffle Trees" with open trees * Landstalker: Fixed endgame locations being present in "Reach Kazalt" goal * Landstalker: Fixed Lithograph hint pointing at the wrong player * Landstalker: Updated docs to remove the link to Steam since game got delisted * Landstalker: Fixed high value hint_count rarely failing at generation * Landstalker: Fixed dynamic shop prices being potentially invalid in case of a progression balancing (changes by ExemptMedic) --- worlds/landstalker/Hints.py | 2 +- worlds/landstalker/__init__.py | 19 ++++++------------- .../landstalker/docs/landstalker_setup_en.md | 2 +- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/worlds/landstalker/Hints.py b/worlds/landstalker/Hints.py index 4211e0ef..366925c6 100644 --- a/worlds/landstalker/Hints.py +++ b/worlds/landstalker/Hints.py @@ -131,7 +131,7 @@ def generate_random_hints(world: "LandstalkerWorld"): hint_texts = list(set(hint_texts)) random.shuffle(hint_texts) - hint_count = world.options.hint_count.value + hint_count = min(world.options.hint_count.value, len(hint_texts)) del hint_texts[hint_count:] hint_source_names = [source["description"] for source in HINT_SOURCES_JSON if diff --git a/worlds/landstalker/__init__.py b/worlds/landstalker/__init__.py index cfdc335c..98172eb6 100644 --- a/worlds/landstalker/__init__.py +++ b/worlds/landstalker/__init__.py @@ -39,7 +39,7 @@ class LandstalkerWorld(World): item_name_to_id = build_item_name_to_id_table() location_name_to_id = build_location_name_to_id_table() - cached_spheres: List[Set[Location]] + cached_spheres: List[Set[Location]] = [] def __init__(self, multiworld, player): super().__init__(multiworld, player) @@ -48,9 +48,11 @@ class LandstalkerWorld(World): self.dark_region_ids = [] self.teleport_tree_pairs = [] self.jewel_items = [] - self.cached_spheres = [] def fill_slot_data(self) -> dict: + if not LandstalkerWorld.cached_spheres: + LandstalkerWorld.cached_spheres = list(self.multiworld.get_spheres()) + # Generate hints. self.adjust_shop_prices() hints = Hints.generate_random_hints(self) @@ -232,18 +234,9 @@ class LandstalkerWorld(World): else: return 4 - @classmethod - def stage_post_fill(cls, multiworld: MultiWorld): - # Cache spheres for hint calculation after fill completes. - cached_spheres = list(multiworld.get_spheres()) - for world in multiworld.get_game_worlds(cls.game): - world.cached_spheres = cached_spheres - @classmethod def stage_modify_multidata(cls, multiworld: MultiWorld, *_): - # Clean up all references in cached spheres after generation completes. - for world in multiworld.get_game_worlds(cls.game): - world.cached_spheres = [] + LandstalkerWorld.cached_spheres = [] def adjust_shop_prices(self): # Calculate prices for items in shops once all items have their final position @@ -254,7 +247,7 @@ class LandstalkerWorld(World): global_price_factor = self.options.shop_prices_factor / 100.0 - spheres = self.cached_spheres + spheres = LandstalkerWorld.cached_spheres sphere_count = len(spheres) for sphere_id, sphere in enumerate(spheres): location: LandstalkerLocation # after conditional, we guarantee it's this kind of location. diff --git a/worlds/landstalker/docs/landstalker_setup_en.md b/worlds/landstalker/docs/landstalker_setup_en.md index 30f85dd8..05cf35f8 100644 --- a/worlds/landstalker/docs/landstalker_setup_en.md +++ b/worlds/landstalker/docs/landstalker_setup_en.md @@ -6,7 +6,7 @@ - A compatible emulator to run the game - [RetroArch](https://retroarch.com?page=platforms) with the Genesis Plus GX core - [Bizhawk 2.9.1 (x64)](https://tasvideos.org/BizHawk/ReleaseHistory) with the Genesis Plus GX core -- Your legally obtained Landstalker US ROM file (which can be acquired on [Steam](https://store.steampowered.com/app/71118/Landstalker_The_Treasures_of_King_Nole/)) +- A Landstalker US ROM file dumped from the original cartridge ## Installation Instructions