feat: 新增暴击抗性和冰冻抗性属性并完善暴击冰冻判定

1.  在HeroAttrs枚举中新增critical_res和freeze_res属性
2.  在HeroAttrsComp中添加对应抗性属性并在重置方法中初始化
3.  修改暴击和冰冻判定逻辑,加入抗性减免计算
This commit is contained in:
walkpan
2026-05-14 22:53:15 +08:00
parent fdc5979484
commit e194132731
4 changed files with 11 additions and 3 deletions

View File

@@ -135,7 +135,8 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
// 暴击判定
// 使用施法者的暴击率属性damageEvent.Attrs 快照),- 被攻击者的暴击抗性属
const isCrit = this.checkChance(damageEvent.Attrs[Attrs.critical]);
const criticalChance = (damageEvent.Attrs[Attrs.critical] || 0) - (TAttrsComp.critical_res || 0);
const isCrit = this.checkChance(criticalChance);
// 计算基础伤害
let damage = this.dmgCount(damageEvent,TAttrsComp);
@@ -189,7 +190,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
mLogger.log(this.debugMode, 'HeroAtkSystem', ` 英雄${TAttrsComp.hero_name} (uuid: ${TAttrsComp.hero_uuid}) 受到 eid:${casterEid} 的 伤害 ${damage},${isCrit?"暴击":"普通"}攻击,技能ID ${damageEvent.s_uuid}`);
// 冰冻判定
const freezeChance = damageEvent.Attrs[Attrs.freeze_chance] || 0;
const freezeChance = (damageEvent.Attrs[Attrs.freeze_chance] || 0) - (TAttrsComp.freeze_res || 0);
const isFrost = !TAttrsComp.isFrost() && this.checkChance(freezeChance);
// 击退判定