| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from .base_logic import 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
										 |  |  | from ..stardew_rule import StardewRule, And, Or, Has, Count, true_, false_ | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class HasLogicMixin(BaseLogic[None]): | 
					
						
							| 
									
										
										
											
												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
										 |  |  |     true_ = true_ | 
					
						
							|  |  |  |     false_ = false_ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     # Should be cached | 
					
						
							|  |  |  |     def has(self, item: str) -> StardewRule: | 
					
						
							|  |  |  |         return Has(item, self.registry.item_rules) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def has_all(self, *items: str): | 
					
						
							|  |  |  |         assert items, "Can't have all of no items." | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												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.and_(*(self.has(item) for item in items)) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def has_any(self, *items: str): | 
					
						
							|  |  |  |         assert items, "Can't have any of no items." | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												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.has(item) for item in items)) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def has_n(self, *items: str, count: int): | 
					
						
							|  |  |  |         return self.count(count, *(self.has(item) for item in items)) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @staticmethod | 
					
						
							|  |  |  |     def count(count: int, *rules: StardewRule) -> StardewRule: | 
					
						
							|  |  |  |         assert rules, "Can't create a Count conditions without rules" | 
					
						
							|  |  |  |         assert len(rules) >= count, "Count need at least as many rules as the count" | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         assert count > 0, "Count can't be negative" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         count -= sum(r is true_ for r in rules) | 
					
						
							|  |  |  |         rules = list(r for r in rules if r is not true_) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if count <= 0: | 
					
						
							|  |  |  |             return true_ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if len(rules) == 1: | 
					
						
							|  |  |  |             return rules[0] | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if count == 1: | 
					
						
							|  |  |  |             return Or(*rules) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if count == len(rules): | 
					
						
							|  |  |  |             return And(*rules) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												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 Count(rules, count) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @staticmethod | 
					
						
							|  |  |  |     def and_(*rules: StardewRule) -> StardewRule: | 
					
						
							|  |  |  |         assert rules, "Can't create a And conditions without rules" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if len(rules) == 1: | 
					
						
							|  |  |  |             return rules[0] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return And(*rules) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @staticmethod | 
					
						
							|  |  |  |     def or_(*rules: StardewRule) -> StardewRule: | 
					
						
							|  |  |  |         assert rules, "Can't create a Or conditions without rules" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if len(rules) == 1: | 
					
						
							|  |  |  |             return rules[0] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return Or(*rules) |