TUNIC: Make the local_fill option load in a specific number of locations (#4488)

* Make it load in a specific number of locations

* TunicLocation -> Location

* Actually shuffle the list
This commit is contained in:
Scipio Wright 2025-01-16 21:13:37 -05:00 committed by GitHub
parent 90f80ce1c1
commit 2e4f5a64b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 5 deletions

View File

@ -95,7 +95,7 @@ class TunicWorld(World):
# for the local_fill option
fill_items: List[TunicItem]
fill_locations: List[TunicLocation]
fill_locations: List[Location]
amount_to_local_fill: int
# so we only loop the multiworld locations once
@ -394,8 +394,6 @@ class TunicWorld(World):
self.multiworld.itempool += tunic_items
def pre_fill(self) -> None:
self.fill_locations = []
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
reserved_locations: Set[str] = set(self.random.sample(sphere_one, 2))
@ -406,8 +404,8 @@ class TunicWorld(World):
if len(viable_locations) < self.amount_to_local_fill:
raise OptionError(f"TUNIC: Not enough locations for local_fill option for {self.player_name}. "
f"This is likely due to excess plando or priority locations.")
self.fill_locations += viable_locations
self.random.shuffle(viable_locations)
self.fill_locations = viable_locations[:self.amount_to_local_fill]
@classmethod
def stage_pre_fill(cls, multiworld: MultiWorld) -> None: