| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | import functools | 
					
						
							| 
									
										
										
										
											2025-04-23 11:31:08 -04:00
										 |  |  | from typing import Any, Iterable | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | from .base_logic import BaseLogicMixin, BaseLogic | 
					
						
							| 
									
										
										
										
											2025-04-20 10:17:22 -04:00
										 |  |  | from ..data.animal import IncubatorSource, OstrichIncubatorSource | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | from ..data.artisan import MachineSource | 
					
						
							| 
									
										
										
										
											2025-04-08 12:37:45 -04:00
										 |  |  | from ..data.game_item import GenericSource, Source, GameItem, CustomRuleSource | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | from ..data.harvest import ForagingSource, FruitBatsSource, MushroomCaveSource, SeasonalForagingSource, \ | 
					
						
							|  |  |  |     HarvestCropSource, HarvestFruitTreeSource, ArtifactSpotSource | 
					
						
							|  |  |  | from ..data.shop import ShopSource, MysteryBoxSource, ArtifactTroveSource, PrizeMachineSource, FishingTreasureChestSource | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SourceLogicMixin(BaseLogicMixin): | 
					
						
							|  |  |  |     def __init__(self, *args, **kwargs): | 
					
						
							|  |  |  |         super().__init__(*args, **kwargs) | 
					
						
							|  |  |  |         self.source = SourceLogic(*args, **kwargs) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-23 11:31:08 -04:00
										 |  |  | class SourceLogic(BaseLogic): | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def has_access_to_item(self, item: GameItem): | 
					
						
							|  |  |  |         rules = [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if self.content.features.cropsanity.is_included(item): | 
					
						
							|  |  |  |             rules.append(self.logic.received(item.name)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         rules.append(self.logic.source.has_access_to_any(item.sources)) | 
					
						
							|  |  |  |         return self.logic.and_(*rules) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-08 12:37:45 -04:00
										 |  |  |     def has_access_to_any(self, sources: Iterable[Source]): | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |         return self.logic.or_(*(self.logic.source.has_access_to(source) & self.logic.requirement.meet_all_requirements(source.other_requirements) | 
					
						
							|  |  |  |                                 for source in sources)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @functools.singledispatchmethod | 
					
						
							|  |  |  |     def has_access_to(self, source: Any): | 
					
						
							|  |  |  |         raise ValueError(f"Sources of type{type(source)} have no rule registered.") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: GenericSource): | 
					
						
							|  |  |  |         return self.logic.region.can_reach_any(source.regions) if source.regions else self.logic.true_ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: CustomRuleSource): | 
					
						
							|  |  |  |         return source.create_rule(self.logic) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: ForagingSource): | 
					
						
							|  |  |  |         return self.logic.harvesting.can_forage_from(source) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: SeasonalForagingSource): | 
					
						
							|  |  |  |         # Implementation could be different with some kind of "calendar shuffle" | 
					
						
							|  |  |  |         return self.logic.harvesting.can_forage_from(source.as_foraging_source()) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, _: FruitBatsSource): | 
					
						
							|  |  |  |         return self.logic.harvesting.can_harvest_from_fruit_bats | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, _: MushroomCaveSource): | 
					
						
							|  |  |  |         return self.logic.harvesting.can_harvest_from_mushroom_cave | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: ShopSource): | 
					
						
							|  |  |  |         return self.logic.money.can_shop_from(source) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: HarvestFruitTreeSource): | 
					
						
							|  |  |  |         return self.logic.harvesting.can_harvest_tree_from(source) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: HarvestCropSource): | 
					
						
							|  |  |  |         return self.logic.harvesting.can_harvest_crop_from(source) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-20 10:17:22 -04:00
										 |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: IncubatorSource): | 
					
						
							|  |  |  |         return self.logic.animal.can_incubate(source.egg_item) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: OstrichIncubatorSource): | 
					
						
							|  |  |  |         return self.logic.animal.can_ostrich_incubate(source.egg_item) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: MachineSource): | 
					
						
							|  |  |  |         return self.logic.artisan.can_produce_from(source) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: MysteryBoxSource): | 
					
						
							|  |  |  |         return self.logic.grind.can_grind_mystery_boxes(source.amount) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: ArtifactTroveSource): | 
					
						
							|  |  |  |         return self.logic.grind.can_grind_artifact_troves(source.amount) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: PrizeMachineSource): | 
					
						
							|  |  |  |         return self.logic.grind.can_grind_prize_tickets(source.amount) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: FishingTreasureChestSource): | 
					
						
							|  |  |  |         return self.logic.grind.can_grind_fishing_treasure_chests(source.amount) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @has_access_to.register | 
					
						
							|  |  |  |     def _(self, source: ArtifactSpotSource): | 
					
						
							|  |  |  |         return self.logic.grind.can_grind_artifact_spots(source.amount) |