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); });