forked from mirror/Archipelago
Major Content update for Stardew Valley ### Features - New BundleRandomization Value: Meme Bundles - Over 100 custom bundles, designed to be jokes, references, trolls, etc - New Setting: Bundles Per Room modifier - New Setting: Backpack Size - New Setting: Secretsanity - Checks for triggering easter eggs and secrets - New Setting: Moviesanity - Checks for watching movies and sharing snacks with Villagers - New Setting: Eatsanity - Checks for eating items - New Setting: Hatsanity - Checks for wearing Hats - New Setting: Start Without - Allows you to select any combination of various "starting" items, that you will actually not start with. Notably, tools, backpack slots, Day5 unlocks, etc. - New Setting: Allowed Filler Items - Allows you to customize the filler items you'll get - New Setting: Endgame Locations - Checks for various expensive endgame tasks and purchases - New Shipsanity value: Crops and Fish - New Settings: Jojapocalypse and settings to customize it - Bundle Plando: Replaced with BundleWhitelist and BundleBlacklist, for more customization freedom - Added a couple of Host.yaml settings to help hosts allow or ban specific difficult settings that could cause problems if the people don't know what they are signing up for. Plus a truckload of improvements on the mod side, not seen in this PR. ### Removed features - Integration for Stardew Valley Expanded. It is simply disabled, the code is all still there, but I'm extremely tired of providing tech support for it, plus Stardew Valley 1.7 was announced and that will break it again, so I'm done. When a maintainer steps up, it can be re-enabled.
79 lines
3.8 KiB
Python
79 lines
3.8 KiB
Python
from functools import cached_property
|
|
|
|
from Utils import cache_self1
|
|
from .base_logic import BaseLogic, BaseLogicMixin
|
|
from ..stardew_rule import StardewRule, true_, false_
|
|
from ..strings.building_names import Building, WizardBuilding
|
|
from ..strings.crop_names import Fruit
|
|
from ..strings.fish_names import Fish, WaterItem
|
|
from ..strings.forageable_names import Forageable
|
|
from ..strings.material_names import Material
|
|
from ..strings.metal_names import MetalBar, Mineral
|
|
from ..strings.region_names import Region
|
|
|
|
AUTO_BUILDING_BUILDINGS = {Building.shipping_bin, Building.pet_bowl, Building.farm_house}
|
|
|
|
|
|
class BuildingLogicMixin(BaseLogicMixin):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.building = BuildingLogic(*args, **kwargs)
|
|
|
|
|
|
class BuildingLogic(BaseLogic):
|
|
|
|
@cache_self1
|
|
def can_build(self, building_name: str) -> StardewRule:
|
|
building = self.content.farm_buildings.get(building_name)
|
|
assert building is not None, f"Building {building_name} not found."
|
|
|
|
source_rule = self.logic.source.has_access_to_any(building.sources)
|
|
if not building.is_upgrade:
|
|
return source_rule
|
|
|
|
upgrade_rule = self.logic.building.has_building(building.upgrade_from)
|
|
return self.logic.and_(upgrade_rule, source_rule)
|
|
|
|
@cache_self1
|
|
def has_building(self, building_name: str) -> StardewRule:
|
|
building_progression = self.content.features.building_progression
|
|
|
|
if building_name in building_progression.starting_buildings:
|
|
return true_
|
|
|
|
if not building_progression.is_progressive:
|
|
return self.logic.building.can_build(building_name)
|
|
|
|
# Those buildings are special. The mod auto-builds them when received, no need to go to Robin.
|
|
if building_name in AUTO_BUILDING_BUILDINGS:
|
|
return self.logic.received(building_name)
|
|
|
|
carpenter_rule = self.logic.building.can_construct_buildings
|
|
item, count = building_progression.to_progressive_item(building_name)
|
|
return self.logic.received(item, count) & carpenter_rule
|
|
|
|
@cache_self1
|
|
def has_wizard_building(self, building_name: str) -> StardewRule:
|
|
return self.logic.region.can_reach(Region.wizard_tower) & self.logic.received(building_name)
|
|
|
|
@cached_property
|
|
def can_construct_buildings(self) -> StardewRule:
|
|
return self.logic.region.can_reach(Region.carpenter)
|
|
|
|
def can_purchase_wizard_blueprint(self, building_name: str) -> StardewRule:
|
|
# This rule is part of the region, so not needed here
|
|
# rule = self.logic.region.can_reach(Region.wizard_tower) & self.logic.quest.has_magic_ink()
|
|
if building_name == WizardBuilding.earth_obelisk:
|
|
return self.logic.money.can_spend(500_000) & self.logic.has_all(MetalBar.iridium, Mineral.earth_crystal)
|
|
if building_name == WizardBuilding.water_obelisk:
|
|
return self.logic.money.can_spend(500_000) & self.logic.has_all(MetalBar.iridium, Fish.clam, WaterItem.coral)
|
|
if building_name == WizardBuilding.desert_obelisk:
|
|
return self.logic.money.can_spend(1_000_000) & self.logic.has_all(MetalBar.iridium, Forageable.coconut, Forageable.cactus_fruit)
|
|
if building_name == WizardBuilding.island_obelisk:
|
|
return self.logic.money.can_spend(1_000_000) & self.logic.has_all(MetalBar.iridium, Forageable.dragon_tooth, Fruit.banana)
|
|
if building_name == WizardBuilding.junimo_hut:
|
|
return self.logic.money.can_spend(20_000) & self.logic.has_all(MetalBar.iridium, Material.stone, Fruit.starfruit, Material.fiber)
|
|
if building_name == WizardBuilding.gold_clock:
|
|
return self.logic.money.can_spend(10_000_000)
|
|
return false_
|