Stardew Valley: Refactor buildings to use content packs (#4239)

* create building data object and rename ItemSource to Source to be more generic

# Conflicts:
#	worlds/stardew_valley/content/game_content.py

# Conflicts:
#	worlds/stardew_valley/data/artisan.py
#	worlds/stardew_valley/data/game_item.py
#	worlds/stardew_valley/data/harvest.py
#	worlds/stardew_valley/data/shop.py

* remove compound sources, replace by other requirements which already handle this usecase

* add coops to content packs

* add building progression in game features

* add shippping bin to starting building; remove has_house

* replace config check with feature

* add other buildings in content packs

* not passing

* tests passes, unbelievable

* use newly create methods more

* use new assets to ease readability

* self review

* fix flake8 maybe

* properly split rule for mapping cave systems

* fix tractor garage name

* self review

* add upgrade_from to farm house buldings

* don't override building name variable in logic

* remove has_group from buildings

* mark some items easy in grinding logic so blueprints buildings can be in more early spheres

* move stuff around to maybe avoid future conflicts cuz I have like 10 PRs opened right now

* remove price_multiplier, turns out it's unused during generation

* disable shop source for mapping cave systems

* bunch of code review changes

* add petbowl and farmhouse to autobuilding

* set min easy items to 300

* fix farm type
This commit is contained in:
Jérémie Bolduc
2025-04-08 12:37:45 -04:00
committed by GitHub
parent 286e24629f
commit 9ac921380f
56 changed files with 757 additions and 460 deletions

View File

@@ -13,8 +13,6 @@ class TestCraftsanityLogic(SVTestBase):
}
def test_can_craft_recipe(self):
location = "Craft Marble Brazier"
rule = self.world.logic.region.can_reach_location(location)
self.collect([self.create_item("Progressive Pickaxe")] * 4)
self.collect([self.create_item("Progressive Fishing Rod")] * 4)
self.collect([self.create_item("Progressive Sword")] * 4)
@@ -23,18 +21,16 @@ class TestCraftsanityLogic(SVTestBase):
self.collect([self.create_item("Combat Level")] * 10)
self.collect([self.create_item("Fishing Level")] * 10)
self.collect_all_the_money()
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Craft Marble Brazier")
self.multiworld.state.collect(self.create_item("Marble Brazier Recipe"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location("Craft Marble Brazier")
def test_can_learn_crafting_recipe(self):
location = "Marble Brazier Recipe"
rule = self.world.logic.region.can_reach_location(location)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Marble Brazier Recipe")
self.collect_lots_of_money()
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location("Marble Brazier Recipe")
def test_can_craft_festival_recipe(self):
recipe = all_crafting_recipes_by_name["Jack-O-Lantern"]
@@ -42,13 +38,13 @@ class TestCraftsanityLogic(SVTestBase):
self.multiworld.state.collect(self.create_item("Torch Recipe"))
self.collect_lots_of_money()
rule = self.world.logic.crafting.can_craft(recipe)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_rule_false(rule)
self.multiworld.state.collect(self.create_item("Fall"))
self.assert_rule_false(rule, self.multiworld.state)
self.assert_rule_false(rule)
self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_rule_true(rule)
def test_require_furnace_recipe_for_smelting_checks(self):
locations = ["Craft Furnace", "Smelting", "Copper Pickaxe Upgrade", "Gold Trash Can Upgrade"]
@@ -83,13 +79,13 @@ class TestCraftsanityWithFestivalsLogic(SVTestBase):
self.multiworld.state.collect(self.create_item("Fall"))
self.collect_lots_of_money()
rule = self.world.logic.crafting.can_craft(recipe)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_rule_false(rule)
self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"))
self.assert_rule_false(rule, self.multiworld.state)
self.assert_rule_false(rule)
self.multiworld.state.collect(self.create_item("Torch Recipe"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_rule_true(rule)
class TestNoCraftsanityLogic(SVTestBase):
@@ -105,7 +101,7 @@ class TestNoCraftsanityLogic(SVTestBase):
def test_can_craft_recipe(self):
recipe = all_crafting_recipes_by_name["Wood Floor"]
rule = self.world.logic.crafting.can_craft(recipe)
self.assert_rule_true(rule, self.multiworld.state)
self.assert_rule_true(rule)
def test_can_craft_festival_recipe(self):
recipe = all_crafting_recipes_by_name["Jack-O-Lantern"]
@@ -116,7 +112,7 @@ class TestNoCraftsanityLogic(SVTestBase):
self.assertFalse(result)
self.collect([self.create_item("Progressive Season")] * 2)
self.assert_rule_true(rule, self.multiworld.state)
self.assert_rule_true(rule)
def test_requires_mining_levels_for_smelting_checks(self):
locations = ["Smelting", "Copper Pickaxe Upgrade", "Gold Trash Can Upgrade"]
@@ -151,7 +147,7 @@ class TestNoCraftsanityWithFestivalsLogic(SVTestBase):
self.multiworld.state.collect(self.create_item("Fall"))
self.collect_lots_of_money()
rule = self.world.logic.crafting.can_craft(recipe)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_rule_false(rule)
self.multiworld.state.collect(self.create_item("Jack-O-Lantern Recipe"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_rule_true(rule)