2020-04-22 03:03:44 +02:00
|
|
|
local tcname = 'tests.e3.e2spells'
|
2020-05-03 16:52:40 +02:00
|
|
|
local lunit = require('lunit')
|
2020-04-22 03:03:44 +02:00
|
|
|
if _VERSION >= 'Lua 5.2' then
|
|
|
|
_ENV = module(tcname, 'seeall')
|
|
|
|
else
|
2020-05-03 16:52:40 +02:00
|
|
|
module(tcname, lunit.testcase, package.seeall)
|
2020-04-22 03:03:44 +02:00
|
|
|
end
|
2012-06-05 16:36:33 +02:00
|
|
|
|
|
|
|
local r, f, u
|
|
|
|
|
|
|
|
function setup()
|
2012-06-10 22:33:05 +02:00
|
|
|
eressea.free_game()
|
|
|
|
eressea.settings.set("magic.regeneration.enable", "0")
|
|
|
|
eressea.settings.set("magic.fumble.enable", "0")
|
2015-09-11 10:04:08 +02:00
|
|
|
eressea.settings.set("rules.food.flags", "4")
|
2012-06-05 16:36:33 +02:00
|
|
|
|
|
|
|
r = region.create(0, 0, "plain")
|
2017-03-17 22:31:59 +01:00
|
|
|
f = faction.create("elf", "spell_payment@eressea.de", "de")
|
2012-06-05 16:36:33 +02:00
|
|
|
u = unit.create(f, r, 1)
|
|
|
|
u.magic = "gray"
|
|
|
|
u:set_skill("magic", 12)
|
|
|
|
end
|
|
|
|
|
|
|
|
function test_create_magicherbbag()
|
|
|
|
u:add_spell('create_magicherbbag')
|
|
|
|
u:cast_spell('create_magicherbbag')
|
|
|
|
assert_equal(1, u:get_item("magicherbbag"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function test_create_runesword()
|
|
|
|
u:add_spell('create_runesword')
|
|
|
|
u:cast_spell('create_runesword')
|
|
|
|
assert_equal(1, u:get_item("runesword"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function test_create_firesword()
|
|
|
|
u:add_spell("create_firesword")
|
|
|
|
u:cast_spell('create_firesword', 1)
|
|
|
|
assert_equal(1, u:get_item("firesword"))
|
|
|
|
end
|
|
|
|
|