diff --git a/BaseClasses.py b/BaseClasses.py index d43c8751..7e17d469 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -304,6 +304,9 @@ class World(object): def is_tile_swapped(self, owid, player): return (self.mode[player] == 'inverted') != (owid in self.owswaps[player][0] and self.owMixed[player]) + def is_bombshop_start(self, player): + return self.is_tile_swapped(0x2c, player) and (self.shuffle[player] in ['vanilla', 'dungeonssimple', 'dungeonsfull'] or not self.shufflelinks[player]) + def check_for_door(self, doorname, player): if isinstance(doorname, Door): return doorname diff --git a/DoorShuffle.py b/DoorShuffle.py index 17fda12c..45ecbc7b 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -1815,7 +1815,7 @@ def remove_pair_type_if_present(door, world, player): def find_inaccessible_regions(world, player): world.inaccessible_regions[player] = [] - start_regions = ['Links House' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop', 'Sanctuary' if world.mode[player] != 'inverted' else 'Dark Sanctuary Hint'] + start_regions = ['Links House' if not world.is_bombshop_start(player) else 'Big Bomb Shop', 'Sanctuary' if world.mode[player] != 'inverted' else 'Dark Sanctuary Hint'] regs = convert_regions(start_regions, world, player) all_regions = [r for r in world.regions if r.player == player and r.type is not RegionType.Dungeon] visited_regions = set() @@ -1851,7 +1851,7 @@ def find_accessible_entrances(world, player, builder): if world.mode[player] == 'standard' and builder.name == 'Hyrule Castle': start_regions = ['Hyrule Castle Courtyard'] else: - start_regions = ['Links House' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop', 'Sanctuary' if world.mode[player] != 'inverted' else 'Dark Sanctuary Hint'] + start_regions = ['Links House' if not world.is_bombshop_start(player) else 'Big Bomb Shop', 'Sanctuary' if world.mode[player] != 'inverted' else 'Dark Sanctuary Hint'] if world.is_tile_swapped(0x1b, player): start_regions.append('Hyrule Castle Ledge') regs = convert_regions(start_regions, world, player) @@ -1886,7 +1886,7 @@ def find_accessible_entrances(world, player, builder): def valid_inaccessible_region(world, r, player): - return r.type is not RegionType.Cave or (len(r.exits) > 0 and r.name not in ['Links House' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop', 'Chris Houlihan Room']) + return r.type is not RegionType.Cave or (len(r.exits) > 0 and r.name not in ['Links House' if not world.is_bombshop_start(player) else 'Big Bomb Shop', 'Chris Houlihan Room']) def add_inaccessible_doors(world, player): diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 826dc585..90f78451 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -54,7 +54,7 @@ def link_entrances(world, player): for exitname, regionname in mandatory_connections: connect_simple(world, exitname, regionname, player) - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): connect_simple(world, 'Links House S&Q', 'Links House', player) else: connect_simple(world, 'Links House S&Q', 'Big Bomb Shop', player) @@ -78,7 +78,7 @@ def link_entrances(world, player): connect_logical(world, entrancename, exitname, player, True) if invFlag: world.get_entrance('Dark Sanctuary Hint Exit', player).connect(world.get_entrance('Dark Sanctuary Hint', player).parent_region) - if world.is_tile_swapped(0x2c, player): + if world.is_bombshop_start(player): world.get_entrance('Big Bomb Shop Exit', player).connect(world.get_entrance('Big Bomb Shop', player).parent_region) ignore_pool = False @@ -215,7 +215,7 @@ def link_entrances(world, player): junk_fill_inaccessible(world, player) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -261,7 +261,7 @@ def link_entrances(world, player): place_old_man(world, lw_entrances if not invFlag else dw_entrances, player) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -319,7 +319,7 @@ def link_entrances(world, player): place_old_man(world, lw_entrances if not invFlag else dw_entrances, player, list(zip(*drop_connections + dropexit_connections))[0]) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = [e for e in entrance_pool if e not in list(zip(*drop_connections + dropexit_connections))[0]] if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in bomb_shop_doors if e not in ['Pyramid Fairy']] @@ -422,7 +422,7 @@ def link_entrances(world, player): connect_caves(world, lw_entrances, dw_entrances, caves, player) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -477,7 +477,7 @@ def link_entrances(world, player): connect_caves(world, connector_entrances, [], caves, player) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -527,7 +527,7 @@ def link_entrances(world, player): place_old_man(world, pool, player) # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -611,7 +611,7 @@ def link_entrances(world, player): caves.append('Old Man Cave Exit (West)') # place bomb shop, has limited options - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): bomb_shop_doors = list(entrance_pool) if world.logic[player] in ['noglitches', 'minorglitches'] or world.is_tile_swapped(0x1b, player): bomb_shop_doors = [e for e in entrance_pool if e not in ['Pyramid Fairy']] @@ -642,8 +642,8 @@ def link_entrances(world, player): # ensure Houlihan exits where Links House does # TODO: Plando should overrule this if not links_house: - for links_house in world.get_entrance('Links House Exit' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop Exit', player).connected_region.exits: - if links_house.connected_region and links_house.connected_region.name == ('Links House' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop'): + for links_house in world.get_entrance('Links House Exit' if not world.is_bombshop_start(player) else 'Big Bomb Shop Exit', player).connected_region.exits: + if links_house.connected_region and links_house.connected_region.name == ('Links House' if not world.is_bombshop_start(player) else 'Big Bomb Shop'): links_house = links_house.name break connect_exit(world, 'Chris Houlihan Room Exit', links_house, player) @@ -1342,7 +1342,7 @@ def full_shuffle_dungeons(world, Dungeon_Exits, player): def place_links_house(world, player, ignore_list=[]): invFlag = world.mode[player] == 'inverted' if world.mode[player] == 'standard' or not world.shufflelinks[player]: - links_house = 'Links House' if not world.is_tile_swapped(0x2c, player) else 'Big Bomb Shop' + links_house = 'Links House' if not world.is_bombshop_start(player) else 'Big Bomb Shop' else: if invFlag: for dark_sanc in world.get_entrance('Dark Sanctuary Hint Exit', player).connected_region.exits: @@ -1361,7 +1361,7 @@ def place_links_house(world, player, ignore_list=[]): links_house_doors = [e for e in links_house_doors if e not in ignore_list] assert len(links_house_doors), 'No valid candidates to place Links House' links_house = random.choice(links_house_doors) - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): connect_two_way(world, links_house, 'Links House Exit', player) else: connect_entrance(world, links_house, 'Big Bomb Shop', player) diff --git a/OverworldShuffle.py b/OverworldShuffle.py index 0c019feb..40c98c36 100644 --- a/OverworldShuffle.py +++ b/OverworldShuffle.py @@ -841,7 +841,7 @@ def can_reach_smith(world, player): found = False explored_regions = list() - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): start_region = 'Links House' else: start_region = 'Big Bomb Shop' @@ -1031,7 +1031,7 @@ def validate_layout(world, player): explored_regions = list() if world.shuffle[player] in ['vanilla', 'dungeonssimple', 'dungeonsfull'] or not world.shufflelinks[player]: - if not world.is_tile_swapped(0x2c, player): + if not world.is_bombshop_start(player): start_region = 'Links House Area' else: start_region = 'Big Bomb Shop Area'