mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00

* create building data object and rename ItemSource to Source to be more generic # Conflicts: # worlds/stardew_valley/content/game_content.py # Conflicts: # worlds/stardew_valley/data/artisan.py # worlds/stardew_valley/data/game_item.py # worlds/stardew_valley/data/harvest.py # worlds/stardew_valley/data/shop.py * remove compound sources, replace by other requirements which already handle this usecase * add coops to content packs * add building progression in game features * add shippping bin to starting building; remove has_house * replace config check with feature * add other buildings in content packs * not passing * tests passes, unbelievable * use newly create methods more * use new assets to ease readability * self review * fix flake8 maybe * properly split rule for mapping cave systems * fix tractor garage name * self review * add upgrade_from to farm house buldings * don't override building name variable in logic * remove has_group from buildings * mark some items easy in grinding logic so blueprints buildings can be in more early spheres * move stuff around to maybe avoid future conflicts cuz I have like 10 PRs opened right now * remove price_multiplier, turns out it's unused during generation * disable shop source for mapping cave systems * bunch of code review changes * add petbowl and farmhouse to autobuilding * set min easy items to 300 * fix farm type
108 lines
4.5 KiB
Python
108 lines
4.5 KiB
Python
import typing
|
|
import unittest
|
|
from unittest import TestCase, SkipTest
|
|
|
|
from BaseClasses import MultiWorld
|
|
from . import setup_solo_multiworld
|
|
from .assertion import RuleAssertMixin
|
|
from .options.presets import allsanity_mods_6_x_x, minimal_locations_maximal_items
|
|
from .. import StardewValleyWorld
|
|
from ..data.bundle_data import all_bundle_items_except_money
|
|
from ..logic.logic import StardewLogic
|
|
from ..options import BundleRandomization
|
|
|
|
|
|
def collect_all(mw):
|
|
for item in mw.get_items():
|
|
mw.state.collect(item, prevent_sweep=True)
|
|
|
|
|
|
class LogicTestBase(RuleAssertMixin, TestCase):
|
|
options: typing.Dict[str, typing.Any] = {}
|
|
multiworld: MultiWorld
|
|
logic: StardewLogic
|
|
world: StardewValleyWorld
|
|
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
if cls is LogicTestBase:
|
|
raise SkipTest("Not running test on base class.")
|
|
|
|
def setUp(self) -> None:
|
|
self.multiworld = setup_solo_multiworld(self.options, _cache={})
|
|
collect_all(self.multiworld)
|
|
self.world = typing.cast(StardewValleyWorld, self.multiworld.worlds[1])
|
|
self.logic = self.world.logic
|
|
|
|
def test_given_bundle_item_then_is_available_in_logic(self):
|
|
for bundle_item in all_bundle_items_except_money:
|
|
if not bundle_item.can_appear(self.world.content, self.world.options):
|
|
continue
|
|
|
|
with self.subTest(msg=bundle_item.item_name):
|
|
self.assertIn(bundle_item.get_item(), self.logic.registry.item_rules)
|
|
|
|
def test_given_item_rule_then_can_be_resolved(self):
|
|
for item in self.logic.registry.item_rules.keys():
|
|
with self.subTest(msg=item):
|
|
rule = self.logic.registry.item_rules[item]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_building_rule_then_can_be_resolved(self):
|
|
for building in self.world.content.farm_buildings:
|
|
with self.subTest(msg=building):
|
|
rule = self.logic.building.can_build(building)
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_quest_rule_then_can_be_resolved(self):
|
|
for quest in self.logic.registry.quest_rules.keys():
|
|
with self.subTest(msg=quest):
|
|
rule = self.logic.registry.quest_rules[quest]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_special_order_rule_then_can_be_resolved(self):
|
|
for special_order in self.logic.registry.special_order_rules.keys():
|
|
with self.subTest(msg=special_order):
|
|
rule = self.logic.registry.special_order_rules[special_order]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_crop_rule_then_can_be_resolved(self):
|
|
for crop in self.logic.registry.crop_rules.keys():
|
|
with self.subTest(msg=crop):
|
|
rule = self.logic.registry.crop_rules[crop]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_fish_rule_then_can_be_resolved(self):
|
|
for fish in self.logic.registry.fish_rules.keys():
|
|
with self.subTest(msg=fish):
|
|
rule = self.logic.registry.fish_rules[fish]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_museum_rule_then_can_be_resolved(self):
|
|
for donation in self.logic.registry.museum_rules.keys():
|
|
with self.subTest(msg=donation):
|
|
rule = self.logic.registry.museum_rules[donation]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_cooking_rule_then_can_be_resolved(self):
|
|
for cooking_rule in self.logic.registry.cooking_rules.keys():
|
|
with self.subTest(msg=cooking_rule):
|
|
rule = self.logic.registry.cooking_rules[cooking_rule]
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
def test_given_location_rule_then_can_be_resolved(self):
|
|
for location in self.multiworld.get_locations(1):
|
|
with self.subTest(msg=location.name):
|
|
rule = location.access_rule
|
|
self.assert_rule_can_be_resolved(rule, self.multiworld.state)
|
|
|
|
|
|
class TestAllSanityLogic(LogicTestBase):
|
|
options = allsanity_mods_6_x_x()
|
|
|
|
|
|
@unittest.skip("This test does not pass because some content is still not in content packs.")
|
|
class TestMinLocationsMaxItemsLogic(LogicTestBase):
|
|
options = minimal_locations_maximal_items()
|
|
options[BundleRandomization.internal_name] = BundleRandomization.default
|