From e15aad356afe96cad96adc7e30aa53f89c70bdf0 Mon Sep 17 00:00:00 2001 From: compiling <8335770+compiling@users.noreply.github.com> Date: Fri, 10 Jul 2020 17:37:35 +1000 Subject: [PATCH] Fix up no logic entrance rules - create all the OWG transitions, but don't apply any logic --- OverworldGlitchRules.py | 26 ++++++++++++++++++++++++++ Rules.py | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/OverworldGlitchRules.py b/OverworldGlitchRules.py index 9b1250d3..151d9744 100644 --- a/OverworldGlitchRules.py +++ b/OverworldGlitchRules.py @@ -218,6 +218,24 @@ def get_invalid_bunny_revival_dungeons(): yield 'Sanctuary' +def no_logic_rules(world, player): + """ + Add OWG transitions to no logic player's world + """ + create_no_logic_connections(player, world, get_boots_clip_exits_lw(world.mode[player] == 'inverted')) + create_no_logic_connections(player, world, get_boots_clip_exits_dw(world.mode[player] == 'inverted', player)) + + # Glitched speed drops. + create_no_logic_connections(player, world, get_glitched_speed_drops_dw(world.mode[player] == 'inverted')) + + # Mirror clip spots. + if world.mode[player] != 'inverted': + create_no_logic_connections(player, world, get_mirror_clip_spots_dw()) + create_no_logic_connections(player, world, get_mirror_offset_spots_dw()) + else: + create_no_logic_connections(player, world, get_mirror_offset_spots_lw(player)) + + def overworld_glitches_rules(world, player): # Boots-accessible locations. @@ -257,6 +275,14 @@ def add_alternate_rule(entrance, rule): entrance.access_rule = lambda state: old_rule(state) or rule(state) +def create_no_logic_connections(player, world, connections): + for entrance, parent_region, target_region, *rule_override in connections: + parent = world.get_region(parent_region, player) + target = world.get_region(target_region, player) + connection = Entrance(player, entrance, parent) + parent.exits.append(connection) + connection.connect(target) + def create_owg_connections(player, world, connections, default_rule): for entrance, parent_region, target_region, *rule_override in connections: parent = world.get_region(parent_region, player) diff --git a/Rules.py b/Rules.py index 420f2d35..e72b5f93 100644 --- a/Rules.py +++ b/Rules.py @@ -3,7 +3,7 @@ import logging import OverworldGlitchRules from BaseClasses import RegionType, World, Entrance from Items import ItemFactory -from OverworldGlitchRules import overworld_glitches_rules +from OverworldGlitchRules import overworld_glitches_rules, no_logic_rules def set_rules(world, player): @@ -11,6 +11,7 @@ def set_rules(world, player): if world.logic[player] == 'nologic': logging.getLogger('').info('WARNING! Seeds generated under this logic often require major glitches and may be impossible!') world.get_region('Menu', player).can_reach_private = lambda state: True + no_logic_rules(world, player) for exit in world.get_region('Menu', player).exits: exit.hide_path = True return