From f99bc676bc211cd1efa0c424fca2842ff514f6d5 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 16 Aug 2020 12:04:04 +0200 Subject: [PATCH] Fix custom item pool triforce piece handling --- Gui.py | 36 +++++++++++++++++++++++++++--------- ItemList.py | 22 ++++++++-------------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Gui.py b/Gui.py index 80e5c913..725af742 100755 --- a/Gui.py +++ b/Gui.py @@ -475,15 +475,33 @@ def guiMain(args=None): guiargs.enemy_damage = enemizerDamageVar.get() guiargs.shufflepots = bool(potShuffleVar.get()) guiargs.custom = bool(customVar.get()) - guiargs.customitemarray = [int(bowVar.get()), int(silverarrowVar.get()), int(boomerangVar.get()), int(magicboomerangVar.get()), int(hookshotVar.get()), int(mushroomVar.get()), int(magicpowderVar.get()), int(firerodVar.get()), - int(icerodVar.get()), int(bombosVar.get()), int(etherVar.get()), int(quakeVar.get()), int(lampVar.get()), int(hammerVar.get()), int(shovelVar.get()), int(fluteVar.get()), int(bugnetVar.get()), - int(bookVar.get()), int(bottleVar.get()), int(somariaVar.get()), int(byrnaVar.get()), int(capeVar.get()), int(mirrorVar.get()), int(bootsVar.get()), int(powergloveVar.get()), int(titansmittVar.get()), - int(proggloveVar.get()), int(flippersVar.get()), int(pearlVar.get()), int(heartpieceVar.get()), int(fullheartVar.get()), int(sancheartVar.get()), int(sword1Var.get()), int(sword2Var.get()), - int(sword3Var.get()), int(sword4Var.get()), int(progswordVar.get()), int(shield1Var.get()), int(shield2Var.get()), int(shield3Var.get()), int(progshieldVar.get()), int(bluemailVar.get()), - int(redmailVar.get()), int(progmailVar.get()), int(halfmagicVar.get()), int(quartermagicVar.get()), int(bcap5Var.get()), int(bcap10Var.get()), int(acap5Var.get()), int(acap10Var.get()), - int(arrow1Var.get()), int(arrow10Var.get()), int(bomb1Var.get()), int(bomb3Var.get()), int(rupee1Var.get()), int(rupee5Var.get()), int(rupee20Var.get()), int(rupee50Var.get()), int(rupee100Var.get()), - int(rupee300Var.get()), int(rupoorVar.get()), int(blueclockVar.get()), int(greenclockVar.get()), int(redclockVar.get()), int(progbowVar.get()), int(bomb10Var.get()), int(triforcepieceVar.get()), - int(triforcecountVar.get()), int(triforceVar.get()), int(rupoorcostVar.get()), int(universalkeyVar.get())] + guiargs.triforce_pieces_required = min(90, int(triforcecountVar.get())) + guiargs.triforce_pieces_available = min(90, int(triforcepieceVar.get())) + guiargs.customitemarray = [int(bowVar.get()), int(silverarrowVar.get()), int(boomerangVar.get()), + int(magicboomerangVar.get()), int(hookshotVar.get()), int(mushroomVar.get()), + int(magicpowderVar.get()), int(firerodVar.get()), + int(icerodVar.get()), int(bombosVar.get()), int(etherVar.get()), int(quakeVar.get()), + int(lampVar.get()), int(hammerVar.get()), int(shovelVar.get()), int(fluteVar.get()), + int(bugnetVar.get()), + int(bookVar.get()), int(bottleVar.get()), int(somariaVar.get()), int(byrnaVar.get()), + int(capeVar.get()), int(mirrorVar.get()), int(bootsVar.get()), + int(powergloveVar.get()), int(titansmittVar.get()), + int(proggloveVar.get()), int(flippersVar.get()), int(pearlVar.get()), + int(heartpieceVar.get()), int(fullheartVar.get()), int(sancheartVar.get()), + int(sword1Var.get()), int(sword2Var.get()), + int(sword3Var.get()), int(sword4Var.get()), int(progswordVar.get()), + int(shield1Var.get()), int(shield2Var.get()), int(shield3Var.get()), + int(progshieldVar.get()), int(bluemailVar.get()), + int(redmailVar.get()), int(progmailVar.get()), int(halfmagicVar.get()), + int(quartermagicVar.get()), int(bcap5Var.get()), int(bcap10Var.get()), + int(acap5Var.get()), int(acap10Var.get()), + int(arrow1Var.get()), int(arrow10Var.get()), int(bomb1Var.get()), + int(bomb3Var.get()), int(rupee1Var.get()), int(rupee5Var.get()), + int(rupee20Var.get()), int(rupee50Var.get()), int(rupee100Var.get()), + int(rupee300Var.get()), int(rupoorVar.get()), int(blueclockVar.get()), + int(greenclockVar.get()), int(redclockVar.get()), int(progbowVar.get()), + int(bomb10Var.get()), int(triforceVar.get()), + int(rupoorcostVar.get()), int(universalkeyVar.get())] guiargs.rom = romVar.get() guiargs.sprite = sprite # get default values for missing parameters diff --git a/ItemList.py b/ItemList.py index 59ce0641..6ed40cc9 100644 --- a/ItemList.py +++ b/ItemList.py @@ -229,7 +229,7 @@ def generate_itempool(world, player: int): if world.custom: (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) = make_custom_item_pool(world, player) - world.rupoor_cost = min(world.customitemarray[69], 9999) + world.rupoor_cost = min(world.customitemarray[67], 9999) else: (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon) = get_pool_core( world, player) @@ -696,12 +696,9 @@ def make_custom_item_pool(world, player): pool.extend(['Red Clock'] * customitemarray[63]) pool.extend(['Progressive Bow'] * customitemarray[64]) pool.extend(['Bombs (10)'] * customitemarray[65]) - pool.extend(['Triforce Piece'] * customitemarray[66]) - pool.extend(['Triforce'] * customitemarray[68]) diff = difficulties[difficulty] - # expert+ difficulties produce the same contents for # all bottles, since only one bottle is available if diff.same_bottle: @@ -711,14 +708,11 @@ def make_custom_item_pool(world, player): thisbottle = world.random.choice(diff.bottles) pool.append(thisbottle) - if customitemarray[66] > 0 or customitemarray[67] > 0: - treasure_hunt_count = max(min(customitemarray[67], 99), 1) #To display, count must be between 1 and 99. + if world.triforce_pieces_available[player] or world.triforce_pieces_required[player]: + pool.extend(["Triforce Piece"] * world.triforce_pieces_available[player]) + itemtotal += world.triforce_pieces_available[player] + treasure_hunt_count = world.triforce_pieces_required[player] treasure_hunt_icon = 'Triforce Piece' - # Ensure game is always possible to complete here, force sufficient pieces if the player is unwilling. - if (customitemarray[66] < treasure_hunt_count) and ('triforcehunt' in goal) and (customitemarray[68] == 0): - extrapieces = treasure_hunt_count - customitemarray[66] - pool.extend(['Triforce Piece'] * extrapieces) - itemtotal = itemtotal + extrapieces if timer in ['display', 'timed', 'timed-countdown']: clock_mode = 'countdown' if timer == 'timed-countdown' else 'stopwatch' @@ -737,11 +731,11 @@ def make_custom_item_pool(world, player): ['Secret Passage', 'Hyrule Castle - Boomerang Chest', 'Hyrule Castle - Map Chest', 'Hyrule Castle - Zelda\'s Chest', 'Sewers - Dark Cross']) place_item(key_location, 'Small Key (Universal)') - pool.extend(['Small Key (Universal)'] * max((customitemarray[70] - 1), 0)) + pool.extend(['Small Key (Universal)'] * max((customitemarray[68] - 1), 0)) else: - pool.extend(['Small Key (Universal)'] * customitemarray[70]) + pool.extend(['Small Key (Universal)'] * customitemarray[68]) else: - pool.extend(['Small Key (Universal)'] * customitemarray[70]) + pool.extend(['Small Key (Universal)'] * customitemarray[68]) pool.extend(['Fighter Sword'] * customitemarray[32]) pool.extend(['Progressive Sword'] * customitemarray[36])