Skip to content

Commit

Permalink
The Witness: Add more panels to the "doors: panels" mode (Archipelago…
Browse files Browse the repository at this point in the history
…MW#2916)

* Add more panels that should be panels

* Make it so the caves panel items don't exist in early caves

* Remove unused import

* oops

* Remove Jungle to Monastery Garden from usefulification list

* Add a basic test

* ruff

---------

Co-authored-by: Fabian Dill <[email protected]>
  • Loading branch information
NewSoupVi and Berserker66 authored Dec 10, 2024
1 parent 54a0a5a commit 9a37a13
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 13 deletions.
12 changes: 9 additions & 3 deletions worlds/witness/data/WitnessItems.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Doors:
1119 - Quarry Stoneworks Entry (Panel) - 0x01E5A,0x01E59
1120 - Quarry Stoneworks Ramp Controls (Panel) - 0x03678,0x03676
1122 - Quarry Stoneworks Lift Controls (Panel) - 0x03679,0x03675
1123 - Quarry Stoneworks Stairs (Panel) - 0x03677
1125 - Quarry Boathouse Ramp Height Control (Panel) - 0x03852
1127 - Quarry Boathouse Ramp Horizontal Control (Panel) - 0x03858
1129 - Quarry Boathouse Hook Control (Panel) - 0x275FA
Expand Down Expand Up @@ -84,6 +85,7 @@ Doors:
1205 - Treehouse Laser House Door Timer (Panel) - 0x2700B,0x17CBC
1208 - Treehouse Drawbridge (Panel) - 0x037FF
1175 - Jungle Popup Wall (Panel) - 0x17CAB
1178 - Jungle Monastery Garden Shortcut (Panel) - 0x17CAA
1180 - Bunker Entry (Panel) - 0x17C2E
1183 - Bunker Tinted Glass Door (Panel) - 0x0A099
1186 - Bunker Elevator Control (Panel) - 0x0A079
Expand All @@ -94,12 +96,15 @@ Doors:
1195 - Swamp Rotating Bridge (Panel) - 0x181F5
1196 - Swamp Long Bridge (Panel) - 0x17E2B
1197 - Swamp Maze Controls (Panel) - 0x17C0A,0x17E07
1199 - Swamp Laser Shortcut (Panel) - 0x17C05
1220 - Mountain Floor 1 Light Bridge (Panel) - 0x09E39
1225 - Mountain Floor 2 Light Bridge Near (Panel) - 0x09E86
1230 - Mountain Floor 2 Light Bridge Far (Panel) - 0x09ED8
1235 - Mountain Floor 2 Elevator Control (Panel) - 0x09EEB
1240 - Caves Entry (Panel) - 0x00FF8
1242 - Caves Elevator Controls (Panel) - 0x335AB,0x335AC,0x3369D
1243 - Caves Mountain Shortcut (Panel) - 0x021D7
1244 - Caves Swamp Shortcut (Panel) - 0x17CF2
1245 - Challenge Entry (Panel) - 0x0A16E
1250 - Tunnels Entry (Panel) - 0x039B4
1255 - Tunnels Town Shortcut (Panel) - 0x09E85
Expand Down Expand Up @@ -250,19 +255,20 @@ Doors:
2101 - Outside Tutorial Outpost Panels - 0x0A171,0x04CA4
2105 - Desert Panels - 0x09FAA,0x1C2DF,0x1831E,0x1C260,0x1831C,0x1C2F3,0x1831D,0x1C2B1,0x1831B,0x0C339,0x0A249,0x0A015,0x09FA0,0x09F86
2110 - Quarry Outside Panels - 0x17C09,0x09E57,0x17CC4
2115 - Quarry Stoneworks Panels - 0x01E5A,0x01E59,0x03678,0x03676,0x03679,0x03675
2115 - Quarry Stoneworks Panels - 0x01E5A,0x01E59,0x03678,0x03676,0x03679,0x03675,0x03677
2120 - Quarry Boathouse Panels - 0x03852,0x03858,0x275FA
2122 - Keep Hedge Maze Panels - 0x00139,0x019DC,0x019E7,0x01A0F
2125 - Monastery Panels - 0x09D9B,0x00C92,0x00B10
2127 - Jungle Panels - 0x17CAB,0x17CAA
2130 - Town Church & RGB House Panels - 0x28998,0x28A0D,0x334D8
2135 - Town Maze Panels - 0x2896A,0x28A79
2137 - Town Dockside House Panels - 0x0A0C8,0x09F98
2140 - Windmill & Theater Panels - 0x17D02,0x00815,0x17F5F,0x17F89,0x0A168,0x33AB2
2145 - Treehouse Panels - 0x0A182,0x0288C,0x02886,0x2700B,0x17CBC,0x037FF
2150 - Bunker Panels - 0x34BC5,0x34BC6,0x0A079,0x0A099,0x17C2E
2155 - Swamp Panels - 0x00609,0x18488,0x181F5,0x17E2B,0x17C0A,0x17E07,0x17C0D,0x0056E
2155 - Swamp Panels - 0x00609,0x18488,0x181F5,0x17E2B,0x17C0A,0x17E07,0x17C0D,0x0056E,0x17C05
2160 - Mountain Panels - 0x09ED8,0x09E86,0x09E39,0x09EEB
2165 - Caves Panels - 0x3369D,0x00FF8,0x0A16E,0x335AB,0x335AC
2165 - Caves Panels - 0x3369D,0x00FF8,0x0A16E,0x335AB,0x335AC,0x021D7,0x17CF2
2170 - Tunnels Panels - 0x09E85,0x039B4

2200 - Desert Obelisk Key - 0x0332B,0x03367,0x28B8A,0x037B6,0x037B2,0x000F7,0x3351D,0x0053C,0x00771,0x335C8,0x335C9,0x337F8,0x037BB,0x220E4,0x220E5,0x334B9,0x334BC,0x22106,0x0A14C,0x0A14D,0x00359
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Desert Flood Room Entry (Panel)
Quarry Entry 1 (Panel)
Quarry Entry 2 (Panel)
Quarry Stoneworks Entry (Panel)
Quarry Stoneworks Stairs (Panel)
Shadows Door Timer (Panel)
Keep Hedge Maze 1 (Panel)
Keep Hedge Maze 2 (Panel)
Expand All @@ -28,11 +29,15 @@ Treehouse Third Door (Panel)
Treehouse Laser House Door Timer (Panel)
Treehouse Drawbridge (Panel)
Jungle Popup Wall (Panel)
Jungle Monastery Garden Shortcut (Panel)
Bunker Entry (Panel)
Bunker Tinted Glass Door (Panel)
Swamp Entry (Panel)
Swamp Platform Shortcut (Panel)
Swamp Laser Shortcut (Panel)
Caves Entry (Panel)
Caves Mountain Shortcut (Panel)
Caves Swamp Shortcut (Panel)
Challenge Entry (Panel)
Tunnels Entry (Panel)
Tunnels Town Shortcut (Panel)
4 changes: 2 additions & 2 deletions worlds/witness/data/settings/Door_Shuffle/Simple_Panels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Quarry Stoneworks Panels
Quarry Boathouse Panels
Keep Hedge Maze Panels
Monastery Panels
Jungle Panels
Town Church & RGB House Panels
Town Maze Panels
Windmill & Theater Panels
Expand All @@ -18,5 +19,4 @@ Mountain Panels
Caves Panels
Tunnels Panels
Glass Factory Entry (Panel)
Shadows Door Timer (Panel)
Jungle Popup Wall (Panel)
Shadows Door Timer (Panel)
6 changes: 5 additions & 1 deletion worlds/witness/data/settings/Early_Caves.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ Caves Shortcuts

Remove Items:
Caves Mountain Shortcut (Door)
Caves Swamp Shortcut (Door)
Caves Swamp Shortcut (Door)

Forbidden Doors:
0x021D7 (Caves Mountain Shortcut Panel)
0x17CF2 (Caves Swamp Shortcut Panel)
6 changes: 5 additions & 1 deletion worlds/witness/data/settings/Early_Caves_Start.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ Caves Shortcuts

Remove Items:
Caves Mountain Shortcut (Door)
Caves Swamp Shortcut (Door)
Caves Swamp Shortcut (Door)

Forbidden Doors:
0x021D7 (Caves Mountain Shortcut Panel)
0x17CF2 (Caves Swamp Shortcut Panel)
7 changes: 5 additions & 2 deletions worlds/witness/player_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,13 @@ def get_door_ids_in_pool(self) -> List[int]:
Returns the total set of all door IDs that are controlled by items in the pool.
"""
output: List[int] = []
for item_name, item_data in dict(self.item_data.items()).items():

for item_name, item_data in self.item_data.items():
if not isinstance(item_data.definition, DoorItemDefinition):
continue
output += [int(hex_string, 16) for hex_string in item_data.definition.panel_id_hexes]

output += [int(hex_string, 16) for hex_string in item_data.definition.panel_id_hexes
if hex_string not in self._logic.FORBIDDEN_DOORS]

return output

Expand Down
12 changes: 9 additions & 3 deletions worlds/witness/player_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(self, world: "WitnessWorld", disabled_locations: Set[str], start_in
self.PARENT_ITEM_COUNT_PER_BASE_ITEM: Dict[str, int] = defaultdict(lambda: 1)
self.PROGRESSIVE_LISTS: Dict[str, List[str]] = {}
self.DOOR_ITEMS_BY_ID: Dict[str, List[str]] = {}
self.FORBIDDEN_DOORS: Set[str] = set()

self.STARTING_INVENTORY: Set[str] = set()

Expand Down Expand Up @@ -192,8 +193,9 @@ def reduce_req_within_region(self, entity_hex: str) -> WitnessRule:
for subset in these_items:
self.BASE_PROGESSION_ITEMS_ACTUALLY_IN_THE_GAME.update(subset)

# Handle door entities (door shuffle)
if entity_hex in self.DOOR_ITEMS_BY_ID:
# If this entity is opened by a door item that exists in the itempool, add that item to its requirements.
# Also, remove any original power requirements this entity might have had.
if entity_hex in self.DOOR_ITEMS_BY_ID and entity_hex not in self.FORBIDDEN_DOORS:
# If this entity is opened by a door item that exists in the itempool, add that item to its requirements.
door_items = frozenset({frozenset([item]) for item in self.DOOR_ITEMS_BY_ID[entity_hex]})

Expand Down Expand Up @@ -329,6 +331,10 @@ def make_single_adjustment(self, adj_type: str, line: str) -> None:
if entity_hex in self.DOOR_ITEMS_BY_ID and item_name in self.DOOR_ITEMS_BY_ID[entity_hex]:
self.DOOR_ITEMS_BY_ID[entity_hex].remove(item_name)

if adj_type == "Forbidden Doors":
entity_hex = line[:7]
self.FORBIDDEN_DOORS.add(entity_hex)

if adj_type == "Starting Inventory":
self.STARTING_INVENTORY.add(line)

Expand Down Expand Up @@ -704,7 +710,7 @@ def make_options_adjustments(self, world: "WitnessWorld") -> None:

self.make_single_adjustment(current_adjustment_type, line)

for entity_id in self.COMPLETELY_DISABLED_ENTITIES:
for entity_id in self.COMPLETELY_DISABLED_ENTITIES | self.FORBIDDEN_DOORS:
if entity_id in self.DOOR_ITEMS_BY_ID:
del self.DOOR_ITEMS_BY_ID[entity_id]

Expand Down
28 changes: 27 additions & 1 deletion worlds/witness/test/test_door_shuffle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ..test import WitnessTestBase
from ..test import WitnessMultiworldTestBase, WitnessTestBase


class TestIndividualDoors(WitnessTestBase):
Expand All @@ -22,3 +22,29 @@ def test_swamp_laser_shortcut(self) -> None:
],
only_check_listed=True,
)


class TestForbiddenDoors(WitnessMultiworldTestBase):
options_per_world = [
{
"early_caves": "off",
},
{
"early_caves": "add_to_pool",
},
]

common_options = {
"shuffle_doors": "panels",
"shuffle_postgame": True,
}

def test_forbidden_doors(self) -> None:
self.assertTrue(
self.get_items_by_name("Caves Mountain Shortcut (Panel)", 1),
"Caves Mountain Shortcut (Panel) should exist in panels shuffle, but it didn't."
)
self.assertFalse(
self.get_items_by_name("Caves Mountain Shortcut (Panel)", 2),
"Caves Mountain Shortcut (Panel) should be removed when Early Caves is enabled, but it still exists."
)

0 comments on commit 9a37a13

Please sign in to comment.