refactor(hero): 优化护盾系统日志与显示逻辑
1. 新增多处护盾相关调试日志,方便追踪护盾数值变化 2. 重构HeroAttrsComp的add_shield方法,统一日志输出格式 3. 重写HeroTopBarComp的护盾显示逻辑,改为直接显示数值而非按上限比例 4. 为HeroViewComp新增护盾特效管理,实现护盾状态自动显隐 5. 清理hk1.prefab中冗余的预制体覆盖配置
This commit is contained in:
@@ -154,14 +154,14 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
add_shield(value: number) {
|
||||
const oldShield = this.shield;
|
||||
const addValue = Math.max(0, Math.floor(value));
|
||||
if (addValue <= 0) return;
|
||||
if (addValue <= 0) {
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', `add_shield: addValue=${addValue} <= 0, skip`);
|
||||
return;
|
||||
}
|
||||
this.shield += addValue;
|
||||
this.shield = Math.min(this.shield, FightSet.SHIELD_MAX); // 限制护盾值上限(数值减免型)
|
||||
if (this.shield < 0) this.shield = 0;
|
||||
this.dirty_shield = true; // 标记护盾需要更新
|
||||
if (this.debugMode) {
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', ` 护盾值变更: ${this.hero_name}, 变化=${addValue}, ${Math.floor(oldShield)} -> ${Math.floor(this.shield)}`);
|
||||
}
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', `add_shield: ${this.hero_name}, old=${Math.floor(oldShield)}, add=${addValue}, new=${Math.floor(this.shield)}, dirty_shield=true`);
|
||||
}
|
||||
add_hp_max(value: number) {
|
||||
this.hp_max += value
|
||||
|
||||
Reference in New Issue
Block a user