From 5a129f8bd4b3a3741f3f8696f33e5d2f90aa4706 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 2 Oct 2016 11:42:31 +0200 Subject: [PATCH] Create the snowman with full hitpoints. https://bugs.eressea.de/view.php?id=2239 --- scripts/eressea/ponnuki.lua | 3 +-- scripts/eressea/xmasitems.lua | 4 +--- scripts/tests/e2/e2features.lua | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/eressea/ponnuki.lua b/scripts/eressea/ponnuki.lua index f220aa380..994a16ff0 100644 --- a/scripts/eressea/ponnuki.lua +++ b/scripts/eressea/ponnuki.lua @@ -25,11 +25,10 @@ function ponnuki.init() local home = get_region(-67, -5) local f = get_faction(666) if home and f then - u = add_unit(f, home) + u = unit.create(f, home, 1, "illusion") u.id = atoi36("ponn") u.name = "Ponnuki" u.info = "Go, Ponnuki, Go!" - u.race = "illusion" u:set_racename("Ritter von Go") else eressea.log.error("Ponnuki cannot find Magrathea") diff --git a/scripts/eressea/xmasitems.lua b/scripts/eressea/xmasitems.lua index b31691d72..a05e023b8 100644 --- a/scripts/eressea/xmasitems.lua +++ b/scripts/eressea/xmasitems.lua @@ -62,9 +62,7 @@ end function use_snowman(u, amount) if amount>0 and u.region.terrain == "glacier" then - local man = unit.create(u.faction, u.region) - man.race = "snowman" - man.number = amount + local man = unit.create(u.faction, u.region, amount, "snowman") return amount end return -4 diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index efed50ea1..c4a53da76 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -215,7 +215,8 @@ function test_snowman() process_orders() for u2 in r.units do if u2.id~=u.id then - assert_equal(u2.race, "snowman") + assert_equal("snowman", u2.race) + assert_equal(1000, u2.hp) u = nil break end