@@ -367,39 +367,56 @@ function calcs.defence(env, actor)
367367 if armourData then
368368 wardBase = not modDB :Flag (nil , " GainNoWardFrom" .. slot ) and armourData .Ward or 0
369369 if wardBase > 0 then
370+ -- "X from Y is doubled" mods from the following flag do not stack
371+ if modDB :Flag (nil , " WardFrom" .. slot .. " isDoubled" ) then
372+ wardBase = wardBase * 2
373+ end
374+
375+ -- Mods that should stack with the above should be implemented like below
370376 if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
371377 wardBase = wardBase * 2
372378 end
373379 output [" WardOn" .. slot ] = wardBase
374380 end
375381 energyShieldBase = not modDB :Flag (nil , " GainNoEnergyShieldFrom" .. slot ) and armourData .EnergyShield or 0
376382 if energyShieldBase > 0 then
383+ -- "X from Y is doubled" mods from the following flag do not stack
384+ if modDB :Flag (nil , " EnergyShieldFrom" .. slot .. " isDoubled" ) then
385+ energyShieldBase = energyShieldBase * 2
386+ end
387+
388+ -- Mods that should stack with the above should be implemented like below
377389 if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
378390 energyShieldBase = energyShieldBase * 2
379391 end
380392 output [" EnergyShieldOn" .. slot ] = energyShieldBase
381393 end
382394 armourBase = not modDB :Flag (nil , " GainNoArmourFrom" .. slot ) and armourData .Armour or 0
383395 if armourBase > 0 then
384- if slot == " Body Armour" then
385- if modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
386- armourBase = armourBase * 2
387- end
388- if modDB :Flag (nil , " Unbreakable" ) then
389- armourBase = armourBase * 2
390- end
396+ -- "X from Y is doubled" mods from the following flag do not stack
397+ if modDB :Flag (nil , " ArmourFrom" .. slot .. " isDoubled" ) then
398+ armourBase = armourBase * 2
399+ end
400+
401+ -- Mods that should stack with the above should be implemented like below
402+ if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" )then
403+ armourBase = armourBase * 2
391404 end
392405 output [" ArmourOn" .. slot ] = armourBase
393406 end
394407 evasionBase = not modDB :Flag (nil , " GainNoEvasionFrom" .. slot ) and armourData .Evasion or 0
395408 if evasionBase > 0 then
396- if slot == " Body Armour" then
397- if modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
398- evasionBase = evasionBase * 2
399- end
400- if modDB :Flag (nil , " Unbreakable" ) and modDB :Flag (nil , " IronReflexes" ) then
401- evasionBase = evasionBase * 2
402- end
409+ -- "X from Y is doubled" mods from the following flag do not stack
410+ if modDB :Flag (nil , " EvasionFrom" .. slot .. " isDoubled" ) then
411+ evasionBase = evasionBase * 2
412+ end
413+ if modDB :Flag (nil , " ArmourFrom" .. slot .. " isDoubled" ) and ironReflexes then
414+ evasionBase = evasionBase * 2
415+ end
416+
417+ -- Mods that should stack with the above should be implemented like below
418+ if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
419+ evasionBase = evasionBase * 2
403420 end
404421 output [" EvasionOn" .. slot ] = evasionBase
405422 end
@@ -699,6 +716,12 @@ function calcs.defence(env, actor)
699716 slotCfg .slotName = slot
700717 wardBase = not modDB :Flag (nil , " GainNoWardFrom" .. slot ) and armourData .Ward or 0
701718 if wardBase > 0 then
719+ -- "X from Y is doubled" mods from the following flag do not stack
720+ if modDB :Flag (nil , " WardFrom" .. slot .. " isDoubled" ) then
721+ wardBase = wardBase * 2
722+ end
723+
724+ -- Mods that should stack with the above should be implemented like below
702725 if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
703726 wardBase = wardBase * 2
704727 end
@@ -727,6 +750,12 @@ function calcs.defence(env, actor)
727750 end
728751 energyShieldBase = not modDB :Flag (nil , " GainNoEnergyShieldFrom" .. slot ) and armourData .EnergyShield or 0
729752 if energyShieldBase > 0 then
753+ -- "X from Y is doubled" mods from the following flag do not stack
754+ if modDB :Flag (nil , " EnergyShieldFrom" .. slot .. " isDoubled" ) then
755+ energyShieldBase = energyShieldBase * 2
756+ end
757+
758+ -- Mods that should stack with the above should be implemented like below
730759 if slot == " Body Armour" and modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
731760 energyShieldBase = energyShieldBase * 2
732761 end
@@ -753,13 +782,16 @@ function calcs.defence(env, actor)
753782 end
754783 armourBase = not modDB :Flag (nil , " GainNoArmourFrom" .. slot ) and armourData .Armour or 0
755784 if armourBase > 0 then
785+ -- "X from Y is doubled" mods from the following flag do not stack
786+ if modDB :Flag (nil , " ArmourFrom" .. slot .. " isDoubled" ) then
787+ armourBase = armourBase * 2
788+ end
789+
756790 if slot == " Body Armour" then
791+ -- Mods that should stack with the above should be implemented like below
757792 if modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
758793 armourBase = armourBase * 2
759794 end
760- if modDB :Flag (nil , " Unbreakable" ) then
761- armourBase = armourBase * 2
762- end
763795 if modDB :Flag (nil , " ConvertBodyArmourArmourEvasionToWard" ) then
764796 armourBase = armourBase * (1 - ((m_min (modDB :Sum (" BASE" , nil , " BodyArmourArmourEvasionToWardPercent" ), 100 ) or 0 ) / 100 ))
765797 end
@@ -772,13 +804,19 @@ function calcs.defence(env, actor)
772804 end
773805 evasionBase = not modDB :Flag (nil , " GainNoEvasionFrom" .. slot ) and armourData .Evasion or 0
774806 if evasionBase > 0 then
807+ -- "X from Y is doubled" mods from the following flag do not stack
808+ if modDB :Flag (nil , " EvasionFrom" .. slot .. " isDoubled" ) then
809+ evasionBase = evasionBase * 2
810+ end
811+ if modDB :Flag (nil , " ArmourFrom" .. slot .. " isDoubled" ) and ironReflexes then
812+ evasionBase = evasionBase * 2
813+ end
814+
775815 if slot == " Body Armour" then
816+ -- Mods that should stack with the above should be implemented like below
776817 if modDB :Flag (nil , " DoubleBodyArmourDefence" ) then
777818 evasionBase = evasionBase * 2
778819 end
779- if modDB :Flag (nil , " Unbreakable" ) and ironReflexes then
780- evasionBase = evasionBase * 2
781- end
782820 if modDB :Flag (nil , " ConvertBodyArmourArmourEvasionToWard" ) then
783821 evasionBase = evasionBase * (1 - ((m_min (modDB :Sum (" BASE" , nil , " BodyArmourArmourEvasionToWardPercent" ), 100 ) or 0 ) / 100 ))
784822 end
0 commit comments