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

Major Content update for Stardew Valley, including the following features - Major performance improvements all across the Stardew Valley apworld, including a significant reduction in the test time - Randomized Farm Type - Bundles rework (Remixed Bundles and Missing Bundle!) - New Settings: * Shipsanity - Shipping individual items * Monstersanity - Slaying monsters * Cooksanity - Cooking individual recipes * Chefsanity - Learning individual recipes * Craftsanity - Crafting individual items - New Goals: * Protector of the Valley - Complete every monster slayer goal * Full Shipment - Ship every item * Craftmaster - Craft every item * Gourmet Chef - Cook every recipe * Legend - Earn 10 000 000g * Mystery of the Stardrops - Find every stardrop (Maguffin Hunt) * Allsanity - Complete every check in your slot - Building Shuffle: Cheaper options - Tool Shuffle: Cheaper options - Money rework - New traps - New isolated checks and items, including the farm cave, the movie theater, etc - Mod Support: SVE [Albrekka] - Mod Support: Distant Lands [Albrekka] - Mod Support: Hat Mouse Lacey [Albrekka] - Mod Support: Boarding House [Albrekka] Co-authored-by: Witchybun <elnendil@gmail.com> Co-authored-by: Witchybun <96719127+Witchybun@users.noreply.github.com> Co-authored-by: Jouramie <jouramie@hotmail.com> Co-authored-by: Alchav <59858495+Alchav@users.noreply.github.com>
51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
import math
|
|
from typing import Union
|
|
|
|
from .base_logic import BaseLogicMixin, BaseLogic
|
|
from .received_logic import ReceivedLogicMixin
|
|
from .region_logic import RegionLogicMixin
|
|
from .time_logic import TimeLogicMixin
|
|
from .tool_logic import ToolLogicMixin
|
|
from ..data.villagers_data import Villager
|
|
from ..options import Friendsanity
|
|
from ..stardew_rule import StardewRule, True_
|
|
from ..strings.region_names import Region
|
|
from ..strings.villager_names import NPC
|
|
|
|
|
|
class PetLogicMixin(BaseLogicMixin):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.pet = PetLogic(*args, **kwargs)
|
|
|
|
|
|
class PetLogic(BaseLogic[Union[RegionLogicMixin, ReceivedLogicMixin, TimeLogicMixin, ToolLogicMixin]]):
|
|
def has_hearts(self, hearts: int = 1) -> StardewRule:
|
|
if hearts <= 0:
|
|
return True_()
|
|
if self.options.friendsanity == Friendsanity.option_none or self.options.friendsanity == Friendsanity.option_bachelors:
|
|
return self.can_befriend_pet(hearts)
|
|
return self.received_hearts(NPC.pet, hearts)
|
|
|
|
def received_hearts(self, npc: Union[str, Villager], hearts: int) -> StardewRule:
|
|
if isinstance(npc, Villager):
|
|
return self.received_hearts(npc.name, hearts)
|
|
return self.logic.received(self.heart(npc), math.ceil(hearts / self.options.friendsanity_heart_size))
|
|
|
|
def can_befriend_pet(self, hearts: int) -> StardewRule:
|
|
if hearts <= 0:
|
|
return True_()
|
|
points = hearts * 200
|
|
points_per_month = 12 * 14
|
|
points_per_water_month = 18 * 14
|
|
farm_rule = self.logic.region.can_reach(Region.farm)
|
|
time_with_water_rule = self.logic.tool.can_water(0) & self.logic.time.has_lived_months(points // points_per_water_month)
|
|
time_without_water_rule = self.logic.time.has_lived_months(points // points_per_month)
|
|
time_rule = time_with_water_rule | time_without_water_rule
|
|
return farm_rule & time_rule
|
|
|
|
def heart(self, npc: Union[str, Villager]) -> str:
|
|
if isinstance(npc, str):
|
|
return f"{npc} <3"
|
|
return self.heart(npc.name)
|