fix(技能施放): 修复技能升级次数计算并支持多次施放

- 将 cNum 计算修正为 Math.min(2, Math.max(0, Math.floor(sUp.num ?? 0))),防止无效值
- 根据 cNum 增加技能施放循环,支持多次施放效果
- 为属性增益 buff 添加注释说明动画意图
This commit is contained in:
walkpan
2026-03-22 21:52:12 +08:00
parent ab11b2b2d3
commit 0a66ef1035

View File

@@ -110,8 +110,8 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const s_uuid = castPlan.skillId;
const skillLv = castPlan.skillLv;
const config = SkillSet[s_uuid];
const sUp=SkillUpList[s_uuid]??SkillUpList[1001]
const cNum=sUp.num
const sUp = SkillUpList[s_uuid] ?? SkillUpList[1001];
const cNum = Math.min(2, Math.max(0, Math.floor(sUp.num ?? 0)));
if (!config) return;
//播放前摇技能动画
heroView.playReady(config.readyAnm);
@@ -125,13 +125,17 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
heroView.scheduleOnce(() => {
if (!heroView.node || !heroView.node.isValid || heroAttrs.is_dead) return;
if (castPlan.isFriendly) {
const friendlyTargets = this.resolveFriendlyTargets(castPlan.targetEids, heroAttrs.fac);
if (friendlyTargets.length === 0) return;
this.applyFriendlySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, friendlyTargets, null);
return;
const castTimes = 1 + cNum;
for (let i = 0; i < castTimes; i++) {
if (!heroView.node || !heroView.node.isValid || heroAttrs.is_dead) return;
if (castPlan.isFriendly) {
const friendlyTargets = this.resolveFriendlyTargets(castPlan.targetEids, heroAttrs.fac);
if (friendlyTargets.length === 0) return;
this.applyFriendlySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, friendlyTargets, null);
continue;
}
this.applyEnemySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, castPlan.targetPos);
}
this.applyEnemySkillEffects(s_uuid, skillLv, config, heroView, heroAttrs, castPlan.targetPos);
}, delay);
heroAttrs.triggerSkillCD(s_uuid);
}
@@ -199,9 +203,11 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
switch (buffConf.buff){
case Attrs.ap:
model.add_ap(sBuffAp)
//加工动画
break
case Attrs.hp_max:
model.add_hp_max(sBuffHp)
//加最大生命值动画
break
}
}