Skip to content

Commit ea9dd66

Browse files
committed
FEAT(mods): add handling for Gain no armour from equipped body armour
1 parent 47c61f0 commit ea9dd66

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

src/Modules/CalcDefence.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,21 +365,21 @@ function calcs.defence(env, actor)
365365
for _, slot in pairs({"Helmet","Gloves","Boots","Body Armour","Weapon 2","Weapon 3"}) do
366366
local armourData = actor.itemList[slot] and actor.itemList[slot].armourData
367367
if armourData then
368-
wardBase = armourData.Ward or 0
368+
wardBase = not modDB:Flag(nil, "GainNoWardFrom" .. slot) and armourData.Ward or 0
369369
if wardBase > 0 then
370370
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
371371
wardBase = wardBase * 2
372372
end
373373
output["WardOn"..slot] = wardBase
374374
end
375-
energyShieldBase = armourData.EnergyShield or 0
375+
energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0
376376
if energyShieldBase > 0 then
377377
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
378378
energyShieldBase = energyShieldBase * 2
379379
end
380380
output["EnergyShieldOn"..slot] = energyShieldBase
381381
end
382-
armourBase = armourData.Armour or 0
382+
armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0
383383
if armourBase > 0 then
384384
if slot == "Body Armour" then
385385
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
@@ -391,7 +391,7 @@ function calcs.defence(env, actor)
391391
end
392392
output["ArmourOn"..slot] = armourBase
393393
end
394-
evasionBase = armourData.Evasion or 0
394+
evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0
395395
if evasionBase > 0 then
396396
if slot == "Body Armour" then
397397
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
@@ -697,7 +697,7 @@ function calcs.defence(env, actor)
697697
local armourData = actor.itemList[slot] and actor.itemList[slot].armourData
698698
if armourData then
699699
slotCfg.slotName = slot
700-
wardBase = armourData.Ward or 0
700+
wardBase = not modDB:Flag(nil, "GainNoWardFrom" .. slot) and armourData.Ward or 0
701701
if wardBase > 0 then
702702
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
703703
wardBase = wardBase * 2
@@ -725,7 +725,7 @@ function calcs.defence(env, actor)
725725
end
726726
end
727727
end
728-
energyShieldBase = armourData.EnergyShield or 0
728+
energyShieldBase = not modDB:Flag(nil, "GainNoEnergyShieldFrom" .. slot) and armourData.EnergyShield or 0
729729
if energyShieldBase > 0 then
730730
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
731731
energyShieldBase = energyShieldBase * 2
@@ -751,7 +751,7 @@ function calcs.defence(env, actor)
751751
end
752752
end
753753
end
754-
armourBase = armourData.Armour or 0
754+
armourBase = not modDB:Flag(nil, "GainNoArmourFrom" .. slot) and armourData.Armour or 0
755755
if armourBase > 0 then
756756
if slot == "Body Armour" then
757757
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
@@ -770,7 +770,7 @@ function calcs.defence(env, actor)
770770
breakdown.slot(slot, nil, slotCfg, armourBase, nil, "Armour", "ArmourAndEvasion", "Defences", slot.."ESAndArmour")
771771
end
772772
end
773-
evasionBase = armourData.Evasion or 0
773+
evasionBase = not modDB:Flag(nil, "GainNoEvasionFrom" .. slot) and armourData.Evasion or 0
774774
if evasionBase > 0 then
775775
if slot == "Body Armour" then
776776
if modDB:Flag(nil, "DoubleBodyArmourDefence") then

src/Modules/ModParser.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,13 @@ local specialModList = {
21492149
["gain no inherent bonuses from strength"] = { flag("NoStrengthAttributeBonuses") },
21502150
["gain no inherent bonuses from dexterity"] = { flag("NoDexterityAttributeBonuses") },
21512151
["gain no inherent bonuses from intelligence"] = { flag("NoIntelligenceAttributeBonuses") },
2152+
["gain no (.+) from equipped (.+)"] = function(_, stat, slot)
2153+
if slot == "shield" then slot = "Weapon 2" end
2154+
return {
2155+
flag("GainNo" .. string.gsub(" "..stat, "%W%l", string.upper):sub(2):gsub(" ", "").. "From" .. string.gsub(" "..slot, "%W%l", string.upper):sub(2))
2156+
}
2157+
end,
2158+
21522159
["all damage taken bypasses energy shield"] = {
21532160
mod("PhysicalEnergyShieldBypass", "OVERRIDE", 100),
21542161
mod("LightningEnergyShieldBypass", "OVERRIDE", 100),

0 commit comments

Comments
 (0)