mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Stardew valley: Fix Queen of Sauce Cookbook conditions (#3651)
* - Extracted walnut logic to a Mixin so it can be used in content pack requirements * - Add 100 walnut requirements to the Queen of Sauce Cookbook * - Woops a file wasn't added to previous commits * - Make the queen of sauce cookbook a ginger island only thing, due to the walnut requirement * - Moved the book in the correct content pack * - Removed an empty class that I'm not sure where it came from
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from functools import cached_property
|
||||
from typing import Collection, Callable
|
||||
|
||||
from .ability_logic import AbilityLogicMixin
|
||||
@@ -43,6 +42,7 @@ from .time_logic import TimeLogicMixin
|
||||
from .tool_logic import ToolLogicMixin
|
||||
from .traveling_merchant_logic import TravelingMerchantLogicMixin
|
||||
from .wallet_logic import WalletLogicMixin
|
||||
from .walnut_logic import WalnutLogicMixin
|
||||
from ..content.game_content import StardewContent
|
||||
from ..data.craftable_data import all_crafting_recipes
|
||||
from ..data.museum_data import all_museum_items
|
||||
@@ -50,16 +50,14 @@ from ..data.recipe_data import all_cooking_recipes
|
||||
from ..mods.logic.magic_logic import MagicLogicMixin
|
||||
from ..mods.logic.mod_logic import ModLogicMixin
|
||||
from ..mods.mod_data import ModNames
|
||||
from ..options import SpecialOrderLocations, ExcludeGingerIsland, FestivalLocations, StardewValleyOptions, Walnutsanity
|
||||
from ..options import ExcludeGingerIsland, FestivalLocations, StardewValleyOptions
|
||||
from ..stardew_rule import False_, True_, StardewRule
|
||||
from ..strings.animal_names import Animal
|
||||
from ..strings.animal_product_names import AnimalProduct
|
||||
from ..strings.ap_names.ap_option_names import OptionName
|
||||
from ..strings.ap_names.community_upgrade_names import CommunityUpgrade
|
||||
from ..strings.ap_names.event_names import Event
|
||||
from ..strings.artisan_good_names import ArtisanGood
|
||||
from ..strings.building_names import Building
|
||||
from ..strings.craftable_names import Consumable, Furniture, Ring, Fishing, Lighting, WildSeeds
|
||||
from ..strings.craftable_names import Consumable, Ring, Fishing, Lighting, WildSeeds
|
||||
from ..strings.crop_names import Fruit, Vegetable
|
||||
from ..strings.currency_names import Currency
|
||||
from ..strings.decoration_names import Decoration
|
||||
@@ -96,7 +94,7 @@ class StardewLogic(ReceivedLogicMixin, HasLogicMixin, RegionLogicMixin, Travelin
|
||||
CombatLogicMixin, MagicLogicMixin, MonsterLogicMixin, ToolLogicMixin, PetLogicMixin, QualityLogicMixin,
|
||||
SkillLogicMixin, FarmingLogicMixin, BundleLogicMixin, FishingLogicMixin, MineLogicMixin, CookingLogicMixin, AbilityLogicMixin,
|
||||
SpecialOrderLogicMixin, QuestLogicMixin, CraftingLogicMixin, ModLogicMixin, HarvestingLogicMixin, SourceLogicMixin,
|
||||
RequirementLogicMixin, BookLogicMixin, GrindLogicMixin):
|
||||
RequirementLogicMixin, BookLogicMixin, GrindLogicMixin, WalnutLogicMixin):
|
||||
player: int
|
||||
options: StardewValleyOptions
|
||||
content: StardewContent
|
||||
@@ -461,32 +459,6 @@ class StardewLogic(ReceivedLogicMixin, HasLogicMixin, RegionLogicMixin, Travelin
|
||||
def can_smelt(self, item: str) -> StardewRule:
|
||||
return self.has(Machine.furnace) & self.has(item)
|
||||
|
||||
@cached_property
|
||||
def can_start_field_office(self) -> StardewRule:
|
||||
field_office = self.region.can_reach(Region.field_office)
|
||||
professor_snail = self.received("Open Professor Snail Cave")
|
||||
return field_office & professor_snail
|
||||
|
||||
def can_complete_large_animal_collection(self) -> StardewRule:
|
||||
fossils = self.has_all(Fossil.fossilized_leg, Fossil.fossilized_ribs, Fossil.fossilized_skull, Fossil.fossilized_spine, Fossil.fossilized_tail)
|
||||
return self.can_start_field_office & fossils
|
||||
|
||||
def can_complete_snake_collection(self) -> StardewRule:
|
||||
fossils = self.has_all(Fossil.snake_skull, Fossil.snake_vertebrae)
|
||||
return self.can_start_field_office & fossils
|
||||
|
||||
def can_complete_frog_collection(self) -> StardewRule:
|
||||
fossils = self.has_all(Fossil.mummified_frog)
|
||||
return self.can_start_field_office & fossils
|
||||
|
||||
def can_complete_bat_collection(self) -> StardewRule:
|
||||
fossils = self.has_all(Fossil.mummified_bat)
|
||||
return self.can_start_field_office & fossils
|
||||
|
||||
def can_complete_field_office(self) -> StardewRule:
|
||||
return self.can_complete_large_animal_collection() & self.can_complete_snake_collection() & \
|
||||
self.can_complete_frog_collection() & self.can_complete_bat_collection()
|
||||
|
||||
def can_finish_grandpa_evaluation(self) -> StardewRule:
|
||||
# https://stardewvalleywiki.com/Grandpa
|
||||
rules_worth_a_point = [
|
||||
@@ -566,86 +538,6 @@ class StardewLogic(ReceivedLogicMixin, HasLogicMixin, RegionLogicMixin, Travelin
|
||||
return False_()
|
||||
return self.region.can_reach(Region.island_trader)
|
||||
|
||||
def has_walnut(self, number: int) -> StardewRule:
|
||||
if self.options.exclude_ginger_island == ExcludeGingerIsland.option_true:
|
||||
return False_()
|
||||
if number <= 0:
|
||||
return True_()
|
||||
|
||||
if self.options.walnutsanity == Walnutsanity.preset_none:
|
||||
return self.can_get_walnuts(number)
|
||||
if self.options.walnutsanity == Walnutsanity.preset_all:
|
||||
return self.has_received_walnuts(number)
|
||||
puzzle_walnuts = 61
|
||||
bush_walnuts = 25
|
||||
dig_walnuts = 18
|
||||
repeatable_walnuts = 33
|
||||
total_walnuts = puzzle_walnuts + bush_walnuts + dig_walnuts + repeatable_walnuts
|
||||
walnuts_to_receive = 0
|
||||
walnuts_to_collect = number
|
||||
if OptionName.walnutsanity_puzzles in self.options.walnutsanity:
|
||||
puzzle_walnut_rate = puzzle_walnuts / total_walnuts
|
||||
puzzle_walnuts_required = round(puzzle_walnut_rate * number)
|
||||
walnuts_to_receive += puzzle_walnuts_required
|
||||
walnuts_to_collect -= puzzle_walnuts_required
|
||||
if OptionName.walnutsanity_bushes in self.options.walnutsanity:
|
||||
bush_walnuts_rate = bush_walnuts / total_walnuts
|
||||
bush_walnuts_required = round(bush_walnuts_rate * number)
|
||||
walnuts_to_receive += bush_walnuts_required
|
||||
walnuts_to_collect -= bush_walnuts_required
|
||||
if OptionName.walnutsanity_dig_spots in self.options.walnutsanity:
|
||||
dig_walnuts_rate = dig_walnuts / total_walnuts
|
||||
dig_walnuts_required = round(dig_walnuts_rate * number)
|
||||
walnuts_to_receive += dig_walnuts_required
|
||||
walnuts_to_collect -= dig_walnuts_required
|
||||
if OptionName.walnutsanity_repeatables in self.options.walnutsanity:
|
||||
repeatable_walnuts_rate = repeatable_walnuts / total_walnuts
|
||||
repeatable_walnuts_required = round(repeatable_walnuts_rate * number)
|
||||
walnuts_to_receive += repeatable_walnuts_required
|
||||
walnuts_to_collect -= repeatable_walnuts_required
|
||||
return self.has_received_walnuts(walnuts_to_receive) & self.can_get_walnuts(walnuts_to_collect)
|
||||
|
||||
def has_received_walnuts(self, number: int) -> StardewRule:
|
||||
return self.received(Event.received_walnuts, number)
|
||||
|
||||
def can_get_walnuts(self, number: int) -> StardewRule:
|
||||
# https://stardewcommunitywiki.com/Golden_Walnut#Walnut_Locations
|
||||
reach_south = self.region.can_reach(Region.island_south)
|
||||
reach_north = self.region.can_reach(Region.island_north)
|
||||
reach_west = self.region.can_reach(Region.island_west)
|
||||
reach_hut = self.region.can_reach(Region.leo_hut)
|
||||
reach_southeast = self.region.can_reach(Region.island_south_east)
|
||||
reach_field_office = self.region.can_reach(Region.field_office)
|
||||
reach_pirate_cove = self.region.can_reach(Region.pirate_cove)
|
||||
reach_outside_areas = self.logic.and_(reach_south, reach_north, reach_west, reach_hut)
|
||||
reach_volcano_regions = [self.region.can_reach(Region.volcano),
|
||||
self.region.can_reach(Region.volcano_secret_beach),
|
||||
self.region.can_reach(Region.volcano_floor_5),
|
||||
self.region.can_reach(Region.volcano_floor_10)]
|
||||
reach_volcano = self.logic.or_(*reach_volcano_regions)
|
||||
reach_all_volcano = self.logic.and_(*reach_volcano_regions)
|
||||
reach_walnut_regions = [reach_south, reach_north, reach_west, reach_volcano, reach_field_office]
|
||||
reach_caves = self.logic.and_(self.region.can_reach(Region.qi_walnut_room), self.region.can_reach(Region.dig_site),
|
||||
self.region.can_reach(Region.gourmand_frog_cave),
|
||||
self.region.can_reach(Region.colored_crystals_cave),
|
||||
self.region.can_reach(Region.shipwreck), self.combat.has_slingshot)
|
||||
reach_entire_island = self.logic.and_(reach_outside_areas, reach_all_volcano,
|
||||
reach_caves, reach_southeast, reach_field_office, reach_pirate_cove)
|
||||
if number <= 5:
|
||||
return self.logic.or_(reach_south, reach_north, reach_west, reach_volcano)
|
||||
if number <= 10:
|
||||
return self.count(2, *reach_walnut_regions)
|
||||
if number <= 15:
|
||||
return self.count(3, *reach_walnut_regions)
|
||||
if number <= 20:
|
||||
return self.logic.and_(*reach_walnut_regions)
|
||||
if number <= 50:
|
||||
return reach_entire_island
|
||||
gems = (Mineral.amethyst, Mineral.aquamarine, Mineral.emerald, Mineral.ruby, Mineral.topaz)
|
||||
return reach_entire_island & self.has(Fruit.banana) & self.has_all(*gems) & self.ability.can_mine_perfectly() & \
|
||||
self.ability.can_fish_perfectly() & self.has(Furniture.flute_block) & self.has(Seed.melon) & self.has(Seed.wheat) & self.has(Seed.garlic) & \
|
||||
self.can_complete_field_office()
|
||||
|
||||
def has_all_stardrops(self) -> StardewRule:
|
||||
other_rules = []
|
||||
number_of_stardrops_to_receive = 0
|
||||
|
||||
Reference in New Issue
Block a user