Files
dockipelago/worlds/stardew_valley/test/test_options/TestForcedOptions.py
agilbert1412 1de91fab67 Stardew Valley: 7.x.x - The Jojapocalypse Update (#5432)
Major Content update for Stardew Valley

### Features
- New BundleRandomization Value: Meme Bundles - Over 100 custom bundles, designed to be jokes, references, trolls, etc
- New Setting: Bundles Per Room modifier
- New Setting: Backpack Size
- New Setting: Secretsanity - Checks for triggering easter eggs and secrets
- New Setting: Moviesanity - Checks for watching movies and sharing snacks with Villagers
- New Setting: Eatsanity - Checks for eating items
- New Setting: Hatsanity - Checks for wearing Hats
- New Setting: Start Without - Allows you to select any combination of various "starting" items, that you will actually not start with. Notably, tools, backpack slots, Day5 unlocks, etc.
- New Setting: Allowed Filler Items - Allows you to customize the filler items you'll get
- New Setting: Endgame Locations - Checks for various expensive endgame tasks and purchases
- New Shipsanity value: Crops and Fish
- New Settings: Jojapocalypse and settings to customize it
- Bundle Plando: Replaced with BundleWhitelist and BundleBlacklist, for more customization freedom
- Added a couple of Host.yaml settings to help hosts allow or ban specific difficult settings that could cause problems if the people don't know what they are signing up for.

Plus a truckload of improvements on the mod side, not seen in this PR.

### Removed features
- Integration for Stardew Valley Expanded. It is simply disabled, the code is all still there, but I'm extremely tired of providing tech support for it, plus Stardew Valley 1.7 was announced and that will break it again, so I'm done. When a maintainer steps up, it can be re-enabled.
2026-02-15 18:02:21 +01:00

116 lines
6.3 KiB
Python

import itertools
import unittest
import Options as ap_options
from ...options import options
from ...options.forced_options import force_change_options_if_incompatible
from ...test.options.utils import fill_dataclass_with_default
class TestGoalsRequiringAllLocationsOverrideAccessibility(unittest.TestCase):
def test_given_goal_requiring_all_locations_when_generate_then_accessibility_is_forced_to_full(self):
"""There is a bug with the current victory condition of the perfection goal that can create unwinnable seeds if the accessibility is set to minimal and
the world gets flooded with progression items through plando. This will increase the amount of collected progression items pass the total amount
calculated for the world when creating the item pool. This will cause the victory condition to be met before all locations are collected, so some could
be left inaccessible, which in practice will make the seed unwinnable.
"""
for goal in [options.Goal.option_perfection, options.Goal.option_allsanity]:
for accessibility in ap_options.Accessibility.options.keys():
with self.subTest(f"Goal: {options.Goal.get_option_name(goal)} Accessibility: {accessibility}"):
world_options = fill_dataclass_with_default({
options.Goal: goal,
"accessibility": accessibility
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.accessibility.value, ap_options.Accessibility.option_full)
class TestGingerIslandRelatedGoalsOverrideGingerIslandExclusion(unittest.TestCase):
def test_given_island_related_goal_when_generate_then_override_exclude_ginger_island(self):
for goal in [options.Goal.option_greatest_walnut_hunter, options.Goal.option_perfection]:
for exclude_island in options.ExcludeGingerIsland.options:
with self.subTest(f"Goal: {options.Goal.get_option_name(goal)} Exclude Ginger Island: {exclude_island}"):
world_options = fill_dataclass_with_default({
options.Goal: goal,
options.ExcludeGingerIsland: exclude_island
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.exclude_ginger_island.value, options.ExcludeGingerIsland.option_false)
class TestGingerIslandExclusionOverridesWalnutsanity(unittest.TestCase):
def test_given_ginger_island_excluded_when_generate_then_walnutsanity_is_forced_disabled(self):
walnutsanity_options = options.Walnutsanity.valid_keys
for walnutsanity in (
walnutsanity
for r in range(len(walnutsanity_options) + 1)
for walnutsanity in itertools.combinations(walnutsanity_options, r)
):
with self.subTest(f"Walnutsanity: {walnutsanity}"):
world_options = fill_dataclass_with_default({
options.ExcludeGingerIsland: options.ExcludeGingerIsland.option_true,
options.Walnutsanity: walnutsanity
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.walnutsanity.value, options.Walnutsanity.preset_none)
def test_given_ginger_island_related_goal_and_ginger_island_excluded_when_generate_then_walnutsanity_is_not_changed(self):
for goal in [options.Goal.option_greatest_walnut_hunter, options.Goal.option_perfection]:
walnutsanity_options = options.Walnutsanity.valid_keys
for original_walnutsanity_choice in (
set(walnutsanity)
for r in range(len(walnutsanity_options) + 1)
for walnutsanity in itertools.combinations(walnutsanity_options, r)
):
with self.subTest(f"Goal: {options.Goal.get_option_name(goal)} Walnutsanity: {original_walnutsanity_choice}"):
world_options = fill_dataclass_with_default({
options.Goal: goal,
options.ExcludeGingerIsland: options.ExcludeGingerIsland.option_true,
options.Walnutsanity: original_walnutsanity_choice
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.walnutsanity.value, original_walnutsanity_choice)
class TestGingerIslandExclusionOverridesQisSpecialOrders(unittest.TestCase):
def test_given_ginger_island_excluded_when_generate_then_qis_special_orders_are_forced_disabled(self):
special_order_options = options.SpecialOrderLocations.options
for special_order in special_order_options.keys():
with self.subTest(f"Special order: {special_order}"):
world_options = fill_dataclass_with_default({
options.ExcludeGingerIsland: options.ExcludeGingerIsland.option_true,
options.SpecialOrderLocations: special_order
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.special_order_locations.value & options.SpecialOrderLocations.value_qi, 0)
def test_given_ginger_island_related_goal_and_ginger_island_excluded_when_generate_then_special_orders_is_not_changed(self):
for goal in [options.Goal.option_greatest_walnut_hunter, options.Goal.option_perfection]:
special_order_options = options.SpecialOrderLocations.options
for special_order, original_special_order_value in special_order_options.items():
with self.subTest(f"Special order: {special_order}"):
world_options = fill_dataclass_with_default({
options.Goal: goal,
options.ExcludeGingerIsland: options.ExcludeGingerIsland.option_true,
options.SpecialOrderLocations: special_order
})
force_change_options_if_incompatible(world_options, 1, "Tester")
self.assertEqual(world_options.special_order_locations.value, original_special_order_value)