feat(技能): 为技能配置添加额外属性字段并应用到技能实例

在 SkillConfig 接口中新增暴击率、冰冻概率等六个可选属性字段,用于技能配置时提供额外加成。
在 Skill 类中,读取这些配置字段并累加到施法者基础属性上,影响技能的实际效果。
This commit is contained in:
panw
2026-03-18 10:13:50 +08:00
parent eb4e544363
commit d2fbac11cd
2 changed files with 20 additions and 7 deletions

View File

@@ -193,21 +193,28 @@ export class Skill extends ecs.Entity {
sDataCom.caster=caster
sDataCom.casterEid=caster.ent.eid
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.critical] = cAttrsComp.critical;
sDataCom.Attrs[Attrs.critical] = cAttrsComp.critical + addCrt;
sDataCom.Attrs[Attrs.critical_dmg] = cAttrsComp.critical_dmg;
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance;
sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance;
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance;
sDataCom.Attrs[Attrs.slow_chance] = cAttrsComp.slow_chance;
sDataCom.Attrs[Attrs.puncture] = cAttrsComp.puncture;
sDataCom.Attrs[Attrs.freeze_chance] = cAttrsComp.freeze_chance + addFrz;
sDataCom.Attrs[Attrs.stun_chance] = cAttrsComp.stun_chance + addStn;
sDataCom.Attrs[Attrs.back_chance] = cAttrsComp.back_chance + addBck;
sDataCom.Attrs[Attrs.slow_chance] = cAttrsComp.slow_chance + addSlw;
sDataCom.Attrs[Attrs.puncture] = totalPuncture;
sDataCom.Attrs[Attrs.puncture_dmg] = cAttrsComp.puncture_dmg;
sDataCom.s_uuid=s_uuid
sDataCom.fac=cAttrsComp.fac
sDataCom.ext_dmg=ext_dmg
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();
}