Skip to content

Commit

Permalink
This really annoying thing
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholassaylor committed Nov 30, 2024
1 parent f29ffb8 commit 6ebc0a3
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions worlds/alttp/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

def set_rules(world):
player = world.player
multiworld = world.multiworld
world = world.multiworld
if world.options.glitches_required == 'no_logic':
if player == next(player_id for player_id in multiworld.get_game_players("A Link to the Past")
if multiworld.worlds[player_id].options.glitches_required == 'no_logic'): # only warn one time
if player == next(player_id for player_id in world.get_game_players("A Link to the Past")
if world.worlds[player_id].options.glitches_required == 'no_logic'): # only warn one time
logging.info(
'WARNING! Seeds generated under this logic often require major glitches and may be impossible!')

if multiworld.players == 1:
for exit in multiworld.get_region('Menu', player).exits:
if world.players == 1:
for exit in world.get_region('Menu', player).exits:
exit.hide_path = True
return
else:
Expand All @@ -44,82 +44,82 @@ def set_rules(world):
world.options.progression_balancing.value = 0

else:
multiworld.completion_condition[player] = lambda state: state.has('Triforce', player)
world.completion_condition[player] = lambda state: state.has('Triforce', player)

dungeon_boss_rules(multiworld, player)
global_rules(multiworld, player)
dungeon_boss_rules(world, player)
global_rules(world, player)

if world.options.mode != 'inverted':
default_rules(multiworld, player)
default_rules(world, player)

if world.options.mode == 'open':
open_rules(multiworld, player)
open_rules(world, player)
elif world.options.mode == 'standard':
standard_rules(multiworld, player)
standard_rules(world, player)
elif world.options.mode == 'inverted':
open_rules(multiworld, player)
inverted_rules(multiworld, player)
open_rules(world, player)
inverted_rules(world, player)
else:
raise NotImplementedError(f'World state {world.options.mode} is not implemented yet')

if world.options.glitches_required == 'no_glitches':
no_glitches_rules(multiworld, player)
forbid_bomb_jump_requirements(multiworld, player)
no_glitches_rules(world, player)
forbid_bomb_jump_requirements(world, player)
elif world.options.glitches_required == 'overworld_glitches':
# Initially setting no_glitches_rules to set the baseline rules for some
# entrances. The overworld_glitches_rules set is primarily additive.
no_glitches_rules(multiworld, player)
fake_flipper_rules(multiworld, player)
overworld_glitches_rules(multiworld, player)
forbid_bomb_jump_requirements(multiworld, player)
no_glitches_rules(world, player)
fake_flipper_rules(world, player)
overworld_glitches_rules(world, player)
forbid_bomb_jump_requirements(world, player)
elif world.options.glitches_required.value in ['hybrid_major_glitches', 'no_logic']:
no_glitches_rules(multiworld, player)
fake_flipper_rules(multiworld, player)
overworld_glitches_rules(multiworld, player)
underworld_glitches_rules(multiworld, player)
bomb_jump_requirements(multiworld, player)
no_glitches_rules(world, player)
fake_flipper_rules(world, player)
overworld_glitches_rules(world, player)
underworld_glitches_rules(world, player)
bomb_jump_requirements(world, player)
elif world.options.glitches_required == 'minor_glitches':
no_glitches_rules(multiworld, player)
fake_flipper_rules(multiworld, player)
forbid_bomb_jump_requirements(multiworld, player)
no_glitches_rules(world, player)
fake_flipper_rules(world, player)
forbid_bomb_jump_requirements(world, player)
else:
raise NotImplementedError(f'Not implemented yet: Logic - {world.options.glitches_required}')

if world.options.goal == 'bosses':
# require all bosses to beat ganon
add_rule(multiworld.get_location('Ganon', player), lambda state: state.can_reach('Master Sword Pedestal', 'Location', player) and state.has('Beat Agahnim 1', player) and state.has('Beat Agahnim 2', player) and has_crystals(state, 7, player))
add_rule(world.get_location('Ganon', player), lambda state: state.can_reach('Master Sword Pedestal', 'Location', player) and state.has('Beat Agahnim 1', player) and state.has('Beat Agahnim 2', player) and has_crystals(state, 7, player))
elif world.options.goal == 'ganon':
# require aga2 to beat ganon
add_rule(multiworld.get_location('Ganon', player), lambda state: state.has('Beat Agahnim 2', player))
add_rule(world.get_location('Ganon', player), lambda state: state.has('Beat Agahnim 2', player))

if world.options.mode != 'inverted':
set_big_bomb_rules(multiworld, player)
set_big_bomb_rules(world, player)
if world.options.glitches_required.current_key in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.options.entrance_shuffle.current_key not in {'insanity', 'insanity_legacy', 'madness'}:
path_to_courtyard = mirrorless_path_to_castle_courtyard(multiworld, player)
add_rule(multiworld.get_entrance('Pyramid Fairy', player), lambda state: state.multiworld.get_entrance('Dark Death Mountain Offset Mirror', player).can_reach(state) and all(rule(state) for rule in path_to_courtyard), 'or')
path_to_courtyard = mirrorless_path_to_castle_courtyard(world, player)
add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: state.multiworld.get_entrance('Dark Death Mountain Offset Mirror', player).can_reach(state) and all(rule(state) for rule in path_to_courtyard), 'or')
else:
set_inverted_big_bomb_rules(multiworld, player)
set_inverted_big_bomb_rules(world, player)

# if swamp and dam have not been moved we require mirror for swamp palace
# however there is mirrorless swamp in hybrid MG, so we don't necessarily want this. HMG handles this requirement itself.
if not multiworld.worlds[player].swamp_patch_required and world.options.glitches_required.value not in ['hybrid_major_glitches', 'no_logic']:
add_rule(multiworld.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Magic Mirror', player))
if not world.worlds[player].swamp_patch_required and world.options.glitches_required.value not in ['hybrid_major_glitches', 'no_logic']:
add_rule(world.get_entrance('Swamp Palace Moat', player), lambda state: state.has('Magic Mirror', player))

# GT Entrance may be required for Turtle Rock for OWG and < 7 required
ganons_tower = multiworld.get_entrance('Inverted Ganons Tower' if world.options.mode == 'inverted' else 'Ganons Tower', player)
ganons_tower = world.get_entrance('Inverted Ganons Tower' if world.options.mode == 'inverted' else 'Ganons Tower', player)
if (world.options.crystals_needed_for_gt == 7
and not (world.options.glitches_required.value
in ['overworld_glitches', 'hybrid_major_glitches', 'no_logic']
and world.options.mode != 'inverted')):
set_rule(ganons_tower, lambda state: False)

set_trock_key_rules(multiworld, player)
set_trock_key_rules(world, player)

set_rule(ganons_tower, lambda state: has_crystals(state, state.multiworld.worlds[player].options.crystals_needed_for_gt, player))
if world.options.mode != 'inverted' and world.options.glitches_required in ['overworld_glitches', 'hybrid_major_glitches', 'no_logic']:
add_rule(multiworld.get_entrance('Ganons Tower', player), lambda state: state.multiworld.get_entrance('Ganons Tower Ascent', player).can_reach(state), 'or')
add_rule(world.get_entrance('Ganons Tower', player), lambda state: state.multiworld.get_entrance('Ganons Tower Ascent', player).can_reach(state), 'or')

set_bunny_rules(multiworld, player, world.options.mode == 'inverted')
set_bunny_rules(world, player, world.options.mode == 'inverted')


def mirrorless_path_to_castle_courtyard(world, player):
Expand Down

0 comments on commit 6ebc0a3

Please sign in to comment.