Skip to content

Commit 74f84f9

Browse files
committed
1 parent 1c107fe commit 74f84f9

2 files changed

Lines changed: 41 additions & 4 deletions

File tree

src/Modules/CalcDefence.lua

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,10 @@ function calcs.buildDefenceEstimations(env, actor)
31123112
if poolTable.Life >= 0 and damageTotal >= maxDamage then -- If still living and the amount of damage exceeds maximum threshold we survived infinite number of hits.
31133113
return m_huge
31143114
end
3115-
return numHits
3115+
if numHits ~= numHits then
3116+
return 0
3117+
end
3118+
return m_max(numHits, 0)
31163119
end
31173120

31183121
if damageCategoryConfig ~= "DamageOverTime" then
@@ -3578,9 +3581,12 @@ function calcs.buildDefenceEstimations(env, actor)
35783581
local damageConvertedMulti = convertPercent / 100
35793582
local totalHitPool = output[damageConvertedType.."TotalHitPool"]
35803583
local totalTakenMulti = output[damageConvertedType.."AfterReductionTakenHitMulti"] * (1 - output["VaalArcticArmourMitigation"])
3581-
3582-
if effectiveAppliedArmour == 0 and convertPercent == 100 then -- use a simpler calculation for no armour DR
3583-
local drMulti = output[damageConvertedType.."ResistTakenHitMulti"] * (1 - output[damageConvertedType.."DamageReduction"] / 100)
3584+
if damageConvertedMulti <= 0 then
3585+
local takenWithoutIncoming = m_max(takenFlat, 0) * totalTakenMulti
3586+
hitTaken = takenWithoutIncoming >= totalHitPool and 0 or m_huge
3587+
elseif effectiveAppliedArmour == 0 and convertPercent == 100 then -- use a simpler calculation for no armour DR
3588+
local totalResistMult = output[damageConvertedType.."ResistTakenHitMulti"]
3589+
local drMulti = totalResistMult * (1 - output[damageConvertedType.."DamageReduction"] / 100)
35843590
hitTaken = m_max(totalHitPool / damageConvertedMulti / drMulti - takenFlat, 0) / totalTakenMulti
35853591
else
35863592
-- get relevant raw reductions and reduction modifiers

src/Modules/CalcDefence.lua.rej

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff a/src/Modules/CalcDefence.lua b/src/Modules/CalcDefence.lua (rejected hunks)
2+
@@ -3194,7 +3200,7 @@ function calcs.buildDefenceEstimations(env, actor)
3+
local b = ((enemyOverwhelmPercent / 100 - flatDR) * effectiveAppliedArmour * totalTakenMulti - 5 * (totalHitPool - takenFlat * totalTakenMulti)) * resistXConvert
4+
local c = -effectiveAppliedArmour * (totalHitPool - takenFlat * totalTakenMulti)
5+
6+
- local RAW = (m_sqrt(b * b - 4 * a * c) - b) / (2 * a)
7+
+ local RAW = a ~= 0 and (m_sqrt(m_max(b * b - 4 * a * c, 0)) - b) / (2 * a) or m_huge
8+
9+
-- tack on some caps
10+
local noDRMaxHit = totalHitPool / damageConvertedMulti / totalResistMult / totalTakenMulti * (1 - takenFlat * totalTakenMulti / totalHitPool)
11+
@@ -3220,9 +3226,18 @@ function calcs.buildDefenceEstimations(env, actor)
12+
local passOverkill = passPools.OverkillDamage - passPools.hitPoolRemaining
13+
local passRatio = 0
14+
for partType, _ in pairs(passDamages) do
15+
- passRatio = m_max(passRatio, (passOverkill + output[partType.."TotalHitPool"]) / output[partType.."TotalHitPool"])
16+
+ local partPool = output[partType.."TotalHitPool"] or 0
17+
+ if partPool > 0 then
18+
+ passRatio = m_max(passRatio, (passOverkill + partPool) / partPool)
19+
+ end
20+
+ end
21+
+ if passRatio <= 0 then
22+
+ passRatio = 1
23+
+ end
24+
+ local stepSize = 1
25+
+ if n > 1 and previousOverkill and previousOverkill ~= 0 and previousOverkill == previousOverkill then
26+
+ stepSize = m_min(m_abs((passOverkill - previousOverkill) / previousOverkill), 2)
27+
end
28+
- local stepSize = n > 1 and m_min(m_abs((passOverkill - previousOverkill) / previousOverkill), 2) or 1
29+
local stepAdjust = stepSize > 1 and -passOverkill / stepSize or n > 1 and -passOverkill * stepSize or 0
30+
previousOverkill = passOverkill
31+
passIncomingDamage = (passIncomingDamage + stepAdjust) / m_sqrt(passRatio)

0 commit comments

Comments
 (0)