forked from github/server
parent
e5cee39963
commit
5fc0ed8631
|
@ -73,13 +73,13 @@ end
|
|||
function test_blessedharvest_lasts_n_turn()
|
||||
free_game()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local f = faction.create("noreply@eressea.de", "halfling", "de")
|
||||
local u = unit.create(f, r)
|
||||
r:set_resource("peasant", 100)
|
||||
r:set_resource("money", 0)
|
||||
u:add_item("money", 1000)
|
||||
u.magic = "gwyrrd"
|
||||
u.race = "elf"
|
||||
u.race = "dwarf"
|
||||
u:set_skill("magic", 20)
|
||||
u.aura = 200
|
||||
u:add_spell("raindance")
|
||||
|
@ -344,6 +344,7 @@ function test_guard()
|
|||
f1.age = 20
|
||||
local u1 = unit.create(f1, r, 1)
|
||||
u1:add_item("sword", 10)
|
||||
u1:add_item("money", 10)
|
||||
u1:set_skill("melee", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH O")
|
||||
|
@ -362,7 +363,7 @@ function test_guard()
|
|||
u2:add_item("money", 100)
|
||||
u3:add_item("money", 100)
|
||||
process_orders()
|
||||
assert(u1.region==r)
|
||||
assert_equal(r.id, u1.region.id, "unit may not move after combat")
|
||||
end
|
||||
|
||||
function test_recruit()
|
||||
|
|
|
@ -60,7 +60,7 @@ function test_fishing()
|
|||
assert_equal(60, u1:get_item("money"))
|
||||
end
|
||||
|
||||
function test_capacity()
|
||||
function test_ship_capacity()
|
||||
local r = region.create(0,0, "ocean")
|
||||
region.create(1,0, "ocean")
|
||||
local r2 = region.create(2,0, "ocean")
|
||||
|
|
|
@ -7,7 +7,6 @@ function setup()
|
|||
end
|
||||
|
||||
function test_unit_limit_is_1500()
|
||||
free_game()
|
||||
local r = region.create(0,0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
for i = 1,1500 do
|
||||
|
@ -20,3 +19,43 @@ function test_unit_limit_is_1500()
|
|||
process_orders()
|
||||
assert_equal(1, u.number)
|
||||
end
|
||||
|
||||
function test_ship_capacity()
|
||||
local r = region.create(0,0, "ocean")
|
||||
region.create(1,0, "ocean")
|
||||
local r2 = region.create(2,0, "ocean")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
|
||||
-- u1 is at the limit and moves
|
||||
local s1 = ship.create(r, "boat")
|
||||
local u1 = unit.create(f, r, 5)
|
||||
u1.ship = s1
|
||||
u1:set_skill("sailing", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH O O")
|
||||
|
||||
-- u2 has too many people
|
||||
local s2 = ship.create(r, "boat")
|
||||
local u2 = unit.create(f, r, 6)
|
||||
u2.ship = s2
|
||||
u2:set_skill("sailing", 10)
|
||||
u2:clear_orders()
|
||||
u2:add_order("NACH O O")
|
||||
|
||||
-- u4 has too much stuff
|
||||
local s4 = ship.create(r, "boat")
|
||||
local u4 = unit.create(f, r, 5)
|
||||
u4.ship = s4
|
||||
u4:set_skill("sailing", 10)
|
||||
u4:add_item("sword", 1)
|
||||
u4:clear_orders()
|
||||
u4:add_order("NACH O O")
|
||||
|
||||
update_owners()
|
||||
process_orders()
|
||||
-- print(s.region, u.region, r2)
|
||||
assert_equal(r2.id, u1.region.id, "boat with 5 humans did not move")
|
||||
assert_not_equal(r2.id, u2.region.id, "boat with too many people has moved")
|
||||
assert_not_equal(r2.id, u4.region.id, "boat with too much cargo has moved")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue