Files
Archipelago/worlds/stardew_valley/test/TestNumberLocations.py
agilbert1412 36bab6f52a Stardew Valley: 0.6.7 Day 1 fixes (#6098)
- The Shane and Sebastian Portrait filler items werent tagged properly.
- The Beach Farm adds one secretsanity check, so it needs to be in the allsanity preset
- The Allsanity preset is renamed to "Maxsanity" to encourage better defined terminology and Allsanity means something else
- The "All Random" preset has been removed entirely. It has been the cause of too many beginner footguns over the years. People can still achieve the effect manually, but at least they'll have to try a little bit to ruin their own experience.
2026-04-07 21:38:04 +02:00

109 lines
4.9 KiB
Python

from BaseClasses import ItemClassification
from .bases import SVTestBase
from .options.presets import default_7_x_x, maxsanity_no_mods_7_x_x, get_minsanity_options, \
minimal_locations_maximal_items, minimal_locations_maximal_items_with_island, maxsanity_mods_7_x_x_exclude_disabled
from .. import location_table
from ..items import Group, item_table
from ..items.item_data import FILLER_GROUPS
def get_real_item_count(multiworld):
number_items = len([item for item in multiworld.itempool
if all(filler_group not in item_table[item.name].groups for filler_group in FILLER_GROUPS) and Group.TRAP not in item_table[
item.name].groups and (item.classification & ItemClassification.progression)])
return number_items
class TestLocationGeneration(SVTestBase):
def test_all_location_created_are_in_location_table(self):
for location in self.get_real_locations():
self.assertIn(location.name, location_table)
class TestMinLocationAndMaxItem(SVTestBase):
options = minimal_locations_maximal_items()
def test_minimal_location_maximal_items_still_valid(self):
valid_locations = self.get_real_locations()
number_locations = len(valid_locations)
number_items = get_real_item_count(self.multiworld)
print(f"Stardew Valley - Minimum Locations: {number_locations}, Maximum Items: {number_items} [ISLAND EXCLUDED]")
self.assertGreaterEqual(number_locations, number_items)
class TestMinLocationAndMaxItemWithIsland(SVTestBase):
options = minimal_locations_maximal_items_with_island()
def test_minimal_location_maximal_items_with_island_still_valid(self):
valid_locations = self.get_real_locations()
number_locations = len(valid_locations)
number_items = get_real_item_count(self.multiworld)
print(f"Stardew Valley - Minimum Locations: {number_locations}, Maximum Items: {number_items} [ISLAND INCLUDED]")
self.assertGreaterEqual(number_locations, number_items)
class TestMinSanityHasAllExpectedLocations(SVTestBase):
options = get_minsanity_options()
def test_minsanity_has_few_locations(self):
fewest_allowed_locations = 90
real_locations = self.get_real_locations()
number_locations = len(real_locations)
print(f"Stardew Valley - Minsanity Locations: {number_locations}")
self.assertGreaterEqual(number_locations, fewest_allowed_locations)
if number_locations < fewest_allowed_locations:
print(f"\tMinsanity too many locations detected"
f"\n\tPlease update test_minsanity_has_fewer_than_locations"
f"\n\t\tMinimum: {fewest_allowed_locations}"
f"\n\t\tActual: {number_locations}")
class TestDefaultSettingsHasAllExpectedLocations(SVTestBase):
options = default_7_x_x()
def test_default_settings_has_exactly_locations(self):
expected_locations = 471
real_locations = self.get_real_locations()
number_locations = len(real_locations)
print(f"Stardew Valley - Default options locations: {number_locations}")
if number_locations != expected_locations:
print(f"\tNew locations detected!"
f"\n\tPlease update test_default_settings_has_exactly_locations"
f"\n\t\tExpected: {expected_locations}"
f"\n\t\tActual: {number_locations}")
class TestAllSanitySettingsHasAllExpectedLocations(SVTestBase):
options = maxsanity_no_mods_7_x_x()
def test_maxsanity_without_mods_has_at_least_locations(self):
expected_locations = 2812
real_locations = self.get_real_locations()
number_locations = len(real_locations)
print(f"Stardew Valley - Maxsanity Locations without mods: {number_locations}")
self.assertGreaterEqual(number_locations, expected_locations)
if number_locations != expected_locations:
print(f"\tNew locations detected!"
f"\n\tPlease update test_maxsanity_without_mods_has_at_least_locations"
f"\n\t\tExpected: {expected_locations}"
f"\n\t\tActual: {number_locations}")
class TestAllSanityWithModsSettingsHasAllExpectedLocations(SVTestBase):
options = maxsanity_mods_7_x_x_exclude_disabled()
def test_maxsanity_with_mods_has_at_least_locations(self):
expected_locations = 3180 # It was 3473 before disabling SVE
real_locations = self.get_real_locations()
number_locations = len(real_locations)
print(f"Stardew Valley - Maxsanity Locations with all mods: {number_locations}")
self.assertGreaterEqual(number_locations, expected_locations)
if number_locations != expected_locations:
print(f"\tNew locations detected!"
f"\n\tPlease update test_maxsanity_with_mods_has_at_least_locations"
f"\n\t\tExpected: {expected_locations}"
f"\n\t\tActual: {number_locations}")