mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00

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
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
from typing import Optional
|
|
|
|
from BaseClasses import ItemClassification
|
|
from .base_logic import BaseLogic, BaseLogicMixin
|
|
from .has_logic import HasLogicMixin
|
|
from .logic_event import all_events
|
|
from ..items import item_table
|
|
from ..stardew_rule import StardewRule, Received, TotalReceived
|
|
|
|
|
|
class ReceivedLogicMixin(BaseLogic[HasLogicMixin], BaseLogicMixin):
|
|
def received(self, item: str, count: Optional[int] = 1) -> StardewRule:
|
|
assert count >= 0, "Can't receive a negative amount of item."
|
|
|
|
if item in all_events:
|
|
return Received(item, self.player, count, event=True)
|
|
|
|
assert item_table[item].classification & ItemClassification.progression, f"Item [{item_table[item].name}] has to be progression to be used in logic"
|
|
return Received(item, self.player, count)
|
|
|
|
def received_all(self, *items: str):
|
|
assert items, "Can't receive all of no items."
|
|
|
|
return self.logic.and_(*(self.received(item) for item in items))
|
|
|
|
def received_any(self, *items: str):
|
|
assert items, "Can't receive any of no items."
|
|
|
|
return self.logic.or_(*(self.received(item) for item in items))
|
|
|
|
def received_once(self, *items: str, count: int):
|
|
assert items, "Can't receive once of no items."
|
|
assert count >= 0, "Can't receive a negative amount of item."
|
|
|
|
return self.logic.count(count, *(self.received(item) for item in items))
|
|
|
|
def received_n(self, *items: str, count: int):
|
|
assert items, "Can't receive n of no items."
|
|
assert count >= 0, "Can't receive a negative amount of item."
|
|
|
|
for item in items:
|
|
assert item_table[item].classification & ItemClassification.progression, f"Item [{item_table[item].name}] has to be progression to be used in logic"
|
|
|
|
return TotalReceived(count, items, self.player)
|