From 8fe9502b314ecd5c7da64f15230189d3d247266a Mon Sep 17 00:00:00 2001 From: Alchav Date: Tue, 16 Apr 2024 23:19:46 -0400 Subject: [PATCH] Triforce Pieces and Condense Items fixes --- worlds/alttp/ItemPool.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/worlds/alttp/ItemPool.py b/worlds/alttp/ItemPool.py index 438c6226bc38..8c666d01e383 100644 --- a/worlds/alttp/ItemPool.py +++ b/worlds/alttp/ItemPool.py @@ -466,8 +466,6 @@ def cut_item(items, item_to_cut, minimum_items): while len(items) > pool_count: items_were_cut = False for reduce_item in items_reduction_table: - if len(items) <= pool_count: - break if len(reduce_item) == 2: items_were_cut = items_were_cut or cut_item(items, *reduce_item) elif len(reduce_item) == 4: @@ -479,7 +477,10 @@ def cut_item(items, item_to_cut, minimum_items): items.remove(bottle) removed_filler.append(bottle) items_were_cut = True - assert items_were_cut, f"Failed to limit item pool size for player {player}" + if items_were_cut: + break + else: + raise Exception(f"Failed to limit item pool size for player {player}") if len(items) < pool_count: items += removed_filler[len(items) - pool_count:] @@ -686,12 +687,12 @@ def place_item(loc, item): if world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_extra: triforce_pieces = world.triforce_pieces_available[player].value + world.triforce_pieces_extra[player].value elif world.triforce_pieces_mode[player].value == TriforcePiecesMode.option_percentage: - percentage = float(max(100, world.triforce_pieces_percentage[player].value)) / 100 - triforce_pieces = int(round(world.triforce_pieces_required[player].value * percentage, 0)) + percentage = float(world.triforce_pieces_percentage[player].value) / 100 + triforce_pieces = round(world.triforce_pieces_required[player].value * percentage, 0) else: # available triforce_pieces = world.triforce_pieces_available[player].value - triforce_pieces = max(triforce_pieces, world.triforce_pieces_required[player].value) + triforce_pieces = min(90, max(triforce_pieces, world.triforce_pieces_required[player].value)) pieces_in_core = min(extraitems, triforce_pieces) additional_pieces_to_place = triforce_pieces - pieces_in_core