From 0f1b16d640913196d42ba6ed324a54b5013ab058 Mon Sep 17 00:00:00 2001 From: Bryce Wilson Date: Wed, 8 May 2024 10:26:13 -0600 Subject: [PATCH] Pokemon Emerald: Change Lilycove access logic (#3277) * Pokemon Emerald: Change logical access to lilycove from east * Pokemon Emerald: Add tests --- .../pokemon_emerald/data/regions/routes.json | 2 +- worlds/pokemon_emerald/rules.py | 4 ++ .../test/test_accessibility.py | 39 +++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/worlds/pokemon_emerald/data/regions/routes.json b/worlds/pokemon_emerald/data/regions/routes.json index 5dad9fff12a2..94af91a49f4c 100644 --- a/worlds/pokemon_emerald/data/regions/routes.json +++ b/worlds/pokemon_emerald/data/regions/routes.json @@ -2475,7 +2475,7 @@ ], "events": [], "exits": [ - "REGION_LILYCOVE_CITY/MAIN", + "REGION_LILYCOVE_CITY/SEA", "REGION_MOSSDEEP_CITY/MAIN", "REGION_UNDERWATER_ROUTE124/BIG_AREA", "REGION_UNDERWATER_ROUTE124/SMALL_AREA_1", diff --git a/worlds/pokemon_emerald/rules.py b/worlds/pokemon_emerald/rules.py index 1c71da2e9292..f93441baeac1 100644 --- a/worlds/pokemon_emerald/rules.py +++ b/worlds/pokemon_emerald/rules.py @@ -994,6 +994,10 @@ def get_location(location: str): get_entrance("REGION_LILYCOVE_CITY/SEA -> REGION_ROUTE124/MAIN"), lambda state: state.has("EVENT_CLEAR_AQUA_HIDEOUT", world.player) ) + set_rule( + get_entrance("REGION_ROUTE124/MAIN -> REGION_LILYCOVE_CITY/SEA"), + lambda state: state.has("EVENT_CLEAR_AQUA_HIDEOUT", world.player) + ) # Magma Hideout set_rule( diff --git a/worlds/pokemon_emerald/test/test_accessibility.py b/worlds/pokemon_emerald/test/test_accessibility.py index b95b1ca32843..4fb1884684b9 100644 --- a/worlds/pokemon_emerald/test/test_accessibility.py +++ b/worlds/pokemon_emerald/test/test_accessibility.py @@ -77,6 +77,25 @@ def test_accessible_with_surf_only(self) -> None: self.assertTrue(self.can_reach_region("MAP_SLATEPORT_CITY_WATER_ENCOUNTERS")) +class TestModify118(PokemonEmeraldTestBase): + options = { + "modify_118": Toggle.option_true, + "bikes": Toggle.option_true, + "rods": Toggle.option_true + } + + def test_inaccessible_with_nothing(self) -> None: + self.assertFalse(self.can_reach_location(location_name_to_label("NPC_GIFT_RECEIVED_GOOD_ROD"))) + + def test_inaccessible_with_only_surf(self) -> None: + self.collect_by_name(["HM03 Surf", "Balance Badge"]) + self.assertFalse(self.can_reach_location(location_name_to_label("NPC_GIFT_RECEIVED_GOOD_ROD"))) + + def test_accessible_with_surf_and_acro_bike(self) -> None: + self.collect_by_name(["HM03 Surf", "Balance Badge", "Acro Bike"]) + self.assertTrue(self.can_reach_location(location_name_to_label("NPC_GIFT_RECEIVED_GOOD_ROD"))) + + class TestFreeFly(PokemonEmeraldTestBase): options = { "npc_gifts": Toggle.option_true, @@ -100,6 +119,26 @@ def test_sootopolis_gift_accessible_with_surf(self) -> None: self.assertTrue(self.can_reach_location(location_name_to_label("NPC_GIFT_RECEIVED_TM_BRICK_BREAK"))) +class TestLilycoveFromEast(PokemonEmeraldTestBase): + options = { + "modify_118": Toggle.option_true, + "bikes": Toggle.option_true, + "free_fly_location": Toggle.option_true + } + + def setUp(self) -> None: + super(PokemonEmeraldTestBase, self).setUp() + + # Swap free fly to Mossdeep + free_fly_location = self.multiworld.get_location("FREE_FLY_LOCATION", 1) + free_fly_location.item = None + free_fly_location.place_locked_item(self.multiworld.worlds[1].create_event("EVENT_VISITED_MOSSDEEP_CITY")) + + def test_lilycove_inaccessible_from_east(self) -> None: + self.collect_by_name(["HM03 Surf", "Balance Badge", "HM02 Fly", "Feather Badge"]) + self.assertFalse(self.can_reach_region("REGION_LILYCOVE_CITY/MAIN")) + + class TestFerry(PokemonEmeraldTestBase): options = { "npc_gifts": Toggle.option_true