@@ -510,7 +510,6 @@ function calcs.reducePoolsByDamage(poolTable, damageTable, actor)
510510 end
511511
512512 local ward = poolTbl .RunicWard or output .RunicWard or 0
513- local restoreWard = modDB :Flag (nil , " WardNotBreak" ) and ward or 0
514513
515514 local energyShield = poolTbl .EnergyShield or output .EnergyShieldRecoveryCap
516515 local mana = poolTbl .Mana or output .ManaUnreserved or 0
@@ -569,12 +568,6 @@ function calcs.reducePoolsByDamage(poolTable, damageTable, actor)
569568 damageRemainder = damageRemainder - tempDamage
570569 resourcesLostToTypeDamage [damageType ].sharedGuard = tempDamage >= 1 and tempDamage or nil
571570 end
572- if ward > 0 then
573- local tempDamage = m_min (damageRemainder * (1 - (modDB :Sum (" BASE" , nil , " RunicWardBypass" ) or 0 ) / 100 ), ward )
574- ward = ward - tempDamage
575- damageRemainder = damageRemainder - tempDamage
576- resourcesLostToTypeDamage [damageType ].runicWard = tempDamage >= 1 and tempDamage or nil
577- end
578571 damageRemaindersBeforeES [damageType ] = damageRemainder > 0 and damageRemainder or nil
579572 end
580573 end
@@ -656,6 +649,12 @@ function calcs.reducePoolsByDamage(poolTable, damageTable, actor)
656649 damageRemainder = damageRemainder - tempDamage
657650 resourcesLostToTypeDamage [damageType ].life = (resourcesLostToTypeDamage [damageType ].life or 0 ) + (tempDamage > 0 and tempDamage or 0 )
658651 end
652+ if ward > 0 then
653+ local tempDamage = m_min (damageRemainder * (1 - (modDB :Sum (" BASE" , nil , " RunicWardBypass" ) or 0 ) / 100 ), ward )
654+ ward = ward - tempDamage
655+ damageRemainder = damageRemainder - tempDamage
656+ resourcesLostToTypeDamage [damageType ].runicWard = tempDamage >= 1 and tempDamage or nil
657+ end
659658 overkillDamage = overkillDamage + damageRemainder
660659 resourcesLostToTypeDamage [damageType ].overkill = damageRemainder >= 1 and damageRemainder or nil
661660 end
@@ -667,7 +666,7 @@ function calcs.reducePoolsByDamage(poolTable, damageTable, actor)
667666 AlliesTakenBeforeYou = alliesTakenBeforeYou ,
668667 Aegis = aegis ,
669668 Guard = guard ,
670- RunicWard = restoreWard ,
669+ RunicWard = ward ,
671670 EnergyShield = energyShield ,
672671 Mana = mana ,
673672 Life = life ,
@@ -726,9 +725,6 @@ local function incomingDamageBreakdown(breakdownTable, poolsRemaining, output)
726725 if output .sharedGuardAbsorb and output .sharedGuardAbsorb > 0 then
727726 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .SCOURGE .. " Shared Guard charge ^7(%d remaining)" , output .sharedGuardAbsorb - poolsRemaining .Guard .shared , poolsRemaining .Guard .shared ))
728727 end
729- if output .RunicWard and output .RunicWard > 0 then
730- t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .WARD .. " Runic Ward" , output .RunicWard ))
731- end
732728 if output .EnergyShieldRecoveryCap ~= poolsRemaining .EnergyShield and output .EnergyShieldRecoveryCap and output .EnergyShieldRecoveryCap > 0 then
733729 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .ES .. " Energy Shield ^7(%d remaining)" , output .EnergyShieldRecoveryCap - poolsRemaining .EnergyShield , poolsRemaining .EnergyShield ))
734730 end
@@ -742,6 +738,9 @@ local function incomingDamageBreakdown(breakdownTable, poolsRemaining, output)
742738 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .LIFE .. " Life ^7Loss Prevented" , poolsRemaining .LifeLossLostOverTime + poolsRemaining .LifeBelowHalfLossLostOverTime ))
743739 end
744740 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .LIFE .. " Life ^7(%d remaining)" , output .LifeRecoverable - poolsRemaining .Life , poolsRemaining .Life ))
741+ if output .RunicWard and output .RunicWard > 0 then
742+ t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .WARD .. " Runic Ward ^7(%d remaining)" , output .RunicWard - poolsRemaining .RunicWard , poolsRemaining .RunicWard ))
743+ end
745744 if poolsRemaining .OverkillDamage >= 1 then
746745 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .NEGATIVE .. " Overkill damage" , poolsRemaining .OverkillDamage ))
747746 end
@@ -1913,6 +1912,7 @@ function calcs.defence(env, actor)
19131912 output .ManaOnBlock = modDB :Sum (" BASE" , nil , " ManaOnBlock" )
19141913
19151914 output .RunicWardOnBlock = modDB :Sum (" BASE" , nil , " RunicWardOnBlock" )
1915+ output .RunicWardOnSuppress = modDB :Sum (" BASE" , nil , " RunicWardOnSuppress" )
19161916
19171917 output .EnergyShieldOnBlock = modDB :Sum (" BASE" , nil , " EnergyShieldOnBlock" )
19181918 output .EnergyShieldOnSpellBlock = modDB :Sum (" BASE" , nil , " EnergyShieldOnSpellBlock" )
@@ -3064,7 +3064,7 @@ function calcs.buildDefenceEstimations(env, actor)
30643064 local damageTotal = 0
30653065 local maxDamage = data .misc .ehpCalcMaxDamage
30663066 local maxIterations = data .misc .ehpCalcMaxIterationsToCalc
3067- while poolTable .Life > 0 and DamageIn [" iterations" ] < maxIterations do
3067+ while ( poolTable .Life > 0 or poolTable . RunicWard > 0 ) and DamageIn [" iterations" ] < maxIterations do
30683068 DamageIn [" iterations" ] = DamageIn [" iterations" ] + 1
30693069 local Damage = { }
30703070 damageTotal = 0
@@ -3080,17 +3080,19 @@ function calcs.buildDefenceEstimations(env, actor)
30803080 poolTable .Life = m_min (poolTable .Life + DamageIn .LifeWhenHit * (gainMult - 1 ), gainMult * (output .LifeRecoverable or 0 ))
30813081 poolTable .Mana = m_min (poolTable .Mana + DamageIn .ManaWhenHit * (gainMult - 1 ), gainMult * (output .ManaUnreserved or 0 ))
30823082 poolTable .EnergyShield = m_min (poolTable .EnergyShield + DamageIn .EnergyShieldWhenHit * (gainMult - 1 ), gainMult * output .EnergyShieldRecoveryCap )
3083+ poolTable .RunicWard = m_min (poolTable .RunicWard + DamageIn .RunicWardWhenHit * (gainMult - 1 ), gainMult * (output .RunicWard or 0 ))
30833084 end
30843085 poolTable = calcs .reducePoolsByDamage (poolTable , Damage , actor )
30853086
30863087 -- If still living and the amount of damage exceeds maximum threshold we survived infinite number of hits.
3087- if poolTable .Life > 0 and damageTotal >= maxDamage then
3088+ if ( poolTable .Life > 0 or poolTable . RunicWard > 0 ) and damageTotal >= maxDamage then
30883089 return m_huge
30893090 end
3090- if DamageIn .GainWhenHit and poolTable .Life > 0 then
3091+ if DamageIn .GainWhenHit and ( poolTable .Life > 0 or poolTable . RunicWard > 0 ) then
30913092 poolTable .Life = m_min (poolTable .Life + DamageIn .LifeWhenHit , output .LifeRecoverable or 0 )
30923093 poolTable .Mana = m_min (poolTable .Mana + DamageIn .ManaWhenHit , output .ManaUnreserved or 0 )
30933094 poolTable .EnergyShield = m_min (poolTable .EnergyShield + DamageIn .EnergyShieldWhenHit , output .EnergyShieldRecoveryCap )
3095+ poolTable .RunicWard = m_min (poolTable .RunicWard + (DamageIn .RunicWardWhenHit or 0 ), output .RunicWard or 0 )
30943096 end
30953097 iterationMultiplier = 1
30963098 -- to speed it up, run recursively but accelerated
@@ -3109,6 +3111,7 @@ function calcs.buildDefenceEstimations(env, actor)
31093111 Damage .LifeWhenHit = DamageIn .LifeWhenHit
31103112 Damage .ManaWhenHit = DamageIn .ManaWhenHit
31113113 Damage .EnergyShieldWhenHit = DamageIn .EnergyShieldWhenHit
3114+ Damage .RunicWardWhenHit = DamageIn .RunicWardWhenHit
31123115 end
31133116 Damage [" cycles" ] = DamageIn [" cycles" ] * speedUp
31143117 Damage [" iterations" ] = DamageIn [" iterations" ]
@@ -3175,6 +3178,7 @@ function calcs.buildDefenceEstimations(env, actor)
31753178 DamageIn .LifeWhenHit = output .LifeOnBlock * BlockChance
31763179 DamageIn .ManaWhenHit = output .ManaOnBlock * BlockChance
31773180 DamageIn .EnergyShieldWhenHit = output .EnergyShieldOnBlock * BlockChance
3181+ DamageIn .RunicWardWhenHit = output .RunicWardOnBlock * BlockChance
31783182 if damageCategoryConfig == " Spell" or damageCategoryConfig == " SpellProjectile" then
31793183 DamageIn .EnergyShieldWhenHit = DamageIn .EnergyShieldWhenHit + output .EnergyShieldOnSpellBlock * BlockChance
31803184 elseif damageCategoryConfig == " Average" then
@@ -3192,10 +3196,12 @@ function calcs.buildDefenceEstimations(env, actor)
31923196 end
31933197 DamageIn .EnergyShieldWhenHit = (DamageIn .EnergyShieldWhenHit or 0 ) + output .EnergyShieldOnSuppress * suppressChance
31943198 DamageIn .LifeWhenHit = (DamageIn .LifeWhenHit or 0 ) + output .LifeOnSuppress * suppressChance
3199+ DamageIn .RunicWardWhenHit = (DamageIn .RunicWardWhenHit or 0 ) + output .RunicWardOnSuppress * suppressChance
31953200 suppressionEffect = 1 - suppressChance * output .SpellSuppressionEffect / 100
31963201 else
31973202 DamageIn .EnergyShieldWhenHit = (DamageIn .EnergyShieldWhenHit or 0 ) + output .EnergyShieldOnSuppress * ( damageCategoryConfig == " Average" and 0.5 or 1 )
31983203 DamageIn .LifeWhenHit = (DamageIn .LifeWhenHit or 0 ) + output .LifeOnSuppress * ( damageCategoryConfig == " Average" and 0.5 or 1 )
3204+ DamageIn .RunicWardWhenHit = (DamageIn .RunicWardWhenHit or 0 ) + output .RunicWardOnSuppress * ( damageCategoryConfig == " Average" and 0.5 or 1 )
31993205 end
32003206 local effectiveDeflectMulti = output .DeflectChance < 100 and 1 - output .DeflectChance * output .DeflectEffect / 10000 or 1
32013207 -- extra avoid chance
@@ -3206,13 +3212,14 @@ function calcs.buildDefenceEstimations(env, actor)
32063212 end
32073213 -- gain when hit (currently just gain on block/suppress)
32083214 if not env .configInput .DisableEHPGainOnBlock then
3209- if (DamageIn .LifeWhenHit or 0 ) ~= 0 or (DamageIn .ManaWhenHit or 0 ) ~= 0 or DamageIn .EnergyShieldWhenHit ~= 0 then
3215+ if (DamageIn .LifeWhenHit or 0 ) ~= 0 or (DamageIn .ManaWhenHit or 0 ) ~= 0 or DamageIn .EnergyShieldWhenHit ~= 0 or DamageIn . RunicWardWhenHit ~= 0 then
32103216 DamageIn .GainWhenHit = true
32113217 end
32123218 else
32133219 DamageIn .LifeWhenHit = 0
32143220 DamageIn .ManaWhenHit = 0
32153221 DamageIn .EnergyShieldWhenHit = 0
3222+ DamageIn .RunicWardWhenHit = 0
32163223 end
32173224 for _ , damageType in ipairs (dmgTypeList ) do
32183225 -- Emperor's Vigilance (this needs to fail with divine flesh as it can't override it, hence the check for high bypass)
@@ -4292,10 +4299,6 @@ function calcs.buildDefenceEstimations(env, actor)
42924299 resourcesLostSum = resourcesLostSum + resourcesLost .sharedGuard
42934300 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .SCOURGE .. " Shared Guard charge" , resourcesLost .sharedGuard ))
42944301 end
4295- if resourcesLost .runicWard then
4296- resourcesLostSum = resourcesLostSum + resourcesLost .runicWard
4297- t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .WARD .. " Runic Ward" , resourcesLost .runicWard ))
4298- end
42994302 if resourcesLost .energyShield then
43004303 resourcesLostSum = resourcesLostSum + resourcesLost .energyShield
43014304 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .ES .. " Energy Shield%s" , resourcesLost .energyShield , damageType == " Chaos" and " ^8 (ES takes double damage from chaos)" and not modDB :Flag (nil , " ChaosNotDoubleESDamage" ) or " " ))
@@ -4315,6 +4318,10 @@ function calcs.buildDefenceEstimations(env, actor)
43154318 resourcesLostSum = resourcesLostSum + resourcesLost .life
43164319 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .LIFE .. " Life" , resourcesLost .life ))
43174320 end
4321+ if resourcesLost .runicWard then
4322+ resourcesLostSum = resourcesLostSum + resourcesLost .runicWard
4323+ t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .WARD .. " Runic Ward" , resourcesLost .runicWard ))
4324+ end
43184325 if resourcesLost .overkill then
43194326 resourcesLostSum = resourcesLostSum + resourcesLost .overkill
43204327 t_insert (breakdownTable , s_format (" \t %d " .. colorCodes .NEGATIVE .. " Overkill damage" , resourcesLost .overkill ))
0 commit comments