fix(技能): 修复技能升级配置和属性计算错误

- 将 SkillUpList 中的 buff_max 字段更正为 buff_hp
- 移除 add_hp 和 add_shield 方法的 isValue 参数,改为直接使用数值
- 在 SCastSystem 中应用技能升级加成计算 AP、命中次数和 buff 值
- 为 HeroAttrsComp 添加 add_hp_max 和 add_ap 方法,替换原有的通用 buff 处理逻辑
- 简化伤害和技能效果应用逻辑,确保属性计算正确
This commit is contained in:
walkpan
2026-03-22 21:30:27 +08:00
parent 61261b97c3
commit 9962a725d1
4 changed files with 33 additions and 55 deletions

View File

@@ -7,6 +7,7 @@ import { Skill } from "../skill/Skill";
import { smc } from "../common/SingletonModuleComp";
import { GameConst } from "../common/config/GameConst";
import { HType } from "../common/config/heroSet";
import { Attrs } from "../common/config/HeroAttrs";
/**
* ==================== 自动施法系统 ====================
@@ -173,20 +174,32 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
*/
private applyFriendlySkillEffects(_s_uuid: number, _skillLv: number, config: SkillConfig, _heroView: HeroViewComp, _cAttrsComp: HeroAttrsComp, targets: HeroViewComp[], _targetPos: Vec3 | null) {
const kind = config.kind ?? SkillKind.Support;
const sUp=SkillUpList[_skillLv]
const sAp =config.ap+sUp.ap*_skillLv;
const sHit=config.hit_count+sUp.hit_count*_skillLv
for (const target of targets) {
if (!target.ent) continue;
const model = target.ent.get(HeroAttrsComp);
if (!model || model.is_dead) continue;
if (kind === SkillKind.Heal && config.ap !== 0) {
const addHp = model.add_hp(config.ap, false);
const addHp = model.add_hp(sAp*_cAttrsComp.ap);
target.health(addHp);
} else if (kind === SkillKind.Shield && config.ap !== 0) {
model.add_shield(config.ap, false);
} else if (kind === SkillKind.Shield && sAp !== 0) {
model.add_shield(sAp*_cAttrsComp.ap);
}
if (!config.buffs || config.buffs.length === 0) continue;
for (const buffConf of config.buffs) {
if (!buffConf) continue;
model.addBuff(buffConf);
const sBuffAp=buffConf.value+sUp.buff_ap
const sBuffHp=buffConf.value+sUp.buff_hp
switch (buffConf.buff){
case Attrs.ap:
model.add_ap(sBuffAp)
break
case Attrs.hp_max:
model.add_hp_max(sBuffHp)
break
}
}
}
}