Stardew Valley: Fix potential soft lock with vanilla tools and entrance randomizer + Performance improvement for vanilla tool/skills (#3002)
* fix vanilla tool fishing rod requiring metal bars fix vanilla skill requiring previous level (it's always the same rule or more restrictive) * add test to ensure fishing rod need fish shop * fishing rod should be indexed from 0 like a mentally sane person would do. * fishing rod 0 isn't real, but it definitely can hurt you. * reeeeeeeee
This commit is contained in:
@@ -8,6 +8,7 @@ from ..options import ToolProgression, BuildingProgression, ExcludeGingerIsland,
|
||||
FriendsanityHeartSize, BundleRandomization, SkillProgression
|
||||
from ..strings.entrance_names import Entrance
|
||||
from ..strings.region_names import Region
|
||||
from ..strings.tool_names import Tool, ToolMaterial
|
||||
|
||||
|
||||
class TestProgressiveToolsLogic(SVTestBase):
|
||||
@@ -596,6 +597,54 @@ def swap_museum_and_bathhouse(multiworld, player):
|
||||
bathhouse_entrance.connect(museum_region)
|
||||
|
||||
|
||||
class TestToolVanillaRequiresBlacksmith(SVTestBase):
|
||||
options = {
|
||||
options.EntranceRandomization: options.EntranceRandomization.option_buildings,
|
||||
options.ToolProgression: options.ToolProgression.option_vanilla,
|
||||
}
|
||||
seed = 4111845104987680262
|
||||
|
||||
# Seed is hardcoded to make sure the ER is a valid roll that actually lock the blacksmith behind the Railroad Boulder Removed.
|
||||
|
||||
def test_cannot_get_any_tool_without_blacksmith_access(self):
|
||||
railroad_item = "Railroad Boulder Removed"
|
||||
place_region_at_entrance(self.multiworld, self.player, Region.blacksmith, Entrance.enter_bathhouse_entrance)
|
||||
collect_all_except(self.multiworld, 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_false(self.world.logic.tool.has_tool(tool, material), self.multiworld.state)
|
||||
|
||||
self.multiworld.state.collect(self.world.create_item(railroad_item), event=False)
|
||||
|
||||
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)
|
||||
|
||||
def test_cannot_get_fishing_rod_without_willy_access(self):
|
||||
railroad_item = "Railroad Boulder Removed"
|
||||
place_region_at_entrance(self.multiworld, self.player, Region.fish_shop, Entrance.enter_bathhouse_entrance)
|
||||
collect_all_except(self.multiworld, 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.multiworld.state.collect(self.world.create_item(railroad_item), event=False)
|
||||
|
||||
for fishing_rod_level in [3, 4]:
|
||||
self.assert_rule_true(self.world.logic.tool.has_fishing_rod(fishing_rod_level), self.multiworld.state)
|
||||
|
||||
|
||||
def place_region_at_entrance(multiworld, player, region, entrance):
|
||||
region_to_place = multiworld.get_region(region, player)
|
||||
entrance_to_place_region = multiworld.get_entrance(entrance, player)
|
||||
|
||||
entrance_to_switch = region_to_place.entrances[0]
|
||||
region_to_switch = entrance_to_place_region.connected_region
|
||||
entrance_to_switch.connect(region_to_switch)
|
||||
entrance_to_place_region.connect(region_to_place)
|
||||
|
||||
|
||||
def collect_all_except(multiworld, item_to_not_collect: str):
|
||||
for item in multiworld.get_items():
|
||||
if item.name != item_to_not_collect:
|
||||
|
||||
Reference in New Issue
Block a user