2024-03-15 15:05:14 +03:00
|
|
|
from unittest import TestCase
|
|
|
|
|
Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
2024-07-07 16:04:25 +03:00
|
|
|
from BaseClasses import CollectionState, Location
|
|
|
|
from ...stardew_rule import StardewRule, false_, MISSING_ITEM, Reach
|
|
|
|
from ...stardew_rule.rule_explain import explain
|
2024-03-15 15:05:14 +03:00
|
|
|
|
|
|
|
|
|
|
|
class RuleAssertMixin(TestCase):
|
|
|
|
def assert_rule_true(self, rule: StardewRule, state: CollectionState):
|
Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
2024-07-07 16:04:25 +03:00
|
|
|
expl = explain(rule, state)
|
|
|
|
try:
|
|
|
|
self.assertTrue(rule(state), expl)
|
|
|
|
except KeyError as e:
|
|
|
|
raise AssertionError(f"Error while checking rule {rule}: {e}"
|
|
|
|
f"\nExplanation: {expl}")
|
2024-03-15 15:05:14 +03:00
|
|
|
|
|
|
|
def assert_rule_false(self, rule: StardewRule, state: CollectionState):
|
Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
2024-07-07 16:04:25 +03:00
|
|
|
expl = explain(rule, state, expected=False)
|
|
|
|
try:
|
|
|
|
self.assertFalse(rule(state), expl)
|
|
|
|
except KeyError as e:
|
|
|
|
raise AssertionError(f"Error while checking rule {rule}: {e}"
|
|
|
|
f"\nExplanation: {expl}")
|
2024-03-15 15:05:14 +03:00
|
|
|
|
|
|
|
def assert_rule_can_be_resolved(self, rule: StardewRule, complete_state: CollectionState):
|
Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
2024-07-07 16:04:25 +03:00
|
|
|
expl = explain(rule, complete_state)
|
|
|
|
try:
|
|
|
|
self.assertNotIn(MISSING_ITEM, repr(rule))
|
|
|
|
self.assertTrue(rule is false_ or rule(complete_state), expl)
|
|
|
|
except KeyError as e:
|
|
|
|
raise AssertionError(f"Error while checking rule {rule}: {e}"
|
|
|
|
f"\nExplanation: {expl}")
|
|
|
|
|
|
|
|
def assert_reach_location_true(self, location: Location, state: CollectionState):
|
|
|
|
expl = explain(Reach(location.name, "Location", 1), state)
|
|
|
|
try:
|
|
|
|
can_reach = location.can_reach(state)
|
|
|
|
self.assertTrue(can_reach, expl)
|
|
|
|
except KeyError as e:
|
|
|
|
raise AssertionError(f"Error while checking location {location.name}: {e}"
|
|
|
|
f"\nExplanation: {expl}")
|
|
|
|
|
|
|
|
def assert_reach_location_false(self, location: Location, state: CollectionState):
|
|
|
|
expl = explain(Reach(location.name, "Location", 1), state, expected=False)
|
|
|
|
try:
|
|
|
|
self.assertFalse(location.can_reach(state), expl)
|
|
|
|
except KeyError as e:
|
|
|
|
raise AssertionError(f"Error while checking location {location.name}: {e}"
|
|
|
|
f"\nExplanation: {expl}")
|