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):
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