diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index b4776e3a..a3e621e5 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -395,7 +395,6 @@ export class HeroViewComp extends CCComp { this.deadCD = 0; this.as.do_buff(); this.status_change("idle"); - this.model.hp =this.model.hp_max*50/100; this.top_node.active=true this.setTopBarOpacity(false); this.lastBarUpdateTime=0 diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 5fc44347..2656f434 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -372,6 +372,9 @@ export class MissionComp extends CCComp { smc.mission.stop_spawn_mon = true; // 触发战斗结束技能(fend) this.triggerHeroBattleSkills(false); + + // 战斗结束阶段,给予所有英雄恢复70%血量的技能效果 + this.healAllHeroes(); break; case MissionPhase.Settle: @@ -481,6 +484,27 @@ export class MissionComp extends CCComp { }); } + /** + * 战斗结束阶段治疗所有英雄(包括墓地英雄),恢复70%最大生命值 + */ + private healAllHeroes() { + ecs.query(this.heroAttrsMatcher).forEach(entity => { + const attrs = entity.get(HeroAttrsComp); + const view = entity.get(HeroViewComp); + if (!attrs || !view || attrs.fac !== FacSet.HERO) return; + + // 计算恢复量:70% 的最大生命值 + const healAmount = Math.floor(attrs.hp_max * 0.7); + + // 应用恢复量,不超过最大生命值 + attrs.hp = Math.min(attrs.hp_max, attrs.hp + healAmount); + attrs.dirty_hp = true; + + // 触发治疗动画,即使在墓地的英雄也触发(会在其当前位置播放) + view.health(healAmount); + }); + } + /** 开始战斗按钮点击回调 */ private onStartFightBtnClick() { if (!smc.mission.play) return; diff --git a/assets/script/game/map/MissionHeroComp.ts b/assets/script/game/map/MissionHeroComp.ts index 03c60f36..3f62ae7c 100644 --- a/assets/script/game/map/MissionHeroComp.ts +++ b/assets/script/game/map/MissionHeroComp.ts @@ -133,7 +133,6 @@ export class MissionHeroCompComp extends CCComp { view.node.setPosition(spawnPos); hero.playDropAnim(spawnPos, landingPos.y); } - model.hp = model.hp_max; model.dirty_hp = true; } }