From e66908816d308dd43b15d5193358873e6b8cc95f Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 19 Sep 2019 14:44:33 -0600 Subject: [PATCH] Kill Landing/Warp End "Doors" --- BaseClasses.py | 1 - DoorShuffle.py | 27 +++++++++++++++------------ Doors.py | 7 ------- Regions.py | 4 ++-- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 8698ce0f..c203e14d 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -863,7 +863,6 @@ class Door(object): self.dest = None self.parentChunk = None self.blocked = False # Indicates if the door is normally blocked off. (Sanc door or always closed) - self.landing = False # Indicates a door only for matching Holes/Warp # Todo: add to those self.smallKey = False # There's a small key door on this side self.bigKey = False # There's a big key door on this side self.ugly = False # Indicates that it can't be seen from the front (e.g. back of a big key door) diff --git a/DoorShuffle.py b/DoorShuffle.py index 90d6e169..6d6447b2 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -215,10 +215,12 @@ def shuffle_dungeon(world, player, start_region_names, dungeon_region_names): if connect_door.ugly: next_ugly_region += 1 new_room_ugly_region = next_ugly_region + is_new_region = connect_region in available_regions # Add the doors for door in get_doors(world, connect_region, player): ugly_regions[door.name] = new_room_ugly_region - available_doors.append(door) + if is_new_region: + available_doors.append(door) # If an ugly door is anything but the connect door, panic and die if door != connect_door and door.ugly: logger.info('Failed because of ugly door, trying again.') @@ -226,15 +228,18 @@ def shuffle_dungeon(world, player, start_region_names, dungeon_region_names): return # We've used this region and door, so don't use them again - available_regions.remove(connect_region) - available_doors.remove(connect_door) + if is_new_region: + available_regions.remove(connect_region) + if connect_door in available_doors: + available_doors.remove(connect_door) else: # If there's no available region with a door, use an internal connection connect_door = find_compatible_door_in_list(ugly_regions, world, door, available_doors, player) if connect_door is not None: logger.info(' Adding loop via %s', connect_door.name) maybe_connect_two_way(world, door, connect_door, player) - available_doors.remove(connect_door) + if connect_door in available_doors: + available_doors.remove(connect_door) # Check that we used everything, and retry if we failed if len(available_regions) > 0 or len(available_doors) > 0: logger.info('Failed to add all regions to dungeon, trying again.') @@ -263,6 +268,8 @@ def maybe_connect_two_way(world, a, b, player): # Finds a compatible door in regions, returns the region and door def find_compatible_door_in_regions(world, door, regions, player): + if door.type in [DoorType.Hole, DoorType.Warp, DoorType.Logical]: + return door.dest, door for region in regions: for proposed_door in get_doors(world, region, player): if doors_compatible(door, proposed_door): @@ -270,6 +277,8 @@ def find_compatible_door_in_regions(world, door, regions, player): return None, None def find_compatible_door_in_list(ugly_regions, world, door, doors, player): + if door.type in [DoorType.Hole, DoorType.Warp, DoorType.Logical]: + return door for proposed_door in doors: if ugly_regions[door.name] != ugly_regions[proposed_door.name]: continue @@ -293,14 +302,12 @@ def doors_compatible(a, b): return doors_fit_mandatory_pair(open_edges, a, b) if a.type == DoorType.StraightStairs: return doors_fit_mandatory_pair(straight_staircases, a, b) - if a.type == DoorType.Hole: - return doors_fit_mandatory_pair(falldown_pits_as_doors, a, b) - if a.type == DoorType.Warp: - return doors_fit_mandatory_pair(dungeon_warps_as_doors, a, b) if a.type == DoorType.Interior: return doors_fit_mandatory_pair(interior_doors, a, b) if a.type == DoorType.Normal and (a.smallKey or b.smallKey or a.bigKey or b.bigKey): return doors_fit_mandatory_pair(key_doors, a, b) + if a.type in [DoorType.Hole, DoorType.Warp, DoorType.Logical]: + return False # these aren't compatible with anything return a.direction == switch_dir(b.direction) @@ -712,15 +719,11 @@ falldown_pits = [ ('Hera Boss Inner Hole', 'Hera 4F'), ] -falldown_pits_as_doors = [('Eastern Courtyard Potholes', 'Eastern Fairy Landing')] - dungeon_warps = [ ('Eastern Fairies\' Warp', 'Eastern Courtyard'), ('Hera Fairies\' Warp', 'Hera 5F') ] -dungeon_warps_as_doors = [('Eastern Fairies\' Warp', 'Eastern Courtyard Warp End')] - interior_doors = [ ('Hyrule Dungeon Armory Interior Key Door S', 'Hyrule Dungeon Armory Interior Key Door N'), ('Hyrule Dungeon Map Room Key Door S', 'Hyrule Dungeon North Abyss Key Door N'), diff --git a/Doors.py b/Doors.py index 502dd19b..393530a6 100644 --- a/Doors.py +++ b/Doors.py @@ -106,9 +106,7 @@ def create_doors(world, player): create_dir_door(player, 'Eastern Courtyard EN', DoorType.Normal, Direction.East, 0xa9, Top, Low), big_key(create_dir_door(player, 'Eastern Courtyard N', DoorType.Normal, Direction.North, 0xa9, Mid, High)), create_door(player, 'Eastern Courtyard Potholes', DoorType.Hole), - landing(create_door(player, 'Eastern Fairy Landing', DoorType.Hole)), create_door(player, 'Eastern Fairies\' Warp', DoorType.Warp), - landing(create_door(player, 'Eastern Courtyard Warp End', DoorType.Warp)), create_dir_door(player, 'Eastern Map Valley WN', DoorType.Normal, Direction.West, 0xaa, Top, Low), create_dir_door(player, 'Eastern Map Valley SW', DoorType.Normal, Direction.South, 0xaa, Left, High), create_dir_door(player, 'Eastern Dark Square NW', DoorType.Normal, Direction.North, 0xba, Left, High), @@ -266,8 +264,3 @@ def toggle(door): def blocked(door): door.blocked = True return door - - -def landing(door): - door.landing = True - return door diff --git a/Regions.py b/Regions.py index 51213064..997aa034 100644 --- a/Regions.py +++ b/Regions.py @@ -319,8 +319,8 @@ def create_regions(world, player): create_dungeon_region(player, 'Eastern Map Area', 'Eastern Palace', ['Eastern Palace - Map Chest'], ['Eastern Map Area W']), create_dungeon_region(player, 'Eastern Compass Area', 'Eastern Palace', ['Eastern Palace - Compass Chest'], ['Eastern Compass Area E', 'Eastern Compass Area EN']), create_dungeon_region(player, 'Eastern Hint Tile Blocked Path', 'Eastern Palace', None, ['Eastern Compass Area SW', 'Eastern Hint Tile Push Block']), - create_dungeon_region(player, 'Eastern Courtyard', 'Eastern Palace', ['Eastern Palace - Big Chest'], ['Eastern Courtyard WN', 'Eastern Courtyard EN', 'Eastern Courtyard N', 'Eastern Courtyard Potholes', 'Eastern Courtyard Warp End']), - create_dungeon_region(player, 'Eastern Fairies', 'Eastern Palace', None, ['Eastern Fairies\' Warp', 'Eastern Fairy Landing']), + create_dungeon_region(player, 'Eastern Courtyard', 'Eastern Palace', ['Eastern Palace - Big Chest'], ['Eastern Courtyard WN', 'Eastern Courtyard EN', 'Eastern Courtyard N', 'Eastern Courtyard Potholes']), + create_dungeon_region(player, 'Eastern Fairies', 'Eastern Palace', None, ['Eastern Fairies\' Warp']), create_dungeon_region(player, 'Eastern Map Valley', 'Eastern Palace', None, ['Eastern Map Valley WN', 'Eastern Map Valley SW']), create_dungeon_region(player, 'Eastern Dark Square', 'Eastern Palace', ['Eastern Palace - Dark Square Pot Key'], ['Eastern Dark Square NW', 'Eastern Dark Square Key Door WN']), create_dungeon_region(player, 'Eastern Big Key', 'Eastern Palace', ['Eastern Palace - Big Key Chest'], ['Eastern Big Key EN', 'Eastern Big Key NE']),