Skip to content

Commit

Permalink
Fix an issue where Secrets of Suffering wasn't applying (#4177)
Browse files Browse the repository at this point in the history
* fix: chance to inflict an ailment on a critical strike could be lower than on a non-crit for alternate ailments

* Fixes #4173: Ailment chance on crit being overwritten for Secrets of Suffering

* fix: typo when removing unnecessary resolute technique check

* fix: remove ailment config options when critting isn't possible
  • Loading branch information
Wires77 authored Feb 28, 2022
1 parent 5511e4f commit de93946
Showing 1 changed file with 54 additions and 84 deletions.
138 changes: 54 additions & 84 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2685,40 +2685,6 @@ function calcs.offence(env, actor, activeSkill)
else
output.PoisonChanceOnCrit = m_min(100, skillModList:Sum("BASE", cfg, "PoisonChance") + enemyDB:Sum("BASE", nil, "SelfPoisonChance"))
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotIgnite") then
output.IgniteChanceOnCrit = 0
else
output.IgniteChanceOnCrit = 100
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotShock") then
output.ShockChanceOnCrit = 0
else
output.ShockChanceOnCrit = 100
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotFreeze") then
output.FreezeChanceOnCrit = 0
else
output.FreezeChanceOnCrit = 100
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotChill") then
output.ChillChanceOnCrit = 0
else
output.ChillChanceOnCrit = 100
end
if skillModList:Flag(cfg, "CritAlwaysAltAilments") and not skillModList:Flag(cfg, "NeverCrit") then
skillFlags.inflictScorch = true
skillFlags.inflictBrittle = true
skillFlags.inflictSap = true
end
if skillModList:Flag(cfg, "CritAlwaysAltAilments") and not skillModList:Flag(cfg, "NeverCrit") and skillFlags.hit then
output.ScorchChanceOnCrit = not skillModList:Flag(cfg, "CannotScorch") and 100 or 0
output.BrittleChanceOnCrit = not skillModList:Flag(cfg, "CannotBrittle") and 100 or 0
output.SapChanceOnCrit = not skillModList:Flag(cfg, "CannotSap") and 100 or 0
else
output.ScorchChanceOnCrit = 0
output.BrittleChanceOnCrit = 0
output.SapChanceOnCrit = 0
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotKnockback") then
output.KnockbackChanceOnCrit = 0
else
Expand All @@ -2742,16 +2708,20 @@ function calcs.offence(env, actor, activeSkill)
if ailment == "Chill" then
chance = 100
end
if chance > 0 then
skillFlags["inflict"..ailment] = true
end
if skillFlags.hit and not skillModList:Flag(cfg, "Cannot"..ailment) then
output[ailment.."ChanceOnHit"] = m_min(100, chance)
if skillModList:Flag(cfg, "CritsDontAlways"..ailment) or (ailmentData[ailment] and ailmentData[ailment].alt) then
if skillModList:Flag(cfg, "CritsDontAlways"..ailment) -- e.g. Painseeker
or (ailmentData[ailment] and ailmentData[ailment].alt and not skillModList:Flag(cfg, "CritAlwaysAltAilments")) then -- e.g. Secrets of Suffering
output[ailment.."ChanceOnCrit"] = output[ailment.."ChanceOnHit"]
else
output[ailment.."ChanceOnCrit"] = 100
end
else
output[ailment.."ChanceOnHit"] = 0
output[ailment.."ChanceOnCrit"] = 0
end
if (output[ailment.."ChanceOnHit"] + (skillModList:Flag(cfg, "NeverCrit") and 0 or output[ailment.."ChanceOnCrit"])) > 0 then
skillFlags["inflict"..ailment] = true
end
end
if not skillFlags.hit or skillModList:Flag(cfg, "CannotKnockback") then
Expand Down Expand Up @@ -3020,7 +2990,7 @@ function calcs.offence(env, actor, activeSkill)
t_insert(breakdown.BleedDPS, s_format("= %.1f", baseVal))
breakdown.multiChain(breakdown.BleedDPS, {
label = "Bleed DPS:",
base = s_format("%.1f ^8(total damage per second)", baseVal),
base = s_format("%.1f ^8(total damage per second)", baseVal),
{ "%.2f ^8(ailment effect modifier)", effectMod },
{ "%.2f ^8(damage rate modifier)", rateMod },
{ "%.3f ^8(effective DPS modifier)", effMult },
Expand Down Expand Up @@ -3178,7 +3148,7 @@ function calcs.offence(env, actor, activeSkill)
t_insert(breakdown.PoisonDPS, s_format("= %.1f", baseVal, 1))
breakdown.multiChain(breakdown.PoisonDPS, {
label = "Poison DPS:",
base = s_format("%.1f ^8(total damage per second)", baseVal),
base = s_format("%.1f ^8(total damage per second)", baseVal),
{ "%.2f ^8(ailment effect modifier)", effectMod },
{ "%.2f ^8(damage rate modifier)", rateMod },
{ "%.3f ^8(effective DPS modifier)", effMult },
Expand Down Expand Up @@ -3224,7 +3194,7 @@ function calcs.offence(env, actor, activeSkill)
end
end
end
end
end

-- Calculate ignite chance and damage
if canDeal.Fire and (output.IgniteChanceOnHit + output.IgniteChanceOnCrit) > 0 then
Expand Down Expand Up @@ -3387,13 +3357,13 @@ function calcs.offence(env, actor, activeSkill)
output.IgniteStacksMax = maxStacks
output.TotalIgniteDPS = output.IgniteDPS
end

if breakdown then
t_insert(breakdown.IgniteDPS, "x 0.9 ^8(ignite deals 90% per second)")
t_insert(breakdown.IgniteDPS, s_format("= %.1f", baseVal, 1))
breakdown.multiChain(breakdown.IgniteDPS, {
label = "Ignite DPS:",
base = s_format("%.1f ^8(total damage per second)", baseVal),
base = s_format("%.1f ^8(total damage per second)", baseVal),
{ "%.2f ^8(ailment effect modifier)", effectMod },
{ "%.2f ^8(burn rate modifier)", rateMod },
{ "%.3f ^8(effective DPS modifier)", effMult },
Expand Down Expand Up @@ -3631,51 +3601,51 @@ function calcs.offence(env, actor, activeSkill)
t_insert(breakdown.EnemyStunDuration, s_format("= %.2fs", output.EnemyStunDuration))
end
end
-- Calculate impale chance and modifiers

-- Calculate impale chance and modifiers
if canDeal.Physical and output.ImpaleChance > 0 then
skillFlags.impale = true
local impaleChance = m_min(output.ImpaleChance/100, 1)
local maxStacks = skillModList:Sum("BASE", cfg, "ImpaleStacksMax") -- magic number: base stacks duration
skillFlags.impale = true
local impaleChance = m_min(output.ImpaleChance/100, 1)
local maxStacks = skillModList:Sum("BASE", cfg, "ImpaleStacksMax") -- magic number: base stacks duration
local configStacks = enemyDB:Sum("BASE", cfg, "Multiplier:ImpaleStacks")
local impaleStacks = m_min(maxStacks, configStacks)

local baseStoredDamage = data.misc.ImpaleStoredDamageBase
local storedExpectedDamageIncOnBleed = skillModList:Sum("INC", cfg, "ImpaleEffectOnBleed")*skillModList:Sum("BASE", cfg, "BleedChance")/100
local storedExpectedDamageInc = (skillModList:Sum("INC", cfg, "ImpaleEffect") + storedExpectedDamageIncOnBleed)/100
local storedExpectedDamageMore = round(skillModList:More(cfg, "ImpaleEffect"), 2)
local storedExpectedDamageModifier = (1 + storedExpectedDamageInc) * storedExpectedDamageMore
local impaleStoredDamage = baseStoredDamage * storedExpectedDamageModifier
local impaleHitDamageMod = impaleStoredDamage * impaleStacks -- Source: https://www.reddit.com/r/pathofexile/comments/chgqqt/impale_and_armor_interaction/

local enemyArmour = m_max(calcLib.val(enemyDB, "Armour"), 0)
local impaleArmourReduction = calcs.armourReductionF(enemyArmour, impaleHitDamageMod * output.impaleStoredHitAvg)
local impaleResist = m_min(m_max(0, enemyDB:Sum("BASE", nil, "PhysicalDamageReduction") + skillModList:Sum("BASE", cfg, "EnemyImpalePhysicalDamageReduction") + impaleArmourReduction), data.misc.DamageReductionCap)

local impaleDMGModifier = impaleHitDamageMod * (1 - impaleResist / 100) * impaleChance

globalOutput.ImpaleStacksMax = maxStacks
globalOutput.ImpaleStacks = impaleStacks
--ImpaleStoredDamage should be named ImpaleEffect or similar
--Using the variable name ImpaleEffect breaks the calculations sidebar (?!)
output.ImpaleStoredDamage = impaleStoredDamage * 100
output.ImpaleModifier = 1 + impaleDMGModifier

if breakdown then
breakdown.ImpaleStoredDamage = {}
t_insert(breakdown.ImpaleStoredDamage, "10% ^8(base value)")
t_insert(breakdown.ImpaleStoredDamage, s_format("x %.2f ^8(increased effectiveness)", storedExpectedDamageModifier))
t_insert(breakdown.ImpaleStoredDamage, s_format("= %.1f%%", output.ImpaleStoredDamage))

breakdown.ImpaleModifier = {}
t_insert(breakdown.ImpaleModifier, s_format("%d ^8(number of stacks, can be overridden in the Configuration tab)", impaleStacks))
t_insert(breakdown.ImpaleModifier, s_format("x %.3f ^8(stored damage)", impaleStoredDamage))
t_insert(breakdown.ImpaleModifier, s_format("x %.2f ^8(impale chance)", impaleChance))
t_insert(breakdown.ImpaleModifier, s_format("x %.2f ^8(impale enemy physical damage reduction)", (1 - impaleResist / 100)))
t_insert(breakdown.ImpaleModifier, s_format("= %.3f ^8(impale damage multiplier)", impaleDMGModifier))
end
end
end
local baseStoredDamage = data.misc.ImpaleStoredDamageBase
local storedExpectedDamageIncOnBleed = skillModList:Sum("INC", cfg, "ImpaleEffectOnBleed")*skillModList:Sum("BASE", cfg, "BleedChance")/100
local storedExpectedDamageInc = (skillModList:Sum("INC", cfg, "ImpaleEffect") + storedExpectedDamageIncOnBleed)/100
local storedExpectedDamageMore = round(skillModList:More(cfg, "ImpaleEffect"), 2)
local storedExpectedDamageModifier = (1 + storedExpectedDamageInc) * storedExpectedDamageMore
local impaleStoredDamage = baseStoredDamage * storedExpectedDamageModifier
local impaleHitDamageMod = impaleStoredDamage * impaleStacks -- Source: https://www.reddit.com/r/pathofexile/comments/chgqqt/impale_and_armor_interaction/

local enemyArmour = m_max(calcLib.val(enemyDB, "Armour"), 0)
local impaleArmourReduction = calcs.armourReductionF(enemyArmour, impaleHitDamageMod * output.impaleStoredHitAvg)
local impaleResist = m_min(m_max(0, enemyDB:Sum("BASE", nil, "PhysicalDamageReduction") + skillModList:Sum("BASE", cfg, "EnemyImpalePhysicalDamageReduction") + impaleArmourReduction), data.misc.DamageReductionCap)

local impaleDMGModifier = impaleHitDamageMod * (1 - impaleResist / 100) * impaleChance

globalOutput.ImpaleStacksMax = maxStacks
globalOutput.ImpaleStacks = impaleStacks
--ImpaleStoredDamage should be named ImpaleEffect or similar
--Using the variable name ImpaleEffect breaks the calculations sidebar (?!)
output.ImpaleStoredDamage = impaleStoredDamage * 100
output.ImpaleModifier = 1 + impaleDMGModifier

if breakdown then
breakdown.ImpaleStoredDamage = {}
t_insert(breakdown.ImpaleStoredDamage, "10% ^8(base value)")
t_insert(breakdown.ImpaleStoredDamage, s_format("x %.2f ^8(increased effectiveness)", storedExpectedDamageModifier))
t_insert(breakdown.ImpaleStoredDamage, s_format("= %.1f%%", output.ImpaleStoredDamage))

breakdown.ImpaleModifier = {}
t_insert(breakdown.ImpaleModifier, s_format("%d ^8(number of stacks, can be overridden in the Configuration tab)", impaleStacks))
t_insert(breakdown.ImpaleModifier, s_format("x %.3f ^8(stored damage)", impaleStoredDamage))
t_insert(breakdown.ImpaleModifier, s_format("x %.2f ^8(impale chance)", impaleChance))
t_insert(breakdown.ImpaleModifier, s_format("x %.2f ^8(impale enemy physical damage reduction)", (1 - impaleResist / 100)))
t_insert(breakdown.ImpaleModifier, s_format("= %.3f ^8(impale damage multiplier)", impaleDMGModifier))
end
end
end

-- Combine secondary effect stats
if isAttack then
Expand Down

0 comments on commit de93946

Please sign in to comment.