summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-12-18 10:46:24 -0500
committerGitHub <noreply@github.com>2023-12-18 09:46:24 -0600
commit1298dce3db9571a0907404cd3af09df948255d9e (patch)
treed264a998089d8f4a5b6833220d276bf9629d2a47
parent99128f67a3b4478a5561b1ba33a2f3588a61a1df (diff)
downloadlingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.tar.gz
lingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.tar.bz2
lingo-apworld-1298dce3db9571a0907404cd3af09df948255d9e.zip
Lingo: Tests no longer disable forced good item (#2602)
The static class with the "disable forced good item" field is gone. Now, certain tests that want to check for specific access progression can run a method that removes the forced good item and adds it back to the pool. Tests that don't care about this will collect the forced good item like normal. This should prevent the intermittent fill failures on complex doors unit tests, since the forced good item should provide enough locations to fill in.
-rw-r--r--__init__.py1
-rw-r--r--player_logic.py3
-rw-r--r--test/TestDoors.py10
-rw-r--r--test/TestOrangeTower.py4
-rw-r--r--test/TestProgressive.py6
-rw-r--r--test/__init__.py8
-rw-r--r--testing.py2
7 files changed, 27 insertions, 7 deletions
diff --git a/__init__.py b/__init__.py index f22d344..0889674 100644 --- a/__init__.py +++ b/__init__.py
@@ -11,7 +11,6 @@ from .options import LingoOptions
11from .player_logic import LingoPlayerLogic 11from .player_logic import LingoPlayerLogic
12from .regions import create_regions 12from .regions import create_regions
13from .static_logic import Room, RoomEntrance 13from .static_logic import Room, RoomEntrance
14from .testing import LingoTestOptions
15 14
16 15
17class LingoWebWorld(WebWorld): 16class LingoWebWorld(WebWorld):
diff --git a/player_logic.py b/player_logic.py index b046f1c..fa497c5 100644 --- a/player_logic.py +++ b/player_logic.py
@@ -6,7 +6,6 @@ from .options import LocationChecks, ShuffleDoors, VictoryCondition
6from .static_logic import DOORS_BY_ROOM, Door, PAINTINGS, PAINTINGS_BY_ROOM, PAINTING_ENTRANCES, PAINTING_EXITS, \ 6from .static_logic import DOORS_BY_ROOM, Door, PAINTINGS, PAINTINGS_BY_ROOM, PAINTING_ENTRANCES, PAINTING_EXITS, \
7 PANELS_BY_ROOM, PROGRESSION_BY_ROOM, REQUIRED_PAINTING_ROOMS, REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS, RoomAndDoor, \ 7 PANELS_BY_ROOM, PROGRESSION_BY_ROOM, REQUIRED_PAINTING_ROOMS, REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS, RoomAndDoor, \
8 RoomAndPanel 8 RoomAndPanel
9from .testing import LingoTestOptions
10 9
11if TYPE_CHECKING: 10if TYPE_CHECKING:
12 from . import LingoWorld 11 from . import LingoWorld
@@ -224,7 +223,7 @@ class LingoPlayerLogic:
224 "kind of logic error.") 223 "kind of logic error.")
225 224
226 if door_shuffle != ShuffleDoors.option_none and location_classification != LocationClassification.insanity \ 225 if door_shuffle != ShuffleDoors.option_none and location_classification != LocationClassification.insanity \
227 and not early_color_hallways and LingoTestOptions.disable_forced_good_item is False: 226 and not early_color_hallways is False:
228 # If shuffle doors is on, force a useful item onto the HI panel. This may not necessarily get you out of BK, 227 # If shuffle doors is on, force a useful item onto the HI panel. This may not necessarily get you out of BK,
229 # but the goal is to allow you to reach at least one more check. The non-painting ones are hardcoded right 228 # but the goal is to allow you to reach at least one more check. The non-painting ones are hardcoded right
230 # now. We only allow the entrance to the Pilgrim Room if color shuffle is off, because otherwise there are 229 # now. We only allow the entrance to the Pilgrim Room if color shuffle is off, because otherwise there are
diff --git a/test/TestDoors.py b/test/TestDoors.py index f496c5f..49a0f9c 100644 --- a/test/TestDoors.py +++ b/test/TestDoors.py
@@ -8,6 +8,8 @@ class TestRequiredRoomLogic(LingoTestBase):
8 } 8 }
9 9
10 def test_pilgrim_first(self) -> None: 10 def test_pilgrim_first(self) -> None:
11 self.remove_forced_good_item()
12
11 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Antechamber", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Antechamber", "Region", self.player))
13 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player)) 15 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player))
@@ -28,6 +30,8 @@ class TestRequiredRoomLogic(LingoTestBase):
28 self.assertTrue(self.can_reach_location("The Seeker - Achievement")) 30 self.assertTrue(self.can_reach_location("The Seeker - Achievement"))
29 31
30 def test_hidden_first(self) -> None: 32 def test_hidden_first(self) -> None:
33 self.remove_forced_good_item()
34
31 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player)) 35 self.assertFalse(self.multiworld.state.can_reach("The Seeker", "Region", self.player))
32 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player)) 36 self.assertFalse(self.multiworld.state.can_reach("Pilgrim Room", "Region", self.player))
33 self.assertFalse(self.can_reach_location("The Seeker - Achievement")) 37 self.assertFalse(self.can_reach_location("The Seeker - Achievement"))
@@ -55,6 +59,8 @@ class TestRequiredDoorLogic(LingoTestBase):
55 } 59 }
56 60
57 def test_through_rhyme(self) -> None: 61 def test_through_rhyme(self) -> None:
62 self.remove_forced_good_item()
63
58 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 64 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
59 65
60 self.collect_by_name("Starting Room - Rhyme Room Entrance") 66 self.collect_by_name("Starting Room - Rhyme Room Entrance")
@@ -64,6 +70,8 @@ class TestRequiredDoorLogic(LingoTestBase):
64 self.assertTrue(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 70 self.assertTrue(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
65 71
66 def test_through_hidden(self) -> None: 72 def test_through_hidden(self) -> None:
73 self.remove_forced_good_item()
74
67 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall")) 75 self.assertFalse(self.can_reach_location("Rhyme Room - Circle/Looped Square Wall"))
68 76
69 self.collect_by_name("Starting Room - Rhyme Room Entrance") 77 self.collect_by_name("Starting Room - Rhyme Room Entrance")
@@ -83,6 +91,8 @@ class TestSimpleDoors(LingoTestBase):
83 } 91 }
84 92
85 def test_requirement(self): 93 def test_requirement(self):
94 self.remove_forced_good_item()
95
86 self.assertFalse(self.multiworld.state.can_reach("Outside The Wanderer", "Region", self.player)) 96 self.assertFalse(self.multiworld.state.can_reach("Outside The Wanderer", "Region", self.player))
87 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 97 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
88 98
diff --git a/test/TestOrangeTower.py b/test/TestOrangeTower.py index 7b0c3bb..9170de1 100644 --- a/test/TestOrangeTower.py +++ b/test/TestOrangeTower.py
@@ -8,6 +8,8 @@ class TestProgressiveOrangeTower(LingoTestBase):
8 } 8 }
9 9
10 def test_from_welcome_back(self) -> None: 10 def test_from_welcome_back(self) -> None:
11 self.remove_forced_good_item()
12
11 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player))
13 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 15 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
@@ -83,6 +85,8 @@ class TestProgressiveOrangeTower(LingoTestBase):
83 self.assertTrue(self.multiworld.state.can_reach("Orange Tower Seventh Floor", "Region", self.player)) 85 self.assertTrue(self.multiworld.state.can_reach("Orange Tower Seventh Floor", "Region", self.player))
84 86
85 def test_from_hub_room(self) -> None: 87 def test_from_hub_room(self) -> None:
88 self.remove_forced_good_item()
89
86 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player)) 90 self.assertFalse(self.multiworld.state.can_reach("Orange Tower First Floor", "Region", self.player))
87 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player)) 91 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Second Floor", "Region", self.player))
88 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) 92 self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player))
diff --git a/test/TestProgressive.py b/test/TestProgressive.py index 917c6e7..8edc7ce 100644 --- a/test/TestProgressive.py +++ b/test/TestProgressive.py
@@ -7,6 +7,8 @@ class TestComplexProgressiveHallwayRoom(LingoTestBase):
7 } 7 }
8 8
9 def test_item(self): 9 def test_item(self):
10 self.remove_forced_good_item()
11
10 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player)) 12 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player))
11 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player)) 13 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player))
12 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player)) 14 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player))
@@ -58,6 +60,8 @@ class TestSimpleHallwayRoom(LingoTestBase):
58 } 60 }
59 61
60 def test_item(self): 62 def test_item(self):
63 self.remove_forced_good_item()
64
61 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player)) 65 self.assertFalse(self.multiworld.state.can_reach("Outside The Agreeable", "Region", self.player))
62 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player)) 66 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (2)", "Region", self.player))
63 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player)) 67 self.assertFalse(self.multiworld.state.can_reach("Hallway Room (3)", "Region", self.player))
@@ -86,6 +90,8 @@ class TestProgressiveArtGallery(LingoTestBase):
86 } 90 }
87 91
88 def test_item(self): 92 def test_item(self):
93 self.remove_forced_good_item()
94
89 self.assertFalse(self.multiworld.state.can_reach("Art Gallery", "Region", self.player)) 95 self.assertFalse(self.multiworld.state.can_reach("Art Gallery", "Region", self.player))
90 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Second Floor)", "Region", self.player)) 96 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Second Floor)", "Region", self.player))
91 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Third Floor)", "Region", self.player)) 97 self.assertFalse(self.multiworld.state.can_reach("Art Gallery (Third Floor)", "Region", self.player))
diff --git a/test/__init__.py b/test/__init__.py index ffbf903..7ff456d 100644 --- a/test/__init__.py +++ b/test/__init__.py
@@ -1,7 +1,6 @@
1from typing import ClassVar 1from typing import ClassVar
2 2
3from test.bases import WorldTestBase 3from test.bases import WorldTestBase
4from .. import LingoTestOptions
5 4
6 5
7class LingoTestBase(WorldTestBase): 6class LingoTestBase(WorldTestBase):
@@ -9,5 +8,10 @@ class LingoTestBase(WorldTestBase):
9 player: ClassVar[int] = 1 8 player: ClassVar[int] = 1
10 9
11 def world_setup(self, *args, **kwargs): 10 def world_setup(self, *args, **kwargs):
12 LingoTestOptions.disable_forced_good_item = True
13 super().world_setup(*args, **kwargs) 11 super().world_setup(*args, **kwargs)
12
13 def remove_forced_good_item(self):
14 location = self.multiworld.get_location("Second Room - Good Luck", self.player)
15 self.remove(location.item)
16 self.multiworld.itempool.append(location.item)
17 self.multiworld.state.events.add(location)
diff --git a/testing.py b/testing.py deleted file mode 100644 index 22fafea..0000000 --- a/testing.py +++ /dev/null
@@ -1,2 +0,0 @@
1class LingoTestOptions:
2 disable_forced_good_item: bool = False