skip gtower fill if target fill count is 0

Also rename gftower to gtower. I don't know what the f could stand for. Girlfriend tower?
This commit is contained in:
Fabian Dill 2020-08-17 03:55:46 +02:00
parent b3bb1f187d
commit 52cf99c5c8
1 changed files with 26 additions and 25 deletions

51
Fill.py
View File

@ -242,34 +242,35 @@ def distribute_items_restrictive(world, gftower_trash=False, fill_locations=None
for player in range(1, world.players + 1): for player in range(1, world.players + 1):
if not gftower_trash or not world.ganonstower_vanilla[player] or \ if not gftower_trash or not world.ganonstower_vanilla[player] or \
world.logic[player] in {'owglitches', "nologic"}: world.logic[player] in {'owglitches', "nologic"}:
continue gtower_trash_count = 0
if 'triforcehunt' in world.goal[player] and ('local' in world.goal[player] or world.players == 1): elif 'triforcehunt' in world.goal[player] and ('local' in world.goal[player] or world.players == 1):
gftower_trash_count = world.random.randint(world.crystals_needed_for_gt[player] * 2, gtower_trash_count = world.random.randint(world.crystals_needed_for_gt[player] * 2,
world.crystals_needed_for_gt[player] * 4) world.crystals_needed_for_gt[player] * 4)
else: else:
gftower_trash_count = world.random.randint(0, world.crystals_needed_for_gt[player] * 2) gtower_trash_count = world.random.randint(0, world.crystals_needed_for_gt[player] * 2)
gtower_locations = [location for location in fill_locations if if gtower_trash_count:
'Ganons Tower' in location.name and location.player == player] gtower_locations = [location for location in fill_locations if
world.random.shuffle(gtower_locations) 'Ganons Tower' in location.name and location.player == player]
trashcnt = 0 world.random.shuffle(gtower_locations)
localrest = localrestitempool[player] trashcnt = 0
if localrest: localrest = localrestitempool[player]
gt_item_pool = restitempool + localrest if localrest:
world.random.shuffle(gt_item_pool) gt_item_pool = restitempool + localrest
else: world.random.shuffle(gt_item_pool)
gt_item_pool = restitempool.copy()
while gtower_locations and gt_item_pool and trashcnt < gftower_trash_count:
spot_to_fill = gtower_locations.pop()
item_to_place = gt_item_pool.pop()
if item_to_place in localrest:
localrest.remove(item_to_place)
else: else:
restitempool.remove(item_to_place) gt_item_pool = restitempool.copy()
world.push_item(spot_to_fill, item_to_place, False)
fill_locations.remove(spot_to_fill) while gtower_locations and gt_item_pool and trashcnt < gtower_trash_count:
trashcnt += 1 spot_to_fill = gtower_locations.pop()
item_to_place = gt_item_pool.pop()
if item_to_place in localrest:
localrest.remove(item_to_place)
else:
restitempool.remove(item_to_place)
world.push_item(spot_to_fill, item_to_place, False)
fill_locations.remove(spot_to_fill)
trashcnt += 1
world.random.shuffle(fill_locations) world.random.shuffle(fill_locations)
fill_locations.reverse() fill_locations.reverse()