Skip to content

Commit 1559937

Browse files
Improve MoM+EB(+ES bypass) calculations (#8590)
1 parent 91c1b58 commit 1559937

2 files changed

Lines changed: 275 additions & 83 deletions

File tree

spec/System/TestDefence_spec.lua

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,4 +840,188 @@ describe("TestDefence", function()
840840
assert.are.equals(0, floor(poolsRemaining.Life))
841841
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
842842
end)
843+
844+
it("MoM + EB", function()
845+
build.configTab.input.enemyIsBoss = "None"
846+
-- enough mana and es, 0% and 100% bypass
847+
build.configTab.input.customMods = [[
848+
50% of damage is taken from mana before life
849+
energy shield protects mana instead of life
850+
+40 to maximum life
851+
+1960 to mana
852+
+2000 to energy shield
853+
You have no intelligence
854+
+60% to all resistances
855+
]]
856+
build.configTab:BuildModList()
857+
runCallback("OnFrame")
858+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
859+
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
860+
local poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
861+
assert.are.equals(2000, round(poolsRemaining.EnergyShield))
862+
assert.are.equals(1900, round(poolsRemaining.Mana))
863+
assert.are.equals(0, floor(poolsRemaining.Life))
864+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
865+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
866+
assert.are.equals(1900, round(poolsRemaining.EnergyShield))
867+
assert.are.equals(2000, round(poolsRemaining.Mana))
868+
assert.are.equals(0, floor(poolsRemaining.Life))
869+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
870+
871+
-- enough mana and es, 50% bypass
872+
build.configTab.input.customMods = [[
873+
50% of damage is taken from mana before life
874+
energy shield protects mana instead of life
875+
50% of non-chaos damage taken bypasses energy shield
876+
+40 to maximum life
877+
+1960 to mana
878+
+2000 to energy shield
879+
You have no intelligence
880+
+60% to all resistances
881+
]]
882+
build.configTab:BuildModList()
883+
runCallback("OnFrame")
884+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
885+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
886+
assert.are.equals(1950, round(poolsRemaining.EnergyShield))
887+
assert.are.equals(1950, round(poolsRemaining.Mana))
888+
assert.are.equals(0, floor(poolsRemaining.Life))
889+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
890+
891+
-- es bottleneck, 0% and 100% bypass
892+
build.configTab.input.customMods = [[
893+
50% of damage is taken from mana before life
894+
energy shield protects mana instead of life
895+
+40 to maximum life
896+
+1960 to mana
897+
+50 to energy shield
898+
You have no intelligence
899+
+60% to all resistances
900+
]]
901+
build.configTab:BuildModList()
902+
runCallback("OnFrame")
903+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
904+
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
905+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
906+
assert.are.equals(50, round(poolsRemaining.EnergyShield))
907+
assert.are.equals(1900, round(poolsRemaining.Mana))
908+
assert.are.equals(0, floor(poolsRemaining.Life))
909+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
910+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
911+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
912+
assert.are.equals(1950, round(poolsRemaining.Mana))
913+
assert.are.equals(0, floor(poolsRemaining.Life))
914+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
915+
916+
-- es bottleneck, 50% bypass
917+
build.configTab.input.customMods = [[
918+
50% of damage is taken from mana before life
919+
energy shield protects mana instead of life
920+
50% of non-chaos damage taken bypasses energy shield
921+
+40 to maximum life
922+
+1960 to mana
923+
+40 to energy shield
924+
You have no intelligence
925+
+60% to all resistances
926+
]]
927+
build.configTab:BuildModList()
928+
runCallback("OnFrame")
929+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
930+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
931+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
932+
assert.are.equals(1940, round(poolsRemaining.Mana))
933+
assert.are.equals(0, floor(poolsRemaining.Life))
934+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
935+
936+
-- mana bottleneck, 0% and 100% bypass
937+
build.configTab.input.customMods = [[
938+
50% of damage is taken from mana before life
939+
energy shield protects mana instead of life
940+
+40 to maximum life
941+
+2000 to energy shield
942+
You have no intelligence
943+
+60% to all resistances
944+
]]
945+
build.configTab:BuildModList()
946+
runCallback("OnFrame")
947+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
948+
assert.are.equals(140, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
949+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
950+
assert.are.equals(2000, round(poolsRemaining.EnergyShield))
951+
assert.are.equals(0, round(poolsRemaining.Mana))
952+
assert.are.equals(0, floor(poolsRemaining.Life))
953+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
954+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
955+
assert.are.equals(1900, round(poolsRemaining.EnergyShield))
956+
assert.are.equals(40, round(poolsRemaining.Mana))
957+
assert.are.equals(0, floor(poolsRemaining.Life))
958+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
959+
960+
-- mana bottleneck, 50% bypass
961+
-- taking 160 damage in this scenario:
962+
-- 160 damage is split to 80 damage straight to life, 80 damage to MoM pools
963+
-- 50% of the 80 MoM pool damage is taken by ES and 50% bypasses
964+
-- 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
965+
build.configTab.input.customMods = [[
966+
50% of damage is taken from mana before life
967+
energy shield protects mana instead of life
968+
50% of non-chaos damage taken bypasses energy shield
969+
+40 to maximum life
970+
-20 to mana
971+
+2000 to energy shield
972+
You have no intelligence
973+
+60% to all resistances
974+
]]
975+
build.configTab:BuildModList()
976+
runCallback("OnFrame")
977+
assert.are.equals(160, build.calcsTab.calcsOutput.FireMaximumHitTaken)
978+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
979+
assert.are.equals(1960, round(poolsRemaining.EnergyShield))
980+
assert.are.equals(0, round(poolsRemaining.Mana))
981+
assert.are.equals(0, floor(poolsRemaining.Life))
982+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
983+
984+
-- mana+es bottleneck, 0% and 100% bypass
985+
build.configTab.input.customMods = [[
986+
50% of damage is taken from mana before life
987+
energy shield protects mana instead of life
988+
+940 to maximum life
989+
+50 to energy shield
990+
You have no intelligence
991+
+60% to all resistances
992+
]]
993+
build.configTab:BuildModList()
994+
runCallback("OnFrame")
995+
assert.are.equals(1090, build.calcsTab.calcsOutput.FireMaximumHitTaken)
996+
assert.are.equals(1040, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
997+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
998+
assert.are.equals(50, round(poolsRemaining.EnergyShield))
999+
assert.are.equals(0, round(poolsRemaining.Mana))
1000+
assert.are.equals(0, floor(poolsRemaining.Life))
1001+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
1002+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
1003+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
1004+
assert.are.equals(0, round(poolsRemaining.Mana))
1005+
assert.are.equals(0, floor(poolsRemaining.Life))
1006+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
1007+
1008+
-- mana+es bottleneck, 50% bypass
1009+
build.configTab.input.customMods = [[
1010+
50% of damage is taken from mana before life
1011+
energy shield protects mana instead of life
1012+
50% of non-chaos damage taken bypasses energy shield
1013+
+940 to maximum life
1014+
+50 to energy shield
1015+
You have no intelligence
1016+
+60% to all resistances
1017+
]]
1018+
build.configTab:BuildModList()
1019+
runCallback("OnFrame")
1020+
assert.are.equals(1090, build.calcsTab.calcsOutput.FireMaximumHitTaken)
1021+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
1022+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
1023+
assert.are.equals(0, round(poolsRemaining.Mana))
1024+
assert.are.equals(0, floor(poolsRemaining.Life))
1025+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
1026+
end)
8431027
end)

0 commit comments

Comments
 (0)