Implement open_pyramid yaml settings
This commit is contained in:
		
							parent
							
								
									fda32578fa
								
							
						
					
					
						commit
						7f74aa7cb0
					
				| 
						 | 
					@ -222,9 +222,16 @@ def parse_arguments(argv, no_defaults=False):
 | 
				
			||||||
                             Random: Picks a random value between 0 and 7 (inclusive).
 | 
					                             Random: Picks a random value between 0 and 7 (inclusive).
 | 
				
			||||||
                             0-7:    Number of crystals needed
 | 
					                             0-7:    Number of crystals needed
 | 
				
			||||||
                             ''')
 | 
					                             ''')
 | 
				
			||||||
    parser.add_argument('--open_pyramid', default=defval(False), help='''\
 | 
					    parser.add_argument('--open_pyramid', default=defval('auto'), help='''\
 | 
				
			||||||
                            Pre-opens the pyramid hole, this removes the Agahnim 2 requirement for it
 | 
					                            Pre-opens the pyramid hole, this removes the Agahnim 2 requirement for it.
 | 
				
			||||||
                             ''', action='store_true')
 | 
					                            Depending on goal, you might still need to beat Agahnim 2 in order to beat ganon.
 | 
				
			||||||
 | 
					                            fast ganon goals are crystals, ganontriforcehunt, localganontriforcehunt, pedestalganon
 | 
				
			||||||
 | 
					                            auto - Only opens pyramid hole if the goal specifies a fast ganon, and entrance shuffle
 | 
				
			||||||
 | 
					                                   is vanilla, dungeonssimple or dungeonsfull.
 | 
				
			||||||
 | 
					                            goal - Opens pyramid hole if the goal specifies a fast ganon.
 | 
				
			||||||
 | 
					                            yes - Always opens the pyramid hole.
 | 
				
			||||||
 | 
					                            no - Never opens the pyramid hole.
 | 
				
			||||||
 | 
					                             ''', choices=['auto', 'goal', 'yes', 'no'])
 | 
				
			||||||
    parser.add_argument('--rom', default=defval('Zelda no Densetsu - Kamigami no Triforce (Japan).sfc'),
 | 
					    parser.add_argument('--rom', default=defval('Zelda no Densetsu - Kamigami no Triforce (Japan).sfc'),
 | 
				
			||||||
                        help='Path to an ALttP JAP(1.0) rom to use as a base.')
 | 
					                        help='Path to an ALttP JAP(1.0) rom to use as a base.')
 | 
				
			||||||
    parser.add_argument('--loglevel', default=defval('info'), const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
 | 
					    parser.add_argument('--loglevel', default=defval('info'), const='info', nargs='?', choices=['error', 'info', 'warning', 'debug'], help='Select level of logging for output.')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								Gui.py
								
								
								
								
							
							
						
						
									
										13
									
								
								Gui.py
								
								
								
								
							| 
						 | 
					@ -64,8 +64,13 @@ def guiMain(args=None):
 | 
				
			||||||
    createSpoilerCheckbutton = Checkbutton(checkBoxFrame, text="Create Spoiler Log", variable=createSpoilerVar)
 | 
					    createSpoilerCheckbutton = Checkbutton(checkBoxFrame, text="Create Spoiler Log", variable=createSpoilerVar)
 | 
				
			||||||
    suppressRomVar = IntVar()
 | 
					    suppressRomVar = IntVar()
 | 
				
			||||||
    suppressRomCheckbutton = Checkbutton(checkBoxFrame, text="Do not create patched Rom", variable=suppressRomVar)
 | 
					    suppressRomCheckbutton = Checkbutton(checkBoxFrame, text="Do not create patched Rom", variable=suppressRomVar)
 | 
				
			||||||
    openpyramidVar = IntVar()
 | 
					    openpyramidFrame = Frame(checkBoxFrame)
 | 
				
			||||||
    openpyramidCheckbutton = Checkbutton(checkBoxFrame, text="Pre-open Pyramid Hole", variable=openpyramidVar)
 | 
					    openpyramidVar = StringVar()
 | 
				
			||||||
 | 
					    openpyramidVar.set('auto')
 | 
				
			||||||
 | 
					    openpyramidOptionMenu = OptionMenu(openpyramidFrame, openpyramidVar, 'auto', 'goal', 'yes', 'no')
 | 
				
			||||||
 | 
					    openpyramidLabel = Label(openpyramidFrame, text='Pre-open Pyramid Hole')
 | 
				
			||||||
 | 
					    openpyramidLabel.pack(side=LEFT)
 | 
				
			||||||
 | 
					    openpyramidOptionMenu.pack(side=LEFT)
 | 
				
			||||||
    mcsbshuffleFrame = Frame(checkBoxFrame)
 | 
					    mcsbshuffleFrame = Frame(checkBoxFrame)
 | 
				
			||||||
    mcsbLabel = Label(mcsbshuffleFrame, text="Shuffle: ")
 | 
					    mcsbLabel = Label(mcsbshuffleFrame, text="Shuffle: ")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +107,7 @@ def guiMain(args=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createSpoilerCheckbutton.pack(expand=True, anchor=W)
 | 
					    createSpoilerCheckbutton.pack(expand=True, anchor=W)
 | 
				
			||||||
    suppressRomCheckbutton.pack(expand=True, anchor=W)
 | 
					    suppressRomCheckbutton.pack(expand=True, anchor=W)
 | 
				
			||||||
    openpyramidCheckbutton.pack(expand=True, anchor=W)
 | 
					    openpyramidFrame.pack(expand=True, anchor=W)
 | 
				
			||||||
    mcsbshuffleFrame.pack(expand=True, anchor=W)
 | 
					    mcsbshuffleFrame.pack(expand=True, anchor=W)
 | 
				
			||||||
    mcsbLabel.grid(row=0, column=0)
 | 
					    mcsbLabel.grid(row=0, column=0)
 | 
				
			||||||
    mapshuffleCheckbutton.grid(row=0, column=1)
 | 
					    mapshuffleCheckbutton.grid(row=0, column=1)
 | 
				
			||||||
| 
						 | 
					@ -564,7 +569,7 @@ def guiMain(args=None):
 | 
				
			||||||
        guiargs.create_spoiler = bool(createSpoilerVar.get())
 | 
					        guiargs.create_spoiler = bool(createSpoilerVar.get())
 | 
				
			||||||
        guiargs.skip_playthrough = not bool(createSpoilerVar.get())
 | 
					        guiargs.skip_playthrough = not bool(createSpoilerVar.get())
 | 
				
			||||||
        guiargs.suppress_rom = bool(suppressRomVar.get())
 | 
					        guiargs.suppress_rom = bool(suppressRomVar.get())
 | 
				
			||||||
        guiargs.open_pyramid = bool(openpyramidVar.get())
 | 
					        guiargs.open_pyramid = openpyramidVar.get()
 | 
				
			||||||
        guiargs.mapshuffle = bool(mapshuffleVar.get())
 | 
					        guiargs.mapshuffle = bool(mapshuffleVar.get())
 | 
				
			||||||
        guiargs.compassshuffle = bool(compassshuffleVar.get())
 | 
					        guiargs.compassshuffle = bool(compassshuffleVar.get())
 | 
				
			||||||
        guiargs.keyshuffle = {"on": True, "universal": "universal", "off": False}[keyshuffleVar.get()]
 | 
					        guiargs.keyshuffle = {"on": True, "universal": "universal", "off": False}[keyshuffleVar.get()]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										34
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										34
									
								
								Main.py
								
								
								
								
							| 
						 | 
					@ -108,10 +108,19 @@ def main(args, seed=None):
 | 
				
			||||||
            world.player_names[player].append(name)
 | 
					            world.player_names[player].append(name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.info('')
 | 
					    logger.info('')
 | 
				
			||||||
 | 
					    initialize_world(world)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for player in range(1, world.players + 1):
 | 
					    for player in range(1, world.players + 1):
 | 
				
			||||||
        world.difficulty_requirements[player] = difficulties[world.difficulty[player]]
 | 
					        world.difficulty_requirements[player] = difficulties[world.difficulty[player]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if world.open_pyramid[player] == 'goal':
 | 
				
			||||||
 | 
					            world.open_pyramid[player] = world.goal[player] in {'crystals', 'ganontriforcehunt', 'localganontriforcehunt', 'ganonpedestal'}
 | 
				
			||||||
 | 
					        elif world.open_pyramid[player] == 'auto':
 | 
				
			||||||
 | 
					            world.open_pyramid[player] = world.goal[player] in {'crystals', 'ganontriforcehunt', 'localganontriforcehunt', 'ganonpedestal'} and \
 | 
				
			||||||
 | 
					                                         (world.shuffle[player] in {'vanilla', 'dungeonssimple', 'dungeonsfull'} or not world.shuffle_ganon)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            world.open_pyramid[player] = {'on': True, 'off': False, 'yes': True, 'no': False}.get(world.open_pyramid[player], world.open_pyramid[player])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for tok in filter(None, args.startinventory[player].split(',')):
 | 
					        for tok in filter(None, args.startinventory[player].split(',')):
 | 
				
			||||||
            item = ItemFactory(tok.strip(), player)
 | 
					            item = ItemFactory(tok.strip(), player)
 | 
				
			||||||
            if item:
 | 
					            if item:
 | 
				
			||||||
| 
						 | 
					@ -148,13 +157,6 @@ def main(args, seed=None):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        world.triforce_pieces_available[player] = max(world.triforce_pieces_available[player], world.triforce_pieces_required[player])
 | 
					        world.triforce_pieces_available[player] = max(world.triforce_pieces_available[player], world.triforce_pieces_required[player])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if world.mode[player] != 'inverted':
 | 
					 | 
				
			||||||
            create_regions(world, player)
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            create_inverted_regions(world, player)
 | 
					 | 
				
			||||||
        create_shops(world, player)
 | 
					 | 
				
			||||||
        create_dungeons(world, player)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    logger.info('Shuffling the World about.')
 | 
					    logger.info('Shuffling the World about.')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for player in range(1, world.players + 1):
 | 
					    for player in range(1, world.players + 1):
 | 
				
			||||||
| 
						 | 
					@ -449,6 +451,16 @@ def main(args, seed=None):
 | 
				
			||||||
    return world
 | 
					    return world
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def initialize_world(world):
 | 
				
			||||||
 | 
					    for player in range(1, world.players + 1):
 | 
				
			||||||
 | 
					        if world.mode[player] != 'inverted':
 | 
				
			||||||
 | 
					            create_regions(world, player)
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            create_inverted_regions(world, player)
 | 
				
			||||||
 | 
					        create_shops(world, player)
 | 
				
			||||||
 | 
					        create_dungeons(world, player)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def copy_world(world):
 | 
					def copy_world(world):
 | 
				
			||||||
    # ToDo: Not good yet
 | 
					    # ToDo: Not good yet
 | 
				
			||||||
    ret = World(world.players, world.shuffle, world.logic, world.mode, world.swords, world.difficulty, world.difficulty_adjustments, world.timer, world.progressive, world.goal, world.algorithm, world.accessibility, world.shuffle_ganon, world.retro, world.custom, world.customitemarray, world.hints)
 | 
					    ret = World(world.players, world.shuffle, world.logic, world.mode, world.swords, world.difficulty, world.difficulty_adjustments, world.timer, world.progressive, world.goal, world.algorithm, world.accessibility, world.shuffle_ganon, world.retro, world.custom, world.customitemarray, world.hints)
 | 
				
			||||||
| 
						 | 
					@ -493,13 +505,7 @@ def copy_world(world):
 | 
				
			||||||
    ret.dark_room_logic = world.dark_room_logic.copy()
 | 
					    ret.dark_room_logic = world.dark_room_logic.copy()
 | 
				
			||||||
    ret.restrict_dungeon_item_on_boss = world.restrict_dungeon_item_on_boss.copy()
 | 
					    ret.restrict_dungeon_item_on_boss = world.restrict_dungeon_item_on_boss.copy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for player in range(1, world.players + 1):
 | 
					    initialize_world(ret)
 | 
				
			||||||
        if world.mode[player] != 'inverted':
 | 
					 | 
				
			||||||
            create_regions(ret, player)
 | 
					 | 
				
			||||||
        else:
 | 
					 | 
				
			||||||
            create_inverted_regions(ret, player)
 | 
					 | 
				
			||||||
        create_shops(ret, player)
 | 
					 | 
				
			||||||
        create_dungeons(ret, player)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    copy_dynamic_regions_and_locations(world, ret)
 | 
					    copy_dynamic_regions_and_locations(world, ret)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -379,7 +379,7 @@ def roll_settings(weights, plando_options: typing.Set[str] = frozenset(("bosses"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO consider moving open_pyramid to an automatic variable in the core roller, set to True when
 | 
					    # TODO consider moving open_pyramid to an automatic variable in the core roller, set to True when
 | 
				
			||||||
    # fast ganon + ganon at hole
 | 
					    # fast ganon + ganon at hole
 | 
				
			||||||
    ret.open_pyramid = ret.goal in {'crystals', 'ganontriforcehunt', 'localganontriforcehunt', 'ganonpedestal'}
 | 
					    ret.open_pyramid = get_choice('open_pyramid', weights, 'goal')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret.crystals_gt = prefer_int(get_choice('tower_open', weights))
 | 
					    ret.crystals_gt = prefer_int(get_choice('tower_open', weights))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,6 +97,11 @@ goals:
 | 
				
			||||||
  ganon_triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout the worlds, then kill Ganon
 | 
					  ganon_triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout the worlds, then kill Ganon
 | 
				
			||||||
  local_ganon_triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout your world, then kill Ganon
 | 
					  local_ganon_triforce_hunt: 0 # Collect 20 of 30 Triforce pieces spread throughout your world, then kill Ganon
 | 
				
			||||||
  ice_rod_hunt: 0 # You start with everything needed to 216 the seed. Find the Ice rod, then kill Trinexx at Turtle rock.
 | 
					  ice_rod_hunt: 0 # You start with everything needed to 216 the seed. Find the Ice rod, then kill Trinexx at Turtle rock.
 | 
				
			||||||
 | 
					pyramid_open:
 | 
				
			||||||
 | 
					  goal: 50 # Opens pyrymid if goal is fast_ganon, ganon_pedestal, ganon_triforce_hunt, or local_ganon_triforce_hunt
 | 
				
			||||||
 | 
					  auto: 0 # Opens pyramid same as goal, except when an entrance shuffle other than vanilla, dungeonssimple or dungeonsfull is in effect.
 | 
				
			||||||
 | 
					  yes: 0 # pyramid is opened unconditionally. You still have to beat agahnim 2 for ganon and dungeons.
 | 
				
			||||||
 | 
					  no: 0 # access to pyramid requires beating agahnim 2.
 | 
				
			||||||
triforce_pieces_mode: #Determine how to calculate the extra available triforce pieces.
 | 
					triforce_pieces_mode: #Determine how to calculate the extra available triforce pieces.
 | 
				
			||||||
  extra: 0 # available = triforce_pieces_extra + triforce_pieces_required
 | 
					  extra: 0 # available = triforce_pieces_extra + triforce_pieces_required
 | 
				
			||||||
  percentage: 0 # available = (triforce_pieces_percentage /100) * triforce_pieces_required
 | 
					  percentage: 0 # available = (triforce_pieces_percentage /100) * triforce_pieces_required
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue