| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | from collections import Counter | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from . import SVTestBase | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from .. import options, HasProgressionPercent | 
					
						
							|  |  |  | from ..data.craftable_data import all_crafting_recipes_by_name | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | from ..locations import locations_by_tag, LocationTags, location_table | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..options import ToolProgression, BuildingProgression, ExcludeGingerIsland, Chefsanity, Craftsanity, Shipsanity, SeasonRandomization, Friendsanity, \ | 
					
						
							|  |  |  |     FriendsanityHeartSize, BundleRandomization, SkillProgression | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | from ..strings.entrance_names import Entrance | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  | from ..strings.region_names import Region | 
					
						
							| 
									
										
										
										
											2024-03-28 04:42:35 -04:00
										 |  |  | from ..strings.tool_names import Tool, ToolMaterial | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestProgressiveToolsLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         ToolProgression.internal_name: ToolProgression.option_progressive, | 
					
						
							|  |  |  |         SeasonRandomization.internal_name: SeasonRandomization.option_randomized, | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     def test_sturgeon(self): | 
					
						
							| 
									
										
										
										
											2023-11-02 00:41:20 -05:00
										 |  |  |         self.multiworld.state.prog_items = {1: Counter()} | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         sturgeon_rule = self.world.logic.has("Sturgeon") | 
					
						
							|  |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         summer = self.world.create_item("Summer") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(summer, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         fishing_rod = self.world.create_item("Progressive Fishing Rod") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(fishing_rod, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(fishing_rod, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         fishing_level = self.world.create_item("Fishing Level") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(fishing_level, event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.remove(summer) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         winter = self.world.create_item("Winter") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(winter, event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.remove(fishing_rod) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assert_rule_false(sturgeon_rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_old_master_cannoli(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.prog_items = {1: Counter()} | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Axe"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Axe"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Summer"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location("Old Master Cannoli") | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         fall = self.world.create_item("Fall") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(fall, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         tuesday = self.world.create_item("Traveling Merchant: Tuesday") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(tuesday, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         rare_seed = self.world.create_item("Rare Seed") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(rare_seed, event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.remove(fall) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(tuesday) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         green_house = self.world.create_item("Greenhouse") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(green_house, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         friday = self.world.create_item("Traveling Merchant: Friday") | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(friday, event=False) | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  |         self.assertTrue(self.multiworld.get_location("Old Master Cannoli", 1).access_rule(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.remove(green_house) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(friday) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestBundlesLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         BundleRandomization.internal_name: BundleRandomization.option_vanilla | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_vault_2500g_bundle(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("2,500g Bundle")(self.multiworld.state)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach_location("2,500g Bundle")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestBuildingLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_coop_blueprint(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach_location("Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_big_coop_blueprint(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         big_coop_blueprint_rule = self.world.logic.region.can_reach_location("Big Coop Blueprint") | 
					
						
							|  |  |  |         self.assertFalse(big_coop_blueprint_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assertFalse(big_coop_blueprint_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item("Can Construct Buildings"), event=True) | 
					
						
							|  |  |  |         self.assertFalse(big_coop_blueprint_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Coop"), event=False) | 
					
						
							|  |  |  |         self.assertTrue(big_coop_blueprint_rule(self.multiworld.state), | 
					
						
							|  |  |  |                         f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}") | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_deluxe_coop_blueprint(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Can Construct Buildings"), event=True) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Coop"), event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Coop"), event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_big_shed_blueprint(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         big_shed_rule = self.world.logic.region.can_reach_location("Big Shed Blueprint") | 
					
						
							|  |  |  |         self.assertFalse(big_shed_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assertFalse(big_shed_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Can Construct Buildings"), event=True) | 
					
						
							|  |  |  |         self.assertFalse(big_shed_rule(self.multiworld.state), | 
					
						
							|  |  |  |                          f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Shed"), event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(big_shed_rule(self.multiworld.state), | 
					
						
							|  |  |  |                         f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}") | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestArcadeMachinesLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         options.ArcadeMachineLocations.internal_name: options.ArcadeMachineLocations.option_full_shuffling, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_prairie_king(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         boots = self.world.create_item("JotPK: Progressive Boots") | 
					
						
							|  |  |  |         gun = self.world.create_item("JotPK: Progressive Gun") | 
					
						
							|  |  |  |         ammo = self.world.create_item("JotPK: Progressive Ammo") | 
					
						
							|  |  |  |         life = self.world.create_item("JotPK: Extra Life") | 
					
						
							|  |  |  |         drop = self.world.create_item("JotPK: Increased Drop Rate") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(boots) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(life, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(life) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(life, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(drop, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(life) | 
					
						
							|  |  |  |         self.remove(drop) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(boots, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(gun, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(ammo, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(life, event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(drop, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state)) | 
					
						
							|  |  |  |         self.assertTrue(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(boots) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(gun) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(ammo) | 
					
						
							|  |  |  |         self.remove(life) | 
					
						
							|  |  |  |         self.remove(drop) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestWeaponsLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         ToolProgression.internal_name: ToolProgression.option_progressive, | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         options.SkillProgression.internal_name: options.SkillProgression.option_progressive, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_mine(self): | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Pickaxe"), event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Pickaxe"), event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Pickaxe"), event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive Pickaxe"), event=True) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Combat Level")] * 10) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.collect([self.world.create_item("Mining Level")] * 10) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         self.collect([self.world.create_item("Progressive Mine Elevator")] * 24) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Bus Repair"), event=True) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Skull Key"), event=True) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.GiveItemAndCheckReachableMine("Progressive Sword", 1) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Dagger", 1) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Club", 1) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.GiveItemAndCheckReachableMine("Progressive Sword", 2) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Dagger", 2) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Club", 2) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.GiveItemAndCheckReachableMine("Progressive Sword", 3) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Dagger", 3) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Club", 3) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.GiveItemAndCheckReachableMine("Progressive Sword", 4) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Dagger", 4) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Club", 4) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.GiveItemAndCheckReachableMine("Progressive Sword", 5) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Dagger", 5) | 
					
						
							|  |  |  |         self.GiveItemAndCheckReachableMine("Progressive Club", 5) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def GiveItemAndCheckReachableMine(self, item_name: str, reachable_level: int): | 
					
						
							|  |  |  |         item = self.multiworld.create_item(item_name, self.player) | 
					
						
							|  |  |  |         self.multiworld.state.collect(item, event=True) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         rule = self.world.logic.mine.can_mine_in_the_mines_floor_1_40() | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         if reachable_level > 0: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         rule = self.world.logic.mine.can_mine_in_the_mines_floor_41_80() | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         if reachable_level > 1: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         rule = self.world.logic.mine.can_mine_in_the_mines_floor_81_120() | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         if reachable_level > 2: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         rule = self.world.logic.mine.can_mine_in_the_skull_cavern() | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         if reachable_level > 3: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         rule = self.world.logic.ability.can_mine_perfectly_in_the_skull_cavern() | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         if reachable_level > 4: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  |         else: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-04-10 19:44:59 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | class TestRecipeLearnLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							|  |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							|  |  |  |         options.Cooksanity.internal_name: options.Cooksanity.option_all, | 
					
						
							|  |  |  |         Chefsanity.internal_name: Chefsanity.option_none, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     def test_can_learn_qos_recipe(self): | 
					
						
							|  |  |  |         location = "Cook Radish Salad" | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location(location) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive House"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Radish Seeds"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Spring"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Summer"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("The Queen of Sauce"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestRecipeReceiveLogic(SVTestBase): | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							|  |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							|  |  |  |         options.Cooksanity.internal_name: options.Cooksanity.option_all, | 
					
						
							|  |  |  |         Chefsanity.internal_name: Chefsanity.option_all, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_learn_qos_recipe(self): | 
					
						
							|  |  |  |         location = "Cook Radish Salad" | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location(location) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive House"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Radish Seeds"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Summer"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         spring = self.world.create_item("Spring") | 
					
						
							|  |  |  |         qos = self.world.create_item("The Queen of Sauce") | 
					
						
							|  |  |  |         self.multiworld.state.collect(spring, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(qos, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  |         self.multiworld.state.remove(spring) | 
					
						
							|  |  |  |         self.multiworld.state.remove(qos) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Radish Salad Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_get_chefsanity_check_recipe(self): | 
					
						
							|  |  |  |         location = "Radish Salad Recipe" | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location(location) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Spring"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         seeds = self.world.create_item("Radish Seeds") | 
					
						
							|  |  |  |         summer = self.world.create_item("Summer") | 
					
						
							|  |  |  |         house = self.world.create_item("Progressive House") | 
					
						
							|  |  |  |         self.multiworld.state.collect(seeds, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(summer, event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(house, event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  |         self.multiworld.state.remove(seeds) | 
					
						
							|  |  |  |         self.multiworld.state.remove(summer) | 
					
						
							|  |  |  |         self.multiworld.state.remove(house) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("The Queen of Sauce"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestCraftsanityLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							| 
									
										
										
										
											2023-11-18 13:35:57 -05:00
										 |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         Craftsanity.internal_name: Craftsanity.option_all, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							| 
									
										
										
										
											2023-07-19 14:26:38 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     def test_can_craft_recipe(self): | 
					
						
							|  |  |  |         location = "Craft Marble Brazier" | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location(location) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Progressive Pickaxe")] * 4) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Progressive Fishing Rod")] * 4) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Progressive Sword")] * 4) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Progressive Mine Elevator")] * 24) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Mining Level")] * 10) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Combat Level")] * 10) | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Fishing Level")] * 10) | 
					
						
							|  |  |  |         self.collect_all_the_money() | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Marble Brazier Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_learn_crafting_recipe(self): | 
					
						
							|  |  |  |         location = "Marble Brazier Recipe" | 
					
						
							|  |  |  |         rule = self.world.logic.region.can_reach_location(location) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_craft_festival_recipe(self): | 
					
						
							|  |  |  |         recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Pumpkin Seeds"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Torch Recipe"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         rule = self.world.logic.crafting.can_craft(recipe) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Fall"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Jack-O-Lantern Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestCraftsanityWithFestivalsLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							|  |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							|  |  |  |         options.FestivalLocations.internal_name: options.FestivalLocations.option_easy, | 
					
						
							|  |  |  |         Craftsanity.internal_name: Craftsanity.option_all, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_craft_festival_recipe(self): | 
					
						
							|  |  |  |         recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Pumpkin Seeds"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Fall"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         rule = self.world.logic.crafting.can_craft(recipe) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Jack-O-Lantern Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Torch Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestNoCraftsanityLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							|  |  |  |         SeasonRandomization.internal_name: SeasonRandomization.option_progressive, | 
					
						
							|  |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							|  |  |  |         options.FestivalLocations.internal_name: options.FestivalLocations.option_disabled, | 
					
						
							|  |  |  |         Craftsanity.internal_name: Craftsanity.option_none, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_craft_recipe(self): | 
					
						
							|  |  |  |         recipe = all_crafting_recipes_by_name["Wood Floor"] | 
					
						
							|  |  |  |         rule = self.world.logic.crafting.can_craft(recipe) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_craft_festival_recipe(self): | 
					
						
							|  |  |  |         recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Pumpkin Seeds"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         rule = self.world.logic.crafting.can_craft(recipe) | 
					
						
							|  |  |  |         result = rule(self.multiworld.state) | 
					
						
							|  |  |  |         self.assertFalse(result) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.collect([self.world.create_item("Progressive Season")] * 2) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestNoCraftsanityWithFestivalsLogic(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive, | 
					
						
							|  |  |  |         options.Cropsanity.internal_name: options.Cropsanity.option_enabled, | 
					
						
							|  |  |  |         options.FestivalLocations.internal_name: options.FestivalLocations.option_easy, | 
					
						
							|  |  |  |         Craftsanity.internal_name: Craftsanity.option_none, | 
					
						
							|  |  |  |         ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_can_craft_festival_recipe(self): | 
					
						
							|  |  |  |         recipe = all_crafting_recipes_by_name["Jack-O-Lantern"] | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Pumpkin Seeds"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Fall"), event=False) | 
					
						
							|  |  |  |         self.collect_lots_of_money() | 
					
						
							|  |  |  |         rule = self.world.logic.crafting.can_craft(recipe) | 
					
						
							|  |  |  |         self.assert_rule_false(rule, self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Jack-O-Lantern Recipe"), event=False) | 
					
						
							|  |  |  |         self.assert_rule_true(rule, self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestDonationLogicAll(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         options.Museumsanity.internal_name: options.Museumsanity.option_all | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_cannot_make_any_donation_without_museum_access(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         railroad_item = "Railroad Boulder Removed" | 
					
						
							|  |  |  |         swap_museum_and_bathhouse(self.multiworld, self.player) | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, railroad_item) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestDonationLogicRandomized(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         options.Museumsanity.internal_name: options.Museumsanity.option_randomized | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_cannot_make_any_donation_without_museum_access(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         railroad_item = "Railroad Boulder Removed" | 
					
						
							|  |  |  |         swap_museum_and_bathhouse(self.multiworld, self.player) | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, railroad_item) | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         donation_locations = [location for location in self.get_real_locations() if | 
					
						
							|  |  |  |                               LocationTags.MUSEUM_DONATIONS in location_table[location.name].tags] | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in donation_locations: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in donation_locations: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestDonationLogicMilestones(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         options.Museumsanity.internal_name: options.Museumsanity.option_milestones | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_cannot_make_any_donation_without_museum_access(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         railroad_item = "Railroad Boulder Removed" | 
					
						
							|  |  |  |         swap_museum_and_bathhouse(self.multiworld, self.player) | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, railroad_item) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |         for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state)) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | def swap_museum_and_bathhouse(multiworld, player): | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  |     museum_region = multiworld.get_region(Region.museum, player) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     bathhouse_region = multiworld.get_region(Region.bathhouse_entrance, player) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  |     museum_entrance = multiworld.get_entrance(Entrance.town_to_museum, player) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     bathhouse_entrance = multiworld.get_entrance(Entrance.enter_bathhouse_entrance, player) | 
					
						
							|  |  |  |     museum_entrance.connect(bathhouse_region) | 
					
						
							|  |  |  |     bathhouse_entrance.connect(museum_region) | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-28 04:42:35 -04:00
										 |  |  | class TestToolVanillaRequiresBlacksmith(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         options.EntranceRandomization: options.EntranceRandomization.option_buildings, | 
					
						
							|  |  |  |         options.ToolProgression: options.ToolProgression.option_vanilla, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     seed = 4111845104987680262 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Seed is hardcoded to make sure the ER is a valid roll that actually lock the blacksmith behind the Railroad Boulder Removed. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_cannot_get_any_tool_without_blacksmith_access(self): | 
					
						
							|  |  |  |         railroad_item = "Railroad Boulder Removed" | 
					
						
							|  |  |  |         place_region_at_entrance(self.multiworld, self.player, Region.blacksmith, Entrance.enter_bathhouse_entrance) | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, railroad_item) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for tool in [Tool.pickaxe, Tool.axe, Tool.hoe, Tool.trash_can, Tool.watering_can]: | 
					
						
							|  |  |  |             for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]: | 
					
						
							|  |  |  |                 self.assert_rule_false(self.world.logic.tool.has_tool(tool, material), self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for tool in [Tool.pickaxe, Tool.axe, Tool.hoe, Tool.trash_can, Tool.watering_can]: | 
					
						
							|  |  |  |             for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]: | 
					
						
							|  |  |  |                 self.assert_rule_true(self.world.logic.tool.has_tool(tool, material), self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_cannot_get_fishing_rod_without_willy_access(self): | 
					
						
							|  |  |  |         railroad_item = "Railroad Boulder Removed" | 
					
						
							|  |  |  |         place_region_at_entrance(self.multiworld, self.player, Region.fish_shop, Entrance.enter_bathhouse_entrance) | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, railroad_item) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for fishing_rod_level in [3, 4]: | 
					
						
							|  |  |  |             self.assert_rule_false(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(railroad_item), event=False) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for fishing_rod_level in [3, 4]: | 
					
						
							|  |  |  |             self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def place_region_at_entrance(multiworld, player, region, entrance): | 
					
						
							|  |  |  |     region_to_place = multiworld.get_region(region, player) | 
					
						
							|  |  |  |     entrance_to_place_region = multiworld.get_entrance(entrance, player) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     entrance_to_switch = region_to_place.entrances[0] | 
					
						
							|  |  |  |     region_to_switch = entrance_to_place_region.connected_region | 
					
						
							|  |  |  |     entrance_to_switch.connect(region_to_switch) | 
					
						
							|  |  |  |     entrance_to_place_region.connect(region_to_place) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-16 10:18:50 -04:00
										 |  |  | def collect_all_except(multiworld, item_to_not_collect: str): | 
					
						
							|  |  |  |     for item in multiworld.get_items(): | 
					
						
							|  |  |  |         if item.name != item_to_not_collect: | 
					
						
							|  |  |  |             multiworld.state.collect(item) | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestFriendsanityDatingRules(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         SeasonRandomization.internal_name: SeasonRandomization.option_randomized_not_winter, | 
					
						
							|  |  |  |         Friendsanity.internal_name: Friendsanity.option_all_with_marriage, | 
					
						
							|  |  |  |         FriendsanityHeartSize.internal_name: 3 | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_earning_dating_heart_requires_dating(self): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         self.collect_all_the_money() | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Fall"), event=False) | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  |         self.multiworld.state.collect(self.world.create_item("Beach Bridge"), event=False) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item("Progressive House"), event=False) | 
					
						
							|  |  |  |         for i in range(3): | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Pickaxe"), event=False) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Weapon"), event=False) | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Axe"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Barn"), event=False) | 
					
						
							|  |  |  |         for i in range(10): | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Foraging Level"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Farming Level"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Mining Level"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Combat Level"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Mine Elevator"), event=False) | 
					
						
							|  |  |  |             self.multiworld.state.collect(self.world.create_item("Progressive Mine Elevator"), event=False) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         npc = "Abigail" | 
					
						
							|  |  |  |         heart_name = f"{npc} <3" | 
					
						
							|  |  |  |         step = 3 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.assert_can_reach_heart_up_to(npc, 3, step) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(heart_name), event=False) | 
					
						
							|  |  |  |         self.assert_can_reach_heart_up_to(npc, 6, step) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(heart_name), event=False) | 
					
						
							|  |  |  |         self.assert_can_reach_heart_up_to(npc, 8, step) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(heart_name), event=False) | 
					
						
							|  |  |  |         self.assert_can_reach_heart_up_to(npc, 10, step) | 
					
						
							|  |  |  |         self.multiworld.state.collect(self.world.create_item(heart_name), event=False) | 
					
						
							|  |  |  |         self.assert_can_reach_heart_up_to(npc, 14, step) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def assert_can_reach_heart_up_to(self, npc: str, max_reachable: int, step: int): | 
					
						
							|  |  |  |         prefix = "Friendsanity: " | 
					
						
							|  |  |  |         suffix = " <3" | 
					
						
							|  |  |  |         for i in range(1, max_reachable + 1): | 
					
						
							|  |  |  |             if i % step != 0 and i != 14: | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             location = f"{prefix}{npc} {i}{suffix}" | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             can_reach = self.world.logic.region.can_reach_location(location)(self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  |             self.assertTrue(can_reach, f"Should be able to earn relationship up to {i} hearts") | 
					
						
							|  |  |  |         for i in range(max_reachable + 1, 14 + 1): | 
					
						
							|  |  |  |             if i % step != 0 and i != 14: | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             location = f"{prefix}{npc} {i}{suffix}" | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             can_reach = self.world.logic.region.can_reach_location(location)(self.multiworld.state) | 
					
						
							| 
									
										
										
										
											2023-09-14 17:56:13 -04:00
										 |  |  |             self.assertFalse(can_reach, f"Should not be able to earn relationship up to {i} hearts") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityNone(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_none | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_no_shipsanity_locations(self): | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         for location in self.get_real_locations(): | 
					
						
							|  |  |  |             self.assertFalse("Shipsanity" in location.name) | 
					
						
							|  |  |  |             self.assertNotIn(LocationTags.SHIPSANITY, location_table[location.name].tags) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityCrops(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_crops | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_only_crop_shipsanity_locations(self): | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         for location in self.get_real_locations(): | 
					
						
							|  |  |  |             if LocationTags.SHIPSANITY in location_table[location.name].tags: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |                 self.assertIn(LocationTags.SHIPSANITY_CROP, location_table[location.name].tags) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityFish(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_fish | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_only_fish_shipsanity_locations(self): | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         for location in self.get_real_locations(): | 
					
						
							|  |  |  |             if LocationTags.SHIPSANITY in location_table[location.name].tags: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |                 self.assertIn(LocationTags.SHIPSANITY_FISH, location_table[location.name].tags) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityFullShipment(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_full_shipment | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_only_full_shipment_shipsanity_locations(self): | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         for location in self.get_real_locations(): | 
					
						
							|  |  |  |             if LocationTags.SHIPSANITY in location_table[location.name].tags: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |                 self.assertIn(LocationTags.SHIPSANITY_FULL_SHIPMENT, location_table[location.name].tags) | 
					
						
							|  |  |  |                 self.assertNotIn(LocationTags.SHIPSANITY_FISH, location_table[location.name].tags) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityFullShipmentWithFish(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_full_shipment_with_fish | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_only_full_shipment_and_fish_shipsanity_locations(self): | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         for location in self.get_real_locations(): | 
					
						
							|  |  |  |             if LocationTags.SHIPSANITY in location_table[location.name].tags: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |                 self.assertTrue(LocationTags.SHIPSANITY_FULL_SHIPMENT in location_table[location.name].tags or | 
					
						
							|  |  |  |                                 LocationTags.SHIPSANITY_FISH in location_table[location.name].tags) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestShipsanityEverything(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         Shipsanity.internal_name: Shipsanity.option_everything, | 
					
						
							|  |  |  |         BuildingProgression.internal_name: BuildingProgression.option_progressive | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_all_shipsanity_locations_require_shipping_bin(self): | 
					
						
							|  |  |  |         bin_name = "Shipping Bin" | 
					
						
							|  |  |  |         collect_all_except(self.multiworld, bin_name) | 
					
						
							| 
									
										
										
										
											2024-04-14 13:37:48 -05:00
										 |  |  |         shipsanity_locations = [location for location in self.get_real_locations() if | 
					
						
							|  |  |  |                                 LocationTags.SHIPSANITY in location_table[location.name].tags] | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         bin_item = self.world.create_item(bin_name) | 
					
						
							|  |  |  |         for location in shipsanity_locations: | 
					
						
							|  |  |  |             with self.subTest(location.name): | 
					
						
							|  |  |  |                 self.remove(bin_item) | 
					
						
							|  |  |  |                 self.assertFalse(self.world.logic.region.can_reach_location(location.name)(self.multiworld.state)) | 
					
						
							|  |  |  |                 self.multiworld.state.collect(bin_item, event=False) | 
					
						
							|  |  |  |                 shipsanity_rule = self.world.logic.region.can_reach_location(location.name) | 
					
						
							|  |  |  |                 self.assert_rule_true(shipsanity_rule, self.multiworld.state) | 
					
						
							|  |  |  |                 self.remove(bin_item) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class TestVanillaSkillLogicSimplification(SVTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         SkillProgression.internal_name: SkillProgression.option_vanilla, | 
					
						
							|  |  |  |         ToolProgression.internal_name: ToolProgression.option_progressive, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_skill_logic_has_level_only_uses_one_has_progression_percent(self): | 
					
						
							|  |  |  |         rule = self.multiworld.worlds[1].logic.skill.has_level("Farming", 8) | 
					
						
							|  |  |  |         self.assertEqual(1, sum(1 for i in rule.current_rules if type(i) == HasProgressionPercent)) |