From 0dfdbfd39ecfdbc2d6b93f30da58b874289f4c93 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 24 Aug 2022 15:00:48 -0600 Subject: [PATCH 1/5] Removed "good bee" from Mothula logic Fixed an issue with Mystery generation and windows file path --- BaseClasses.py | 20 ++++++++++---------- Bosses.py | 3 +-- Mystery.py | 12 ++++++------ RELEASENOTES.md | 2 ++ 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 7f6a00c6..36758575 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1093,16 +1093,16 @@ class CollectionState(object): return self.has('Bow', player) and (self.can_buy_unlimited('Single Arrow', player) or self.has('Single Arrow', player)) return self.has('Bow', player) - def can_get_good_bee(self, player): - cave = self.world.get_region('Good Bee Cave', player) - return ( - self.can_use_bombs(player) and - self.has_bottle(player) and - self.has('Bug Catching Net', player) and - (self.has_Boots(player) or (self.has_sword(player) and self.has('Quake', player))) and - cave.can_reach(self) and - self.is_not_bunny(cave, player) - ) + # def can_get_good_bee(self, player): + # cave = self.world.get_region('Good Bee Cave', player) + # return ( + # self.can_use_bombs(player) and + # self.has_bottle(player) and + # self.has('Bug Catching Net', player) and + # (self.has_Boots(player) or (self.has_sword(player) and self.has('Quake', player))) and + # cave.can_reach(self) and + # self.is_not_bunny(cave, player) + # ) def has_sword(self, player): return self.has('Fighter Sword', player) or self.has('Master Sword', player) or self.has('Tempered Sword', player) or self.has('Golden Sword', player) diff --git a/Bosses.py b/Bosses.py index 206b797c..d84df921 100644 --- a/Bosses.py +++ b/Bosses.py @@ -61,8 +61,7 @@ def MothulaDefeatRule(state, player): # TODO: Not sure how much (if any) extend magic is needed for these two, since they only apply # to non-vanilla locations, so are harder to test, so sticking with what VT has for now: (state.has('Cane of Somaria', player) and state.can_extend_magic(player, 16)) or - (state.has('Cane of Byrna', player) and state.can_extend_magic(player, 16)) or - state.can_get_good_bee(player) + (state.has('Cane of Byrna', player) and state.can_extend_magic(player, 16)) ) def BlindDefeatRule(state, player): diff --git a/Mystery.py b/Mystery.py index 20e0e2ca..568ff6a8 100644 --- a/Mystery.py +++ b/Mystery.py @@ -1,5 +1,7 @@ import argparse import logging +from pathlib import Path +import os import RaceRandom as random import urllib.request import urllib.parse @@ -104,13 +106,11 @@ def main(): DRMain(erargs, seed, BabelFish()) def get_weights(path): - try: - if urllib.parse.urlparse(path).scheme: - return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader) - with open(path, 'r', encoding='utf-8') as f: + if os.path.exists(Path(path)): + with open(path, "r", encoding="utf-8") as f: return yaml.load(f, Loader=yaml.SafeLoader) - except Exception as e: - raise Exception(f'Failed to read weights file: {e}') + elif urllib.parse.urlparse(path).scheme in ['http', 'https']: + return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader) def roll_settings(weights): def get_choice(option, root=None): diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0603d95e..dc790ea1 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -184,6 +184,8 @@ Same as above but both small keys and bigs keys of the dungeon are not allowed o #### Unstable * 1.0.1.2 + * Removed "good bee" as an in-logic way of killing Mothula + * Fixed an issue with Mystery generation and Windows path * Fixed an issue with small key bias rework * 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 From 55364c071af640cc1b064b36ec9a05df6b4557a2 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 26 Aug 2022 14:42:06 -0600 Subject: [PATCH 2/5] 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 3/5] 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 4/5] 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 5/5] 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))