feat:优化职业技能关联实现
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
# b522a95d819a5559b775deb9a490e49a
|
||||
from core.basic.skill import PassiveSkill, ActiveSkill, get_data
|
||||
from core.basic.character import Character
|
||||
from core.basic.skill_effect_types import (
|
||||
CharacterAttribute,
|
||||
CharacterEffect,
|
||||
LevelTable,
|
||||
Percent,
|
||||
SkillAttribute,
|
||||
SkillEffect,
|
||||
)
|
||||
|
||||
prefix = "extra/creator/cn/skillDetail"
|
||||
|
||||
@@ -510,7 +518,11 @@ class Skill16(PassiveSkill):
|
||||
# 施放速度增加 : {value2}%
|
||||
data2 = get_data(f'{prefix}/{uuid}', 2)
|
||||
|
||||
associate = [{'data': data0, 'type': '$*PAtkI'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '$*PAtkI'}]
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_I, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 具象强化
|
||||
# extra/creator/ef9d26746effee9199b54541f01b8752
|
||||
@@ -536,7 +548,11 @@ class Skill17(PassiveSkill):
|
||||
# 各系列攻击力增加率 : {value0}%
|
||||
data0 = get_data(f'{prefix}/{uuid}', 0)
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 烈焰飓风
|
||||
# extra/creator/e788de1a4498c99fcc790302c4d41fed
|
||||
@@ -877,7 +893,11 @@ class Skill25(PassiveSkill):
|
||||
# 烈炎、 寒冰、 守护、 风暴系列能量增加量 : {value1}
|
||||
data1 = get_data(f'{prefix}/{uuid}', 1)
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 自我觉醒
|
||||
# extra/creator/845e0ce3235e19f60cc82a082d072cba
|
||||
@@ -911,7 +931,11 @@ class Skill26(PassiveSkill):
|
||||
# 独立攻击力增加率 : {value3}%
|
||||
data3 = get_data(f'{prefix}/{uuid}', 3)
|
||||
|
||||
associate = [{'data': data3, 'type': '$*PAtkI'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data3, 'type': '$*PAtkI'}]
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_I, value=1 + Percent(LevelTable(data3))),
|
||||
]
|
||||
|
||||
# 终末狂想
|
||||
# extra/creator/5536486eaf9b13c9a8283447cb5e77ab
|
||||
@@ -1220,7 +1244,11 @@ class Skill33(PassiveSkill):
|
||||
# 烈炎、 寒冰、 守护、 风暴系列能量增加量 : {value1}
|
||||
data1 = get_data(f'{prefix}/{uuid}', 1)
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 虚空
|
||||
# extra/creator/dacd5c2848a1eb33489e5471f1a73759
|
||||
@@ -1484,7 +1512,11 @@ class Skill39(PassiveSkill):
|
||||
# [冰霜之球]能量恢复率 : {value1}%
|
||||
data1 = get_data(f'{prefix}/{uuid}', 1)
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 创生
|
||||
# extra/creator/1bf9711f3f15865e38d7dce51c6b5a8c
|
||||
|
||||
@@ -2,21 +2,37 @@
|
||||
from core.basic.character.calc_carry import _skill_error_context
|
||||
from core.basic.skill import PassiveSkill, ActiveSkill, get_data
|
||||
from core.basic.character import Character
|
||||
from core.basic.skill_effect_types import (
|
||||
CharacterAttribute,
|
||||
CharacterEffect,
|
||||
Equals,
|
||||
LevelTable,
|
||||
Not,
|
||||
Operation,
|
||||
OutputTypeStartsWith,
|
||||
Percent,
|
||||
Read,
|
||||
Select,
|
||||
SkillAttribute,
|
||||
SkillEffect,
|
||||
WeaponCategoryContains,
|
||||
)
|
||||
|
||||
prefix = "extra/dark_knight/cn/skillDetail"
|
||||
|
||||
|
||||
def apply_weapon_mastery(skill: PassiveSkill, old: int, new: int, weapon_type: str):
|
||||
weapon = skill.char.GetWeaponType()
|
||||
if weapon[0] != weapon_type:
|
||||
return None
|
||||
|
||||
physical = skill.char.输出类型.startswith('物理')
|
||||
inherited = '传世武器' in weapon[1]
|
||||
data_index = (3 if physical else 4) if inherited else (0 if physical else 1)
|
||||
attack_type = '$*PAtkP' if physical else '$*PAtkM'
|
||||
skill.associate = [{'type': attack_type, 'data': getattr(skill, f'data{data_index}')}]
|
||||
return PassiveSkill.effect(skill, old, new)
|
||||
# 迁移前武器精通辅助函数(保留对照):
|
||||
# def apply_weapon_mastery(skill: PassiveSkill, old: int, new: int, weapon_type: str):
|
||||
# weapon = skill.char.GetWeaponType()
|
||||
# if weapon[0] != weapon_type:
|
||||
# return None
|
||||
#
|
||||
# physical = skill.char.输出类型.startswith('物理')
|
||||
# inherited = '传世武器' in weapon[1]
|
||||
# data_index = (3 if physical else 4) if inherited else (0 if physical else 1)
|
||||
# attack_type = '$*PAtkP' if physical else '$*PAtkM'
|
||||
# skill.associate = [{'type': attack_type, 'data': getattr(skill, f'data{data_index}')}]
|
||||
# return PassiveSkill.effect(skill, old, new)
|
||||
|
||||
class DarkKnightSkill(ActiveSkill):
|
||||
# 默认5阶段
|
||||
@@ -208,7 +224,11 @@ class Skill5(PassiveSkill):
|
||||
# 跳跃攻击力变化率 : {value2}%
|
||||
data2 = get_data(f'{prefix}/{uuid}', 2)
|
||||
|
||||
associate = [{'type': '*skillDamage', 'data': [i - 100 if i > 0 else 0 for i in data0], 'skills': ['挑击']}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'type': '*skillDamage', 'data': [i - 100 if i > 0 else 0 for i in data0], 'skills': ['挑击']}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable([i - 100 if i > 0 else 0 for i in data0])), skills=['挑击']),
|
||||
]
|
||||
|
||||
# 受身蹲伏
|
||||
# extra/dark_knight/ce26c6b69d02a440a81b552bec94f03b
|
||||
@@ -666,8 +686,13 @@ class Skill19(PassiveSkill):
|
||||
# 命中率增加 : {value5}%
|
||||
data5 = get_data(f'{prefix}/{uuid}', 5)
|
||||
|
||||
def effect(self, old, new):
|
||||
return apply_weapon_mastery(self, old, new, '光剑')
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# return apply_weapon_mastery(self, old, new, '光剑')
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data3), LevelTable(data0))), weapon=['光剑'], when=OutputTypeStartsWith('物理')),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data4), LevelTable(data1))), weapon=['光剑'], when=Not(OutputTypeStartsWith('物理'))),
|
||||
]
|
||||
|
||||
# 暗 · 短剑精通
|
||||
# extra/dark_knight/01c3a2fb793d293a25ed8dc7a0d70c1a
|
||||
@@ -705,8 +730,13 @@ class Skill20(PassiveSkill):
|
||||
# 命中率增加 : {value5}%
|
||||
data5 = get_data(f'{prefix}/{uuid}', 5)
|
||||
|
||||
def effect(self, old, new):
|
||||
return apply_weapon_mastery(self, old, new, '短剑')
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# return apply_weapon_mastery(self, old, new, '短剑')
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data3), LevelTable(data0))), weapon=['短剑'], when=OutputTypeStartsWith('物理')),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data4), LevelTable(data1))), weapon=['短剑'], when=Not(OutputTypeStartsWith('物理'))),
|
||||
]
|
||||
|
||||
# 暗 · 太刀精通
|
||||
# extra/dark_knight/8f73f243041c2d27739fe7696f02bf9b
|
||||
@@ -744,8 +774,13 @@ class Skill21(PassiveSkill):
|
||||
# 命中率增加 : {value5}%
|
||||
data5 = get_data(f'{prefix}/{uuid}', 5)
|
||||
|
||||
def effect(self, old, new):
|
||||
return apply_weapon_mastery(self, old, new, '太刀')
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# return apply_weapon_mastery(self, old, new, '太刀')
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data3), LevelTable(data0))), weapon=['太刀'], when=OutputTypeStartsWith('物理')),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data4), LevelTable(data1))), weapon=['太刀'], when=Not(OutputTypeStartsWith('物理'))),
|
||||
]
|
||||
|
||||
# 暗 · 巨剑精通
|
||||
# extra/dark_knight/8c2379737c5acc935c1731f67f607655
|
||||
@@ -783,8 +818,13 @@ class Skill22(PassiveSkill):
|
||||
# 命中率增加 : {value5}%
|
||||
data5 = get_data(f'{prefix}/{uuid}', 5)
|
||||
|
||||
def effect(self, old, new):
|
||||
return apply_weapon_mastery(self, old, new, '巨剑')
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# return apply_weapon_mastery(self, old, new, '巨剑')
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data3), LevelTable(data0))), weapon=['巨剑'], when=OutputTypeStartsWith('物理')),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data4), LevelTable(data1))), weapon=['巨剑'], when=Not(OutputTypeStartsWith('物理'))),
|
||||
]
|
||||
|
||||
# 暗 · 钝器精通
|
||||
# extra/dark_knight/9cb6f9ed646fa87f9b7680a42ce83d1a
|
||||
@@ -822,8 +862,13 @@ class Skill23(PassiveSkill):
|
||||
# 命中率增加 : {value5}%
|
||||
data5 = get_data(f'{prefix}/{uuid}', 5)
|
||||
|
||||
def effect(self, old, new):
|
||||
return apply_weapon_mastery(self, old, new, '钝器')
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# return apply_weapon_mastery(self, old, new, '钝器')
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data3), LevelTable(data0))), weapon=['钝器'], when=OutputTypeStartsWith('物理')),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(Select(WeaponCategoryContains('传世武器'), LevelTable(data4), LevelTable(data1))), weapon=['钝器'], when=Not(OutputTypeStartsWith('物理'))),
|
||||
]
|
||||
|
||||
# 暗劲爆发
|
||||
# extra/dark_knight/506e7ed77d517419a6e1c437a2cedb17
|
||||
@@ -882,7 +927,11 @@ class Skill25(PassiveSkill):
|
||||
hasUP = False
|
||||
custom = get_data(f'{prefix}/{uuid}', 'custom') # noqa: E501
|
||||
|
||||
associate = [{'type': '+lv', 'data': [i + 1 if i > 0 else i for i in range(0, maxLv + 3)], 'ratio': 1, 'skills': ['暗 · 光剑精通', '暗 · 钝器精通', '暗 · 太刀精通', '暗 · 巨剑精通', '暗 · 短剑精通']}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'type': '+lv', 'data': [i + 1 if i > 0 else i for i in range(0, maxLv + 3)], 'ratio': 1, 'skills': ['暗 · 光剑精通', '暗 · 钝器精通', '暗 · 太刀精通', '暗 · 巨剑精通', '暗 · 短剑精通']}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.LEVEL, operation=Operation.ADD, value=LevelTable([i + 1 if i > 0 else i for i in range(0, maxLv + 3)]), skills=['暗 · 光剑精通', '暗 · 钝器精通', '暗 · 太刀精通', '暗 · 巨剑精通', '暗 · 短剑精通']),
|
||||
]
|
||||
|
||||
|
||||
# 暗影鞭
|
||||
@@ -1692,7 +1741,11 @@ class Skill44(PassiveSkill):
|
||||
# 施放连续技期间所受伤害减少率 : {value1}%
|
||||
data1 = get_data(f'{prefix}/{uuid}', 1)
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
|
||||
# 幽魂剑
|
||||
# extra/dark_knight/ce7cd04a44e32212e80f120f4421996e
|
||||
@@ -1783,7 +1836,12 @@ class Skill46(PassiveSkill):
|
||||
# 物理、 魔法攻击力增加率 : {value3}%
|
||||
data3 = get_data(f'{prefix}/{uuid}', 3)
|
||||
|
||||
associate = [{'type': '$*PAtkP', 'data': data3}, {'type': '$*PAtkM', 'data': data3}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'type': '$*PAtkP', 'data': data3}, {'type': '$*PAtkM', 'data': data3}]
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_P, value=1 + Percent(LevelTable(data3))),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_ATK_M, value=1 + Percent(LevelTable(data3))),
|
||||
]
|
||||
|
||||
# 暗炎冥魂波
|
||||
# extra/dark_knight/5c00ce6d7dbbb5e9a0f6e1071d486832
|
||||
@@ -1920,7 +1978,12 @@ class Skill49(PassiveSkill):
|
||||
# 物理、 魔法暴击率增加 : {value3}%
|
||||
data3 = get_data(f'{prefix}/{uuid}', 3)
|
||||
|
||||
associate = [{'type': '$*PSTR', 'data': data2}, {'type': '$*PINT', 'data': data2}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'type': '$*PSTR', 'data': data2}, {'type': '$*PINT', 'data': data2}]
|
||||
associate = [
|
||||
CharacterEffect(attribute=CharacterAttribute.P_STR, value=1 + Percent(LevelTable(data2))),
|
||||
CharacterEffect(attribute=CharacterAttribute.P_INT, value=1 + Percent(LevelTable(data2))),
|
||||
]
|
||||
|
||||
# 邪影升龙斩
|
||||
# extra/dark_knight/b1732acfaf117f8e9ff130f47d3ed0e7
|
||||
@@ -1971,6 +2034,19 @@ class Skill50(DarkKnightSkill):
|
||||
"""
|
||||
self.stage = 6
|
||||
|
||||
# 迁移前实现(保留对照):
|
||||
# def effect(self, old, new):
|
||||
# # 选择该vp之后,当前列的连招列的其他技能都没有伤害
|
||||
# skills = []
|
||||
# for index in self.char.combos[self.comboCol]:
|
||||
# if str(index) != str(self.id):
|
||||
# skill = self.char.GetSkillByID(index)
|
||||
# if skill:
|
||||
# skills.append(skill.name)
|
||||
# if self.vp == 2:
|
||||
# self.associate = [{"type":"=skillDamage","data":[0] + [0]*self.maxLv,"skills":skills}]
|
||||
# return super().effect(old, new)
|
||||
# 仅动态枚举目标名称,贡献值与 VP 条件交由类型化声明处理。
|
||||
def effect(self, old, new):
|
||||
# 选择该vp之后,当前列的连招列的其他技能都没有伤害
|
||||
skills = []
|
||||
@@ -1979,8 +2055,9 @@ class Skill50(DarkKnightSkill):
|
||||
skill = self.char.GetSkillByID(index)
|
||||
if skill:
|
||||
skills.append(skill.name)
|
||||
if self.vp == 2:
|
||||
self.associate = [{"type":"=skillDamage","data":[0] + [0]*self.maxLv,"skills":skills}]
|
||||
self.associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, operation=Operation.ASSIGN, value=LevelTable([0] + [0] * self.maxLv), skills=skills, when=Equals(Read(SkillAttribute.VP), 2)),
|
||||
]
|
||||
return super().effect(old, new)
|
||||
|
||||
# 超时空碎裂
|
||||
@@ -2048,7 +2125,11 @@ class Skill52(PassiveSkill):
|
||||
data0 = get_data(f'{prefix}/{uuid}', 0)
|
||||
# [时空主宰]效果持续时间 : 5秒
|
||||
|
||||
associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
# 迁移前实现(保留对照):
|
||||
# associate = [{'data': data0, 'type': '*skillDamage'}]
|
||||
associate = [
|
||||
SkillEffect(attribute=SkillAttribute.DAMAGE, value=1 + Percent(LevelTable(data0))),
|
||||
]
|
||||
# [时空主宰]效果持续时间 : 5秒
|
||||
|
||||
# 暗黑溯回斩
|
||||
|
||||
Reference in New Issue
Block a user