From 05fe806100a476bf2110084996a0132f65765383 Mon Sep 17 00:00:00 2001 From: CovenEsme <84377742+CovenEsme@users.noreply.github.com> Date: Tue, 24 Dec 2024 17:44:14 +0000 Subject: [PATCH 1/3] Add clearer error msg when too few dungeons are inaccessible in ER --- logic/entrance_shuffle.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/logic/entrance_shuffle.py b/logic/entrance_shuffle.py index 165ec938..99adabac 100644 --- a/logic/entrance_shuffle.py +++ b/logic/entrance_shuffle.py @@ -57,6 +57,18 @@ def shuffle_world_entrances(world: World, worlds: list[World]): f"Removing {location} as goal location due to it being unreachable" ) + for d in world.dungeons.values(): + goal_location_found = False + + for l in d.locations: + if l.is_goal_location: + goal_location_found = True + + if not goal_location_found: + raise EntranceShuffleError( + f"Could not generate seed because '{location}' could not be accessed and there are now not enough goal locations.

\nIf you are playing with randomized entrances, try changing your seed and re-randomizing.

\nIf not, please report this error on Discord or GitHub." + ) + def set_all_entrances_data(world: World) -> None: with open(ENTRANCE_SHUFFLE_DATA_PATH, encoding="utf-8") as entrance_data_file: From fa4968257806e966e6166fc7b54e00831d69aa68 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Tue, 24 Dec 2024 15:27:45 -0800 Subject: [PATCH 2/3] fix bugs in all_logix_satisfied function --- logic/entrance_shuffle.py | 12 ------------ logic/search.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/logic/entrance_shuffle.py b/logic/entrance_shuffle.py index 99adabac..165ec938 100644 --- a/logic/entrance_shuffle.py +++ b/logic/entrance_shuffle.py @@ -57,18 +57,6 @@ def shuffle_world_entrances(world: World, worlds: list[World]): f"Removing {location} as goal location due to it being unreachable" ) - for d in world.dungeons.values(): - goal_location_found = False - - for l in d.locations: - if l.is_goal_location: - goal_location_found = True - - if not goal_location_found: - raise EntranceShuffleError( - f"Could not generate seed because '{location}' could not be accessed and there are now not enough goal locations.

\nIf you are playing with randomized entrances, try changing your seed and re-randomizing.

\nIf not, please report this error on Discord or GitHub." - ) - def set_all_entrances_data(world: World) -> None: with open(ENTRANCE_SHUFFLE_DATA_PATH, encoding="utf-8") as entrance_data_file: diff --git a/logic/search.py b/logic/search.py index 787f213f..8320ef20 100644 --- a/logic/search.py +++ b/logic/search.py @@ -408,11 +408,21 @@ def all_logic_satisfied(worlds: list["World"], item_pool: Counter[Item] = {}) -> l for l in world.location_table.values() if l.is_goal_location + and l in search.visited_locations and ( world.setting("dungeons_include_sky_keep") == "on" or not l.name.startswith("Sky Keep") ) ] + + # Filter so that there's only one sky keep goal location + found_sky_keep_goal = False + for loc in accessible_goal_locations.copy(): + if "Sky Keep" in loc.name and not found_sky_keep_goal: + found_sky_keep_goal = True + elif "Sky Keep" in loc.name and found_sky_keep_goal: + accessible_goal_locations.remove(loc) + if ( world.get_game_winning_item() not in search.owned_items or len(accessible_goal_locations) From de24f7ea431f3e1a540d7f0d535e5109b898dfe5 Mon Sep 17 00:00:00 2001 From: gymnast86 Date: Tue, 24 Dec 2024 15:31:44 -0800 Subject: [PATCH 3/3] formatting --- logic/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic/search.py b/logic/search.py index 8320ef20..6872c1f1 100644 --- a/logic/search.py +++ b/logic/search.py @@ -414,7 +414,7 @@ def all_logic_satisfied(worlds: list["World"], item_pool: Counter[Item] = {}) -> or not l.name.startswith("Sky Keep") ) ] - + # Filter so that there's only one sky keep goal location found_sky_keep_goal = False for loc in accessible_goal_locations.copy():