feat(技能): 为技能配置添加额外属性字段并应用到技能实例
在 SkillConfig 接口中新增暴击率、冰冻概率等六个可选属性字段,用于技能配置时提供额外加成。 在 Skill 类中,读取这些配置字段并累加到施法者基础属性上,影响技能的实际效果。
This commit is contained in:
@@ -177,6 +177,12 @@ export interface SkillConfig {
|
|||||||
EType:EType, // 结束条件(动画结束/时间结束/距离结束/碰撞/次数结束)
|
EType:EType, // 结束条件(动画结束/时间结束/距离结束/碰撞/次数结束)
|
||||||
time?:number, // timeEnd 持续时间(秒)
|
time?:number, // timeEnd 持续时间(秒)
|
||||||
kind?:SkillKind, // 主效果类型
|
kind?:SkillKind, // 主效果类型
|
||||||
|
crt?:number, // 额外暴击率
|
||||||
|
frz?:number, // 额外冰冻概率
|
||||||
|
stn?:number, // 额外眩晕概率
|
||||||
|
bck?:number, // 额外击退概率
|
||||||
|
slw?:number, // 额外减速概率
|
||||||
|
pct?:number, // 额外穿刺次数
|
||||||
buffs:number[], // 对施法者的buff配置列表(Buff UUID 列表)
|
buffs:number[], // 对施法者的buff配置列表(Buff UUID 列表)
|
||||||
debuffs:number[], // 对目标的debuff配置列表(Buff UUID 列表)
|
debuffs:number[], // 对目标的debuff配置列表(Buff UUID 列表)
|
||||||
call_hero?:number, // 召唤技能召唤英雄id(可选)
|
call_hero?:number, // 召唤技能召唤英雄id(可选)
|
||||||
|
|||||||
@@ -193,21 +193,28 @@ export class Skill extends ecs.Entity {
|
|||||||
sDataCom.caster=caster
|
sDataCom.caster=caster
|
||||||
sDataCom.casterEid=caster.ent.eid
|
sDataCom.casterEid=caster.ent.eid
|
||||||
sDataCom.Attrs = {};
|
sDataCom.Attrs = {};
|
||||||
|
const addCrt = config.crt ?? 0;
|
||||||
|
const addFrz = config.frz ?? 0;
|
||||||
|
const addStn = config.stn ?? 0;
|
||||||
|
const addBck = config.bck ?? 0;
|
||||||
|
const addSlw = config.slw ?? 0;
|
||||||
|
const addPct = config.pct ?? 0;
|
||||||
|
const totalPuncture = cAttrsComp.puncture + addPct;
|
||||||
sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap;
|
sDataCom.Attrs[Attrs.ap] = cAttrsComp.ap;
|
||||||
sDataCom.Attrs[Attrs.critical] = cAttrsComp.critical;
|
sDataCom.Attrs[Attrs.critical] = cAttrsComp.critical + addCrt;
|
||||||
sDataCom.Attrs[Attrs.critical_dmg] = cAttrsComp.critical_dmg;
|
sDataCom.Attrs[Attrs.critical_dmg] = cAttrsComp.critical_dmg;
|
||||||
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance;
|
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance + addFrz;
|
||||||
sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance;
|
sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance + addStn;
|
||||||
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance;
|
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance + addBck;
|
||||||
sDataCom.Attrs[Attrs.slow_chance] = cAttrsComp.slow_chance;
|
sDataCom.Attrs[Attrs.slow_chance] = cAttrsComp.slow_chance + addSlw;
|
||||||
sDataCom.Attrs[Attrs.puncture] = cAttrsComp.puncture;
|
sDataCom.Attrs[Attrs.puncture] = totalPuncture;
|
||||||
sDataCom.Attrs[Attrs.puncture_dmg] = cAttrsComp.puncture_dmg;
|
sDataCom.Attrs[Attrs.puncture_dmg] = cAttrsComp.puncture_dmg;
|
||||||
|
|
||||||
sDataCom.s_uuid=s_uuid
|
sDataCom.s_uuid=s_uuid
|
||||||
sDataCom.fac=cAttrsComp.fac
|
sDataCom.fac=cAttrsComp.fac
|
||||||
sDataCom.ext_dmg=ext_dmg
|
sDataCom.ext_dmg=ext_dmg
|
||||||
sDataCom.hit_count = 0
|
sDataCom.hit_count = 0
|
||||||
sDataCom.max_hit_count = Math.max(1, config.hit_count + cAttrsComp.puncture)
|
sDataCom.max_hit_count = Math.max(1, config.hit_count + totalPuncture)
|
||||||
SView.init();
|
SView.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user