refactor(护盾): 移除 shield_max 属性并简化护盾逻辑
护盾系统不再需要维护最大护盾值,因为护盾层数已有明确上限(FightSet.SHIELD_MAX)。 移除 HeroAttrs 枚举、HeroAttrsComp 组件、HeroAtkSystem 和 HeroViewComp 中所有对 shield_max 的引用和操作。 现在护盾层数直接受 SHIELD_MAX 限制,视图层仅需当前护盾值即可显示。
This commit is contained in:
@@ -24,7 +24,6 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
speed: number = 100; // 基础移动速度
|
||||
dis: number = 100; // 基础距离
|
||||
shield: number = 0; // 当前护盾
|
||||
shield_max: number = 0; // 最大护盾值
|
||||
|
||||
// ==================== 攻击属性 (补充) ====================
|
||||
skills: Record<number, HSkillInfo> = {};
|
||||
@@ -97,9 +96,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
const addValue = Math.max(0, Math.floor(value));
|
||||
if (addValue <= 0) return;
|
||||
this.shield += addValue;
|
||||
this.shield_max += addValue;
|
||||
this.shield = Math.min(this.shield, FightSet.SHIELD_MAX); // 限制护盾最大层数
|
||||
if (this.shield < 0) this.shield = 0;
|
||||
if (this.shield_max < 0) this.shield_max = 0;
|
||||
this.dirty_shield = true; // 标记护盾需要更新
|
||||
if (this.debugMode) {
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', ` 护盾次数变更: ${this.hero_name}, 变化=${addValue}, ${Math.floor(oldShield)} -> ${Math.floor(this.shield)}`);
|
||||
@@ -229,7 +227,6 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.speed = 100;
|
||||
this.dis = 100;
|
||||
this.shield = 0;
|
||||
this.shield_max = 0;
|
||||
|
||||
// 重置新增属性
|
||||
this.skills = {};
|
||||
|
||||
Reference in New Issue
Block a user