Add "timer" as individual setting (#23)
This commit is contained in:
		
							parent
							
								
									8ea3f34898
								
							
						
					
					
						commit
						21b8c73179
					
				| 
						 | 
					@ -18,7 +18,7 @@ class World(object):
 | 
				
			||||||
        self.swords = swords.copy()
 | 
					        self.swords = swords.copy()
 | 
				
			||||||
        self.difficulty = difficulty.copy()
 | 
					        self.difficulty = difficulty.copy()
 | 
				
			||||||
        self.difficulty_adjustments = difficulty_adjustments.copy()
 | 
					        self.difficulty_adjustments = difficulty_adjustments.copy()
 | 
				
			||||||
        self.timer = timer
 | 
					        self.timer = timer.copy()
 | 
				
			||||||
        self.progressive = progressive
 | 
					        self.progressive = progressive
 | 
				
			||||||
        self.goal = goal.copy()
 | 
					        self.goal = goal.copy()
 | 
				
			||||||
        self.algorithm = algorithm
 | 
					        self.algorithm = algorithm
 | 
				
			||||||
| 
						 | 
					@ -37,7 +37,6 @@ class World(object):
 | 
				
			||||||
        self.shuffle_bonk_prizes = False
 | 
					        self.shuffle_bonk_prizes = False
 | 
				
			||||||
        self.light_world_light_cone = False
 | 
					        self.light_world_light_cone = False
 | 
				
			||||||
        self.dark_world_light_cone = False
 | 
					        self.dark_world_light_cone = False
 | 
				
			||||||
        self.clock_mode = 'off'
 | 
					 | 
				
			||||||
        self.rupoor_cost = 10
 | 
					        self.rupoor_cost = 10
 | 
				
			||||||
        self.aga_randomness = True
 | 
					        self.aga_randomness = True
 | 
				
			||||||
        self.lock_aga_door_in_escape = False
 | 
					        self.lock_aga_door_in_escape = False
 | 
				
			||||||
| 
						 | 
					@ -48,7 +47,6 @@ class World(object):
 | 
				
			||||||
        self.retro = retro.copy()
 | 
					        self.retro = retro.copy()
 | 
				
			||||||
        self.custom = custom
 | 
					        self.custom = custom
 | 
				
			||||||
        self.customitemarray = customitemarray
 | 
					        self.customitemarray = customitemarray
 | 
				
			||||||
        self.can_take_damage = True
 | 
					 | 
				
			||||||
        self.hints = hints.copy()
 | 
					        self.hints = hints.copy()
 | 
				
			||||||
        self.dynamic_regions = []
 | 
					        self.dynamic_regions = []
 | 
				
			||||||
        self.dynamic_locations = []
 | 
					        self.dynamic_locations = []
 | 
				
			||||||
| 
						 | 
					@ -93,6 +91,8 @@ class World(object):
 | 
				
			||||||
            set_player_attr('open_pyramid', False)
 | 
					            set_player_attr('open_pyramid', False)
 | 
				
			||||||
            set_player_attr('treasure_hunt_icon', 'Triforce Piece')
 | 
					            set_player_attr('treasure_hunt_icon', 'Triforce Piece')
 | 
				
			||||||
            set_player_attr('treasure_hunt_count', 0)
 | 
					            set_player_attr('treasure_hunt_count', 0)
 | 
				
			||||||
 | 
					            set_player_attr('clock_mode', 'off')
 | 
				
			||||||
 | 
					            set_player_attr('can_take_damage', False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_name_string_for_object(self, obj):
 | 
					    def get_name_string_for_object(self, obj):
 | 
				
			||||||
        return obj.name if self.players == 1 else f'{obj.name} ({self.get_player_names(obj.player)})'
 | 
					        return obj.name if self.players == 1 else f'{obj.name} ({self.get_player_names(obj.player)})'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -289,7 +289,7 @@ def parse_arguments(argv, no_defaults=False):
 | 
				
			||||||
            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',
 | 
					            for name in ['logic', 'mode', 'swords', 'goal', 'difficulty', 'item_functionality',
 | 
				
			||||||
                         'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid',
 | 
					                         'shuffle', 'crystals_ganon', 'crystals_gt', 'openpyramid', 'timer',
 | 
				
			||||||
                         'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory',
 | 
					                         'mapshuffle', 'compassshuffle', 'keyshuffle', 'bigkeyshuffle', 'startinventory',
 | 
				
			||||||
                         'retro', 'accessibility', 'hints', 'beemizer',
 | 
					                         'retro', 'accessibility', 'hints', 'beemizer',
 | 
				
			||||||
                         'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',
 | 
					                         'shufflebosses', 'shuffleenemies', 'enemy_health', 'enemy_damage', 'shufflepots',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										10
									
								
								ItemList.py
								
								
								
								
							
							
						
						
									
										10
									
								
								ItemList.py
								
								
								
								
							| 
						 | 
					@ -129,12 +129,12 @@ def generate_itempool(world, player):
 | 
				
			||||||
                                                                                                   'dungeons',
 | 
					                                                                                                   'dungeons',
 | 
				
			||||||
                                                                                                   'triforcehunt',
 | 
					                                                                                                   'triforcehunt',
 | 
				
			||||||
                                                                                                   'crystals']
 | 
					                                                                                                   'crystals']
 | 
				
			||||||
            or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer not in ['none', 'display',
 | 
					            or world.mode[player] not in ['open', 'standard', 'inverted'] or world.timer[player] not in ['none', 'display',
 | 
				
			||||||
                                                                                                 'timed', 'timed-ohko',
 | 
					                                                                                                 'timed', 'timed-ohko',
 | 
				
			||||||
                                                                                                 'ohko',
 | 
					                                                                                                 'ohko',
 | 
				
			||||||
                                                                                                 'timed-countdown']):
 | 
					                                                                                                 'timed-countdown']):
 | 
				
			||||||
        raise NotImplementedError('Not supported yet')
 | 
					        raise NotImplementedError('Not supported yet')
 | 
				
			||||||
    if world.timer in ['ohko', 'timed-ohko']:
 | 
					    if world.timer[player] in ['ohko', 'timed-ohko']:
 | 
				
			||||||
        world.can_take_damage = False
 | 
					        world.can_take_damage = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if world.goal[player] in ['pedestal', 'triforcehunt']:
 | 
					    if world.goal[player] in ['pedestal', 'triforcehunt']:
 | 
				
			||||||
