@@ -1336,6 +1336,8 @@ function calcs.defence(env, actor)
13361336 output .Evasion = m_max (round (output .Evasion ), 0 )
13371337 output .MeleeEvasion = m_max (round (output .Evasion * calcLib .mod (modDB , nil , " MeleeEvasion" )), 0 )
13381338 output .ProjectileEvasion = m_max (round (output .Evasion * calcLib .mod (modDB , nil , " ProjectileEvasion" )), 0 )
1339+ output .SpellEvasion = m_max (round (output .Evasion * calcLib .mod (modDB , nil , " SpellEvasion" )), 0 )
1340+ output .SpellProjectileEvasion = m_max (round (output .Evasion * calcLib .mod (modDB , nil , " SpellProjectileEvasion" )), 0 )
13391341 output .LowestOfArmourAndEvasion = m_min (output .Armour , output .Evasion )
13401342 output .Ward = m_max (m_floor (ward ), 0 )
13411343 output [" Gear:Ward" ] = gearWard
@@ -1355,10 +1357,14 @@ function calcs.defence(env, actor)
13551357 output .EvadeChance = 0
13561358 output .MeleeEvadeChance = 0
13571359 output .ProjectileEvadeChance = 0
1360+ output .SpellEvadeChance = 0
1361+ output .SpellProjectileEvadeChance = 0
13581362 elseif modDB :Flag (nil , " AlwaysEvade" ) then
13591363 output .EvadeChance = 100
13601364 output .MeleeEvadeChance = 100
13611365 output .ProjectileEvadeChance = 100
1366+ output .SpellEvadeChance = 100
1367+ output .SpellProjectileEvadeChance = 100
13621368 else
13631369 local enemyAccuracy = round (calcLib .val (enemyDB , " Accuracy" ))
13641370 if modDB :Flag (nil , " EnemyAccuracyDistancePenalty" ) then
@@ -1372,8 +1378,10 @@ function calcs.defence(env, actor)
13721378 output .EvadeChance = 100 - (calcs .hitChance (output .Evasion , enemyAccuracy ) - evadeChance ) * hitChance
13731379 output .MeleeEvadeChance = m_max (0 , m_min (evadeMax , (100 - (calcs .hitChance (output .MeleeEvasion , enemyAccuracy ) - evadeChance ) * hitChance ) * calcLib .mod (modDB , nil , " EvadeChance" , " MeleeEvadeChance" )))
13741380 output .ProjectileEvadeChance = m_max (0 , m_min (evadeMax , (100 - (calcs .hitChance (output .ProjectileEvasion , enemyAccuracy ) - evadeChance ) * hitChance ) * calcLib .mod (modDB , nil , " EvadeChance" , " ProjectileEvadeChance" )))
1381+ output .SpellEvadeChance = m_max (0 , m_min (evadeMax , (100 - (calcs .hitChance (output .SpellEvasion , enemyAccuracy ) - evadeChance ) * hitChance ) * calcLib .mod (modDB , nil , " EvadeChance" , " SpellEvadeChance" )))
1382+ output .SpellProjectileEvadeChance = m_max (0 , m_min (evadeMax , (100 - (calcs .hitChance (output .SpellProjectileEvasion , enemyAccuracy ) - evadeChance ) * hitChance ) * calcLib .mod (modDB , nil , " EvadeChance" , " ProjectileEvadeChance" , " SpellProjectileEvadeChance" )))
13751383 -- Condition for displaying evade chance only if melee or projectile evade chance have the same values
1376- if output .MeleeEvadeChance ~= output .ProjectileEvadeChance then
1384+ if output .MeleeEvadeChance ~= output .ProjectileEvadeChance and output . MeleeEvadeChance ~= output . SpellEvadeChance and output . MeleeEvadeChance ~= output . SpellProjectileEvadeChance then
13771385 output .splitEvade = true
13781386 else
13791387 output .EvadeChance = output .MeleeEvadeChance
@@ -1398,6 +1406,18 @@ function calcs.defence(env, actor)
13981406 s_format (" Effective Evasion: %d" , output .ProjectileEvasion ),
13991407 s_format (" Approximate projectile evade chance: %d%%" , output .ProjectileEvadeChance ),
14001408 }
1409+ breakdown .SpellEvadeChance = {
1410+ s_format (" Enemy level: %d ^8(%s the Configuration tab)" , env .enemyLevel , env .configInput .enemyLevel and " overridden from" or " can be overridden in" ),
1411+ s_format (" Average enemy accuracy: %d" , enemyAccuracy ),
1412+ s_format (" Effective Evasion: %d" , output .SpellEvasion ),
1413+ s_format (" Approximate spell evade chance: %d%%" , output .SpellEvadeChance ),
1414+ }
1415+ breakdown .SpellProjectileEvadeChance = {
1416+ s_format (" Enemy level: %d ^8(%s the Configuration tab)" , env .enemyLevel , env .configInput .enemyLevel and " overridden from" or " can be overridden in" ),
1417+ s_format (" Average enemy accuracy: %d" , enemyAccuracy ),
1418+ s_format (" Effective Evasion: %d" , output .SpellProjectileEvasion ),
1419+ s_format (" Approximate spell projectile evade chance: %d%%" , output .SpellProjectileEvadeChance ),
1420+ }
14011421 end
14021422 end
14031423 end
@@ -1922,11 +1942,11 @@ function calcs.buildDefenceEstimations(env, actor)
19221942 local worstOf = env .configInput .EHPUnluckyWorstOf or 1
19231943 output .MeleeNotHitChance = 100 - (1 - output .MeleeEvadeChance / 100 ) * (1 - output .EffectiveAttackDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * 100
19241944 output .ProjectileNotHitChance = 100 - (1 - output .ProjectileEvadeChance / 100 ) * (1 - output .EffectiveAttackDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * (1 - (output .specificTypeAvoidance and 0 or output .AvoidProjectilesChance ) / 100 ) * 100
1925- output .SpellNotHitChance = 100 - (1 - output .EffectiveSpellDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * 100
1926- output .SpellProjectileNotHitChance = 100 - (1 - output .EffectiveSpellDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * (1 - (output .specificTypeAvoidance and 0 or output .AvoidProjectilesChance ) / 100 ) * 100
1945+ output .SpellNotHitChance = 100 - (1 - output .SpellEvadeChance / 100 ) * ( 1 - output . EffectiveSpellDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * 100
1946+ output .SpellProjectileNotHitChance = 100 - (1 - output .SpellProjectileEvadeChance / 100 ) * ( 1 - output . EffectiveSpellDodgeChance / 100 ) * (1 - output .AvoidAllDamageFromHitsChance / 100 ) * (1 - (output .specificTypeAvoidance and 0 or output .AvoidProjectilesChance ) / 100 ) * 100
19271947 output .UntypedNotHitChance = 100 - (1 - output .AvoidAllDamageFromHitsChance / 100 ) * 100
19281948 output .AverageNotHitChance = (output .MeleeNotHitChance + output .ProjectileNotHitChance + output .SpellNotHitChance + output .SpellProjectileNotHitChance ) / 4
1929- output .AverageEvadeChance = (output .MeleeEvadeChance + output .ProjectileEvadeChance ) / 4
1949+ output .AverageEvadeChance = (output .MeleeEvadeChance + output .ProjectileEvadeChance + output . SpellNotHitChance + output . SpellProjectileNotHitChance ) / 4
19301950 output .ConfiguredNotHitChance = output [damageCategoryConfig .. " NotHitChance" ]
19311951 output .ConfiguredEvadeChance = output [damageCategoryConfig .. " EvadeChance" ] or 0
19321952 -- unlucky config to lower the value of block, dodge, evade etc for ehp
@@ -3147,15 +3167,18 @@ function calcs.buildDefenceEstimations(env, actor)
31473167 t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" x %.2f ^8(chance for avoidance to fail)" , 1 - output .AvoidProjectilesChance / 100 ))
31483168 end
31493169 elseif damageCategoryConfig == " Spell" or damageCategoryConfig == " SpellProjectile" then
3170+ if output [damageCategoryConfig .. " EvadeChance" ] > 0 then
3171+ t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" %.2f ^8(chance for evasion to fail)" , 1 - output [damageCategoryConfig .. " EvadeChance" ] / 100 ))
3172+ end
31503173 if output .SpellDodgeChance > 0 then
31513174 t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" %.2f ^8(chance for dodge to fail)" , 1 - output .SpellDodgeChance / 100 ))
31523175 end
31533176 if damageCategoryConfig == " SpellProjectile" and not output .specificTypeAvoidance and output .AvoidProjectilesChance > 0 then
31543177 t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" x %.2f ^8(chance for avoidance to fail)" , 1 - output .AvoidProjectilesChance / 100 ))
31553178 end
31563179 elseif damageCategoryConfig == " Average" then
3157- if output .MeleeEvadeChance > 0 or output .ProjectileEvadeChance > 0 then
3158- t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" %.2f ^8(chance for evasion to fail, only applies to the attack portion )" , 1 - (output .MeleeEvadeChance + output .ProjectileEvadeChance ) / 2 / 100 ))
3180+ if output .MeleeEvadeChance > 0 or output .ProjectileEvadeChance > 0 or output . SpellNotHitChance > 0 or output . SpellProjectileNotHitChance > 0 then
3181+ t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" %.2f ^8(chance for evasion to fail)" , 1 - (output .MeleeEvadeChance + output .ProjectileEvadeChance + output . SpellNotHitChance + output . SpellProjectileNotHitChance ) / 4 / 100 ))
31593182 end
31603183 if output .AttackDodgeChance > 0 or output .SpellDodgeChance > 0 then
31613184 t_insert (breakdown [" ConfiguredNotHitChance" ], s_format (" x%.2f ^8(chance for dodge to fail)" , 1 - (output .AttackDodgeChance + output .SpellDodgeChance ) / 2 / 100 ))
0 commit comments