From f607cc2522e8758ab64cce19d9b4005703828b42 Mon Sep 17 00:00:00 2001 From: AmazingAmpharos Date: Thu, 15 Mar 2018 16:53:42 -0500 Subject: [PATCH] Custom item pool support for retro mode Allows the placement of Universal Keys (which probably don't do much outside of retro mode) and handles total item counts properly. --- Gui.py | 10 +++++++++- ItemList.py | 8 ++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Gui.py b/Gui.py index c33fe5e2..5ea97546 100755 --- a/Gui.py +++ b/Gui.py @@ -280,7 +280,7 @@ def guiMain(args=None): 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(triforcepieceVar.get()), int(triforcecountVar.get()), - int(triforceVar.get()), int(rupoorcostVar.get())] + int(triforceVar.get()), int(rupoorcostVar.get()), int(universalkeyVar.get())] guiargs.rom = romVar.get() guiargs.jsonout = None guiargs.sprite = sprite @@ -938,6 +938,14 @@ def guiMain(args=None): redclockLabel.pack(anchor=W, side=LEFT, padx=(0,14)) redclockEntry.pack(anchor=E) + universalkeyFrame = Frame(itemList5) + universalkeyLabel = Label(universalkeyFrame, text='Universal Key') + universalkeyVar = StringVar(value='0') + universalkeyEntry = Entry(universalkeyFrame, textvariable=universalkeyVar, width=3, validate='all', vcmd=vcmd) + universalkeyFrame.pack() + universalkeyLabel.pack(anchor=W, side=LEFT, padx=(0,57)) + universalkeyEntry.pack(anchor=E) + triforcepieceFrame = Frame(itemList5) triforcepieceLabel = Label(triforcepieceFrame, text='Triforce Piece') triforcepieceVar = StringVar(value='0') diff --git a/ItemList.py b/ItemList.py index 0f1ebf3d..f95f9cb6 100644 --- a/ItemList.py +++ b/ItemList.py @@ -220,7 +220,7 @@ def generate_itempool(world): # set up item pool if world.custom: - (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode, world.customitemarray) + (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode, world.retro, world.customitemarray) world.rupoor_cost = min(world.customitemarray[67], 9999) else: (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) = get_pool_core(world.progressive, world.shuffle, world.difficulty, world.timer, world.goal, world.mode, world.retro) @@ -393,7 +393,7 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, retro): pool.extend(diff.retro) return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) -def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, customitemarray): +def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, retro, customitemarray): pool = [] placed_items = [] clock_mode = None @@ -410,6 +410,7 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, c for x in range(0, 65): itemtotal = itemtotal + customitemarray[x] itemtotal = itemtotal + customitemarray[66] + itemtotal = itemtotal + customitemarray[68] pool.extend(['Bow'] * customitemarray[0]) pool.extend(['Silver Arrows']* customitemarray[1]) @@ -472,6 +473,7 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, c pool.extend(['Red Clock'] * customitemarray[63]) pool.extend(['Triforce Piece'] * customitemarray[64]) pool.extend(['Triforce'] * customitemarray[66]) + pool.extend(['Small Key (Universal)'] * customitemarray[68]) diff = difficulties[difficulty] @@ -530,6 +532,8 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, c pool.extend(['Magic Mirror'] * customitemarray[22]) pool.extend(['Moon Pearl'] * customitemarray[28]) + if retro: + itemtotal = itemtotal - 28 # Corrects for small keys not being in item pool in Retro Mode if itemtotal < total_items_to_place: pool.extend(['Nothing'] * (total_items_to_place - itemtotal))