From d0abfeb88b34f6eaad6ed677b10bea9b6e17a973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Bolduc?= <16137441+Jouramie@users.noreply.github.com> Date: Mon, 18 May 2026 07:53:48 -0400 Subject: [PATCH] The Messenger: Fix portal shuffle logic not using unlocked portals (#6194) --- worlds/messenger/portals.py | 6 +----- worlds/messenger/test/test_portals.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/worlds/messenger/portals.py b/worlds/messenger/portals.py index 11fc610108..8e46eee17d 100644 --- a/worlds/messenger/portals.py +++ b/worlds/messenger/portals.py @@ -7,7 +7,6 @@ from Options import PlandoConnection if TYPE_CHECKING: from . import MessengerWorld - PORTALS: list[str] = [ "Autumn Hills", "Riviere Turquoise", @@ -17,7 +16,6 @@ PORTALS: list[str] = [ "Glacial Peak", ] - SHOP_POINTS: dict[str, list[str]] = { "Autumn Hills": [ "Climbing Claws", @@ -112,7 +110,6 @@ SHOP_POINTS: dict[str, list[str]] = { ] } - CHECKPOINTS: dict[str, list[str]] = { "Autumn Hills": [ "Hope Latch", @@ -185,7 +182,6 @@ CHECKPOINTS: dict[str, list[str]] = { ] } - REGION_ORDER: list[str] = [ "Autumn Hills", "Forlorn Temple", @@ -306,4 +302,4 @@ def add_closed_portal_reqs(world: "MessengerWorld") -> None: closed_portals = [entrance for entrance in PORTALS if f"{entrance} Portal" not in world.starting_portals] for portal in closed_portals: tower_exit = world.multiworld.get_entrance(f"ToTHQ {portal} Portal", world.player) - tower_exit.access_rule = lambda state, portal_item=portal: state.has(portal_item, world.player) + tower_exit.access_rule = lambda state, portal_item=portal: state.has(f"{portal_item} Portal", world.player) diff --git a/worlds/messenger/test/test_portals.py b/worlds/messenger/test/test_portals.py index b1875ac0b3..416b1f6a6a 100644 --- a/worlds/messenger/test/test_portals.py +++ b/worlds/messenger/test/test_portals.py @@ -35,3 +35,29 @@ class PortalTestBase(MessengerTestBase): test_state.collect(item) self.assertTrue(entrance.can_reach(test_state), grouping) entrance.access_rule = lambda state: True + + +class PortalUnlockTest(MessengerTestBase): + options = { + "available_portals": 3, + } + + def test_unlocking_portal(self) -> None: + """Validate that unlocking the portal event actually unlock the portal in HQ""" + + print(self.world.starting_portals) + + for portal in PORTALS: + name = f"{portal} Portal" + if name in self.world.starting_portals: + continue + + entrance_name = f"ToTHQ {name}" + with self.subTest(portal=name, entrance_name=entrance_name): + hq_portal = self.multiworld.get_entrance(entrance_name, self.player) + test_state = CollectionState(self.multiworld) + self.assertFalse(hq_portal.can_reach(test_state), "reachable with nothing") + + event = self.multiworld.get_location(name, self.player) + test_state.collect(event.item) + self.assertTrue(hq_portal.can_reach(test_state))