SMZ3: FixJunkFillGT making invalid placements

This commit is contained in:
black-sliver 2022-08-04 01:49:15 +02:00 committed by Fabian Dill
parent 95012c004f
commit 530b6cc360
1 changed files with 6 additions and 8 deletions

View File

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