repair snowmen (xmas 2004)
This commit is contained in:
Enno Rehling 2010-11-20 18:01:46 -08:00
parent 7b08767aa5
commit 2073e8f860
2 changed files with 19 additions and 1 deletions

View File

@ -1,6 +1,6 @@
function use_snowman(u, amount) function use_snowman(u, amount)
if u.region.terrain == "glacier" then if u.region.terrain == "glacier" then
local man = add_unit(u.faction, u.region) local man = unit.create(u.faction, u.region)
man.race = "snowman" man.race = "snowman"
man.number = amount man.number = amount
u:add_item("snowman", -amount) u:add_item("snowman", -amount)

View File

@ -182,3 +182,21 @@ function test_no_uruk()
local f1 = faction.create("noreply@eressea.de", "uruk", "de") local f1 = faction.create("noreply@eressea.de", "uruk", "de")
assert_equal(f1.race, "orc") assert_equal(f1.race, "orc")
end end
function test_snowman()
local r = region.create(0, 0, "glacier")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
u:add_item("snowman", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Schneemann")
process_orders()
for u2 in r.units do
if u2~=u then
assert_equal(u2.race, "snowman")
u = nil
break
end
end
assert_equal(nil, u)
end