Files
Grinch-AP/worlds/stardew_valley/test/content/feature/TestToolProgression.py
Jérémie Bolduc ee9bcb84b7 Stardew Valley: Move progressive tool options handling in features (#4374)
* create tool progression feature and unwrap option

* replace option usage with calling feature

* add comment explaining why some logic is a weird place

* replace item creation logic with feature

* self review and add unit tests

* rename test cuz I named them too long

* add a test for the trash can useful stuff cuz I thought there was a bug but turns out it works

* self review again

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

* damn it 3.11 why are you like this

* use blacksmith region when checking vanilla tools

* fix rule

* move can mine using in tool logic

* remove changes to performance test

* properly set the option I guess

* properly set options 2

* that's what happen when you code too late
2025-03-08 11:19:29 -05:00

53 lines
1.9 KiB
Python

import unittest
from ....content import choose_tool_progression
from ....options import ToolProgression, SkillProgression
from ....strings.tool_names import Tool
class TestToolDistribution(unittest.TestCase):
def test_given_vanilla_tool_progression_when_create_feature_then_only_one_scythe_is_randomized(self):
tool_progression = ToolProgression(ToolProgression.option_vanilla)
skill_progression = SkillProgression.from_text("random")
feature = choose_tool_progression(tool_progression, skill_progression)
self.assertEqual(feature.tool_distribution, {
Tool.scythe: 1,
})
def test_given_progressive_tool_when_create_feature_then_all_tool_upgrades_are_randomized(self):
tool_progression = ToolProgression(ToolProgression.option_progressive)
skill_progression = SkillProgression(SkillProgression.option_progressive)
feature = choose_tool_progression(tool_progression, skill_progression)
self.assertEqual(feature.tool_distribution, {
Tool.scythe: 1,
Tool.pickaxe: 4,
Tool.axe: 4,
Tool.hoe: 4,
Tool.watering_can: 4,
Tool.trash_can: 4,
Tool.pan: 4,
Tool.fishing_rod: 4,
})
def test_given_progressive_tool_and_skill_masteries_when_create_feature_then_additional_scythe_and_fishing_rod_are_randomized(self):
tool_progression = ToolProgression(ToolProgression.option_progressive)
skill_progression = SkillProgression(SkillProgression.option_progressive_with_masteries)
feature = choose_tool_progression(tool_progression, skill_progression)
self.assertEqual(feature.tool_distribution, {
Tool.scythe: 2,
Tool.pickaxe: 4,
Tool.axe: 4,
Tool.hoe: 4,
Tool.watering_can: 4,
Tool.trash_can: 4,
Tool.pan: 4,
Tool.fishing_rod: 5,
})