feat: 新增闪避与命中属性系统,完善战斗判定逻辑
1. 新增全局默认闪避/命中率配置,为英雄和怪物提供缺省属性兜底 2. 扩展英雄属性组件,添加闪避、命中率属性与对应计算接口 3. 实现闪避判定逻辑,修正伤害流程,添加闪避提示效果 4. 新增闪避/命中相关buff、技能与光环配置 5. 完善属性值计算与 tooltip 显示逻辑
This commit is contained in:
@@ -75,6 +75,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
// ==================== 特殊属性 ====================
|
||||
critical: number = 0; // 暴击率
|
||||
critical_res: number = 0; // 暴击抗性
|
||||
dodge: number = 0; // 闪避率(被攻击时闪避概率,百分点)
|
||||
accuracy: number = 0; // 命中率(攻击时命中概率,百分点;削减目标闪避)
|
||||
freeze_chance: number = 0; // 冰冻概率
|
||||
freeze_res: number = 0; // 冰冻抗性
|
||||
stun_chance: number = 0; // 击晕概率
|
||||
@@ -350,6 +352,18 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
return this.critical + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroCrit);
|
||||
}
|
||||
|
||||
/** 英雄实时闪避率 = 基础闪避率 + 驻场闪避率。 */
|
||||
public getRuntimeDodge(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.dodge;
|
||||
return this.dodge + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroDodge);
|
||||
}
|
||||
|
||||
/** 英雄实时命中率 = 基础命中率 + 驻场命中率。 */
|
||||
public getRuntimeAccuracy(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.accuracy;
|
||||
return this.accuracy + HeroAttrsComp.getFieldPercentValue(FieldSkillType.HeroHit);
|
||||
}
|
||||
|
||||
/** 英雄实时冰冻率 = 基础冰冻率 + 驻场冰冻率。 */
|
||||
public getRuntimeFreezeChance(): number {
|
||||
if (this.fac !== FacSet.HERO) return this.freeze_chance;
|
||||
@@ -541,6 +555,20 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
return this.critical_res + mods.flatSum + mods.pctSum;
|
||||
}
|
||||
|
||||
/** 最终闪避率 = 驻场实时闪避率 + 限时修饰(加法模型) */
|
||||
public getFinalDodge(): number {
|
||||
const base = this.getRuntimeDodge();
|
||||
const mods = this.aggregateTimedMods(Attrs.dodge);
|
||||
return base + mods.flatSum + mods.pctSum;
|
||||
}
|
||||
|
||||
/** 最终命中率 = 驻场实时命中率 + 限时修饰(加法模型) */
|
||||
public getFinalAccuracy(): number {
|
||||
const base = this.getRuntimeAccuracy();
|
||||
const mods = this.aggregateTimedMods(Attrs.accuracy);
|
||||
return base + mods.flatSum + mods.pctSum;
|
||||
}
|
||||
|
||||
/** 最终冰冻抗性 = 基础 + 限时修饰(加法模型) */
|
||||
public getFinalFreezeRes(): number {
|
||||
const mods = this.aggregateTimedMods(Attrs.freeze_res);
|
||||
@@ -687,6 +715,8 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
this.runtime_field = undefined;
|
||||
this.critical = 0;
|
||||
this.critical_res = 0;
|
||||
this.dodge = 0;
|
||||
this.accuracy = 0;
|
||||
this.freeze_chance = 0;
|
||||
this.freeze_res = 0;
|
||||
this.stun_chance = 0;
|
||||
|
||||
Reference in New Issue
Block a user