From e04d5e6fbe701fce326eb1ef77eebbba2890c14a Mon Sep 17 00:00:00 2001 From: Adam Heinermann Date: Tue, 13 Dec 2022 18:48:52 -0800 Subject: [PATCH] Limit the generation of chest locations --- worlds/noita/Events.py | 2 +- worlds/noita/Locations.py | 2 ++ worlds/noita/Regions.py | 26 ++++++++++++++++---------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/worlds/noita/Events.py b/worlds/noita/Events.py index adca36339a7a..d253f11ce38c 100644 --- a/worlds/noita/Events.py +++ b/worlds/noita/Events.py @@ -27,7 +27,7 @@ def create_victory_events(world: MultiWorld, player: int) -> None: def create_chest_events(world: MultiWorld, player: int) -> None: - total_locations = world.total_locations[player].value + total_locations = world.total_locations[player].value - Locations.num_static_locations # Iterates all our generated chests and makes sure that they are accessible in a specific # logical order (?) TODO: Revisit and confirm this diff --git a/worlds/noita/Locations.py b/worlds/noita/Locations.py index 84d8c808e456..10b4508f183e 100644 --- a/worlds/noita/Locations.py +++ b/worlds/noita/Locations.py @@ -68,6 +68,8 @@ class NoitaLocation(Location): } } +num_static_locations = sum([len(locs) for locs in location_region_mapping.values()]) - TotalLocations.range_end + location_name_to_id: Dict[str, int] = {} for location_group in location_region_mapping.values(): location_name_to_id.update(location_group) diff --git a/worlds/noita/Regions.py b/worlds/noita/Regions.py index 9cb5d16bdcc2..9f6aa32cc6b9 100644 --- a/worlds/noita/Regions.py +++ b/worlds/noita/Regions.py @@ -2,7 +2,7 @@ import itertools from typing import Dict, List, Set from BaseClasses import Region, Entrance, LocationProgressType, RegionType, MultiWorld -from . import Locations +from . import Locations, Items # Creates a new Region with the locations found in `location_region_mapping` @@ -10,17 +10,23 @@ def create_region(world: MultiWorld, player: int, region_name: str) -> Region: new_region = Region(region_name, RegionType.Generic, region_name, player, world) - # Here we create and assign locations to the region - for location_name, location_id in Locations.location_region_mapping.get(region_name, {}).items(): - location = Locations.NoitaLocation(player, location_name, location_id, new_region) + # Chests hack, don't add more locations than we requested + if region_name == "Forest": + total_locations = world.total_locations[player].value - Locations.num_static_locations - # TODO this is a hack. - # If it's not the region with all the shitty chests, increases the priority of important items. - # This way people know they can find their items by checking fixed locations instead of leaving it up to chance. - if region_name != "Forest": - location.progress_type = LocationProgressType.PRIORITY + for i in range(total_locations): + location_name = f"Chest{i+1}" + location_id = 110000+i - new_region.locations.append(location) + location = Locations.NoitaLocation(player, location_name, location_id, new_region) + location.progress_type = LocationProgressType.EXCLUDED + + new_region.locations.append(location) + else: + # Here we create and assign locations to the region + for location_name, location_id in Locations.location_region_mapping.get(region_name, {}).items(): + location = Locations.NoitaLocation(player, location_name, location_id, new_region) + new_region.locations.append(location) return new_region