From 0126e7ab484afa921a5416a3fe4c0dd8b4c385d6 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 17 Oct 2021 19:42:13 -0500 Subject: [PATCH] Improving the multi-entrance connection fill routine --- EntranceShuffle.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/EntranceShuffle.py b/EntranceShuffle.py index a7bdaa72..04716d03 100644 --- a/EntranceShuffle.py +++ b/EntranceShuffle.py @@ -769,6 +769,11 @@ def connect_mandatory_exits(world, entrances, caves, must_be_exits, player, must raise RuntimeError('Not enough multi-entrance caves left to connect unreachable regions!') if len(entrances) < len(must_be_exits) + 1: raise RuntimeError('Not enough entrances left to connect unreachable regions!') + if cave_surplus > len(must_be_exits): + for candidate in caves: + if not isinstance(candidate, str) and (candidate in used_caves or len(candidate) < len(entrances) - required_entrances - 1): + cave = candidate + break if len(must_be_exits) == 0: # if assigning last must exit for candidate in caves: if not isinstance(candidate, str) and (candidate in used_caves or len(candidate) <= len(entrances) - required_entrances - 1):