From 229747b4a417271bf5b599bee3ee653e59bb9a4d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 3 Aug 2021 09:29:16 -0500 Subject: [PATCH] Added dynamic flute exits --- Main.py | 4 +++- OverworldShuffle.py | 18 ++++++++++++++---- Regions.py | 2 +- Rules.py | 2 -- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Main.py b/Main.py index 007595de..6bf42916 100644 --- a/Main.py +++ b/Main.py @@ -16,7 +16,7 @@ from OverworldGlitchRules import create_owg_connections from PotShuffle import shuffle_pots from Regions import create_regions, create_shops, mark_light_world_regions, mark_dark_world_regions, create_dungeon_regions, adjust_locations from OWEdges import create_owedges -from OverworldShuffle import link_overworld +from OverworldShuffle import link_overworld, create_flute_exits from EntranceShuffle import link_entrances from Rom import patch_rom, patch_race_rom, patch_enemizer, apply_rom_settings, LocalRom, JsonRom, get_hash_string from Doors import create_doors @@ -162,6 +162,7 @@ def main(args, seed=None, fish=None): for player in range(1, world.players + 1): link_overworld(world, player) + create_flute_exits(world, player) logger.info(world.fish.translate("cli","cli","shuffling.world")) @@ -420,6 +421,7 @@ def copy_world(world): for player in range(1, world.players + 1): create_regions(ret, player) + create_flute_exits(ret, player) create_dungeon_regions(ret, player) create_shops(ret, player) create_rooms(ret, player) diff --git a/OverworldShuffle.py b/OverworldShuffle.py index 612a5f7e..f2a0bb4a 100644 --- a/OverworldShuffle.py +++ b/OverworldShuffle.py @@ -1,5 +1,5 @@ import RaceRandom as random, logging, copy -from BaseClasses import OWEdge, WorldType, RegionType, Direction, Terrain, PolSlot +from BaseClasses import OWEdge, WorldType, RegionType, Direction, Terrain, PolSlot, Entrance from OWEdges import OWTileRegions, OWTileGroups, OWEdgeGroups, OpenStd, parallel_links, IsParallel __version__ = '0.1.7.2-u' @@ -500,6 +500,18 @@ def reorganize_groups(world, groups, player): else: raise NotImplementedError('Shuffling not supported yet') +def create_flute_exits(world, player): + for region in world.regions: + if ((region.type == RegionType.LightWorld and region.name not in world.owswaps[player][1]) + or (region.type == RegionType.DarkWorld and region.name in world.owswaps[player][2])) \ + and region.name not in ['Zoras Domain', 'Master Sword Meadow', 'Hobo Bridge']: + exitname = 'Flute From ' + region.name + exit = Entrance(region.player, exitname, region) + exit.access_rule = lambda state: state.can_flute(player) + exit.connect(world.get_region('Flute Sky', player)) + region.exits.append(exit) + world.initialize_regions() + test_connections = [ #('Links House ES', 'Octoballoon WS'), #('Links House NE', 'Lost Woods Pass SW') @@ -513,9 +525,7 @@ temporary_mandatory_connections = [ ] # these are connections that cannot be shuffled and always exist. They link together separate parts of the world we need to divide into regions -mandatory_connections = [('Flute Away', 'Flute Sky'), - - # Whirlpool Connections +mandatory_connections = [# Whirlpool Connections ('C Whirlpool', 'River Bend Water'), ('River Bend Whirlpool', 'C Whirlpool Water'), ('Lake Hylia Whirlpool', 'Zora Waterfall Water'), diff --git a/Regions.py b/Regions.py index 40d84a28..c916716e 100644 --- a/Regions.py +++ b/Regions.py @@ -79,7 +79,7 @@ def create_regions(world, player): create_lw_region(player, 'Flute Boy Area', ['Flute Spot'], ['Stumpy Mirror Spot', 'Flute Boy SC']), create_lw_region(player, 'Flute Boy Pass', None, ['Stumpy Pass Mirror Spot', 'Flute Boy WS', 'Flute Boy SW']), create_lw_region(player, 'Central Bonk Rocks Area', None, ['Bonk Fairy (Light)', 'Dark Bonk Rocks Mirror Spot', 'Central Bonk Rocks NW', 'Central Bonk Rocks SW', 'Central Bonk Rocks EN', 'Central Bonk Rocks EC', 'Central Bonk Rocks ES']), - create_lw_region(player, 'Links House Area', None, ['Links House', 'Big Bomb Shop Mirror Spot', 'Links House NE', 'Links House WN', 'Links House WC', 'Links House WS', 'Links House SC', 'Links House ES', 'Flute Away']), + create_lw_region(player, 'Links House Area', None, ['Links House', 'Big Bomb Shop Mirror Spot', 'Links House NE', 'Links House WN', 'Links House WC', 'Links House WS', 'Links House SC', 'Links House ES']), create_lw_region(player, 'Stone Bridge Area', None, ['Hammer Bridge North Mirror Spot', 'Hammer Bridge South Mirror Spot', 'Stone Bridge NC', 'Stone Bridge EN', 'Stone Bridge WS', 'Stone Bridge SC']), create_lw_region(player, 'Stone Bridge Water', None, ['Dark Hobo Mirror Spot', 'Stone Bridge WC', 'Stone Bridge EC']), create_lw_region(player, 'Hobo Bridge', ['Hobo'], ['Hobo EC']), diff --git a/Rules.py b/Rules.py index 0a1bc261..ba46fe55 100644 --- a/Rules.py +++ b/Rules.py @@ -792,8 +792,6 @@ def default_rules(world, player): set_rule(world.get_entrance('Dark C Whirlpool Rock (Bottom)', player), lambda state: state.can_lift_rocks(player)) set_rule(world.get_entrance('Dark C Whirlpool Rock (Top)', player), lambda state: state.can_lift_rocks(player)) - set_rule(world.get_entrance('Flute Away', player), lambda state: state.can_flute(player)) - set_rule(world.get_entrance('Zora Waterfall Water Drop', player), lambda state: state.has('Flippers', player)) set_rule(world.get_entrance('Zora Waterfall Water Entry', player), lambda state: state.has('Flippers', player)) set_rule(world.get_entrance('Waterfall of Wishing Cave Entry', player), lambda state: state.has('Flippers', player))