| 
						 | 
					@ -181,14 +181,14 @@ def generate_itempool(world, player):
 | 
				
			||||||
    if world.custom:
 | 
					    if world.custom:
 | 
				
			||||||
        (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
 | 
					        (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
 | 
				
			||||||
         lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive[player], world.shuffle[player],
 | 
					         lamps_needed_for_dark_rooms) = make_custom_item_pool(world.progressive[player], world.shuffle[player],
 | 
				
			||||||
                                                              world.difficulty[player], world.timer, world.goal[player],
 | 
					                                                              world.difficulty[player], world.timer[player], world.goal[player],
 | 
				
			||||||
                                                              world.mode[player], world.swords[player],
 | 
					                                                              world.mode[player], world.swords[player],
 | 
				
			||||||
                                                              world.retro[player], world.customitemarray)
 | 
					                                                              world.retro[player], world.customitemarray)
 | 
				
			||||||
        world.rupoor_cost = min(world.customitemarray[69], 9999)
 | 
					        world.rupoor_cost = min(world.customitemarray[69], 9999)
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
 | 
					        (pool, placed_items, precollected_items, clock_mode, treasure_hunt_count, treasure_hunt_icon,
 | 
				
			||||||
         lamps_needed_for_dark_rooms) = get_pool_core(world.progressive[player], world.shuffle[player],
 | 
					         lamps_needed_for_dark_rooms) = get_pool_core(world.progressive[player], world.shuffle[player],
 | 
				
			||||||
                                                      world.difficulty[player], world.timer, world.goal[player],
 | 
					                                                      world.difficulty[player], world.timer[player], world.goal[player],
 | 
				
			||||||
                                                      world.mode[player], world.swords[player], world.retro[player])
 | 
					                                                      world.mode[player], world.swords[player], world.retro[player])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for item in precollected_items:
 | 
					    for item in precollected_items:
 | 
				
			||||||
| 
						 | 
					@ -226,7 +226,7 @@ def generate_itempool(world, player):
 | 
				
			||||||
    world.lamps_needed_for_dark_rooms = lamps_needed_for_dark_rooms
 | 
					    world.lamps_needed_for_dark_rooms = lamps_needed_for_dark_rooms
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if clock_mode is not None:
 | 
					    if clock_mode is not None:
 | 
				
			||||||
        world.clock_mode = clock_mode
 | 
					        world.clock_mode[player] = clock_mode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if treasure_hunt_count is not None:
 | 
					    if treasure_hunt_count is not None:
 | 
				
			||||||
        world.treasure_hunt_count[player] = treasure_hunt_count
 | 
					        world.treasure_hunt_count[player] = treasure_hunt_count
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								Main.py
								
								
								
								
							
							
						
						
									
										2
									
								
								Main.py
								
								
								
								
							| 
						 | 
					@ -54,6 +54,7 @@ def main(args, seed=None):
 | 
				
			||||||
    world.enemy_health = args.enemy_health.copy()
 | 
					    world.enemy_health = args.enemy_health.copy()
 | 
				
			||||||
    world.enemy_damage = args.enemy_damage.copy()
 | 
					    world.enemy_damage = args.enemy_damage.copy()
 | 
				
			||||||
    world.beemizer = args.beemizer.copy()
 | 
					    world.beemizer = args.beemizer.copy()
 | 
				
			||||||
 | 
					    world.timer = args.timer.copy()
 | 
				
			||||||
    world.shufflepots = args.shufflepots.copy()
 | 
					    world.shufflepots = args.shufflepots.copy()
 | 
				
			||||||
    world.progressive = args.progressive.copy()
 | 
					    world.progressive = args.progressive.copy()
 | 
				
			||||||
    world.extendedmsu = args.extendedmsu.copy()
 | 
					    world.extendedmsu = args.extendedmsu.copy()
 | 
				
			||||||
