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

@@ -11,7 +11,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertFalse(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_cannot_reach_location("Journey of the Prairie King Victory")
boots = self.create_item("JotPK: Progressive Boots")
gun = self.create_item("JotPK: Progressive Gun")
@@ -24,7 +24,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_cannot_reach_location("Journey of the Prairie King Victory")
self.remove(boots)
self.remove(gun)
@@ -33,7 +33,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_cannot_reach_location("Journey of the Prairie King Victory")
self.remove(boots)
self.remove(boots)
@@ -44,7 +44,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_cannot_reach_location("Journey of the Prairie King Victory")
self.remove(boots)
self.remove(gun)
self.remove(ammo)
@@ -60,7 +60,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertFalse(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_cannot_reach_location("Journey of the Prairie King Victory")
self.remove(boots)
self.remove(gun)
self.remove(gun)
@@ -83,7 +83,7 @@ class TestArcadeMachinesLogic(SVTestBase):
self.assertTrue(self.world.logic.region.can_reach("JotPK World 1")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach("JotPK World 2")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach("JotPK World 3")(self.multiworld.state))
self.assertTrue(self.world.logic.region.can_reach_location("Journey of the Prairie King Victory")(self.multiworld.state))
self.assert_can_reach_location("Journey of the Prairie King Victory")
self.remove(boots)
self.remove(boots)
self.remove(gun)

View File

@@ -7,18 +7,15 @@ 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)
location = self.multiworld.get_location("Read Mapping Cave Systems", self.player)
self.assert_cannot_reach_location(location, self.multiworld.state)
def test_can_get_mapping_cave_systems_with_weapon_and_time(self):
self.collect_months(12)
self.assert_cannot_reach_location("Read Mapping Cave Systems")
self.collect("Progressive Mine Elevator")
self.collect("Progressive Mine Elevator")
self.collect("Progressive Mine Elevator")
self.collect("Progressive Mine Elevator")
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location("Read Mapping Cave Systems")
self.collect("Progressive Weapon")
self.assert_can_reach_location(location, self.multiworld.state)
self.assert_can_reach_location("Read Mapping Cave Systems")

View File

@@ -9,45 +9,37 @@ class TestBuildingLogic(SVTestBase):
}
def test_coop_blueprint(self):
self.assertFalse(self.world.logic.region.can_reach_location("Coop Blueprint")(self.multiworld.state))
self.assert_cannot_reach_location("Coop Blueprint")
self.collect_lots_of_money()
self.assertTrue(self.world.logic.region.can_reach_location("Coop Blueprint")(self.multiworld.state))
self.assert_can_reach_location("Coop Blueprint")
def test_big_coop_blueprint(self):
big_coop_blueprint_rule = self.world.logic.region.can_reach_location("Big Coop Blueprint")
self.assertFalse(big_coop_blueprint_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}")
self.assert_cannot_reach_location("Big Coop Blueprint")
self.collect_lots_of_money()
self.assertFalse(big_coop_blueprint_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}")
self.assert_cannot_reach_location("Big Coop Blueprint")
self.multiworld.state.collect(self.create_item("Progressive Coop"))
self.assertTrue(big_coop_blueprint_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Coop Blueprint', self.player).access_rule)}")
self.assert_can_reach_location("Big Coop Blueprint")
def test_deluxe_coop_blueprint(self):
self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state))
self.assert_cannot_reach_location("Deluxe Coop Blueprint")
self.collect_lots_of_money()
self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state))
self.assert_cannot_reach_location("Deluxe Coop Blueprint")
self.multiworld.state.collect(self.create_item("Progressive Coop"))
self.assertFalse(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state))
self.assert_cannot_reach_location("Deluxe Coop Blueprint")
self.multiworld.state.collect(self.create_item("Progressive Coop"))
self.assertTrue(self.world.logic.region.can_reach_location("Deluxe Coop Blueprint")(self.multiworld.state))
self.assert_can_reach_location("Deluxe Coop Blueprint")
def test_big_shed_blueprint(self):
big_shed_rule = self.world.logic.region.can_reach_location("Big Shed Blueprint")
self.assertFalse(big_shed_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}")
self.assert_cannot_reach_location("Big Shed Blueprint")
self.collect_lots_of_money()
self.assertFalse(big_shed_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}")
self.assert_cannot_reach_location("Big Shed Blueprint")
self.multiworld.state.collect(self.create_item("Progressive Shed"))
self.assertTrue(big_shed_rule(self.multiworld.state),
f"Rule is {repr(self.multiworld.get_location('Big Shed Blueprint', self.player).access_rule)}")
self.assert_can_reach_location("Big Shed Blueprint")

View File

