Stardew Valley: Replace current naive entrance rando with GER (#4624)

This commit is contained in:
Jérémie Bolduc
2025-05-24 01:15:41 -04:00
committed by GitHub
parent e82d50a3c5
commit c64791e3a8
21 changed files with 1351 additions and 1224 deletions

View File

@@ -1,7 +1,7 @@
from typing import List
from unittest import TestCase
from BaseClasses import CollectionState, Location, Region
from BaseClasses import CollectionState, Location, Region, Entrance
from ...stardew_rule import StardewRule, false_, MISSING_ITEM, Reach
from ...stardew_rule.rule_explain import explain
@@ -79,3 +79,13 @@ class RuleAssertMixin(TestCase):
except KeyError as e:
raise AssertionError(f"Error while checking region {region_name}: {e}"
f"\nExplanation: {expl}")
def assert_can_reach_entrance(self, entrance: Entrance | str, state: CollectionState) -> None:
entrance_name = entrance.name if isinstance(entrance, Entrance) else entrance
expl = explain(Reach(entrance_name, "Entrance", 1), state)
try:
can_reach = state.can_reach_entrance(entrance_name, 1)
self.assertTrue(can_reach, expl)
except KeyError as e:
raise AssertionError(f"Error while checking entrance {entrance_name}: {e}"
f"\nExplanation: {expl}")