feat(护盾): 将护盾机制从数值吸收改为次数免疫
- 护盾技能配置的 `ap` 字段现在表示免疫次数而非攻击力百分比 - 修改护盾计算逻辑,每次受到攻击消耗1点护盾值 - 更新日志和注释以反映新的护盾行为
This commit is contained in:
@@ -93,14 +93,15 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
}
|
||||
add_shield(value:number){
|
||||
const oldShield = this.shield;
|
||||
let addValue = value;
|
||||
const addValue = Math.max(0, Math.floor(value));
|
||||
if (addValue <= 0) return;
|
||||
this.shield += addValue;
|
||||
this.shield_max += addValue;
|
||||
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.toFixed(1)}, ${oldShield.toFixed(1)} -> ${this.shield.toFixed(1)}`);
|
||||
mLogger.log(this.debugMode, 'HeroAttrs', ` 护盾次数变更: ${this.hero_name}, 变化=${addValue}, ${Math.floor(oldShield)} -> ${Math.floor(this.shield)}`);
|
||||
}
|
||||
}
|
||||
add_hp_max(value:number){
|
||||
|
||||
Reference in New Issue
Block a user