Skip to content

Commit f74568e

Browse files
LocalIdentityLocalIdentity
authored andcommitted
Use harmonic mean for Dual Wield Attack Speed calc instead of average (PathOfBuildingCommunity#1205)
Copy of PR from PoB 1 PathOfBuildingCommunity/PathOfBuilding#8900 Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 385b7d3 commit f74568e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Modules/CalcOffence.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,12 @@ function calcs.offence(env, actor, activeSkill)
21932193
output[stat] = (output.MainHand[stat] or 0) + (output.OffHand[stat] or 0)
21942194
elseif mode == "AVERAGE" then
21952195
output[stat] = ((output.MainHand[stat] or 0) + (output.OffHand[stat] or 0)) / 2
2196+
elseif mode == 'HARMONICMEAN' then
2197+
if output.MainHand[stat] == 0 or output.OffHand[stat] == 0 then
2198+
output[stat] = 0
2199+
else
2200+
output[stat] = 2 / ((1 / output.MainHand[stat]) + (1 / output.OffHand[stat]))
2201+
end
21962202
elseif mode == "CHANCE" then
21972203
if output.MainHand[stat] and output.OffHand[stat] then
21982204
local mainChance = output.MainHand[...] * output.MainHand.HitChance
@@ -2723,7 +2729,7 @@ function calcs.offence(env, actor, activeSkill)
27232729
combineStat("AccuracyHitChance", "AVERAGE")
27242730
combineStat("HitChance", "AVERAGE")
27252731
combineStat("AccuracyHitChanceUncapped", "AVERAGE")
2726-
combineStat("Speed", "AVERAGE")
2732+
combineStat("Speed", "HARMONICMEAN")
27272733
combineStat("HitSpeed", "OR")
27282734
combineStat("HitTime", "OR")
27292735
if output.Speed == 0 then
@@ -2748,7 +2754,7 @@ function calcs.offence(env, actor, activeSkill)
27482754
if breakdown then
27492755
breakdown.Speed = {
27502756
"Both weapons:",
2751-
s_format("(%.2f + %.2f) / 2", output.MainHand.Speed, output.OffHand.Speed),
2757+
s_format("2 / (1 / %.2f + 1 / %.2f)", output.MainHand.Speed, output.OffHand.Speed),
27522758
s_format("= %.2f", output.Speed),
27532759
}
27542760
end

0 commit comments

Comments
 (0)