| 
						 | 
					@ -273,6 +274,7 @@ def copy_world(world):
 | 
				
			||||||
    ret.enemy_health = world.enemy_health.copy()
 | 
					    ret.enemy_health = world.enemy_health.copy()
 | 
				
			||||||
    ret.enemy_damage = world.enemy_damage.copy()
 | 
					    ret.enemy_damage = world.enemy_damage.copy()
 | 
				
			||||||
    ret.beemizer = world.beemizer.copy()
 | 
					    ret.beemizer = world.beemizer.copy()
 | 
				
			||||||
 | 
					    ret.timer = world.timer.copy()
 | 
				
			||||||
    ret.shufflepots = world.shufflepots.copy()
 | 
					    ret.shufflepots = world.shufflepots.copy()
 | 
				
			||||||
    ret.extendedmsu = world.extendedmsu.copy()
 | 
					    ret.extendedmsu = world.extendedmsu.copy()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -217,6 +217,13 @@ def roll_settings(weights):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret.beemizer = int(get_choice('beemizer')) if 'beemizer' in weights else 0
 | 
					    ret.beemizer = int(get_choice('beemizer')) if 'beemizer' in weights else 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ret.timer = {'none': 'none',
 | 
				
			||||||
 | 
					                 'timed': 'timed',
 | 
				
			||||||
 | 
					                 'timed_ohko': 'timed-ohko',
 | 
				
			||||||
 | 
					                 'ohko': 'ohko',
 | 
				
			||||||
 | 
					                 'timed_countdown': 'timed-countdown',
 | 
				
			||||||
 | 
					                 'display': 'display'}[get_choice('timer')] if 'timer' in weights.keys() else 'none'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret.progressive = convert_to_on_off(get_choice('progressive')) if "progressive" in weights else 'on'
 | 
					    ret.progressive = convert_to_on_off(get_choice('progressive')) if "progressive" in weights else 'on'
 | 
				
			||||||
    inventoryweights = weights.get('startinventory', {})
 | 
					    inventoryweights = weights.get('startinventory', {})
 | 
				
			||||||
    startitems = []
 | 
					    startitems = []
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								Rom.py
								
								
								
								
							
							
						
						
									
										14
									
								
								Rom.py
								
								
								
								
							| 
						 | 
					@ -707,7 +707,7 @@ def patch_rom(world, rom, player, team, enemized):
 | 
				
			||||||
        # Set stun items
 | 
					        # Set stun items
 | 
				
			||||||
        rom.write_byte(0x180180, 0x03) # All standard items
 | 
					        rom.write_byte(0x180180, 0x03) # All standard items
 | 
				
			||||||
        #Set overflow items for progressive equipment
 | 
					        #Set overflow items for progressive equipment
 | 
				
			||||||
        if world.timer in ['timed', 'timed-countdown', 'timed-ohko']:
 | 
					        if world.timer[player] in ['timed', 'timed-countdown', 'timed-ohko']:
 | 
				
			||||||
            overflow_replacement = GREEN_CLOCK
 | 
					            overflow_replacement = GREEN_CLOCK
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            overflow_replacement = GREEN_TWENTY_RUPEES
 | 
					            overflow_replacement = GREEN_TWENTY_RUPEES
 | 
				
			||||||
