Merge pull request #239 from badgerman/feature/bug-1949-magicbag

bug 1949: magicbag contents
This commit is contained in:
Enno Rehling 2015-07-01 22:34:00 +02:00
commit b9f41526ef
5 changed files with 63 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<resource name="cart" big="true"> <resource name="cart">
<item capacity="14000" weight="4000" score="60" vehicle="yes"> <item capacity="14000" weight="4000" score="60" vehicle="yes" big="yes">
<construction skill="cartmaking" minskill="1" reqsize="1"> <construction skill="cartmaking" minskill="1" reqsize="1">
<requirement type="log" quantity="5"/> <requirement type="log" quantity="5"/>
</construction> </construction>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<resource name="catapult"> <resource name="catapult">
<item weight="10000"> <item weight="10000" big="yes">
<construction skill="cartmaking" minskill="5" reqsize="1"> <construction skill="cartmaking" minskill="5" reqsize="1">
<requirement type="log" quantity="10"/> <requirement type="log" quantity="10"/>
</construction> </construction>

View File

@ -6,3 +6,4 @@ require 'tests.e2.stealth'
require 'tests.orders' require 'tests.orders'
require 'tests.common' require 'tests.common'
require 'tests.storage' require 'tests.storage'
require 'tests.magicbag'

View File

@ -6,3 +6,4 @@ require 'tests.e3.parser'
require 'tests.e3.morale' require 'tests.e3.morale'
require 'tests.orders' require 'tests.orders'
require 'tests.common' require 'tests.common'
require 'tests.magicbag'

View File

@ -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