Skip to content

Commit 0ed5ddd

Browse files
committed
add unit tests for enemy damage lessened by chill effect
1 parent 0e2c166 commit 0ed5ddd

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

spec/System/TestDefence_spec.lua

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,60 @@ describe("TestDefence", function()
491491
assert.are.equals(175, build.calcsTab.calcsOutput.EnergyShield)
492492
end)
493493

494+
describe("enemy damage lessened by half of chill effect", function ()
495+
it("enemy damage lessened by half of chill effect if the corresponding conditions are fulfilled", function()
496+
build.configTab.input.enemyIsBoss = "None"
497+
build.configTab.input.conditionEnemyChilled = true
498+
-- default max chill effect
499+
build.configTab.input.conditionEnemyChilledEffect = 30
500+
build.configTab.input.customMods = "\z
501+
enemies chilled by your hits lessen their damage dealt by half of chill effect\n\z
502+
"
503+
build.configTab:BuildModList()
504+
runCallback("OnFrame")
505+
506+
-- 15% less since it's half of current chill effect
507+
assert.are.equals(0.85, build.calcsTab.calcsOutput.PhysicalEnemyDamageMult)
508+
assert.are.equals(0.85, build.calcsTab.calcsOutput.LightningEnemyDamageMult)
509+
assert.are.equals(0.85, build.calcsTab.calcsOutput.ColdEnemyDamageMult)
510+
assert.are.equals(0.85, build.calcsTab.calcsOutput.FireEnemyDamageMult)
511+
assert.are.equals(0.85, build.calcsTab.calcsOutput.ChaosEnemyDamageMult)
512+
end)
513+
514+
it("enemy damage is not lessened if the enemy is not chilled", function()
515+
build.configTab.input.enemyIsBoss = "None"
516+
build.configTab.input.customMods = "\z
517+
enemies chilled by your hits lessen their damage dealt by half of chill effect\n\z
518+
"
519+
build.configTab:BuildModList()
520+
runCallback("OnFrame")
521+
522+
assert.are.equals(1, build.calcsTab.calcsOutput.PhysicalEnemyDamageMult)
523+
assert.are.equals(1, build.calcsTab.calcsOutput.LightningEnemyDamageMult)
524+
assert.are.equals(1, build.calcsTab.calcsOutput.ColdEnemyDamageMult)
525+
assert.are.equals(1, build.calcsTab.calcsOutput.FireEnemyDamageMult)
526+
assert.are.equals(1, build.calcsTab.calcsOutput.ChaosEnemyDamageMult)
527+
end)
528+
529+
it("lessened enemy damage respects chill cap", function()
530+
build.configTab.input.enemyIsBoss = "None"
531+
build.configTab.input.conditionEnemyChilled = true
532+
-- default max chill effect is 30%, so this shouldn't affect the resulting enemy damage multiplier beyond the cap
533+
build.configTab.input.conditionEnemyChilledEffect = 100
534+
build.configTab.input.customMods = "\z
535+
enemies chilled by your hits lessen their damage dealt by half of chill effect\n\z
536+
"
537+
build.configTab:BuildModList()
538+
runCallback("OnFrame")
539+
540+
assert.are.equals(0.85, build.calcsTab.calcsOutput.PhysicalEnemyDamageMult)
541+
assert.are.equals(0.85, build.calcsTab.calcsOutput.LightningEnemyDamageMult)
542+
assert.are.equals(0.85, build.calcsTab.calcsOutput.ColdEnemyDamageMult)
543+
assert.are.equals(0.85, build.calcsTab.calcsOutput.FireEnemyDamageMult)
544+
assert.are.equals(0.85, build.calcsTab.calcsOutput.ChaosEnemyDamageMult)
545+
end)
546+
end)
547+
494548
local function withinTenPercent(value, otherValue)
495549
local ratio = otherValue / value
496550
return 0.9 < ratio and ratio < 1.1

0 commit comments

Comments
 (0)