mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
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:
@@ -95,7 +95,7 @@ class TunicWorld(World):
|
|||||||
|
|
||||||
# for the local_fill option
|
# for the local_fill option
|
||||||
fill_items: List[TunicItem]
|
fill_items: List[TunicItem]
|
||||||
fill_locations: List[TunicLocation]
|
fill_locations: List[Location]
|
||||||
amount_to_local_fill: int
|
amount_to_local_fill: int
|
||||||
|
|
||||||
# so we only loop the multiworld locations once
|
# so we only loop the multiworld locations once
|
||||||
@@ -394,8 +394,6 @@ class TunicWorld(World):
|
|||||||
self.multiworld.itempool += tunic_items
|
self.multiworld.itempool += tunic_items
|
||||||
|
|
||||||
def pre_fill(self) -> None:
|
def pre_fill(self) -> None:
|
||||||
self.fill_locations = []
|
|
||||||
|
|
||||||
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))
|
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:
|
if len(viable_locations) < self.amount_to_local_fill:
|
||||||
raise OptionError(f"TUNIC: Not enough locations for local_fill option for {self.player_name}. "
|
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.")
|
f"This is likely due to excess plando or priority locations.")
|
||||||
|
self.random.shuffle(viable_locations)
|
||||||
self.fill_locations += viable_locations
|
self.fill_locations = viable_locations[:self.amount_to_local_fill]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def stage_pre_fill(cls, multiworld: MultiWorld) -> None:
|
def stage_pre_fill(cls, multiworld: MultiWorld) -> None:
|
||||||
|
Reference in New Issue
Block a user