Skip to content

Commit 79a598d

Browse files
authored
Add support for % of damage bypasses ward (#4549)
This mod comes from Nightgrip Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
1 parent 6a69d38 commit 79a598d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/Modules/CalcDefence.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ function calcs.defence(env, actor)
13911391
if output[damageType.."EnergyShieldBypass"] > 0 then
13921392
local poolProtected = output.EnergyShieldRecoveryCap / (1 - output[damageType.."EnergyShieldBypass"] / 100) * (output[damageType.."EnergyShieldBypass"] / 100)
13931393
output[damageType.."TotalPool"] = m_max(output[damageType.."TotalPool"] - poolProtected, 0) + m_min(output[damageType.."TotalPool"], poolProtected) / (output[damageType.."EnergyShieldBypass"] / 100)
1394-
else
1394+
else
13951395
output[damageType.."TotalPool"] = output[damageType.."TotalPool"] + output.EnergyShieldRecoveryCap
13961396
end
13971397
end
@@ -1449,8 +1449,10 @@ function calcs.defence(env, actor)
14491449
if not DamageIn[damageType.."EnergyShieldBypass"] then
14501450
DamageIn[damageType.."EnergyShieldBypass"] = output[damageType.."EnergyShieldBypass"] or 0
14511451
end
1452+
14521453
end
14531454
DamageIn["LifeLossBelowHalfLost"] = DamageIn["LifeLossBelowHalfLost"] or 0
1455+
DamageIn["WardBypass"] = DamageIn["WardBypass"] or modDB:Sum("BASE", nil, "WardBypass") or 0
14541456

14551457
local itterationMultiplier = 1
14561458
local maxHits = data.misc.ehpCalcMaxHitsToCalc
@@ -1500,7 +1502,7 @@ function calcs.defence(env, actor)
15001502
Damage[damageType] = Damage[damageType] - tempDamage
15011503
end
15021504
if ward > 0 then
1503-
local tempDamage = m_min(Damage[damageType], ward)
1505+
local tempDamage = m_min(Damage[damageType] * (1 - DamageIn["WardBypass"] / 100), ward)
15041506
ward = ward - tempDamage
15051507
Damage[damageType] = Damage[damageType] - tempDamage
15061508
end
@@ -1919,7 +1921,15 @@ function calcs.defence(env, actor)
19191921
output[damageType.."TotalPool"] = output[damageType.."TotalPool"] / (1 - output["preventedLifeLoss"] / 100)
19201922
end
19211923
--ward
1922-
output[damageType.."TotalPool"] = output[damageType.."TotalPool"] + output.Ward or 0
1924+
local wardBypass = modDB:Sum("BASE", nil, "WardBypass") or 0
1925+
if wardBypass > 0 then
1926+
local poolProtected = output.Ward / (1 - wardBypass / 100) * (wardBypass / 100)
1927+
local sourcePool = output[damageType.."TotalPool"]
1928+
sourcePool = m_max(sourcePool - poolProtected, 0) + m_min(sourcePool, poolProtected) / (wardBypass / 100)
1929+
output[damageType.."TotalPool"] = sourcePool
1930+
else
1931+
output[damageType.."TotalPool"] = output[damageType.."TotalPool"] + output.Ward or 0
1932+
end
19231933
--aegis
19241934
output[damageType.."TotalHitPool"] = output[damageType.."TotalPool"] + output[damageType.."Aegis"] or 0 + output[damageType.."sharedAegis"] or 0 + isElemental[damageType] and output[damageType.."sharedElementalAegis"] or 0
19251935
--guardskill

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,7 @@ local specialModList = {
16281628
["auras from your skills have (%d+)%% increased effect on you"] = function(num) return { mod("SkillAuraEffectOnSelf", "INC", num) } end,
16291629
["increases and reductions to mana regeneration rate instead apply to rage regeneration rate"] = { flag("ManaRegenToRageRegen") },
16301630
["increases and reductions to maximum energy shield instead apply to ward"] = { flag("EnergyShieldToWard") },
1631+
["(%d+)%% of damage taken bypasses ward"] = function(num) return { mod("WardBypass", "BASE", num) } end,
16311632
["maximum energy shield is (%d+)"] = function(num) return { mod("EnergyShield", "OVERRIDE", num ) } end,
16321633
["while not on full life, sacrifice ([%d%.]+)%% of mana per second to recover that much life"] = function(num) return {
16331634
mod("ManaDegen", "BASE", 1, { type = "PercentStat", stat = "Mana", percent = num }, { type = "Condition", var = "FullLife", neg = true }),

0 commit comments

Comments
 (0)