-
Notifications
You must be signed in to change notification settings - Fork 713
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
Stardew Valley: Fix a bug where walnutsanity would get deactivated even tho ginger island got forced activated (and move some files) #4311
Merged
Berserker66
merged 9 commits into
ArchipelagoMW:main
from
agilbert1412:StardewValley/fix-walnut-force-options-change
Dec 9, 2024
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
008bb51
move option related stuff in an options module
Jouramie d42e568
fix formatting in options
Jouramie 8e86c47
move option filling for test in its own module
Jouramie af14bcb
move test for forced options and fix walnutsanity issue
Jouramie 2cb160b
remove duplicated method to fill dataclass with default
Jouramie 3711ac7
Merge branch 'main' into StardewValley/fix-walnut-force-options-change
Jouramie 1814beb
change lines seperator while we're at it
Jouramie 932cea5
address comments
Jouramie 9ea276c
rename stuff
Jouramie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .options import StardewValleyOption, Goal, FarmType, StartingMoney, ProfitMargin, BundleRandomization, BundlePrice, EntranceRandomization, \ | ||
SeasonRandomization, Cropsanity, BackpackProgression, ToolProgression, ElevatorProgression, SkillProgression, BuildingProgression, FestivalLocations, \ | ||
ArcadeMachineLocations, SpecialOrderLocations, QuestLocations, Fishsanity, Museumsanity, Monstersanity, Shipsanity, Cooksanity, Chefsanity, Craftsanity, \ | ||
Friendsanity, FriendsanityHeartSize, Booksanity, Walnutsanity, NumberOfMovementBuffs, EnabledFillerBuffs, ExcludeGingerIsland, TrapItems, \ | ||
MultipleDaySleepEnabled, MultipleDaySleepCost, ExperienceMultiplier, FriendshipMultiplier, DebrisMultiplier, QuickStart, Gifting, Mods, BundlePlando, \ | ||
StardewValleyOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import logging | ||
|
||
import Options as ap_options | ||
from . import options | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def force_change_options_if_incompatible(world_options: options.StardewValleyOptions, player: int, player_name: str) -> None: | ||
force_ginger_island_inclusion_when_goal_is_ginger_island_related(world_options, player, player_name) | ||
force_walnutsanity_deactivation_when_ginger_island_is_excluded(world_options, player, player_name) | ||
force_accessibility_to_full_when_goal_requires_all_locations(player, player_name, world_options) | ||
|
||
|
||
def force_ginger_island_inclusion_when_goal_is_ginger_island_related(world_options: options.StardewValleyOptions, player: int, player_name: str) -> None: | ||
goal_is_walnut_hunter = world_options.goal == options.Goal.option_greatest_walnut_hunter | ||
goal_is_perfection = world_options.goal == options.Goal.option_perfection | ||
goal_is_island_related = goal_is_walnut_hunter or goal_is_perfection | ||
ginger_island_is_excluded = world_options.exclude_ginger_island == options.ExcludeGingerIsland.option_true | ||
|
||
if goal_is_island_related and ginger_island_is_excluded: | ||
world_options.exclude_ginger_island.value = options.ExcludeGingerIsland.option_false | ||
goal_name = world_options.goal.current_key | ||
Jouramie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
logger.warning(f"Goal '{goal_name}' requires Ginger Island. " | ||
f"Exclude Ginger Island setting forced to 'False' for player {player} ({player_name})") | ||
Jouramie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
def force_walnutsanity_deactivation_when_ginger_island_is_excluded(world_options: options.StardewValleyOptions, player: int, player_name: str): | ||
ginger_island_is_excluded = world_options.exclude_ginger_island == options.ExcludeGingerIsland.option_true | ||
walnutsanity_is_active = world_options.walnutsanity != options.Walnutsanity.preset_none | ||
|
||
if ginger_island_is_excluded and walnutsanity_is_active: | ||
world_options.walnutsanity.value = options.Walnutsanity.preset_none | ||
logger.warning(f"Walnutsanity requires Ginger Island. " | ||
f"Ginger Island was excluded from {player} ({player_name})'s world, so walnutsanity was force disabled") | ||
|
||
|
||
def force_accessibility_to_full_when_goal_requires_all_locations(player, player_name, world_options): | ||
goal_is_allsanity = world_options.goal == options.Goal.option_allsanity | ||
goal_is_perfection = world_options.goal == options.Goal.option_perfection | ||
goal_requires_all_locations = goal_is_allsanity or goal_is_perfection | ||
accessibility_is_minimal = world_options.accessibility == ap_options.Accessibility.option_minimal | ||
|
||
if goal_requires_all_locations and accessibility_is_minimal: | ||
world_options.accessibility.value = ap_options.Accessibility.option_full | ||
goal_name = world_options.goal.current_key | ||
Jouramie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
logger.warning(f"Goal '{goal_name}' requires full accessibility. " | ||
f"Accessibility setting forced to 'Full' for player {player} ({player_name})") | ||
Jouramie marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this doesn't just pass the world and you grab the options, player, and name off that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes it easier to test specifically that options were changed without creating a complete world. We've often been rightfully criticized for generating too many worlds just to test small things that could be unit tested, so I'm slowly trying to address that.
See in TestForcedOptions.py