From 063b882879399a8ac0c8080dd537ba1885addcd6 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sat, 3 Jan 2026 19:58:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=8B=B1=E9=9B=84=E7=B3=BB=E7=BB=9F):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8B=B1=E9=9B=84=E5=A4=8D=E6=B4=BB=E6=9C=BA?= =?UTF-8?q?=E5=88=B6=E5=B9=B6=E8=B0=83=E6=95=B4=E6=AD=BB=E4=BA=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 初始化英雄时添加复活次数属性 修改英雄死亡事件触发条件为复活次数耗尽 移除HeroViewComp中重复的死亡事件触发 --- assets/script/game/hero/Hero.ts | 4 ++-- assets/script/game/hero/HeroAtkSystem.ts | 10 +++++++--- assets/script/game/hero/HeroViewComp.ts | 6 +----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/assets/script/game/hero/Hero.ts b/assets/script/game/hero/Hero.ts index 531dacfd..96779f38 100644 --- a/assets/script/game/hero/Hero.ts +++ b/assets/script/game/hero/Hero.ts @@ -100,10 +100,10 @@ export class Hero extends ecs.Entity { model.Attrs[Attrs.AP] = model.base_ap; model.Attrs[Attrs.SPEED] = hero.speed; model.Attrs[Attrs.DIS] = hero.dis; - + // 初始化 buff/debuff 系统 model.initAttrs(); - + model.Attrs[Attrs.REVIVE_COUNT]=1 this.add(hv); oops.message.dispatchEvent(GameEvent.MasterCalled,{uuid:uuid}) const move = this.get(HeroMoveComp); diff --git a/assets/script/game/hero/HeroAtkSystem.ts b/assets/script/game/hero/HeroAtkSystem.ts index 20f6f9cd..3ed02121 100644 --- a/assets/script/game/hero/HeroAtkSystem.ts +++ b/assets/script/game/hero/HeroAtkSystem.ts @@ -8,6 +8,8 @@ import { HeroViewComp } from "./HeroViewComp"; import { DamageQueueComp, DamageEvent } from "./DamageQueueComp"; import { smc } from "../common/SingletonModuleComp"; import { TalAttrs } from "../common/config/TalSet"; +import { oops } from "db://oops-framework/core/Oops"; +import { GameEvent } from "../common/config/GameEvent"; /** 最终伤害数据接口 @@ -226,9 +228,10 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd if (caster) CAttrsComp.Attrs.killed_count++; // 玩家英雄死亡后,怪物停止刷新和移动 - if (TAttrsComp.is_master) { + if (TAttrsComp.is_master&&TAttrsComp.Attrs[Attrs.REVIVE_COUNT] <= 0) { smc.mission.stop_mon_action = true; - console.log("[HeroAtkSystem] Hero died, stopping monster action (spawn/move)"); + oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: TAttrsComp.hero_uuid}); + console.log("[HeroAtkSystem] Hero died, stopping monster action (spawn/move)"+TAttrsComp.Attrs[Attrs.REVIVE_COUNT]); } this.doDead(target); @@ -277,8 +280,9 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd } // 玩家英雄死亡后,怪物停止刷新和移动 - if (CAttrs.is_master) { + if (CAttrs.is_master&&CAttrs.Attrs[Attrs.REVIVE_COUNT] <= 0) { smc.mission.stop_mon_action = true; + oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: CAttrs.hero_uuid}); console.log("[HeroAtkSystem] Hero died from thorns, stopping monster action (spawn/move)"); } diff --git a/assets/script/game/hero/HeroViewComp.ts b/assets/script/game/hero/HeroViewComp.ts index 288a2519..cd5db488 100644 --- a/assets/script/game/hero/HeroViewComp.ts +++ b/assets/script/game/hero/HeroViewComp.ts @@ -416,11 +416,7 @@ export class HeroViewComp extends CCComp { if(this.model.fac === FacSet.HERO){ // 英雄死亡:延迟触发死亡事件 // 🔥 只有主角死亡才触发游戏结束判定 - if (this.model.is_master) { - oops.message.dispatchEvent(GameEvent.HeroDead, { - hero_uuid: this.model.hero_uuid - }); - } + if (this.model.is_master) return } // 根据阵营触发不同事件 if(this.model.fac === FacSet.MON){