From 604b574d0f25e600ea8b25ac520e567adcfab55f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 27 Feb 2017 11:39:55 +0100 Subject: [PATCH] fix potion-use? need more testing --- res/core/common/potions.xml | 45 +++++++++++---------------------- res/e3a/items.xml | 24 ++++++------------ scripts/tests/e2/e2features.lua | 15 +++++++++++ src/kernel/item.c | 7 +++-- 4 files changed, 41 insertions(+), 50 deletions(-) diff --git a/res/core/common/potions.xml b/res/core/common/potions.xml index 12ac67aa2..4812727dd 100644 --- a/res/core/common/potions.xml +++ b/res/core/common/potions.xml @@ -4,8 +4,7 @@ - - + @@ -15,8 +14,7 @@ - - + @@ -26,8 +24,7 @@ - - + @@ -37,8 +34,7 @@ - - + @@ -48,8 +44,7 @@ - - + @@ -61,8 +56,7 @@ - - + @@ -74,8 +68,7 @@ - - + @@ -87,8 +80,7 @@ - - + @@ -100,8 +92,7 @@ - - + @@ -113,8 +104,7 @@ - - + @@ -126,8 +116,7 @@ - - + @@ -139,8 +128,7 @@ - - + @@ -152,8 +140,7 @@ - - + @@ -166,8 +153,7 @@ - - + @@ -181,8 +167,7 @@ - - + diff --git a/res/e3a/items.xml b/res/e3a/items.xml index fa3af4b41..9e928837e 100644 --- a/res/e3a/items.xml +++ b/res/e3a/items.xml @@ -7,64 +7,56 @@ - - + - - + - - + - - + - - + - - + - - + - - + diff --git a/scripts/tests/e2/e2features.lua b/scripts/tests/e2/e2features.lua index eb2d06f0d..c88dfdf22 100644 --- a/scripts/tests/e2/e2features.lua +++ b/scripts/tests/e2/e2features.lua @@ -230,6 +230,21 @@ function test_no_uruk() assert_equal(f1.race, "orc") end +function test_ointment() + local r = region.create(0, 0, "plain") + local f = faction.create("noreply@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + local hp = u.hp + u.hp = 0 + u:add_item("ointment", 1) + u:clear_orders() + u:add_order("BENUTZEN 1 Wundsalbe") + process_orders() + assert_equal(0, u:get_item("ointment")) + assert_equal(1, f:count_msg_type('usepotion')) + assert_equal(hp, u.hp) +end + function test_bloodpotion_demon() local r = region.create(0, 0, "plain") local f = faction.create("noreply@eressea.de", "demon", "de") diff --git a/src/kernel/item.c b/src/kernel/item.c index 5991eca96..1fa006c73 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -1287,13 +1287,12 @@ void register_resources(void) register_function((pf_generic)res_changehp, "changehp"); register_function((pf_generic)res_changeaura, "changeaura"); - register_item_use(use_potion, "usepotion"); - register_item_use(use_potion_delayed, "usepotion_delayed"); + register_item_use(use_potion_delayed, "use_p2"); register_item_use(use_tacticcrystal, "use_tacticcrystal"); register_item_use(use_birthdayamulet, "use_birthdayamulet"); - register_item_use(use_warmthpotion, "usewarmthpotion"); + register_item_use(use_warmthpotion, "use_nestwarmth"); register_item_use(use_bloodpotion, "use_peasantblood"); - register_item_use(use_healingpotion, "usehealingpotion"); + register_item_use(use_healingpotion, "use_ointment"); register_item_use(use_foolpotion, "use_p7"); register_item_use(use_mistletoe, "usemistletoe"); register_item_use(use_magicboost, "usemagicboost");