summary refs log tree commit diff stats
path: root/player_logic.py
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-12-10 13:15:42 -0500
committerGitHub <noreply@github.com>2023-12-10 19:15:42 +0100
commit99128f67a3b4478a5561b1ba33a2f3588a61a1df (patch)
tree6afdfc1d51bb8b6d22e6b20725aacaef9437ebb4 /player_logic.py
parentee4ebe472759e91d511f3f151311f3a54e68051b (diff)
downloadlingo-apworld-99128f67a3b4478a5561b1ba33a2f3588a61a1df.tar.gz
lingo-apworld-99128f67a3b4478a5561b1ba33a2f3588a61a1df.tar.bz2
lingo-apworld-99128f67a3b4478a5561b1ba33a2f3588a61a1df.zip
Lingo: Fix entrance checking being broken on default settings (#2506)
The most serious issue this PR addresses is that entrances that use doors without items (a small subset of doors when door shuffle is on, but *every* door when door shuffle is off, which is the default) underestimate the requirements needed to use that entrance. The logic would calculate the panels needed to open the door, but would neglect to keep track of the rooms those panels were in, meaning that doors would be considered openable if you had the colors needed to solve a panel that's in a room you have no access to.

Another issue is that, previously, logic would always consider the "ANOTHER TRY" panel accessible for the purposes of the LEVEL 2 panel hunt. This could result in seeds where the player is expected to have exactly the correct number of solves to reach LEVEL 2, but in reality is short by one because ANOTHER TRY itself is not revealed until the panel hunt is complete. This change marks ANOTHER TRY as non-counting, because even though it is technically a counting panel in-game, it can never contribute to the LEVEL 2 panel hunt. This issue could also apply to THE MASTER, since it is the only other counting panel with special access rules, although it is much less likely. This change adds special handling for counting THE MASTER. These issues were possible to manifest whenever the LEVEL 2 panel hunt was enabled, which it is by default.

Smaller logic issues also fixed in this PR:

* The Orange Tower Basement MASTERY panel was marked as requiring the mastery doors to be opened, when it was actually possible to get it without them by using a painting to get into the room.
* The Pilgrim Room painting item was incorrectly being marked as a filler item, despite it being progression.
* There has been another update to the game that adds connections between areas that were previously not connected. These changes were additive, which is why they are not critical.
* The panel stacks in the rhyme room now require both colours on each panel.
Diffstat (limited to 'player_logic.py')
-rw-r--r--player_logic.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/player_logic.py b/player_logic.py index a0b33d1..b046f1c 100644 --- a/player_logic.py +++ b/player_logic.py
@@ -190,6 +190,25 @@ class LingoPlayerLogic:
190 if item.should_include(world): 190 if item.should_include(world):
191 self.real_items.append(name) 191 self.real_items.append(name)
192 192
193 # Calculate the requirements for the fake pilgrimage.
194 fake_pilgrimage = [
195 ["Second Room", "Exit Door"], ["Crossroads", "Tower Entrance"],
196 ["Orange Tower Fourth Floor", "Hot Crusts Door"], ["Outside The Initiated", "Shortcut to Hub Room"],
197 ["Orange Tower First Floor", "Shortcut to Hub Room"], ["Directional Gallery", "Shortcut to The Undeterred"],
198 ["Orange Tower First Floor", "Salt Pepper Door"], ["Hub Room", "Crossroads Entrance"],
199 ["Champion's Rest", "Shortcut to The Steady"], ["The Bearer", "Shortcut to The Bold"],
200 ["Art Gallery", "Exit"], ["The Tenacious", "Shortcut to Hub Room"],
201 ["Outside The Agreeable", "Tenacious Entrance"]
202 ]
203 pilgrimage_reqs = AccessRequirements()
204 for door in fake_pilgrimage:
205 door_object = DOORS_BY_ROOM[door[0]][door[1]]
206 if door_object.event or world.options.shuffle_doors == ShuffleDoors.option_none:
207 pilgrimage_reqs.merge(self.calculate_door_requirements(door[0], door[1], world))
208 else:
209 pilgrimage_reqs.doors.add(RoomAndDoor(door[0], door[1]))
210 self.door_reqs.setdefault("Pilgrim Antechamber", {})["Pilgrimage"] = pilgrimage_reqs
211
193 # Create the paintings mapping, if painting shuffle is on. 212 # Create the paintings mapping, if painting shuffle is on.
194 if painting_shuffle: 213 if painting_shuffle:
195 # Shuffle paintings until we get something workable. 214 # Shuffle paintings until we get something workable.
@@ -369,11 +388,9 @@ class LingoPlayerLogic:
369 door_object = DOORS_BY_ROOM[room][door] 388 door_object = DOORS_BY_ROOM[room][door]
370 389
371 for req_panel in door_object.panels: 390 for req_panel in door_object.panels:
372 if req_panel.room is not None and req_panel.room != room: 391 panel_room = room if req_panel.room is None else req_panel.room
373 access_reqs.rooms.add(req_panel.room) 392 access_reqs.rooms.add(panel_room)
374 393 sub_access_reqs = self.calculate_panel_requirements(panel_room, req_panel.panel, world)
375 sub_access_reqs = self.calculate_panel_requirements(room if req_panel.room is None else req_panel.room,
376 req_panel.panel, world)
377 access_reqs.merge(sub_access_reqs) 394 access_reqs.merge(sub_access_reqs)
378 395
379 self.door_reqs[room][door] = access_reqs 396 self.door_reqs[room][door] = access_reqs
@@ -397,8 +414,8 @@ class LingoPlayerLogic:
397 unhindered_panels_by_color: dict[Optional[str], int] = {} 414 unhindered_panels_by_color: dict[Optional[str], int] = {}
398 415
399 for panel_name, panel_data in room_data.items(): 416 for panel_name, panel_data in room_data.items():
400 # We won't count non-counting panels. 417 # We won't count non-counting panels. THE MASTER has special access rules and is handled separately.
401 if panel_data.non_counting: 418 if panel_data.non_counting or panel_name == "THE MASTER":
402 continue 419 continue
403 420
404 # We won't coalesce any panels that have requirements beyond colors. To simplify things for now, we will 421 # We won't coalesce any panels that have requirements beyond colors. To simplify things for now, we will