feat:优化职业技能关联实现
This commit is contained in:
@@ -41,26 +41,20 @@ def test_blade_dance_shadow_uses_final_hit_damage_not_hit_count():
|
||||
assert shadow_final_hit.value.id == "data2"
|
||||
|
||||
|
||||
def test_blade_dance_shadow_uses_its_own_passive_ratio():
|
||||
passive = _skill_class("唤魔 : 弑神剑")
|
||||
associations = next(
|
||||
item.value
|
||||
for item in passive.body
|
||||
if isinstance(item, ast.Assign)
|
||||
and any(isinstance(target, ast.Name) and target.id == "associate" for target in item.targets)
|
||||
)
|
||||
shadow_associations = [
|
||||
dict(zip((key.value for key in entry.keys), entry.values))
|
||||
for entry in associations.elts
|
||||
if isinstance(entry, ast.Dict)
|
||||
]
|
||||
def test_blade_dance_shadow_uses_its_own_passive_ratio(minimal_calc_config):
|
||||
from core.basic.character import createCharacter
|
||||
from core.basic.skill_effect_types import Operation, Power, SkillEffect
|
||||
|
||||
for power in ("+power4", "+power5"):
|
||||
association = next(
|
||||
entry
|
||||
for entry in shadow_associations
|
||||
if isinstance(entry.get("type"), ast.Constant)
|
||||
and entry["type"].value == power
|
||||
)
|
||||
assert isinstance(association["data"], ast.Name)
|
||||
assert association["data"].id == "data3"
|
||||
char = createCharacter('GF.swordman_female.demon_slayer')
|
||||
char.calc(minimal_calc_config)
|
||||
passive = char.GetSkillByName('唤魔 : 弑神剑')
|
||||
for level in (1, 10, passive.maxLv):
|
||||
passive.lv = level
|
||||
for index in (4, 5):
|
||||
association = next(
|
||||
entry for entry in passive.associate
|
||||
if isinstance(entry, SkillEffect) and entry.attribute == Power(index)
|
||||
)
|
||||
assert association.operation == Operation.ADD
|
||||
assert '魔刃狂舞' in association.skills
|
||||
assert association.evaluate(passive) == passive.data3[level] / 100
|
||||
|
||||
Reference in New Issue
Block a user