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:
@@ -1,14 +1,11 @@
|
||||
from typing import Dict
|
||||
import random
|
||||
from typing import Dict
|
||||
|
||||
from BaseClasses import MultiWorld
|
||||
from BaseClasses import MultiWorld, get_seed
|
||||
from Options import NamedRange, Range
|
||||
from .option_names import options_to_include
|
||||
from .. import setup_solo_multiworld, SVTestCase
|
||||
from ..checks.goal_checks import assert_perfection_world_is_valid, assert_goal_world_is_valid
|
||||
from ..checks.option_checks import assert_can_reach_island_if_should, assert_cropsanity_same_number_items_and_locations, \
|
||||
assert_festivals_give_access_to_deluxe_scarecrow
|
||||
from ..checks.world_checks import assert_same_number_items_locations, assert_victory_exists
|
||||
from ..assertion import GoalAssertMixin, OptionAssertMixin, WorldAssertMixin
|
||||
|
||||
|
||||
def get_option_choices(option) -> Dict[str, int]:
|
||||
@@ -27,10 +24,10 @@ def generate_random_multiworld(world_id: int):
|
||||
return multiworld
|
||||
|
||||
|
||||
def generate_random_world_options(world_id: int) -> Dict[str, int]:
|
||||
def generate_random_world_options(seed: int) -> Dict[str, int]:
|
||||
num_options = len(options_to_include)
|
||||
world_options = dict()
|
||||
rng = random.Random(world_id)
|
||||
rng = random.Random(seed)
|
||||
for option_index in range(0, num_options):
|
||||
option = options_to_include[option_index]
|
||||
option_choices = get_option_choices(option)
|
||||
@@ -57,42 +54,37 @@ def get_number_log_steps(number_worlds: int) -> int:
|
||||
return 100
|
||||
|
||||
|
||||
def generate_many_worlds(number_worlds: int, start_index: int) -> Dict[int, MultiWorld]:
|
||||
num_steps = get_number_log_steps(number_worlds)
|
||||
log_step = number_worlds / num_steps
|
||||
multiworlds = dict()
|
||||
print(f"Generating {number_worlds} Solo Multiworlds [Start Seed: {start_index}] for Stardew Valley...")
|
||||
for world_number in range(0, number_worlds + 1):
|
||||
world_id = world_number + start_index
|
||||
multiworld = generate_random_multiworld(world_id)
|
||||
multiworlds[world_id] = multiworld
|
||||
if world_number > 0 and world_number % log_step == 0:
|
||||
print(f"Generated {world_number}/{number_worlds} worlds [{(world_number * 100) // number_worlds}%]")
|
||||
print(f"Finished generating {number_worlds} Solo Multiworlds for Stardew Valley")
|
||||
return multiworlds
|
||||
|
||||
|
||||
def check_every_multiworld_is_valid(tester: SVTestCase, multiworlds: Dict[int, MultiWorld]):
|
||||
for multiworld_id in multiworlds:
|
||||
multiworld = multiworlds[multiworld_id]
|
||||
with tester.subTest(f"Checking validity of world {multiworld_id}"):
|
||||
check_multiworld_is_valid(tester, multiworld_id, multiworld)
|
||||
|
||||
|
||||
def check_multiworld_is_valid(tester: SVTestCase, multiworld_id: int, multiworld: MultiWorld):
|
||||
assert_victory_exists(tester, multiworld)
|
||||
assert_same_number_items_locations(tester, multiworld)
|
||||
assert_goal_world_is_valid(tester, multiworld)
|
||||
assert_can_reach_island_if_should(tester, multiworld)
|
||||
assert_cropsanity_same_number_items_and_locations(tester, multiworld)
|
||||
assert_festivals_give_access_to_deluxe_scarecrow(tester, multiworld)
|
||||
|
||||
|
||||
class TestGenerateManyWorlds(SVTestCase):
|
||||
class TestGenerateManyWorlds(GoalAssertMixin, OptionAssertMixin, WorldAssertMixin, SVTestCase):
|
||||
def test_generate_many_worlds_then_check_results(self):
|
||||
if self.skip_long_tests:
|
||||
return
|
||||
number_worlds = 1000
|
||||
start_index = random.Random().randint(0, 9999999999)
|
||||
multiworlds = generate_many_worlds(number_worlds, start_index)
|
||||
check_every_multiworld_is_valid(self, multiworlds)
|
||||
number_worlds = 10 if self.skip_long_tests else 1000
|
||||
seed = get_seed()
|
||||
self.generate_and_check_many_worlds(number_worlds, seed)
|
||||
|
||||
def generate_and_check_many_worlds(self, number_worlds: int, seed: int):
|
||||
num_steps = get_number_log_steps(number_worlds)
|
||||
log_step = number_worlds / num_steps
|
||||
|
||||
print(f"Generating {number_worlds} Solo Multiworlds [Start Seed: {seed}] for Stardew Valley...")
|
||||
for world_number in range(0, number_worlds + 1):
|
||||
|
||||
world_seed = world_number + seed
|
||||
world_options = generate_random_world_options(world_seed)
|
||||
|
||||
with self.solo_world_sub_test(f"Multiworld: {world_seed}", world_options, seed=world_seed, world_caching=False) as (multiworld, _):
|
||||
self.assert_multiworld_is_valid(multiworld)
|
||||
|
||||
if world_number > 0 and world_number % log_step == 0:
|
||||
print(f"Generated and Verified {world_number}/{number_worlds} worlds [{(world_number * 100) // number_worlds}%]")
|
||||
|
||||
print(f"Finished generating and verifying {number_worlds} Solo Multiworlds for Stardew Valley")
|
||||
|
||||
def assert_multiworld_is_valid(self, multiworld: MultiWorld):
|
||||
self.assert_victory_exists(multiworld)
|
||||
self.assert_same_number_items_locations(multiworld)
|
||||
self.assert_goal_world_is_valid(multiworld)
|
||||
self.assert_can_reach_island_if_should(multiworld)
|
||||
self.assert_cropsanity_same_number_items_and_locations(multiworld)
|
||||
self.assert_festivals_give_access_to_deluxe_scarecrow(multiworld)
|
||||
self.assert_has_festival_recipes(multiworld)
|
||||
|
||||
Reference in New Issue
Block a user