@@ -839,7 +839,18 @@ function calcs.defence(env, actor)
839839 local armourData = actor .itemList [slot ] and actor .itemList [slot ].armourData
840840 if armourData then
841841 slotCfg .slotName = slot
842+ energyShieldBase = not modDB :Flag (nil , " GainNoEnergyShieldFrom" .. slot ) and armourData .EnergyShield or 0
843+ armourBase = not modDB :Flag (nil , " GainNoArmourFrom" .. slot ) and armourData .Armour or 0
844+ evasionBase = not modDB :Flag (nil , " GainNoEvasionFrom" .. slot ) and armourData .Evasion or 0
842845 wardBase = not modDB :Flag (nil , " GainNoWardFrom" .. slot ) and armourData .Ward or 0
846+ if slot == " Body Armour" and modDB :Flag (nil , " ConvertBodyArmourArmourEvasionToWard" ) then
847+ local conversion = m_min (modDB :Sum (" BASE" , nil , " BodyArmourArmourEvasionToWardPercent" ) / 100 , 1 )
848+ local convertedArmour = armourBase * conversion
849+ local convertedEvasion = evasionBase * conversion
850+ armourBase = armourBase - convertedArmour
851+ evasionBase = evasionBase - convertedEvasion
852+ wardBase = wardBase + (convertedEvasion + convertedArmour )
853+ end
843854 if wardBase > 0 then
844855 if modDB :Flag (nil , " EnergyShieldToWard" ) then
845856 local inc = modDB :Sum (" INC" , slotCfg , " Ward" , " Defences" , " EnergyShield" )
@@ -864,7 +875,6 @@ function calcs.defence(env, actor)
864875 end
865876 end
866877 end
867- energyShieldBase = not modDB :Flag (nil , " GainNoEnergyShieldFrom" .. slot ) and armourData .EnergyShield or 0
868878 if energyShieldBase > 0 then
869879 if modDB :Flag (nil , " EnergyShieldToWard" ) then
870880 local more = modDB :More (slotCfg , " EnergyShield" , " Defences" )
@@ -887,22 +897,14 @@ function calcs.defence(env, actor)
887897 end
888898 end
889899 end
890- armourBase = not modDB :Flag (nil , " GainNoArmourFrom" .. slot ) and armourData .Armour or 0
891900 if armourBase > 0 then
892- if slot == " Body Armour" and modDB :Flag (nil , " ConvertBodyArmourArmourEvasionToWard" )then
893- armourBase = armourBase * (1 - ((m_min (modDB :Sum (" BASE" , nil , " BodyArmourArmourEvasionToWardPercent" ), 100 ) or 0 ) / 100 ))
894- end
895901 armour = armour + armourBase * calcLib .mod (modDB , slotCfg , " Armour" , " ArmourAndEvasion" , " Defences" , slot .. " ESAndArmour" )
896902 gearArmour = gearArmour + armourBase
897903 if breakdown then
898904 breakdown .slot (slot , nil , slotCfg , armourBase , nil , " Armour" , " ArmourAndEvasion" , " Defences" , slot .. " ESAndArmour" )
899905 end
900906 end
901- evasionBase = not modDB :Flag (nil , " GainNoEvasionFrom" .. slot ) and armourData .Evasion or 0
902907 if evasionBase > 0 then
903- if slot == " Body Armour" and modDB :Flag (nil , " ConvertBodyArmourArmourEvasionToWard" )then
904- evasionBase = evasionBase * (1 - ((m_min (modDB :Sum (" BASE" , nil , " BodyArmourArmourEvasionToWardPercent" ), 100 ) or 0 ) / 100 ))
905- end
906908 gearEvasion = gearEvasion + evasionBase
907909 if breakdown then
908910 breakdown .slot (slot , nil , slotCfg , evasionBase , nil , " Evasion" , " ArmourAndEvasion" , " Defences" )
0 commit comments