diff --git a/res/core/resources/cart.xml b/res/core/resources/cart.xml index a72b222d3..af3860c9c 100644 --- a/res/core/resources/cart.xml +++ b/res/core/resources/cart.xml @@ -1,6 +1,6 @@ - - + + diff --git a/res/core/weapons/catapult.xml b/res/core/weapons/catapult.xml index 2ea16d9a2..08dc83457 100644 --- a/res/core/weapons/catapult.xml +++ b/res/core/weapons/catapult.xml @@ -1,6 +1,6 @@ - + diff --git a/scripts/tests/e2/init.lua b/scripts/tests/e2/init.lua index 322e87195..2f69f6a71 100644 --- a/scripts/tests/e2/init.lua +++ b/scripts/tests/e2/init.lua @@ -6,3 +6,4 @@ require 'tests.e2.stealth' require 'tests.orders' require 'tests.common' require 'tests.storage' +require 'tests.magicbag' diff --git a/scripts/tests/e3/init.lua b/scripts/tests/e3/init.lua index 63c26cacf..2a31be599 100644 --- a/scripts/tests/e3/init.lua +++ b/scripts/tests/e3/init.lua @@ -6,3 +6,4 @@ require 'tests.e3.parser' require 'tests.e3.morale' require 'tests.orders' require 'tests.common' +require 'tests.magicbag' diff --git a/scripts/tests/magicbag.lua b/scripts/tests/magicbag.lua new file mode 100644 index 000000000..4ca5e6ae5 --- /dev/null +++ b/scripts/tests/magicbag.lua @@ -0,0 +1,58 @@ +require "lunit" + +module("tests.magicbag", package.seeall, lunit.testcase) + +local u + +function setup() + eressea.free_game() + u = unit.create(faction.create("test@example.com", "human", "de"), region.create(0, 0, "plain"), 1) +end + +function test_magicbag_weight() + assert_equal(1000, u.weight) + u:add_item("log", 10) + assert_equal(6000, u.weight) + u:add_item("magicbag", 1) + assert_equal(1100, u.weight) +end + +function test_magicbag_no_stone() + assert_equal(1000, u.weight) + u:add_item("stone", 1) + assert_equal(7000, u.weight) + u:add_item("magicbag", 1) + assert_equal(7100, u.weight) +end + +function test_magicbag_limit_200ge() + assert_equal(1000, u.weight) + u:add_item("log", 100) + assert_equal(51000, u.weight) + u:add_item("magicbag", 1) + assert_equal(31100, u.weight) +end + +function test_magicbag_no_carts() + assert_equal(1000, u.weight) + u:add_item("cart", 1) + assert_equal(5000, u.weight) + u:add_item("magicbag", 1) + assert_equal(5100, u.weight) +end + +function test_magicbag_no_catapult() + assert_equal(1000, u.weight) + u:add_item("catapult", 1) + assert_equal(11000, u.weight) + u:add_item("magicbag", 1) + assert_equal(11100, u.weight) +end + +function test_magicbag_no_horses() + assert_equal(1000, u.weight) + u:add_item("horse", 1) + assert_equal(6000, u.weight) + u:add_item("magicbag", 1) + assert_equal(6100, u.weight) +end