refactor(hero): 重构英雄死亡与复活机制

1. 统一英雄真实死亡流程:死亡时快照数据到全局列表,动画结束后统一销毁实体
2. 移除回合自动复活逻辑,改为由复活系统主动读取快照重新召唤
3. 修复近战追敌可能脱离战场的问题,增加推进距离上限
4. 重构死亡计数与全员存活检测逻辑,基于死亡快照列表而非实体状态
This commit is contained in:
pan
2026-08-12 16:15:33 +08:00
parent ab6a3b7824
commit 3060ee7df7
6 changed files with 79 additions and 42 deletions

View File

@@ -38,6 +38,23 @@ export interface CloudData {
openid: string;
data: GameDate;
}
/**
* 死亡英雄快照:英雄真实死亡时记录,供后续复活机制(重新召唤)消费。
* 仅记录静态/成长数据不含战斗内临时状态buff、CD 等)。
*/
export interface DeadHeroRecord {
/** 英雄模板 uuid决定重新召唤哪个英雄 */
uuid: number;
/** 死亡时的英雄等级(复活后继承) */
lv: number;
/** 卡牌等级(驱动 bg_node 颜色) */
card_lv: number;
/** 死亡时占用的站位索引(复活时优先归位,-1 表示未分配) */
posIndex: number;
/** 死亡时的回合数(用于统计/按回合清理) */
wave: number;
}
/** 游戏模块 */
@ecs.register('SingletonModule')
export class SingletonModuleComp extends ecs.Comp {
@@ -60,6 +77,8 @@ export class SingletonModuleComp extends ecs.Comp {
stop_mon_action: false,
heroGrid: [-1, -1, -1, -1, -1, -1],
monGrid: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1],
/** 本局真实死亡的英雄快照列表,供后续复活机制消费;整局结束(MissionEnd)时清空 */
dead_heroes: [] as DeadHeroRecord[],
};
data: any = {
openid: '',