@@ -1067,9 +1067,9 @@ function calcs.defence(env, actor)
10671067 local enemyPen = modDB :Flag (nil , " SelfIgnore" .. damageType .. " Resistance" ) and 0 or output [damageType .. " EnemyPen" ]
10681068 local enemyOverwhelm = modDB :Flag (nil , " SelfIgnore" .. damageType .. " Resistance" ) and 0 or output [damageType .. " enemyOverwhelm" ] or 0 -- or 0 is to be removed once mod is passed / added to config tab.
10691069 local takenFlat = modDB :Sum (" BASE" , nil , " DamageTaken" , damageType .. " DamageTaken" , " DamageTakenWhenHit" , damageType .. " DamageTakenWhenHit" )
1070- local percentOfArmourApplies = (damageType == " Physical" and 100 ) or m_min ((modDB :Sum (" BASE" , nil , " ArmourAppliesTo" .. damageType .. " DamageTaken" ) or 0 ), 100 )
10711070 local damage = output [damageType .. " TakenDamage" ]
10721071 local armourReduct = 0
1072+ local percentOfArmourApplies = (damageType == " Physical" and 100 ) or m_min ((modDB :Sum (" BASE" , nil , " ArmourAppliesTo" .. damageType .. " DamageTaken" ) or 0 ), 100 )
10731073 local resMult = 1 - (resist - enemyPen ) / 100
10741074 local reductMult = 1
10751075 if damageCategoryConfig == " Melee" or damageCategoryConfig == " Projectile" then
@@ -1078,7 +1078,7 @@ function calcs.defence(env, actor)
10781078 takenFlat = takenFlat + modDB :Sum (" BASE" , nil , " DamageTakenFromAttacks" , damageType .. " DamageTakenFromAttacks" ) / 2
10791079 end
10801080 if percentOfArmourApplies > 0 then
1081- armourReduct = calcs .armourReduction (output .Armour * (1 + output .ArmourDefense ), damage * resMult )
1081+ armourReduct = calcs .armourReduction (( output .Armour * percentOfArmourApplies / 100 ) * (1 + output .ArmourDefense ), damage * resMult )
10821082 armourReduct = m_min (output .DamageReductionMax , armourReduct )
10831083 end
10841084 reductMult = (1 - m_max (m_min (output .DamageReductionMax , armourReduct + reduction - enemyOverwhelm ), 0 ) / 100 )
@@ -1088,7 +1088,6 @@ function calcs.defence(env, actor)
10881088 if armourReduct ~= 0 then
10891089 if resMult ~= 1 then
10901090 t_insert (breakdown [damageType .. " DamageReduction" ], s_format (" Enemy Hit Damage After Resistance: %d ^8(total incoming damage)" , damage * resMult ))
1091- armourReduct = calcs .armourReduction ((output .Armour * percentOfArmourApplies / 100 ) * (1 + output .ArmourDefense ), damage * portionArmour / 100 )
10921091 else
10931092 t_insert (breakdown [damageType .. " DamageReduction" ], s_format (" Enemy Hit Damage: %d ^8(total incoming damage)" , damage ))
10941093 end
0 commit comments