mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
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
This commit is contained in:
@@ -4,11 +4,13 @@ from typing import Iterable, Union, Hashable
|
||||
from Utils import cache_self1
|
||||
from .base_logic import BaseLogicMixin, BaseLogic
|
||||
from .combat_logic import CombatLogicMixin
|
||||
from .has_logic import HasLogicMixin
|
||||
from .region_logic import RegionLogicMixin
|
||||
from .time_logic import TimeLogicMixin, MAX_MONTHS
|
||||
from .. import options
|
||||
from ..data import monster_data
|
||||
from ..stardew_rule import StardewRule, Or, And
|
||||
from ..stardew_rule import StardewRule
|
||||
from ..strings.generic_names import Generic
|
||||
from ..strings.region_names import Region
|
||||
|
||||
|
||||
@@ -18,7 +20,7 @@ class MonsterLogicMixin(BaseLogicMixin):
|
||||
self.monster = MonsterLogic(*args, **kwargs)
|
||||
|
||||
|
||||
class MonsterLogic(BaseLogic[Union[MonsterLogicMixin, RegionLogicMixin, CombatLogicMixin, TimeLogicMixin]]):
|
||||
class MonsterLogic(BaseLogic[Union[HasLogicMixin, MonsterLogicMixin, RegionLogicMixin, CombatLogicMixin, TimeLogicMixin]]):
|
||||
|
||||
@cached_property
|
||||
def all_monsters_by_name(self):
|
||||
@@ -29,13 +31,18 @@ class MonsterLogic(BaseLogic[Union[MonsterLogicMixin, RegionLogicMixin, CombatLo
|
||||
return monster_data.all_monsters_by_category_given_mods(self.options.mods.value)
|
||||
|
||||
def can_kill(self, monster: Union[str, monster_data.StardewMonster], amount_tier: int = 0) -> StardewRule:
|
||||
if isinstance(monster, str):
|
||||
monster = self.all_monsters_by_name[monster]
|
||||
region_rule = self.logic.region.can_reach_any(monster.locations)
|
||||
combat_rule = self.logic.combat.can_fight_at_level(monster.difficulty)
|
||||
if amount_tier <= 0:
|
||||
amount_tier = 0
|
||||
time_rule = self.logic.time.has_lived_months(amount_tier)
|
||||
|
||||
if isinstance(monster, str):
|
||||
if monster == Generic.any:
|
||||
return self.logic.monster.can_kill_any(self.all_monsters_by_name.values()) & time_rule
|
||||
|
||||
monster = self.all_monsters_by_name[monster]
|
||||
region_rule = self.logic.region.can_reach_any(monster.locations)
|
||||
combat_rule = self.logic.combat.can_fight_at_level(monster.difficulty)
|
||||
|
||||
return region_rule & combat_rule & time_rule
|
||||
|
||||
@cache_self1
|
||||
@@ -48,13 +55,11 @@ class MonsterLogic(BaseLogic[Union[MonsterLogicMixin, RegionLogicMixin, CombatLo
|
||||
|
||||
# Should be cached
|
||||
def can_kill_any(self, monsters: (Iterable[monster_data.StardewMonster], Hashable), amount_tier: int = 0) -> StardewRule:
|
||||
rules = [self.logic.monster.can_kill(monster, amount_tier) for monster in monsters]
|
||||
return Or(*rules)
|
||||
return self.logic.or_(*(self.logic.monster.can_kill(monster, amount_tier) for monster in monsters))
|
||||
|
||||
# Should be cached
|
||||
def can_kill_all(self, monsters: (Iterable[monster_data.StardewMonster], Hashable), amount_tier: int = 0) -> StardewRule:
|
||||
rules = [self.logic.monster.can_kill(monster, amount_tier) for monster in monsters]
|
||||
return And(*rules)
|
||||
return self.logic.and_(*(self.logic.monster.can_kill(monster, amount_tier) for monster in monsters))
|
||||
|
||||
def can_complete_all_monster_slaying_goals(self) -> StardewRule:
|
||||
rules = [self.logic.time.has_lived_max_months]
|
||||
@@ -66,4 +71,4 @@ class MonsterLogic(BaseLogic[Union[MonsterLogicMixin, RegionLogicMixin, CombatLo
|
||||
continue
|
||||
rules.append(self.logic.monster.can_kill_any(self.all_monsters_by_category[category]))
|
||||
|
||||
return And(*rules)
|
||||
return self.logic.and_(*rules)
|
||||
|
||||
Reference in New Issue
Block a user