fix(技能): 修复治疗技能未正确触发目标生命值显示的问题
修改 HeroAttrsComp.add_hp 方法使其返回实际治疗值,并在 SCastSystem 中调用目标 health 方法更新显示
This commit is contained in:
@@ -106,6 +106,7 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
if (this.debugMode) {
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', ` HP变更: ${this.hero_name}, 变化=${addValue.toFixed(1)}, ${oldHp.toFixed(1)} -> ${this.hp.toFixed(1)}`);
|
||||
}
|
||||
return addValue;
|
||||
}
|
||||
|
||||
add_shield(value:number,isValue:boolean){
|
||||
|
||||
@@ -129,13 +129,14 @@ export class SCastSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const model = target.ent.get(HeroAttrsComp);
|
||||
if (!model || model.is_dead) continue;
|
||||
if (kind === SkillKind.Heal && config.ap !== 0) {
|
||||
model.add_hp(config.ap, false);
|
||||
let addHp = model.add_hp(config.ap, false);
|
||||
target.health(addHp);
|
||||
} else if (kind === SkillKind.Shield && config.ap !== 0) {
|
||||
model.add_shield(config.ap, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//应用额外效果
|
||||
private applyExtraEffects(config: SkillConfig, targets: HeroViewComp[]) {
|
||||
for (const target of targets) {
|
||||
if (!target.ent) continue;
|
||||
|
||||
Reference in New Issue
Block a user