diff --git a/res/core/common/items.xml b/res/core/common/items.xml
index 63a07d88f..0e1505205 100644
--- a/res/core/common/items.xml
+++ b/res/core/common/items.xml
@@ -61,14 +61,8 @@
-
-
-
-
- -
-
-
+
@@ -105,16 +99,12 @@
- -
-
-
+
- -
-
-
+
diff --git a/res/core/de/strings.xml b/res/core/de/strings.xml
index 26e8cc862..46d5605b1 100644
--- a/res/core/de/strings.xml
+++ b/res/core/de/strings.xml
@@ -1458,12 +1458,6 @@
Amulette des wahren Sehens
-
- Katzenamulett
-
-
- Katzenamulette
-
Ring der Unsichtbarkeit
diff --git a/res/core/en/strings.xml b/res/core/en/strings.xml
index 063194c5d..14b2b817d 100644
--- a/res/core/en/strings.xml
+++ b/res/core/en/strings.xml
@@ -444,12 +444,6 @@
amulets of chastity
-
- amulet of the kitten
-
-
- amulets of the kitten
-
amulet of darkness
diff --git a/res/core/fr/strings.xml b/res/core/fr/strings.xml
index c69bb5b75..13e6beb25 100644
--- a/res/core/fr/strings.xml
+++ b/res/core/fr/strings.xml
@@ -458,12 +458,6 @@
amulettes de chasteté
-
- amulette du chaton
-
-
- amulettes du chaton
-
amulette de ténčbres
diff --git a/res/eressea/items.xml b/res/eressea/items.xml
index 007f0277c..a785691fe 100644
--- a/res/eressea/items.xml
+++ b/res/eressea/items.xml
@@ -86,6 +86,10 @@
+
+
+
+
diff --git a/res/eressea/strings.xml b/res/eressea/strings.xml
index 4869014c5..8afeabbca 100644
--- a/res/eressea/strings.xml
+++ b/res/eressea/strings.xml
@@ -392,5 +392,14 @@
Adamantiumrüstungen
adamantium plates
-
+
+ Katzenamulett
+ amulet of the kitten
+ amulette du chaton
+
+
+ amulets of the kitten
+ Katzenamulette
+ amulettes du chaton
+
diff --git a/scripts/tests/e2/init.lua b/scripts/tests/e2/init.lua
index 4d916d1a9..5f81933d7 100644
--- a/scripts/tests/e2/init.lua
+++ b/scripts/tests/e2/init.lua
@@ -8,6 +8,7 @@ require 'tests.e2.destroy'
require 'tests.e2.guard'
require 'tests.e2.spells'
require 'tests.e2.stealth'
+require 'tests.e2.items'
require 'tests.items'
require 'tests.orders'
require 'tests.common'
diff --git a/scripts/tests/e2/items.lua b/scripts/tests/e2/items.lua
new file mode 100644
index 000000000..da72bdbbc
--- /dev/null
+++ b/scripts/tests/e2/items.lua
@@ -0,0 +1,109 @@
+require "lunit"
+
+module("tests.items", package.seeall, lunit.testcase )
+
+function setup()
+ eressea.free_game()
+ eressea.settings.set("nmr.timeout", "0")
+ eressea.settings.set("rules.food.flags", "4")
+ eressea.settings.set("rules.ship.storms", "0")
+ eressea.settings.set("rules.encounters", "0")
+ eressea.settings.set("magic.regeneration.enable", "0")
+end
+
+function test_meow()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("aoc", 1)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Katzenamulett")
+ process_orders()
+ assert_equal(1, u:get_item("aoc"))
+ assert_equal(1, r:count_msg_type('meow'))
+end
+
+function test_aurapotion50()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("aurapotion50", 1)
+ u:set_skill('magic', 10);
+ u.magic = 'gwyrrd'
+ u.aura = 0
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Auratrank")
+ process_orders()
+ assert_equal(0, u:get_item("aurapotion50"))
+ assert_equal(1, f:count_msg_type('aurapotion50'))
+ assert_equal(50, u.aura)
+end
+
+function test_bagpipe()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("bagpipeoffear", 1)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Dudelsack")
+ process_orders()
+ assert_equal(1, u:get_item("bagpipeoffear"))
+ assert_equal(1, f:count_msg_type('bagpipeoffear_faction'))
+ assert_equal(1, r:count_msg_type('bagpipeoffear_region'))
+end
+
+function test_speedsail()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u.ship = ship.create(r, "boat")
+ u:add_item("speedsail", 2)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Sonnensegel")
+ process_orders()
+ assert_equal(1, u:get_item("speedsail"))
+ assert_equal(1, f:count_msg_type('use_speedsail'))
+end
+
+function test_foolpotion()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("p7", 1)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Dumpfbackenbrot 4242")
+ process_orders()
+ assert_equal(1, u:get_item("p7"))
+ assert_equal(1, f:count_msg_type('feedback_unit_not_found'))
+ local u2 = unit.create(f, r, 1)
+
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Dumpfbackenbrot " .. itoa36(u2.id))
+ process_orders()
+ assert_equal(1, u:get_item("p7"))
+ assert_equal(1, f:count_msg_type('error64'))
+
+ u:set_skill("stealth", 1);
+ process_orders()
+ assert_equal(0, u:get_item("p7"))
+ assert_equal(1, f:count_msg_type('givedumb'))
+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.id~=u.id then
+ assert_equal("snowman", u2.race)
+ assert_equal(1000, u2.hp)
+ u = nil
+ break
+ end
+ end
+ assert_equal(nil, u)
+end
diff --git a/scripts/tests/e3/init.lua b/scripts/tests/e3/init.lua
index 4655fdcef..95df86c4c 100644
--- a/scripts/tests/e3/init.lua
+++ b/scripts/tests/e3/init.lua
@@ -6,6 +6,7 @@ require 'tests.e3.parser'
require 'tests.e3.morale'
require 'tests.orders'
require 'tests.common'
+require 'tests.items'
-- require 'tests.report'
require 'tests.magicbag'
require 'tests.process'
diff --git a/scripts/tests/items.lua b/scripts/tests/items.lua
index 15d638a63..ff292b4cb 100644
--- a/scripts/tests/items.lua
+++ b/scripts/tests/items.lua
@@ -8,61 +8,35 @@ function setup()
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.storms", "0")
eressea.settings.set("rules.encounters", "0")
-end
-
-function test_meow()
- local r = region.create(0, 0, "plain")
- local f = faction.create("noreply@eressea.de", "human", "de")
- local u = unit.create(f, r, 1)
- u:add_item("aoc", 1)
- u:clear_orders()
- u:add_order("BENUTZEN 1 Katzenamulett")
- process_orders()
- assert_equal(1, u:get_item("aoc"))
- assert_equal(1, r:count_msg_type('meow'))
-end
-
-function test_aurapotion50()
eressea.settings.set("magic.regeneration.enable", "0")
+end
+
+function test_dreameye()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
- u:add_item("aurapotion50", 1)
- u:set_skill('magic', 10);
- u.magic = 'gwyrrd'
+ u:add_item("dreameye", 2)
+ u:clear_orders()
+ u:add_order("BENUTZEN 1 Traumauge")
+ process_orders()
+ assert_equal(1, u:get_item("dreameye"))
+ assert_equal(1, f:count_msg_type('use_tacticcrystal'))
+end
+
+function test_manacrystal()
+ local r = region.create(0, 0, "plain")
+ local f = faction.create("noreply@eressea.de", "human", "de")
+ local u = unit.create(f, r, 1)
+ u:add_item("manacrystal", 2)
+ u:clear_orders()
+ u.magic = "gwyrrd"
+ u:set_skill('magic', 1)
u.aura = 0
- u:clear_orders()
- u:add_order("BENUTZEN 1 Auratrank")
+ u:add_order("BENUTZEN 1 Astralkristall")
process_orders()
- assert_equal(0, u:get_item("aurapotion50"))
- assert_equal(1, f:count_msg_type('aurapotion50'))
- assert_equal(50, u.aura)
-end
-
-function test_bagpipe()
- local r = region.create(0, 0, "plain")
- local f = faction.create("noreply@eressea.de", "human", "de")
- local u = unit.create(f, r, 1)
- u:add_item("bagpipeoffear", 1)
- u:clear_orders()
- u:add_order("BENUTZEN 1 Dudelsack")
- process_orders()
- assert_equal(1, u:get_item("bagpipeoffear"))
- assert_equal(1, f:count_msg_type('bagpipeoffear_faction'))
- assert_equal(1, r:count_msg_type('bagpipeoffear_region'))
-end
-
-function test_speedsail()
- local r = region.create(0, 0, "plain")
- local f = faction.create("noreply@eressea.de", "human", "de")
- local u = unit.create(f, r, 1)
- u.ship = ship.create(r, "boat")
- u:add_item("speedsail", 2)
- u:clear_orders()
- u:add_order("BENUTZEN 1 Sonnensegel")
- process_orders()
- assert_equal(1, u:get_item("speedsail"))
- assert_equal(1, f:count_msg_type('use_speedsail'))
+ assert_equal(1, u:get_item("manacrystal"))
+ assert_equal(25, u.aura)
+ assert_equal(1, f:count_msg_type('manacrystal_use'))
end
function test_skillpotion()
@@ -141,46 +115,3 @@ function test_bloodpotion_other()
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal("smurf", u.race)
end
-
-function test_foolpotion()
- local r = region.create(0, 0, "plain")
- local f = faction.create("noreply@eressea.de", "human", "de")
- local u = unit.create(f, r, 1)
- u:add_item("p7", 1)
- u:clear_orders()
- u:add_order("BENUTZEN 1 Dumpfbackenbrot 4242")
- process_orders()
- assert_equal(1, u:get_item("p7"))
- assert_equal(1, f:count_msg_type('feedback_unit_not_found'))
- local u2 = unit.create(f, r, 1)
-
- u:clear_orders()
- u:add_order("BENUTZEN 1 Dumpfbackenbrot " .. itoa36(u2.id))
- process_orders()
- assert_equal(1, u:get_item("p7"))
- assert_equal(1, f:count_msg_type('error64'))
-
- u:set_skill("stealth", 1);
- process_orders()
- assert_equal(0, u:get_item("p7"))
- assert_equal(1, f:count_msg_type('givedumb'))
-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.id~=u.id then
- assert_equal("snowman", u2.race)
- assert_equal(1000, u2.hp)
- u = nil
- break
- end
- end
- assert_equal(nil, u)
-end
diff --git a/src/items.c b/src/items.c
index 197240d3e..ccba7ae7f 100644
--- a/src/items.c
+++ b/src/items.c
@@ -21,8 +21,6 @@
#include
#include
-#include
-
/* triggers includes */
#include
#include
@@ -340,11 +338,38 @@ struct order *ord)
return 0;
}
+/* ------------------------------------------------------------- */
+/* Kann auch von Nichtmagier benutzt werden, modifiziert Taktik fuer diese
+* Runde um -1 - 4 Punkte. */
+static int
+use_tacticcrystal(unit * u, const struct item_type *itype, int amount,
+ struct order *ord)
+{
+ int i;
+ for (i = 0; i != amount; ++i) {
+ int duration = 1; /* wirkt nur eine Runde */
+ curse *c;
+ float effect;
+ float power = 5; /* Widerstand gegen Antimagiesprueche, ist in diesem
+ Fall egal, da der curse fuer den Kampf gelten soll,
+ der vor den Antimagiezaubern passiert */
+
+ effect = (float)(rng_int() % 6 - 1);
+ c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
+ duration, effect, u->number);
+ c->data.i = SK_TACTICS;
+ UNUSED_ARG(ord);
+ }
+ use_pooled(u, itype->rtype, GET_DEFAULT, amount);
+ ADDMSG(&u->faction->msgs, msg_message("use_tacticcrystal",
+ "unit region", u, u->region));
+ return 0;
+}
+
void register_itemfunctions(void)
{
- register_demonseye();
-
/* have tests: */
+ register_item_use(use_tacticcrystal, "use_dreameye");
register_item_use(use_studypotion, "use_studypotion");
register_item_use(use_antimagiccrystal, "use_antimagic");
register_item_use(use_speedsail, "use_speedsail");
diff --git a/src/items/CMakeLists.txt b/src/items/CMakeLists.txt
index bbf192a66..37777f9e4 100644
--- a/src/items/CMakeLists.txt
+++ b/src/items/CMakeLists.txt
@@ -5,7 +5,6 @@ xerewards.test.c
)
SET(_FILES
-demonseye.c
speedsail.c
weapons.c
xerewards.c
diff --git a/src/items/demonseye.c b/src/items/demonseye.c
deleted file mode 100644
index 563a16047..000000000
--- a/src/items/demonseye.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Copyright (c) 1998-2015, Enno Rehling
-Katja Zedel
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-**/
-
-#include
-#include "demonseye.h"
-
-/* kernel includes */
-#include
-#include
-#include
-#include
-#include
-#include
-
-/* util includes */
-#include
-
-/* libc includes */
-#include
-
-static int
-summon_igjarjuk(struct unit *u, const struct item_type *itype, int amount,
-struct order *ord)
-{
- struct plane *p = rplane(u->region);
- UNUSED_ARG(amount);
- UNUSED_ARG(itype);
- if (p != NULL) {
- ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", ""));
- return EUNUSABLE;
- }
- else {
- assert(!"not implemented");
- return EUNUSABLE;
- }
-}
-
-static int
-give_igjarjuk(struct unit *src, struct unit *d, const struct item_type *itype,
-int n, struct order *ord)
-{
- ADDMSG(&src->faction->msgs, msg_feedback(src, ord, "error_giveeye", ""));
- return 0;
-}
-
-void register_demonseye(void)
-{
- register_item_use(summon_igjarjuk, "useigjarjuk");
- register_item_give(give_igjarjuk, "giveigjarjuk");
-}
diff --git a/src/items/demonseye.h b/src/items/demonseye.h
deleted file mode 100644
index 8d878a174..000000000
--- a/src/items/demonseye.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright (c) 1998-2015, Enno Rehling
-Katja Zedel
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-**/
-
-#ifndef H_ITM_DEMONSEYE
-#define H_ITM_DEMONSEYE
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- void register_demonseye(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/kernel/item.c b/src/kernel/item.c
index ecad829ca..adfddf6f4 100644
--- a/src/kernel/item.c
+++ b/src/kernel/item.c
@@ -677,34 +677,6 @@ int set_item(unit * u, const item_type *itype, int value)
#define FL_ITEM_ANIMAL (1<<3) /* ist ein Tier */
#define FL_ITEM_MOUNT ((1<<4) | FL_ITEM_ANIMAL) /* ist ein Reittier */
-/* ------------------------------------------------------------- */
-/* Kann auch von Nichtmagier benutzt werden, modifiziert Taktik fuer diese
- * Runde um -1 - 4 Punkte. */
-static int
-use_tacticcrystal(unit * u, const struct item_type *itype, int amount,
-struct order *ord)
-{
- int i;
- for (i = 0; i != amount; ++i) {
- int duration = 1; /* wirkt nur eine Runde */
- curse *c;
- float effect;
- float power = 5; /* Widerstand gegen Antimagiesprueche, ist in diesem
- Fall egal, da der curse fuer den Kampf gelten soll,
- der vor den Antimagiezaubern passiert */
-
- effect = (float)(rng_int() % 6 - 1);
- c = create_curse(u, &u->attribs, ct_find("skillmod"), power,
- duration, effect, u->number);
- c->data.i = SK_TACTICS;
- UNUSED_ARG(ord);
- }
- use_pooled(u, itype->rtype, GET_DEFAULT, amount);
- ADDMSG(&u->faction->msgs, msg_message("use_tacticcrystal",
- "unit region", u, u->region));
- return 0;
-}
-
typedef struct t_item {
const char *name;
/* [0]: Einzahl fuer eigene; [1]: Mehrzahl fuer eigene;
@@ -1165,7 +1137,6 @@ void register_resources(void)
register_item_use(use_potion_delayed, "use_p2");
register_item_use(use_warmthpotion, "use_nestwarmth");
- register_item_use(use_tacticcrystal, "use_tacticcrystal");
register_item_use(use_mistletoe, "usemistletoe");
register_item_use(use_magicboost, "usemagicboost");
register_item_use(use_snowball, "usesnowball");
diff --git a/src/modules/gmcmd.c b/src/modules/gmcmd.c
index 9a4e7ac47..c911e3de4 100644
--- a/src/modules/gmcmd.c
+++ b/src/modules/gmcmd.c
@@ -16,7 +16,6 @@
#include
/* misc includes */
-#include
#include
#include