From 3334fc05e7c85437e9e4a067a14a76188c74af54 Mon Sep 17 00:00:00 2001 From: Steffen Mecke Date: Sun, 21 Mar 2021 17:50:06 +0100 Subject: [PATCH] e3 test irrelevant --- scripts/tests/e2/spells.lua | 38 +++++++++++++++++++++++++++++++++++++ scripts/tests/spells.lua | 37 ------------------------------------ 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/scripts/tests/e2/spells.lua b/scripts/tests/e2/spells.lua index 43c586c11..6f43acaca 100644 --- a/scripts/tests/e2/spells.lua +++ b/scripts/tests/e2/spells.lua @@ -334,3 +334,41 @@ function test_astral_disruption_default_level() assert_nil(r5:get_curse("astralblock")) assert_equal(r, uh.region) end + +function test_dream_magician_dies() + local u1, u2, r, f, f2 + r = region.create(0, 0, 'plain') + f = faction.create('human', "dreamer@eressea.de", "de") + u1 = unit.create(f, r, 1) + u1:set_skill("melee", 1) + u2 = unit.create(f, r, 1) + u2.magic = 'illaun' + u2:set_skill('magic', 20) + u2.aura = 100 + u2:add_spell('gooddreams') + u2:add_order('ZAUBERE STUFE 10 "Schöne Träume"') + + f2 = faction.create('human') + u3 = unit.create(f2, r, 1000) + + assert_equal(1, u1:eff_skill("melee")) + + process_orders() + + u2:clear_orders() + -- how to kill a mage ... + u3:add_order("ATTACKIERE " .. itoa36(u2.id)) + u1:add_order("KÄMPFE NICHT") + u2:add_order("KÄMPFE AGGRESSIV") + + init_reports() + write_reports() + + assert_equal(2, u1:eff_skill("melee")) + process_orders() + -- u2 is dead + + -- in a perfect world, this would be a test that the curse has no effect. However, with rng == 0, the duration of the dream curse is only 1 week, so it would have faded anyway. But we should at least not crash. + assert_equal(0, u2.number) + assert_equal(1, u1:eff_skill("melee")) +end diff --git a/scripts/tests/spells.lua b/scripts/tests/spells.lua index 3dfe1d7c6..d72851017 100644 --- a/scripts/tests/spells.lua +++ b/scripts/tests/spells.lua @@ -138,40 +138,3 @@ function test_appeasement_break_guard() assert_equal(5, u2.status) assert_equal(false, u2.guard) end - -function test_dream_magician_dies() - local u1, u2, r, f, f2 - r = region.create(0, 0, 'plain') - f = faction.create('human', "dreamer@eressea.de", "de") - u1 = unit.create(f, r, 1) - u1:set_skill("melee", 1) - u2 = unit.create(f, r, 1) - u2.magic = 'illaun' - u2:set_skill('magic', 10) - u2.aura = 100 - u2:add_spell('gooddreams') - u2:add_order('ZAUBERE "Schöne Träume"') - - f2 = faction.create('human') - u3 = unit.create(f2, r, 1000) - - assert_equal(1, u1:eff_skill("melee")) - - rng.inject(1) - process_orders() - - u2:clear_orders() - -- how to kill a mage ... - u3:add_order("ATTACKIERE " .. itoa36(u2.id)) - u1:add_order("KÄMPFE NICHT") - u2:add_order("KÄMPFE AGGRESSIV") - - - assert_equal(2, u1:eff_skill("melee")) - process_orders() - -- u2 is dead - - -- in a perfect world, this would be a test that the curse has no effect. However, with rng == 0, the duration of the dream curse is only 1 week, so it would have faded anyway. But we should at least not crash. - assert_equal(0, u2.number) - assert_equal(1, u1:eff_skill("melee")) -end