| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  | from typing import Dict | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-10 20:05:21 -05:00
										 |  |  | from BaseClasses import CollectionState | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  | from . import MessengerTestBase | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  | from ..shop import SHOP_ITEMS, FIGURINES | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ShopCostTest(MessengerTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         "shop_price": "random", | 
					
						
							|  |  |  |         "shuffle_shards": "true", | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_shop_rules(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         for loc in SHOP_ITEMS: | 
					
						
							|  |  |  |             loc = f"The Shop - {loc}" | 
					
						
							|  |  |  |             with self.subTest("has cost", loc=loc): | 
					
						
							|  |  |  |                 self.assertFalse(self.can_reach_location(loc)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_shop_prices(self) -> None: | 
					
						
							| 
									
										
										
										
											2024-02-15 16:49:52 -06:00
										 |  |  |         prices: Dict[str, int] = self.world.shop_prices | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         for loc, price in prices.items(): | 
					
						
							|  |  |  |             with self.subTest("prices", loc=loc): | 
					
						
							| 
									
										
										
										
											2023-07-24 19:41:20 -05:00
										 |  |  |                 self.assertLessEqual(price, self.multiworld.get_location(f"The Shop - {loc}", self.player).cost) | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |                 self.assertTrue(loc in SHOP_ITEMS) | 
					
						
							|  |  |  |         self.assertEqual(len(prices), len(SHOP_ITEMS)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ShopCostMinTest(ShopCostTest): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         "shop_price": "random", | 
					
						
							|  |  |  |         "shuffle_seals": "false", | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-07-24 19:41:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_shop_rules(self) -> None: | 
					
						
							| 
									
										
										
										
											2024-02-15 16:49:52 -06:00
										 |  |  |         if self.world.total_shards: | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |             super().test_shop_rules() | 
					
						
							| 
									
										
										
										
											2023-06-29 07:33:37 -05:00
										 |  |  |         else: | 
					
						
							|  |  |  |             for loc in SHOP_ITEMS: | 
					
						
							|  |  |  |                 loc = f"The Shop - {loc}" | 
					
						
							|  |  |  |                 with self.subTest("has cost", loc=loc): | 
					
						
							|  |  |  |                     self.assertTrue(self.can_reach_location(loc)) | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_dboost(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         pass | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_currents(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         pass | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_strike(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PlandoTest(MessengerTestBase): | 
					
						
							|  |  |  |     options = { | 
					
						
							|  |  |  |         "shop_price_plan": { | 
					
						
							|  |  |  |             "Karuta Plates": 50, | 
					
						
							|  |  |  |             "Serendipitous Bodies": {100: 1, 200: 1, 300: 1}, | 
					
						
							|  |  |  |             "Barmath'azel Figurine": 500, | 
					
						
							|  |  |  |             "Demon Hive Figurine": {100: 1, 200: 2, 300: 1}, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-10-08 07:33:39 -05:00
										 |  |  |     def test_costs(self) -> None: | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         for loc in SHOP_ITEMS: | 
					
						
							|  |  |  |             loc = f"The Shop - {loc}" | 
					
						
							|  |  |  |             with self.subTest("has cost", loc=loc): | 
					
						
							|  |  |  |                 self.assertFalse(self.can_reach_location(loc)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-15 16:49:52 -06:00
										 |  |  |         prices = self.world.shop_prices | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         for loc, price in prices.items(): | 
					
						
							|  |  |  |             with self.subTest("prices", loc=loc): | 
					
						
							|  |  |  |                 if loc == "Karuta Plates": | 
					
						
							|  |  |  |                     self.assertEqual(self.options["shop_price_plan"]["Karuta Plates"], price) | 
					
						
							|  |  |  |                 elif loc == "Serendipitous Bodies": | 
					
						
							|  |  |  |                     self.assertIn(price, self.options["shop_price_plan"]["Serendipitous Bodies"]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 loc = f"The Shop - {loc}" | 
					
						
							| 
									
										
										
										
											2023-07-24 19:41:20 -05:00
										 |  |  |                 self.assertLessEqual(price, self.multiworld.get_location(loc, self.player).cost) | 
					
						
							| 
									
										
										
										
											2024-11-27 03:28:00 +01:00
										 |  |  |                 self.assertTrue(loc.removeprefix("The Shop - ") in SHOP_ITEMS) | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         self.assertEqual(len(prices), len(SHOP_ITEMS)) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-15 16:49:52 -06:00
										 |  |  |         figures = self.world.figurine_prices | 
					
						
							| 
									
										
										
										
											2023-06-27 18:39:52 -05:00
										 |  |  |         for loc, price in figures.items(): | 
					
						
							|  |  |  |             with self.subTest("figure prices", loc=loc): | 
					
						
							|  |  |  |                 if loc == "Barmath'azel Figurine": | 
					
						
							|  |  |  |                     self.assertEqual(self.options["shop_price_plan"]["Barmath'azel Figurine"], price) | 
					
						
							|  |  |  |                 elif loc == "Demon Hive Figurine": | 
					
						
							|  |  |  |                     self.assertIn(price, self.options["shop_price_plan"]["Demon Hive Figurine"]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 self.assertTrue(loc in FIGURINES) | 
					
						
							|  |  |  |         self.assertEqual(len(figures), len(FIGURINES)) | 
					
						
							| 
									
										
										
										
											2024-10-10 20:05:21 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |         max_cost_state = CollectionState(self.multiworld) | 
					
						
							|  |  |  |         self.assertFalse(self.world.get_location("Money Wrench").can_reach(max_cost_state)) | 
					
						
							|  |  |  |         prog_shards = [] | 
					
						
							|  |  |  |         for item in self.multiworld.itempool: | 
					
						
							|  |  |  |             if "Time Shard " in item.name: | 
					
						
							|  |  |  |                 value = int(item.name.strip("Time Shard ()")) | 
					
						
							|  |  |  |                 if value >= 100: | 
					
						
							|  |  |  |                     prog_shards.append(item) | 
					
						
							|  |  |  |         for shard in prog_shards: | 
					
						
							|  |  |  |             max_cost_state.collect(shard, True) | 
					
						
							|  |  |  |         self.assertTrue(self.world.get_location("Money Wrench").can_reach(max_cost_state)) |