Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Fixes #4

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion worlds/stardew_valley/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def setup_victory(self):
Event.victory)
elif self.options.goal == Goal.option_cryptic_note:
self.create_event_location(location_table[GoalName.cryptic_note],
self.logic.can_complete_quest("Cryptic Note").simplify(),
self.logic.quest.can_complete_quest("Cryptic Note").simplify(),
Event.victory)
elif self.options.goal == Goal.option_master_angler:
self.create_event_location(location_table[GoalName.master_angler],
Expand Down
11 changes: 6 additions & 5 deletions worlds/stardew_valley/test/TestGeneration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import List

from BaseClasses import ItemClassification, MultiWorld, Item
from . import setup_solo_multiworld, SVTestBase, get_minsanity_options
from . import setup_solo_multiworld, SVTestBase, get_minsanity_options, allsanity_options_without_mods, \
allsanity_options_with_mods, minimal_locations_maximal_items
from .. import locations, items, location_table, options
from ..data.villagers_data import all_villagers_by_name, all_villagers_by_mod_by_name
from ..items import items_by_group, Group, item_table
from ..items import Group, item_table
from ..locations import LocationTags
from ..mods.mod_data import ModNames
from ..options import Friendsanity, SpecialOrderLocations, Shipsanity, Chefsanity, SeasonRandomization, Craftsanity, ExcludeGingerIsland, ToolProgression, \
Expand Down Expand Up @@ -316,7 +317,7 @@ def test_all_location_created_are_in_location_table(self):
class TestLocationAndItemCount(SVTestBase):

def test_minimal_location_maximal_items_still_valid(self):
min_max_options = self.minimal_locations_maximal_items()
min_max_options = minimal_locations_maximal_items()
multiworld = setup_solo_multiworld(min_max_options)
valid_locations = get_real_locations(self, multiworld)
number_locations = len(valid_locations)
Expand All @@ -341,7 +342,7 @@ def test_minsanity_has_fewer_than_locations(self):

def test_allsanity_without_mods_has_at_least_locations(self):
expected_locations = 1948
allsanity_options = self.allsanity_options_without_mods()
allsanity_options = allsanity_options_without_mods()
multiworld = setup_solo_multiworld(allsanity_options)
real_locations = get_real_locations(self, multiworld)
number_locations = len(real_locations)
Expand All @@ -355,7 +356,7 @@ def test_allsanity_without_mods_has_at_least_locations(self):

def test_allsanity_with_mods_has_at_least_locations(self):
expected_locations = 2200
allsanity_options = self.allsanity_options_with_mods()
allsanity_options = allsanity_options_with_mods()
multiworld = setup_solo_multiworld(allsanity_options)
real_locations = get_real_locations(self, multiworld)
number_locations = len(real_locations)
Expand Down
4 changes: 2 additions & 2 deletions worlds/stardew_valley/test/TestLogic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import unittest

from . import SVTestBase, setup_solo_multiworld
from . import setup_solo_multiworld, allsanity_options_with_mods
from ..data.bundle_data import all_bundle_items_except_money
from ..stardew_rule import MISSING_ITEM, False_

multi_world = setup_solo_multiworld(SVTestBase.allsanity_options_without_mods())
multi_world = setup_solo_multiworld(allsanity_options_with_mods())
world = multi_world.worlds[1]
logic = world.logic

Expand Down
157 changes: 80 additions & 77 deletions worlds/stardew_valley/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,86 @@ def get_minsanity_options():
return minsanity


def minimal_locations_maximal_items():
min_max_options = {
Goal.internal_name: Goal.option_bottom_of_the_mines,
BundleRandomization.internal_name: BundleRandomization.option_vanilla,
BundlePrice.internal_name: BundlePrice.option_very_cheap,
SeasonRandomization.internal_name: SeasonRandomization.option_randomized,
Cropsanity.internal_name: Cropsanity.option_shuffled,
BackpackProgression.internal_name: BackpackProgression.option_vanilla,
ToolProgression.internal_name: ToolProgression.option_vanilla,
SkillProgression.internal_name: SkillProgression.option_vanilla,
BuildingProgression.internal_name: BuildingProgression.option_vanilla,
FestivalLocations.internal_name: FestivalLocations.option_disabled,
ElevatorProgression.internal_name: ElevatorProgression.option_vanilla,
ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_disabled,
SpecialOrderLocations.internal_name: SpecialOrderLocations.option_disabled,
HelpWantedLocations.internal_name: 0,
Fishsanity.internal_name: Fishsanity.option_none,
Museumsanity.internal_name: Museumsanity.option_none,
Monstersanity.internal_name: Monstersanity.option_none,
Shipsanity.internal_name: Shipsanity.option_none,
Friendsanity.internal_name: Friendsanity.option_none,
FriendsanityHeartSize.internal_name: 8,
NumberOfMovementBuffs.internal_name: 12,
NumberOfLuckBuffs.internal_name: 12,
ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true,
TrapItems.internal_name: TrapItems.option_nightmare,
Mods.internal_name: (),
}
return min_max_options


def allsanity_options_without_mods():
allsanity = {
Goal.internal_name: Goal.option_perfection,
BundleRandomization.internal_name: BundleRandomization.option_thematic,
BundlePrice.internal_name: BundlePrice.option_expensive,
SeasonRandomization.internal_name: SeasonRandomization.option_randomized,
Cropsanity.internal_name: Cropsanity.option_shuffled,
BackpackProgression.internal_name: BackpackProgression.option_progressive,
ToolProgression.internal_name: ToolProgression.option_progressive,
SkillProgression.internal_name: SkillProgression.option_progressive,
BuildingProgression.internal_name: BuildingProgression.option_progressive,
FestivalLocations.internal_name: FestivalLocations.option_hard,
ElevatorProgression.internal_name: ElevatorProgression.option_progressive,
ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_full_shuffling,
SpecialOrderLocations.internal_name: SpecialOrderLocations.option_board_qi,
HelpWantedLocations.internal_name: 56,
Fishsanity.internal_name: Fishsanity.option_all,
Museumsanity.internal_name: Museumsanity.option_all,
Monstersanity.internal_name: Monstersanity.option_progressive_goals,
Shipsanity.internal_name: Shipsanity.option_everything,
Cooksanity.internal_name: Cooksanity.option_all,
Chefsanity.internal_name: Chefsanity.option_all,
Craftsanity.internal_name: Craftsanity.option_all,
Friendsanity.internal_name: Friendsanity.option_all_with_marriage,
FriendsanityHeartSize.internal_name: 1,
NumberOfMovementBuffs.internal_name: 12,
NumberOfLuckBuffs.internal_name: 12,
ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_false,
TrapItems.internal_name: TrapItems.option_nightmare,
}
return allsanity


def allsanity_options_with_mods():
allsanity = {}
allsanity.update(allsanity_options_without_mods())
all_mods = (
ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack,
ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology,
ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna,
ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene,
ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores,
ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator,
ModNames.sve
)
allsanity.update({Mods.internal_name: all_mods})
return allsanity


class SVTestBase(WorldTestBase):
game = "Stardew Valley"
world: StardewValleyWorld
Expand All @@ -72,83 +152,6 @@ def run_default_tests(self) -> bool:
should_run_default_tests = is_not_stardew_test and super().run_default_tests
return should_run_default_tests

@staticmethod
def minimal_locations_maximal_items():
min_max_options = {
Goal.internal_name: Goal.option_bottom_of_the_mines,
BundleRandomization.internal_name: BundleRandomization.option_vanilla,
BundlePrice.internal_name: BundlePrice.option_very_cheap,
SeasonRandomization.internal_name: SeasonRandomization.option_randomized,
Cropsanity.internal_name: Cropsanity.option_shuffled,
BackpackProgression.internal_name: BackpackProgression.option_vanilla,
ToolProgression.internal_name: ToolProgression.option_vanilla,
SkillProgression.internal_name: SkillProgression.option_vanilla,
BuildingProgression.internal_name: BuildingProgression.option_vanilla,
FestivalLocations.internal_name: FestivalLocations.option_disabled,
ElevatorProgression.internal_name: ElevatorProgression.option_vanilla,
ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_disabled,
SpecialOrderLocations.internal_name: SpecialOrderLocations.option_disabled,
HelpWantedLocations.internal_name: 0,
Fishsanity.internal_name: Fishsanity.option_none,
Museumsanity.internal_name: Museumsanity.option_none,
Monstersanity.internal_name: Monstersanity.option_none,
Shipsanity.internal_name: Shipsanity.option_none,
Friendsanity.internal_name: Friendsanity.option_none,
FriendsanityHeartSize.internal_name: 8,
NumberOfMovementBuffs.internal_name: 12,
NumberOfLuckBuffs.internal_name: 12,
ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true,
TrapItems.internal_name: TrapItems.option_nightmare,
Mods.internal_name: (),
}
return min_max_options

@staticmethod
def allsanity_options_without_mods():
allsanity = {
Goal.internal_name: Goal.option_perfection,
BundleRandomization.internal_name: BundleRandomization.option_thematic,
BundlePrice.internal_name: BundlePrice.option_expensive,
SeasonRandomization.internal_name: SeasonRandomization.option_randomized,
Cropsanity.internal_name: Cropsanity.option_shuffled,
BackpackProgression.internal_name: BackpackProgression.option_progressive,
ToolProgression.internal_name: ToolProgression.option_progressive,
SkillProgression.internal_name: SkillProgression.option_progressive,
BuildingProgression.internal_name: BuildingProgression.option_progressive,
FestivalLocations.internal_name: FestivalLocations.option_hard,
ElevatorProgression.internal_name: ElevatorProgression.option_progressive,
ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_full_shuffling,
SpecialOrderLocations.internal_name: SpecialOrderLocations.option_board_qi,
HelpWantedLocations.internal_name: 56,
Fishsanity.internal_name: Fishsanity.option_all,
Museumsanity.internal_name: Museumsanity.option_all,
Monstersanity.internal_name: Monstersanity.option_progressive_goals,
Shipsanity.internal_name: Shipsanity.option_everything,
Cooksanity.internal_name: Cooksanity.option_all,
Chefsanity.internal_name: Chefsanity.option_all,
Craftsanity.internal_name: Craftsanity.option_all,
Friendsanity.internal_name: Friendsanity.option_all_with_marriage,
FriendsanityHeartSize.internal_name: 1,
NumberOfMovementBuffs.internal_name: 12,
NumberOfLuckBuffs.internal_name: 12,
ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_false,
TrapItems.internal_name: TrapItems.option_nightmare,
}
return allsanity

def allsanity_options_with_mods(self):
allsanity = {}
allsanity.update(self.allsanity_options_without_mods())
all_mods = (
ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack,
ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology,
ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna,
ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene,
ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores,
ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator
)
allsanity.update({Mods.internal_name: all_mods})
return allsanity

pre_generated_worlds = {}

Expand Down
Loading