TUNIC: More varied reserved locations for local_fill option (#4653)

* Make reserved locations more varied

* Use CollectionState(self.multiworld) instead of whatever it used to be
This commit is contained in:
Scipio Wright
2025-04-21 17:41:20 -04:00
committed by GitHub
parent d309de2557
commit 57d3c52df9
2 changed files with 4 additions and 20 deletions

View File

@@ -3,7 +3,7 @@ from logging import warning
from BaseClasses import Region, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState from BaseClasses import Region, Location, Item, Tutorial, ItemClassification, MultiWorld, CollectionState
from .items import (item_name_to_id, item_table, item_name_groups, fool_tiers, filler_items, slot_data_item_names, from .items import (item_name_to_id, item_table, item_name_groups, fool_tiers, filler_items, slot_data_item_names,
combat_items) combat_items)
from .locations import location_table, location_name_groups, standard_location_name_to_id, hexagon_locations, sphere_one from .locations import location_table, location_name_groups, standard_location_name_to_id, hexagon_locations
from .rules import set_location_rules, set_region_rules, randomize_ability_unlocks, gold_hexagon from .rules import set_location_rules, set_region_rules, randomize_ability_unlocks, gold_hexagon
from .er_rules import set_er_location_rules from .er_rules import set_er_location_rules
from .regions import tunic_regions from .regions import tunic_regions
@@ -451,9 +451,10 @@ class TunicWorld(World):
def pre_fill(self) -> None: def pre_fill(self) -> None:
if self.options.local_fill > 0 and self.multiworld.players > 1: if self.options.local_fill > 0 and self.multiworld.players > 1:
# we need to reserve a couple locations so that we don't fill up every sphere 1 location # we need to reserve a couple locations so that we don't fill up every sphere 1 location
reserved_locations: Set[str] = set(self.random.sample(sphere_one, 2)) sphere_one_locs = self.multiworld.get_reachable_locations(CollectionState(self.multiworld), self.player)
reserved_locations: Set[Location] = set(self.random.sample(sphere_one_locs, 2))
viable_locations = [loc for loc in self.multiworld.get_unfilled_locations(self.player) viable_locations = [loc for loc in self.multiworld.get_unfilled_locations(self.player)
if loc.name not in reserved_locations if loc not in reserved_locations
and loc.name not in self.options.priority_locations.value] and loc.name not in self.options.priority_locations.value]
if len(viable_locations) < self.amount_to_local_fill: if len(viable_locations) < self.amount_to_local_fill:

View File

@@ -322,23 +322,6 @@ hexagon_locations: Dict[str, str] = {
"Blue Questagon": "Rooted Ziggurat Lower - Hexagon Blue", "Blue Questagon": "Rooted Ziggurat Lower - Hexagon Blue",
} }
sphere_one: List[str] = [
"Overworld - [Central] Chest Across From Well",
"Overworld - [Northwest] Chest Near Quarry Gate",
"Overworld - [Northwest] Shadowy Corner Chest",
"Overworld - [Southwest] Chest Guarded By Turret",
"Overworld - [Southwest] South Chest Near Guard",
"Overworld - [Southwest] Obscured in Tunnel to Beach",
"Overworld - [Northwest] Chest Near Turret",
"Overworld - [Northwest] Page By Well",
"Overworld - [West] Chest Behind Moss Wall",
"Overworld - [Southwest] Key Pickup",
"Overworld - [West] Key Pickup",
"Overworld - [West] Obscured Behind Windmill",
"Overworld - [West] Obscured Near Well",
"Overworld - [West] Page On Teleporter"
]
standard_location_name_to_id: Dict[str, int] = {name: location_base_id + index for index, name in enumerate(location_table)} standard_location_name_to_id: Dict[str, int] = {name: location_base_id + index for index, name in enumerate(location_table)}
all_locations = location_table.copy() all_locations = location_table.copy()