From 5f9ec0ed579379a800ff8daa611c78112f930821 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Tue, 14 May 2024 02:45:12 +0800 Subject: [PATCH] Fix: Multiple right doors are classified as left and right doors --- tasks/rogue/route/exit.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tasks/rogue/route/exit.py b/tasks/rogue/route/exit.py index c5d45ee48..cf7c21bc8 100644 --- a/tasks/rogue/route/exit.py +++ b/tasks/rogue/route/exit.py @@ -253,8 +253,17 @@ class RogueExit(CombatInteract): else: return None, results[0].matched_keyword else: - results = [r for d, r in sorted(zip(directions, results))] - return results[0].matched_keyword, results[-1].matched_keyword + left = [r for d, r in sorted(zip(directions, results)) if d < 0] + right = [r for d, r in sorted(zip(directions, results)) if d >= 0] + if len(left): + left = left[0].matched_keyword + else: + left = None + if len(right): + right = right[-1].matched_keyword + else: + right = None + return left, right def choose_door(self, left_door: MapPlane | None, right_door: MapPlane | None) -> str | None: """