From 729088fd8516051b6e409310eec9929b4cb0264c Mon Sep 17 00:00:00 2001
From: Fabian Dill <fabian.dill@web.de>
Date: Tue, 11 May 2021 01:26:59 +0200
Subject: [PATCH] Fix generation failure if aga tower door was placed on HC
 ledge in inverted dungeonsfull

---
 worlds/alttp/EntranceShuffle.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/worlds/alttp/EntranceShuffle.py b/worlds/alttp/EntranceShuffle.py
index fdf3750b..f26c59ab 100644
--- a/worlds/alttp/EntranceShuffle.py
+++ b/worlds/alttp/EntranceShuffle.py
@@ -1151,8 +1151,7 @@ def link_inverted_entrances(world, player):
             hc_ledge_must_exit = hc_ledge_entrances.pop()
             lw_entrances.remove(hc_ledge_must_exit)
             lw_dungeon_entrances_must_exit.append(hc_ledge_must_exit)
-
-        if aga_door in lw_entrances:
+        elif aga_door in lw_entrances:
             lw_entrances.remove(aga_door)
         else:
             dw_entrances.remove(aga_door)
@@ -1395,10 +1394,9 @@ def link_inverted_entrances(world, player):
             hc_ledge_must_exit = hc_ledge_entrances.pop()
             lw_entrances.remove(hc_ledge_must_exit)
             lw_must_exits.append(hc_ledge_must_exit)
-
-        if aga_door in lw_entrances:
+        elif aga_door in lw_entrances:
             lw_entrances.remove(aga_door)
-        elif aga_door in dw_entrances:
+        else:
             dw_entrances.remove(aga_door)
 
         connect_two_way(world, aga_door, 'Inverted Agahnims Tower Exit', player)