Skip to content

Commit 0eecb27

Browse files
LocalIdentityLocalIdentity
andauthored
Update evasion to also apply to spell damage (#1229)
Changes evasion to apply to damage from spells Adds breakdowns for spell evasion incase GGG adds it at some point Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 07b4083 commit 0eecb27

4 files changed

Lines changed: 47 additions & 10 deletions

File tree

src/Modules/BuildDisplayStats.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ local displayStats = {
158158
{ },
159159
{ stat = "Evasion", label = "Evasion rating", fmt = "d", color = colorCodes.EVASION, compPercent = true },
160160
{ stat = "Spec:EvasionInc", label = "%Inc Evasion from Tree", color = colorCodes.EVASION, fmt = "d%%" },
161-
{ stat = "MeleeEvadeChance", label = "Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.MeleeEvadeChance == o.ProjectileEvadeChance end },
162-
{ stat = "MeleeEvadeChance", label = "Melee Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.MeleeEvadeChance ~= o.ProjectileEvadeChance end },
163-
{ stat = "ProjectileEvadeChance", label = "Projectile Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.MeleeEvadeChance ~= o.ProjectileEvadeChance end },
161+
{ stat = "EvadeChance", label = "Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.noSplitEvade end },
162+
{ stat = "MeleeEvadeChance", label = "Melee Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.splitEvade end },
163+
{ stat = "ProjectileEvadeChance", label = "Projectile Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.splitEvade end },
164+
{ stat = "SpellEvadeChance", label = "Spell Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.splitEvade end },
165+
{ stat = "SpellProjectileEvadeChance", label = "Spell Proj. Evade Chance", fmt = "d%%", color = colorCodes.EVASION, condFunc = function(v,o) return v > 0 and o.splitEvade end },
164166
{ },
165167
{ stat = "Armour", label = "Armour", fmt = "d", compPercent = true },
166168
{ stat = "Spec:ArmourInc", label = "%Inc Armour from Tree", fmt = "d%%" },

src/Modules/CalcDefence.lua

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,8 @@ function calcs.defence(env, actor)
13361336
output.Evasion = m_max(round(output.Evasion), 0)
13371337
output.MeleeEvasion = m_max(round(output.Evasion * calcLib.mod(modDB, nil, "MeleeEvasion")), 0)
13381338
output.ProjectileEvasion = m_max(round(output.Evasion * calcLib.mod(modDB, nil, "ProjectileEvasion")), 0)
1339+
output.SpellEvasion = m_max(round(output.Evasion * calcLib.mod(modDB, nil, "SpellEvasion")), 0)
1340+
output.SpellProjectileEvasion = m_max(round(output.Evasion * calcLib.mod(modDB, nil, "SpellProjectileEvasion")), 0)
13391341
output.LowestOfArmourAndEvasion = m_min(output.Armour, output.Evasion)
13401342
output.Ward = m_max(m_floor(ward), 0)
13411343
output["Gear:Ward"] = gearWard
@@ -1355,10 +1357,14 @@ function calcs.defence(env, actor)
13551357
output.EvadeChance = 0
13561358
output.MeleeEvadeChance = 0
13571359
output.ProjectileEvadeChance = 0
1360+
output.SpellEvadeChance = 0
1361+
output.SpellProjectileEvadeChance = 0
13581362
elseif modDB:Flag(nil, "AlwaysEvade") then
13591363
output.EvadeChance = 100
13601364
output.MeleeEvadeChance = 100
13611365
output.ProjectileEvadeChance = 100
1366+
output.SpellEvadeChance = 100
1367+
output.SpellProjectileEvadeChance = 100
13621368
else
13631369
local enemyAccuracy = round(calcLib.val(enemyDB, "Accuracy"))
13641370
if modDB:Flag(nil, "EnemyAccuracyDistancePenalty") then
@@ -1372,8 +1378,10 @@ function calcs.defence(env, actor)
13721378
output.EvadeChance = 100 - (calcs.hitChance(output.Evasion, enemyAccuracy) - evadeChance) * hitChance
13731379
output.MeleeEvadeChance = m_max(0, m_min(evadeMax, (100 - (calcs.hitChance(output.MeleeEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "MeleeEvadeChance")))
13741380
output.ProjectileEvadeChance = m_max(0, m_min(evadeMax, (100 - (calcs.hitChance(output.ProjectileEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance")))
1381+
output.SpellEvadeChance = m_max(0, m_min(evadeMax, (100 - (calcs.hitChance(output.SpellEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "SpellEvadeChance")))
1382+
output.SpellProjectileEvadeChance = m_max(0, m_min(evadeMax, (100 - (calcs.hitChance(output.SpellProjectileEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance", "SpellProjectileEvadeChance")))
13751383
-- Condition for displaying evade chance only if melee or projectile evade chance have the same values
1376-
if output.MeleeEvadeChance ~= output.ProjectileEvadeChance then
1384+
if output.MeleeEvadeChance ~= output.ProjectileEvadeChance and output.MeleeEvadeChance ~= output.SpellEvadeChance and output.MeleeEvadeChance ~= output.SpellProjectileEvadeChance then
13771385
output.splitEvade = true
13781386
else
13791387
output.EvadeChance = output.MeleeEvadeChance
@@ -1398,6 +1406,18 @@ function calcs.defence(env, actor)
13981406
s_format("Effective Evasion: %d", output.ProjectileEvasion),
13991407
s_format("Approximate projectile evade chance: %d%%", output.ProjectileEvadeChance),
14001408
}
1409+
breakdown.SpellEvadeChance = {
1410+
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
1411+
s_format("Average enemy accuracy: %d", enemyAccuracy),
1412+
s_format("Effective Evasion: %d", output.SpellEvasion),
1413+
s_format("Approximate spell evade chance: %d%%", output.SpellEvadeChance),
1414+
}
1415+
breakdown.SpellProjectileEvadeChance = {
1416+
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
1417+
s_format("Average enemy accuracy: %d", enemyAccuracy),
1418+
s_format("Effective Evasion: %d", output.SpellProjectileEvasion),
1419+
s_format("Approximate spell projectile evade chance: %d%%", output.SpellProjectileEvadeChance),
1420+
}
14011421
end
14021422
end
14031423
end
@@ -1922,11 +1942,11 @@ function calcs.buildDefenceEstimations(env, actor)
19221942
local worstOf = env.configInput.EHPUnluckyWorstOf or 1
19231943
output.MeleeNotHitChance = 100 - (1 - output.MeleeEvadeChance / 100) * (1 - output.EffectiveAttackDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * 100
19241944
output.ProjectileNotHitChance = 100 - (1 - output.ProjectileEvadeChance / 100) * (1 - output.EffectiveAttackDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * (1 - (output.specificTypeAvoidance and 0 or output.AvoidProjectilesChance) / 100) * 100
1925-
output.SpellNotHitChance = 100 - (1 - output.EffectiveSpellDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * 100
1926-
output.SpellProjectileNotHitChance = 100 - (1 - output.EffectiveSpellDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * (1 - (output.specificTypeAvoidance and 0 or output.AvoidProjectilesChance) / 100) * 100
1945+
output.SpellNotHitChance = 100 - (1 - output.SpellEvadeChance / 100) * (1 - output.EffectiveSpellDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * 100
1946+
output.SpellProjectileNotHitChance = 100 - (1 - output.SpellProjectileEvadeChance / 100) * (1 - output.EffectiveSpellDodgeChance / 100) * (1 - output.AvoidAllDamageFromHitsChance / 100) * (1 - (output.specificTypeAvoidance and 0 or output.AvoidProjectilesChance) / 100) * 100
19271947
output.UntypedNotHitChance = 100 - (1 - output.AvoidAllDamageFromHitsChance / 100) * 100
19281948
output.AverageNotHitChance = (output.MeleeNotHitChance + output.ProjectileNotHitChance + output.SpellNotHitChance + output.SpellProjectileNotHitChance) / 4
1929-
output.AverageEvadeChance = (output.MeleeEvadeChance + output.ProjectileEvadeChance) / 4
1949+
output.AverageEvadeChance = (output.MeleeEvadeChance + output.ProjectileEvadeChance + output.SpellNotHitChance + output.SpellProjectileNotHitChance) / 4
19301950
output.ConfiguredNotHitChance = output[damageCategoryConfig.."NotHitChance"]
19311951
output.ConfiguredEvadeChance = output[damageCategoryConfig.."EvadeChance"] or 0
19321952
-- unlucky config to lower the value of block, dodge, evade etc for ehp
@@ -3147,15 +3167,18 @@ function calcs.buildDefenceEstimations(env, actor)
31473167
t_insert(breakdown["ConfiguredNotHitChance"], s_format("x %.2f ^8(chance for avoidance to fail)", 1 - output.AvoidProjectilesChance / 100))
31483168
end
31493169
elseif damageCategoryConfig == "Spell" or damageCategoryConfig == "SpellProjectile" then
3170+
if output[damageCategoryConfig.."EvadeChance"] > 0 then
3171+
t_insert(breakdown["ConfiguredNotHitChance"], s_format("%.2f ^8(chance for evasion to fail)", 1 - output[damageCategoryConfig.."EvadeChance"] / 100))
3172+
end
31503173
if output.SpellDodgeChance > 0 then
31513174
t_insert(breakdown["ConfiguredNotHitChance"], s_format("%.2f ^8(chance for dodge to fail)", 1 - output.SpellDodgeChance / 100))
31523175
end
31533176
if damageCategoryConfig == "SpellProjectile" and not output.specificTypeAvoidance and output.AvoidProjectilesChance > 0 then
31543177
t_insert(breakdown["ConfiguredNotHitChance"], s_format("x %.2f ^8(chance for avoidance to fail)", 1 - output.AvoidProjectilesChance / 100))
31553178
end
31563179
elseif damageCategoryConfig == "Average" then
3157-
if output.MeleeEvadeChance > 0 or output.ProjectileEvadeChance > 0 then
3158-
t_insert(breakdown["ConfiguredNotHitChance"], s_format("%.2f ^8(chance for evasion to fail, only applies to the attack portion)", 1 - (output.MeleeEvadeChance + output.ProjectileEvadeChance) / 2 / 100))
3180+
if output.MeleeEvadeChance > 0 or output.ProjectileEvadeChance > 0 or output.SpellNotHitChance > 0 or output.SpellProjectileNotHitChance > 0 then
3181+
t_insert(breakdown["ConfiguredNotHitChance"], s_format("%.2f ^8(chance for evasion to fail)", 1 - (output.MeleeEvadeChance + output.ProjectileEvadeChance + output.SpellNotHitChance + output.SpellProjectileNotHitChance) / 4 / 100))
31593182
end
31603183
if output.AttackDodgeChance > 0 or output.SpellDodgeChance > 0 then
31613184
t_insert(breakdown["ConfiguredNotHitChance"], s_format("x%.2f ^8(chance for dodge to fail)", 1 - (output.AttackDodgeChance + output.SpellDodgeChance) / 2 / 100))

src/Modules/CalcSections.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ return {
16341634
{ label = "Total", { format = "{0:output:Evasion}", { breakdown = "Evasion" }, }, },
16351635
{ label = "Evade Chance", haveOutput = "noSplitEvade", { format = "{0:output:EvadeChance}%",
16361636
{ breakdown = "EvadeChance" },
1637-
{ label = "Player modifiers", modName = { "CannotEvade", "EvadeChance", "MeleeEvadeChance", "ProjectileEvadeChance" } },
1637+
{ label = "Player modifiers", modName = { "CannotEvade", "EvadeChance", "MeleeEvadeChance", "ProjectileEvadeChance", "SpellEvadeChance", "SpellProjectileEvadeChance" } },
16381638
{ label = "Enemy modifiers", modName = { "Accuracy", "HitChance" }, enemy = true },
16391639
}, },
16401640
{ label = "Melee Evade Ch.", haveOutput = "splitEvade", { format = "{0:output:MeleeEvadeChance}%",
@@ -1647,6 +1647,16 @@ return {
16471647
{ label = "Player modifiers", modName = { "CannotEvade", "EvadeChance", "ProjectileEvadeChance" } },
16481648
{ label = "Enemy modifiers", modName = { "Accuracy", "HitChance" }, enemy = true },
16491649
}, },
1650+
{ label = "Spell Evade Ch.", haveOutput = "splitEvade", { format = "{0:output:SpellEvadeChance}%",
1651+
{ breakdown = "SpellEvadeChance" },
1652+
{ label = "Player modifiers", modName = { "CannotEvade", "EvadeChance", "SpellEvadeChance" } },
1653+
{ label = "Enemy modifiers", modName = { "Accuracy", "HitChance" }, enemy = true },
1654+
}, },
1655+
{ label = "Spell Proj. Evade Ch.", haveOutput = "splitEvade", { format = "{0:output:SpellProjectileEvadeChance}%",
1656+
{ breakdown = "SpellProjectileEvadeChance" },
1657+
{ label = "Player modifiers", modName = { "CannotEvade", "EvadeChance", "ProjectileEvadeChance", "SpellProjectileEvadeChance" } },
1658+
{ label = "Enemy modifiers", modName = { "Accuracy", "HitChance" }, enemy = true },
1659+
}, },
16501660
{ label = "Effect of Blind", haveOutput = "BlindEffectMod", { format = "{0:output:BlindEffectMod}%", { breakdown = "BlindEffectMod" }, { modName = { "BlindEffect", "BuffEffectOnSelf" }, }, } },
16511661
} }
16521662
} },

src/Modules/ModParser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ local modNameList = {
219219
["chance to evade attacks"] = "EvadeChance",
220220
["chance to evade attack hits"] = "EvadeChance",
221221
["chance to evade projectile attacks"] = "ProjectileEvadeChance",
222+
["chance to evade spells"] = "SpellEvadeChance",
223+
["chance to evade spell hits"] = "SpellEvadeChance",
222224
["chance to evade melee attacks"] = "MeleeEvadeChance",
223225
["evasion rating against melee attacks"] = "MeleeEvasion",
224226
["evasion rating against projectile attacks"] = "ProjectileEvasion",

0 commit comments

Comments
 (0)