Added HMG check to all checks for OWG and NL
This commit is contained in:
		
							parent
							
								
									d425e5eb6a
								
							
						
					
					
						commit
						deff356910
					
				
							
								
								
									
										2
									
								
								Fill.py
								
								
								
								
							
							
						
						
									
										2
									
								
								Fill.py
								
								
								
								
							| 
						 | 
					@ -93,7 +93,7 @@ def distribute_items_restrictive(world, gftower_trash=False, fill_locations=None
 | 
				
			||||||
    # fill in gtower locations with trash first
 | 
					    # fill in gtower locations with trash first
 | 
				
			||||||
    for player in world.alttp_player_ids:
 | 
					    for player in world.alttp_player_ids:
 | 
				
			||||||
        if not gftower_trash or not world.ganonstower_vanilla[player] or \
 | 
					        if not gftower_trash or not world.ganonstower_vanilla[player] or \
 | 
				
			||||||
                world.logic[player] in {'owglitches', 'hybridmg', "nologic"}:
 | 
					                world.logic[player] in {'owglitches', 'hybridglitches', "nologic"}:
 | 
				
			||||||
            gtower_trash_count = 0
 | 
					            gtower_trash_count = 0
 | 
				
			||||||
        elif 'triforcehunt' in world.goal[player] and ('local' in world.goal[player] or world.players == 1):
 | 
					        elif 'triforcehunt' in world.goal[player] and ('local' in world.goal[player] or world.players == 1):
 | 
				
			||||||
            gtower_trash_count = world.random.randint(world.crystals_needed_for_gt[player] * 2,
 | 
					            gtower_trash_count = world.random.randint(world.crystals_needed_for_gt[player] * 2,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -121,8 +121,8 @@ def GanonDefeatRule(state, player: int):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    can_hurt = state.has_beam_sword(player)
 | 
					    can_hurt = state.has_beam_sword(player)
 | 
				
			||||||
    common = can_hurt and state.has_fire_source(player)
 | 
					    common = can_hurt and state.has_fire_source(player)
 | 
				
			||||||
    # silverless ganon may be needed in minor glitches
 | 
					    # silverless ganon may be needed in anything higher than no glitches
 | 
				
			||||||
    if state.world.logic[player] in {"owglitches", "minorglitches", "none"}:
 | 
					    if state.world.logic[player] != 'noglitches':
 | 
				
			||||||
        # need to light torch a sufficient amount of times
 | 
					        # need to light torch a sufficient amount of times
 | 
				
			||||||
        return common and (state.has('Tempered Sword', player) or state.has('Golden Sword', player) or (
 | 
					        return common and (state.has('Tempered Sword', player) or state.has('Golden Sword', player) or (
 | 
				
			||||||
                state.has('Silver Bow', player) and state.can_shoot_arrows(player)) or
 | 
					                state.has('Silver Bow', player) and state.can_shoot_arrows(player)) or
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,13 +21,14 @@ def parse_arguments(argv, no_defaults=False):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
 | 
					    parser = argparse.ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
 | 
				
			||||||
    parser.add_argument('--create_spoiler', help='Output a Spoiler File', action='store_true')
 | 
					    parser.add_argument('--create_spoiler', help='Output a Spoiler File', action='store_true')
 | 
				
			||||||
    parser.add_argument('--logic', default=defval('noglitches'), const='noglitches', nargs='?', choices=['noglitches', 'minorglitches', 'owglitches', 'nologic'],
 | 
					    parser.add_argument('--logic', default=defval('noglitches'), const='noglitches', nargs='?', choices=['noglitches', 'minorglitches', 'owglitches', 'hybridglitches', 'nologic'],
 | 
				
			||||||
                        help='''\
 | 
					                        help='''\
 | 
				
			||||||
                             Select Enforcement of Item Requirements. (default: %(default)s)
 | 
					                             Select Enforcement of Item Requirements. (default: %(default)s)
 | 
				
			||||||
                             No Glitches:
 | 
					                             No Glitches:
 | 
				
			||||||
                             Minor Glitches: May require Fake Flippers, Bunny Revival
 | 
					                             Minor Glitches: May require Fake Flippers, Bunny Revival
 | 
				
			||||||
                                             and Dark Room Navigation.
 | 
					                                             and Dark Room Navigation.
 | 
				
			||||||
                             Overworld Glitches: May require overworld glitches.
 | 
					                             Overworld Glitches: May require overworld glitches.
 | 
				
			||||||
 | 
					                             Hybrid Major Glitches: May require both overworld and underworld clipping. 
 | 
				
			||||||
                             No Logic: Distribute items without regard for
 | 
					                             No Logic: Distribute items without regard for
 | 
				
			||||||
                                             item requirements.
 | 
					                                             item requirements.
 | 
				
			||||||
                             ''')
 | 
					                             ''')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1949,7 +1949,7 @@ def connect_mandatory_exits(world, entrances, caves, must_be_exits, player):
 | 
				
			||||||
        invalid_connections = Must_Exit_Invalid_Connections.copy()
 | 
					        invalid_connections = Must_Exit_Invalid_Connections.copy()
 | 
				
			||||||
    invalid_cave_connections = defaultdict(set)
 | 
					    invalid_cave_connections = defaultdict(set)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if world.logic[player] in ['owglitches', 'nologic']:
 | 
					    if world.logic[player] in ['owglitches', 'hybridglitches', 'nologic']:
 | 
				
			||||||
        from worlds.alttp import OverworldGlitchRules
 | 
					        from worlds.alttp import OverworldGlitchRules
 | 
				
			||||||
        for entrance in OverworldGlitchRules.get_non_mandatory_exits(world.mode[player] == 'inverted'):
 | 
					        for entrance in OverworldGlitchRules.get_non_mandatory_exits(world.mode[player] == 'inverted'):
 | 
				
			||||||
            invalid_connections[entrance] = set()
 | 
					            invalid_connections[entrance] = set()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +74,7 @@ def set_rules(world, player):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if world.mode[player] != 'inverted':
 | 
					    if world.mode[player] != 'inverted':
 | 
				
			||||||
        set_big_bomb_rules(world, player)
 | 
					        set_big_bomb_rules(world, player)
 | 
				
			||||||
        if world.logic[player] in {'owglitches', 'nologic'} and world.shuffle[player] not in {'insanity', 'insanity_legacy', 'madness'}:
 | 
					        if world.logic[player] in {'owglitches', 'hybridglitches', 'nologic'} and world.shuffle[player] not in {'insanity', 'insanity_legacy', 'madness'}:
 | 
				
			||||||
            path_to_courtyard = mirrorless_path_to_castle_courtyard(world, player)
 | 
					            path_to_courtyard = mirrorless_path_to_castle_courtyard(world, player)
 | 
				
			||||||
            add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: state.world.get_entrance('Dark Death Mountain Offset Mirror', player).can_reach(state) and all(rule(state) for rule in path_to_courtyard), 'or')
 | 
					            add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: state.world.get_entrance('Dark Death Mountain Offset Mirror', player).can_reach(state) and all(rule(state) for rule in path_to_courtyard), 'or')
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
| 
						 | 
					@ -87,13 +87,13 @@ def set_rules(world, player):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # GT Entrance may be required for Turtle Rock for OWG and < 7 required
 | 
					    # GT Entrance may be required for Turtle Rock for OWG and < 7 required
 | 
				
			||||||
    ganons_tower = world.get_entrance('Inverted Ganons Tower' if world.mode[player] == 'inverted' else 'Ganons Tower', player)
 | 
					    ganons_tower = world.get_entrance('Inverted Ganons Tower' if world.mode[player] == 'inverted' else 'Ganons Tower', player)
 | 
				
			||||||
    if world.crystals_needed_for_gt[player] == 7 and not (world.logic[player] in ['owglitches', 'nologic'] and world.mode[player] != 'inverted'):
 | 
					    if world.crystals_needed_for_gt[player] == 7 and not (world.logic[player] in ['owglitches', 'hybridglitches', 'nologic'] and world.mode[player] != 'inverted'):
 | 
				
			||||||
        set_rule(ganons_tower, lambda state: False)
 | 
					        set_rule(ganons_tower, lambda state: False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set_trock_key_rules(world, player)
 | 
					    set_trock_key_rules(world, player)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set_rule(ganons_tower, lambda state: state.has_crystals(state.world.crystals_needed_for_gt[player], player))
 | 
					    set_rule(ganons_tower, lambda state: state.has_crystals(state.world.crystals_needed_for_gt[player], player))
 | 
				
			||||||
    if world.mode[player] != 'inverted' and world.logic[player] in ['owglitches', 'nologic']:
 | 
					    if world.mode[player] != 'inverted' and world.logic[player] in ['owglitches', 'hybridglitches', 'nologic']:
 | 
				
			||||||
        add_rule(world.get_entrance('Ganons Tower', player), lambda state: state.world.get_entrance('Ganons Tower Ascent', player).can_reach(state), 'or')
 | 
					        add_rule(world.get_entrance('Ganons Tower', player), lambda state: state.world.get_entrance('Ganons Tower Ascent', player).can_reach(state), 'or')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    set_bunny_rules(world, player, world.mode[player] == 'inverted')
 | 
					    set_bunny_rules(world, player, world.mode[player] == 'inverted')
 | 
				
			||||||
| 
						 | 
					@ -1394,7 +1394,7 @@ def set_bunny_rules(world: MultiWorld, player: int, inverted: bool):
 | 
				
			||||||
    def get_rule_to_add(region, location = None, connecting_entrance = None):
 | 
					    def get_rule_to_add(region, location = None, connecting_entrance = None):
 | 
				
			||||||
        # In OWG, a location can potentially be superbunny-mirror accessible or
 | 
					        # In OWG, a location can potentially be superbunny-mirror accessible or
 | 
				
			||||||
        # bunny revival accessible.
 | 
					        # bunny revival accessible.
 | 
				
			||||||
        if world.logic[player] in ['minorglitches', 'owglitches', 'nologic']:
 | 
					        if world.logic[player] in ['minorglitches', 'owglitches', 'hybridglitches', 'nologic']:
 | 
				
			||||||
            if region.name == 'Swamp Palace (Entrance)':  # Need to 0hp revive - not in logic
 | 
					            if region.name == 'Swamp Palace (Entrance)':  # Need to 0hp revive - not in logic
 | 
				
			||||||
                return lambda state: state.has('Moon Pearl', player)
 | 
					                return lambda state: state.has('Moon Pearl', player)
 | 
				
			||||||
            if region.name == 'Tower of Hera (Bottom)':  # Need to hit the crystal switch
 | 
					            if region.name == 'Tower of Hera (Bottom)':  # Need to hit the crystal switch
 | 
				
			||||||
| 
						 | 
					@ -1434,7 +1434,7 @@ def set_bunny_rules(world: MultiWorld, player: int, inverted: bool):
 | 
				
			||||||
                seen.add(new_region)
 | 
					                seen.add(new_region)
 | 
				
			||||||
                if not is_link(new_region):
 | 
					                if not is_link(new_region):
 | 
				
			||||||
                    # For glitch rulesets, establish superbunny and revival rules.
 | 
					                    # For glitch rulesets, establish superbunny and revival rules.
 | 
				
			||||||
                    if world.logic[player] in ['minorglitches', 'owglitches', 'nologic'] and entrance.name not in OverworldGlitchRules.get_invalid_bunny_revival_dungeons():
 | 
					                    if world.logic[player] in ['minorglitches', 'owglitches', 'hybridglitches', 'nologic'] and entrance.name not in OverworldGlitchRules.get_invalid_bunny_revival_dungeons():
 | 
				
			||||||
                        if region.name in OverworldGlitchRules.get_sword_required_superbunny_mirror_regions():
 | 
					                        if region.name in OverworldGlitchRules.get_sword_required_superbunny_mirror_regions():
 | 
				
			||||||
                            possible_options.append(lambda state: path_to_access_rule(new_path, entrance) and state.has('Magic Mirror', player) and state.has_sword(player))
 | 
					                            possible_options.append(lambda state: path_to_access_rule(new_path, entrance) and state.has('Magic Mirror', player) and state.has_sword(player))
 | 
				
			||||||
                        elif (region.name in OverworldGlitchRules.get_boots_required_superbunny_mirror_regions()
 | 
					                        elif (region.name in OverworldGlitchRules.get_boots_required_superbunny_mirror_regions()
 | 
				
			||||||
| 
						 | 
					@ -1472,7 +1472,7 @@ def set_bunny_rules(world: MultiWorld, player: int, inverted: bool):
 | 
				
			||||||
    # Add requirements for all locations that are actually in the dark world, except those available to the bunny, including dungeon revival
 | 
					    # Add requirements for all locations that are actually in the dark world, except those available to the bunny, including dungeon revival
 | 
				
			||||||
    for entrance in world.get_entrances():
 | 
					    for entrance in world.get_entrances():
 | 
				
			||||||
        if entrance.player == player and is_bunny(entrance.connected_region):
 | 
					        if entrance.player == player and is_bunny(entrance.connected_region):
 | 
				
			||||||
            if world.logic[player] in ['minorglitches', 'owglitches', 'nologic'] :
 | 
					            if world.logic[player] in ['minorglitches', 'owglitches', 'hybridglitches', 'nologic'] :
 | 
				
			||||||
                if entrance.connected_region.type == RegionType.Dungeon:
 | 
					                if entrance.connected_region.type == RegionType.Dungeon:
 | 
				
			||||||
                    if entrance.parent_region.type != RegionType.Dungeon and entrance.connected_region.name in OverworldGlitchRules.get_invalid_bunny_revival_dungeons():
 | 
					                    if entrance.parent_region.type != RegionType.Dungeon and entrance.connected_region.name in OverworldGlitchRules.get_invalid_bunny_revival_dungeons():
 | 
				
			||||||
                        add_rule(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
 | 
					                        add_rule(entrance, get_rule_to_add(entrance.connected_region, None, entrance))
 | 
				
			||||||
| 
						 | 
					@ -1480,7 +1480,7 @@ def set_bunny_rules(world: MultiWorld, player: int, inverted: bool):
 | 
				
			||||||
                if entrance.connected_region.name == 'Turtle Rock (Entrance)':
 | 
					                if entrance.connected_region.name == 'Turtle Rock (Entrance)':
 | 
				
			||||||
                    add_rule(world.get_entrance('Turtle Rock Entrance Gap', player), get_rule_to_add(entrance.connected_region, None, entrance))
 | 
					                    add_rule(world.get_entrance('Turtle Rock Entrance Gap', player), get_rule_to_add(entrance.connected_region, None, entrance))
 | 
				
			||||||
            for location in entrance.connected_region.locations:
 | 
					            for location in entrance.connected_region.locations:
 | 
				
			||||||
                if world.logic[player] in ['minorglitches', 'owglitches', 'nologic'] and entrance.name in OverworldGlitchRules.get_invalid_mirror_bunny_entrances():
 | 
					                if world.logic[player] in ['minorglitches', 'owglitches', 'hybridglitches', 'nologic'] and entrance.name in OverworldGlitchRules.get_invalid_mirror_bunny_entrances():
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
                if location.name in bunny_accessible_locations:
 | 
					                if location.name in bunny_accessible_locations:
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue