Skip to content

Commit 86216cf

Browse files
committed
FEAT(mods): add handling for Prospero's Protection mods
Gain no armour from equipped body armour Armour from equipped shield is doubled
1 parent e1f94ad commit 86216cf

3 files changed

Lines changed: 42 additions & 57 deletions

File tree

src/Modules/CalcDefence.lua

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -454,40 +454,22 @@ function calcs.defence(env, actor)
454454
if armourData then
455455
wardBase = armourData.Ward or 0
456456
if wardBase > 0 then
457-
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
458-
wardBase = wardBase * 2
459-
end
457+
wardBase = wardBase * modDB:More(nil, slot:gsub(" ", "") .. "WardDefenceMult")
460458
output["WardOn"..slot] = wardBase
461459
end
462460
energyShieldBase = armourData.EnergyShield or 0
463461
if energyShieldBase > 0 then
464-
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
465-
energyShieldBase = energyShieldBase * 2
466-
end
462+
energyShieldBase = energyShieldBase * modDB:More(nil, slot:gsub(" ", "") .. "EnergyShieldDefenceMult")
467463
output["EnergyShieldOn"..slot] = energyShieldBase
468464
end
469465
armourBase = armourData.Armour or 0
470466
if armourBase > 0 then
471-
if slot == "Body Armour" then
472-
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
473-
armourBase = armourBase * 2
474-
end
475-
if modDB:Flag(nil, "Unbreakable") then
476-
armourBase = armourBase * 2
477-
end
478-
end
467+
armourBase = armourBase * modDB:More(nil, slot:gsub(" ", "") .. "ArmourDefenceMult")
479468
output["ArmourOn"..slot] = armourBase
480469
end
481470
evasionBase = armourData.Evasion or 0
482471
if evasionBase > 0 then
483-
if slot == "Body Armour" then
484-
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
485-
evasionBase = evasionBase * 2
486-
end
487-
if modDB:Flag(nil, "Unbreakable") and modDB:Flag(nil, "IronReflexes") then
488-
evasionBase = evasionBase * 2
489-
end
490-
end
472+
evasionBase = evasionBase * modDB:More(nil, slot:gsub(" ", "") .. "EvasionDefenceMult")
491473
output["EvasionOn"..slot] = evasionBase
492474
end
493475
end
@@ -763,7 +745,7 @@ function calcs.defence(env, actor)
763745
end
764746
-- Primary defences: Energy shield, evasion and armour
765747
do
766-
local ironReflexes = modDB:Flag(nil, "IronReflexes")
748+
local ironReflexes = modDB:Flag(nil, "Condition:IronReflexes")
767749
local ward = 0
768750
local energyShield = 0
769751
local armour = 0
@@ -782,13 +764,12 @@ function calcs.defence(env, actor)
782764
local slotCfg = wipeTable(tempTable1)
783765
for _, slot in pairs({"Helmet","Gloves","Boots","Body Armour","Weapon 2","Weapon 3"}) do
784766
local armourData = actor.itemList[slot] and actor.itemList[slot].armourData
767+
print(slot == "Weapon 3" and armourData)
785768
if armourData then
786769
slotCfg.slotName = slot
787770
wardBase = armourData.Ward or 0
788771
if wardBase > 0 then
789-
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
790-
wardBase = wardBase * 2
791-
end
772+
wardBase = wardBase * modDB:More(nil, slot:gsub(" ", "") .. "WardDefenceMult")
792773
if modDB:Flag(nil, "EnergyShieldToWard") then
793774
local inc = modDB:Sum("INC", slotCfg, "Ward", "Defences", "EnergyShield")
794775
local more = modDB:More(slotCfg, "Ward", "Defences")
@@ -814,9 +795,7 @@ function calcs.defence(env, actor)
814795
end
815796
energyShieldBase = armourData.EnergyShield or 0
816797
if energyShieldBase > 0 then
817-
if slot == "Body Armour" and modDB:Flag(nil, "DoubleBodyArmourDefence") then
818-
energyShieldBase = energyShieldBase * 2
819-
end
798+
energyShieldBase = energyShieldBase * modDB:More(nil, slot:gsub(" ", "") .. "EnergyShieldDefenceMult")
820799
if modDB:Flag(nil, "EnergyShieldToWard") then
821800
local more = modDB:More(slotCfg, "EnergyShield", "Defences")
822801
energyShield = energyShield + energyShieldBase * more
@@ -840,16 +819,9 @@ function calcs.defence(env, actor)
840819
end
841820
armourBase = armourData.Armour or 0
842821
if armourBase > 0 then
843-
if slot == "Body Armour" then
844-
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
845-
armourBase = armourBase * 2
846-
end
847-
if modDB:Flag(nil, "Unbreakable") then
848-
armourBase = armourBase * 2
849-
end
850-
if modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then
851-
armourBase = armourBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100))
852-
end
822+
armourBase = armourBase * modDB:More(nil, slot:gsub(" ", "") .. "ArmourDefenceMult")
823+
if slot == "Body Armour" and modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then
824+
armourBase = armourBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100))
853825
end
854826
armour = armour + armourBase * calcLib.mod(modDB, slotCfg, "Armour", "ArmourAndEvasion", "Defences", slot.."ESAndArmour")
855827
gearArmour = gearArmour + armourBase
@@ -859,16 +831,9 @@ function calcs.defence(env, actor)
859831
end
860832
evasionBase = armourData.Evasion or 0
861833
if evasionBase > 0 then
862-
if slot == "Body Armour" then
863-
if modDB:Flag(nil, "DoubleBodyArmourDefence") then
864-
evasionBase = evasionBase * 2
865-
end
866-
if modDB:Flag(nil, "Unbreakable") and ironReflexes then
867-
evasionBase = evasionBase * 2
868-
end
869-
if modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then
870-
evasionBase = evasionBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100))
871-
end
834+
evasionBase = evasionBase * modDB:More(nil, slot:gsub(" ", "") .. "EvasionDefenceMult")
835+
if slot == "Body Armour" and modDB:Flag(nil, "ConvertBodyArmourArmourEvasionToWard") then
836+
evasionBase = evasionBase * (1 - ((m_min(modDB:Sum("BASE", nil, "BodyArmourArmourEvasionToWardPercent"), 100) or 0) / 100))
872837
end
873838
gearEvasion = gearEvasion + evasionBase
874839
if breakdown then

src/Modules/ConfigOptions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ Huge sets the radius to 11.
14831483
modList:NewMod("Multiplier:FragileRegrowthCount", "BASE", m_min(val,10), "Config", { type = "Condition", var = "Combat" })
14841484
end },
14851485
{ var = "conditionHaveArborix", type = "check", label = "Do you have Iron Reflexes?", ifFlag = "Condition:HaveArborix", tooltip = "This option is specific to Arborix.",apply = function(val, modList, enemyModList)
1486-
modList:NewMod("Condition:HaveIronReflexes", "FLAG", true, "Config", { type = "Condition", var = "Combat" })
1486+
modList:NewMod("Condition:IronReflexes", "FLAG", true, "Config", { type = "Condition", var = "Combat" })
14871487
modList:NewMod("Keystone", "LIST", "Iron Reflexes", "Config")
14881488
end },
14891489
{ var = "conditionHaveAugyre", type = "list", label = "Augyre rotating buff:", ifFlag = "Condition:HaveAugyre", list = {{val="EleOverload",label="Elemental Overload"},{val="ResTechnique",label="Resolute Technique"}}, tooltip = "This option is specific to Augyre.", apply = function(val, modList, enemyModList)

src/Modules/ModParser.lua

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,8 +1744,8 @@ local modTagList = {
17441744
["to enemies they're attached to"] = { tag = { type = "MultiplierThreshold", var = "BrandsAttachedToEnemy", threshold = 1 } },
17451745
["for each hit you've taken recently up to a maximum of (%d+)%%"] = function(num) return { tag = { type = "Multiplier", var = "BeenHitRecently", limit = num, limitTotal = true } } end,
17461746
["for each nearby enemy, up to (%d+)%%"] = function(num) return { tag = { type = "Multiplier", var = "NearbyEnemies", limit = num, limitTotal = true } } end,
1747-
["while you have iron reflexes"] = { tag = { type = "Condition", var = "HaveIronReflexes" } },
1748-
["while you do not have iron reflexes"] = { tag = { type = "Condition", var = "HaveIronReflexes", neg = true } },
1747+
["while you have iron reflexes"] = { tag = { type = "Condition", var = "IronReflexes" } },
1748+
["while you do not have iron reflexes"] = { tag = { type = "Condition", var = "IronReflexes", neg = true } },
17491749
["while you have elemental overload"] = { tag = { type = "Condition", var = "HaveElementalOverload" } },
17501750
["while you do not have elemental overload"] = { tag = { type = "Condition", var = "HaveElementalOverload", neg = true } },
17511751
["while you have resolute technique"] = { tag = { type = "Condition", var = "HaveResoluteTechnique" } },
@@ -2016,7 +2016,7 @@ local specialModList = {
20162016
["ailments never count as being from critical strikes"] = { flag("AilmentsAreNeverFromCrit") },
20172017
["the increase to physical damage from strength applies to projectile attacks as well as melee attacks"] = { flag("IronGrip") },
20182018
["strength%'s damage bonus applies to projectile attack damage as well as melee damage"] = { flag("IronGrip") },
2019-
["converts all evasion rating to armour%. dexterity provides no bonus to evasion rating"] = { flag("NoDexBonusToEvasion"), flag("IronReflexes") },
2019+
["converts all evasion rating to armour%. dexterity provides no bonus to evasion rating"] = { flag("NoDexBonusToEvasion"), flag("Condition:IronReflexes") },
20202020
["30%% chance to dodge attack hits%. 50%% less armour, 30%% less energy shield, 30%% less chance to block spell and attack damage"] = {
20212021
mod("AttackDodgeChance", "BASE", 30),
20222022
mod("Armour", "MORE", -50),
@@ -2150,6 +2150,12 @@ local specialModList = {
21502150
["gain no inherent bonuses from strength"] = { flag("NoStrengthAttributeBonuses") },
21512151
["gain no inherent bonuses from dexterity"] = { flag("NoDexterityAttributeBonuses") },
21522152
["gain no inherent bonuses from intelligence"] = { flag("NoIntelligenceAttributeBonuses") },
2153+
["gain no (.+) from equipped (.+)"] = function(_, stat, slot)
2154+
if slot == "shield" then slot = "Weapon 2" end
2155+
return {
2156+
mod(string.gsub(" "..slot, "%W%l", string.upper):sub(2):gsub(" ", "") .. string.gsub(" "..stat, "%W%l", string.upper):sub(2):gsub(" ", "") .. "DefenceMult", "MORE", -100),
2157+
}
2158+
end,
21532159
["all damage taken bypasses energy shield"] = {
21542160
mod("PhysicalEnergyShieldBypass", "OVERRIDE", 100),
21552161
mod("LightningEnergyShieldBypass", "OVERRIDE", 100),
@@ -2623,8 +2629,13 @@ local specialModList = {
26232629
mod("Damage", "MORE", num, nil, ModFlag.Attack, { type = "Multiplier", var = "CastLast8Seconds", limit = max, limitTotal = true }),
26242630
} end,
26252631
-- Juggernaut
2626-
["armour received from body armour is doubled"] = { flag("Unbreakable") },
2627-
["armour from equipped body armour is doubled"] = { flag("Unbreakable") },
2632+
["armour r?e?c?e?i?v?e?d? ?from ?e?q?u?i?p?p?e?d? ?(%w+%W?%w+) is doubled"] = function(_, slot)
2633+
if slot == "shield" then slot = "Weapon 2" end
2634+
return {
2635+
mod(string.gsub(" "..slot, "%W%l", string.upper):sub(2):gsub(" ", "") .. "ArmourDefenceMult", "MORE", 100),
2636+
mod(string.gsub(" "..slot, "%W%l", string.upper):sub(2):gsub(" ", "") .. "EvasionDefenceMult", "MORE", 100, { type = "Condition", var = "IronReflexes" })
2637+
}
2638+
end,
26282639
["action speed cannot be modified to below base value"] = { mod("MinimumActionSpeed", "MAX", 100, { type = "GlobalEffect", effectType = "Global", unscalable = true }) },
26292640
["movement speed cannot be modified to below base value"] = { flag("MovementSpeedCannotBeBelowBase") },
26302641
["you cannot be slowed to below base speed"] = { mod("MinimumActionSpeed", "MAX", 100, { type = "GlobalEffect", effectType = "Global", unscalable = true }) },
@@ -2746,7 +2757,16 @@ local specialModList = {
27462757
},
27472758
["(%d+)%% more elemental damage while unbound"] = function(num) return { mod("ElementalDamage", "MORE", num, { type = "Condition", var = "Unbound"})} end,
27482759
-- Warden (Affliction)
2749-
["defences from equipped body armour are doubled if it has no socketed gems"] = { flag("DoubleBodyArmourDefence", { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }, { type = "Condition", var = "UsingBody Armour" }) },
2760+
["defences from equipped (.+) are doubled if it has no socketed gems"] = function(_, slot)
2761+
if slot == "shield" then slot = "Weapon 2" end
2762+
local slotName = string.gsub(" "..slot, "%W%l", string.upper):sub(2):gsub(" ", "")
2763+
return {
2764+
mod(slotName .. "ArmourDefenceMult", "MORE", 100, { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }, { type = "Condition", var = "UsingBody Armour" }),
2765+
mod(slotName .. "EvasionDefenceMult", "MORE", 100, { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }, { type = "Condition", var = "UsingBody Armour" }),
2766+
mod(slotName .. "EnergyShieldDefenceMult", "MORE", 100, { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }, { type = "Condition", var = "UsingBody Armour" }),
2767+
mod(slotName .. "WardDefenceMult", "MORE", 100, { type = "MultiplierThreshold", var = "SocketedGemsInBody Armour", threshold = 0, upper = true }, { type = "Condition", var = "UsingBody Armour" }),
2768+
}
2769+
end,
27502770
["([%+%-]%d+)%% to all elemental resistances if you have an equipped helmet with no socketed gems"] = function(num) return { mod("ElementalResist", "BASE", num, { type = "MultiplierThreshold", var = "SocketedGemsInHelmet", threshold = 0, upper = true}, { type = "Condition", var = "UsingHelmet" }) } end,
27512771
["(%d+)%% increased maximum life if you have equipped gloves with no socketed gems"] = function(num) return { mod("Life", "INC", num, { type = "MultiplierThreshold", var = "SocketedGemsInGloves", threshold = 0, upper = true}, { type = "Condition", var = "UsingGloves" }) } end,
27522772
["(%d+)%% increased movement speed if you have equipped boots with no socketed gems"] = function(num) return { mod("MovementSpeed", "INC", num, { type = "MultiplierThreshold", var = "SocketedGemsInBoots", threshold = 0, upper = true}, { type = "Condition", var = "UsingBoots" }) } end,
@@ -4807,7 +4827,7 @@ local specialModList = {
48074827
mod("OmniAttributeRequirements", "INC", num),
48084828
flag("OmniscienceRequirements")
48094829
} end,
4810-
["you have far shot while you do not have iron reflexes"] = { flag("FarShot", { neg = true, type = "Condition", var = "HaveIronReflexes" }) },
4830+
["you have far shot while you do not have iron reflexes"] = { flag("FarShot", { neg = true, type = "Condition", var = "IronReflexes" }) },
48114831
["you have resolute technique while you do not have elemental overload"] = { mod("Keystone", "LIST", "Resolute Technique", { neg = true, type = "Condition", var = "HaveElementalOverload" }) },
48124832
["hits ignore enemy monster fire resistance while you are ignited"] = { flag("IgnoreFireResistance", { type = "Condition", var = "Ignited" }) },
48134833
["your hits can't be evaded by blinded enemies"] = { flag("CannotBeEvaded", { type = "ActorCondition", actor = "enemy", var = "Blinded" }) },

0 commit comments

Comments
 (0)