From 4c29d6942a405bdfc2e0da89fe2e4e654d9d1185 Mon Sep 17 00:00:00 2001 From: walkpan Date: Thu, 19 Mar 2026 19:38:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8A=80=E8=83=BD):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B2=BB=E7=96=97=E6=8A=80=E8=83=BD=E6=9C=AA=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=9B=AE=E6=A0=87=E7=94=9F=E5=91=BD=E5=80=BC?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改 HeroAttrsComp.add_hp 方法使其返回实际治疗值,并在 SCastSystem 中调用目标 health 方法更新显示 --- assets/script/game/hero/HeroAttrsComp.ts | 1 + assets/script/game/hero/SCastSystem.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index cc7dbd01..e9e00308 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -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){ diff --git a/assets/script/game/hero/SCastSystem.ts b/assets/script/game/hero/SCastSystem.ts index f378473a..48318eb7 100644 --- a/assets/script/game/hero/SCastSystem.ts +++ b/assets/script/game/hero/SCastSystem.ts @@ -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;