Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/Modules/CalcDefence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down
12 changes: 0 additions & 12 deletions src/Modules/CalcPerform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down