Files
Grinch-AP/worlds/stardew_valley/test/assertion/option_assert.py
agilbert1412 52e65e208e 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>
2024-03-15 13:05:14 +01:00

97 lines
4.6 KiB
Python

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)