@@ -11,10 +11,10 @@ class TestBundlesLogic(SVTestBase):
}
def test_vault_2500g_bundle(self):
self.assertFalse(self.world.logic.region.can_reach_location("2,500g Bundle")(self.multiworld.state))
self.assert_cannot_reach_location("2,500g Bundle")
self.collect_lots_of_money()
self.assertTrue(self.world.logic.region.can_reach_location("2,500g Bundle")(self.multiworld.state))
self.assert_can_reach_location("2,500g Bundle")
class TestRemixedBundlesLogic(SVTestBase):
@@ -25,10 +25,10 @@ class TestRemixedBundlesLogic(SVTestBase):
}
def test_sticky_bundle_has_grind_rules(self):
self.assertFalse(self.world.logic.region.can_reach_location("Sticky Bundle")(self.multiworld.state))
self.assert_cannot_reach_location("Sticky Bundle")
self.collect_all_the_money()
self.assertTrue(self.world.logic.region.can_reach_location("Sticky Bundle")(self.multiworld.state))
self.assert_can_reach_location("Sticky Bundle")
class TestRaccoonBundlesLogic(SVTestBase):
@@ -40,11 +40,6 @@ class TestRaccoonBundlesLogic(SVTestBase):
seed = 2 # Magic seed that does what I want. Might need to get changed if we change the randomness behavior of raccoon bundles
def test_raccoon_bundles_rely_on_previous_ones(self):
# The first raccoon bundle is a fishing one
raccoon_rule_1 = self.world.logic.region.can_reach_location("Raccoon Request 1")
# The 3th raccoon bundle is a foraging one
raccoon_rule_3 = self.world.logic.region.can_reach_location("Raccoon Request 3")
self.collect("Progressive Raccoon", 6)
self.collect("Progressive Mine Elevator", 24)
self.collect("Mining Level", 12)
@@ -58,10 +53,12 @@ class TestRaccoonBundlesLogic(SVTestBase):
self.collect("Fishing Level", 10)
self.collect("Furnace Recipe")
self.assertFalse(raccoon_rule_1(self.multiworld.state))
self.assertFalse(raccoon_rule_3(self.multiworld.state))
# The first raccoon bundle is a fishing one
self.assert_cannot_reach_location("Raccoon Request 1")
# The third raccoon bundle is a foraging one
self.assert_cannot_reach_location("Raccoon Request 3")
self.collect("Fish Smoker Recipe")
self.assertTrue(raccoon_rule_1(self.multiworld.state))
self.assertTrue(raccoon_rule_3(self.multiworld.state))
self.assert_can_reach_location("Raccoon Request 1")
self.assert_can_reach_location("Raccoon Request 3")

View File

