feat:优化职业技能关联实现

This commit is contained in:
2026-10-13 15:57:28 +08:00
parent 15c3bff467
commit 7dc5f4cde5
20 changed files with 875 additions and 161 deletions
@@ -102,3 +102,50 @@ def test_all_equipment_can_calculate_when_equipped_once(equ, part, minimal_calc_
assert character is not None
_assert_calc_result_shape(character.calc(config))
@pytest.mark.parametrize('vp', [0, 1, 2])
@pytest.mark.parametrize('alter', _character_params())
def test_all_gf_learned_skill_results_ignore_configuration_order(alter, vp, minimal_calc_config):
"""Exercise real profession rules, including every VP-dependent effect."""
from copy import deepcopy
from random import Random
probe = createCharacter(alter, '0')
values = [
(str(skill.id), {'lv': skill.calculate_lv(), 'vp': vp, 'up': 0})
for skill in sorted(probe.skills, key=lambda item: item.id)
]
shuffled = values.copy()
Random(42).shuffle(shuffled)
results = []
for ordered in (values, values[::-1], shuffled):
config = deepcopy(minimal_calc_config)
config['skills'] = dict(ordered)
config['skillShortcuts'] = {'combos': [[] for _ in range(6)]}
result = createCharacter(alter, '0').calc(config)
result.pop('uuid')
results.append(result)
assert results[0] == results[1] == results[2]
@pytest.mark.parametrize('alter', _character_params())
def test_learned_skills_with_weapon_ignore_configuration_order(alter, minimal_calc_config):
from copy import deepcopy
probe = createCharacter(alter, '0')
weapon = next(
equ for equ in get_equipment('0').equs
if equ.itemType == '武器' and equ.itemDetailType in probe.武器选项
)
values = [(str(skill.id), {'lv': skill.calculate_lv(), 'vp': 2, 'up': 0}) for skill in probe.skills]
results = []
for ordered in (values, values[::-1]):
config = deepcopy(minimal_calc_config)
config['equips']['武器']['id'] = weapon.id
config['skills'] = dict(ordered)
config['skillShortcuts'] = {'combos': [[] for _ in range(6)]}
result = createCharacter(alter, '0').calc(config)
result.pop('uuid')
results.append(result)
assert results[0] == results[1]