Skip to content

Commit 018ad8e

Browse files
author
LocalIdentity
committed
Better fix
Was improperly modifying the armourData instead of just adding to the Body Armour slot
1 parent 6e9bb0b commit 018ad8e

2 files changed

Lines changed: 11 additions & 17 deletions

File tree

src/Modules/CalcDefence.lua

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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")

src/Modules/CalcPerform.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,14 +1405,6 @@ function calcs.perform(env, skipEHP)
14051405
end
14061406
end
14071407

1408-
if modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then
1409-
local armourData = env.player.itemList["Body Armour"] and env.player.itemList["Body Armour"].armourData
1410-
local wardMult = ((modDB:Sum("BASE", nil,"BodyArmourArmourEvasionToWardPercent") or 0) / 100)
1411-
if armourData then
1412-
armourData.Ward = m_floor((armourData.Evasion + armourData.Armour) * wardMult)
1413-
end
1414-
end
1415-
14161408
-- Special handling of Mageblood
14171409
local maxLeftActiveMagicUtilityCount = modDB:Sum("BASE", nil, "LeftActiveMagicUtilityFlasks")
14181410
local maxRightActiveMagicUtilityCount = modDB:Sum("BASE", nil, "RightActiveMagicUtilityFlasks")

0 commit comments

Comments
 (0)