diff --git a/worlds/lingo/__init__.py b/worlds/lingo/__init__.py index 25be16699126..537b149f16ed 100644 --- a/worlds/lingo/__init__.py +++ b/worlds/lingo/__init__.py @@ -132,7 +132,8 @@ def set_rules(self): def fill_slot_data(self): slot_options = [ "death_link", "victory_condition", "shuffle_colors", "shuffle_doors", "shuffle_paintings", "shuffle_panels", - "mastery_achievements", "level_2_requirement", "location_checks", "early_color_hallways" + "enable_pilgrimage", "sunwarp_access", "mastery_achievements", "level_2_requirement", "location_checks", + "early_color_hallways", "pilgrimage_allows_roof_access", "pilgrimage_allows_paintings", "shuffle_sunwarps" ] slot_data = { @@ -143,6 +144,9 @@ def fill_slot_data(self): if self.options.shuffle_paintings: slot_data["painting_entrance_to_exit"] = self.player_logic.painting_mapping + if self.options.shuffle_sunwarps: + slot_data["sunwarp_permutation"] = self.player_logic.sunwarp_mapping + return slot_data def get_filler_item_name(self) -> str: diff --git a/worlds/lingo/data/LL1.yaml b/worlds/lingo/data/LL1.yaml index f2d2a9ff5448..c33cad393bba 100644 --- a/worlds/lingo/data/LL1.yaml +++ b/worlds/lingo/data/LL1.yaml @@ -54,6 +54,8 @@ # this door will open the doors listed here. # - painting_id: An internal ID of a painting that should be moved upon # receiving this door. + # - warp_id: An internal ID or IDs of warps that should be disabled + # until receiving this door. # - panels: These are the panels that canonically open this door. If # there is only one panel for the door, then that panel is a # check. If there is more than one panel, then that entire @@ -73,10 +75,6 @@ # will be covered by a single item. # - include_reduce: Door checks are assumed to be EXCLUDED when reduce checks # is on. This option includes the check anyway. - # - junk_item: If on, the item for this door will be considered a junk - # item instead of a progression item. Only use this for - # doors that could never gate progression regardless of - # options and state. # - event: Denotes that the door is event only. This is similar to # setting both skip_location and skip_item. # @@ -106,9 +104,42 @@ # Use "req_blocked_when_no_doors" instead if it would be # fine in door shuffle mode. # - move: Denotes that the painting is able to move. + # + # sunwarps is an array of sunwarps in the room. This is used for sunwarp + # shuffling. + # - dots: The number of dots on this sunwarp. + # - direction: "enter" or "exit" + # - entrance_indicator_pos: Coordinates for where the entrance indicator + # should be placed if this becomes an entrance. + # - orientation: One of north/south/east/west. Starting Room: entrances: - Menu: True + Menu: + warp: True + Outside The Wise: + painting: True + Rhyme Room (Circle): + painting: True + Rhyme Room (Target): + painting: True + Wondrous Lobby: + painting: True + Orange Tower Third Floor: + painting: True + Color Hunt: + painting: True + Owl Hallway: + painting: True + The Wondrous: + room: The Wondrous + door: Exit + painting: True + Orange Tower Sixth Floor: + painting: True + Orange Tower Basement: + painting: True + The Colorful: + painting: True panels: HI: id: Entry Room/Panel_hi_hi @@ -416,7 +447,7 @@ The Traveled: door: Traveled Entrance Roof: True # through the sunwarp - Outside The Undeterred: # (NOTE: used in hardcoded pilgrimage) + Outside The Undeterred: room: Outside The Undeterred door: Green Painting painting: True @@ -500,6 +531,11 @@ paintings: - id: maze_painting orientation: west + sunwarps: + - dots: 1 + direction: enter + entrance_indicator_pos: [18, 2.5, -17.01] + orientation: north Dead End Area: entrances: Hidden Room: @@ -526,12 +562,52 @@ paintings: - id: smile_painting_6 orientation: north - Pilgrim Antechamber: - # Let's not shuffle the paintings yet. + Sunwarps: + # This is a special, meta-ish room. entrances: - # The pilgrimage is hardcoded in rules.py - Starting Room: - door: Sun Painting + Menu: True + doors: + 1 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_1 + door_group: Sunwarps + skip_location: True + item_name: "1 Sunwarp" + 2 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_2 + door_group: Sunwarps + skip_location: True + item_name: 2 Sunwarp + 3 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_3 + door_group: Sunwarps + skip_location: True + item_name: "3 Sunwarp" + 4 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_4 + door_group: Sunwarps + skip_location: True + item_name: 4 Sunwarp + 5 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_5 + door_group: Sunwarps + skip_location: True + item_name: "5 Sunwarp" + 6 Sunwarp: + warp_id: Teleporter Warps/Sunwarp_enter_6 + door_group: Sunwarps + skip_location: True + item_name: "6 Sunwarp" + progression: + Progressive Pilgrimage: + - 1 Sunwarp + - 2 Sunwarp + - 3 Sunwarp + - 4 Sunwarp + - 5 Sunwarp + - 6 Sunwarp + Pilgrim Antechamber: + # The entrances to this room are special. When pilgrimage is enabled, we use a special access rule to determine + # whether a pilgrimage can succeed. When pilgrimage is disabled, the sun painting will be added to the pool. panels: HOT CRUST: id: Lingo Room/Panel_shortcut @@ -541,6 +617,7 @@ id: Lingo Room/Panel_pilgrim colors: blue tag: midblue + check: True MASTERY: id: Master Room/Panel_mastery_mastery14 tag: midwhite @@ -636,11 +713,19 @@ - THIS Crossroads: entrances: - Hub Room: True # The sunwarp means that we never need the ORDER door - Color Hallways: True + Hub Room: + - room: Sunwarps + door: 1 Sunwarp + sunwarp: True + - room: Hub Room + door: Crossroads Entrance + Color Hallways: + warp: True The Tenacious: door: Tenacious Entrance - Orange Tower Fourth Floor: True # through IRK HORN + Orange Tower Fourth Floor: + - warp: True # through IRK HORN + - door: Tower Entrance Amen Name Area: room: Lost Area door: Exit @@ -760,7 +845,6 @@ - SWORD Eye Wall: id: Shuffle Room Area Doors/Door_behind - junk_item: True door_group: Crossroads Doors panels: - BEND HI @@ -795,6 +879,11 @@ door: Eye Wall - id: smile_painting_4 orientation: south + sunwarps: + - dots: 1 + direction: exit + entrance_indicator_pos: [ -17, 2.5, -41.01 ] + orientation: north Lost Area: entrances: Outside The Agreeable: @@ -1036,11 +1125,12 @@ - LEAF - FEEL Outside The Agreeable: - # Let's ignore the blue warp thing for now because the lookout is a dead - # end. Later on it could be filler checks. entrances: - # We don't have to list Lost Area because of Crossroads. - Crossroads: True + Crossroads: + warp: True + Lost Area: + room: Lost Area + door: Exit The Tenacious: door: Tenacious Entrance The Agreeable: @@ -1053,12 +1143,11 @@ Starting Room: door: Painting Shortcut painting: True - Hallway Room (2): True - Hallway Room (3): True - Hallway Room (4): True + Hallway Room (1): + warp: True Hedge Maze: True # through the door to the sectioned-off part of the hedge maze - Cellar: - door: Lookout Entrance + Compass Room: + warp: True panels: MASSACRED: id: Palindrome Room/Panel_massacred_sacred @@ -1104,11 +1193,6 @@ required_door: room: Outside The Undeterred door: Fives - OUT: - id: Hallway Room/Panel_out_out - check: True - exclude_reduce: True - tag: midwhite HIDE: id: Maze Room/Panel_hide_seek_4 colors: black @@ -1117,52 +1201,6 @@ id: Maze Room/Panel_daze_maze colors: purple tag: midpurp - WALL: - id: Hallway Room/Panel_castle_1 - colors: blue - tag: quad bot blue - link: qbb CASTLE - KEEP: - id: Hallway Room/Panel_castle_2 - colors: blue - tag: quad bot blue - link: qbb CASTLE - BAILEY: - id: Hallway Room/Panel_castle_3 - colors: blue - tag: quad bot blue - link: qbb CASTLE - TOWER: - id: Hallway Room/Panel_castle_4 - colors: blue - tag: quad bot blue - link: qbb CASTLE - NORTH: - id: Cross Room/Panel_north_missing - colors: green - tag: forbid - required_panel: - - room: Outside The Bold - panel: SOUND - - room: Outside The Bold - panel: YEAST - - room: Outside The Bold - panel: WET - DIAMONDS: - id: Cross Room/Panel_diamonds_missing - colors: green - tag: forbid - required_room: Suits Area - FIRE: - id: Cross Room/Panel_fire_missing - colors: green - tag: forbid - required_room: Elements Area - WINTER: - id: Cross Room/Panel_winter_missing - colors: green - tag: forbid - required_room: Orange Tower Fifth Floor doors: Tenacious Entrance: id: Palindrome Room Area Doors/Door_massacred_sacred @@ -1194,15 +1232,49 @@ panels: - room: Color Hunt panel: PURPLE - Hallway Door: - id: Red Blue Purple Room Area Doors/Door_room_2 - door_group: Hallway Room Doors - location_name: Hallway Room - First Room - panels: - - WALL - - KEEP - - BAILEY - - TOWER + paintings: + - id: eyes_yellow_painting + orientation: east + sunwarps: + - dots: 6 + direction: enter + entrance_indicator_pos: [ 3, 2.5, -55.01 ] + orientation: north + Compass Room: + entrances: + Outside The Agreeable: + warp: True + Cellar: + door: Lookout Entrance + warp: True + panels: + NORTH: + id: Cross Room/Panel_north_missing + colors: green + tag: forbid + required_panel: + - room: Outside The Bold + panel: SOUND + - room: Outside The Bold + panel: YEAST + - room: Outside The Bold + panel: WET + DIAMONDS: + id: Cross Room/Panel_diamonds_missing + colors: green + tag: forbid + required_room: Suits Area + FIRE: + id: Cross Room/Panel_fire_missing + colors: green + tag: forbid + required_room: Elements Area + WINTER: + id: Cross Room/Panel_winter_missing + colors: green + tag: forbid + required_room: Orange Tower Fifth Floor + doors: Lookout Entrance: id: Cross Room Doors/Door_missing location_name: Outside The Agreeable - Lookout Panels @@ -1212,21 +1284,8 @@ - DIAMONDS - FIRE paintings: - - id: panda_painting - orientation: south - - id: eyes_yellow_painting - orientation: east - id: pencil_painting7 orientation: north - progression: - Progressive Hallway Room: - - Hallway Door - - room: Hallway Room (2) - door: Exit - - room: Hallway Room (3) - door: Exit - - room: Hallway Room (4) - door: Exit Dread Hallway: entrances: Outside The Agreeable: @@ -1321,7 +1380,8 @@ Hub Room: room: Hub Room door: Shortcut to Hedge Maze - Color Hallways: True + Color Hallways: + warp: True The Agreeable: room: The Agreeable door: Shortcut to Hedge Maze @@ -1465,7 +1525,8 @@ orientation: north The Fearless (First Floor): entrances: - The Perceptive: True + The Perceptive: + warp: True panels: SPAN: id: Naps Room/Panel_naps_span @@ -1508,6 +1569,7 @@ The Fearless (First Floor): room: The Fearless (First Floor) door: Second Floor + warp: True panels: NONE: id: Naps Room/Panel_one_many @@ -1557,6 +1619,7 @@ The Fearless (First Floor): room: The Fearless (Second Floor) door: Third Floor + warp: True panels: Achievement: id: Countdown Panels/Panel_fearless_fearless @@ -1585,7 +1648,8 @@ Hedge Maze: room: Hedge Maze door: Observant Entrance - The Incomparable: True + The Incomparable: + warp: True panels: Achievement: id: Countdown Panels/Panel_observant_observant @@ -1709,7 +1773,8 @@ - SIX The Incomparable: entrances: - The Observant: True # Assuming that access to The Observant includes access to the right entrance + The Observant: + warp: True Eight Room: True Eight Alcove: door: Eight Door @@ -1911,9 +1976,11 @@ Outside The Wanderer: room: Outside The Wanderer door: Tower Entrance + warp: True Orange Tower Second Floor: room: Orange Tower door: Second Floor + warp: True Directional Gallery: door: Salt Pepper Door Roof: True # through the sunwarp @@ -1944,15 +2011,23 @@ - SALT - room: Directional Gallery panel: PEPPER + sunwarps: + - dots: 4 + direction: enter + entrance_indicator_pos: [ -32, 2.5, -14.99 ] + orientation: south Orange Tower Second Floor: entrances: Orange Tower First Floor: room: Orange Tower door: Second Floor + warp: True Orange Tower Third Floor: room: Orange Tower door: Third Floor - Outside The Undeterred: True + warp: True + Outside The Undeterred: + warp: True Orange Tower Third Floor: entrances: Knight Night Exit: @@ -1961,16 +2036,22 @@ Orange Tower Second Floor: room: Orange Tower door: Third Floor + warp: True Orange Tower Fourth Floor: room: Orange Tower door: Fourth Floor - Hot Crusts Area: True # sunwarp - Bearer Side Area: # This is complicated because of The Bearer's topology + warp: True + Hot Crusts Area: + room: Sunwarps + door: 2 Sunwarp + sunwarp: True + Bearer Side Area: room: Bearer Side Area door: Shortcut to Tower Rhyme Room (Smiley): door: Rhyme Room Entrance - Art Gallery: True # mark this as a warp in the sunwarps branch + Art Gallery: + warp: True panels: RED: id: Color Arrow Room/Panel_red_afar @@ -2019,14 +2100,25 @@ orientation: east - id: flower_painting_5 orientation: south + sunwarps: + - dots: 2 + direction: exit + entrance_indicator_pos: [ 24.01, 2.5, 38 ] + orientation: west + - dots: 3 + direction: enter + entrance_indicator_pos: [ 28.01, 2.5, 29 ] + orientation: west Orange Tower Fourth Floor: entrances: Orange Tower Third Floor: room: Orange Tower door: Fourth Floor + warp: True Orange Tower Fifth Floor: room: Orange Tower door: Fifth Floor + warp: True Hot Crusts Area: door: Hot Crusts Door Crossroads: @@ -2034,7 +2126,10 @@ door: Tower Entrance - room: Crossroads door: Tower Back Entrance - Courtyard: True + Courtyard: + - warp: True + - room: Crossroads + door: Tower Entrance Roof: True # through the sunwarp panels: RUNT (1): @@ -2067,6 +2162,11 @@ id: Shuffle Room Area Doors/Door_hotcrust_shortcuts panels: - HOT CRUSTS + sunwarps: + - dots: 5 + direction: enter + entrance_indicator_pos: [ -20, 3, -64.01 ] + orientation: north Hot Crusts Area: entrances: Orange Tower Fourth Floor: @@ -2084,28 +2184,31 @@ paintings: - id: smile_painting_8 orientation: north + sunwarps: + - dots: 2 + direction: enter + entrance_indicator_pos: [ -26, 3.5, -80.01 ] + orientation: north Orange Tower Fifth Floor: entrances: Orange Tower Fourth Floor: room: Orange Tower door: Fifth Floor + warp: True Orange Tower Sixth Floor: room: Orange Tower door: Sixth Floor + warp: True Cellar: room: Room Room door: Cellar Exit + warp: True Welcome Back Area: door: Welcome Back - Art Gallery: - room: Art Gallery - door: Exit - The Bearer: - room: Art Gallery - door: Exit Outside The Initiated: room: Art Gallery door: Exit + warp: True panels: SIZE (Small): id: Entry Room/Panel_size_small @@ -2185,6 +2288,7 @@ Orange Tower Fifth Floor: room: Orange Tower door: Sixth Floor + warp: True The Scientific: painting: True paintings: @@ -2213,6 +2317,7 @@ Orange Tower Sixth Floor: room: Orange Tower door: Seventh Floor + warp: True panels: THE END: id: EndPanel/Panel_end_end @@ -2389,7 +2494,10 @@ Courtyard: entrances: Roof: True - Orange Tower Fourth Floor: True + Orange Tower Fourth Floor: + - warp: True + - room: Crossroads + door: Tower Entrance Arrow Garden: painting: True Starting Room: @@ -2757,15 +2865,24 @@ entrances: Starting Room: door: Shortcut to Starting Room - Hub Room: True - Outside The Wondrous: True - Outside The Undeterred: True - Outside The Agreeable: True - Outside The Wanderer: True - The Observant: True - Art Gallery: True - The Scientific: True - Cellar: True + Hub Room: + warp: True + Outside The Wondrous: + warp: True + Outside The Undeterred: + warp: True + Outside The Agreeable: + warp: True + Outside The Wanderer: + warp: True + The Observant: + warp: True + Art Gallery: + warp: True + The Scientific: + warp: True + Cellar: + warp: True Orange Tower Fifth Floor: room: Orange Tower Fifth Floor door: Welcome Back @@ -2833,10 +2950,21 @@ Knight Night Exit: room: Knight Night (Final) door: Exit - Orange Tower Third Floor: True # sunwarp + Orange Tower Third Floor: + room: Sunwarps + door: 3 Sunwarp + sunwarp: True Orange Tower Fifth Floor: room: Art Gallery door: Exit + warp: True + Art Gallery: + room: Art Gallery + door: Exit + warp: True + The Bearer: + room: Art Gallery + door: Exit Eight Alcove: door: Eight Door The Optimistic: True @@ -3007,6 +3135,11 @@ orientation: east - id: smile_painting_1 orientation: north + sunwarps: + - dots: 3 + direction: exit + entrance_indicator_pos: [ 89.99, 2.5, 1 ] + orientation: east The Initiated: entrances: Outside The Initiated: @@ -3130,6 +3263,7 @@ door: Traveled Entrance Color Hallways: door: Color Hallways Entrance + warp: True panels: Achievement: id: Countdown Panels/Panel_traveled_traveled @@ -3220,22 +3354,32 @@ The Traveled: room: The Traveled door: Color Hallways Entrance - Outside The Bold: True - Outside The Undeterred: True - Crossroads: True - Hedge Maze: True - The Optimistic: True # backside - Directional Gallery: True # backside - Yellow Backside Area: True + Outside The Bold: + warp: True + Outside The Undeterred: + warp: True + Crossroads: + warp: True + Hedge Maze: + warp: True + The Optimistic: + warp: True # backside + Directional Gallery: + warp: True # backside + Yellow Backside Area: + warp: True The Bearer: room: The Bearer door: Backside Door + warp: True The Observant: room: The Observant door: Backside Door + warp: True Outside The Bold: entrances: - Color Hallways: True + Color Hallways: + warp: True Color Hunt: room: Color Hunt door: Shortcut to The Steady @@ -3253,7 +3397,7 @@ door: Painting Shortcut painting: True Room Room: True # trapdoor - Outside The Agreeable: + Compass Room: painting: True panels: UNOPEN: @@ -3455,13 +3599,22 @@ tag: botred Outside The Undeterred: entrances: - Color Hallways: True - Orange Tower First Floor: True # sunwarp - Orange Tower Second Floor: True - The Artistic (Smiley): True - The Artistic (Panda): True - The Artistic (Apple): True - The Artistic (Lattice): True + Color Hallways: + warp: True + Orange Tower First Floor: + room: Sunwarps + door: 4 Sunwarp + sunwarp: True + Orange Tower Second Floor: + warp: True + The Artistic (Smiley): + warp: True + The Artistic (Panda): + warp: True + The Artistic (Apple): + warp: True + The Artistic (Lattice): + warp: True Yellow Backside Area: painting: True Number Hunt: @@ -3651,6 +3804,11 @@ door: Green Painting - id: blueman_painting_2 orientation: east + sunwarps: + - dots: 4 + direction: exit + entrance_indicator_pos: [ -89.01, 2.5, 4 ] + orientation: east The Undeterred: entrances: Outside The Undeterred: @@ -3928,7 +4086,10 @@ door: Eights Directional Gallery: entrances: - Outside The Agreeable: True # sunwarp + Outside The Agreeable: + room: Sunwarps + door: 6 Sunwarp + sunwarp: True Orange Tower First Floor: room: Orange Tower First Floor door: Salt Pepper Door @@ -4096,11 +4257,19 @@ orientation: south - id: cherry_painting orientation: east + sunwarps: + - dots: 6 + direction: exit + entrance_indicator_pos: [ -39, 2.5, -7.01 ] + orientation: north Color Hunt: entrances: Outside The Bold: door: Shortcut to The Steady - Orange Tower Fourth Floor: True # sunwarp + Orange Tower Fourth Floor: + room: Sunwarps + door: 5 Sunwarp + sunwarp: True Roof: True # through ceiling of sunwarp Champion's Rest: room: Outside The Initiated @@ -4159,6 +4328,11 @@ required_door: room: Outside The Initiated door: Entrance + sunwarps: + - dots: 5 + direction: exit + entrance_indicator_pos: [ 54, 2.5, 69.99 ] + orientation: north Champion's Rest: entrances: Color Hunt: @@ -4192,7 +4366,7 @@ entrances: Outside The Bold: door: Entrance - Orange Tower Fifth Floor: + Outside The Initiated: room: Art Gallery door: Exit The Bearer (East): True @@ -4640,7 +4814,8 @@ tag: midyellow The Steady (Lime): entrances: - The Steady (Sunflower): True + The Steady (Sunflower): + warp: True The Steady (Emerald): room: The Steady door: Reveal @@ -4662,7 +4837,8 @@ orientation: south The Steady (Lemon): entrances: - The Steady (Emerald): True + The Steady (Emerald): + warp: True The Steady (Orange): room: The Steady door: Reveal @@ -5019,8 +5195,10 @@ Knight Night (Outer Ring): room: Knight Night (Outer Ring) door: Fore Door + warp: True Knight Night (Right Lower Segment): door: Segment Door + warp: True panels: RUST (1): id: Appendix Room/Panel_rust_trust @@ -5049,9 +5227,11 @@ Knight Night (Right Upper Segment): room: Knight Night (Right Upper Segment) door: Segment Door + warp: True Knight Night (Outer Ring): room: Knight Night (Outer Ring) door: New Door + warp: True panels: ADJUST: id: Appendix Room/Panel_adjust_readjusted @@ -5097,9 +5277,11 @@ Knight Night (Outer Ring): room: Knight Night (Outer Ring) door: To End + warp: True Knight Night (Right Upper Segment): room: Knight Night (Outer Ring) door: To End + warp: True panels: TRUSTED: id: Appendix Room/Panel_trusted_readjusted @@ -5295,7 +5477,7 @@ entrances: Orange Tower Sixth Floor: painting: True - Outside The Agreeable: + Hallway Room (1): painting: True The Artistic (Smiley): room: The Artistic (Smiley) @@ -5746,7 +5928,8 @@ painting: True Wondrous Lobby: door: Exit - Directional Gallery: True + Directional Gallery: + warp: True panels: NEAR: id: Shuffle Room/Panel_near_near @@ -5781,7 +5964,8 @@ tag: midwhite Wondrous Lobby: entrances: - Directional Gallery: True + Directional Gallery: + warp: True The Eyes They See: room: The Eyes They See door: Exit @@ -5790,10 +5974,12 @@ orientation: east Outside The Wondrous: entrances: - Wondrous Lobby: True + Wondrous Lobby: + warp: True The Wondrous (Doorknob): door: Wondrous Entrance - The Wondrous (Window): True + The Wondrous (Window): + warp: True panels: SHRINK: id: Wonderland Room/Panel_shrink_shrink @@ -5815,7 +6001,9 @@ painting: True The Wondrous (Chandelier): painting: True - The Wondrous (Table): True # There is a way that doesn't use the painting + The Wondrous (Table): + - painting: True + - warp: True doors: Painting Shortcut: painting_id: @@ -5901,7 +6089,8 @@ required: True The Wondrous: entrances: - The Wondrous (Table): True + The Wondrous (Table): + warp: True Arrow Garden: door: Exit panels: @@ -5967,11 +6156,70 @@ paintings: - id: flower_painting_6 orientation: south - Hallway Room (2): + Hallway Room (1): entrances: Outside The Agreeable: - room: Outside The Agreeable - door: Hallway Door + warp: True + Hallway Room (2): + warp: True + Hallway Room (3): + warp: True + Hallway Room (4): + warp: True + panels: + OUT: + id: Hallway Room/Panel_out_out + check: True + exclude_reduce: True + tag: midwhite + WALL: + id: Hallway Room/Panel_castle_1 + colors: blue + tag: quad bot blue + link: qbb CASTLE + KEEP: + id: Hallway Room/Panel_castle_2 + colors: blue + tag: quad bot blue + link: qbb CASTLE + BAILEY: + id: Hallway Room/Panel_castle_3 + colors: blue + tag: quad bot blue + link: qbb CASTLE + TOWER: + id: Hallway Room/Panel_castle_4 + colors: blue + tag: quad bot blue + link: qbb CASTLE + doors: + Exit: + id: Red Blue Purple Room Area Doors/Door_room_2 + door_group: Hallway Room Doors + location_name: Hallway Room - First Room + panels: + - WALL + - KEEP + - BAILEY + - TOWER + paintings: + - id: panda_painting + orientation: south + progression: + Progressive Hallway Room: + - Exit + - room: Hallway Room (2) + door: Exit + - room: Hallway Room (3) + door: Exit + - room: Hallway Room (4) + door: Exit + Hallway Room (2): + entrances: + Hallway Room (1): + room: Hallway Room (1) + door: Exit + warp: True Elements Area: True panels: WISE: @@ -6009,6 +6257,7 @@ Hallway Room (2): room: Hallway Room (2) door: Exit + warp: True # No entrance from Elements Area. The winding hallway does not connect. panels: TRANCE: @@ -6046,6 +6295,7 @@ Hallway Room (3): room: Hallway Room (3) door: Exit + warp: True Elements Area: True panels: WHEEL: @@ -6068,6 +6318,7 @@ Hallway Room (4): room: Hallway Room (4) door: Exit + # If this door is open, then a non-warp entrance from the first hallway room is available The Artistic (Smiley): room: Hallway Room (4) door: Exit @@ -6112,6 +6363,7 @@ entrances: Orange Tower First Floor: door: Tower Entrance + warp: True Rhyme Room (Cross): room: Rhyme Room (Cross) door: Exit @@ -6139,6 +6391,7 @@ Outside The Wanderer: room: Outside The Wanderer door: Wanderer Entrance + warp: True panels: Achievement: id: Countdown Panels/Panel_1234567890_wanderlust @@ -6180,12 +6433,17 @@ tag: midorange Art Gallery: entrances: - Orange Tower Third Floor: True - Art Gallery (Second Floor): True - Art Gallery (Third Floor): True - Art Gallery (Fourth Floor): True - Orange Tower Fifth Floor: + Orange Tower Third Floor: + warp: True + Art Gallery (Second Floor): + warp: True + Art Gallery (Third Floor): + warp: True + Art Gallery (Fourth Floor): + warp: True + Outside The Initiated: door: Exit + warp: True panels: EIGHT: id: Backside Room/Panel_eight_eight_6 @@ -6766,6 +7024,7 @@ Rhyme Room (Smiley): # one-way room: Rhyme Room (Smiley) door: Door to Target + warp: True Rhyme Room (Looped Square): room: Rhyme Room (Looped Square) door: Door to Target @@ -6829,7 +7088,8 @@ # For pretty much the same reason, I don't want to shuffle the paintings in # here. entrances: - Orange Tower Fourth Floor: True + Orange Tower Fourth Floor: + warp: True panels: DOOR (1): id: Panel Room/Panel_room_door_1 @@ -7037,9 +7297,11 @@ Orange Tower Fifth Floor: room: Room Room door: Cellar Exit - Outside The Agreeable: - room: Outside The Agreeable + warp: True + Compass Room: + room: Compass Room door: Lookout Entrance + warp: True Outside The Wise: entrances: Orange Tower Sixth Floor: @@ -7077,6 +7339,7 @@ Outside The Wise: room: Outside The Wise door: Wise Entrance + warp: True # The Wise is so full of warps panels: Achievement: id: Countdown Panels/Panel_intelligent_wise diff --git a/worlds/lingo/data/generated.dat b/worlds/lingo/data/generated.dat index c957e5d51c89..304109ca2840 100644 Binary files a/worlds/lingo/data/generated.dat and b/worlds/lingo/data/generated.dat differ diff --git a/worlds/lingo/data/ids.yaml b/worlds/lingo/data/ids.yaml index d3307deaa300..918af7aba923 100644 --- a/worlds/lingo/data/ids.yaml +++ b/worlds/lingo/data/ids.yaml @@ -140,13 +140,9 @@ panels: PURPLE: 444502 FIVE (1): 444503 FIVE (2): 444504 - OUT: 444505 HIDE: 444506 DAZE: 444507 - WALL: 444508 - KEEP: 444509 - BAILEY: 444510 - TOWER: 444511 + Compass Room: NORTH: 444512 DIAMONDS: 444513 FIRE: 444514 @@ -689,6 +685,12 @@ panels: Arrow Garden: MASTERY: 444948 SHARP: 444949 + Hallway Room (1): + OUT: 444505 + WALL: 444508 + KEEP: 444509 + BAILEY: 444510 + TOWER: 444511 Hallway Room (2): WISE: 444950 CLOCK: 444951 @@ -995,6 +997,19 @@ doors: Traveled Entrance: item: 444433 location: 444438 + Sunwarps: + 1 Sunwarp: + item: 444581 + 2 Sunwarp: + item: 444588 + 3 Sunwarp: + item: 444586 + 4 Sunwarp: + item: 444585 + 5 Sunwarp: + item: 444587 + 6 Sunwarp: + item: 444584 Pilgrim Antechamber: Sun Painting: item: 444436 @@ -1067,9 +1082,7 @@ doors: location: 444501 Purple Barrier: item: 444457 - Hallway Door: - item: 444459 - location: 445214 + Compass Room: Lookout Entrance: item: 444579 location: 445271 @@ -1342,6 +1355,10 @@ doors: Exit: item: 444552 location: 444947 + Hallway Room (1): + Exit: + item: 444459 + location: 445214 Hallway Room (2): Exit: item: 444553 @@ -1452,9 +1469,11 @@ door_groups: Colorful Doors: 444498 Directional Gallery Doors: 444531 Artistic Doors: 444545 + Sunwarps: 444582 progression: Progressive Hallway Room: 444461 Progressive Fearless: 444470 Progressive Orange Tower: 444482 Progressive Art Gallery: 444563 Progressive Colorful: 444580 + Progressive Pilgrimage: 444583 diff --git a/worlds/lingo/datatypes.py b/worlds/lingo/datatypes.py index e9bf0a378039..e466558f87ff 100644 --- a/worlds/lingo/datatypes.py +++ b/worlds/lingo/datatypes.py @@ -1,3 +1,4 @@ +from enum import Enum, Flag, auto from typing import List, NamedTuple, Optional @@ -11,10 +12,18 @@ class RoomAndPanel(NamedTuple): panel: str +class EntranceType(Flag): + NORMAL = auto() + PAINTING = auto() + SUNWARP = auto() + WARP = auto() + CROSSROADS_ROOF_ACCESS = auto() + + class RoomEntrance(NamedTuple): room: str # source room door: Optional[RoomAndDoor] - painting: bool + type: EntranceType class Room(NamedTuple): @@ -22,6 +31,12 @@ class Room(NamedTuple): entrances: List[RoomEntrance] +class DoorType(Enum): + NORMAL = 1 + SUNWARP = 2 + SUN_PAINTING = 3 + + class Door(NamedTuple): name: str item_name: str @@ -34,7 +49,7 @@ class Door(NamedTuple): event: bool door_group: Optional[str] include_reduce: bool - junk_item: bool + type: DoorType item_group: Optional[str] diff --git a/worlds/lingo/items.py b/worlds/lingo/items.py index 7c7928cbab68..67eaceab10fe 100644 --- a/worlds/lingo/items.py +++ b/worlds/lingo/items.py @@ -1,8 +1,14 @@ -from typing import Dict, List, NamedTuple, Optional, TYPE_CHECKING +from enum import Enum +from typing import Dict, List, NamedTuple, Set from BaseClasses import Item, ItemClassification -from .static_logic import DOORS_BY_ROOM, PROGRESSION_BY_ROOM, PROGRESSIVE_ITEMS, get_door_group_item_id, \ - get_door_item_id, get_progressive_item_id, get_special_item_id +from .static_logic import DOORS_BY_ROOM, PROGRESSIVE_ITEMS, get_door_group_item_id, get_door_item_id, \ + get_progressive_item_id, get_special_item_id + + +class ItemType(Enum): + NORMAL = 1 + COLOR = 2 class ItemData(NamedTuple): @@ -11,7 +17,7 @@ class ItemData(NamedTuple): """ code: int classification: ItemClassification - mode: Optional[str] + type: ItemType has_doors: bool painting_ids: List[str] @@ -34,36 +40,29 @@ def load_item_data(): for color in ["Black", "Red", "Blue", "Yellow", "Green", "Orange", "Gray", "Brown", "Purple"]: ALL_ITEM_TABLE[color] = ItemData(get_special_item_id(color), ItemClassification.progression, - "colors", [], []) + ItemType.COLOR, False, []) ITEMS_BY_GROUP.setdefault("Colors", []).append(color) - door_groups: Dict[str, List[str]] = {} + door_groups: Set[str] = set() for room_name, doors in DOORS_BY_ROOM.items(): for door_name, door in doors.items(): if door.skip_item is True or door.event is True: continue - if door.door_group is None: - door_mode = "doors" - else: - door_mode = "complex door" - door_groups.setdefault(door.door_group, []) - - if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]: - door_mode = "special" + if door.door_group is not None: + door_groups.add(door.door_group) ALL_ITEM_TABLE[door.item_name] = \ - ItemData(get_door_item_id(room_name, door_name), - ItemClassification.filler if door.junk_item else ItemClassification.progression, door_mode, + ItemData(get_door_item_id(room_name, door_name), ItemClassification.progression, ItemType.NORMAL, door.has_doors, door.painting_ids) ITEMS_BY_GROUP.setdefault("Doors", []).append(door.item_name) if door.item_group is not None: ITEMS_BY_GROUP.setdefault(door.item_group, []).append(door.item_name) - for group, group_door_ids in door_groups.items(): + for group in door_groups: ALL_ITEM_TABLE[group] = ItemData(get_door_group_item_id(group), - ItemClassification.progression, "door group", True, []) + ItemClassification.progression, ItemType.NORMAL, True, []) ITEMS_BY_GROUP.setdefault("Doors", []).append(group) special_items: Dict[str, ItemClassification] = { @@ -77,7 +76,7 @@ def load_item_data(): for item_name, classification in special_items.items(): ALL_ITEM_TABLE[item_name] = ItemData(get_special_item_id(item_name), classification, - "special", False, []) + ItemType.NORMAL, False, []) if classification == ItemClassification.filler: ITEMS_BY_GROUP.setdefault("Junk", []).append(item_name) @@ -86,7 +85,7 @@ def load_item_data(): for item_name in PROGRESSIVE_ITEMS: ALL_ITEM_TABLE[item_name] = ItemData(get_progressive_item_id(item_name), - ItemClassification.progression, "special", False, []) + ItemClassification.progression, ItemType.NORMAL, False, []) # Initialize the item data at module scope. diff --git a/worlds/lingo/locations.py b/worlds/lingo/locations.py index 92ee309487a5..a6e53e761d49 100644 --- a/worlds/lingo/locations.py +++ b/worlds/lingo/locations.py @@ -56,7 +56,7 @@ def load_location_data(): for room_name, doors in DOORS_BY_ROOM.items(): for door_name, door in doors.items(): - if door.skip_location or door.event or door.panels is None: + if door.skip_location or door.event or not door.panels: continue location_name = door.location_name diff --git a/worlds/lingo/options.py b/worlds/lingo/options.py index 293992ab91d6..05fb4ed977e0 100644 --- a/worlds/lingo/options.py +++ b/worlds/lingo/options.py @@ -61,15 +61,55 @@ class ShufflePaintings(Toggle): display_name = "Shuffle Paintings" +class EnablePilgrimage(Toggle): + """If on, you are required to complete a pilgrimage in order to access the Pilgrim Antechamber. + If off, the pilgrimage will be deactivated, and the sun painting will be added to the pool, even if door shuffle is off.""" + display_name = "Enable Pilgrimage" + + +class PilgrimageAllowsRoofAccess(DefaultOnToggle): + """If on, you may use the Crossroads roof access during a pilgrimage (and you may be expected to do so). + Otherwise, pilgrimage will be deactivated when going up the stairs.""" + display_name = "Allow Roof Access for Pilgrimage" + + +class PilgrimageAllowsPaintings(DefaultOnToggle): + """If on, you may use paintings during a pilgrimage (and you may be expected to do so). + Otherwise, pilgrimage will be deactivated when going through a painting.""" + display_name = "Allow Paintings for Pilgrimage" + + +class SunwarpAccess(Choice): + """Determines how access to sunwarps works. + On "normal", all sunwarps are enabled from the start. + On "disabled", all sunwarps are disabled. Pilgrimage must be disabled when this is used. + On "unlock", sunwarps start off disabled, and all six activate once you receive an item. + On "individual", sunwarps start off disabled, and each has a corresponding item that unlocks it. + On "progressive", sunwarps start off disabled, and they unlock in order using a progressive item.""" + display_name = "Sunwarp Access" + option_normal = 0 + option_disabled = 1 + option_unlock = 2 + option_individual = 3 + option_progressive = 4 + + +class ShuffleSunwarps(Toggle): + """If on, the pairing and ordering of the sunwarps in the game will be randomized.""" + display_name = "Shuffle Sunwarps" + + class VictoryCondition(Choice): """Change the victory condition. On "the_end", the goal is to solve THE END at the top of the tower. On "the_master", the goal is to solve THE MASTER at the top of the tower, after getting the number of achievements specified in the Mastery Achievements option. - On "level_2", the goal is to solve LEVEL 2 in the second room, after solving the number of panels specified in the Level 2 Requirement option.""" + On "level_2", the goal is to solve LEVEL 2 in the second room, after solving the number of panels specified in the Level 2 Requirement option. + On "pilgrimage", the goal is to solve PILGRIM in the Pilgrim Antechamber, typically after performing a Pilgrimage.""" display_name = "Victory Condition" option_the_end = 0 option_the_master = 1 option_level_2 = 2 + option_pilgrimage = 3 class MasteryAchievements(Range): @@ -140,6 +180,11 @@ class LingoOptions(PerGameCommonOptions): shuffle_colors: ShuffleColors shuffle_panels: ShufflePanels shuffle_paintings: ShufflePaintings + enable_pilgrimage: EnablePilgrimage + pilgrimage_allows_roof_access: PilgrimageAllowsRoofAccess + pilgrimage_allows_paintings: PilgrimageAllowsPaintings + sunwarp_access: SunwarpAccess + shuffle_sunwarps: ShuffleSunwarps victory_condition: VictoryCondition mastery_achievements: MasteryAchievements level_2_requirement: Level2Requirement diff --git a/worlds/lingo/player_logic.py b/worlds/lingo/player_logic.py index 966f5a163762..96e9869d3731 100644 --- a/worlds/lingo/player_logic.py +++ b/worlds/lingo/player_logic.py @@ -1,12 +1,13 @@ from enum import Enum from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING -from .datatypes import Door, RoomAndDoor, RoomAndPanel -from .items import ALL_ITEM_TABLE, ItemData +from .datatypes import Door, DoorType, RoomAndDoor, RoomAndPanel +from .items import ALL_ITEM_TABLE, ItemType from .locations import ALL_LOCATION_TABLE, LocationClassification -from .options import LocationChecks, ShuffleDoors, VictoryCondition +from .options import LocationChecks, ShuffleDoors, SunwarpAccess, VictoryCondition from .static_logic import DOORS_BY_ROOM, PAINTINGS, PAINTING_ENTRANCES, PAINTING_EXITS, \ - PANELS_BY_ROOM, PROGRESSION_BY_ROOM, REQUIRED_PAINTING_ROOMS, REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS + PANELS_BY_ROOM, PROGRESSION_BY_ROOM, REQUIRED_PAINTING_ROOMS, REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS, \ + SUNWARP_ENTRANCES, SUNWARP_EXITS if TYPE_CHECKING: from . import LingoWorld @@ -58,21 +59,6 @@ def should_split_progression(progression_name: str, world: "LingoWorld") -> Prog return ProgressiveItemBehavior.PROGRESSIVE -def should_include_item(item: ItemData, world: "LingoWorld") -> bool: - if item.mode == "colors": - return world.options.shuffle_colors > 0 - elif item.mode == "doors": - return world.options.shuffle_doors != ShuffleDoors.option_none - elif item.mode == "complex door": - return world.options.shuffle_doors == ShuffleDoors.option_complex - elif item.mode == "door group": - return world.options.shuffle_doors == ShuffleDoors.option_simple - elif item.mode == "special": - return False - else: - return True - - class LingoPlayerLogic: """ Defines logic after a player's options have been applied @@ -99,6 +85,10 @@ class LingoPlayerLogic: mastery_reqs: List[AccessRequirements] counting_panel_reqs: Dict[str, List[Tuple[AccessRequirements, int]]] + sunwarp_mapping: List[int] + sunwarp_entrances: List[str] + sunwarp_exits: List[str] + def add_location(self, room: str, name: str, code: Optional[int], panels: List[RoomAndPanel], world: "LingoWorld"): """ Creates a location. This function determines the access requirements for the location by combining and @@ -132,6 +122,7 @@ def handle_non_grouped_door(self, room_name: str, door_data: Door, world: "Lingo self.real_items.append(progressive_item_name) else: self.set_door_item(room_name, door_data.name, door_data.item_name) + self.real_items.append(door_data.item_name) def __init__(self, world: "LingoWorld"): self.item_by_door = {} @@ -148,6 +139,7 @@ def __init__(self, world: "LingoWorld"): self.door_reqs = {} self.mastery_reqs = [] self.counting_panel_reqs = {} + self.sunwarp_mapping = [] door_shuffle = world.options.shuffle_doors color_shuffle = world.options.shuffle_colors @@ -161,15 +153,37 @@ def __init__(self, world: "LingoWorld"): "be enough locations for all of the door items.") # Create door items, where needed. - if door_shuffle != ShuffleDoors.option_none: - for room_name, room_data in DOORS_BY_ROOM.items(): - for door_name, door_data in room_data.items(): - if door_data.skip_item is False and door_data.event is False: + door_groups: Set[str] = set() + for room_name, room_data in DOORS_BY_ROOM.items(): + for door_name, door_data in room_data.items(): + if door_data.skip_item is False and door_data.event is False: + if door_data.type == DoorType.NORMAL and door_shuffle != ShuffleDoors.option_none: if door_data.door_group is not None and door_shuffle == ShuffleDoors.option_simple: # Grouped doors are handled differently if shuffle doors is on simple. self.set_door_item(room_name, door_name, door_data.door_group) + door_groups.add(door_data.door_group) else: self.handle_non_grouped_door(room_name, door_data, world) + elif door_data.type == DoorType.SUNWARP: + if world.options.sunwarp_access == SunwarpAccess.option_unlock: + self.set_door_item(room_name, door_name, "Sunwarps") + door_groups.add("Sunwarps") + elif world.options.sunwarp_access == SunwarpAccess.option_individual: + self.set_door_item(room_name, door_name, door_data.item_name) + self.real_items.append(door_data.item_name) + elif world.options.sunwarp_access == SunwarpAccess.option_progressive: + self.set_door_item(room_name, door_name, "Progressive Pilgrimage") + self.real_items.append("Progressive Pilgrimage") + elif door_data.type == DoorType.SUN_PAINTING: + if not world.options.enable_pilgrimage: + self.set_door_item(room_name, door_name, door_data.item_name) + self.real_items.append(door_data.item_name) + + self.real_items += door_groups + + # Create color items, if needed. + if color_shuffle: + self.real_items += [name for name, item in ALL_ITEM_TABLE.items() if item.type == ItemType.COLOR] # Create events for each achievement panel, so that we can determine when THE MASTER is accessible. for room_name, room_data in PANELS_BY_ROOM.items(): @@ -206,6 +220,11 @@ def __init__(self, world: "LingoWorld"): if world.options.level_2_requirement == 1: raise Exception("The Level 2 requirement must be at least 2 when LEVEL 2 is the victory condition.") + elif victory_condition == VictoryCondition.option_pilgrimage: + self.victory_condition = "Pilgrim Antechamber - PILGRIM" + self.add_location("Pilgrim Antechamber", "PILGRIM (Solved)", None, + [RoomAndPanel("Pilgrim Antechamber", "PILGRIM")], world) + self.event_loc_to_item["PILGRIM (Solved)"] = "Victory" # Create groups of counting panel access requirements for the LEVEL 2 check. self.create_panel_hunt_events(world) @@ -225,28 +244,22 @@ def __init__(self, world: "LingoWorld"): self.add_location(location_data.room, location_name, location_data.code, location_data.panels, world) self.real_locations.append(location_name) - # Instantiate all real items. - for name, item in ALL_ITEM_TABLE.items(): - if should_include_item(item, world): - self.real_items.append(name) - - # Calculate the requirements for the fake pilgrimage. - fake_pilgrimage = [ - ["Second Room", "Exit Door"], ["Crossroads", "Tower Entrance"], - ["Orange Tower Fourth Floor", "Hot Crusts Door"], ["Outside The Initiated", "Shortcut to Hub Room"], - ["Orange Tower First Floor", "Shortcut to Hub Room"], ["Directional Gallery", "Shortcut to The Undeterred"], - ["Orange Tower First Floor", "Salt Pepper Door"], ["Hub Room", "Crossroads Entrance"], - ["Color Hunt", "Shortcut to The Steady"], ["The Bearer", "Entrance"], ["Art Gallery", "Exit"], - ["The Tenacious", "Shortcut to Hub Room"], ["Outside The Agreeable", "Tenacious Entrance"] - ] - pilgrimage_reqs = AccessRequirements() - for door in fake_pilgrimage: - door_object = DOORS_BY_ROOM[door[0]][door[1]] - if door_object.event or world.options.shuffle_doors == ShuffleDoors.option_none: - pilgrimage_reqs.merge(self.calculate_door_requirements(door[0], door[1], world)) - else: - pilgrimage_reqs.doors.add(RoomAndDoor(door[0], door[1])) - self.door_reqs.setdefault("Pilgrim Antechamber", {})["Pilgrimage"] = pilgrimage_reqs + if world.options.enable_pilgrimage and world.options.sunwarp_access == SunwarpAccess.option_disabled: + raise Exception("Sunwarps cannot be disabled when pilgrimage is enabled.") + + if world.options.shuffle_sunwarps: + if world.options.sunwarp_access == SunwarpAccess.option_disabled: + raise Exception("Sunwarps cannot be shuffled if they are disabled.") + + self.sunwarp_mapping = list(range(0, 12)) + world.random.shuffle(self.sunwarp_mapping) + + sunwarp_rooms = SUNWARP_ENTRANCES + SUNWARP_EXITS + self.sunwarp_entrances = [sunwarp_rooms[i] for i in self.sunwarp_mapping[0:6]] + self.sunwarp_exits = [sunwarp_rooms[i] for i in self.sunwarp_mapping[6:12]] + else: + self.sunwarp_entrances = SUNWARP_ENTRANCES + self.sunwarp_exits = SUNWARP_EXITS # Create the paintings mapping, if painting shuffle is on. if painting_shuffle: @@ -277,10 +290,11 @@ def __init__(self, world: "LingoWorld"): # Starting Room - Exit Door gives access to OPEN and TRACE. good_item_options: List[str] = ["Starting Room - Back Right Door", "Second Room - Exit Door"] - if not color_shuffle: + if not color_shuffle and not world.options.enable_pilgrimage: # HOT CRUST and THIS. good_item_options.append("Pilgrim Room - Sun Painting") + if not color_shuffle: if door_shuffle == ShuffleDoors.option_simple: # WELCOME BACK, CLOCKWISE, and DRAWL + RUNS. good_item_options.append("Welcome Back Doors") diff --git a/worlds/lingo/regions.py b/worlds/lingo/regions.py index 5fddabd6894e..4b357db261b4 100644 --- a/worlds/lingo/regions.py +++ b/worlds/lingo/regions.py @@ -1,10 +1,11 @@ from typing import Dict, Optional, TYPE_CHECKING from BaseClasses import Entrance, ItemClassification, Region -from .datatypes import Room, RoomAndDoor +from .datatypes import EntranceType, Room, RoomAndDoor from .items import LingoItem from .locations import LingoLocation -from .rules import lingo_can_use_entrance, make_location_lambda +from .options import SunwarpAccess +from .rules import lingo_can_do_pilgrimage, lingo_can_use_entrance, make_location_lambda from .static_logic import ALL_ROOMS, PAINTINGS if TYPE_CHECKING: @@ -25,8 +26,20 @@ def create_region(room: Room, world: "LingoWorld") -> Region: return new_region +def is_acceptable_pilgrimage_entrance(entrance_type: EntranceType, world: "LingoWorld") -> bool: + allowed_entrance_types = EntranceType.NORMAL + + if world.options.pilgrimage_allows_paintings: + allowed_entrance_types |= EntranceType.PAINTING + + if world.options.pilgrimage_allows_roof_access: + allowed_entrance_types |= EntranceType.CROSSROADS_ROOF_ACCESS + + return bool(entrance_type & allowed_entrance_types) + + def connect_entrance(regions: Dict[str, Region], source_region: Region, target_region: Region, description: str, - door: Optional[RoomAndDoor], world: "LingoWorld"): + door: Optional[RoomAndDoor], entrance_type: EntranceType, pilgrimage: bool, world: "LingoWorld"): connection = Entrance(world.player, description, source_region) connection.access_rule = lambda state: lingo_can_use_entrance(state, target_region.name, door, world) @@ -38,6 +51,21 @@ def connect_entrance(regions: Dict[str, Region], source_region: Region, target_r if door.door not in world.player_logic.item_by_door.get(effective_room, {}): for region in world.player_logic.calculate_door_requirements(effective_room, door.door, world).rooms: world.multiworld.register_indirect_condition(regions[region], connection) + + if not pilgrimage and world.options.enable_pilgrimage and is_acceptable_pilgrimage_entrance(entrance_type, world)\ + and source_region.name != "Menu": + for part in range(1, 6): + pilgrimage_descriptor = f" (Pilgrimage Part {part})" + pilgrim_source_region = regions[f"{source_region.name}{pilgrimage_descriptor}"] + pilgrim_target_region = regions[f"{target_region.name}{pilgrimage_descriptor}"] + + effective_door = door + if effective_door is not None: + effective_room = target_region.name if door.room is None else door.room + effective_door = RoomAndDoor(effective_room, door.door) + + connect_entrance(regions, pilgrim_source_region, pilgrim_target_region, + f"{description}{pilgrimage_descriptor}", effective_door, entrance_type, True, world) def connect_painting(regions: Dict[str, Region], warp_enter: str, warp_exit: str, world: "LingoWorld") -> None: @@ -48,7 +76,8 @@ def connect_painting(regions: Dict[str, Region], warp_enter: str, warp_exit: str source_region = regions[source_painting.room] entrance_name = f"{source_painting.room} to {target_painting.room} ({source_painting.id} Painting)" - connect_entrance(regions, source_region, target_region, entrance_name, source_painting.required_door, world) + connect_entrance(regions, source_region, target_region, entrance_name, source_painting.required_door, + EntranceType.PAINTING, False, world) def create_regions(world: "LingoWorld") -> None: @@ -63,11 +92,26 @@ def create_regions(world: "LingoWorld") -> None: for room in ALL_ROOMS: regions[room.name] = create_region(room, world) + if world.options.enable_pilgrimage: + for part in range(1, 6): + pilgrimage_region_name = f"{room.name} (Pilgrimage Part {part})" + regions[pilgrimage_region_name] = Region(pilgrimage_region_name, world.player, world.multiworld) + # Connect all created regions now that they exist. + allowed_entrance_types = EntranceType.NORMAL | EntranceType.WARP | EntranceType.CROSSROADS_ROOF_ACCESS + + if not painting_shuffle: + # Don't use the vanilla painting connections if we are shuffling paintings. + allowed_entrance_types |= EntranceType.PAINTING + + if world.options.sunwarp_access != SunwarpAccess.option_disabled and not world.options.shuffle_sunwarps: + # Don't connect sunwarps if sunwarps are disabled or if we're shuffling sunwarps. + allowed_entrance_types |= EntranceType.SUNWARP + for room in ALL_ROOMS: for entrance in room.entrances: - # Don't use the vanilla painting connections if we are shuffling paintings. - if entrance.painting and painting_shuffle: + effective_entrance_type = entrance.type & allowed_entrance_types + if not effective_entrance_type: continue entrance_name = f"{entrance.room} to {room.name}" @@ -77,17 +121,56 @@ def create_regions(world: "LingoWorld") -> None: else: entrance_name += f" (through {room.name} - {entrance.door.door})" - connect_entrance(regions, regions[entrance.room], regions[room.name], entrance_name, entrance.door, world) + effective_door = entrance.door + if entrance.type == EntranceType.SUNWARP and world.options.sunwarp_access == SunwarpAccess.option_normal: + effective_door = None + + connect_entrance(regions, regions[entrance.room], regions[room.name], entrance_name, effective_door, + effective_entrance_type, False, world) + + if world.options.enable_pilgrimage: + # Connect the start of the pilgrimage. We check for all sunwarp items here. + pilgrim_start_from = regions[world.player_logic.sunwarp_entrances[0]] + pilgrim_start_to = regions[f"{world.player_logic.sunwarp_exits[0]} (Pilgrimage Part 1)"] + + if world.options.sunwarp_access >= SunwarpAccess.option_unlock: + pilgrim_start_from.connect(pilgrim_start_to, f"Pilgrimage Part 1", + lambda state: lingo_can_do_pilgrimage(state, world)) + else: + pilgrim_start_from.connect(pilgrim_start_to, f"Pilgrimage Part 1") - # Add the fake pilgrimage. - connect_entrance(regions, regions["Outside The Agreeable"], regions["Pilgrim Antechamber"], "Pilgrimage", - RoomAndDoor("Pilgrim Antechamber", "Pilgrimage"), world) + # Create connections between each segment of the pilgrimage. + for i in range(1, 6): + from_room = f"{world.player_logic.sunwarp_entrances[i]} (Pilgrimage Part {i})" + to_room = f"{world.player_logic.sunwarp_exits[i]} (Pilgrimage Part {i+1})" + if i == 5: + to_room = "Pilgrim Antechamber" + + regions[from_room].connect(regions[to_room], f"Pilgrimage Part {i+1}") + else: + connect_entrance(regions, regions["Starting Room"], regions["Pilgrim Antechamber"], "Sun Painting", + RoomAndDoor("Pilgrim Antechamber", "Sun Painting"), EntranceType.PAINTING, False, world) if early_color_hallways: - regions["Starting Room"].connect(regions["Outside The Undeterred"], "Early Color Hallways") + connect_entrance(regions, regions["Starting Room"], regions["Outside The Undeterred"], "Early Color Hallways", + None, EntranceType.PAINTING, False, world) if painting_shuffle: for warp_enter, warp_exit in world.player_logic.painting_mapping.items(): connect_painting(regions, warp_enter, warp_exit, world) + if world.options.shuffle_sunwarps: + for i in range(0, 6): + if world.options.sunwarp_access == SunwarpAccess.option_normal: + effective_door = None + else: + effective_door = RoomAndDoor("Sunwarps", f"{i + 1} Sunwarp") + + source_region = regions[world.player_logic.sunwarp_entrances[i]] + target_region = regions[world.player_logic.sunwarp_exits[i]] + + entrance_name = f"{source_region.name} to {target_region.name} ({i + 1} Sunwarp)" + connect_entrance(regions, source_region, target_region, entrance_name, effective_door, EntranceType.SUNWARP, + False, world) + world.multiworld.regions += regions.values() diff --git a/worlds/lingo/rules.py b/worlds/lingo/rules.py index 4e12938afa26..9cc11fdaea31 100644 --- a/worlds/lingo/rules.py +++ b/worlds/lingo/rules.py @@ -17,6 +17,10 @@ def lingo_can_use_entrance(state: CollectionState, room: str, door: RoomAndDoor, return _lingo_can_open_door(state, effective_room, door.door, world) +def lingo_can_do_pilgrimage(state: CollectionState, world: "LingoWorld"): + return all(_lingo_can_open_door(state, "Sunwarps", f"{i} Sunwarp", world) for i in range(1, 7)) + + def lingo_can_use_location(state: CollectionState, location: PlayerLocation, world: "LingoWorld"): return _lingo_can_satisfy_requirements(state, location.access, world) diff --git a/worlds/lingo/static_logic.py b/worlds/lingo/static_logic.py index 1da265df7d70..c7ee00102ca5 100644 --- a/worlds/lingo/static_logic.py +++ b/worlds/lingo/static_logic.py @@ -1,10 +1,9 @@ import os import pkgutil +import pickle from io import BytesIO from typing import Dict, List, Set -import pickle - from .datatypes import Door, Painting, Panel, Progression, Room ALL_ROOMS: List[Room] = [] @@ -21,6 +20,9 @@ REQUIRED_PAINTING_ROOMS: List[str] = [] REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS: List[str] = [] +SUNWARP_ENTRANCES: List[str] = [] +SUNWARP_EXITS: List[str] = [] + SPECIAL_ITEM_IDS: Dict[str, int] = {} PANEL_LOCATION_IDS: Dict[str, Dict[str, int]] = {} DOOR_LOCATION_IDS: Dict[str, Dict[str, int]] = {} @@ -99,6 +101,8 @@ def find_class(self, module, name): PAINTING_EXITS = pickdata["PAINTING_EXITS"] REQUIRED_PAINTING_ROOMS.extend(pickdata["REQUIRED_PAINTING_ROOMS"]) REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS.extend(pickdata["REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS"]) + SUNWARP_ENTRANCES.extend(pickdata["SUNWARP_ENTRANCES"]) + SUNWARP_EXITS.extend(pickdata["SUNWARP_EXITS"]) SPECIAL_ITEM_IDS.update(pickdata["SPECIAL_ITEM_IDS"]) PANEL_LOCATION_IDS.update(pickdata["PANEL_LOCATION_IDS"]) DOOR_LOCATION_IDS.update(pickdata["DOOR_LOCATION_IDS"]) diff --git a/worlds/lingo/test/TestOptions.py b/worlds/lingo/test/TestOptions.py index 176967786243..fce074311637 100644 --- a/worlds/lingo/test/TestOptions.py +++ b/worlds/lingo/test/TestOptions.py @@ -29,3 +29,23 @@ class TestAllPanelHunt(LingoTestBase): "level_2_requirement": "800", "early_color_hallways": "true" } + + +class TestShuffleSunwarps(LingoTestBase): + options = { + "shuffle_doors": "none", + "shuffle_colors": "false", + "victory_condition": "pilgrimage", + "shuffle_sunwarps": "true", + "sunwarp_access": "normal" + } + + +class TestShuffleSunwarpsAccess(LingoTestBase): + options = { + "shuffle_doors": "none", + "shuffle_colors": "false", + "victory_condition": "pilgrimage", + "shuffle_sunwarps": "true", + "sunwarp_access": "individual" + } \ No newline at end of file diff --git a/worlds/lingo/test/TestPilgrimage.py b/worlds/lingo/test/TestPilgrimage.py new file mode 100644 index 000000000000..3cc91940017e --- /dev/null +++ b/worlds/lingo/test/TestPilgrimage.py @@ -0,0 +1,114 @@ +from . import LingoTestBase + + +class TestDisabledPilgrimage(LingoTestBase): + options = { + "enable_pilgrimage": "false", + "shuffle_colors": "false" + } + + def test_access(self): + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + self.collect_by_name("Pilgrim Room - Sun Painting") + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestPilgrimageWithRoofAndPaintings(LingoTestBase): + options = { + "enable_pilgrimage": "true", + "shuffle_colors": "false", + "shuffle_doors": "complex", + "pilgrimage_allows_roof_access": "true", + "pilgrimage_allows_paintings": "true", + "early_color_hallways": "false" + } + + def test_access(self): + doors = ["Second Room - Exit Door", "Crossroads - Roof Access", "Hub Room - Crossroads Entrance", + "Outside The Undeterred - Green Painting"] + + for door in doors: + print(door) + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect_by_name(door) + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestPilgrimageNoRoofYesPaintings(LingoTestBase): + options = { + "enable_pilgrimage": "true", + "shuffle_colors": "false", + "shuffle_doors": "complex", + "pilgrimage_allows_roof_access": "false", + "pilgrimage_allows_paintings": "true", + "early_color_hallways": "false" + } + + def test_access(self): + doors = ["Second Room - Exit Door", "Crossroads - Roof Access", "Hub Room - Crossroads Entrance", + "Outside The Undeterred - Green Painting", "Crossroads - Tower Entrance", + "Orange Tower Fourth Floor - Hot Crusts Door", "Orange Tower First Floor - Shortcut to Hub Room", + "Starting Room - Street Painting"] + + for door in doors: + print(door) + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect_by_name(door) + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestPilgrimageNoRoofNoPaintings(LingoTestBase): + options = { + "enable_pilgrimage": "true", + "shuffle_colors": "false", + "shuffle_doors": "complex", + "pilgrimage_allows_roof_access": "false", + "pilgrimage_allows_paintings": "false", + "early_color_hallways": "false" + } + + def test_access(self): + doors = ["Second Room - Exit Door", "Crossroads - Roof Access", "Hub Room - Crossroads Entrance", + "Outside The Undeterred - Green Painting", "Orange Tower First Floor - Shortcut to Hub Room", + "Starting Room - Street Painting", "Outside The Initiated - Shortcut to Hub Room", + "Directional Gallery - Shortcut to The Undeterred", "Orange Tower First Floor - Salt Pepper Door", + "Color Hunt - Shortcut to The Steady", "The Bearer - Entrance", + "Orange Tower Fifth Floor - Quadruple Intersection", "The Tenacious - Shortcut to Hub Room", + "Outside The Agreeable - Tenacious Entrance", "Crossroads - Tower Entrance", + "Orange Tower Fourth Floor - Hot Crusts Door"] + + for door in doors: + print(door) + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect_by_name(door) + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestPilgrimageYesRoofNoPaintings(LingoTestBase): + options = { + "enable_pilgrimage": "true", + "shuffle_colors": "false", + "shuffle_doors": "complex", + "pilgrimage_allows_roof_access": "true", + "pilgrimage_allows_paintings": "false", + "early_color_hallways": "false" + } + + def test_access(self): + doors = ["Second Room - Exit Door", "Crossroads - Roof Access", "Hub Room - Crossroads Entrance", + "Outside The Undeterred - Green Painting", "Orange Tower First Floor - Shortcut to Hub Room", + "Starting Room - Street Painting", "Outside The Initiated - Shortcut to Hub Room", + "Directional Gallery - Shortcut to The Undeterred", "Orange Tower First Floor - Salt Pepper Door", + "Color Hunt - Shortcut to The Steady", "The Bearer - Entrance", + "Orange Tower Fifth Floor - Quadruple Intersection"] + + for door in doors: + print(door) + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect_by_name(door) + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) diff --git a/worlds/lingo/test/TestSunwarps.py b/worlds/lingo/test/TestSunwarps.py new file mode 100644 index 000000000000..e8e913c4f499 --- /dev/null +++ b/worlds/lingo/test/TestSunwarps.py @@ -0,0 +1,213 @@ +from . import LingoTestBase + + +class TestVanillaDoorsNormalSunwarps(LingoTestBase): + options = { + "shuffle_doors": "none", + "shuffle_colors": "true", + "sunwarp_access": "normal" + } + + def test_access(self): + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + + self.collect_by_name("Yellow") + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestSimpleDoorsNormalSunwarps(LingoTestBase): + options = { + "shuffle_doors": "simple", + "sunwarp_access": "normal" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + + self.collect_by_name(["Crossroads - Tower Entrances", "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestSimpleDoorsDisabledSunwarps(LingoTestBase): + options = { + "shuffle_doors": "simple", + "sunwarp_access": "disabled" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + + self.collect_by_name(["Hub Room - Crossroads Entrance", "Crossroads - Tower Entrancse", + "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestSimpleDoorsUnlockSunwarps(LingoTestBase): + options = { + "shuffle_doors": "simple", + "sunwarp_access": "unlock" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name(["Crossroads - Tower Entrances", "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + self.collect_by_name("Sunwarps") + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestComplexDoorsNormalSunwarps(LingoTestBase): + options = { + "shuffle_doors": "complex", + "sunwarp_access": "normal" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + + self.collect_by_name(["Crossroads - Tower Entrance", "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestComplexDoorsDisabledSunwarps(LingoTestBase): + options = { + "shuffle_doors": "complex", + "sunwarp_access": "disabled" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + + self.collect_by_name(["Hub Room - Crossroads Entrance", "Crossroads - Tower Entrance", + "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestComplexDoorsIndividualSunwarps(LingoTestBase): + options = { + "shuffle_doors": "complex", + "sunwarp_access": "individual" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("1 Sunwarp") + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name(["Crossroads - Tower Entrance", "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + self.collect_by_name("2 Sunwarp") + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + self.collect_by_name("3 Sunwarp") + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestComplexDoorsProgressiveSunwarps(LingoTestBase): + options = { + "shuffle_doors": "complex", + "sunwarp_access": "progressive" + } + + def test_access(self): + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name("Second Room - Exit Door") + self.assertFalse(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + progressive_pilgrimage = self.get_items_by_name("Progressive Pilgrimage") + self.collect(progressive_pilgrimage[0]) + self.assertTrue(self.multiworld.state.can_reach("Crossroads", "Region", self.player)) + + self.collect_by_name(["Crossroads - Tower Entrance", "Orange Tower Fourth Floor - Hot Crusts Door"]) + self.assertFalse(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + self.collect(progressive_pilgrimage[1]) + self.assertTrue(self.multiworld.state.can_reach("Orange Tower Third Floor", "Region", self.player)) + self.assertFalse(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + self.collect(progressive_pilgrimage[2]) + self.assertTrue(self.multiworld.state.can_reach("Outside The Initiated", "Region", self.player)) + + +class TestUnlockSunwarpPilgrimage(LingoTestBase): + options = { + "sunwarp_access": "unlock", + "shuffle_colors": "false", + "enable_pilgrimage": "true" + } + + def test_access(self): + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + self.collect_by_name("Sunwarps") + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestIndividualSunwarpPilgrimage(LingoTestBase): + options = { + "sunwarp_access": "individual", + "shuffle_colors": "false", + "enable_pilgrimage": "true" + } + + def test_access(self): + for i in range(1, 7): + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect_by_name(f"{i} Sunwarp") + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + + +class TestProgressiveSunwarpPilgrimage(LingoTestBase): + options = { + "sunwarp_access": "progressive", + "shuffle_colors": "false", + "enable_pilgrimage": "true" + } + + def test_access(self): + for item in self.get_items_by_name("Progressive Pilgrimage"): + self.assertFalse(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) + self.collect(item) + + self.assertTrue(self.can_reach_location("Pilgrim Antechamber - PILGRIM")) diff --git a/worlds/lingo/utils/pickle_static_data.py b/worlds/lingo/utils/pickle_static_data.py index 5d6fa1e68328..10ec69be3537 100644 --- a/worlds/lingo/utils/pickle_static_data.py +++ b/worlds/lingo/utils/pickle_static_data.py @@ -1,4 +1,4 @@ -from typing import Dict, List, Set +from typing import Dict, List, Set, Optional import os import sys @@ -6,7 +6,8 @@ sys.path.append(os.path.join("worlds", "lingo")) sys.path.append(".") sys.path.append("..") -from datatypes import Door, Painting, Panel, Progression, Room, RoomAndDoor, RoomAndPanel, RoomEntrance +from datatypes import Door, DoorType, EntranceType, Painting, Panel, Progression, Room, RoomAndDoor, RoomAndPanel,\ + RoomEntrance import hashlib import pickle @@ -28,6 +29,9 @@ REQUIRED_PAINTING_ROOMS: List[str] = [] REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS: List[str] = [] +SUNWARP_ENTRANCES: List[str] = ["", "", "", "", "", ""] +SUNWARP_EXITS: List[str] = ["", "", "", "", "", ""] + SPECIAL_ITEM_IDS: Dict[str, int] = {} PANEL_LOCATION_IDS: Dict[str, Dict[str, int]] = {} DOOR_LOCATION_IDS: Dict[str, Dict[str, int]] = {} @@ -96,41 +100,51 @@ def load_static_data(ll1_path, ids_path): PAINTING_EXITS = len(PAINTING_EXIT_ROOMS) -def process_entrance(source_room, doors, room_obj): +def process_single_entrance(source_room: str, room_name: str, door_obj) -> RoomEntrance: global PAINTING_ENTRANCES, PAINTING_EXIT_ROOMS + entrance_type = EntranceType.NORMAL + if "painting" in door_obj and door_obj["painting"]: + entrance_type = EntranceType.PAINTING + elif "sunwarp" in door_obj and door_obj["sunwarp"]: + entrance_type = EntranceType.SUNWARP + elif "warp" in door_obj and door_obj["warp"]: + entrance_type = EntranceType.WARP + elif source_room == "Crossroads" and room_name == "Roof": + entrance_type = EntranceType.CROSSROADS_ROOF_ACCESS + + if "painting" in door_obj and door_obj["painting"]: + PAINTING_EXIT_ROOMS.add(room_name) + PAINTING_ENTRANCES += 1 + + if "door" in door_obj: + return RoomEntrance(source_room, RoomAndDoor( + door_obj["room"] if "room" in door_obj else None, + door_obj["door"] + ), entrance_type) + else: + return RoomEntrance(source_room, None, entrance_type) + + +def process_entrance(source_room, doors, room_obj): # If the value of an entrance is just True, that means that the entrance is always accessible. if doors is True: - room_obj.entrances.append(RoomEntrance(source_room, None, False)) + room_obj.entrances.append(RoomEntrance(source_room, None, EntranceType.NORMAL)) elif isinstance(doors, dict): # If the value of an entrance is a dictionary, that means the entrance requires a door to be accessible, is a # painting-based entrance, or both. - if "painting" in doors and "door" not in doors: - PAINTING_EXIT_ROOMS.add(room_obj.name) - PAINTING_ENTRANCES += 1 - - room_obj.entrances.append(RoomEntrance(source_room, None, True)) - else: - if "painting" in doors and doors["painting"]: - PAINTING_EXIT_ROOMS.add(room_obj.name) - PAINTING_ENTRANCES += 1 - - room_obj.entrances.append(RoomEntrance(source_room, RoomAndDoor( - doors["room"] if "room" in doors else None, - doors["door"] - ), doors["painting"] if "painting" in doors else False)) + room_obj.entrances.append(process_single_entrance(source_room, room_obj.name, doors)) else: # If the value of an entrance is a list, then there are multiple possible doors that can give access to the - # entrance. + # entrance. If there are multiple connections with the same door (or lack of door) that differ only by entrance + # type, coalesce them into one entrance. + entrances: Dict[Optional[RoomAndDoor], EntranceType] = {} for door in doors: - if "painting" in door and door["painting"]: - PAINTING_EXIT_ROOMS.add(room_obj.name) - PAINTING_ENTRANCES += 1 + entrance = process_single_entrance(source_room, room_obj.name, door) + entrances[entrance.door] = entrances.get(entrance.door, EntranceType(0)) | entrance.type - room_obj.entrances.append(RoomEntrance(source_room, RoomAndDoor( - door["room"] if "room" in door else None, - door["door"] - ), door["painting"] if "painting" in door else False)) + for door, entrance_type in entrances.items(): + room_obj.entrances.append(RoomEntrance(source_room, door, entrance_type)) def process_panel(room_name, panel_name, panel_data): @@ -250,11 +264,6 @@ def process_door(room_name, door_name, door_data): else: include_reduce = False - if "junk_item" in door_data: - junk_item = door_data["junk_item"] - else: - junk_item = False - if "door_group" in door_data: door_group = door_data["door_group"] else: @@ -276,7 +285,7 @@ def process_door(room_name, door_name, door_data): panels.append(RoomAndPanel(None, panel)) else: skip_location = True - panels = None + panels = [] # The location name associated with a door can be explicitly specified in the configuration. If it is not, then the # name is generated using a combination of all of the panels that would ordinarily open the door. This can get quite @@ -312,8 +321,14 @@ def process_door(room_name, door_name, door_data): else: painting_ids = [] + door_type = DoorType.NORMAL + if door_name.endswith(" Sunwarp"): + door_type = DoorType.SUNWARP + elif room_name == "Pilgrim Antechamber" and door_name == "Sun Painting": + door_type = DoorType.SUN_PAINTING + door_obj = Door(door_name, item_name, location_name, panels, skip_location, skip_item, has_doors, - painting_ids, event, door_group, include_reduce, junk_item, item_group) + painting_ids, event, door_group, include_reduce, door_type, item_group) DOORS_BY_ROOM[room_name][door_name] = door_obj @@ -377,6 +392,15 @@ def process_painting(room_name, painting_data): PAINTINGS[painting_id] = painting_obj +def process_sunwarp(room_name, sunwarp_data): + global SUNWARP_ENTRANCES, SUNWARP_EXITS + + if sunwarp_data["direction"] == "enter": + SUNWARP_ENTRANCES[sunwarp_data["dots"] - 1] = room_name + else: + SUNWARP_EXITS[sunwarp_data["dots"] - 1] = room_name + + def process_progression(room_name, progression_name, progression_doors): global PROGRESSIVE_ITEMS, PROGRESSION_BY_ROOM @@ -422,6 +446,10 @@ def process_room(room_name, room_data): for painting_data in room_data["paintings"]: process_painting(room_name, painting_data) + if "sunwarps" in room_data: + for sunwarp_data in room_data["sunwarps"]: + process_sunwarp(room_name, sunwarp_data) + if "progression" in room_data: for progression_name, progression_doors in room_data["progression"].items(): process_progression(room_name, progression_name, progression_doors) @@ -468,6 +496,8 @@ def process_room(room_name, room_data): "PAINTING_EXITS": PAINTING_EXITS, "REQUIRED_PAINTING_ROOMS": REQUIRED_PAINTING_ROOMS, "REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS": REQUIRED_PAINTING_WHEN_NO_DOORS_ROOMS, + "SUNWARP_ENTRANCES": SUNWARP_ENTRANCES, + "SUNWARP_EXITS": SUNWARP_EXITS, "SPECIAL_ITEM_IDS": SPECIAL_ITEM_IDS, "PANEL_LOCATION_IDS": PANEL_LOCATION_IDS, "DOOR_LOCATION_IDS": DOOR_LOCATION_IDS, diff --git a/worlds/lingo/utils/validate_config.rb b/worlds/lingo/utils/validate_config.rb index ae0ac61cdb1b..831fee2ad312 100644 --- a/worlds/lingo/utils/validate_config.rb +++ b/worlds/lingo/utils/validate_config.rb @@ -37,12 +37,14 @@ mentioned_rooms = Set[] mentioned_doors = Set[] mentioned_panels = Set[] +mentioned_sunwarp_entrances = Set[] +mentioned_sunwarp_exits = Set[] door_groups = {} -directives = Set["entrances", "panels", "doors", "paintings", "progression"] +directives = Set["entrances", "panels", "doors", "paintings", "sunwarps", "progression"] panel_directives = Set["id", "required_room", "required_door", "required_panel", "colors", "check", "exclude_reduce", "tag", "link", "subtag", "achievement", "copy_to_sign", "non_counting", "hunt"] -door_directives = Set["id", "painting_id", "panels", "item_name", "item_group", "location_name", "skip_location", "skip_item", "door_group", "include_reduce", "junk_item", "event"] +door_directives = Set["id", "painting_id", "panels", "item_name", "item_group", "location_name", "skip_location", "skip_item", "door_group", "include_reduce", "event", "warp_id"] painting_directives = Set["id", "enter_only", "exit_only", "orientation", "required_door", "required", "required_when_no_doors", "move", "req_blocked", "req_blocked_when_no_doors"] non_counting = 0 @@ -67,17 +69,17 @@ entrances = [] if entrance.kind_of? Hash - if entrance.keys() != ["painting"] then - entrances = [entrance] - end + entrances = [entrance] elsif entrance.kind_of? Array entrances = entrance end entrances.each do |e| - entrance_room = e.include?("room") ? e["room"] : room_name - mentioned_rooms.add(entrance_room) - mentioned_doors.add(entrance_room + " - " + e["door"]) + if e.include?("door") then + entrance_room = e.include?("room") ? e["room"] : room_name + mentioned_rooms.add(entrance_room) + mentioned_doors.add(entrance_room + " - " + e["door"]) + end end end @@ -204,8 +206,8 @@ end end - if not door.include?("id") and not door.include?("painting_id") and not door["skip_item"] and not door["event"] then - puts "#{room_name} - #{door_name} :::: Should be marked skip_item or event if there are no doors or paintings" + if not door.include?("id") and not door.include?("painting_id") and not door.include?("warp_id") and not door["skip_item"] and not door["event"] then + puts "#{room_name} - #{door_name} :::: Should be marked skip_item or event if there are no doors, paintings, or warps" end if door.include?("panels") @@ -292,6 +294,32 @@ end end + (room["sunwarps"] || []).each do |sunwarp| + if sunwarp.include? "dots" and sunwarp.include? "direction" then + if sunwarp["dots"] < 1 or sunwarp["dots"] > 6 then + puts "#{room_name} :::: Contains a sunwarp with an invalid dots value" + end + + if sunwarp["direction"] == "enter" then + if mentioned_sunwarp_entrances.include? sunwarp["dots"] then + puts "Multiple #{sunwarp["dots"]} sunwarp entrances were found" + else + mentioned_sunwarp_entrances.add(sunwarp["dots"]) + end + elsif sunwarp["direction"] == "exit" then + if mentioned_sunwarp_exits.include? sunwarp["dots"] then + puts "Multiple #{sunwarp["dots"]} sunwarp exits were found" + else + mentioned_sunwarp_exits.add(sunwarp["dots"]) + end + else + puts "#{room_name} :::: Contains a sunwarp with an invalid direction value" + end + else + puts "#{room_name} :::: Contains a sunwarp without a dots and direction" + end + end + (room["progression"] || {}).each do |progression_name, door_list| door_list.each do |door| if door.kind_of? Hash then