Landstalker: Fixed rare generation issues (#3353)

Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
This commit is contained in:
Dinopony 2024-06-01 13:39:57 +02:00 committed by GitHub
parent 97c9c5310b
commit 1e205f9d73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 4 deletions

View File

@ -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]

View File

@ -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)

View File

@ -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)

View File

@ -10,7 +10,7 @@ if TYPE_CHECKING:
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):

View File

@ -204,6 +204,9 @@ class LandstalkerWorld(World):
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