@@ -14,18 +14,17 @@ class TestRecipeLearnLogic(SVTestBase):
def test_can_learn_qos_recipe(self):
location = "Cook Radish Salad"
rule = self.world.logic.region.can_reach_location(location)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.collect(self.create_item("Progressive House"))
self.multiworld.state.collect(self.create_item("Radish Seeds"))
self.multiworld.state.collect(self.create_item("Spring"))
self.multiworld.state.collect(self.create_item("Summer"))
self.collect_lots_of_money()
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.collect(self.create_item("The Queen of Sauce"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location(location)
class TestRecipeReceiveLogic(SVTestBase):
@@ -39,34 +38,32 @@ class TestRecipeReceiveLogic(SVTestBase):
def test_can_learn_qos_recipe(self):
location = "Cook Radish Salad"
rule = self.world.logic.region.can_reach_location(location)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.collect(self.create_item("Progressive House"))
self.multiworld.state.collect(self.create_item("Radish Seeds"))
self.multiworld.state.collect(self.create_item("Summer"))
self.collect_lots_of_money()
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
spring = self.create_item("Spring")
qos = self.create_item("The Queen of Sauce")
self.multiworld.state.collect(spring)
self.multiworld.state.collect(qos)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.remove(spring)
self.multiworld.state.remove(qos)
self.multiworld.state.collect(self.create_item("Radish Salad Recipe"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location(location)
def test_get_chefsanity_check_recipe(self):
location = "Radish Salad Recipe"
rule = self.world.logic.region.can_reach_location(location)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.collect(self.create_item("Spring"))
self.collect_lots_of_money()
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
seeds = self.create_item("Radish Seeds")
summer = self.create_item("Summer")
@@ -74,10 +71,10 @@ class TestRecipeReceiveLogic(SVTestBase):
self.multiworld.state.collect(seeds)
self.multiworld.state.collect(summer)
self.multiworld.state.collect(house)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location(location)
self.multiworld.state.remove(seeds)
self.multiworld.state.remove(summer)
self.multiworld.state.remove(house)
self.multiworld.state.collect(self.create_item("The Queen of Sauce"))
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location(location)

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)

View File

@@ -16,12 +16,12 @@ class TestDonationLogicAll(SVTestBase):
self.collect_all_except(railroad_item)
for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]:
self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_cannot_reach_location(donation.name)
self.multiworld.state.collect(self.create_item(railroad_item))
for donation in locations_by_tag[LocationTags.MUSEUM_DONATIONS]:
self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_can_reach_location(donation.name)
class TestDonationLogicRandomized(SVTestBase):
@@ -37,12 +37,12 @@ class TestDonationLogicRandomized(SVTestBase):
LocationTags.MUSEUM_DONATIONS in location_table[location.name].tags]
for donation in donation_locations:
self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_cannot_reach_location(donation.name)
self.multiworld.state.collect(self.create_item(railroad_item))
for donation in donation_locations:
self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_can_reach_location(donation.name)
class TestDonationLogicMilestones(SVTestBase):
@@ -56,12 +56,12 @@ class TestDonationLogicMilestones(SVTestBase):
self.collect_all_except(railroad_item)
for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]:
self.assertFalse(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_cannot_reach_location(donation.name)
self.multiworld.state.collect(self.create_item(railroad_item))
for donation in locations_by_tag[LocationTags.MUSEUM_MILESTONES]:
self.assertTrue(self.world.logic.region.can_reach_location(donation.name)(self.multiworld.state))
self.assert_can_reach_location(donation.name)
def swap_museum_and_bathhouse(multiworld, player):

View File

@@ -42,19 +42,18 @@ class TestNeedRegionToCatchFish(SVTestBase):
with self.subTest(f"Region rules for {fish}"):
self.collect_all_the_money()
item_names = fish_and_items[fish]
location = self.multiworld.get_location(f"Fishsanity: {fish}", self.player)
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location(f"Fishsanity: {fish}")
items = []
for item_name in item_names:
items.append(self.collect(item_name))
with self.subTest(f"{fish} can be reached with {item_names}"):
self.assert_can_reach_location(location, self.multiworld.state)
self.assert_can_reach_location(f"Fishsanity: {fish}")
for item_required in items:
self.multiworld.state = self.original_state.copy()
with self.subTest(f"{fish} requires {item_required.name}"):
for item_to_collect in items:
if item_to_collect.name != item_required.name:
self.collect(item_to_collect)
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location(f"Fishsanity: {fish}")
self.multiworld.state = self.original_state.copy()

View File

@@ -47,12 +47,8 @@ class TestFriendsanityDatingRules(SVTestBase):
for i in range(1, max_reachable + 1):
if i % step != 0 and i != 14:
continue
location = f"{prefix}{npc} {i}{suffix}"
can_reach = self.world.logic.region.can_reach_location(location)(self.multiworld.state)
self.assertTrue(can_reach, f"Should be able to earn relationship up to {i} hearts")
self.assert_can_reach_location(f"{prefix}{npc} {i}{suffix}")
for i in range(max_reachable + 1, 14 + 1):
if i % step != 0 and i != 14:
continue
location = f"{prefix}{npc} {i}{suffix}"
can_reach = self.world.logic.region.can_reach_location(location)(self.multiworld.state)
self.assertFalse(can_reach, f"Should not be able to earn relationship up to {i} hearts")
self.assert_cannot_reach_location(f"{prefix}{npc} {i}{suffix}")

View File

@@ -76,10 +76,8 @@ class TestShipsanityEverything(SVTestBase):
for location in shipsanity_locations:
with self.subTest(location.name):
self.assertFalse(self.world.logic.region.can_reach_location(location.name)(self.multiworld.state))
self.assert_cannot_reach_location(location.name)
self.collect(bin_item)
shipsanity_rule = self.world.logic.region.can_reach_location(location.name)
self.assert_rule_true(shipsanity_rule, self.multiworld.state)
self.assert_can_reach_location(location.name)
self.remove(bin_item)

View File

@@ -35,14 +35,13 @@ class TestSkillProgressionProgressive(SVTestBase):
for level in range(1, 11):
location_name = f"Level {level} {skill}"
location = self.multiworld.get_location(location_name, self.player)
with self.subTest(location_name):
if level > 1:
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location(location_name)
self.collect(f"{skill} Level")
self.assert_can_reach_location(location, self.multiworld.state)
self.assert_can_reach_location(location_name)
self.reset_collection_state()
@@ -87,8 +86,7 @@ class TestSkillProgressionProgressiveWithMasteryWithoutMods(SVTestBase):
for skill in all_vanilla_skills:
with self.subTest(skill):
location = self.multiworld.get_location(f"{skill} Mastery", self.player)
self.assert_can_reach_location(location, self.multiworld.state)
self.assert_can_reach_location(f"{skill} Mastery")
self.reset_collection_state()
@@ -98,8 +96,7 @@ class TestSkillProgressionProgressiveWithMasteryWithoutMods(SVTestBase):
self.collect_everything()
self.remove_one_by_name(f"{skill} Level")
location = self.multiworld.get_location(f"{skill} Mastery", self.player)
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location(f"{skill} Mastery")
self.reset_collection_state()
@@ -107,7 +104,6 @@ class TestSkillProgressionProgressiveWithMasteryWithoutMods(SVTestBase):
self.collect_everything()
self.remove_one_by_name(f"Progressive Pickaxe")
location = self.multiworld.get_location("Mining Mastery", self.player)
self.assert_cannot_reach_location(location, self.multiworld.state)
self.assert_cannot_reach_location("Mining Mastery")
self.reset_collection_state()

View File

@@ -18,37 +18,37 @@ class TestProgressiveToolsLogic(SVTestBase):
self.multiworld.state.prog_items = {1: Counter()}
sturgeon_rule = self.world.logic.has("Sturgeon")
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
summer = self.create_item("Summer")
self.multiworld.state.collect(summer)
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
fishing_rod = self.create_item("Progressive Fishing Rod")
self.multiworld.state.collect(fishing_rod)
self.multiworld.state.collect(fishing_rod)
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
fishing_level = self.create_item("Fishing Level")
self.multiworld.state.collect(fishing_level)
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
self.multiworld.state.collect(fishing_level)
self.multiworld.state.collect(fishing_level)
self.multiworld.state.collect(fishing_level)
self.multiworld.state.collect(fishing_level)
self.multiworld.state.collect(fishing_level)
self.assert_rule_true(sturgeon_rule, self.multiworld.state)
self.assert_rule_true(sturgeon_rule)
self.remove(summer)
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
winter = self.create_item("Winter")
self.multiworld.state.collect(winter)
self.assert_rule_true(sturgeon_rule, self.multiworld.state)
self.assert_rule_true(sturgeon_rule)
self.remove(fishing_rod)
self.assert_rule_false(sturgeon_rule, self.multiworld.state)
self.assert_rule_false(sturgeon_rule)
def test_old_master_cannoli(self):
self.multiworld.state.prog_items = {1: Counter()}
@@ -58,35 +58,34 @@ class TestProgressiveToolsLogic(SVTestBase):
self.multiworld.state.collect(self.create_item("Summer"))
self.collect_lots_of_money()
rule = self.world.logic.region.can_reach_location("Old Master Cannoli")
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
fall = self.create_item("Fall")
self.multiworld.state.collect(fall)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
tuesday = self.create_item("Traveling Merchant: Tuesday")
self.multiworld.state.collect(tuesday)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
rare_seed = self.create_item("Rare Seed")
self.multiworld.state.collect(rare_seed)
self.assert_rule_true(rule, self.multiworld.state)
self.assert_can_reach_location("Old Master Cannoli")
self.remove(fall)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
self.remove(tuesday)
green_house = self.create_item("Greenhouse")
self.multiworld.state.collect(green_house)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
friday = self.create_item("Traveling Merchant: Friday")
self.multiworld.state.collect(friday)
self.assertTrue(self.multiworld.get_location("Old Master Cannoli", 1).access_rule(self.multiworld.state))
self.assert_can_reach_location("Old Master Cannoli")
self.remove(green_house)
self.assert_rule_false(rule, self.multiworld.state)
self.assert_cannot_reach_location("Old Master Cannoli")
self.remove(friday)
@@ -106,13 +105,13 @@ class TestToolVanillaRequiresBlacksmith(SVTestBase):
for tool in [Tool.pickaxe, Tool.axe, Tool.hoe, Tool.trash_can, Tool.watering_can]:
for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]:
self.assert_rule_false(self.world.logic.tool.has_tool(tool, material), self.multiworld.state)
self.assert_rule_false(self.world.logic.tool.has_tool(tool, material))
self.multiworld.state.collect(self.create_item(railroad_item))
for tool in [Tool.pickaxe, Tool.axe, Tool.hoe, Tool.trash_can, Tool.watering_can]:
for material in [ToolMaterial.copper, ToolMaterial.iron, ToolMaterial.gold, ToolMaterial.iridium]:
self.assert_rule_true(self.world.logic.tool.has_tool(tool, material), self.multiworld.state)
self.assert_rule_true(self.world.logic.tool.has_tool(tool, material))
def test_cannot_get_fishing_rod_without_willy_access(self):
railroad_item = "Railroad Boulder Removed"
@@ -120,12 +119,12 @@ class TestToolVanillaRequiresBlacksmith(SVTestBase):
self.collect_all_except(railroad_item)
for fishing_rod_level in [3, 4]:
self.assert_rule_false(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state)
self.assert_rule_false(self.world.logic.tool.has_fishing_rod(fishing_rod_level))
self.multiworld.state.collect(self.create_item(railroad_item))
for fishing_rod_level in [3, 4]:
self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state)
self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level))
def place_region_at_entrance(multiworld, player, region, entrance):