The Messenger: Improve the shopping experience (#2029)

* The Messenger: Don't generate Figurines

* The Messenger: add prerequisite shop cost requirements

* The Messenger: don't double the cost anymore

* The Messenger: remove centered mind prereq instead of checking for it

* The Messenger: use cost as a property to cache it and gain back speed

* The Messenger: hardcode the prereqs for more speed

* make the linter and mypy happier

* use cached_property
This commit is contained in:
Aaron Wagener
2023-07-25 02:41:20 +02:00
committed by GitHub
parent 6a96f33ad2
commit f2d0d1e895
5 changed files with 78 additions and 56 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ class ShopCostTest(MessengerTestBase):
prices: Dict[str, int] = self.multiworld.worlds[self.player].shop_prices
for loc, price in prices.items():
with self.subTest("prices", loc=loc):
self.assertEqual(price, self.multiworld.get_location(f"The Shop - {loc}", self.player).cost())
self.assertLessEqual(price, self.multiworld.get_location(f"The Shop - {loc}", self.player).cost)
self.assertTrue(loc in SHOP_ITEMS)
self.assertEqual(len(prices), len(SHOP_ITEMS))
@@ -49,7 +49,7 @@ class ShopCostMinTest(ShopCostTest):
"shop_price": "random",
"shuffle_seals": "false",
}
def testShopRules(self) -> None:
if self.multiworld.worlds[self.player].total_shards:
super().testShopRules()
@@ -94,7 +94,7 @@ class PlandoTest(MessengerTestBase):
self.assertIn(price, self.options["shop_price_plan"]["Serendipitous Bodies"])
loc = f"The Shop - {loc}"
self.assertEqual(price, self.multiworld.get_location(loc, self.player).cost())
self.assertLessEqual(price, self.multiworld.get_location(loc, self.player).cost)
self.assertTrue(loc.replace("The Shop - ", "") in SHOP_ITEMS)
self.assertEqual(len(prices), len(SHOP_ITEMS))
@@ -106,6 +106,6 @@ class PlandoTest(MessengerTestBase):
elif loc == "Demon Hive Figurine":
self.assertIn(price, self.options["shop_price_plan"]["Demon Hive Figurine"])
self.assertEqual(price, self.multiworld.get_location(loc, self.player).cost())
self.assertLessEqual(price, self.multiworld.get_location(loc, self.player).cost)
self.assertTrue(loc in FIGURINES)
self.assertEqual(len(figures), len(FIGURINES))
+8 -5
View File
@@ -44,7 +44,8 @@ class HalfSealsRequired(MessengerTestBase):
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 45)
self.assertEqual(self.multiworld.worlds[self.player].required_seals, 22)
total_seals = [seal for seal in self.multiworld.itempool if seal.name == "Power Seal"]
required_seals = [seal for seal in total_seals if seal.classification == ItemClassification.progression_skip_balancing]
required_seals = [seal for seal in total_seals
if seal.classification == ItemClassification.progression_skip_balancing]
self.assertEqual(len(total_seals), 45)
self.assertEqual(len(required_seals), 22)
@@ -62,7 +63,8 @@ class ThirtyThirtySeals(MessengerTestBase):
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 30)
self.assertEqual(self.multiworld.worlds[self.player].required_seals, 10)
total_seals = [seal for seal in self.multiworld.itempool if seal.name == "Power Seal"]
required_seals = [seal for seal in total_seals if seal.classification == ItemClassification.progression_skip_balancing]
required_seals = [seal for seal in total_seals
if seal.classification == ItemClassification.progression_skip_balancing]
self.assertEqual(len(total_seals), 30)
self.assertEqual(len(required_seals), 10)
@@ -74,9 +76,9 @@ class MaxSealsNoShards(MessengerTestBase):
}
def testSealsAmount(self) -> None:
"""Should set total seals to 57 since shards aren't shuffled."""
"""Should set total seals to 70 since shards aren't shuffled."""
self.assertEqual(self.multiworld.total_seals[self.player], 85)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 57)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 70)
class MaxSealsWithShards(MessengerTestBase):
@@ -92,6 +94,7 @@ class MaxSealsWithShards(MessengerTestBase):
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 85)
self.assertEqual(self.multiworld.worlds[self.player].required_seals, 85)
total_seals = [seal for seal in self.multiworld.itempool if seal.name == "Power Seal"]
required_seals = [seal for seal in total_seals if seal.classification == ItemClassification.progression_skip_balancing]
required_seals = [seal for seal in total_seals
if seal.classification == ItemClassification.progression_skip_balancing]
self.assertEqual(len(total_seals), 85)
self.assertEqual(len(required_seals), 85)