refactor: 重构复活机制,将复活逻辑整合到dead触发组
1. 新增SkillOverrides的revive_hp和revive_count配置项,替代原独立复活字段 2. 移除所有revive相关的旧配置、解析函数和UI展示逻辑 3. 调整战斗逻辑,从dead触发组的overrides中读取复活配置 4. 更新文档说明,统一复活机制的配置方式 5. 清理冗余的导入和类型定义
This commit is contained in:
@@ -275,21 +275,26 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
|
||||
// 先触发死亡技能(如亡语),不管后续是否续命都应触发
|
||||
this.triggerDeadSkills(target);
|
||||
|
||||
// 濒死回血(revive 系):不是真正复活,而是血量归零瞬间消耗 1 次续命次数,
|
||||
// 按比例回血继续战斗。次数每回合重置(见 MissionComp.healAllHeroes)。
|
||||
// 死亡计数 +1(用于 dead 触发统计)
|
||||
TAttrsComp.death_count++;
|
||||
|
||||
// 从 runtime_dead 中提取复活配置(revive_hp / revive_count)
|
||||
let canRevive = false;
|
||||
let maxReviveCount = 0;
|
||||
let reviveHpPercent = 50; // 默认恢复50%
|
||||
let reviveSkillConf: any = null; // 提取出来的复活技能配置
|
||||
if (TAttrsComp.runtime_revive) {
|
||||
const reviveConf = TAttrsComp.runtime_revive;
|
||||
maxReviveCount = reviveConf.r_num + Math.floor((TAttrsComp.lv - 1) * reviveConf.upr);
|
||||
if (TAttrsComp.revived_count < maxReviveCount) {
|
||||
canRevive = true;
|
||||
// 从配置表中读取对应的复活技能配置,ap 字段代表恢复生命值的百分比
|
||||
reviveSkillConf = SkillSet[reviveConf.s_uuid];
|
||||
if (reviveSkillConf && reviveSkillConf.ap) {
|
||||
reviveHpPercent = reviveSkillConf.ap;
|
||||
let reviveHpPercent = 0;
|
||||
let reviveSkillConf: any = null;
|
||||
if (TAttrsComp.runtime_dead) {
|
||||
for (const trig of TAttrsComp.runtime_dead) {
|
||||
const reviveHp = trig.overrides?.revive_hp;
|
||||
const reviveCount = trig.overrides?.revive_count ?? 0;
|
||||
if (reviveHp !== undefined && reviveCount > 0) {
|
||||
maxReviveCount = reviveCount;
|
||||
if (TAttrsComp.revived_count < maxReviveCount) {
|
||||
canRevive = true;
|
||||
reviveHpPercent = reviveHp;
|
||||
reviveSkillConf = SkillSet[trig.s_uuid];
|
||||
}
|
||||
break; // 只取第一个复活配置
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +302,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
|
||||
if (canRevive) {
|
||||
TAttrsComp.revived_count++;
|
||||
TAttrsComp.is_reviving = true; // 标记为正在复活
|
||||
// 根据技能配置恢复生命值
|
||||
// 根据 dead 触发配置恢复生命值
|
||||
TAttrsComp.hp = Math.floor(TAttrsComp.hp_max * (reviveHpPercent / 100));
|
||||
TAttrsComp.dirty_hp = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user