Skip to content

Commit

Permalink
properly split rule for mapping cave systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouramie committed Dec 1, 2024
1 parent 5fd6088 commit 66ec922
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 3 additions & 4 deletions worlds/stardew_valley/content/vanilla/pelican_town.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ...data.building import Building
from ...data.game_item import GenericSource, ItemTag, Tag, CustomRuleSource
from ...data.harvest import ForagingSource, SeasonalForagingSource, ArtifactSpotSource
from ...data.requirement import ToolRequirement, BookRequirement, SkillRequirement, RegionRequirement
from ...data.requirement import ToolRequirement, BookRequirement, SkillRequirement
from ...data.shop import ShopSource, MysteryBoxSource, ArtifactTroveSource, PrizeMachineSource, FishingTreasureChestSource
from ...strings.artisan_good_names import ArtisanGood
from ...strings.book_names import Book
Expand Down Expand Up @@ -233,9 +233,8 @@
ShopSource(money_price=20000, shop_region=LogicRegion.bookseller_3),),
Book.mapping_cave_systems: (
Tag(ItemTag.BOOK, ItemTag.BOOK_POWER),
ShopSource(money_price=20000,
shop_region=LogicRegion.bookseller_3,
other_requirements=(RegionRequirement(Region.adventurer_guild_bedroom),)),
GenericSource(regions=(Region.adventurer_guild_bedroom,)),
ShopSource(money_price=20000, shop_region=LogicRegion.bookseller_3),
),
Book.monster_compendium: (
Tag(ItemTag.BOOK, ItemTag.BOOK_POWER),
Expand Down
7 changes: 7 additions & 0 deletions worlds/stardew_valley/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from worlds.AutoWorld import call_all
from .assertion import RuleAssertMixin
from .. import StardewValleyWorld, options, StardewItem, StardewRule
from ..logic.time_logic import MONTH_COEFFICIENT
from ..options import StardewValleyOptions, StardewValleyOption

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -255,6 +256,12 @@ def run_default_tests(self) -> bool:
return False
return super().run_default_tests

def collect_months(self, months: int):
real_total_prog_items = self.world.total_progression_items
percent = months * MONTH_COEFFICIENT
self.collect("Stardrop", real_total_prog_items * 100 // percent)
self.world.total_progression_items = real_total_prog_items

def collect_lots_of_money(self, percent: float = 0.25):
self.collect("Shipping Bin")
real_total_prog_items = self.world.total_progression_items
Expand Down
9 changes: 6 additions & 3 deletions worlds/stardew_valley/test/rules/TestBooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ class TestBooksLogic(SVTestBase):
options.Booksanity.internal_name: options.Booksanity.option_all,
}

def test_need_weapon_for_mapping_cave_systems(self):
self.collect_lots_of_money(0.5)

def test_can_get_mapping_cave_systems_with_weapon_and_time(self):
self.collect_months(12)
self.assert_location_cannot_be_reached("Read Mapping Cave Systems")

self.collect("Progressive Mine Elevator")
Expand All @@ -20,3 +19,7 @@ def test_need_weapon_for_mapping_cave_systems(self):

self.collect("Progressive Weapon")
self.assert_location_can_be_reached("Read Mapping Cave Systems")

def test_can_get_mapping_cave_systems_with_money(self):
self.collect_lots_of_money(0.5)
self.assert_location_can_be_reached("Read Mapping Cave Systems")

0 comments on commit 66ec922

Please sign in to comment.