diff --git a/worlds/portal2/ItemNames.py b/worlds/portal2/ItemNames.py index 378a0db1ba3..cbdfb99c547 100644 --- a/worlds/portal2/ItemNames.py +++ b/worlds/portal2/ItemNames.py @@ -14,6 +14,9 @@ ball_button = "Ball Buttons" frankenturret = "Frankenturrets" paint = "Three Gels" +blue_gel = "Blue Gel" +orange_gel = "Orange Gel" +white_gel = "White Gel" laser = "Lasers" faith_plate = "Aerial Faith Plates" funnel = "Excursion Funnels" diff --git a/worlds/portal2/Items.py b/worlds/portal2/Items.py index 540a64f3342..6bb7fa6801b 100644 --- a/worlds/portal2/Items.py +++ b/worlds/portal2/Items.py @@ -8,6 +8,11 @@ class ItemTag(Flag): WEAPON = auto() CUBE = auto() GEL = auto() + + BLUE_GEL = auto() + ORANGE_GEL = auto() + WHITE_GEL = auto() + CORE = auto() # Affect applied @@ -41,7 +46,7 @@ class Portal2Item(Item): weighted_cube: Portal2ItemData("prop_weighted_cube", "models/props/metal_box.mdl", ItemTag.DELETE | ItemTag.CUBE, ItemClassification.progression), reflection_cube: Portal2ItemData("prop_weighted_cube", "models/props/reflection_cube.mdl", ItemTag.DELETE | ItemTag.CUBE, ItemClassification.progression), spherical_cube: Portal2ItemData("prop_weighted_cube", "models/props_gameplay/mp_ball.mdl", ItemTag.DELETE | ItemTag.CUBE, ItemClassification.filler), - antique_cube: Portal2ItemData("prop_weighted_cube", "models/props_underground_underground_weighted_cube.mdl", ItemTag.DELETE | ItemTag.CUBE, ItemClassification.progression), + antique_cube: Portal2ItemData("prop_weighted_cube", "models/props_underground_weighted_cube.mdl", ItemTag.DELETE | ItemTag.CUBE, ItemClassification.progression), # Buttons button: Portal2ItemData("prop_button", None, ItemTag.ENTITY | ItemTag.DELETE, ItemClassification.progression), @@ -51,7 +56,9 @@ class Portal2Item(Item): # Puzzle Elements frankenturret: Portal2ItemData("prop_monster_box", None, ItemTag.ENTITY | ItemTag.DELETE, ItemClassification.progression), - paint: Portal2ItemData("info_paint_sprayer", None, ItemTag.ENTITY | ItemTag.GEL | ItemTag.DELETE, ItemClassification.progression), + blue_gel: Portal2ItemData("various", "blue", ItemTag.ENTITY | ItemTag.GEL | ItemTag.BLUE_GEL, ItemClassification.progression), + orange_gel: Portal2ItemData("various", "orange", ItemTag.ENTITY | ItemTag.GEL | ItemTag.ORANGE_GEL, ItemClassification.progression), + white_gel: Portal2ItemData("various", "white", ItemTag.ENTITY | ItemTag.GEL | ItemTag.WHITE_GEL, ItemClassification.progression), laser: Portal2ItemData("env_portal_laser", None, ItemTag.ENTITY | ItemTag.DELETE, ItemClassification.progression), faith_plate: Portal2ItemData("trigger_catapult", None, ItemTag.ENTITY | ItemTag.DELETE, ItemClassification.progression), funnel: Portal2ItemData("prop_tractor_beam", None, ItemTag.ENTITY | ItemTag.DELETE, ItemClassification.progression), diff --git a/worlds/portal2/Locations.py b/worlds/portal2/Locations.py index 34b6ac608da..ff3129e0955 100644 --- a/worlds/portal2/Locations.py +++ b/worlds/portal2/Locations.py @@ -14,6 +14,7 @@ class LocationType(Flag): ITEM = auto() ACHIEVEMENT = auto() WHEATLY_MONITOR = auto() + RATMAN_DEN = auto() OTHER = auto() class Portal2LocationData: @@ -75,15 +76,15 @@ class Portal2Location(Location): # Chapter 6 "Underground Completion": Portal2LocationData("sp_a3_01", LocationType.MAP_COMPLETION, [portal_gun_2], 6), "Cave Johnson Completion": Portal2LocationData("sp_a3_03", LocationType.MAP_COMPLETION, [portal_gun_2], 6), - "Repulsion Intro Completion": Portal2LocationData("sp_a3_jump_intro", LocationType.MAP_COMPLETION, [portal_gun_2, paint, old_button, old_floor_button, antique_cube], 6), - "Bomb Flings Completion": Portal2LocationData("sp_a3_bomb_flings", LocationType.MAP_COMPLETION, [portal_gun_2, old_button, paint], 6), - "Crazy Box Completion": Portal2LocationData("sp_a3_crazy_box", LocationType.MAP_COMPLETION, [portal_gun_2, old_button, paint, antique_cube, old_floor_button], 6), + "Repulsion Intro Completion": Portal2LocationData("sp_a3_jump_intro", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, old_button, old_floor_button, antique_cube], 6), + "Bomb Flings Completion": Portal2LocationData("sp_a3_bomb_flings", LocationType.MAP_COMPLETION, [portal_gun_2, old_button, blue_gel], 6), + "Crazy Box Completion": Portal2LocationData("sp_a3_crazy_box", LocationType.MAP_COMPLETION, [portal_gun_2, old_button, blue_gel, antique_cube, old_floor_button], 6), "PotatOS Completion": Portal2LocationData("sp_a3_transition01", LocationType.MAP_COMPLETION, [portal_gun_2, potatos], 6), # Chapter 7 - "Propulsion Intro Completion": Portal2LocationData("sp_a3_speed_ramp", LocationType.MAP_COMPLETION, [portal_gun_2, paint, antique_cube, old_floor_button, old_button], 7), - "Propulsion Flings Completion": Portal2LocationData("sp_a3_speed_flings", LocationType.MAP_COMPLETION, [portal_gun_2, paint, antique_cube, old_floor_button], 7), - "Conversion Intro Completion": Portal2LocationData("sp_a3_portal_intro", LocationType.MAP_COMPLETION, [portal_gun_2, paint], 7), - "Three Gels Completion": Portal2LocationData("sp_a3_end", LocationType.MAP_COMPLETION, [portal_gun_2, paint], 7), + "Propulsion Intro Completion": Portal2LocationData("sp_a3_speed_ramp", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, orange_gel, antique_cube, old_floor_button, old_button], 7), + "Propulsion Flings Completion": Portal2LocationData("sp_a3_speed_flings", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, orange_gel, antique_cube, old_floor_button], 7), + "Conversion Intro Completion": Portal2LocationData("sp_a3_portal_intro", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, orange_gel, white_gel], 7), + "Three Gels Completion": Portal2LocationData("sp_a3_end", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, orange_gel, white_gel], 7), # Chapter 8 "Test Completion": Portal2LocationData("sp_a4_intro", LocationType.MAP_COMPLETION, [portal_gun_2, frankenturret, floor_button, button], 8), "Funnel Intro Completion": Portal2LocationData("sp_a4_tb_intro", LocationType.MAP_COMPLETION, [portal_gun_2, funnel, frankenturret, floor_button], 8), @@ -94,13 +95,13 @@ class Portal2Location(Location): "Stop The Box Completion": Portal2LocationData("sp_a4_stop_the_box", LocationType.MAP_COMPLETION, [portal_gun_2, frankenturret, floor_button, button, faith_plate, bridge], 8), "Laser Catapult Completion": Portal2LocationData("sp_a4_laser_catapult", LocationType.MAP_COMPLETION, [portal_gun_2, frankenturret, floor_button, faith_plate, reflection_cube, laser, laser_catcher, funnel], 8), "Laser Platform Completion": Portal2LocationData("sp_a4_laser_platform", LocationType.MAP_COMPLETION, [portal_gun_2, button, reflection_cube, laser, laser_catcher, funnel], 8), - "Propulsion Catch Completion": Portal2LocationData("sp_a4_speed_tb_catch", LocationType.MAP_COMPLETION, [portal_gun_2, floor_button, funnel, button, frankenturret, paint], 8), - "Repulsion Polarity Completion": Portal2LocationData("sp_a4_jump_polarity", LocationType.MAP_COMPLETION, [portal_gun_2, paint, funnel, floor_button, button], 8), + "Propulsion Catch Completion": Portal2LocationData("sp_a4_speed_tb_catch", LocationType.MAP_COMPLETION, [portal_gun_2, floor_button, funnel, button, frankenturret, orange_gel], 8), + "Repulsion Polarity Completion": Portal2LocationData("sp_a4_jump_polarity", LocationType.MAP_COMPLETION, [portal_gun_2, blue_gel, white_gel, funnel, floor_button, button], 8), # Chapter 9 - "Finale 1 Completion": Portal2LocationData("sp_a4_finale1", LocationType.MAP_COMPLETION, [portal_gun_2, faith_plate, funnel, paint], 9), - "Finale 2 Completion": Portal2LocationData("sp_a4_finale2", LocationType.MAP_COMPLETION, [portal_gun_2, funnel, paint, floor_button, turrets], 9), - "Finale 3 Completion": Portal2LocationData("sp_a4_finale3", LocationType.MAP_COMPLETION, [portal_gun_2, paint, funnel], 9), - "Finale 4 Completion": Portal2LocationData("sp_a4_finale4", LocationType.MAP_COMPLETION, [portal_gun_2, potatos, paint, adventure_core, space_core, fact_core], 9), + "Finale 1 Completion": Portal2LocationData("sp_a4_finale1", LocationType.MAP_COMPLETION, [portal_gun_2, faith_plate, funnel, white_gel], 9), + "Finale 2 Completion": Portal2LocationData("sp_a4_finale2", LocationType.MAP_COMPLETION, [portal_gun_2, funnel, blue_gel, floor_button, turrets], 9), + "Finale 3 Completion": Portal2LocationData("sp_a4_finale3", LocationType.MAP_COMPLETION, [portal_gun_2, orange_gel, white_gel, funnel], 9), + "Finale 4 Completion": Portal2LocationData("sp_a4_finale4", LocationType.MAP_COMPLETION, [portal_gun_2, potatos, blue_gel, orange_gel, white_gel, adventure_core, space_core, fact_core], 9), } # Optional Checks @@ -154,10 +155,12 @@ class Portal2Location(Location): "Wheatley Monitor 8": Portal2LocationData("sp_a4_laser_catapult", LocationType.WHEATLY_MONITOR, [portal_gun_2, frankenturret, faith_plate, funnel, reflection_cube, laser, laser_catcher]), "Wheatley Monitor 9": Portal2LocationData("sp_a4_laser_platform", LocationType.WHEATLY_MONITOR, [portal_gun_2, laser, laser_catcher, reflection_cube, button]), "Wheatley Monitor 10": Portal2LocationData("sp_a4_speed_tb_catch", LocationType.WHEATLY_MONITOR, [portal_gun_2]), - "Wheatley Monitor 11": Portal2LocationData("sp_a4_jump_polarity", LocationType.WHEATLY_MONITOR, [portal_gun_2, paint, funnel, turrets, floor_button, button]), - "Wheatley Monitor 12": Portal2LocationData("sp_a4_finale3", LocationType.WHEATLY_MONITOR, [portal_gun_2, paint]), + "Wheatley Monitor 11": Portal2LocationData("sp_a4_jump_polarity", LocationType.WHEATLY_MONITOR, [portal_gun_2, blue_gel, white_gel, funnel, turrets, floor_button, button]), + "Wheatley Monitor 12": Portal2LocationData("sp_a4_finale3", LocationType.WHEATLY_MONITOR, [portal_gun_2, orange_gel, white_gel]), } +# Note: these are the names used in game to identify the monitors +# most are just the map name but some have a number after due to multiple monitors in the same map wheatley_maps_to_monitor_names: dict[str, str] = {value.map_name: key for key, value in wheatley_monitor_table.items()} item_location_table: dict[str, Portal2LocationData] = { @@ -169,17 +172,31 @@ class Portal2Location(Location): item_maps_to_item_location : dict[str, str] = {value.map_name:key for key, value in item_location_table.items()} ratman_den_locations_table: dict[str, Portal2LocationData] = { - "Ratman Den 1": Portal2LocationData("sp_a1_intro4", LocationType.OTHER, [weighted_cube, floor_button]), - "Ratman Den 2": Portal2LocationData("sp_a2_dual_lasers", LocationType.OTHER), - "Ratman Den 3": Portal2LocationData("sp_a2_trust_fling", LocationType.OTHER, [portal_gun_2, faith_plate]), - "Ratman Den 4": Portal2LocationData("sp_a2_bridge_intro", LocationType.OTHER), - "Ratman Den 5": Portal2LocationData("sp_a2_bridge_the_gap", LocationType.OTHER, [portal_gun_2]), - "Ratman Den 6": Portal2LocationData("sp_a2_laser_vs_turret", LocationType.OTHER, [portal_gun_2, laser, floor_button, reflection_cube]), - "Ratman Den 7": Portal2LocationData("sp_a2_pull_the_rug", LocationType.OTHER, [portal_gun_2, bridge]) + "Ratman Den 1": Portal2LocationData("sp_a1_intro4", LocationType.RATMAN_DEN, [weighted_cube, floor_button]), + "Ratman Den 2": Portal2LocationData("sp_a2_dual_lasers", LocationType.RATMAN_DEN), + "Ratman Den 3": Portal2LocationData("sp_a2_trust_fling", LocationType.RATMAN_DEN, [portal_gun_2, faith_plate]), + "Ratman Den 4": Portal2LocationData("sp_a2_bridge_intro", LocationType.RATMAN_DEN), + "Ratman Den 5": Portal2LocationData("sp_a2_bridge_the_gap", LocationType.RATMAN_DEN, [portal_gun_2, bridge]), + "Ratman Den 6": Portal2LocationData("sp_a2_laser_vs_turret", LocationType.RATMAN_DEN, [portal_gun_2, laser, floor_button, reflection_cube]), + "Ratman Den 7": Portal2LocationData("sp_a2_pull_the_rug", LocationType.RATMAN_DEN, [portal_gun_2, bridge]) } ratman_map_to_ratman_den: dict[str, str] = {value.map_name: key for key, value in ratman_den_locations_table.items()} +vitrified_door_locations_table: dict[str, Portal2LocationData] = { + "Vitrified Door 1": Portal2LocationData("sp_a3_03", LocationType.OTHER, [portal_gun_2], 6), + "Vitrified Door 2": Portal2LocationData("sp_a3_03", LocationType.OTHER, [portal_gun_2], 6), + "Vitrified Door 3": Portal2LocationData("sp_a3_03", LocationType.OTHER, [portal_gun_2], 6), + "Vitrified Door 4": Portal2LocationData("sp_a3_transition01", LocationType.OTHER, [portal_gun_2], 6), + "Vitrified Door 5": Portal2LocationData("sp_a3_transition01", LocationType.OTHER, [portal_gun_2], 6), + "Vitrified Door 6": Portal2LocationData("sp_a3_transition01", LocationType.OTHER, [portal_gun_2], 6), +} + +vitrified_map_to_vitrified_door: dict[str, list[str]] = { + "sp_a3_03": ["Vitrified Door 1", "Vitrified Door 2", "Vitrified Door 3"], + "sp_a3_transition01": ["Vitrified Door 4", "Vitrified Door 5", "Vitrified Door 6"] +} + all_locations_table: dict[str, Portal2LocationData] = map_complete_table.copy() all_locations_table.update(cutscene_completion_table) @@ -191,6 +208,7 @@ class Portal2Location(Location): all_locations_table.update(wheatley_monitor_table) all_locations_table.update(item_location_table) all_locations_table.update(ratman_den_locations_table) +all_locations_table.update(vitrified_door_locations_table) # all_locations_table.update(achievements_table) location_groups: dict[str, set[str]] = { @@ -236,8 +254,8 @@ class Portal2Location(Location): "Neurotoxin Sabotage Completion": [portal_gun_2], "Core Completion": [turrets], # Chapter 6 - "Repulsion Intro Completion": [paint, old_floor_button, portal_gun_2], - "Bomb Flings Completion": [portal_gun_2, paint, old_button], + "Repulsion Intro Completion": [blue_gel, old_floor_button, portal_gun_2], + "Bomb Flings Completion": [portal_gun_2, blue_gel, old_button], "Crazy Box Completion": [portal_gun_2, old_floor_button], # Chapter 7 "Propulsion Intro Completion": [portal_gun_2], @@ -253,7 +271,7 @@ class Portal2Location(Location): "Laser Catapult Completion": [portal_gun_2], "Laser Platform Completion": [portal_gun_2, funnel], "Propulsion Catch Completion": [button, frankenturret], - "Repulsion Polarity Completion": [turrets, button, paint], + "Repulsion Polarity Completion": [turrets, button, blue_gel, white_gel], # Chapter 9 "Finale 1 Completion": [portal_gun_2, frankenturret, faith_plate], "Finale 2 Completion": [portal_gun_2], @@ -263,7 +281,7 @@ class Portal2Location(Location): sub_locations_in_maps: dict[str, list[str]] = { "Portal Gun Completion": [portal_gun_1], "Incinerator Completion": [portal_gun_2], - "PotatOS Completion": [potatos], + "PotatOS Completion": [potatos, "Vitrified Door 4", "Vitrified Door 5", "Vitrified Door 6"], "Funnel Intro Completion": ["Wheatley Monitor 1"], "Ceiling Button Completion": ["Wheatley Monitor 2"], "Wall Button Completion": ["Wheatley Monitor 3"], @@ -275,11 +293,12 @@ class Portal2Location(Location): "Propulsion Catch Completion": ["Wheatley Monitor 10"], "Repulsion Polarity Completion": ["Wheatley Monitor 11"], "Finale 3 Completion": ["Wheatley Monitor 12"], - "Laser Stairs Completion": ["Ratman Den 1"], + "Smooth Jazz Completion": ["Ratman Den 1"], "Dual Lasers Completion": ["Ratman Den 2"], "Trust Fling Completion": ["Ratman Den 3"], "Bridge Intro Completion": ["Ratman Den 4"], "Bridge the Gap Completion": ["Ratman Den 5"], "Laser Vs. Turret Completion": ["Ratman Den 6"], - "Pull The Rug Completion": ["Ratman Den 7"] + "Pull The Rug Completion": ["Ratman Den 7"], + "Cave Johnson Completion": ["Vitrified Door 1", "Vitrified Door 2", "Vitrified Door 3"], } \ No newline at end of file diff --git a/worlds/portal2/Options.py b/worlds/portal2/Options.py index 40abb39fa05..a3aff7cf8a7 100644 --- a/worlds/portal2/Options.py +++ b/worlds/portal2/Options.py @@ -127,6 +127,12 @@ class RatmanDens(Toggle): Determines whether locating Ratman Dens will send location checks """ display_name = "Ratman Dens" + +class VitrifiedDoors(Toggle): + """ + Determines whether locating Vitrified Doors will send location checks + """ + display_name = "Vitrified Doors" portal2_option_groups = [ OptionGroup("Location Options", [ @@ -137,6 +143,7 @@ class RatmanDens(Toggle): CutsceneLevels, WheatleyMonitors, RatmanDens, + VitrifiedDoors ]), OptionGroup("Trap Options", [ TrapFillPercentage, @@ -169,6 +176,7 @@ class Portal2Options(PerGameCommonOptions): # storyachievementsanity: StoryAchievementSanity wheatley_monitors: WheatleyMonitors ratman_dens: RatmanDens + vitrified_doors: VitrifiedDoors trap_fill_percentage: TrapFillPercentage motion_blur_trap_weight: MotionBlurTrapWeight diff --git a/worlds/portal2/__init__.py b/worlds/portal2/__init__.py index cec83e04fd8..3000d580eb8 100644 --- a/worlds/portal2/__init__.py +++ b/worlds/portal2/__init__.py @@ -172,6 +172,9 @@ def create_connected_maps(self, chapter_number: int, map_location_names: list[st elif self.options.ratman_dens and sub_location in ratman_den_locations_table: ratman_requirements = ratman_den_locations_table[sub_location].required_items self.create_in_level_check(sub_location, ratman_requirements, region_start) + elif self.options.vitrified_doors and sub_location in vitrified_door_locations_table: + vitrified_requirements = vitrified_door_locations_table[sub_location].required_items + self.create_in_level_check(sub_location, vitrified_requirements, region_start) # Connect to chapter region if there was no previous level or if open world if self.options.game_mode == GameModeOption.OPEN_WORLD or last_region == None: diff --git a/worlds/portal2/archipelago.json b/worlds/portal2/archipelago.json index a9f54a2a088..a23d0fdb094 100644 --- a/worlds/portal2/archipelago.json +++ b/worlds/portal2/archipelago.json @@ -2,5 +2,5 @@ "game": "Portal 2", "authors": [ "GlassToadstool" ], "minimum_ap_version": "0.6.3", - "world_version": "0.6.0" + "world_version": "0.7.0" } \ No newline at end of file diff --git a/worlds/portal2/client/DeathMessages.py b/worlds/portal2/client/DeathMessages.py new file mode 100644 index 00000000000..f612e2fc758 --- /dev/null +++ b/worlds/portal2/client/DeathMessages.py @@ -0,0 +1,87 @@ +from random import choice + +default_death_messages = [ + "Long fall boots could not save {player_name}", + "{player_name} found the cake", + "{player_name} looked at the operational end of the Aperture Science Handheld Portal Device", + "{player_name} died of known side effects", + "{player_name} died of unknown side effects" +] + +map_specific_death_messages = { + # Chapter 1 + "sp_a1_intro1": ["{player_name} had a minor case of serious brain damage"], + "sp_a1_intro2": ["The Aperture Science Material Emancipation Grill fizzled {player_name}'s eartubes"], + "sp_a1_intro3": ["{player_name} found a gun that makes the wrong type of hole"], + "sp_a1_intro4": ["{player_name} did not remain tranquil in the face of almost certain death"], + "sp_a1_intro5": ["{player_name} did not avoid unsheltered testing areas"], + "sp_a1_intro6": ["{player_name} was irradiated in such a way that the future should not start with them"], + "sp_a1_intro7": ["{player_name}disengaged from their management rail"], + "sp_a1_wakeup": ["{player_name} found the escape pod"], + "sp_a2_intro": ["{player_name} was euthanized"], + # Chapter 2 + "sp_a2_laser_intro": ["{player_name} failed this first simple test"], + "sp_a2_laser_stairs": ["{player_name} got to see how the Discouragement Redirection Cubes work"], + "sp_a2_dual_lasers": ["{player_name} somehow managed to pack on a few pounds"], + "sp_a2_laser_over_goo": ["{player_name} decided to go THAT slowly"], + "sp_a2_catapult_intro": ["{player_name} was catapulted into space"], + "sp_a2_trust_fling": ["{player_name} landed in 15 acres of broken glass"], + "sp_a2_pit_flings": ['{player_name} has died. They probably wanted to say: "I love you"'], + "sp_a2_fizzler_intro": ["{player_name} did not understand the test"], + # Chapter 3 + "sp_a2_sphere_peek": ["{player_name} defeated the load-bearing capacity of the Aperture Science Aerial Faith Plate"], + "sp_a2_ricochet": ["{player_name} saw a deer"], + "sp_a2_bridge_intro": ["{player_name} rubbed their cheek on the Aperture Science Hard Light Bridge"], + "sp_a2_bridge_the_gap": ["{player_name} did not do well enough"], + "sp_a2_turret_intro": ["{player_name} became a pale spherical thing full of bullets"], + "sp_a2_laser_relays": ["{player_name} accepted a belated birthday medical experiment"], + "sp_a2_turret_blocker": ["{player_name}'s jumpsuit looked too stupid"], + "sp_a2_laser_vs_turret":["{player_name} couldn't wait for the surprise"], + "sp_a2_pull_the_rug": ["{player_name} didn't win the Nobel Prize for being immune to neurotoxin"], + # Chapter 4 + "sp_a2_column_blocker": ["{player_name}'s birth parents do not love them"], + "sp_a2_laser_chaining": ["{player_name}'s death was actually pretty funny according to the old formula"], + "sp_a2_triple_laser": ["Something is wrong with {player_name}'s Triple Laser"], + "sp_a2_bts1": ["{player_name} completed the last test"], + "sp_a2_bts2": ["{player_name} did not get into the lift"], + # Chapter 5 + "sp_a2_bts3": ["{player_name} was too smelly"], + "sp_a2_bts4": ["{player_name} made a potato battery"], + "sp_a2_bts5": ["{player_name} did not look directly at the implosion"], + "sp_a2_core": ["{player_name} must have felt really silly for dying here"], + # Chapter 6 + "sp_a3_01": ["{player_name} did not heed the warning signs"], + "sp_a3_03": ["{player_name} found the human-mantis hybrids"], + "sp_a3_jump_intro": ["{player_name} was part of the control group"], + "sp_a3_bomb_flings": ["{player_name} died from asbestos poisoning"], + "sp_a3_crazy_box": ["{player_name} made eye contact with themselves on the testing track"], + "sp_a3_transition01": ["{player_name} was not good at murder"], + # Chapter 7 + "sp_a3_speed_ramp": ["{player_name} did not want the 60 bucks"], + "sp_a3_speed_flings": ["{player_name} let Aperture Science disassemble them"], + "sp_a3_portal_intro": ["Cave Johnson burned {player_name}'s house down with the lemons"], + "sp_a3_end": ["{player_name} died of moon rock poisoning"], + # Chapter 8 + "sp_a4_intro": ["{player_name} did not want to get onto the button"], + "sp_a4_tb_intro": ["{player_name} got stuck on the roof when trying to crouch-flight"], + "sp_a4_tb_trust_drop": ["{player_name} did not pull the lever"], + "sp_a4_tb_wall_button": ["{player_name} started before Wheatley"], + "sp_a4_tb_polarity": ["{player_name} got called adopted"], + "sp_a4_tb_catch": ["{player_name} did not read Machiavellian"], + "sp_a4_stop_the_box": ["{player_name} found the worst way to solve the test chamber"], + "sp_a4_laser_catapult": ["{player_name} failed to solve the test chamber ten times as fast"], + "sp_a4_laser_platform": ["{player_name} was caught in the tremor for old times' sake"], + "sp_a4_speed_tb_catch": ["{player_name} loved the big surprise to death"], + "sp_a4_jump_polarity": ["{player_name} slipped. Butterfingers!"], + # Chapter 9 + "sp_a4_finale1": ["{player_name} reached the part where he kills you"], + "sp_a4_finale2": ["{player_name} lost against mashy spike plate"], + "sp_a4_finale3": ["{player_name} spent ten years in the room where all the robots scream at you"], + "sp_a4_finale4": ["Bombs were thrown at {player_name}"], +} + +def get_death_message(map_name, player_name): + death_messages = default_death_messages + if map_name in map_specific_death_messages: + death_messages += map_specific_death_messages[map_name] + return choice(death_messages).format(player_name=player_name) \ No newline at end of file diff --git a/worlds/portal2/client/Portal2Client.py b/worlds/portal2/client/Portal2Client.py index 934b1c91d50..276ea2e79a9 100644 --- a/worlds/portal2/client/Portal2Client.py +++ b/worlds/portal2/client/Portal2Client.py @@ -11,7 +11,8 @@ from ..mod_helpers.ItemHandling import add_ratman_commands, handle_item, handle_map_start, handle_trap, portal_gun_upgrade_not_inplace, potatos_not_inplace from ..mod_helpers.MapMenu import Menu -from ..Locations import location_names_to_map_codes, map_codes_to_location_names, wheatley_maps_to_monitor_names, all_locations_table +from .DeathMessages import get_death_message +from ..Locations import location_names_to_map_codes, map_codes_to_location_names, wheatley_maps_to_monitor_names, all_locations_table, wheatley_monitor_table, ratman_den_locations_table from .. import Portal2World from ..Options import GameModeOption @@ -211,7 +212,7 @@ async def handle_message(self, message: str): # append the whole command string command_string = self.create_level_begin_command() self.command_queue.append(command_string) - self.command_queue += handle_map_start(map_name, self.item_list) + self.command_queue += handle_map_start(map_name, self.item_list, self.get_wheatley_monitor_names(self.checked_locations), self.get_ratman_den_names(self.checked_locations)) # For map complete checks elif message.startswith("map_complete:"): @@ -225,21 +226,22 @@ async def handle_message(self, message: str): self.update_menu(map_id) # All other checks + # Item checks e.g. portal gun upgrade, potatos elif message.startswith("item_collected:"): item_collected = message.split(":", 1)[1] check_id = all_locations_table[item_collected].id await self.check_locations([check_id]) self.update_menu(check_id) - + + # Wheatley monitor checks elif message.startswith("monitor_break:"): map_name = message.split(":", 1)[1] check_name = wheatley_maps_to_monitor_names[map_name] - check_id = all_locations_table[check_name].id await self.check_locations([check_id]) self.update_menu(check_id) - # Custom buttons e.g. ratman dens + # Custom buttons e.g. ratman dens, vitrified doors elif message.startswith("button_check:"): check_name = message.split(":", 1)[1] check_id = all_locations_table[check_name].id @@ -249,7 +251,9 @@ async def handle_message(self, message: str): # Deathlink elif message.startswith("send_deathlink"): if self.death_link_active and time.time() - self.last_death_link > 10: - await self.send_death() + map_name = message.split(" ")[1] + death_message = get_death_message(map_name, self.player_names[self.slot]) + await self.send_death(death_text=death_message) async def handle_goal_completion(self): if self.finished_game: @@ -289,6 +293,24 @@ def map_code_to_location_id(self, map_code: str): return None return self.location_name_to_id[location_name] + def get_wheatley_monitor_names(self, location_ids: list[int]) -> list[str]: + '''Convert location ids to the names of the wheatley monitor checks if they are ones''' + monitors_checked = [] + for loc in location_ids: + location_name = self.location_names.lookup_in_game(loc) + if location_name in wheatley_monitor_table: + monitors_checked.append(location_name) + return monitors_checked + + def get_ratman_den_names(self, location_ids: list[int]) -> list[str]: + '''Convert location ids to the names of the ratman den checks if they are ones''' + dens_checked = [] + for loc in location_ids: + location_name = self.location_names.lookup_in_game(loc) + if location_name in ratman_den_locations_table: + dens_checked.append(location_name) + return dens_checked + def handle_slot_data(self, slot_data: dict): if "death_link" in slot_data: self.death_link_active = slot_data["death_link"] @@ -319,6 +341,10 @@ def handle_slot_data(self, slot_data: dict): if slot_data["ratman_dens"]: add_ratman_commands() self.menu.has_ratman_dens = True + + if "vitrified_doors" in slot_data: + if slot_data["vitrified_doors"]: + self.menu.has_vitrified_doors = True # Don't remove the portal gun upgrade after pickup if "portal_gun_upgrade_inplace" not in slot_data: @@ -329,7 +355,7 @@ def handle_slot_data(self, slot_data: dict): potatos_not_inplace() self.menu.generate_menu() - # self.refresh_menu() + self.refresh_menu() def on_package(self, cmd, args): def update_item_list(): @@ -394,7 +420,7 @@ def update_item_remove_commands(self): temp_commands += item_commands self.item_remove_commands = temp_commands - + def make_gui(self): from kvui import GameManager diff --git a/worlds/portal2/mod_helpers/Gels.py b/worlds/portal2/mod_helpers/Gels.py new file mode 100644 index 00000000000..eb4cbf9d1a1 --- /dev/null +++ b/worlds/portal2/mod_helpers/Gels.py @@ -0,0 +1,190 @@ +from dataclasses import dataclass +from ..Items import blue_gel, orange_gel, white_gel, ItemTag + +@dataclass +class GelData: + object_name: str + object_type: str + x: float + y: float + z: float + gel_item: str + +map_gel_table: dict[str, list[GelData]] = { + "sp_a3_bomb_flings": [ + GelData(object_name="paint_bomb_maker", object_type="point_template", x=-224.0, y=-64.0, z=656.0, gel_item=blue_gel), + ], + "sp_a3_crazy_box": [ + GelData(object_name="paint_bomb_template", object_type="point_template", x=2240.0, y=-896.0, z=656.0, gel_item=blue_gel), + GelData(object_name="paint_drip1", object_type="info_paint_sprayer", x=1716.0, y=-1772.0, z=714.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_bounce", object_type="info_paint_sprayer", x=1280.0, y=-1408.0, z=1776.0, gel_item=blue_gel), + ], + "sp_a3_end": [ + GelData(object_name="paint_trickle_blue_1", object_type="info_paint_sprayer", x=-288.0, y=640.0, z=-228.0, gel_item=blue_gel), + GelData(object_name="paint_trickle_orange_1", object_type="info_paint_sprayer", x=-2112.0, y=-224.0, z=-2614.0, gel_item=orange_gel), + GelData(object_name="paint_trickle_white_1", object_type="info_paint_sprayer", x=-1728.0, y=422.0, z=-2372.0, gel_item=white_gel), + GelData(object_name="paint_trickle_blue_2", object_type="info_paint_sprayer", x=-2624.0, y=192.0, z=-2080.0, gel_item=blue_gel), + GelData(object_name="paint_trickle_blue_2", object_type="info_paint_sprayer", x=-2224.0, y=192.0, z=-2080.0, gel_item=blue_gel), + GelData(object_name="paint_trickle_white_2", object_type="info_paint_sprayer", x=-136.0, y=256.0, z=-1728.0, gel_item=white_gel), + GelData(object_name="paint_duct_1", object_type="info_paint_sprayer", x=-872.0, y=359.0, z=-1088.0, gel_item=white_gel), + GelData(object_name="paint_duct_2", object_type="info_paint_sprayer", x=-872.0, y=359.0, z=-752.0, gel_item=white_gel), + GelData(object_name="paint_duct_3", object_type="info_paint_sprayer", x=-1306.0, y=358.0, z=-85.0, gel_item=white_gel), + GelData(object_name="paint_duct_4", object_type="info_paint_sprayer", x=-1583.0, y=357.0, z=181.0, gel_item=white_gel), + ], + "sp_a3_jump_intro": [ + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=160.0, y=528.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=32.0, y=528.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-96.0, y=528.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-224.0, y=528.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-352.0, y=528.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=160.0, y=688.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=32.0, y=688.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-96.0, y=688.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-224.0, y=688.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-352.0, y=688.0, z=-168.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-1632.0, y=1152.0, z=809.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-1568.0, y=1024.0, z=809.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-1632.0, y=960.0, z=809.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-1560.0, y=896.0, z=809.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-1696.0, y=896.0, z=809.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-864.0, y=1088.0, z=1072.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-832.0, y=1152.0, z=1072.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-960.0, y=1328.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-832.0, y=1328.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-704.0, y=1328.0, z=1332.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-576.0, y=1328.0, z=1280.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-448.0, y=1328.0, z=1280.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-320.0, y=1328.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-192.0, y=1328.0, z=1280.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-232.0, y=976.0, z=1296.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-320.0, y=976.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-448.0, y=976.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-576.0, y=976.0, z=1284.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-704.0, y=976.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-832.0, y=976.0, z=1312.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump_2", object_type="info_paint_sprayer", x=-960.0, y=976.0, z=1312.0, gel_item=blue_gel), + ], + "sp_a3_portal_intro": [ + GelData(object_name="pump_machine_white_sprayer", object_type="info_paint_sprayer", x=1908.0, y=1712.0, z=-1984.0, gel_item=white_gel), + GelData(object_name="pump_machine_blue_sprayer", object_type="info_paint_sprayer", x=1088.0, y=1712.0, z=-2068.0, gel_item=blue_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=952.0, y=1272.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1088.0, y=1280.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1184.0, y=1264.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1264.0, y=1277.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1344.0, y=1266.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1456.0, y=1283.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1568.0, y=1280.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1680.0, y=1282.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1760.0, y=1296.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1856.0, y=1287.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1936.0, y=1296.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=2016.0, y=1277.0, z=-1672.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1384.0, y=1244.0, z=-1728.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1462.0, y=1240.0, z=-1704.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1632.0, y=1244.0, z=-1712.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1844.0, y=1248.0, z=-1680.0, gel_item=orange_gel), + GelData(object_name="intermediate_chamber_paint_sprayers", object_type="info_paint_sprayer", x=1916.0, y=1244.0, z=-1712.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_1", object_type="info_paint_sprayer", x=32.0, y=99.0, z=144.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_2", object_type="info_paint_sprayer", x=287.0, y=192.0, z=292.0, gel_item=white_gel), + ], + "sp_a3_speed_flings": [ + GelData(object_name="paint_sprayer_speed", object_type="info_paint_sprayer", x=2560.0, y=-128.0, z=-152.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_bounce", object_type="info_paint_sprayer", x=2816.0, y=-128.0, z=320.0, gel_item=blue_gel), + ], + "sp_a3_speed_ramp": [ + GelData(object_name="paint_sprayer", object_type="info_paint_sprayer", x=576.0, y=0.0, z=704.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer", object_type="info_paint_sprayer", x=576.0, y=0.0, z=696.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_2", object_type="info_paint_sprayer", x=-1600.0, y=-896.0, z=960.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_3", object_type="info_paint_sprayer", x=-1600.0, y=-384.0, z=960.0, gel_item=blue_gel), + ], + "sp_a4_finale1": [ + GelData(object_name="paint_bomb_maker", object_type="point_template", x=-9936.0, y=-2208.0, z=794.0, gel_item=white_gel), + GelData(object_name="paint_bomb", object_type="prop_paint_bomb", x=-9936.0, y=-2208.0, z=826.0, gel_item=white_gel), + GelData(object_name="platform_sprayer", object_type="info_paint_sprayer", x=-8881.0, y=-2038.0, z=-214.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8928.0, y=-2016.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8944.0, y=-2048.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8928.0, y=-2080.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8896.0, y=-2096.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8896.0, y=-2000.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8896.0, y=-2048.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8864.0, y=-2016.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8848.0, y=-2048.0, z=-239.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_portal", object_type="info_paint_sprayer", x=-8864.0, y=-2080.0, z=-239.0, gel_item=white_gel), + ], + "sp_a4_finale2": [ + GelData(object_name="paint_sprayer_jump", object_type="info_paint_sprayer", x=-1710.0, y=-1226.0, z=-503.0, gel_item=blue_gel), + GelData(object_name="paint_sprayer_jump", object_type="info_paint_sprayer", x=-1710.0, y=-1202.0, z=-503.0, gel_item=blue_gel), + GelData(object_name="paint_trickle_blue", object_type="info_paint_sprayer", x=-1648.0, y=-1200.0, z=168.0, gel_item=blue_gel), + GelData(object_name="sprayer_broken_pipe", object_type="info_paint_sprayer", x=-1888.0, y=-1632.0, z=-455.0, gel_item=blue_gel), + GelData(object_name="sprayer_broken_pipe", object_type="info_paint_sprayer", x=-1844.0, y=-1612.0, z=-455.0, gel_item=blue_gel), + GelData(object_name="sprayer_broken_pipe", object_type="info_paint_sprayer", x=-1832.0, y=-1580.0, z=-455.0, gel_item=blue_gel), + GelData(object_name="sprayer_broken_pipe", object_type="info_paint_sprayer", x=-1832.0, y=-1504.0, z=-443.0, gel_item=blue_gel), + GelData(object_name="sprayer_broken_pipe", object_type="info_paint_sprayer", x=-1888.0, y=-1504.0, z=-443.0, gel_item=blue_gel), + GelData(object_name="bomb", object_type="prop_paint_bomb", x=-1440.0, y=-608.0, z=-497.0, gel_item=blue_gel), + GelData(object_name="trigger_to_drop", object_type="logic_relay", x=-1432.0, y=-608.0, z=-295.0, gel_item=blue_gel), + GelData(object_name="template_artillery_paint_bomb", object_type="point_template", x=-1440.0, y=-608.0, z=-119.0, gel_item=blue_gel), + GelData(object_name="artillery_paint_bomb", object_type="prop_paint_bomb", x=-1440.0, y=-608.0, z=-87.0, gel_item=blue_gel), + ], + "sp_a4_finale3": [ + GelData(object_name="practice_paint_sprayer", object_type="info_paint_sprayer", x=-128.0, y=-2872.0, z=288.0, gel_item=white_gel), + GelData(object_name="paint_sprayer_break", object_type="info_paint_sprayer", x=-960.0, y=27.0, z=-111.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_break", object_type="info_paint_sprayer", x=-985.0, y=61.0, z=-105.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer", object_type="info_paint_sprayer", x=-960.0, y=-56.0, z=-223.0, gel_item=orange_gel), + GelData(object_name="paint_sprayer_2", object_type="info_paint_sprayer", x=-960.0, y=113.0, z=-70.0, gel_item=orange_gel), + ], + "sp_a4_finale4": [ + GelData(object_name="toxin_paint_sprayer", object_type="info_paint_sprayer", x=882.0, y=256.0, z=192.0, gel_item=white_gel), + GelData(object_name="panel1_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=240.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel2_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=240.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel3_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=256.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel4_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=256.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel5_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=256.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel6_paint_sprayer", object_type="info_paint_sprayer", x=754.0, y=256.0, z=160.0, gel_item=white_gel), + GelData(object_name="panel7_paint_sprayer", object_type="info_paint_sprayer", x=722.0, y=256.0, z=160.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere1", object_type="paint_sphere", x=560.0, y=256.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere2", object_type="paint_sphere", x=288.0, y=256.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere3", object_type="paint_sphere", x=448.0, y=64.0, z=64.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere4", object_type="paint_sphere", x=432.0, y=528.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere5", object_type="paint_sphere", x=544.0, y=-160.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere6", object_type="paint_sphere", x=240.0, y=0.0, z=64.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere7", object_type="paint_sphere", x=384.0, y=800.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere8", object_type="paint_sphere", x=144.0, y=480.0, z=16.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere9", object_type="paint_sphere", x=0.0, y=256.0, z=8.0, gel_item=white_gel), + GelData(object_name="paint_white_event_sphere10", object_type="paint_sphere", x=128.0, y=800.0, z=16.0, gel_item=white_gel), + GelData(object_name="wall_panel1-paint_portal_sprayer", object_type="paint_sphere", x=0.0, y=-325.0, z=578.0, gel_item=white_gel), + GelData(object_name="wall_panel2-paint_portal_sprayer", object_type="paint_sphere", x=0.0, y=-403.0, z=443.0, gel_item=white_gel), + GelData(object_name="wall_panel3-paint_portal_sprayer", object_type="paint_sphere", x=-290.0, y=-247.0, z=578.0, gel_item=white_gel), # Wrong on SS + GelData(object_name="wall_panel11-paint_portal_sprayer", object_type="paint_sphere", x=-346.0, y=775.0, z=578.0, gel_item=white_gel), + GelData(object_name="wall_panel16-paint_portal_sprayer", object_type="paint_sphere", x=329.0, y=827.0, z=443.0, gel_item=white_gel), + GelData(object_name="wall_panel17-paint_portal_sprayer", object_type="paint_sphere", x=503.0, y=546.0, z=578.0, gel_item=white_gel), + GelData(object_name="wall_panel24-paint_portal_sprayer", object_type="paint_sphere", x=329.0, y=-315.0, z=443.0, gel_item=white_gel), + GelData(object_name="wall_panel26-paint_portal_sprayer", object_type="paint_sphere", x=728.0, y=-368.0, z=60.0, gel_item=white_gel), + GelData(object_name="paint_blue_event_sphere1", object_type="paint_sphere", x=-544.0, y=96.0, z=32.0, gel_item=blue_gel), + GelData(object_name="paint_blue_event_sphere2", object_type="paint_sphere", x=-544.0, y=288.0, z=32.0, gel_item=blue_gel), + GelData(object_name="paint_blue_event_sphere3", object_type="paint_sphere", x=-544.0, y=448.0, z=32.0, gel_item=blue_gel), # Wrong on SS + GelData(object_name="paint_blue_event_sphere4", object_type="paint_sphere", x=-288.0, y=192.0, z=32.0, gel_item=blue_gel), + GelData(object_name="paint_blue_event_sphere5", object_type="paint_sphere", x=240.0, y=144.0, z=24.0, gel_item=blue_gel), + GelData(object_name="paint_blue_sprayer", object_type="info_paint_sprayer", x=-544.0, y=-16.0, z=320.0, gel_item=blue_gel), + + # Cannot removed last 2 blobs from finale4 at the moment + GelData(object_name="pipe_bounce_paint_bomb_template1", object_type="point_template", x=-576.0, y=256.0, z=320.0, gel_item=blue_gel), # Doesn't work + # Above handles these two + # GelData(object_name="pipe_bounce_paint_bomb1", object_type="prop_paint_bomb", x=-544.0, y=256.0, z=352.0, gel_item=blue_gel), + # GelData(object_name="pipe_bounce_paint_bomb1", object_type="prop_paint_bomb", x=-544.0, y=256.0, z=288.0, gel_item=blue_gel), + GelData(object_name="paint_speed_sprayer", object_type="info_paint_sprayer", x=752.0, y=-368.0, z=184.0, gel_item=orange_gel), + GelData(object_name="paint_orange_sphere", object_type="paint_sphere", x=544.0, y=-360.0, z=32.0, gel_item=orange_gel), + GelData(object_name="paint_speed_bomb_maker", object_type="point_template", x=616.0, y=-368.0, z=336.0, gel_item=orange_gel), # Doesn't work + # Above handles this one + # GelData(object_name="paint_speed_bomb", object_type="prop_paint_bomb", x=616.0, y=-368.0, z=368.0, gel_item=orange_gel), + + GelData(object_name="paint_white_ending_sphere", object_type="paint_sphere", x=0.0, y=256.0, z=8.0, gel_item=white_gel), + ], + "sp_a4_jump_polarity": [ + GelData(object_name="antechamber-paint_meSilly", object_type="info_paint_sprayer", x=1742.0, y=-62.0, z=140.0, gel_item=white_gel), + GelData(object_name="antechamber-paint_meSilly", object_type="info_paint_sprayer", x=1902.0, y=65.0, z=188.0, gel_item=white_gel), + GelData(object_name="paint_sprayer", object_type="info_paint_sprayer", x=-576.0, y=-64.0, z=640.0, gel_item=blue_gel), + ], + "sp_a4_speed_tb_catch": [ + GelData(object_name="AutoInstance1-paint_sprayer", object_type="info_paint_sprayer", x=256.0, y=1376.0, z=552.0, gel_item=orange_gel), + ], +} diff --git a/worlds/portal2/mod_helpers/ItemHandling.py b/worlds/portal2/mod_helpers/ItemHandling.py index 54ced358cda..cfe17512b53 100644 --- a/worlds/portal2/mod_helpers/ItemHandling.py +++ b/worlds/portal2/mod_helpers/ItemHandling.py @@ -1,6 +1,8 @@ from dataclasses import dataclass from ..Items import * from ..ItemNames import motion_blur_trap, fizzle_portal_trap, butter_fingers_trap +from .Gels import * +from ..Locations import wheatley_monitor_table, LocationType # Constants DELETE_CUBE = ItemTag.CUBE | ItemTag.DELETE @@ -41,8 +43,7 @@ def handle_item(item_name: str) -> list[str]: else: return_commands.append(f'script DeleteEntity("{ent_name}")') - if ItemTag.GEL in item_tags: - return_commands.append("removeallpaint") + # No longer handle gel removal generically, now under map specific commands if ItemTag.WEAPON in item_tags: if item_name == portal_gun_1: # Removed Item for improved randomized levels (too many levels rely on this) @@ -53,10 +54,6 @@ def handle_item(item_name: str) -> list[str]: if DISABLE_PICKUP in item_tags: return_commands.append(f'script DisableEntityPickup("{ent_name}")') return_commands.append(f'script AttachHologramToEntity("{ent_name}", null, 0.66, 20, 2)') - - if ItemTag.ALTER in item_tags: - if item_name == "Fizzler": # Also removed as it would lock down most of the game, could be a trap though - return_commands.append(f'script CreateMurderFizzlers()') if ItemTag.CORE in item_tags: core_name = item_data.variant @@ -101,7 +98,7 @@ def handle_trap(trap_name: str) -> str: "sp_a4_finale3", "sp_a4_finale4"] -def handle_map_start(map_code: str, items_missing: list[str]) -> list[str]: +def handle_map_start(map_code: str, items_missing: list[str], wheatley_monitors_checked: list[str], ratman_dens_checked: list[str]) -> list[str]: commands: list[str] = [] if map_code in maps_with_potatos and potatos in items_missing: @@ -109,8 +106,18 @@ def handle_map_start(map_code: str, items_missing: list[str]) -> list[str]: for mc in map_specific_commands: if map_code == mc.map_code and (mc.condition_item == None or mc.condition_item in items_missing): - commands += mc.commands - + # For ratman den commands, check if pressed + if mc.type == LocationType.RATMAN_DEN and any(den in mc.commands[0] for den in ratman_dens_checked): + replacement_command = mc.commands[0].replace(")\n", ", 1)\n") + commands.append(replacement_command) + else: + commands += mc.commands + + # Mark wheatley monitors that have already been checked + map_names = [wheatley_monitor_table[monitor].map_name for monitor in wheatley_monitors_checked] + commands.append(f'script SetCheckedScreens(["{'", "'.join(map_names)}"])\n') + commands += ["script AddWheatleyMonitorBreakCheck()\n"] + return commands @@ -119,36 +126,48 @@ class MapCommand: map_code: str condition_item: str commands: list[str] + type: LocationType | None = None map_specific_commands: list[MapCommand] = [ MapCommand("sp_a4_finale4", potatos, ["script BlockWheatleyFight()\n"]), - MapCommand("sp_a2_laser_stairs", reflection_cube, ['script ppmod.addscript([Vector(-352, -288, -32), 1, "trigger_once"], "OnStartTouch", "DeleteEntity(\"models/props/reflection_cube.mdl\")", 0.5, 1)\n', - 'script ppmod.addscript("prop_button", "OnPressed", "DeleteEntity(\"models/props/reflection_cube.mdl\")", 0.5)\n']), + MapCommand("sp_a2_laser_stairs", reflection_cube, ['script ppmod.addscript([Vector(-352, -288, -32), 1, "trigger_once"], "OnStartTouch", "DeleteEntity(reflection_cube)", 0.5, 1)\n', + 'script ppmod.addscript("prop_button", "OnPressed", "DeleteEntity(reflection_cube)", 0.5)\n']), MapCommand("sp_a2_laser_relays", reflection_cube, ['script ppmod.get("laser_cube_spawner").Destroy()\n']), MapCommand("sp_a1_intro1", weighted_cube, ['script DeleteEntity("entity_box_maker_rm1")\n']), # Turret physics disable (sometimes cannot be at start of level due to spawning times) - MapCommand("sp_a2_turret_intro", turrets, [f'script DisableEntityPhysics("npc_portal_turret_floor")\n']), - MapCommand("sp_a2_bts2", turrets, ['script ppmod.addscript([Vector(1514, -3898, 64), 1, "trigger_once"], "OnStartTouch", "DisableEntityPhysics(\"npc_portal_turret_floor\")", 3, 1)\n']), - MapCommand("sp_a4_finale2", turrets, ['script ppmod.addscript([Vector(11835, 11776, 8543), 1, "trigger_once"], "OnStartTouch", "DisableEntityPhysics(\"npc_portal_turret_floor\")", 2.5, 1)\n']), + MapCommand("sp_a2_turret_intro", turrets, [f'script DisableEntityPhysics(turret)\n']), + MapCommand("sp_a2_bts2", turrets, ['script ppmod.addscript([Vector(1514, -3898, 64), 1, "trigger_once"], "OnStartTouch", "DisableEntityPhysics(turret)", 3, 1)\n']), + MapCommand("sp_a4_finale2", turrets, ['script ppmod.addscript([Vector(11835, 11776, 8543), 1, "trigger_once"], "OnStartTouch", "DisableEntityPhysics(turret)", 2.5, 1)\n']), ] +# map specific gel removal commands +for map, gels in map_gel_table.items(): + if map == "sp_a3_jump_intro": + map_specific_commands.append(MapCommand(map, blue_gel, ['removeallpaint\n'])) + + if map == "sp_a3_portal_intro": + map_specific_commands.append(MapCommand(map, orange_gel, ['removeallpaint\n'])) + + for gel_data in gels: + map_specific_commands.append(MapCommand(map, gel_data.gel_item, [f'script RemoveGel({gel_data.x}, {gel_data.y}, {gel_data.z}, "{gel_data.object_type}", "{gel_data.object_name}")\n'])) + def potatos_not_inplace(): global map_specific_commands map_specific_commands.append(MapCommand("sp_a3_transition01", potatos, ["script RemovePotatOS()\n"])) def portal_gun_upgrade_not_inplace(): global map_specific_commands - map_specific_commands.append(MapCommand("sp_a2_intro", portal_gun_2, ["scrupt InciniratorDisablePortalGun()\n"])) + map_specific_commands.append(MapCommand("sp_a2_intro", portal_gun_2, ["script InciniratorDisablePortalGun()\n"])) # Option based commands ratman_den_commands: list[MapCommand] = [ - MapCommand("sp_a1_intro4", None, ['script CreateAPButton("Ratman Den 1", Vector(847, -703, 320-65), Vector(0,-90,0), 0.8)\n']), - MapCommand("sp_a2_dual_lasers", None, ['script CreateAPButton("Ratman Den 2", Vector(438, -636, 827-65), Vector(0,135,0), 0.8)\n']), - MapCommand("sp_a2_trust_fling", None, ['script CreateAPButton("Ratman Den 3", Vector(2045, 82, 254-65), Vector(0,-135,0), 0.8)\n']), - MapCommand("sp_a2_bridge_intro", None, ['script CreateAPButton("Ratman Den 4", Vector(612, -618, 64-65), Vector(0,-135,0), 0.8)\n']), - MapCommand("sp_a2_bridge_the_gap", None, ['script CreateAPButton("Ratman Den 5", Vector(-128, -270, 1756-65), Vector(0,90,0), 0.8)\n']), - MapCommand("sp_a2_laser_vs_turret", None, ['script CreateAPButton("Ratman Den 6", Vector(850, -720, 222-65), Vector(0,180,0), 0.8)\n']), - MapCommand("sp_a2_pull_the_rug", None, ['script CreateAPButton("Ratman Den 7", Vector(63, -1158, 550-65), Vector(0,45,0), 0.8)\n']) + MapCommand("sp_a1_intro4", None, ['script CreateAPButton("Ratman Den 1", Vector(847, -703, 320-65), Vector(0,-90,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_dual_lasers", None, ['script CreateAPButton("Ratman Den 2", Vector(438, -636, 827-65), Vector(0,135,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_trust_fling", None, ['script CreateAPButton("Ratman Den 3", Vector(2045, 82, 254-65), Vector(0,-135,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_bridge_intro", None, ['script CreateAPButton("Ratman Den 4", Vector(612, -618, 64-65), Vector(0,-135,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_bridge_the_gap", None, ['script CreateAPButton("Ratman Den 5", Vector(-128, -270, 1756-65), Vector(0,90,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_laser_vs_turret", None, ['script CreateAPButton("Ratman Den 6", Vector(850, -720, 222-65), Vector(0,180,0), 0.8)\n'], LocationType.RATMAN_DEN), + MapCommand("sp_a2_pull_the_rug", None, ['script CreateAPButton("Ratman Den 7", Vector(63, -1158, 550-65), Vector(0,45,0), 0.8)\n'], LocationType.RATMAN_DEN) ] def add_ratman_commands(): diff --git a/worlds/portal2/mod_helpers/MapMenu.py b/worlds/portal2/mod_helpers/MapMenu.py index 9bbb1326f6e..30b845ab2ba 100644 --- a/worlds/portal2/mod_helpers/MapMenu.py +++ b/worlds/portal2/mod_helpers/MapMenu.py @@ -3,54 +3,62 @@ # Custom font for items items_shortened = { - portal_gun_1 : "û", - portal_gun_2 : "û", - potatos : "ù", - weighted_cube : "ç", - reflection_cube : "ì", - spherical_cube : "ë", - antique_cube : "é", - button : "ñ", - old_button : "ò", - floor_button : "æ", - old_floor_button : "è", - frankenturret : "ð", - paint : "¢", - laser : "í", - faith_plate : "õ", - funnel : "å", - bridge : "¿", - laser_relays : "ï", - laser_catcher : "î", - turrets : "ó", - adventure_core : "A.ô", - space_core : "S.ô", - fact_core : "F.ô", - - moon_dust : "¡", - lemon : "¡", - slice_of_cake : "¡", - - motion_blur_trap : "¥", - fizzle_portal_trap : "¥", - butter_fingers_trap : "¥", - cube_confetti_trap : "¥", - slippery_floor_trap : "¥" + portal_gun_1: "û", + portal_gun_2: "û", + potatos: "ù", + weighted_cube: "ç", + reflection_cube: "ì", + spherical_cube: "ë", + antique_cube: "é", + button: "ñ", + old_button: "ò", + floor_button: "æ", + old_floor_button: "è", + frankenturret: "ð", + paint: "¢", + blue_gel: "à", + orange_gel: "á", + white_gel: "â", + laser: "í", + faith_plate: "õ", + funnel: "å", + bridge: "¿", + laser_relays: "ï", + laser_catcher: "î", + turrets: "ó", + adventure_core: "A.ô", + space_core: "S.ô", + fact_core: "F.ô", + moon_dust: "¡", + lemon: "¡", + slice_of_cake: "¡", + motion_blur_trap: "¥", + fizzle_portal_trap: "¥", + butter_fingers_trap: "¥", + cube_confetti_trap: "¥", + slippery_floor_trap: "¥", } indicator_characters: dict[str, str] = { - "completed" : "✓", - "map": "M", - "wheatley" : "ÿ", - "ratman": "R", - portal_gun_1 : "ý", - portal_gun_2 : "þ", - potatos : "ù" + "completed": "✓", + "map": "ã", + "wheatley": "ÿ", + "ratman": "ø", + "vitrified_door": "¢", + portal_gun_1: "ý", + portal_gun_2: "þ", + potatos: "ù", +} + +access_icons: dict[str, str] = { + "playable": "═ ", + "unplayable": "║ ", } def items_to_shortened(items_list: list[str]) -> list[str]: return map(lambda x: items_shortened[x], items_list) + class MenuElement: def __init__(self, parent, name: str, title: str, subtitle: str = "", command: str = "", pic: str = ""): self.parent = parent @@ -59,61 +67,70 @@ def __init__(self, parent, name: str, title: str, subtitle: str = "", command: s self.subtitle = subtitle self.command = command self.pic = pic + self.info_text: str | None = None def __str__(self): return ( f' "{self.name}"\n' - ' {\n' + " {\n" f' "title" "{self.title}"\n' f' "subtitle" "{self.subtitle}"\n' f' "command" "{self.command}"\n' f' "pic" "{self.pic}"\n' - ' }\n' + " }\n" + self.generate_info_text() ) + def generate_info_text(self): + if self.info_text == None: + return "" + return f' "{self.name}_info"\n' " {\n" f' "title" "{self.info_text}"\n' " }\n" + class MapMenuElement(MenuElement): next_map: MenuElement = None completed: bool = False sub_location_completion: dict[str, bool] = {} - + def __init__(self, parent, chapter_number, map_number, title, map_code, location_id, required_items, pic): self.location_id = location_id self.required_items = required_items - self.sub_location_completion = get_sub_locations(title, parent.parent.has_wheatley_monitors, parent.parent.has_ratman_dens) - subtitle = " ".join(items_to_shortened(self.required_items)) - new_title = indicator_characters["map"] + parse_sub_locations(self.sub_location_completion) - # Pad title to 4 characters for alignment - new_title = new_title.ljust(4, "-") + title.removesuffix(" Completion") + self.sub_location_completion = get_sub_locations( + title, parent.parent.has_wheatley_monitors, parent.parent.has_ratman_dens, parent.parent.has_vitrified_doors + ) + subtitle = "".join(items_to_shortened(self.required_items)) + new_title = title.removesuffix(" Completion") super().__init__(parent, f"chapter {chapter_number}.{map_number}", new_title, subtitle, f"map {map_code}", pic) - + self.info_text = indicator_characters["map"] + parse_sub_locations(self.sub_location_completion) + def refresh_title(self, blocked: bool = False): + self.info_text = indicator_characters["completed"] if self.completed else indicator_characters["map"] + self.info_text += parse_sub_locations(self.sub_location_completion) + if blocked: - self.title = "~~~~" + self.title[4:] - return - - new_title = indicator_characters["completed"] if self.completed else indicator_characters["map"] - new_title += parse_sub_locations(self.sub_location_completion) - # Pad title to 4 characters for alignment - new_title = new_title.ljust(4, "-") + self.title[4:] - self.title = new_title + if access_icons["unplayable"] not in self.title: + self.title = access_icons["unplayable"] + self.title + elif access_icons["playable"] not in self.title: + self.title = self.title.strip(access_icons["unplayable"]) + self.title = access_icons["playable"] + self.title def get_string(self, previous_completed: bool): # Update required items new_required_items = [item for item in self.required_items if item in self.parent.parent.client.item_list] - + # Remake subtitle - self.subtitle = " ".join(items_to_shortened(new_required_items)) - + self.subtitle = "".join(items_to_shortened(new_required_items)) + text = super().__str__() if not (self.parent.parent.is_open_world or previous_completed): self.refresh_title(blocked=True) - text = super().__str__() text = text.replace("command", "command_deactivated") - if self.next_map: - return text + self.next_map.get_string(self.completed) else: - return text + self.refresh_title() + + if self.next_map: + text = text + self.next_map.get_string(self.completed) + + return text def complete_map(self, map_id: int) -> bool: if self.location_id == map_id: @@ -129,30 +146,35 @@ def complete_map(self, map_id: int) -> bool: return self.next_map.complete_map(map_id) else: return False - + def complete_sub_location_check(self, sub_location: str): if sub_location in self.sub_location_completion: self.sub_location_completion[sub_location] = True self.refresh_title() elif self.next_map: self.next_map.complete_sub_location_check(sub_location) - + def complete_check(self, location_id: int): if not self.complete_map(location_id): location_name = self.parent.parent.client.location_names.lookup_in_game(location_id) if "Complete" not in location_name: self.complete_sub_location_check(location_name) - + blank_map_element = lambda parent, chapter_number: MapMenuElement(parent, chapter_number, 0, "No Maps In This Chapter", "", -1, [], "") - -def get_sub_locations(location_name: str, has_wheatley_monitors: bool, has_ratman_dens: bool) -> dict[str, bool]: + +def get_sub_locations( + location_name: str, has_wheatley_monitors: bool, has_ratman_dens: bool, has_vitrified_doors: bool +) -> dict[str, bool]: sub_locations = sub_locations_in_maps.get(location_name, []) if not has_wheatley_monitors: sub_locations = [sub_location for sub_location in sub_locations if "Wheatley Monitor" not in sub_location] if not has_ratman_dens: sub_locations = [sub_location for sub_location in sub_locations if "Ratman Den" not in sub_location] + if not has_vitrified_doors: + sub_locations = [sub_location for sub_location in sub_locations if "Vitrified Door" not in sub_location] return {sub_location: False for sub_location in sub_locations} - + + def parse_sub_locations(sub_locations: dict[str, bool]) -> str: additional_indicators = "" for sub_location, is_completed in sub_locations.items(): @@ -161,15 +183,20 @@ def parse_sub_locations(sub_locations: dict[str, bool]) -> str: additional_indicators += indicator_characters["wheatley"] elif "Ratman Den" in sub_location: additional_indicators += indicator_characters["ratman"] + elif "Vitrified Door" in sub_location: + additional_indicators += indicator_characters["vitrified_door"] + # No in use atm but can add more indicators for other sub locations if wanted elif sub_location in indicator_characters: additional_indicators += indicator_characters[sub_location] else: additional_indicators += indicator_characters["completed"] - + return additional_indicators + class ChapterMenuElement(MenuElement): first_map: MapMenuElement = None + def __init__(self, parent, chapter_number: int, map_names: list[str]): super().__init__(parent, f"chapter{chapter_number}", f"Chapter {chapter_number}", pic=f"vgui/chapters/chapter{chapter_number}") if not map_names: @@ -179,7 +206,9 @@ def __init__(self, parent, chapter_number: int, map_names: list[str]): current_map: MapMenuElement = None for i, name in enumerate(map_names): location = all_locations_table[name] - next_map = MapMenuElement(self, chapter_number, i, name, location.map_name, location.id, location.required_items, self.pic) + next_map = MapMenuElement( + self, chapter_number, i, name, location.map_name, location.id, location.required_items, self.pic + ) if not self.first_map: self.first_map = next_map current_map = self.first_map @@ -216,7 +245,16 @@ def complete_check(self, location_id: int): class Menu: chapters: list[ChapterMenuElement] = [] - def __init__(self, chapter_dict: dict[int, list[str]], client, is_open_world: bool = False, logic_difficulty: int = 0, wheatley_monitors: bool = False, ratman_dens: bool = False): + def __init__( + self, + chapter_dict: dict[int, list[str]], + client, + is_open_world: bool = False, + logic_difficulty: int = 0, + wheatley_monitors: bool = False, + ratman_dens: bool = False, + vitrified_doors: bool = False, + ): # Update all_locations table to speedrun logic if logic_difficulty == 1: for map_location in speedrun_logic_table: @@ -225,28 +263,24 @@ def __init__(self, chapter_dict: dict[int, list[str]], client, is_open_world: bo self.is_open_world = is_open_world self.has_wheatley_monitors = wheatley_monitors self.has_ratman_dens = ratman_dens + self.has_vitrified_doors = vitrified_doors self.chapter_dict = chapter_dict - + def generate_menu(self): for chapter_number, map_names in self.chapter_dict.items(): self.chapters.append(ChapterMenuElement(self, chapter_number, map_names)) def __str__(self): - return ( - '"Extras"\n' - '{\n' - f'{"".join([str(map) for map in self.chapters])}' - '}\n' - ) + return '"Extras"\n' "{\n" f'{"".join([str(map) for map in self.chapters])}' "}\n" def complete_map(self, map_id: int): for chapter in self.chapters: chapter.complete_map(map_id) - + def complete_sub_location_check(self, sub_location: str): for chapter in self.chapters: chapter.complete_sub_location_check(sub_location) - + def complete_check(self, location_id: int): for chapter in self.chapters: chapter.complete_check(location_id) diff --git a/worlds/portal2/test/test_base_menu.py b/worlds/portal2/test/test_base_menu.py index 917d73a91ec..78dafaf737e 100644 --- a/worlds/portal2/test/test_base_menu.py +++ b/worlds/portal2/test/test_base_menu.py @@ -32,7 +32,6 @@ def test_menu_generation(self) -> None: menu.generate_menu() # Check menu is generated where the first map of each chapter says "command" and the rest say "command_deactivated" menu_string = str(menu) - print(menu_string) self.assertGreater(menu_string.count('"command_deactivated"'), 0) self.assertEqual(menu_string.count('"command"'), 18) @@ -40,6 +39,5 @@ def test_menu_no_maps(self) -> None: menu = Menu({1: [], 2: [], 3: []}, self.client) menu.generate_menu() menu_string = str(menu) - print(menu_string) # Check menu is generated where the first map of each chapter says "No Maps In This Chapter" self.assertEqual(menu_string.count("No Maps In This Chapter"), 3) \ No newline at end of file diff --git a/worlds/portal2/test/test_menu_additional_checks.py b/worlds/portal2/test/test_menu_additional_checks.py index a82339916ee..314f4ff1350 100644 --- a/worlds/portal2/test/test_menu_additional_checks.py +++ b/worlds/portal2/test/test_menu_additional_checks.py @@ -13,6 +13,7 @@ class AdditionalChecksMenuTests(Portal2TestBase): "wheatley_monitors": True, "ratman_dens": True, "cutscene_levels": True, + "vitrified_doors": True, } def setUp(self): @@ -28,17 +29,18 @@ def test_title_generation(self) -> None: slot_data = self.world.fill_slot_data() - menu = Menu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"]) + menu = Menu(slot_data["chapter_dict"], self.client, is_open_world=slot_data["game_mode"] == GameModeOption.OPEN_WORLD, logic_difficulty=slot_data["logic_difficulty"], wheatley_monitors=slot_data["wheatley_monitors"], ratman_dens=slot_data["ratman_dens"], vitrified_doors=slot_data["vitrified_doors"]) menu.generate_menu() menu_string = str(menu) # Find map that includes Wheatley Monitors in the title and check it is correct - self.assertTrue(f"M{indicator_characters["wheatley"]}{indicator_characters["wheatley"]}-Funnel Catch" in menu_string) - self.assertTrue(f"M{indicator_characters["wheatley"]}--Laser Platform" in menu_string) - self.assertTrue("MR--Laser Stairs" in menu_string) - self.assertTrue("M---" in menu_string) - self.assertTrue(f"M{indicator_characters[portal_gun_1]}--Portal Gun" in menu_string) - self.assertTrue(f"M{indicator_characters[portal_gun_2]}--Incinerator" in menu_string) - self.assertTrue(f"M{indicator_characters[potatos]}--PotatOS" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["wheatley"]}{indicator_characters["wheatley"]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["wheatley"]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["ratman"]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters["vitrified_door"]}{indicator_characters["vitrified_door"]}{indicator_characters["vitrified_door"]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[portal_gun_1]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[portal_gun_2]}" in menu_string) + self.assertTrue(f"{indicator_characters["map"]}{indicator_characters[potatos]}" in menu_string) def test_sub_location_completion(self) -> None: from Fill import distribute_items_restrictive @@ -54,9 +56,8 @@ def test_sub_location_completion(self) -> None: # Complete a map with a sub location and check the title updates menu.complete_map(slot_data["location_name_to_id"]["Portal Gun Completion"]) menu_string = str(menu) - self.assertTrue(f"✓{indicator_characters[portal_gun_1]}--Portal Gun" in menu_string) + self.assertTrue(f"✓{indicator_characters[portal_gun_1]}" in menu_string) menu.complete_sub_location_check(portal_gun_1) menu_string = str(menu) - self.assertTrue("✓✓--Portal Gun" in menu_string) - + self.assertTrue("✓✓" in menu_string) \ No newline at end of file