Skip to content

Commit

Permalink
Allow to generate even if there's not enough locations for all the re…
Browse files Browse the repository at this point in the history
…quired items.

Any excess items will be available from start.
  • Loading branch information
Ziktofel committed Oct 5, 2023
1 parent 1c72083 commit f92a7c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion worlds/sc2wol/PoolFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ def attempt_removal(item: Item) -> bool:

while len(inventory) + len(locked_items) > inventory_size:
if len(inventory) == 0:
raise Exception("Reduced item pool generation failed - not enough locations available to place items.")
# There are more items than locations and all of them are already locked due to YAML or logic.
# Random items from locked ones will go to starting items
self.multiworld.random.shuffle(locked_items)
while len(locked_items) > inventory_size:
item: Item = locked_items.pop()
self.multiworld.push_precollected(item)
break
# Select random item from removable items
item = self.multiworld.random.choice(inventory)
# Cascade removals to associated items
Expand Down

0 comments on commit f92a7c1

Please sign in to comment.