backfill a test for smithies

This commit is contained in:
Enno Rehling 2017-03-18 10:33:52 +01:00
parent ae6d9f0e1a
commit bdf7411954
1 changed files with 19 additions and 0 deletions

View File

@ -32,6 +32,25 @@ function test_mine_bonus()
assert_equal(80, r:get_resource("iron"))
end
function test_smithy_bonus()
local r = region.create(0, 0, "mountain")
local u = unit.create(faction.create("human"), r)
u:set_skill("weaponsmithing", 5)
u:add_item("iron", 20)
u:add_order("MACHE SCHWERT")
process_orders()
assert_equal(1, u:get_item('sword'))
assert_equal(19, u:get_item('iron'))
u.building = building.create(r, "smithy")
u.building.size = 10
u:add_item("money", 300) -- maintenance
u:add_item("log", 1) -- maintenance
process_orders()
assert_equal(3, u:get_item('sword'))
assert_equal(18, u:get_item('iron'))
end
function test_no_guards()
local r = region.create(0, 0, "plain")
r:set_resource("tree", 100)