From 1aa3e431c81591bc4aeb8f3863c8f04afa1f4241 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Mon, 17 Oct 2022 09:52:34 +0200 Subject: [PATCH] LttP: fix ganons tower trash fill deleting items that did not fit (#1113) --- worlds/alttp/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/worlds/alttp/__init__.py b/worlds/alttp/__init__.py index 169d21ab..561b489b 100644 --- a/worlds/alttp/__init__.py +++ b/worlds/alttp/__init__.py @@ -490,11 +490,15 @@ class ALTTPWorld(World): while gtower_locations and filleritempool and trash_count > 0: spot_to_fill = gtower_locations.pop() - item_to_place = filleritempool.pop() - if spot_to_fill.item_rule(item_to_place): - world.push_item(spot_to_fill, item_to_place, False) - fill_locations.remove(spot_to_fill) # very slow, unfortunately - trash_count -= 1 + for index, item in enumerate(filleritempool): + if spot_to_fill.item_rule(item): + filleritempool.pop(index) # remove from outer fill + world.push_item(spot_to_fill, item, False) + fill_locations.remove(spot_to_fill) # very slow, unfortunately + trash_count -= 1 + break + else: + logging.warning(f"Could not trash fill Ganon's Tower for player {player}.") def get_filler_item_name(self) -> str: if self.world.goal[self.player] == "icerodhunt":