From 12cde88f95803da6638f748da234086a1c1dded6 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 19 May 2024 18:56:24 -0400 Subject: [PATCH] Lingo: Fixed edge case sunwarp shuffle accessibility issue (#3228) * Lingo: Fixed edge case sunwarp shuffle accessibility issue * Minor readability update --------- Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> --- worlds/lingo/player_logic.py | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/worlds/lingo/player_logic.py b/worlds/lingo/player_logic.py index 19583bc8..b6941f37 100644 --- a/worlds/lingo/player_logic.py +++ b/worlds/lingo/player_logic.py @@ -2,7 +2,7 @@ from enum import Enum from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING from Options import OptionError -from .datatypes import Door, DoorType, RoomAndDoor, RoomAndPanel +from .datatypes import Door, DoorType, Painting, RoomAndDoor, RoomAndPanel from .items import ALL_ITEM_TABLE, ItemType from .locations import ALL_LOCATION_TABLE, LocationClassification from .options import LocationChecks, ShuffleDoors, SunwarpAccess, VictoryCondition @@ -361,13 +361,29 @@ class LingoPlayerLogic: if door_shuffle == ShuffleDoors.option_none: required_painting_rooms += REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS req_exits = [painting_id for painting_id, painting in PAINTINGS.items() if painting.required_when_no_doors] - req_enterable = [painting_id for painting_id, painting in PAINTINGS.items() - if not painting.exit_only and not painting.disable and not painting.req_blocked and - not painting.req_blocked_when_no_doors and painting.room not in required_painting_rooms] - else: - req_enterable = [painting_id for painting_id, painting in PAINTINGS.items() - if not painting.exit_only and not painting.disable and not painting.req_blocked and - painting.room not in required_painting_rooms] + + def is_req_enterable(painting_id: str, painting: Painting) -> bool: + if painting.exit_only or painting.disable or painting.req_blocked\ + or painting.room in required_painting_rooms: + return False + + if world.options.shuffle_doors == ShuffleDoors.option_none: + if painting.req_blocked_when_no_doors: + return False + + # Special case for the paintings in Color Hunt and Champion's Rest. These are req blocked when not on + # doors mode, and when sunwarps are disabled or sunwarp shuffle is on and the Color Hunt sunwarp is not + # an exit. This is because these two rooms would then be inaccessible without roof access, and we can't + # hide the Owl Hallway entrance behind roof access. + if painting.room in ["Color Hunt", "Champion's Rest"]: + if world.options.sunwarp_access == SunwarpAccess.option_disabled\ + or (world.options.shuffle_sunwarps and "Color Hunt" not in self.sunwarp_exits): + return False + + return True + + req_enterable = [painting_id for painting_id, painting in PAINTINGS.items() + if is_req_enterable(painting_id, painting)] req_exits += [painting_id for painting_id, painting in PAINTINGS.items() if painting.exit_only and painting.required] req_entrances = world.random.sample(req_enterable, len(req_exits))