Stardew valley: Add Trap Distribution setting (#4601)

Co-authored-by: Jouramie <16137441+Jouramie@users.noreply.github.com>
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
agilbert1412
2025-05-10 17:57:24 -04:00
committed by GitHub
parent 5f24da7e18
commit 8f71dac417
15 changed files with 426 additions and 209 deletions

View File

@@ -2,8 +2,8 @@ from typing import List
from BaseClasses import ItemClassification, Item
from . import SVTestBase
from .. import items, location_table, options
from ..items import Group, ItemData
from .. import location_table, options, items
from ..items import Group, ItemData, item_data
from ..locations import LocationTags
from ..options import Friendsanity, SpecialOrderLocations, Shipsanity, Chefsanity, SeasonRandomization, Craftsanity, ExcludeGingerIsland, SkillProgression, \
Booksanity, Walnutsanity
@@ -15,10 +15,10 @@ def get_all_permanent_progression_items() -> List[ItemData]:
"""
return [
item
for item in items.all_items
for item in item_data.all_items
if ItemClassification.progression in item.classification
if item.mod_name is None
if item.name not in {event.name for event in items.events}
if item.name not in {event.name for event in item_data.events}
if item.name not in {deprecated.name for deprecated in items.items_by_group[Group.DEPRECATED]}
if item.name not in {season.name for season in items.items_by_group[Group.SEASON]}
if item.name not in {weapon.name for weapon in items.items_by_group[Group.WEAPON]}
@@ -54,19 +54,19 @@ class TestBaseItemGeneration(SVTestBase):
def test_does_not_create_deprecated_items(self):
all_created_items = set(self.get_all_created_items())
for deprecated_item in items.items_by_group[items.Group.DEPRECATED]:
for deprecated_item in item_data.items_by_group[item_data.Group.DEPRECATED]:
with self.subTest(f"{deprecated_item.name}"):
self.assertNotIn(deprecated_item.name, all_created_items)
def test_does_not_create_more_than_one_maximum_one_items(self):
all_created_items = self.get_all_created_items()
for maximum_one_item in items.items_by_group[items.Group.MAXIMUM_ONE]:
for maximum_one_item in item_data.items_by_group[item_data.Group.MAXIMUM_ONE]:
with self.subTest(f"{maximum_one_item.name}"):
self.assertLessEqual(all_created_items.count(maximum_one_item.name), 1)
def test_does_not_create_or_create_two_of_exactly_two_items(self):
all_created_items = self.get_all_created_items()
for exactly_two_item in items.items_by_group[items.Group.AT_LEAST_TWO]:
for exactly_two_item in item_data.items_by_group[item_data.Group.AT_LEAST_TWO]:
with self.subTest(f"{exactly_two_item.name}"):
count = all_created_items.count(exactly_two_item.name)
self.assertTrue(count == 0 or count == 2)
@@ -102,19 +102,19 @@ class TestNoGingerIslandItemGeneration(SVTestBase):
def test_does_not_create_deprecated_items(self):
all_created_items = self.get_all_created_items()
for deprecated_item in items.items_by_group[items.Group.DEPRECATED]:
for deprecated_item in item_data.items_by_group[item_data.Group.DEPRECATED]:
with self.subTest(f"Deprecated item: {deprecated_item.name}"):
self.assertNotIn(deprecated_item.name, all_created_items)
def test_does_not_create_more_than_one_maximum_one_items(self):
all_created_items = self.get_all_created_items()
for maximum_one_item in items.items_by_group[items.Group.MAXIMUM_ONE]:
for maximum_one_item in item_data.items_by_group[item_data.Group.MAXIMUM_ONE]:
with self.subTest(f"{maximum_one_item.name}"):
self.assertLessEqual(all_created_items.count(maximum_one_item.name), 1)
def test_does_not_create_exactly_two_items(self):
all_created_items = self.get_all_created_items()
for exactly_two_item in items.items_by_group[items.Group.AT_LEAST_TWO]:
for exactly_two_item in item_data.items_by_group[item_data.Group.AT_LEAST_TWO]:
with self.subTest(f"{exactly_two_item.name}"):
count = all_created_items.count(exactly_two_item.name)
self.assertTrue(count == 0 or count == 2)