Skip to content

Commit 6d97791

Browse files
committed
apply spell suppress early if 100% and add gain on suppress
1 parent 03fa9f2 commit 6d97791

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

src/Modules/CalcDefence.lua

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ function calcs.defence(env, actor)
796796
output.EnergyShieldOnBlock = modDB:Sum("BASE", nil, "EnergyShieldOnBlock")
797797
output.EnergyShieldOnSpellBlock = modDB:Sum("BASE", nil, "EnergyShieldOnSpellBlock")
798798

799+
output.EnergyShieldOnSuppress = modDB:Sum("BASE", nil, "EnergyShieldOnSuppress")
800+
799801
-- damage avoidances
800802
for _, damageType in ipairs(dmgTypeList) do
801803
output["Avoid"..damageType.."DamageChance"] = m_min(modDB:Sum("BASE", nil, "Avoid"..damageType.."DamageChance"), data.misc.AvoidChanceCap)
@@ -1106,17 +1108,20 @@ function calcs.defence(env, actor)
11061108
end
11071109
end
11081110
local takenMult = output[damageType.."TakenHitMult"]
1111+
local spellSuppressMult = 1
11091112
if damageCategoryConfig == "Melee" or damageCategoryConfig == "Projectile" then
11101113
takenMult = output[damageType.."AttackTakenHitMult"]
11111114
elseif damageCategoryConfig == "Spell" or damageCategoryConfig == "SpellProjectile" then
11121115
takenMult = output[damageType.."SpellTakenHitMult"]
1116+
spellSuppressMult = output.SpellSuppressionChance == 100 and (1 - output.SpellSuppressionEffect / 100) or 1
11131117
elseif damageCategoryConfig == "Average" then
11141118
takenMult = (output[damageType.."SpellTakenHitMult"] + output[damageType.."AttackTakenHitMult"]) / 2
1119+
spellSuppressMult = output.SpellSuppressionChance == 100 and (1 - output.SpellSuppressionEffect / 100 / 2) or 1
11151120
end
1116-
output[damageType.."BaseTakenHitMult"] = (1 - (resist - enemyPen) / 100) * takenMult
1121+
output[damageType.."BaseTakenHitMult"] = (1 - (resist - enemyPen) / 100) * takenMult * spellSuppressMult
11171122
local takenMultReflect = output[damageType.."TakenReflect"]
11181123
local finalReflect = (1 - (resist - enemyPen) / 100) * takenMultReflect
1119-
output[damageType.."TakenHit"] = m_max(output[damageType.."TakenDamage"] * (1 - (resist - enemyPen) / 100) + takenFlat, 0) * takenMult
1124+
output[damageType.."TakenHit"] = m_max(output[damageType.."TakenDamage"] * (1 - (resist - enemyPen) / 100) + takenFlat, 0) * takenMult * spellSuppressMult
11201125
output[damageType.."TakenHitMult"] = (output[damageType.."TakenDamage"] > 0) and (output[damageType.."TakenHit"] / output[damageType.."TakenDamage"]) or 0
11211126
output["totalTakenHit"] = output["totalTakenHit"] + output[damageType.."TakenHit"]
11221127
if output.AnyTakenReflect then
@@ -1130,7 +1135,7 @@ function calcs.defence(env, actor)
11301135
t_insert(breakdown[damageType.."TakenHitMult"], s_format("Enemy Pen: %.2f", enemyPen))
11311136
end
11321137
t_insert(breakdown[damageType.."TakenHitMult"], s_format("+ Flat: %.3f", takenFlat))
1133-
t_insert(breakdown[damageType.."TakenHitMult"], s_format("x Taken: %.3f", takenMult))
1138+
t_insert(breakdown[damageType.."TakenHitMult"], s_format("x Taken: %.3f", takenMult * spellSuppressMult))
11341139
t_insert(breakdown[damageType.."TakenHitMult"], s_format("= %.3f", output[damageType.."TakenHitMult"]))
11351140
breakdown[damageType.."TakenHit"] = {
11361141
s_format("Final %s Damage taken:", damageType),
@@ -1605,32 +1610,36 @@ function calcs.defence(env, actor)
16051610
DamageIn.EnergyShieldWhenHit = DamageIn.EnergyShieldWhenHit + output.EnergyShieldOnSpellBlock / 2 * BlockChance
16061611
end
16071612
end
1608-
-- supression
1609-
if damageCategoryConfig == "Spell" or damageCategoryConfig == "SpellProjectile" or damageCategoryConfig == "Average" then
1613+
-- suppression
1614+
if damageCategoryConfig == "Spell" or damageCategoryConfig == "SpellProjectile" or damageCategoryConfig == "Average" then
16101615
suppressChance = output.SpellSuppressionChance / 100
16111616
end
1612-
-- unlucky config to lower the value of block, dodge, evade etc for ehp
1613-
if worstOf > 1 then
1614-
suppressChance = suppressChance * suppressChance
1615-
if worstOf == 4 then
1617+
-- We include suppresion in damage reduction if it is 100% otherwise we handle it here.
1618+
if suppressChance < 1 then
1619+
-- unlucky config to lower the value of block, dodge, evade etc for ehp
1620+
if worstOf > 1 then
16161621
suppressChance = suppressChance * suppressChance
1622+
if worstOf == 4 then
1623+
suppressChance = suppressChance * suppressChance
1624+
end
16171625
end
1626+
if damageCategoryConfig == "Average" then
1627+
suppressChance = suppressChance / 2
1628+
end
1629+
DamageIn.EnergyShieldWhenHit = (DamageIn.EnergyShieldWhenHit or 0) + output.EnergyShieldOnSuppress * suppressChance
1630+
suppressionEffect = 1 - suppressChance * output.SpellSuppressionEffect / 100
1631+
else
1632+
DamageIn.EnergyShieldWhenHit = (DamageIn.EnergyShieldWhenHit or 0) + output.EnergyShieldOnSuppress * ( damageCategoryConfig == "Average" and 0.5 or 1 )
16181633
end
1619-
if damageCategoryConfig == "Average" then
1620-
suppressChance = suppressChance / 2
1621-
end
1622-
suppressionEffect = 1 - suppressChance * output.SpellSuppressionEffect / 100
16231634
-- extra avoid chance
16241635
if damageCategoryConfig == "Projectile" or damageCategoryConfig == "SpellProjectile" then
16251636
ExtraAvoidChance = ExtraAvoidChance + output.AvoidProjectilesChance
16261637
elseif damageCategoryConfig == "Average" then
16271638
ExtraAvoidChance = ExtraAvoidChance + output.AvoidProjectilesChance / 2
16281639
end
1629-
-- gain when hit (currently just gain on block)
1630-
if not env.configInput.DisableEHPGainOnBlock then
1631-
if DamageIn.LifeWhenHit ~= 0 or DamageIn.ManaWhenHit ~= 0 or DamageIn.EnergyShieldWhenHit ~= 0 then
1632-
DamageIn.GainWhenHit = true
1633-
end
1640+
-- gain when hit (currently just gain on block/suppress)
1641+
if (DamageIn.LifeWhenHit or 0) ~= 0 or (DamageIn.ManaWhenHit or 0) ~= 0 or DamageIn.EnergyShieldWhenHit ~= 0 then
1642+
DamageIn.GainWhenHit = true
16341643
end
16351644
for _, damageType in ipairs(dmgTypeList) do
16361645
-- Emperor's Vigilance (this needs to fail with divine flesh as it cant override it, hence the check for high bypass)
@@ -1663,7 +1672,7 @@ function calcs.defence(env, actor)
16631672
if output.ShowBlockEffect then
16641673
t_insert(breakdown["ConfiguredDamageChance"], s_format("x %.2f ^8(block effect)", output.BlockEffect / 100))
16651674
end
1666-
if suppressionEffect > 0 then
1675+
if suppressionEffect < 1 then
16671676
t_insert(breakdown["ConfiguredDamageChance"], s_format("x %.3f ^8(suppression effect)", suppressionEffect))
16681677
end
16691678
if averageAvoidChance > 0 then

src/Modules/CalcSections.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ return {
14411441
extra = "{0:output:SpellSuppressionChance}%",
14421442
{ label = "Suppression Ch.", { format = "{0:output:SpellSuppressionChance}% (+{0:output:SpellSuppressionChanceOverCap}%)", { modName = "SpellSuppressionChance" }, }, },
14431443
{ label = "Suppression Effect", { format = "{0:output:SpellSuppressionEffect}%", { modName = "SpellSuppressionEffect" }, }, },
1444+
{ label = "ES on Suppression", haveOutput = "EnergyShieldOnSuppress", { format = "{0:output:EnergyShieldOnSuppress}", { modName = "EnergyShieldOnSuppress" }, }, },
14441445
} },
14451446
} },
14461447
{ 3, "DamageTaken", 1, colorCodes.DEFENCE, {{ defaultCollapsed = false, label = "Damage Taken", data = {

src/Modules/ModParser.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,6 +2877,7 @@ local specialModList = {
28772877
["damage from unblocked hits always bypasses energy shield"] = { flag("UnblockedDamageDoesBypassES", { type = "Condition", var = "EVBypass", neg = true }) },
28782878
["recover (%d+) life when you block"] = function(num) return { mod("LifeOnBlock", "BASE", num) } end,
28792879
["recover (%d+) energy shield when you block spell damage"] = function(num) return { mod("EnergyShieldOnSpellBlock", "BASE", num) } end,
2880+
["recover (%d+) energy shield when you suppress spell damage"] = function(num) return { mod("EnergyShieldOnSuppress", "BASE", num) } end,
28802881
["recover (%d+)%% of life when you block"] = function(num) return { mod("LifeOnBlock", "BASE", 1, { type = "PerStat", stat = "Life", div = 100 / num }) } end,
28812882
["recover (%d+)%% of life when you block attack damage while wielding a staff"] = function(num) return { mod("LifeOnBlock", "BASE", 1, { type = "PerStat", stat = "Life", div = 100 / num }, { type = "Condition", var = "UsingStaff" }) } end,
28822883
["recover (%d+)%% of your maximum mana when you block"] = function(num) return { mod("ManaOnBlock", "BASE", 1, { type = "PerStat", stat = "Mana", div = 100 / num }) } end,

0 commit comments

Comments
 (0)