| 
						 | 
					@ -861,19 +861,19 @@ def patch_rom(world, rom, player, team, enemized):
 | 
				
			||||||
        ERtimeincrease = 20
 | 
					        ERtimeincrease = 20
 | 
				
			||||||
    if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]:
 | 
					    if world.keyshuffle[player] or world.bigkeyshuffle[player] or world.mapshuffle[player]:
 | 
				
			||||||
        ERtimeincrease = ERtimeincrease + 15
 | 
					        ERtimeincrease = ERtimeincrease + 15
 | 
				
			||||||
    if world.clock_mode == 'off':
 | 
					    if world.clock_mode[player] == 'off':
 | 
				
			||||||
        rom.write_bytes(0x180190, [0x00, 0x00, 0x00])  # turn off clock mode
 | 
					        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, 0x180200, 0)  # red clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180204, 0)  # blue clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180204, 0)  # blue clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180208, 0)  # green clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180208, 0)  # green clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
					        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
				
			||||||
    elif world.clock_mode == 'ohko':
 | 
					    elif world.clock_mode[player] == 'ohko':
 | 
				
			||||||
        rom.write_bytes(0x180190, [0x01, 0x02, 0x01])  # ohko timer with resetable timer functionality
 | 
					        rom.write_bytes(0x180190, [0x01, 0x02, 0x01])  # ohko timer with resetable timer functionality
 | 
				
			||||||
        write_int32(rom, 0x180200, 0)  # red clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180200, 0)  # red clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180204, 0)  # blue clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180204, 0)  # blue clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180208, 0)  # green clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180208, 0)  # green clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
					        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
				
			||||||
    elif world.clock_mode == 'countdown-ohko':
 | 
					    elif world.clock_mode[player] == 'countdown-ohko':
 | 
				
			||||||
        rom.write_bytes(0x180190, [0x01, 0x02, 0x01])  # ohko timer with resetable timer functionality
 | 
					        rom.write_bytes(0x180190, [0x01, 0x02, 0x01])  # ohko timer with resetable timer functionality
 | 
				
			||||||
        write_int32(rom, 0x180200, -100 * 60 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180200, -100 * 60 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
				
			||||||
| 
						 | 
					@ -882,13 +882,13 @@ def patch_rom(world, rom, player, team, enemized):
 | 
				
			||||||
            write_int32(rom, 0x18020C, (10 + ERtimeincrease) * 60 * 60)  # starting time (in frames, sint32)
 | 
					            write_int32(rom, 0x18020C, (10 + ERtimeincrease) * 60 * 60)  # starting time (in frames, sint32)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            write_int32(rom, 0x18020C, int((5 + ERtimeincrease / 2) * 60 * 60))  # starting time (in frames, sint32)
 | 
					            write_int32(rom, 0x18020C, int((5 + ERtimeincrease / 2) * 60 * 60))  # starting time (in frames, sint32)
 | 
				
			||||||
    if world.clock_mode == 'stopwatch':
 | 
					    if world.clock_mode[player] == 'stopwatch':
 | 
				
			||||||
        rom.write_bytes(0x180190, [0x02, 0x01, 0x00])  # set stopwatch mode
 | 
					        rom.write_bytes(0x180190, [0x02, 0x01, 0x00])  # set stopwatch mode
 | 
				
			||||||
        write_int32(rom, 0x180200, -2 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180200, -2 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180208, 4 * 60 * 60)  # green clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180208, 4 * 60 * 60)  # green clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
					        write_int32(rom, 0x18020C, 0)  # starting time (in frames, sint32)
 | 
				
			||||||
    if world.clock_mode == 'countdown':
 | 
					    if world.clock_mode[player] == 'countdown':
 | 
				
			||||||
        rom.write_bytes(0x180190, [0x01, 0x01, 0x00])  # set countdown, with no reset available
 | 
					        rom.write_bytes(0x180190, [0x01, 0x01, 0x00])  # set countdown, with no reset available
 | 
				
			||||||
        write_int32(rom, 0x180200, -2 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180200, -2 * 60 * 60)  # red clock adjustment time (in frames, sint32)
 | 
				
			||||||
        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
					        write_int32(rom, 0x180204, 2 * 60 * 60)  # blue clock adjustment time (in frames, sint32)
 | 
				
			||||||
| 
						 | 
					@ -1119,7 +1119,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
 | 
					    rom.write_byte(0x18003B, 0x01 if world.mapshuffle[player] else 0x00)  # maps showing crystals on overworld
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # compasses showing dungeon count
 | 
					    # compasses showing dungeon count
 | 
				
			||||||
    if world.clock_mode != 'off':
 | 
					    if world.clock_mode[player] != 'off':
 | 
				
			||||||
        rom.write_byte(0x18003C, 0x00)  # Currently must be off if timer is on, because they use same HUD location
 | 
					        rom.write_byte(0x18003C, 0x00)  # Currently must be off if timer is on, because they use same HUD location
 | 
				
			||||||
    elif world.compassshuffle[player]:
 | 
					    elif world.compassshuffle[player]:
 | 
				
			||||||
        rom.write_byte(0x18003C, 0x01)  # show on pickup
 | 
					        rom.write_byte(0x18003C, 0x01)  # show on pickup
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue