refactor(英雄系统): 优化技能距离计算和伤害处理逻辑

移除getMaxSkillDistance方法的MP参数,改为内部处理
在应用伤害后添加英雄数据更新到VM的操作
This commit is contained in:
walkpan
2026-01-02 23:53:19 +08:00
parent 7cb87433a1
commit 0a7903f138
2 changed files with 6 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import { HeroAttrsComp } from "./HeroAttrsComp";
import { HeroViewComp } from "./HeroViewComp";
import { DamageQueueComp, DamageEvent } from "./DamageQueueComp";
import { smc } from "../common/SingletonModuleComp";
import { TalAttrs } from "../common/config/TalSet";
/** 最终伤害数据接口
@@ -172,8 +173,10 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
targetView.shield_tip(shieldResult.absorbedDamage);
}
if (damage <= 0) return reDate;
// 应用伤害到数据层
TAttrsComp.hp -= damage;
TAttrsComp.hp -= damage; // 应用伤害到数据层
smc.updateHeroInfo(TAttrsComp); // 更新英雄数据到 VM
if (this.debugMode) {
const casterName = damageEvent.caster?.ent?.get(HeroAttrsComp)?.hero_name || "未知";
const casterUuid = damageEvent.caster?.ent?.get(HeroAttrsComp)?.hero_uuid || 0;

View File

@@ -444,7 +444,7 @@ export class HeroAttrsComp extends ecs.Comp {
}
// 最远距离使用当前MP可施放的技能
this.maxSkillDistance = skillsComp.getMaxSkillDistance(this.mp);
this.maxSkillDistance = skillsComp.getMaxSkillDistance();
// 最近距离使用所有技能中的最小距离不考虑MP限制用于停止位置判断
this.minSkillDistance = skillsComp.getAbsoluteMinSkillDistance();
}