Skip to content

Commit 7e90a23

Browse files
committed
Improve MoM+EB(+ES bypass) calculations
1 parent 6a146e6 commit 7e90a23

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
@@ -807,4 +807,188 @@ describe("TestDefence", function()
807807
assert.are.equals(0, floor(poolsRemaining.Life))
808808
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
809809
end)
810+
811+
it("MoM + EB", function()
812+
build.configTab.input.enemyIsBoss = "None"
813+
-- enough mana and es, 0% and 100% bypass
814+
build.configTab.input.customMods = [[
815+
50% of damage is taken from mana before life
816+
energy shield protects mana instead of life
817+
+40 to maximum life
818+
+1960 to mana
819+
+2000 to energy shield
820+
You have no intelligence
821+
+60% to all resistances
822+
]]
823+
build.configTab:BuildModList()
824+
runCallback("OnFrame")
825+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
826+
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
827+
local poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
828+
assert.are.equals(2000, round(poolsRemaining.EnergyShield))
829+
assert.are.equals(1900, round(poolsRemaining.Mana))
830+
assert.are.equals(0, floor(poolsRemaining.Life))
831+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
832+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
833+
assert.are.equals(1900, round(poolsRemaining.EnergyShield))
834+
assert.are.equals(2000, round(poolsRemaining.Mana))
835+
assert.are.equals(0, floor(poolsRemaining.Life))
836+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
837+
838+
-- enough mana and es, 50% bypass
839+
build.configTab.input.customMods = [[
840+
50% of damage is taken from mana before life
841+
energy shield protects mana instead of life
842+
50% of non-chaos damage taken bypasses energy shield
843+
+40 to maximum life
844+
+1960 to mana
845+
+2000 to energy shield
846+
You have no intelligence
847+
+60% to all resistances
848+
]]
849+
build.configTab:BuildModList()
850+
runCallback("OnFrame")
851+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
852+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
853+
assert.are.equals(1950, round(poolsRemaining.EnergyShield))
854+
assert.are.equals(1950, round(poolsRemaining.Mana))
855+
assert.are.equals(0, floor(poolsRemaining.Life))
856+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
857+
858+
-- es bottleneck, 0% and 100% bypass
859+
build.configTab.input.customMods = [[
860+
50% of damage is taken from mana before life
861+
energy shield protects mana instead of life
862+
+40 to maximum life
863+
+1960 to mana
864+
+50 to energy shield
865+
You have no intelligence
866+
+60% to all resistances
867+
]]
868+
build.configTab:BuildModList()
869+
runCallback("OnFrame")
870+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
871+
assert.are.equals(200, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
872+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
873+
assert.are.equals(50, round(poolsRemaining.EnergyShield))
874+
assert.are.equals(1900, round(poolsRemaining.Mana))
875+
assert.are.equals(0, floor(poolsRemaining.Life))
876+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
877+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
878+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
879+
assert.are.equals(1950, round(poolsRemaining.Mana))
880+
assert.are.equals(0, floor(poolsRemaining.Life))
881+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
882+
883+
-- es bottleneck, 50% bypass
884+
build.configTab.input.customMods = [[
885+
50% of damage is taken from mana before life
886+
energy shield protects mana instead of life
887+
50% of non-chaos damage taken bypasses energy shield
888+
+40 to maximum life
889+
+1960 to mana
890+
+40 to energy shield
891+
You have no intelligence
892+
+60% to all resistances
893+
]]
894+
build.configTab:BuildModList()
895+
runCallback("OnFrame")
896+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
897+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
898+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
899+
assert.are.equals(1940, round(poolsRemaining.Mana))
900+
assert.are.equals(0, floor(poolsRemaining.Life))
901+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
902+
903+
-- mana bottleneck, 0% and 100% bypass
904+
build.configTab.input.customMods = [[
905+
50% of damage is taken from mana before life
906+
energy shield protects mana instead of life
907+
+40 to maximum life
908+
+2000 to energy shield
909+
You have no intelligence
910+
+60% to all resistances
911+
]]
912+
build.configTab:BuildModList()
913+
runCallback("OnFrame")
914+
assert.are.equals(200, build.calcsTab.calcsOutput.FireMaximumHitTaken)
915+
assert.are.equals(140, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
916+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
917+
assert.are.equals(2000, round(poolsRemaining.EnergyShield))
918+
assert.are.equals(0, round(poolsRemaining.Mana))
919+
assert.are.equals(0, floor(poolsRemaining.Life))
920+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
921+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
922+
assert.are.equals(1900, round(poolsRemaining.EnergyShield))
923+
assert.are.equals(40, round(poolsRemaining.Mana))
924+
assert.are.equals(0, floor(poolsRemaining.Life))
925+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
926+
927+
-- mana bottleneck, 50% bypass
928+
-- taking 160 damage in this scenario:
929+
-- 160 damage is split to 80 damage straight to life, 80 damage to MoM pools
930+
-- 50% of the 80 MoM pool damage is taken by ES and 50% bypasses
931+
-- 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
932+
build.configTab.input.customMods = [[
933+
50% of damage is taken from mana before life
934+
energy shield protects mana instead of life
935+
50% of non-chaos damage taken bypasses energy shield
936+
+40 to maximum life
937+
-20 to mana
938+
+2000 to energy shield
939+
You have no intelligence
940+
+60% to all resistances
941+
]]
942+
build.configTab:BuildModList()
943+
runCallback("OnFrame")
944+
assert.are.equals(160, build.calcsTab.calcsOutput.FireMaximumHitTaken)
945+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
946+
assert.are.equals(1960, round(poolsRemaining.EnergyShield))
947+
assert.are.equals(0, round(poolsRemaining.Mana))
948+
assert.are.equals(0, floor(poolsRemaining.Life))
949+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
950+
951+
-- mana+es bottleneck, 0% and 100% bypass
952+
build.configTab.input.customMods = [[
953+
50% of damage is taken from mana before life
954+
energy shield protects mana instead of life
955+
+940 to maximum life
956+
+50 to energy shield
957+
You have no intelligence
958+
+60% to all resistances
959+
]]
960+
build.configTab:BuildModList()
961+
runCallback("OnFrame")
962+
assert.are.equals(1090, build.calcsTab.calcsOutput.FireMaximumHitTaken)
963+
assert.are.equals(1040, build.calcsTab.calcsOutput.ChaosMaximumHitTaken)
964+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Chaos")
965+
assert.are.equals(50, round(poolsRemaining.EnergyShield))
966+
assert.are.equals(0, round(poolsRemaining.Mana))
967+
assert.are.equals(0, floor(poolsRemaining.Life))
968+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
969+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
970+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
971+
assert.are.equals(0, round(poolsRemaining.Mana))
972+
assert.are.equals(0, floor(poolsRemaining.Life))
973+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
974+
975+
-- mana+es bottleneck, 50% bypass
976+
build.configTab.input.customMods = [[
977+
50% of damage is taken from mana before life
978+
energy shield protects mana instead of life
979+
50% of non-chaos damage taken bypasses energy shield
980+
+940 to maximum life
981+
+50 to energy shield
982+
You have no intelligence
983+
+60% to all resistances
984+
]]
985+
build.configTab:BuildModList()
986+
runCallback("OnFrame")
987+
assert.are.equals(1090, build.calcsTab.calcsOutput.FireMaximumHitTaken)
988+
poolsRemaining = poolsRemainingAfterTypeMaxHit("Fire")
989+
assert.are.equals(0, round(poolsRemaining.EnergyShield))
990+
assert.are.equals(0, round(poolsRemaining.Mana))
991+
assert.are.equals(0, floor(poolsRemaining.Life))
992+
assert.are.equals(0, floor(poolsRemaining.OverkillDamage))
993+
end)
810994
end)

0 commit comments

Comments
 (0)