From 5ae4c8fcd021ef6056473f4048ed8d0a20d7669b Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 23 Apr 2026 09:49:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(hero):=20=E4=BF=AE=E5=A4=8D=E5=A4=8D?= =?UTF-8?q?=E6=B4=BB=E5=90=8E=E6=B2=BB=E7=96=97=E6=9C=AA=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E5=A4=8D=E6=B4=BB=E8=AE=A1=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=B9=B6=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE=E5=A4=8D=E6=B4=BB?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E7=99=BE=E5=88=86=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在MissionComp中,英雄被治疗后重置复活计数,防止下回合无法复活 - 在HeroAtkSystem中,从技能配置读取复活恢复生命值百分比,替代硬编码的50% --- assets/script/game/hero/HeroAtkSystem.ts | 17 +++++++++++++---- assets/script/game/map/MissionComp.ts | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/assets/script/game/hero/HeroAtkSystem.ts b/assets/script/game/hero/HeroAtkSystem.ts index 5be6d535..3f903351 100644 --- a/assets/script/game/hero/HeroAtkSystem.ts +++ b/assets/script/game/hero/HeroAtkSystem.ts @@ -190,23 +190,32 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd // 复活机制:如果玩家属性内的复活属性值>=1 则执行复活,原地50%血量复活 let canRevive = false; let maxReviveCount = 0; + let reviveHpPercent = 50; // 默认恢复50% if (TAttrsComp.revive && TAttrsComp.revive.length > 0) { const reviveConf = TAttrsComp.revive[0]; maxReviveCount = reviveConf.r_num + Math.floor((TAttrsComp.lv - 1) * reviveConf.upr); if (TAttrsComp.revived_count < maxReviveCount) { canRevive = true; + // 从配置表中读取对应的复活技能配置,ap 字段代表恢复生命值的百分比 + const skillConf = SkillSet[reviveConf.s_uuid]; + if (skillConf && skillConf.ap) { + reviveHpPercent = skillConf.ap; + } } } if (canRevive) { TAttrsComp.revived_count++; TAttrsComp.is_reviving = true; // 标记为正在复活 - // 触发死亡动画(假死) + // 根据技能配置恢复生命值 + TAttrsComp.hp = Math.floor(TAttrsComp.hp_max * (reviveHpPercent / 100)); + TAttrsComp.dirty_hp = true; + + // 触发复活动画 if (targetView) { - targetView.do_dead(); - + targetView.playReady(skillConf.readyAnm); } - mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives revived: ${TAttrsComp.revived_count}/${maxReviveCount}`); + mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives revived: ${TAttrsComp.revived_count}/${maxReviveCount}, Hp restored: ${reviveHpPercent}%`); return reDate; } diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 5b41bb7d..ddbee53b 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -514,6 +514,9 @@ export class MissionComp extends CCComp { attrs.hp = Math.min(attrs.hp_max, attrs.hp + healAmount); attrs.dirty_hp = true; + // 重置复活次数,使得下回合可以继续复活 + attrs.revived_count = 0; + // 触发治疗动画,即使在墓地的英雄也触发(会在其当前位置播放) view.health(healAmount); });