feat(英雄系统): 添加英雄复活机制并调整死亡处理逻辑
初始化英雄时添加复活次数属性 修改英雄死亡事件触发条件为复活次数耗尽 移除HeroViewComp中重复的死亡事件触发
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)");
|
||||
}
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user