refactor(hero): 优化调试日志输出并添加调试工具方法

添加条件日志方法 debugLog 和 debugWarn 来统一管理调试输出
将 HeroAtkSystem 中的 console.log 调用改为条件输出
启用 HeroViewComp 的调试模式以便开发时查看日志
This commit is contained in:
panw
2025-11-28 10:29:54 +08:00
parent 7a7a6fa02c
commit 509539760d
2 changed files with 26 additions and 8 deletions

View File

@@ -151,7 +151,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
const isCrit = this.checkChance(damageEvent.Attrs[Attrs.CRITICAL]-TAttrsComp.Attrs[Attrs.CRITICAL_RESIST]);
// 计算基础伤害
let damage = this.dmgCount(damageEvent,TAttrsComp);
console.log("[HeroAtkSystem] dmgCount",damage)
if (this.debugMode) console.log("[HeroAtkSystem] dmgCount",damage)
if (isCrit) {
// 暴击伤害计算
// 使用施法者的暴击伤害加成属性damageEvent.Attrs 快照)
@@ -162,10 +162,10 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
CAttrsComp?.useValueTalByAttr(Attrs.CRITICAL); // 清除施法者的暴击buff
}
console.log("[HeroAtkSystem] after crit",damage)
if (this.debugMode) console.log("[HeroAtkSystem] after crit",damage)
// 护盾吸收
damage =Math.floor(this.absorbShield(TAttrsComp, damage))
console.log("[HeroAtkSystem] after shield",damage)
if (this.debugMode) console.log("[HeroAtkSystem] after shield",damage)
if (damage <= 0) return reDate;
// 应用伤害到数据层
TAttrsComp.hp -= damage;