@@ -457,7 +457,40 @@ describe("TestDefence", function()
457457 assert .are .equals (1000 , takenHitFromTypeMaxHit (" Lightning" ))
458458 assert .are .equals (1250 , build .calcsTab .calcsOutput .ChaosMaximumHitTaken )
459459 end )
460-
460+
461+ it (" energy shield increased by spell block chance if corresponding flag is present" , function ()
462+ build .configTab .input .enemyIsBoss = " None"
463+ build .configTab .input .customMods = " \z
464+ You have no intelligence\n\z
465+ 100 Energy shield \n\z
466+ energy shield is increased by chance to block spell damage\n\z
467+ 50% chance to block spell damage\n\z
468+ "
469+ build .configTab :BuildModList ()
470+ runCallback (" OnFrame" )
471+
472+ assert .are .equals (0 , build .calcsTab .calcsOutput .SpellBlockChanceOverCap )
473+ assert .are .equals (50 , build .calcsTab .calcsOutput .SpellBlockChance )
474+ assert .are .equals (150 , build .calcsTab .calcsOutput .EnergyShield )
475+ end )
476+
477+ it (" energy shield increased by spell block chance if corresponding flag is present should be capped to max block" , function ()
478+ build .configTab .input .enemyIsBoss = " None"
479+
480+ build .configTab .input .customMods = " \z
481+ You have no intelligence\n\z
482+ 100 Energy shield \n\z
483+ energy shield is increased by chance to block spell damage\n\z
484+ 100% chance to block spell damage\n\z
485+ "
486+ build .configTab :BuildModList ()
487+ runCallback (" OnFrame" )
488+
489+ assert .are .equals (25 , build .calcsTab .calcsOutput .SpellBlockChanceOverCap )
490+ assert .are .equals (75 , build .calcsTab .calcsOutput .SpellBlockChance )
491+ assert .are .equals (175 , build .calcsTab .calcsOutput .EnergyShield )
492+ end )
493+
461494 local function withinTenPercent (value , otherValue )
462495 local ratio = otherValue / value
463496 return 0.9 < ratio and ratio < 1.1
@@ -807,7 +840,7 @@ describe("TestDefence", function()
807840 assert .are .equals (0 , floor (poolsRemaining .Life ))
808841 assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
809842 end )
810-
843+
811844 it (" Unreakable + Iron Reflexes" , function ()
812845 build .configTab .input .customMods = [[
813846 you have no dexterity
@@ -902,4 +935,188 @@ describe("TestDefence", function()
902935 -- Oath Of Maji should apply only once
903936 assert .are .equals (2 * 2 * ironReflexesArmour + baseArmour + baseEvasion , build .calcsTab .mainOutput .Armour )
904937 end )
938+
939+ it (" MoM + EB" , function ()
940+ build .configTab .input .enemyIsBoss = " None"
941+ -- enough mana and es, 0% and 100% bypass
942+ build .configTab .input .customMods = [[
943+ 50% of damage is taken from mana before life
944+ energy shield protects mana instead of life
945+ +40 to maximum life
946+ +1960 to mana
947+ +2000 to energy shield
948+ You have no intelligence
949+ +60% to all resistances
950+ ]]
951+ build .configTab :BuildModList ()
952+ runCallback (" OnFrame" )
953+ assert .are .equals (200 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
954+ assert .are .equals (200 , build .calcsTab .calcsOutput .ChaosMaximumHitTaken )
955+ local poolsRemaining = poolsRemainingAfterTypeMaxHit (" Chaos" )
956+ assert .are .equals (2000 , round (poolsRemaining .EnergyShield ))
957+ assert .are .equals (1900 , round (poolsRemaining .Mana ))
958+ assert .are .equals (0 , floor (poolsRemaining .Life ))
959+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
960+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
961+ assert .are .equals (1900 , round (poolsRemaining .EnergyShield ))
962+ assert .are .equals (2000 , round (poolsRemaining .Mana ))
963+ assert .are .equals (0 , floor (poolsRemaining .Life ))
964+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
965+
966+ -- enough mana and es, 50% bypass
967+ build .configTab .input .customMods = [[
968+ 50% of damage is taken from mana before life
969+ energy shield protects mana instead of life
970+ 50% of non-chaos damage taken bypasses energy shield
971+ +40 to maximum life
972+ +1960 to mana
973+ +2000 to energy shield
974+ You have no intelligence
975+ +60% to all resistances
976+ ]]
977+ build .configTab :BuildModList ()
978+ runCallback (" OnFrame" )
979+ assert .are .equals (200 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
980+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
981+ assert .are .equals (1950 , round (poolsRemaining .EnergyShield ))
982+ assert .are .equals (1950 , round (poolsRemaining .Mana ))
983+ assert .are .equals (0 , floor (poolsRemaining .Life ))
984+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
985+
986+ -- es bottleneck, 0% and 100% bypass
987+ build .configTab .input .customMods = [[
988+ 50% of damage is taken from mana before life
989+ energy shield protects mana instead of life
990+ +40 to maximum life
991+ +1960 to mana
992+ +50 to energy shield
993+ You have no intelligence
994+ +60% to all resistances
995+ ]]
996+ build .configTab :BuildModList ()
997+ runCallback (" OnFrame" )
998+ assert .are .equals (200 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
999+ assert .are .equals (200 , build .calcsTab .calcsOutput .ChaosMaximumHitTaken )
1000+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Chaos" )
1001+ assert .are .equals (50 , round (poolsRemaining .EnergyShield ))
1002+ assert .are .equals (1900 , round (poolsRemaining .Mana ))
1003+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1004+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1005+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1006+ assert .are .equals (0 , round (poolsRemaining .EnergyShield ))
1007+ assert .are .equals (1950 , round (poolsRemaining .Mana ))
1008+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1009+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1010+
1011+ -- es bottleneck, 50% bypass
1012+ build .configTab .input .customMods = [[
1013+ 50% of damage is taken from mana before life
1014+ energy shield protects mana instead of life
1015+ 50% of non-chaos damage taken bypasses energy shield
1016+ +40 to maximum life
1017+ +1960 to mana
1018+ +40 to energy shield
1019+ You have no intelligence
1020+ +60% to all resistances
1021+ ]]
1022+ build .configTab :BuildModList ()
1023+ runCallback (" OnFrame" )
1024+ assert .are .equals (200 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
1025+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1026+ assert .are .equals (0 , round (poolsRemaining .EnergyShield ))
1027+ assert .are .equals (1940 , round (poolsRemaining .Mana ))
1028+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1029+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1030+
1031+ -- mana bottleneck, 0% and 100% bypass
1032+ build .configTab .input .customMods = [[
1033+ 50% of damage is taken from mana before life
1034+ energy shield protects mana instead of life
1035+ +40 to maximum life
1036+ +2000 to energy shield
1037+ You have no intelligence
1038+ +60% to all resistances
1039+ ]]
1040+ build .configTab :BuildModList ()
1041+ runCallback (" OnFrame" )
1042+ assert .are .equals (200 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
1043+ assert .are .equals (140 , build .calcsTab .calcsOutput .ChaosMaximumHitTaken )
1044+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Chaos" )
1045+ assert .are .equals (2000 , round (poolsRemaining .EnergyShield ))
1046+ assert .are .equals (0 , round (poolsRemaining .Mana ))
1047+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1048+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1049+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1050+ assert .are .equals (1900 , round (poolsRemaining .EnergyShield ))
1051+ assert .are .equals (40 , round (poolsRemaining .Mana ))
1052+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1053+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1054+
1055+ -- mana bottleneck, 50% bypass
1056+ -- taking 160 damage in this scenario:
1057+ -- 160 damage is split to 80 damage straight to life, 80 damage to MoM pools
1058+ -- 50% of the 80 MoM pool damage is taken by ES and 50% bypasses
1059+ -- pool of 20 mana takes 40 damage, gets depleted and the remaining damage continues on to life, for a total of 100 damage to life
1060+ build .configTab .input .customMods = [[
1061+ 50% of damage is taken from mana before life
1062+ energy shield protects mana instead of life
1063+ 50% of non-chaos damage taken bypasses energy shield
1064+ +40 to maximum life
1065+ -20 to mana
1066+ +2000 to energy shield
1067+ You have no intelligence
1068+ +60% to all resistances
1069+ ]]
1070+ build .configTab :BuildModList ()
1071+ runCallback (" OnFrame" )
1072+ assert .are .equals (160 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
1073+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1074+ assert .are .equals (1960 , round (poolsRemaining .EnergyShield ))
1075+ assert .are .equals (0 , round (poolsRemaining .Mana ))
1076+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1077+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1078+
1079+ -- mana+es bottleneck, 0% and 100% bypass
1080+ build .configTab .input .customMods = [[
1081+ 50% of damage is taken from mana before life
1082+ energy shield protects mana instead of life
1083+ +940 to maximum life
1084+ +50 to energy shield
1085+ You have no intelligence
1086+ +60% to all resistances
1087+ ]]
1088+ build .configTab :BuildModList ()
1089+ runCallback (" OnFrame" )
1090+ assert .are .equals (1090 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
1091+ assert .are .equals (1040 , build .calcsTab .calcsOutput .ChaosMaximumHitTaken )
1092+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Chaos" )
1093+ assert .are .equals (50 , round (poolsRemaining .EnergyShield ))
1094+ assert .are .equals (0 , round (poolsRemaining .Mana ))
1095+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1096+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1097+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1098+ assert .are .equals (0 , round (poolsRemaining .EnergyShield ))
1099+ assert .are .equals (0 , round (poolsRemaining .Mana ))
1100+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1101+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1102+
1103+ -- mana+es bottleneck, 50% bypass
1104+ build .configTab .input .customMods = [[
1105+ 50% of damage is taken from mana before life
1106+ energy shield protects mana instead of life
1107+ 50% of non-chaos damage taken bypasses energy shield
1108+ +940 to maximum life
1109+ +50 to energy shield
1110+ You have no intelligence
1111+ +60% to all resistances
1112+ ]]
1113+ build .configTab :BuildModList ()
1114+ runCallback (" OnFrame" )
1115+ assert .are .equals (1090 , build .calcsTab .calcsOutput .FireMaximumHitTaken )
1116+ poolsRemaining = poolsRemainingAfterTypeMaxHit (" Fire" )
1117+ assert .are .equals (0 , round (poolsRemaining .EnergyShield ))
1118+ assert .are .equals (0 , round (poolsRemaining .Mana ))
1119+ assert .are .equals (0 , floor (poolsRemaining .Life ))
1120+ assert .are .equals (0 , floor (poolsRemaining .OverkillDamage ))
1121+ end )
9051122end )
0 commit comments