 9ac921380f
			
		
	
	9ac921380f
	
	
	
		
			
			* 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
		
			
				
	
	
		
			138 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			138 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from collections import Counter
 | |
| 
 | |
| from .. import SVTestBase
 | |
| from ... import options
 | |
| from ...options import ToolProgression, SeasonRandomization
 | |
| from ...strings.entrance_names import Entrance
 | |
| from ...strings.region_names import Region
 | |
| from ...strings.tool_names import Tool, ToolMaterial
 | |
| 
 | |
| 
 | |
| class TestProgressiveToolsLogic(SVTestBase):
 | |
|     options = {
 | |
|         ToolProgression.internal_name: ToolProgression.option_progressive,
 | |
|         SeasonRandomization.internal_name: SeasonRandomization.option_randomized,
 | |
|     }
 | |
| 
 | |
|     def test_sturgeon(self):
 | |
|         self.multiworld.state.prog_items = {1: Counter()}
 | |
| 
 | |
|         sturgeon_rule = self.world.logic.has("Sturgeon")
 | |
|         self.assert_rule_false(sturgeon_rule)
 | |
| 
 | |
|         summer = self.create_item("Summer")
 | |
|         self.multiworld.state.collect(summer)
 | |
|         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)
 | |
| 
 | |
|         fishing_level = self.create_item("Fishing Level")
 | |
|         self.multiworld.state.collect(fishing_level)
 | |
|         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.remove(summer)
 | |
|         self.assert_rule_false(sturgeon_rule)
 | |
| 
 | |
|         winter = self.create_item("Winter")
 | |
|         self.multiworld.state.collect(winter)
 | |
|         self.assert_rule_true(sturgeon_rule)
 | |
| 
 | |
|         self.remove(fishing_rod)
 | |
|         self.assert_rule_false(sturgeon_rule)
 | |
| 
 | |
|     def test_old_master_cannoli(self):
 | |
|         self.multiworld.state.prog_items = {1: Counter()}
 | |
| 
 | |
|         self.multiworld.state.collect(self.create_item("Progressive Axe"))
 | |
|         self.multiworld.state.collect(self.create_item("Progressive Axe"))
 | |
|         self.multiworld.state.collect(self.create_item("Summer"))
 | |
|         self.collect_lots_of_money()
 | |
| 
 | |
|         self.assert_cannot_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         fall = self.create_item("Fall")
 | |
|         self.multiworld.state.collect(fall)
 | |
|         self.assert_cannot_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         tuesday = self.create_item("Traveling Merchant: Tuesday")
 | |
|         self.multiworld.state.collect(tuesday)
 | |
|         self.assert_cannot_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         rare_seed = self.create_item("Rare Seed")
 | |
|         self.multiworld.state.collect(rare_seed)
 | |
|         self.assert_can_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         self.remove(fall)
 | |
|         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_cannot_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         friday = self.create_item("Traveling Merchant: Friday")
 | |
|         self.multiworld.state.collect(friday)
 | |
|         self.assert_can_reach_location("Old Master Cannoli")
 | |
| 
 | |
|         self.remove(green_house)
 | |
|         self.assert_cannot_reach_location("Old Master Cannoli")
 | |
|         self.remove(friday)
 | |
| 
 | |
| 
 | |
| 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)
 | |
|         self.collect_all_except(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.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))
 | |
| 
 | |
|     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)
 | |
|         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.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))
 | |
| 
 | |
| 
 | |
| 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)
 |