Stardew Valley: Remove Rarecrow Locations from Night Market when Museumsanity is Disabled (#5146)

This commit is contained in:
Jérémie Bolduc
2025-07-12 07:12:04 -04:00
committed by GitHub
parent a79423534c
commit 909565e5d9
3 changed files with 51 additions and 10 deletions

View File

@@ -279,6 +279,9 @@ def extend_festival_locations(randomized_locations: List[LocationData], options:
return return
festival_locations = locations_by_tag[LocationTags.FESTIVAL] festival_locations = locations_by_tag[LocationTags.FESTIVAL]
if not options.museumsanity:
festival_locations = [location for location in festival_locations if location.name not in ("Rarecrow #7 (Tanuki)", "Rarecrow #8 (Tribal Mask)")]
randomized_locations.extend(festival_locations) randomized_locations.extend(festival_locations)
extend_hard_festival_locations(randomized_locations, options) extend_hard_festival_locations(randomized_locations, options)
extend_desert_festival_chef_locations(randomized_locations, options, random) extend_desert_festival_chef_locations(randomized_locations, options, random)

View File

@@ -1,13 +1,5 @@
from typing import Union
from Utils import cache_self1 from Utils import cache_self1
from .action_logic import ActionLogicMixin
from .base_logic import BaseLogic, BaseLogicMixin from .base_logic import BaseLogic, BaseLogicMixin
from .has_logic import HasLogicMixin
from .received_logic import ReceivedLogicMixin
from .region_logic import RegionLogicMixin
from .time_logic import TimeLogicMixin
from .tool_logic import ToolLogicMixin
from .. import options from .. import options
from ..data.museum_data import MuseumItem, all_museum_items, all_museum_artifacts, all_museum_minerals from ..data.museum_data import MuseumItem, all_museum_items, all_museum_artifacts, all_museum_minerals
from ..stardew_rule import StardewRule, False_ from ..stardew_rule import StardewRule, False_

View File

@@ -1,12 +1,16 @@
from collections import Counter from collections import Counter
from unittest.mock import patch
from ..bases import SVTestBase from ..bases import SVTestBase
from ...options import Museumsanity from ..options import presets
from ... import options, StardewLogic, StardewRule
from ...logic.museum_logic import MuseumLogic
from ...stardew_rule import true_, LiteralStardewRule
class TestMuseumMilestones(SVTestBase): class TestMuseumMilestones(SVTestBase):
options = { options = {
Museumsanity.internal_name: Museumsanity.option_milestones options.Museumsanity: options.Museumsanity.option_milestones
} }
def test_50_milestone(self): def test_50_milestone(self):
@@ -14,3 +18,45 @@ class TestMuseumMilestones(SVTestBase):
milestone_rule = self.world.logic.museum.can_find_museum_items(50) milestone_rule = self.world.logic.museum.can_find_museum_items(50)
self.assert_rule_false(milestone_rule, self.multiworld.state) self.assert_rule_false(milestone_rule, self.multiworld.state)
class DisabledMuseumRule(LiteralStardewRule):
value = False
def __or__(self, other) -> StardewRule:
return other
def __and__(self, other) -> StardewRule:
return self
def __repr__(self):
return "Disabled Museum Rule"
class TestMuseumsanityDisabledExcludesMuseumDonationsFromOtherLocations(SVTestBase):
options = {
**presets.allsanity_mods_6_x_x(),
options.Museumsanity.internal_name: options.Museumsanity.option_none
}
def test_museum_donations_are_never_required_in_any_locations(self):
with patch("worlds.stardew_valley.logic.museum_logic.MuseumLogic") as MockMuseumLogic:
museum_logic: MuseumLogic = MockMuseumLogic.return_value
museum_logic.can_donate_museum_items.return_value = DisabledMuseumRule()
museum_logic.can_donate_museum_artifacts.return_value = DisabledMuseumRule()
museum_logic.can_find_museum_artifacts.return_value = DisabledMuseumRule()
museum_logic.can_find_museum_minerals.return_value = DisabledMuseumRule()
museum_logic.can_find_museum_items.return_value = DisabledMuseumRule()
museum_logic.can_complete_museum.return_value = DisabledMuseumRule()
museum_logic.can_donate.return_value = DisabledMuseumRule()
# Allowing calls to museum rules since a lot of other logic depends on it, for minerals for instance.
museum_logic.can_find_museum_item.return_value = true_
regions = {region.name for region in self.multiworld.regions}
self.world.logic = StardewLogic(self.player, self.world.options, self.world.content, regions)
self.world.set_rules()
self.collect_everything()
for location in self.get_real_locations():
with self.subTest(location.name):
self.assert_can_reach_location(location)