refactor(游戏逻辑): 统一使用is_master判断玩家角色并简化暂停逻辑

将多处使用FacSet.HERO判断玩家角色的代码改为使用is_master属性
将stop_mon_action控制逻辑简化为统一的pause状态管理
在MissionComp初始化时确保pause状态正确重置
This commit is contained in:
walkpan
2026-01-03 19:33:53 +08:00
parent e343e26862
commit 4a2768cb13
4 changed files with 8 additions and 9 deletions

View File

@@ -204,7 +204,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 检查死亡
if (TAttrsComp.hp <= 0) {
// 复活机制:如果玩家属性内的复活属性值>=1 则执行复活,原地50%血量复活
if (TAttrsComp.fac === FacSet.HERO && TAttrsComp.Attrs[Attrs.REVIVE_COUNT] >= 1) {
if (TAttrsComp.is_master && TAttrsComp.Attrs[Attrs.REVIVE_COUNT] >= 1) {
TAttrsComp.Attrs[Attrs.REVIVE_COUNT]--;
TAttrsComp.is_reviving = true; // 标记为正在复活
@@ -226,7 +226,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
if (caster) CAttrsComp.Attrs.killed_count++;
// 玩家英雄死亡后,怪物停止刷新和移动
if (TAttrsComp.fac === FacSet.HERO) {
if (TAttrsComp.is_master) {
smc.mission.stop_mon_action = true;
console.log("[HeroAtkSystem] Hero died, stopping monster action (spawn/move)");
}
@@ -261,7 +261,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 检查死亡
if (CAttrs.hp <= 0) {
// 复活机制
if (CAttrs.fac === FacSet.HERO && CAttrs.Attrs[Attrs.REVIVE_COUNT] >= 1) {
if (CAttrs.is_master && CAttrs.Attrs[Attrs.REVIVE_COUNT] >= 1) {
CAttrs.Attrs[Attrs.REVIVE_COUNT]--;
CAttrs.is_reviving = true;
@@ -277,7 +277,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
}
// 玩家英雄死亡后,怪物停止刷新和移动
if (CAttrs.fac === FacSet.HERO) {
if (CAttrs.is_master) {
smc.mission.stop_mon_action = true;
console.log("[HeroAtkSystem] Hero died from thorns, stopping monster action (spawn/move)");
}