refactor(英雄系统): 移除主角特殊逻辑和怪物死亡处理
- 删除 HeroAttrsComp 中的 is_master 字段 - 简化 Hero.load() 方法签名,移除 is_master 和 is_friend 参数 - 移除 MissionComp 中的怪物死亡事件监听和奖励计算逻辑 - 移除 HeroViewComp 中主角复活时恢复怪物行动的逻辑 - 修改 HeroAtkSystem 中复活逻辑,不再区分主角 - 将 MissionHeroComp 中的 CallFriend 事件改为 CallHero,并清理事件监听 - 移除英雄死亡时停止怪物刷新的逻辑,简化阵营判断 这些更改旨在简化英雄系统架构,消除主角与普通英雄之间的特殊处理差异,使系统更加统一和可维护。怪物死亡奖励计算等逻辑被移至其他系统处理。
This commit is contained in:
@@ -172,20 +172,15 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
// 检查死亡
|
||||
if (TAttrsComp.hp <= 0) {
|
||||
// 复活机制:如果玩家属性内的复活属性值>=1 则执行复活,原地50%血量复活
|
||||
if (TAttrsComp.is_master && TAttrsComp.revive_count >= 1) {
|
||||
if (TAttrsComp.revive_count >= 1) {
|
||||
TAttrsComp.revive_count--;
|
||||
TAttrsComp.is_reviving = true; // 标记为正在复活
|
||||
|
||||
// 停止怪物行动
|
||||
smc.mission.stop_mon_action = true;
|
||||
|
||||
// 触发死亡动画(假死)
|
||||
if (targetView) {
|
||||
targetView.do_dead();
|
||||
// 延迟1秒复活
|
||||
targetView.scheduleRevive(1.0);
|
||||
}
|
||||
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', ` Hero waiting to revive! Lives left: ${TAttrsComp.revive_count}`);
|
||||
return reDate;
|
||||
}
|
||||
@@ -193,13 +188,6 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
||||
// 增加被击杀计数
|
||||
if (caster) CAttrsComp.killed_count++;
|
||||
|
||||
// 玩家英雄死亡后,怪物停止刷新和移动
|
||||
if (TAttrsComp.is_master&&TAttrsComp.revive_count <= 0) {
|
||||
smc.mission.stop_mon_action = true;
|
||||
oops.message.dispatchEvent(GameEvent.HeroDead, { hero_uuid: TAttrsComp.hero_uuid});
|
||||
mLogger.log(this.debugMode, 'HeroAtkSystem', " Hero died, stopping monster action (spawn/move)"+TAttrsComp.revive_count);
|
||||
}
|
||||
|
||||
this.doDead(target);
|
||||
// ✅ 触发死亡视图表现
|
||||
if (targetView) {
|
||||
|
||||
Reference in New Issue
Block a user