feat(hero&buff): 新增反伤类buff与技能,支持带修饰的反伤计算
1. 新增两个反伤相关的buff配置:固定反伤7027和比例反伤7028 2. 新增两个支援技能:荆棘护盾和荆棘比例增益 3. 为HeroAttrsComp新增获取最终反伤属性的方法,支持限时修饰词计算 4. 重构英雄反伤伤害计算逻辑,使用新的属性获取方法
This commit is contained in:
@@ -196,7 +196,7 @@ export class HeroAtkSystem extends ecs.ComblockSystem implements ecs.ISystemUpda
|
||||
// 反伤值 = 实际受到伤害 * thorns_rate / 100 + thorns_dmg(固定值+比例混合)
|
||||
// DoT 不触发反伤(持续伤害类效果通常不触发荆棘)
|
||||
if (!isDot && damage > 0) {
|
||||
const thornsDmg = Math.floor(damage * TAttrsComp.thorns_rate / 100) + TAttrsComp.thorns_dmg;
|
||||
const thornsDmg = Math.floor(damage * TAttrsComp.getFinalThornsRate() / 100) + TAttrsComp.getFinalThornsDmg();
|
||||
if (thornsDmg > 0) {
|
||||
this.applyThornsDamage(casterEid, thornsDmg);
|
||||
}
|
||||
|
||||
@@ -542,6 +542,18 @@ export class HeroAttrsComp extends ecs.Comp {
|
||||
return Math.max(0, this.defense + mods.flatSum + mods.pctSum);
|
||||
}
|
||||
|
||||
/** 最终反伤固定值 = 基础 + 限时修饰(加法模型) */
|
||||
public getFinalThornsDmg(): number {
|
||||
const mods = this.aggregateTimedMods(Attrs.thorns_dmg);
|
||||
return Math.max(0, this.thorns_dmg + mods.flatSum + mods.pctSum);
|
||||
}
|
||||
|
||||
/** 最终反伤比例 = 基础 + 限时修饰(加法模型,百分点) */
|
||||
public getFinalThornsRate(): number {
|
||||
const mods = this.aggregateTimedMods(Attrs.thorns_rate);
|
||||
return Math.max(0, this.thorns_rate + mods.flatSum + mods.pctSum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按除法递减模型计算防御减伤后的伤害
|
||||
* 减伤率 = defense / (defense + DEFENSE_K),防御收益递减且永不达到 100%
|
||||
|
||||
Reference in New Issue
Block a user