The Messenger: Fix portal shuffle logic not using unlocked portals (#6194)

This commit is contained in:
Jérémie Bolduc
2026-05-18 07:53:48 -04:00
committed by GitHub
parent b575983599
commit d0abfeb88b
2 changed files with 27 additions and 5 deletions
+1 -5
View File
@@ -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)
+26
View File
@@ -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))