forked from github/server
repair snowmen (xmas 2004)
This commit is contained in:
parent
7b08767aa5
commit
2073e8f860
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue