From 55364c071af640cc1b064b36ec9a05df6b4557a2 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 26 Aug 2022 14:42:06 -0600 Subject: [PATCH 1/7] Fixed issue with inverted and certain pottery settings. --- BaseClasses.py | 5 +++++ RELEASENOTES.md | 1 + Regions.py | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 36758575..12ef4ee3 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -2805,6 +2805,11 @@ class Pot(object): item = self.item if not self.indicator else self.standing_item_code return [self.x, high_byte, item] + def get_region(self, world, player): + if world.mode[player] == 'inverted' and self.room == 'Links House': + return world.get_region('Inverted Links House', 1) + return world.get_region(self.room, 1) + def __eq__(self, other): return self.x == other.x and self.y == other.y and self.room == other.room diff --git a/RELEASENOTES.md b/RELEASENOTES.md index dc790ea1..76df07c1 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -190,6 +190,7 @@ Same as above but both small keys and bigs keys of the dungeon are not allowed o * Fixed an issue where trinity goal would open pyramid unexpectedly. (No longer does so if ER mdoe is shuffling holes). Crystals goal updated to match that behavior. * Fixed a playthrough issue that was not respecting pot rules * Fixed an issue that was conflicting with downstream OWR project + * Fixed an issue with inverted and certain pottery settings * 1.0.1.1 * Fixed the pots in Mire Storyteller/ Dark Desert Hint to be colorized when they should be * Certain pot items no longer reload when reloading the supertile (matches original pot behavior better) diff --git a/Regions.py b/Regions.py index c0ef0364..31a5ab92 100644 --- a/Regions.py +++ b/Regions.py @@ -1065,9 +1065,9 @@ def valid_pot_location(pot, pot_set, world, player): return True if world.pottery[player] in ['reduced', 'clustered'] and pot in pot_set: return True - if world.pottery[player] == 'dungeon' and world.get_region(pot.room, player).type == RegionType.Dungeon: + if world.pottery[player] == 'dungeon' and pot.get_region(world, player).type == RegionType.Dungeon: return True - if world.pottery[player] in ['cave', 'cavekeys'] and world.get_region(pot.room, player).type == RegionType.Cave: + if world.pottery[player] in ['cave', 'cavekeys'] and pot.get_region(world, player).type == RegionType.Cave: return True return False From 3e6f2bb79be31ad26bc949aa56b39b34018ccc45 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 26 Aug 2022 15:20:53 -0600 Subject: [PATCH 2/7] Fixed issue with small key shuffle when big keys aren't --- Fill.py | 3 +++ RELEASENOTES.md | 1 + 2 files changed, 4 insertions(+) diff --git a/Fill.py b/Fill.py index b2dc3400..e2ea4726 100644 --- a/Fill.py +++ b/Fill.py @@ -48,6 +48,9 @@ def fill_dungeons_restrictive(world, shuffled_locations): bigs, smalls, others = [], [], [] for i in dungeon_items: (bigs if i.bigkey else smalls if i.smallkey else others).append(i) + for i in world.itempool: + if i.smallkey and world.keyshuffle[i.player]: + smalls.append(i) def fill(base_state, items, key_pool): fill_restrictive(world, base_state, shuffled_locations, items, key_pool, True) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 76df07c1..1e059997 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -191,6 +191,7 @@ Same as above but both small keys and bigs keys of the dungeon are not allowed o * Fixed a playthrough issue that was not respecting pot rules * Fixed an issue that was conflicting with downstream OWR project * Fixed an issue with inverted and certain pottery settings + * Fixed an issue with small keys being shuffled and big keys not (key distribution) * 1.0.1.1 * Fixed the pots in Mire Storyteller/ Dark Desert Hint to be colorized when they should be * Certain pot items no longer reload when reloading the supertile (matches original pot behavior better) From ae0efad8307158d1b320227835659b5b3f0c5e21 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 26 Aug 2022 15:48:07 -0600 Subject: [PATCH 3/7] More inverted pot fixes --- PotShuffle.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PotShuffle.py b/PotShuffle.py index 7806f495..a2a10c0f 100644 --- a/PotShuffle.py +++ b/PotShuffle.py @@ -894,7 +894,7 @@ def shuffle_pots(world, player): new_pot.item = PotItem.FiveRupees if new_pot.item == PotItem.Key: - key = next(location for location in world.get_region(old_pot.room, player).locations if location.name in key_drop_data) + key = next(location for location in old_pot.get_region(world, player).locations if location.name in key_drop_data) key.pot = new_pot if new_pot.room != old_pot.room: # Move pot key to new room @@ -970,7 +970,7 @@ def choose_pots(world, player): dungeon_list = [] for super_tile, pot_list in vanilla_pots.items(): for pot in pot_list: - if world.get_region(pot.room, player).type == RegionType.Cave: + if pot.get_region(world, player).type == RegionType.Cave: pot_pool.add(pot) else: dungeon_list.append(pot) @@ -981,7 +981,7 @@ def choose_pots(world, player): dungeon_count = 0 for super_tile, pot_list in vanilla_pots.items(): for pot in pot_list: - if world.get_region(pot.room, player).type == RegionType.Cave: + if pot.get_region(world, player).type == RegionType.Cave: pot_pool.add(pot) else: dungeon_map[pot.room].append(pot) From 45395e9b15e67e8062e6df1b0eabcf1784d9b98d Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 26 Aug 2022 16:08:18 -0600 Subject: [PATCH 4/7] Legacy pot shuffle fix --- Rules.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Rules.py b/Rules.py index c7b9ef44..a553fbfe 100644 --- a/Rules.py +++ b/Rules.py @@ -322,8 +322,10 @@ def global_rules(world, player): # byrna could work with sufficient magic set_rule(world.get_location('Misery Mire - Spike Chest', player), lambda state: (state.world.can_take_damage and state.has_hearts(player, 4)) or state.has('Cane of Byrna', player) or state.has('Cape', player)) loc = world.get_location('Misery Mire - Spikes Pot Key', player) - if loc.pot.x == 48 and loc.pot.y == 28: # pot shuffled to spike area - set_rule(loc, lambda state: (state.world.can_take_damage and state.has_hearts(player, 4)) or state.has('Cane of Byrna', player) or state.has('Cape', player)) + if loc.pot: + if loc.pot.x == 48 and loc.pot.y == 28: # pot shuffled to spike area + set_rule(loc, lambda state: (state.world.can_take_damage and state.has_hearts(player, 4)) + or state.has('Cane of Byrna', player) or state.has('Cape', player)) set_rule(world.get_entrance('Mire Left Bridge Hook Path', player), lambda state: state.has('Hookshot', player)) set_rule(world.get_entrance('Mire Tile Room NW', player), lambda state: state.has_fire_source(player)) set_rule(world.get_entrance('Mire Attic Hint Hole', player), lambda state: state.has_fire_source(player)) From 4aff460b22b1fe1af0ec9997b3d447b1aaa4f1d9 Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 30 Aug 2022 13:51:12 -0600 Subject: [PATCH 5/7] Fix for crossed doors with ambrosia Fix for ER + OWG in crossed doors Fix for Small Key shuffle --- DoorShuffle.py | 11 ++++++++--- EntranceShuffle.py | 5 +++-- Fill.py | 7 ++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/DoorShuffle.py b/DoorShuffle.py index ecb1b503..380193d5 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -988,11 +988,16 @@ def cross_dungeon(world, player): paths = determine_required_paths(world, player) check_required_paths(paths, world, player) + hc_compass = ItemFactory('Compass (Escape)', player) + at_compass = ItemFactory('Compass (Agahnims Tower)', player) + at_map = ItemFactory('Map (Agahnims Tower)', player) + if world.restrict_boss_items[player] != 'none': + hc_compass.advancement = at_compass.advancement = at_map.advancement = True hc = world.get_dungeon('Hyrule Castle', player) - hc.dungeon_items.append(ItemFactory('Compass (Escape)', player)) + hc.dungeon_items.append(hc_compass) at = world.get_dungeon('Agahnims Tower', player) - at.dungeon_items.append(ItemFactory('Compass (Agahnims Tower)', player)) - at.dungeon_items.append(ItemFactory('Map (Agahnims Tower)', player)) + at.dungeon_items.append(at_compass) + at.dungeon_items.append(at_map) assign_cross_keys(dungeon_builders, world, player) all_dungeon_items_cnt = len(list(y for x in world.dungeons if x.player == player for y in x.all_items)) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index 82aa6a75..f67c089b 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -63,9 +63,10 @@ def link_entrances(world, player): connect_caves(world, lw_entrances, [], hyrule_castle_exits, player) elif world.doorShuffle[player] != 'vanilla': # sanc is in light world, so must all of HC if door shuffle is on - connect_mandatory_exits(world, lw_entrances, - [('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)', 'Hyrule Castle Exit (South)')], + hyrule_castle_exits = [('Hyrule Castle Exit (West)', 'Hyrule Castle Exit (East)', 'Hyrule Castle Exit (South)')] + connect_mandatory_exits(world, lw_entrances, hyrule_castle_exits, list(LW_Dungeon_Entrances_Must_Exit), player) + connect_caves(world, lw_entrances, [], hyrule_castle_exits, player) else: connect_mandatory_exits(world, lw_entrances, dungeon_exits, list(LW_Dungeon_Entrances_Must_Exit), player) connect_mandatory_exits(world, dw_entrances, dungeon_exits, list(DW_Dungeon_Entrances_Must_Exit), player) diff --git a/Fill.py b/Fill.py index e2ea4726..5a414c98 100644 --- a/Fill.py +++ b/Fill.py @@ -48,9 +48,10 @@ def fill_dungeons_restrictive(world, shuffled_locations): bigs, smalls, others = [], [], [] for i in dungeon_items: (bigs if i.bigkey else smalls if i.smallkey else others).append(i) + unplaced_smalls = list(smalls) for i in world.itempool: if i.smallkey and world.keyshuffle[i.player]: - smalls.append(i) + unplaced_smalls.append(i) def fill(base_state, items, key_pool): fill_restrictive(world, base_state, shuffled_locations, items, key_pool, True) @@ -59,12 +60,12 @@ def fill_dungeons_restrictive(world, shuffled_locations): big_state_base = all_state_base.copy() for x in smalls + others: big_state_base.collect(x, True) - fill(big_state_base, bigs, smalls) + fill(big_state_base, bigs, unplaced_smalls) random.shuffle(shuffled_locations) small_state_base = all_state_base.copy() for x in others: small_state_base.collect(x, True) - fill(small_state_base, smalls, list(smalls)) + fill(small_state_base, smalls, unplaced_smalls) random.shuffle(shuffled_locations) fill(all_state_base, others, None) From 258d66fb5cef6c5c477a1eac4e668fba41411f2c Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 31 Aug 2022 14:10:02 -0600 Subject: [PATCH 6/7] Minor standard fix, fix for test suite, made one error less annoying --- DoorShuffle.py | 6 +++++- TestSuite.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DoorShuffle.py b/DoorShuffle.py index 380193d5..ea287d8f 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -214,7 +214,7 @@ def vanilla_key_logic(world, player): key_layout = build_key_layout(builder, start_regions, doors, world, player) valid = validate_key_layout(key_layout, world, player) if not valid: - logging.getLogger('').warning('Vanilla key layout not valid %s', builder.name) + logging.getLogger('').info('Vanilla key layout not valid %s', builder.name) builder.key_door_proposal = doors if player not in world.key_logic.keys(): world.key_logic[player] = {} @@ -1911,8 +1911,10 @@ def find_inaccessible_regions(world, player): def find_accessible_entrances(world, player, builder): entrances = [region.name for region in (portal.door.entrance.parent_region for portal in world.dungeon_portals[player]) if region.dungeon.name == builder.name] entrances.extend(drop_entrances[builder.name]) + hc_std = False if world.mode[player] == 'standard' and builder.name == 'Hyrule Castle': + hc_std = True start_regions = ['Hyrule Castle Courtyard'] elif world.mode[player] != 'inverted': start_regions = ['Links House', 'Sanctuary'] @@ -1937,6 +1939,8 @@ def find_accessible_entrances(world, player, builder): if connect not in queue and connect not in visited_regions: queue.append(connect) for ext in next_region.exits: + if hc_std and ext.name == 'Hyrule Castle Main Gate (North)': # just skip it + continue connect = ext.connected_region if connect is None or ext.door and ext.door.blocked: continue diff --git a/TestSuite.py b/TestSuite.py index 062cb2eb..ca620b21 100644 --- a/TestSuite.py +++ b/TestSuite.py @@ -45,7 +45,7 @@ def main(args=None): test("Vanilla ", "--shuffle vanilla") test("Retro ", "--retro --shuffle vanilla") - test("Keysanity ", "--shuffle vanilla --keydropshuffle drops_only --keysanity") + test("Keysanity ", "--shuffle vanilla --dropshuffle --keysanity") test("Shopsanity", "--shuffle vanilla --shopsanity") test("Simple ", "--shuffle simple") test("Full ", "--shuffle full") From 2c7817057918e66dc3287397dd7e13e95223ca44 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 31 Aug 2022 16:16:20 -0600 Subject: [PATCH 7/7] Pyinstaller 5.0+ build fix --- source/meta/build-dr.py | 1 - source/meta/build-gui.py | 1 - 2 files changed, 2 deletions(-) diff --git a/source/meta/build-dr.py b/source/meta/build-dr.py index 6f26adb9..a83c9d56 100644 --- a/source/meta/build-dr.py +++ b/source/meta/build-dr.py @@ -22,7 +22,6 @@ if os.path.isdir("build") and not sys.platform.find("mac") and not sys.platform. subprocess.run(" ".join([f"pyinstaller {SPEC_FILE} ", upx_string, "-y ", - "--onefile ", f"--distpath {DEST_DIRECTORY} ", ]), shell=True) diff --git a/source/meta/build-gui.py b/source/meta/build-gui.py index ae284261..4986df67 100644 --- a/source/meta/build-gui.py +++ b/source/meta/build-gui.py @@ -22,7 +22,6 @@ if os.path.isdir("build") and not sys.platform.find("mac") and not sys.platform. subprocess.run(" ".join([f"pyinstaller {SPEC_FILE} ", upx_string, "-y ", - "--onefile ", f"--distpath {DEST_DIRECTORY} ", ]), shell=True)