Major Game Update: Stardew Valley v3.x.x - The BK Update (#1686)
This is a major update for Stardew Valley, for version 3.x.x. Changes include a large number of new features, including Seasons Randomizer, SeedShuffle, Museumsanity, Friendsanity, Complete Collection Goal, Full House Goal, friendship multiplier Co-authored-by: Jouramie <jouramie@hotmail.com>
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
from typing import ClassVar
|
||||
from argparse import Namespace
|
||||
from typing import Dict, FrozenSet, Tuple, Any, ClassVar
|
||||
|
||||
from BaseClasses import MultiWorld
|
||||
from test.TestBase import WorldTestBase
|
||||
from test.general import gen_steps
|
||||
from .. import StardewValleyWorld
|
||||
from ...AutoWorld import call_all
|
||||
|
||||
|
||||
class SVTestBase(WorldTestBase):
|
||||
@@ -12,9 +16,41 @@ class SVTestBase(WorldTestBase):
|
||||
def world_setup(self, *args, **kwargs):
|
||||
super().world_setup(*args, **kwargs)
|
||||
if self.constructed:
|
||||
self.world = self.multiworld.worlds[self.player]
|
||||
self.world = self.multiworld.worlds[self.player] # noqa
|
||||
|
||||
@property
|
||||
def run_default_tests(self) -> bool:
|
||||
# world_setup is overridden, so it'd always run default tests when importing SVTestBase
|
||||
return type(self) is not SVTestBase and super().run_default_tests
|
||||
|
||||
|
||||
pre_generated_worlds = {}
|
||||
|
||||
|
||||
# Mostly a copy of test.general.setup_solo_multiworld, I just don't want to change the core.
|
||||
def setup_solo_multiworld(test_options=None,
|
||||
_cache: Dict[FrozenSet[Tuple[str, Any]], MultiWorld] = {}) -> MultiWorld: # noqa
|
||||
if test_options is None:
|
||||
test_options = {}
|
||||
|
||||
# Yes I reuse the worlds generated between tests, its speeds the execution by a couple seconds
|
||||
frozen_options = frozenset(test_options.items())
|
||||
if frozen_options in _cache:
|
||||
return _cache[frozen_options]
|
||||
|
||||
multiworld = MultiWorld(1)
|
||||
multiworld.game[1] = StardewValleyWorld.game
|
||||
multiworld.player_name = {1: "Tester"}
|
||||
multiworld.set_seed()
|
||||
args = Namespace()
|
||||
for name, option in StardewValleyWorld.option_definitions.items():
|
||||
value = option(test_options[name]) if name in test_options else option.from_any(option.default)
|
||||
setattr(args, name, {1: value})
|
||||
multiworld.set_options(args)
|
||||
multiworld.set_default_common_options()
|
||||
for step in gen_steps:
|
||||
call_all(multiworld, step)
|
||||
|
||||
_cache[frozen_options] = multiworld
|
||||
|
||||
return multiworld
|
||||
|
||||
Reference in New Issue
Block a user