diff --git a/BaseClasses.py b/BaseClasses.py index 43cf1da9..c515d9c8 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -98,7 +98,7 @@ class World(object): set_player_attr('open_pyramid', False) set_player_attr('treasure_hunt_icon', 'Triforce Piece') set_player_attr('treasure_hunt_count', 0) - set_player_attr('clock_mode', 'off') + set_player_attr('clock_mode', False) set_player_attr('can_take_damage', True) def get_name_string_for_object(self, obj) -> str: diff --git a/EntranceRandomizer.py b/EntranceRandomizer.py index 725e6c1a..26b7db66 100755 --- a/EntranceRandomizer.py +++ b/EntranceRandomizer.py @@ -280,13 +280,15 @@ def parse_arguments(argv, no_defaults=False): parser.add_argument(f'--p{player}', default=defval(''), help=argparse.SUPPRESS) ret = parser.parse_args(argv) + if ret.timer == "none": + ret.timer = False if ret.keysanity: ret.mapshuffle, ret.compassshuffle, ret.keyshuffle, ret.bigkeyshuffle = [True] * 4 if multiargs.multi: defaults = copy.deepcopy(ret) for player in range(1, multiargs.multi + 1): - playerargs = parse_arguments(shlex.split(getattr(ret,f"p{player}")), True) + playerargs = parse_arguments(shlex.split(getattr(ret, f"p{player}")), True) for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality', 'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'timer', diff --git a/Gui.py b/Gui.py index 93eac367..d4750dd9 100755 --- a/Gui.py +++ b/Gui.py @@ -416,6 +416,8 @@ def guiMain(args=None): guiargs.difficulty = difficultyVar.get() guiargs.item_functionality = itemfunctionVar.get() guiargs.timer = timerVar.get() + if guiargs.timer == "none": + guiargs.timer = False guiargs.progressive = progressiveVar.get() guiargs.accessibility = accessibilityVar.get() guiargs.algorithm = algorithmVar.get() diff --git a/ItemList.py b/ItemList.py index d0b24d0f..840f65ad 100644 --- a/ItemList.py +++ b/ItemList.py @@ -129,10 +129,12 @@ def generate_itempool(world, player): 'dungeons', 'triforcehunt', 'crystals'] - or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in ['none', 'display', - 'timed', 'timed-ohko', - 'ohko', - 'timed-countdown']): + or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in [False, + 'display', + 'timed', + 'timed-ohko', + 'ohko', + 'timed-countdown']): raise NotImplementedError('Not supported yet') if world.timer[player] in ['ohko', 'timed-ohko']: world.can_take_damage[player] = False @@ -414,7 +416,7 @@ def get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, r lamps_needed_for_dark_rooms = 1 # insanity shuffle doesn't have fake LW/DW logic so for now guaranteed Mirror and Moon Pearl at the start - if shuffle == 'insanity_legacy': + if shuffle == 'insanity_legacy': place_item('Link\'s House', 'Magic Mirror') place_item('Sanctuary', 'Moon Pearl') else: @@ -669,13 +671,14 @@ def make_custom_item_pool(progressive, shuffle, difficulty, timer, goal, mode, s def test(): for difficulty in ['normal', 'hard', 'expert']: for goal in ['ganon', 'triforcehunt', 'pedestal']: - for timer in ['none', 'display', 'timed', 'timed-ohko', 'ohko', 'timed-countdown']: + for timer in [False, 'display', 'timed', 'timed-ohko', 'ohko', 'timed-countdown']: for mode in ['open', 'standard', 'inverted']: for swords in ['random', 'assured', 'swordless', 'vanilla']: for progressive in ['on', 'off']: for shuffle in ['full', 'insanity_legacy']: for retro in [True, False]: - out = get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, retro) + out = get_pool_core(progressive, shuffle, difficulty, timer, goal, mode, swords, + retro) count = len(out[0]) + len(out[1]) correct_count = total_items_to_place diff --git a/Main.py b/Main.py index bb14097c..a3920e99 100644 --- a/Main.py +++ b/Main.py @@ -197,13 +197,20 @@ def main(args, seed=None): outfilepname += f'_P{player}' if world.players > 1 or world.teams > 1: outfilepname += f"_{world.player_names[player][team].replace(' ', '_')}" if world.player_names[player][team] != 'Player %d' % player else '' - outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player], world.difficulty_adjustments[player], - world.mode[player], world.goal[player], - "" if world.timer[player] in ['none', 'display'] else "-" + world.timer[player], - world.shuffle[player], world.algorithm, mcsb_name, - "-retro" if world.retro[player] else "", - "-prog_" + world.progressive[player] if world.progressive[player] in ['off', 'random'] else "", - "-nohints" if not world.hints[player] else "")) if not args.outputname else '' + outfilesuffix = ('_%s_%s-%s-%s-%s%s_%s-%s%s%s%s%s' % (world.logic[player], world.difficulty[player], + world.difficulty_adjustments[player], + world.mode[player], world.goal[player], + "" if world.timer[player] in [False, + 'display'] else "-" + + world.timer[ + player], + world.shuffle[player], world.algorithm, + mcsb_name, + "-retro" if world.retro[player] else "", + "-prog_" + world.progressive[player] if + world.progressive[player] in ['off', + 'random'] else "", + "-nohints" if not world.hints[player] else "")) if not args.outputname else '' rom.write_to_file(output_path(f'{outfilebase}{outfilepname}{outfilesuffix}.sfc')) multidata = zlib.compress(json.dumps({"names": parsed_names, diff --git a/Mystery.py b/Mystery.py index 2943a772..693884f5 100644 --- a/Mystery.py +++ b/Mystery.py @@ -256,12 +256,14 @@ def roll_settings(weights): ret.beemizer = int(get_choice('beemizer', weights)) if 'beemizer' in weights else 0 - ret.timer = {'none': 'none', + ret.timer = {'none': False, + None: False, + False: False, 'timed': 'timed', 'timed_ohko': 'timed-ohko', 'ohko': 'ohko', 'timed_countdown': 'timed-countdown', - 'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else 'none' + 'display': 'display'}[get_choice('timer', weights)] if 'timer' in weights.keys() else False ret.progressive = convert_to_on_off(get_choice('progressive', weights)) if "progressive" in weights else 'on' inventoryweights = weights.get('startinventory', {}) diff --git a/Rom.py b/Rom.py index d7c465b5..058d112f 100644 --- a/Rom.py +++ b/Rom.py @@ -853,7 +853,7 @@ def patch_rom(world, rom, player, team, enemized): ERtimeincrease = 20 if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]: ERtimeincrease = ERtimeincrease + 15 - if world.clock_mode[player] == 'off': + if world.clock_mode[player] == False: rom.write_bytes(0x180190, [0x00, 0x00, 0x00]) # turn off clock mode write_int32(rom, 0x180200, 0) # red clock adjustment time (in frames, sint32) write_int32(rom, 0x180204, 0) # blue clock adjustment time (in frames, sint32) @@ -1111,7 +1111,7 @@ def patch_rom(world, rom, player, team, enemized): rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00) # maps showing crystals on overworld # compasses showing dungeon count - if world.clock_mode[player] != 'off': + if world.clock_mode[player]: rom.write_byte(0x18003C, 0x00) # Currently must be off if timer is on, because they use same HUD location elif world.compassshuffle[player]: rom.write_byte(0x18003C, 0x01) # show on pickup