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.
This commit is contained in:
AmazingAmpharos 2018-03-15 16:53:42 -05:00 committed by GitHub
parent f701aefa28
commit f607cc2522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

10
Gui.py
View File

@ -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(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(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(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.rom = romVar.get()
guiargs.jsonout = None guiargs.jsonout = None
guiargs.sprite = sprite guiargs.sprite = sprite
@ -938,6 +938,14 @@ def guiMain(args=None):
redclockLabel.pack(anchor=W, side=LEFT, padx=(0,14)) redclockLabel.pack(anchor=W, side=LEFT, padx=(0,14))
redclockEntry.pack(anchor=E) 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) triforcepieceFrame = Frame(itemList5)
triforcepieceLabel = Label(triforcepieceFrame, text='Triforce Piece') triforcepieceLabel = Label(triforcepieceFrame, text='Triforce Piece')
triforcepieceVar = StringVar(value='0') triforcepieceVar = StringVar(value='0')

View File

@ -220,7 +220,7 @@ def generate_itempool(world):
# set up item pool # set up item pool
if world.custom: 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) world.rupoor_cost = min(world.customitemarray[67], 9999)
else: 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) (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) pool.extend(diff.retro)
return (pool, placed_items, clock_mode, treasure_hunt_count, treasure_hunt_icon, lamps_needed_for_dark_rooms) 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 = [] pool = []
placed_items = [] placed_items = []
clock_mode = None 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): for x in range(0, 65):
itemtotal = itemtotal + customitemarray[x] itemtotal = itemtotal + customitemarray[x]
itemtotal = itemtotal + customitemarray[66] itemtotal = itemtotal + customitemarray[66]
itemtotal = itemtotal + customitemarray[68]
pool.extend(['Bow'] * customitemarray[0]) pool.extend(['Bow'] * customitemarray[0])
pool.extend(['Silver Arrows']* customitemarray[1]) 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(['Red Clock'] * customitemarray[63])
pool.extend(['Triforce Piece'] * customitemarray[64]) pool.extend(['Triforce Piece'] * customitemarray[64])
pool.extend(['Triforce'] * customitemarray[66]) pool.extend(['Triforce'] * customitemarray[66])
pool.extend(['Small Key (Universal)'] * customitemarray[68])
diff = difficulties[difficulty] 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(['Magic Mirror'] * customitemarray[22])
pool.extend(['Moon Pearl'] * customitemarray[28]) 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: if itemtotal < total_items_to_place:
pool.extend(['Nothing'] * (total_items_to_place - itemtotal)) pool.extend(['Nothing'] * (total_items_to_place - itemtotal))