Skip to content

Commit

Permalink
Add support for Arrow Dancing (PathOfBuildingCommunity#4779)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuickStick123 committed Aug 14, 2022
1 parent f468faa commit 9b9c49f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ function calcs.defence(env, actor)
output.ArmourDefense = (modDB:Max(nil, "ArmourDefense") or 0) / 100
output.RawArmourDefense = output.ArmourDefense > 0 and ((1 + output.ArmourDefense) * 100) or nil
output.Evasion = m_max(round(evasion), 0)
output.MeleeEvasion = m_max(round(evasion * calcLib.mod(modDB, nil, "MeleeEvasion")), 0)
output.ProjectileEvasion = m_max(round(evasion * calcLib.mod(modDB, nil, "ProjectileEvasion")), 0)
output.LowestOfArmourAndEvasion = m_min(output.Armour, output.Evasion)
output.Ward = m_max(round(ward), 0)
output["Gear:Ward"] = gearWard
Expand All @@ -440,9 +442,11 @@ function calcs.defence(env, actor)
output.ProjectileEvadeChance = 0
else
local enemyAccuracy = round(calcLib.val(enemyDB, "Accuracy"))
output.EvadeChance = 100 - (calcs.hitChance(output.Evasion, enemyAccuracy) - modDB:Sum("BASE", nil, "EvadeChance")) * calcLib.mod(enemyDB, nil, "HitChance")
output.MeleeEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, output.EvadeChance * calcLib.mod(modDB, nil, "EvadeChance", "MeleeEvadeChance")))
output.ProjectileEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, output.EvadeChance * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance")))
local evadeChance = modDB:Sum("BASE", nil, "EvadeChance")
local hitChance = calcLib.mod(enemyDB, nil, "HitChance")
output.EvadeChance = 100 - (calcs.hitChance(output.Evasion, enemyAccuracy) - evadeChance) * hitChance
output.MeleeEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(output.MeleeEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "MeleeEvadeChance")))
output.ProjectileEvadeChance = m_max(0, m_min(data.misc.EvadeChanceCap, (100 - (calcs.hitChance(output.ProjectileEvasion, enemyAccuracy) - evadeChance) * hitChance) * calcLib.mod(modDB, nil, "EvadeChance", "ProjectileEvadeChance")))
-- Condition for displaying evade chance only if melee or projectile evade chance have the same values
if output.MeleeEvadeChance ~= output.ProjectileEvadeChance then
output.splitEvade = true
Expand All @@ -459,11 +463,13 @@ function calcs.defence(env, actor)
breakdown.MeleeEvadeChance = {
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
s_format("Average enemy accuracy: %d", enemyAccuracy),
s_format("Effective Evasion: %d", output.MeleeEvasion),
s_format("Approximate melee evade chance: %d%%", output.MeleeEvadeChance),
}
breakdown.ProjectileEvadeChance = {
s_format("Enemy level: %d ^8(%s the Configuration tab)", env.enemyLevel, env.configInput.enemyLevel and "overridden from" or "can be overridden in"),
s_format("Average enemy accuracy: %d", enemyAccuracy),
s_format("Effective Evasion: %d", output.ProjectileEvasion),
s_format("Approximate projectile evade chance: %d%%", output.ProjectileEvadeChance),
}
end
Expand Down
4 changes: 4 additions & 0 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ local modNameList = {
["chance to evade attack hits"] = "EvadeChance",
["chance to evade projectile attacks"] = "ProjectileEvadeChance",
["chance to evade melee attacks"] = "MeleeEvadeChance",
["evasion rating against melee attacks"] = "MeleeEvasion",
["evasion rating against projectile attacks"] = "ProjectileEvasion",
-- Resistances
["physical damage reduction"] = "PhysicalDamageReduction",
["physical damage reduction from hits"] = "PhysicalDamageReductionWhenHit",
Expand Down Expand Up @@ -2551,6 +2553,8 @@ local specialModList = {
{ type = "StatThreshold", stat = "EvasionOnGloves", threshold = 1}
)
} end,
["evasion rating is doubled against projectile attacks"] = { mod("ProjectileEvasion", "MORE", 100) },
["evasion rating is doubled against melee attacks"] = { mod("MeleeEvasion", "MORE", 100) },
["+(%d+)%% chance to suppress spell damage for each dagger you're wielding"] = function(num) return {
mod("SpellSuppressionChance", "BASE", num, { type = "ModFlag", modFlags = ModFlag.Dagger } ),
mod("SpellSuppressionChance", "BASE", num, { type = "Condition", var = "DualWieldingDaggers" } )
Expand Down

0 comments on commit 9b9c49f

Please sign in to comment.