Files
Grinch-AP/worlds/messenger/test/TestShop.py
Aaron Wagener 332eab9569 The Messenger: Add Shop Rando (#1834)
* add shop shuffle options and items

* add logic for the shop slots

* write cost tests

* start on shop item logic

* make strike and second wind early items

* some cleanup

* remove 5 shards

* double cost requirement for really expensive items and raise the rates

* add test for shop shuffle with minimum other locations

* put power seal in front of shards

* rename locations and items

* update rules, regions, and shop

* update tests and misc fixes

* minor cleanup

* implement money wrench and figurines

* clean out now unneeded info from slot_data

* docs update and fix a failure when not shuffling shops

* remove shop shuffle option

* Finish out shop rules

* make seals generation easier to read and fix tests

* rule adjustments

* oop

* adjust the prices to be a bit more generous

* add max price to slot data for tracker

* update the hard rules a bit

* remove unnecessary test

* update data_version

* bump version and remove info for fixed issues

* remove now unneeded assert

* review updates

* minor bug fix

* add a test for minimum locations shop costing

* minor optimizations and cleanup

* remove whitespace
2023-06-28 01:39:52 +02:00

102 lines
3.7 KiB
Python

from typing import Dict
from . import MessengerTestBase
from ..Shop import SHOP_ITEMS, FIGURINES
class ShopCostTest(MessengerTestBase):
options = {
"shop_price": "random",
"shuffle_shards": "true",
}
def testShopRules(self) -> None:
for loc in SHOP_ITEMS:
loc = f"The Shop - {loc}"
with self.subTest("has cost", loc=loc):
self.assertFalse(self.can_reach_location(loc))
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.assertTrue(loc in SHOP_ITEMS)
self.assertEqual(len(prices), len(SHOP_ITEMS))
def testDBoost(self) -> None:
locations = [
"Riviere Turquoise Seal - Bounces and Balls",
"Forlorn Temple - Demon King", "Forlorn Temple Seal - Rocket Maze", "Forlorn Temple Seal - Rocket Sunset",
"Sunny Day Mega Shard", "Down Under Mega Shard",
]
items = [["Path of Resilience", "Meditation", "Second Wind"]]
self.assertAccessDependency(locations, items)
def testCurrents(self) -> None:
self.assertAccessDependency(["Elemental Skylands Seal - Water"], [["Currents Master"]])
def testStrike(self) -> None:
locations = [
"Glacial Peak Seal - Projectile Spike Pit", "Elemental Skylands Seal - Fire",
]
items = [["Strike of the Ninja"]]
self.assertAccessDependency(locations, items)
class ShopCostMinTest(ShopCostTest):
options = {
"shop_price": "random",
"shuffle_seals": "false",
}
def testDBoost(self) -> None:
pass
def testCurrents(self) -> None:
pass
def testStrike(self) -> None:
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},
},
}
def testCosts(self) -> None:
for loc in SHOP_ITEMS:
loc = f"The Shop - {loc}"
with self.subTest("has cost", loc=loc):
self.assertFalse(self.can_reach_location(loc))
prices = self.multiworld.worlds[self.player].shop_prices
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}"
self.assertEqual(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))
figures = self.multiworld.worlds[self.player].figurine_prices
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.assertEqual(price, self.multiworld.get_location(loc, self.player).cost())
self.assertTrue(loc in FIGURINES)
self.assertEqual(len(figures), len(FIGURINES))