Skip to content

Commit c3880e0

Browse files
authored
Count hook precollected items too (#167)
* include hook precollected items in counts * remove duplicate copies created by yaml options from count * small tweaks * small tweak * disable the exception precol removal when using UT
1 parent 896ab46 commit c3880e0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,18 @@ def stringCheck(string: str) -> ItemClassification:
257257
# then will remove specific item placements below from the overall pool
258258
self.multiworld.itempool += pool
259259

260-
real_pool = pool + items_started
260+
# Filter Precollected items for those not in logic aka created by start_inventory(_from_pool)
261+
precollected_items = list(self.multiworld.precollected_items[self.player])
262+
263+
# UT doesn't precollect the exceptions so this can be skipped
264+
if not hasattr(self.multiworld, "generation_is_fake"):
265+
precollected_exceptions = self.options.start_inventory.value + self.options.start_inventory_from_pool.value # type: ignore
266+
for item, count in precollected_exceptions.items():
267+
items_iter = iter([i for i in precollected_items if i.name == item])
268+
for _ in range(count):
269+
precollected_items.remove(next(items_iter))
270+
271+
real_pool = pool + precollected_items
261272
self.item_counts[self.player] = self.get_item_counts(pool=real_pool)
262273
self.item_counts_progression[self.player] = self.get_item_counts(pool=real_pool, only_progression=True)
263274

0 commit comments

Comments
 (0)