diff --git a/worlds/smz3/__init__.py b/worlds/smz3/__init__.py index 7c519ec0..0cd9a0e2 100644 --- a/worlds/smz3/__init__.py +++ b/worlds/smz3/__init__.py @@ -77,7 +77,7 @@ class SMZ3World(World): def __init__(self, world: MultiWorld, player: int): self.rom_name_available_event = threading.Event() - self.locations = {} + self.locations: Dict[str, Location] = {} self.unreachable = [] super().__init__(world, player) @@ -481,15 +481,13 @@ class SMZ3World(World): if loc.name in self.locationNamesGT and loc.item is None: poolLength = len(self.world.itempool) # start looking at a random starting index and loop at start if no match found - for i in range(self.world.random.randint(0, poolLength), poolLength): - if not self.world.itempool[i].advancement: + start = self.world.random.randint(0, poolLength) + for off in range(0, poolLength): + i = (start + off) % poolLength + if self.world.itempool[i].classification in (ItemClassification.filler, ItemClassification.trap) \ + and loc.can_fill(self.world.state, self.world.itempool[i], False): itemFromPool = self.world.itempool.pop(i) break - else: - for i in range(0, poolLength): - if not self.world.itempool[i].advancement: - itemFromPool = self.world.itempool.pop(i) - break self.world.push_item(loc, itemFromPool, False) loc.event = False