diff --git a/src/Modules/CalcDefence.lua b/src/Modules/CalcDefence.lua index de34350342..c143608c6c 100644 --- a/src/Modules/CalcDefence.lua +++ b/src/Modules/CalcDefence.lua @@ -839,7 +839,18 @@ function calcs.defence(env, actor) local armourData = actor.itemList[slot] and actor.itemList[slot].armourData if armourData then slotCfg.slotName = slot + energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0 + armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0 + evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0 wardBase = not modDB:Flag(nil, "GainNoWardFrom" .. slot) and armourData.Ward or 0 + if slot == "Body Armour" and modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then + local conversion = m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent") / 100, 1) + local convertedArmour = armourBase * conversion + local convertedEvasion = evasionBase * conversion + armourBase = armourBase - convertedArmour + evasionBase = evasionBase - convertedEvasion + wardBase = wardBase + (convertedEvasion + convertedArmour) + end if wardBase > 0 then if modDB:Flag(nil, "EnergyShieldToWard") then local inc = modDB:Sum("INC", slotCfg, "Ward", "Defences", "EnergyShield") @@ -864,7 +875,6 @@ function calcs.defence(env, actor) end end end - energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0 if energyShieldBase > 0 then if modDB:Flag(nil, "EnergyShieldToWard") then local more = modDB:More(slotCfg, "EnergyShield", "Defences") @@ -887,22 +897,14 @@ function calcs.defence(env, actor) end end end - armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0 if armourBase > 0 then - if slot == "Body Armour" and modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard")then - armourBase = armourBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100)) - end armour = armour + armourBase * calcLib.mod(modDB, slotCfg, "Armour", "ArmourAndEvasion", "Defences", slot.."ESAndArmour") gearArmour = gearArmour + armourBase if breakdown then breakdown.slot(slot, nil, slotCfg, armourBase, nil, "Armour", "ArmourAndEvasion", "Defences", slot.."ESAndArmour") end end - evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0 if evasionBase > 0 then - if slot == "Body Armour" and modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard")then - evasionBase = evasionBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100)) - end gearEvasion = gearEvasion + evasionBase if breakdown then breakdown.slot(slot, nil, slotCfg, evasionBase, nil, "Evasion", "ArmourAndEvasion", "Defences") diff --git a/src/Modules/CalcPerform.lua b/src/Modules/CalcPerform.lua index 584235561d..ec8a798e15 100644 --- a/src/Modules/CalcPerform.lua +++ b/src/Modules/CalcPerform.lua @@ -1405,18 +1405,6 @@ function calcs.perform(env, skipEHP) end end - if modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then - local ward - local armourData = env.player.itemList["Body Armour"] and env.player.itemList["Body Armour"].armourData - if armourData then - ward = armourData.Evasion + armourData.Armour - if ward > 0 then - local wardMult = ((modDB:Sum("BASE", nil,"BodyArmourArmourEvasionToWardPercent") or 0) / 100) - modDB:NewMod("Ward", "BASE", ward * wardMult , "Body Armour Armour And Evasion Rating to Ward Conversion") - end - end - end - -- Special handling of Mageblood local maxLeftActiveMagicUtilityCount = modDB:Sum("BASE", nil, "LeftActiveMagicUtilityFlasks") local maxRightActiveMagicUtilityCount = modDB:Sum("BASE", nil, "RightActiveMagicUtilityFlasks")