diff --git a/assets/script/game/hero/HeroAttrsComp.ts b/assets/script/game/hero/HeroAttrsComp.ts index cda1ca7e..b74a79cd 100644 --- a/assets/script/game/hero/HeroAttrsComp.ts +++ b/assets/script/game/hero/HeroAttrsComp.ts @@ -202,6 +202,16 @@ export class HeroAttrsComp extends ecs.Comp { finalValue = -value; } + // 护盾特殊处理:同时修改当前值和最大值 + if (attr === Attrs.shield && type === BType.VALUE) { + this.shield += finalValue; + this.shield_max += finalValue; + this.shield = Math.max(0, this.shield); + this.shield_max = Math.max(0, this.shield_max); + this.dirty_shield = true; + return; + } + // 处理百分比 // 注意:百分比通常是基于基础值计算,这里简化为直接修改当前值 // 如果需要严格的基础值+百分比,需要维护 baseAttrs 和 bonusAttrs