| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from functools import cached_property | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from Utils import cache_self1 | 
					
						
							|  |  |  | from .base_logic import BaseLogicMixin, BaseLogic | 
					
						
							|  |  |  | from ..data.recipe_data import RecipeSource, StarterSource, ShopSource, SkillSource, FriendshipSource, \ | 
					
						
							| 
									
										
										
										
											2025-03-22 15:29:16 -04:00
										 |  |  |     QueenOfSauceSource, CookingRecipe, ShopFriendshipSource | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..data.recipe_source import CutsceneSource, ShopTradeSource | 
					
						
							|  |  |  | from ..options import Chefsanity | 
					
						
							| 
									
										
										
											
												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 ..stardew_rule import StardewRule, True_, False_ | 
					
						
							| 
									
										
										
										
											2025-04-08 12:37:45 -04:00
										 |  |  | from ..strings.building_names import Building | 
					
						
							| 
									
										
										
											
												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 ..strings.region_names import LogicRegion | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..strings.skill_names import Skill | 
					
						
							|  |  |  | from ..strings.tv_channel_names import Channel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CookingLogicMixin(BaseLogicMixin): | 
					
						
							|  |  |  |     def __init__(self, *args, **kwargs): | 
					
						
							|  |  |  |         super().__init__(*args, **kwargs) | 
					
						
							|  |  |  |         self.cooking = CookingLogic(*args, **kwargs) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-04-23 11:31:08 -04:00
										 |  |  | class CookingLogic(BaseLogic): | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     @cached_property | 
					
						
							|  |  |  |     def can_cook_in_kitchen(self) -> StardewRule: | 
					
						
							| 
									
										
										
										
											2025-04-08 12:37:45 -04:00
										 |  |  |         return self.logic.building.has_building(Building.kitchen) | self.logic.skill.has_level(Skill.foraging, 9) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # Should be cached | 
					
						
							|  |  |  |     def can_cook(self, recipe: CookingRecipe = None) -> StardewRule: | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         cook_rule = self.logic.region.can_reach(LogicRegion.kitchen) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         if recipe is None: | 
					
						
							|  |  |  |             return cook_rule | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         recipe_rule = self.logic.cooking.knows_recipe(recipe.source, recipe.meal) | 
					
						
							|  |  |  |         ingredients_rule = self.logic.has_all(*sorted(recipe.ingredients)) | 
					
						
							|  |  |  |         return cook_rule & recipe_rule & ingredients_rule | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Should be cached | 
					
						
							|  |  |  |     def knows_recipe(self, source: RecipeSource, meal_name: str) -> StardewRule: | 
					
						
							|  |  |  |         if self.options.chefsanity == Chefsanity.option_none: | 
					
						
							|  |  |  |             return self.logic.cooking.can_learn_recipe(source) | 
					
						
							|  |  |  |         if isinstance(source, StarterSource): | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, ShopTradeSource) and self.options.chefsanity & Chefsanity.option_purchases: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, ShopSource) and self.options.chefsanity & Chefsanity.option_purchases: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, SkillSource) and self.options.chefsanity & Chefsanity.option_skills: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, CutsceneSource) and self.options.chefsanity & Chefsanity.option_friendship: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, FriendshipSource) and self.options.chefsanity & Chefsanity.option_friendship: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         if isinstance(source, QueenOfSauceSource) and self.options.chefsanity & Chefsanity.option_queen_of_sauce: | 
					
						
							|  |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         if isinstance(source, ShopFriendshipSource) and self.options.chefsanity & Chefsanity.option_purchases: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |             return self.logic.cooking.received_recipe(meal_name) | 
					
						
							|  |  |  |         return self.logic.cooking.can_learn_recipe(source) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @cache_self1 | 
					
						
							|  |  |  |     def can_learn_recipe(self, source: RecipeSource) -> StardewRule: | 
					
						
							|  |  |  |         if isinstance(source, StarterSource): | 
					
						
							|  |  |  |             return True_() | 
					
						
							|  |  |  |         if isinstance(source, ShopTradeSource): | 
					
						
							|  |  |  |             return self.logic.money.can_trade_at(source.region, source.currency, source.price) | 
					
						
							|  |  |  |         if isinstance(source, ShopSource): | 
					
						
							|  |  |  |             return self.logic.money.can_spend_at(source.region, source.price) | 
					
						
							|  |  |  |         if isinstance(source, SkillSource): | 
					
						
							|  |  |  |             return self.logic.skill.has_level(source.skill, source.level) | 
					
						
							|  |  |  |         if isinstance(source, CutsceneSource): | 
					
						
							|  |  |  |             return self.logic.region.can_reach(source.region) & self.logic.relationship.has_hearts(source.friend, source.hearts) | 
					
						
							|  |  |  |         if isinstance(source, FriendshipSource): | 
					
						
							|  |  |  |             return self.logic.relationship.has_hearts(source.friend, source.hearts) | 
					
						
							|  |  |  |         if isinstance(source, QueenOfSauceSource): | 
					
						
							|  |  |  |             return self.logic.action.can_watch(Channel.queen_of_sauce) & self.logic.season.has(source.season) | 
					
						
							|  |  |  |         if isinstance(source, ShopFriendshipSource): | 
					
						
							|  |  |  |             return self.logic.money.can_spend_at(source.region, source.price) & self.logic.relationship.has_hearts(source.friend, source.hearts) | 
					
						
							|  |  |  |         return False_() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @cache_self1 | 
					
						
							|  |  |  |     def received_recipe(self, meal_name: str): | 
					
						
							|  |  |  |         return self.logic.received(f"{meal_name} Recipe") |