feat(战斗系统): 实现攻击和技能伤害加成天赋效果

添加ATK_DMG和SKILL_DMG天赋类型,支持在普通攻击和技能释放时应用额外伤害
修改SACastSystem以处理不同类型的伤害加成
重构TalEffet枚举并更新相关配置
This commit is contained in:
2025-11-24 15:39:05 +08:00
parent 4ed531e100
commit 8d2ec76b01
4 changed files with 57 additions and 25 deletions

View File

@@ -433,6 +433,12 @@ export class HeroAttrsComp extends ecs.Comp {
t.count -= 1;
return true;
}
useCountValTal(eff: number): number {
const t = this.Talents[eff];
if (!t || t.value <= 0) return 0;
t.count -= 1;
return t.value;
}
useValueTalByUuid(t_uuid: number) {
const buff = this.BUFFS_TAL[t_uuid];
if (!buff) return;

View File

@@ -157,29 +157,39 @@ export class SACastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdat
return false;
}
// 2. 延迟创建技能实体(等待动画)
const delay = 0.3
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,targets);
}, delay);
if (hset === HSSet.atk){
let delay = 0.3
let ext_dmg = heroAttrs.useCountValTal(TalEffet.ATK_DMG);
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,targets,ext_dmg);
}, delay);
}
if(hset === HSSet.skill){
let delay = 0.3
let ext_dmg = heroAttrs.useCountValTal(TalEffet.SKILL_DMG);
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,targets,ext_dmg);
}, delay);
}
//风怒wfuny 只针对 普通攻击起效
if (hset === HSSet.atk && heroAttrs.useCountTal(TalEffet.WFUNY)){
let delay = 0.3
heroView.playSkillEffect(s_uuid);
//需要再添加 风怒动画
this.createSkill(s_uuid, heroView,targets);
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,targets);
},delay);
}
// 双技能 只针对 技能起效
if(hset === HSSet.skill && heroAttrs.useCountTal(TalEffet.D_SKILL)){
targets = this.sTargets(heroView, s_uuid);
if (targets.length === 0) {
console.warn("[SACastSystem] 没有找到有效目标");
return false;
}
let delay = 0.3
heroView.playSkillEffect(s_uuid);
//需要再添加 双技能动画
heroView.scheduleOnce(() => {
this.createSkill(s_uuid, heroView,targets);
}, delay);
},delay);
}

View File

@@ -202,6 +202,21 @@ export class TalComp extends ecs.Comp {
const talent = this.Tals[uuid];
const heroAttrs=this.ent.get(HeroAttrsComp);
switch(talent.effet){
case TalEffet.ATK_DMG:
heroAttrs.addCountTal(TalEffet.ATK_DMG, talent.value + talent.value_add);
break;
case TalEffet.SKILL_DMG:
heroAttrs.addCountTal(TalEffet.SKILL_DMG, talent.value + talent.value_add);
break;
case TalEffet.LDMG:
heroAttrs.addCountTal(TalEffet.LDMG, talent.value + talent.value_add);
break;
// case TalEffet.HP:
// heroAttrs.addCountTal(TalEffet.HP, talent.value + talent.value_add);
// break;
// case TalEffet.MP:
// heroAttrs.addCountTal(TalEffet.MP, talent.value + talent.value_add);
// break;
case TalEffet.WFUNY:
heroAttrs.addCountTal(TalEffet.WFUNY, talent.value + talent.value_add);
break;