Merge pull request #589 from ennorehling/develop

Bug 2239: create snowman with full hitpoints
This commit is contained in:
Enno Rehling 2016-10-02 12:03:00 +02:00 committed by GitHub
commit 165bd6acaf
3 changed files with 4 additions and 6 deletions

View File

@ -25,11 +25,10 @@ function ponnuki.init()
local home = get_region(-67, -5) local home = get_region(-67, -5)
local f = get_faction(666) local f = get_faction(666)
if home and f then if home and f then
u = add_unit(f, home) u = unit.create(f, home, 1, "illusion")
u.id = atoi36("ponn") u.id = atoi36("ponn")
u.name = "Ponnuki" u.name = "Ponnuki"
u.info = "Go, Ponnuki, Go!" u.info = "Go, Ponnuki, Go!"
u.race = "illusion"
u:set_racename("Ritter von Go") u:set_racename("Ritter von Go")
else else
eressea.log.error("Ponnuki cannot find Magrathea") eressea.log.error("Ponnuki cannot find Magrathea")

View File

@ -62,9 +62,7 @@ end
function use_snowman(u, amount) function use_snowman(u, amount)
if amount>0 and u.region.terrain == "glacier" then if amount>0 and u.region.terrain == "glacier" then
local man = unit.create(u.faction, u.region) local man = unit.create(u.faction, u.region, amount, "snowman")
man.race = "snowman"
man.number = amount
return amount return amount
end end
return -4 return -4

View File

@ -215,7 +215,8 @@ function test_snowman()
process_orders() process_orders()
for u2 in r.units do for u2 in r.units do
if u2.id~=u.id then if u2.id~=u.id then
assert_equal(u2.race, "snowman") assert_equal("snowman", u2.race)
assert_equal(1000, u2.hp)
u = nil u = nil
break break
end end