Stardew Valley: 5.x.x - The Allsanity Update (#2764)

Major Content update for Stardew Valley, including the following features

- Major performance improvements all across the Stardew Valley apworld, including a significant reduction in the test time
- Randomized Farm Type
- Bundles rework (Remixed Bundles and Missing Bundle!)
- New Settings:
  * Shipsanity - Shipping individual items
  * Monstersanity - Slaying monsters
  * Cooksanity - Cooking individual recipes
  * Chefsanity - Learning individual recipes
  * Craftsanity - Crafting individual items
- New Goals:
  * Protector of the Valley - Complete every monster slayer goal
  * Full Shipment - Ship every item
  * Craftmaster - Craft every item
  * Gourmet Chef - Cook every recipe
  * Legend - Earn 10 000 000g
  * Mystery of the Stardrops - Find every stardrop (Maguffin Hunt)
  * Allsanity - Complete every check in your slot
- Building Shuffle: Cheaper options
- Tool Shuffle: Cheaper options
- Money rework
- New traps
- New isolated checks and items, including the farm cave, the movie theater, etc
- Mod Support: SVE [Albrekka]
- Mod Support: Distant Lands [Albrekka]
- Mod Support: Hat Mouse Lacey [Albrekka]
- Mod Support: Boarding House [Albrekka]

Co-authored-by: Witchybun <elnendil@gmail.com>
Co-authored-by: Witchybun <96719127+Witchybun@users.noreply.github.com>
Co-authored-by: Jouramie <jouramie@hotmail.com>
Co-authored-by: Alchav <59858495+Alchav@users.noreply.github.com>
This commit is contained in:
agilbert1412
2024-03-15 15:05:14 +03:00
committed by GitHub
parent f7da833572
commit 52e65e208e
177 changed files with 17815 additions and 6863 deletions

View File

@@ -0,0 +1,5 @@
from .goal_assert import *
from .mod_assert import *
from .option_assert import *
from .rule_assert import *
from .world_assert import *

View File

@@ -0,0 +1,55 @@
from unittest import TestCase
from BaseClasses import MultiWorld
from .option_assert import get_stardew_options
from ... import options, ExcludeGingerIsland
def is_goal(multiworld: MultiWorld, goal: int) -> bool:
return get_stardew_options(multiworld).goal.value == goal
def is_bottom_mines(multiworld: MultiWorld) -> bool:
return is_goal(multiworld, options.Goal.option_bottom_of_the_mines)
def is_not_bottom_mines(multiworld: MultiWorld) -> bool:
return not is_bottom_mines(multiworld)
def is_walnut_hunter(multiworld: MultiWorld) -> bool:
return is_goal(multiworld, options.Goal.option_greatest_walnut_hunter)
def is_not_walnut_hunter(multiworld: MultiWorld) -> bool:
return not is_walnut_hunter(multiworld)
def is_perfection(multiworld: MultiWorld) -> bool:
return is_goal(multiworld, options.Goal.option_perfection)
def is_not_perfection(multiworld: MultiWorld) -> bool:
return not is_perfection(multiworld)
class GoalAssertMixin(TestCase):
def assert_ginger_island_is_included(self, multiworld: MultiWorld):
self.assertEqual(get_stardew_options(multiworld).exclude_ginger_island, ExcludeGingerIsland.option_false)
def assert_walnut_hunter_world_is_valid(self, multiworld: MultiWorld):
if is_not_walnut_hunter(multiworld):
return
self.assert_ginger_island_is_included(multiworld)
def assert_perfection_world_is_valid(self, multiworld: MultiWorld):
if is_not_perfection(multiworld):
return
self.assert_ginger_island_is_included(multiworld)
def assert_goal_world_is_valid(self, multiworld: MultiWorld):
self.assert_walnut_hunter_world_is_valid(multiworld)
self.assert_perfection_world_is_valid(multiworld)

View File

@@ -0,0 +1,26 @@
from typing import Union, List
from unittest import TestCase
from BaseClasses import MultiWorld
from ... import item_table, location_table
from ...mods.mod_data import ModNames
class ModAssertMixin(TestCase):
def assert_stray_mod_items(self, chosen_mods: Union[List[str], str], multiworld: MultiWorld):
if isinstance(chosen_mods, str):
chosen_mods = [chosen_mods]
if ModNames.jasper in chosen_mods:
# Jasper is a weird case because it shares NPC w/ SVE...
chosen_mods.append(ModNames.sve)
for multiworld_item in multiworld.get_items():
item = item_table[multiworld_item.name]
self.assertTrue(item.mod_name is None or item.mod_name in chosen_mods,
f"Item {item.name} has is from mod {item.mod_name}. Allowed mods are {chosen_mods}.")
for multiworld_location in multiworld.get_locations():
if multiworld_location.event:
continue
location = location_table[multiworld_location.name]
self.assertTrue(location.mod_name is None or location.mod_name in chosen_mods)

View File

@@ -0,0 +1,96 @@
from unittest import TestCase
from BaseClasses import MultiWorld
from .world_assert import get_all_item_names, get_all_location_names
from ... import StardewValleyWorld, options, item_table, Group, location_table, ExcludeGingerIsland
from ...locations import LocationTags
from ...strings.ap_names.transport_names import Transportation
def get_stardew_world(multiworld: MultiWorld) -> StardewValleyWorld:
for world_key in multiworld.worlds:
world = multiworld.worlds[world_key]
if isinstance(world, StardewValleyWorld):
return world
raise ValueError("no stardew world in this multiworld")
def get_stardew_options(multiworld: MultiWorld) -> options.StardewValleyOptions:
return get_stardew_world(multiworld).options
class OptionAssertMixin(TestCase):
def assert_has_item(self, multiworld: MultiWorld, item: str):
all_item_names = set(get_all_item_names(multiworld))
self.assertIn(item, all_item_names)
def assert_has_not_item(self, multiworld: MultiWorld, item: str):
all_item_names = set(get_all_item_names(multiworld))
self.assertNotIn(item, all_item_names)
def assert_has_location(self, multiworld: MultiWorld, item: str):
all_location_names = set(get_all_location_names(multiworld))
self.assertIn(item, all_location_names)
def assert_has_not_location(self, multiworld: MultiWorld, item: str):
all_location_names = set(get_all_location_names(multiworld))
self.assertNotIn(item, all_location_names)
def assert_can_reach_island(self, multiworld: MultiWorld):
all_item_names = get_all_item_names(multiworld)
self.assertIn(Transportation.boat_repair, all_item_names)
self.assertIn(Transportation.island_obelisk, all_item_names)
def assert_cannot_reach_island(self, multiworld: MultiWorld):
all_item_names = get_all_item_names(multiworld)
self.assertNotIn(Transportation.boat_repair, all_item_names)
self.assertNotIn(Transportation.island_obelisk, all_item_names)
def assert_can_reach_island_if_should(self, multiworld: MultiWorld):
stardew_options = get_stardew_options(multiworld)
include_island = stardew_options.exclude_ginger_island.value == ExcludeGingerIsland.option_false
if include_island:
self.assert_can_reach_island(multiworld)
else:
self.assert_cannot_reach_island(multiworld)
def assert_cropsanity_same_number_items_and_locations(self, multiworld: MultiWorld):
is_cropsanity = get_stardew_options(multiworld).cropsanity.value == options.Cropsanity.option_enabled
if not is_cropsanity:
return
all_item_names = set(get_all_item_names(multiworld))
all_location_names = set(get_all_location_names(multiworld))
all_cropsanity_item_names = {item_name for item_name in all_item_names if Group.CROPSANITY in item_table[item_name].groups}
all_cropsanity_location_names = {location_name for location_name in all_location_names if LocationTags.CROPSANITY in location_table[location_name].tags}
self.assertEqual(len(all_cropsanity_item_names), len(all_cropsanity_location_names))
def assert_all_rarecrows_exist(self, multiworld: MultiWorld):
all_item_names = set(get_all_item_names(multiworld))
for rarecrow_number in range(1, 9):
self.assertIn(f"Rarecrow #{rarecrow_number}", all_item_names)
def assert_has_deluxe_scarecrow_recipe(self, multiworld: MultiWorld):
self.assert_has_item(multiworld, "Deluxe Scarecrow Recipe")
def assert_festivals_give_access_to_deluxe_scarecrow(self, multiworld: MultiWorld):
stardew_options = get_stardew_options(multiworld)
has_festivals = stardew_options.festival_locations.value != options.FestivalLocations.option_disabled
if not has_festivals:
return
self.assert_all_rarecrows_exist(multiworld)
self.assert_has_deluxe_scarecrow_recipe(multiworld)
def assert_has_festival_recipes(self, multiworld: MultiWorld):
stardew_options = get_stardew_options(multiworld)
has_festivals = stardew_options.festival_locations.value != options.FestivalLocations.option_disabled
festival_items = ["Tub o' Flowers Recipe", "Jack-O-Lantern Recipe"]
for festival_item in festival_items:
if has_festivals:
self.assert_has_item(multiworld, festival_item)
self.assert_has_location(multiworld, festival_item)
else:
self.assert_has_not_item(multiworld, festival_item)
self.assert_has_not_location(multiworld, festival_item)

View File

@@ -0,0 +1,17 @@
from unittest import TestCase
from BaseClasses import CollectionState
from .rule_explain import explain
from ...stardew_rule import StardewRule, false_, MISSING_ITEM
class RuleAssertMixin(TestCase):
def assert_rule_true(self, rule: StardewRule, state: CollectionState):
self.assertTrue(rule(state), explain(rule, state))
def assert_rule_false(self, rule: StardewRule, state: CollectionState):
self.assertFalse(rule(state), explain(rule, state, expected=False))
def assert_rule_can_be_resolved(self, rule: StardewRule, complete_state: CollectionState):
self.assertNotIn(MISSING_ITEM, repr(rule))
self.assertTrue(rule is false_ or rule(complete_state), explain(rule, complete_state))

View File

@@ -0,0 +1,102 @@
from __future__ import annotations
from dataclasses import dataclass, field
from functools import cached_property, singledispatch
from typing import Iterable
from BaseClasses import CollectionState
from worlds.generic.Rules import CollectionRule
from ...stardew_rule import StardewRule, AggregatingStardewRule, Count, Has, TotalReceived, Received, Reach
max_explanation_depth = 10
@dataclass
class RuleExplanation:
rule: StardewRule
state: CollectionState
expected: bool
sub_rules: Iterable[StardewRule] = field(default_factory=list)
def summary(self, depth=0):
return " " * depth + f"{str(self.rule)} -> {self.result}"
def __str__(self, depth=0):
if not self.sub_rules or depth >= max_explanation_depth:
return self.summary(depth)
return self.summary(depth) + "\n" + "\n".join(RuleExplanation.__str__(i, depth + 1)
if i.result is not self.expected else i.summary(depth + 1)
for i in sorted(self.explained_sub_rules, key=lambda x: x.result))
def __repr__(self, depth=0):
if not self.sub_rules or depth >= max_explanation_depth:
return self.summary(depth)
return self.summary(depth) + "\n" + "\n".join(RuleExplanation.__repr__(i, depth + 1)
for i in sorted(self.explained_sub_rules, key=lambda x: x.result))
@cached_property
def result(self):
return self.rule(self.state)
@cached_property
def explained_sub_rules(self):
return [_explain(i, self.state, self.expected) for i in self.sub_rules]
def explain(rule: CollectionRule, state: CollectionState, expected: bool = True) -> RuleExplanation:
if isinstance(rule, StardewRule):
return _explain(rule, state, expected)
else:
return f"Value of rule {str(rule)} was not {str(expected)} in {str(state)}" # noqa
@singledispatch
def _explain(rule: StardewRule, state: CollectionState, expected: bool) -> RuleExplanation:
return RuleExplanation(rule, state, expected)
@_explain.register
def _(rule: AggregatingStardewRule, state: CollectionState, expected: bool) -> RuleExplanation:
return RuleExplanation(rule, state, expected, rule.original_rules)
@_explain.register
def _(rule: Count, state: CollectionState, expected: bool) -> RuleExplanation:
return RuleExplanation(rule, state, expected, rule.rules)
@_explain.register
def _(rule: Has, state: CollectionState, expected: bool) -> RuleExplanation:
return RuleExplanation(rule, state, expected, [rule.other_rules[rule.item]])
@_explain.register
def _(rule: TotalReceived, state: CollectionState, expected=True) -> RuleExplanation:
return RuleExplanation(rule, state, expected, [Received(i, rule.player, 1) for i in rule.items])
@_explain.register
def _(rule: Reach, state: CollectionState, expected=True) -> RuleExplanation:
access_rules = None
if rule.resolution_hint == 'Location':
spot = state.multiworld.get_location(rule.spot, rule.player)
if isinstance(spot.access_rule, StardewRule):
access_rules = [spot.access_rule, Reach(spot.parent_region.name, "Region", rule.player)]
elif rule.resolution_hint == 'Entrance':
spot = state.multiworld.get_entrance(rule.spot, rule.player)
if isinstance(spot.access_rule, StardewRule):
access_rules = [spot.access_rule, Reach(spot.parent_region.name, "Region", rule.player)]
else:
spot = state.multiworld.get_region(rule.spot, rule.player)
access_rules = [*(Reach(e.name, "Entrance", rule.player) for e in spot.entrances)]
if not access_rules:
return RuleExplanation(rule, state, expected)
return RuleExplanation(rule, state, expected, access_rules)

View File

@@ -0,0 +1,83 @@
from typing import List
from unittest import TestCase
from BaseClasses import MultiWorld, ItemClassification
from .rule_assert import RuleAssertMixin
from ... import StardewItem
from ...items import items_by_group, Group
from ...locations import LocationTags, locations_by_tag
def get_all_item_names(multiworld: MultiWorld) -> List[str]:
return [item.name for item in multiworld.itempool]
def get_all_location_names(multiworld: MultiWorld) -> List[str]:
return [location.name for location in multiworld.get_locations() if not location.event]
class WorldAssertMixin(RuleAssertMixin, TestCase):
def assert_victory_exists(self, multiworld: MultiWorld):
self.assertIn(StardewItem("Victory", ItemClassification.progression, None, 1), multiworld.get_items())
def assert_can_reach_victory(self, multiworld: MultiWorld):
victory = multiworld.find_item("Victory", 1)
self.assert_rule_true(victory.access_rule, multiworld.state)
def assert_cannot_reach_victory(self, multiworld: MultiWorld):
victory = multiworld.find_item("Victory", 1)
self.assert_rule_false(victory.access_rule, multiworld.state)
def assert_item_was_necessary_for_victory(self, item: StardewItem, multiworld: MultiWorld):
self.assert_can_reach_victory(multiworld)
multiworld.state.remove(item)
self.assert_cannot_reach_victory(multiworld)
multiworld.state.collect(item, event=False)
self.assert_can_reach_victory(multiworld)
def assert_item_was_not_necessary_for_victory(self, item: StardewItem, multiworld: MultiWorld):
self.assert_can_reach_victory(multiworld)
multiworld.state.remove(item)
self.assert_can_reach_victory(multiworld)
multiworld.state.collect(item, event=False)
self.assert_can_reach_victory(multiworld)
def assert_can_win(self, multiworld: MultiWorld):
self.assert_victory_exists(multiworld)
self.assert_can_reach_victory(multiworld)
def assert_same_number_items_locations(self, multiworld: MultiWorld):
non_event_locations = [location for location in multiworld.get_locations() if not location.event]
self.assertEqual(len(multiworld.itempool), len(non_event_locations))
def assert_can_reach_everything(self, multiworld: MultiWorld):
for location in multiworld.get_locations():
self.assert_rule_true(location.access_rule, multiworld.state)
def assert_basic_checks(self, multiworld: MultiWorld):
self.assert_same_number_items_locations(multiworld)
non_event_items = [item for item in multiworld.get_items() if item.code]
for item in non_event_items:
multiworld.state.collect(item)
self.assert_can_win(multiworld)
self.assert_can_reach_everything(multiworld)
def assert_basic_checks_with_subtests(self, multiworld: MultiWorld):
with self.subTest("same_number_items_locations"):
self.assert_same_number_items_locations(multiworld)
non_event_items = [item for item in multiworld.get_items() if item.code]
for item in non_event_items:
multiworld.state.collect(item)
with self.subTest("can_win"):
self.assert_can_win(multiworld)
with self.subTest("can_reach_everything"):
self.assert_can_reach_everything(multiworld)
def assert_no_ginger_island_content(self, multiworld: MultiWorld):
ginger_island_items = [item_data.name for item_data in items_by_group[Group.GINGER_ISLAND]]
ginger_island_locations = [location_data.name for location_data in locations_by_tag[LocationTags.GINGER_ISLAND]]
for item in multiworld.get_items():
self.assertNotIn(item.name, ginger_island_items)
for location in multiworld.get_locations():
self.assertNotIn(location.name, ginger_island_locations)