forked from github/server
remove attribs from rtype (it's only in rtype->construction that we use it?)
test to verify that mine bonus for iron works as advertised. change the oder of arguments for faction.create (race is the only thing not optional).
This commit is contained in:
parent
beb498d70c
commit
4c67e0603b
39 changed files with 284 additions and 234 deletions
|
@ -61,7 +61,7 @@ end
|
||||||
|
|
||||||
local function seed(r, email, race, lang)
|
local function seed(r, email, race, lang)
|
||||||
assert(r)
|
assert(r)
|
||||||
local f = faction.create(email, race, lang)
|
local f = faction.create(race, email, lang)
|
||||||
assert(f)
|
assert(f)
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
assert(u)
|
assert(u)
|
||||||
|
|
|
@ -17,8 +17,8 @@ local function two_units(r, f1, f2)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function two_factions()
|
local function two_factions()
|
||||||
local f1 = faction.create("one@eressea.de", "human", "de")
|
local f1 = faction.create("human", "one@eressea.de", "de")
|
||||||
local f2 = faction.create("two@eressea.de", "elf", "de")
|
local f2 = faction.create("elf", "two@eressea.de", "de")
|
||||||
return f1, f2
|
return f1, f2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ end
|
||||||
|
|
||||||
function test_flags()
|
function test_flags()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("flags@eressea.de", "halfling", "de")
|
local f = faction.create("halfling", "flags@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local no = itoa36(f.id)
|
local no = itoa36(f.id)
|
||||||
local flags = 50332673
|
local flags = 50332673
|
||||||
|
@ -62,7 +62,7 @@ function test_elvenhorse_requires_riding_5()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
local goal = region.create(2, 0, "plain")
|
local goal = region.create(2, 0, "plain")
|
||||||
local f = faction.create("riding@eressea.de", "halfling", "de")
|
local f = faction.create("halfling", "riding@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("elvenhorse", 1)
|
u:add_item("elvenhorse", 1)
|
||||||
u:set_skill("riding", 6)-- halfling has -1 modifier
|
u:set_skill("riding", 6)-- halfling has -1 modifier
|
||||||
|
@ -76,7 +76,7 @@ function test_cannot_ride_elvenhorse_without_enough_skill()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local goal = region.create(1, 0, "plain")
|
local goal = region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local f = faction.create("elvenhorse@eressea.de", "halfling", "de")
|
local f = faction.create("halfling", "elvenhorse@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("elvenhorse", 1)
|
u:add_item("elvenhorse", 1)
|
||||||
u:set_skill("riding", 5) -- halfling has -1 modifier
|
u:set_skill("riding", 5) -- halfling has -1 modifier
|
||||||
|
@ -96,7 +96,7 @@ end
|
||||||
|
|
||||||
function test_demon_food()
|
function test_demon_food()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("demonfood@eressea.de", "demon", "de")
|
local f = faction.create("demon", "demonfood@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local p = r:get_resource("peasant")
|
local p = r:get_resource("peasant")
|
||||||
r:set_resource("peasant", 2000)
|
r:set_resource("peasant", 2000)
|
||||||
|
@ -136,7 +136,7 @@ function test_plane()
|
||||||
local nx, ny = plane.normalize(pl, 4, 4)
|
local nx, ny = plane.normalize(pl, 4, 4)
|
||||||
assert_equal(nx, -3, "normalization failed")
|
assert_equal(nx, -3, "normalization failed")
|
||||||
assert_equal(ny, -3, "normalization failed")
|
assert_equal(ny, -3, "normalization failed")
|
||||||
local f = faction.create("plan@eressea.de", "human", "de")
|
local f = faction.create("human", "plan@eressea.de", "de")
|
||||||
f.id = atoi36("tpla")
|
f.id = atoi36("tpla")
|
||||||
local r, x, y
|
local r, x, y
|
||||||
for x = -3, 3 do for y = -3, 3 do
|
for x = -3, 3 do for y = -3, 3 do
|
||||||
|
@ -155,7 +155,7 @@ end
|
||||||
|
|
||||||
function test_read_write()
|
function test_read_write()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("readwrite@eressea.de", "human", "de")
|
local f = faction.create("human", "readwrite@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u.number = 2
|
u.number = 2
|
||||||
local fno = f.id
|
local fno = f.id
|
||||||
|
@ -184,7 +184,7 @@ end
|
||||||
function test_descriptions()
|
function test_descriptions()
|
||||||
local info = "Descriptions can be very long. Bug 1984 behauptet, dass es Probleme gibt mit Beschreibungen die laenger als 120 Zeichen sind. This description is longer than 120 characters."
|
local info = "Descriptions can be very long. Bug 1984 behauptet, dass es Probleme gibt mit Beschreibungen die laenger als 120 Zeichen sind. This description is longer than 120 characters."
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("descriptions@eressea.de", "human", "de")
|
local f = faction.create("human", "descriptions@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local s = _test_create_ship(r)
|
local s = _test_create_ship(r)
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
@ -236,7 +236,7 @@ end
|
||||||
|
|
||||||
function test_faction()
|
function test_faction()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("testfaction@eressea.de", "human", "de")
|
local f = faction.create("human", "testfaction@eressea.de", "de")
|
||||||
assert(f)
|
assert(f)
|
||||||
f.info = "Spazz"
|
f.info = "Spazz"
|
||||||
assert(f.info=="Spazz")
|
assert(f.info=="Spazz")
|
||||||
|
@ -259,7 +259,7 @@ end
|
||||||
|
|
||||||
function test_unit()
|
function test_unit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("testunit@eressea.de", "human", "de")
|
local f = faction.create("human", "testunit@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u.number = 20
|
u.number = 20
|
||||||
u.name = "Enno"
|
u.name = "Enno"
|
||||||
|
@ -292,7 +292,7 @@ end
|
||||||
|
|
||||||
function test_building()
|
function test_building()
|
||||||
local u
|
local u
|
||||||
local f = faction.create("testbuilding@eressea.de", "human", "de")
|
local f = faction.create("human", "testbuilding@eressea.de", "de")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
u = unit.create(f, r)
|
u = unit.create(f, r)
|
||||||
|
@ -318,7 +318,7 @@ end
|
||||||
|
|
||||||
function test_message()
|
function test_message()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("testmessage@eressea.de", "human", "de")
|
local f = faction.create("human", "testmessage@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
local msg = message.create("item_create_spell")
|
local msg = message.create("item_create_spell")
|
||||||
msg:set_unit("mage", u)
|
msg:set_unit("mage", u)
|
||||||
|
@ -346,7 +346,7 @@ function test_events()
|
||||||
plain = region.create(0, 0, "plain")
|
plain = region.create(0, 0, "plain")
|
||||||
skill = 8
|
skill = 8
|
||||||
|
|
||||||
f = faction.create("noreply2@eressea.de", "elf", "de")
|
f = faction.create("elf", "noreply2@eressea.de", "de")
|
||||||
f.age = 20
|
f.age = 20
|
||||||
|
|
||||||
u = unit.create(f, plain)
|
u = unit.create(f, plain)
|
||||||
|
@ -356,7 +356,7 @@ function test_events()
|
||||||
u:add_order("NUMMER PARTEI test")
|
u:add_order("NUMMER PARTEI test")
|
||||||
u:add_handler("message", msg_handler)
|
u:add_handler("message", msg_handler)
|
||||||
msg = "BOTSCHAFT EINHEIT " .. itoa36(u.id) .. " Du~Elf~stinken"
|
msg = "BOTSCHAFT EINHEIT " .. itoa36(u.id) .. " Du~Elf~stinken"
|
||||||
f = faction.create("noreply3@eressea.de", "elf", "de")
|
f = faction.create("elf", "noreply3@eressea.de", "de")
|
||||||
f.age = 20
|
f.age = 20
|
||||||
|
|
||||||
u = unit.create(f, plain)
|
u = unit.create(f, plain)
|
||||||
|
@ -371,7 +371,7 @@ end
|
||||||
|
|
||||||
function test_renumber_ship()
|
function test_renumber_ship()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply4@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply4@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
local s = ship.create(r, config.ships[1])
|
local s = ship.create(r, config.ships[1])
|
||||||
u.ship = s
|
u.ship = s
|
||||||
|
@ -386,7 +386,7 @@ end
|
||||||
|
|
||||||
function test_recruit2()
|
function test_recruit2()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply4@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply4@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u.number = 1
|
u.number = 1
|
||||||
u:add_item("money", 2000)
|
u:add_item("money", 2000)
|
||||||
|
@ -401,7 +401,7 @@ end
|
||||||
function test_guard()
|
function test_guard()
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply5@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply5@eressea.de", "de")
|
||||||
f1.age = 20
|
f1.age = 20
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
u1:add_item("sword", 10)
|
u1:add_item("sword", 10)
|
||||||
|
@ -411,7 +411,7 @@ function test_guard()
|
||||||
u1:add_order("NACH O")
|
u1:add_order("NACH O")
|
||||||
u1.name="Kalle Pimp"
|
u1.name="Kalle Pimp"
|
||||||
|
|
||||||
local f2 = faction.create("noreply6@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply6@eressea.de", "de")
|
||||||
f2.age = 20
|
f2.age = 20
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
local u3 = unit.create(f2, r, 1)
|
local u3 = unit.create(f2, r, 1)
|
||||||
|
@ -429,7 +429,7 @@ end
|
||||||
|
|
||||||
function test_recruit()
|
function test_recruit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply7@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply7@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u.number = 1
|
u.number = 1
|
||||||
local n = 3
|
local n = 3
|
||||||
|
@ -445,7 +445,7 @@ end
|
||||||
|
|
||||||
function test_produce()
|
function test_produce()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply8@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply8@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
local sword = config.get_resource('sword')
|
local sword = config.get_resource('sword')
|
||||||
|
@ -460,7 +460,7 @@ end
|
||||||
|
|
||||||
function test_work()
|
function test_work()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply9@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply9@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("money", u.number * 10) -- humans cost 10
|
u:add_item("money", u.number * 10) -- humans cost 10
|
||||||
u:set_skill("herbalism", 5)
|
u:set_skill("herbalism", 5)
|
||||||
|
@ -473,7 +473,7 @@ end
|
||||||
function test_upkeep()
|
function test_upkeep()
|
||||||
eressea.settings.set("rules.food.flags", "0")
|
eressea.settings.set("rules.food.flags", "0")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply10@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply10@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 5)
|
local u = unit.create(f, r, 5)
|
||||||
u:add_item("money", u.number * 11)
|
u:add_item("money", u.number * 11)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -485,7 +485,7 @@ end
|
||||||
function test_id()
|
function test_id()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
|
|
||||||
local f = faction.create("noreply11@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply11@eressea.de", "de")
|
||||||
f.id = atoi36("42")
|
f.id = atoi36("42")
|
||||||
assert_not_equal(f, get_faction(42))
|
assert_not_equal(f, get_faction(42))
|
||||||
assert_equal(f, get_faction("42"))
|
assert_equal(f, get_faction("42"))
|
||||||
|
@ -521,7 +521,7 @@ function test_mallorn()
|
||||||
m:set_resource("tree", 100)
|
m:set_resource("tree", 100)
|
||||||
assert_equal(100, m:get_resource("tree"))
|
assert_equal(100, m:get_resource("tree"))
|
||||||
|
|
||||||
local f = faction.create("noreply13@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply13@eressea.de", "de")
|
||||||
|
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
u1:add_item("money", u1.number * 100)
|
u1:add_item("money", u1.number * 100)
|
||||||
|
@ -558,7 +558,7 @@ function test_coordinate_translation()
|
||||||
local pl = plane.create(1, 500, 500, 1001, 1001) -- astralraum
|
local pl = plane.create(1, 500, 500, 1001, 1001) -- astralraum
|
||||||
local pe = plane.create(1, -8761, 3620, 23, 23) -- eternath
|
local pe = plane.create(1, -8761, 3620, 23, 23) -- eternath
|
||||||
local r = region.create(1000, 1000, "plain")
|
local r = region.create(1000, 1000, "plain")
|
||||||
local f = faction.create("noreply14@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply14@eressea.de", "de")
|
||||||
assert_not_equal(nil, r)
|
assert_not_equal(nil, r)
|
||||||
assert_equal(r.x, 1000)
|
assert_equal(r.x, 1000)
|
||||||
assert_equal(r.y, 1000)
|
assert_equal(r.y, 1000)
|
||||||
|
@ -604,8 +604,8 @@ end
|
||||||
|
|
||||||
function test_building_other()
|
function test_building_other()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f1 = faction.create("noreply17@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply17@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply18@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply18@eressea.de", "de")
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
b.size = 10
|
b.size = 10
|
||||||
local u1 = unit.create(f1, r, 3)
|
local u1 = unit.create(f1, r, 3)
|
||||||
|
@ -632,7 +632,7 @@ end
|
||||||
local function _test_create_laen()
|
local function _test_create_laen()
|
||||||
eressea.settings.set("rules.terraform.all", "1")
|
eressea.settings.set("rules.terraform.all", "1")
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f1 = faction.create("noreply19@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply19@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
r:set_resource("laen", 50)
|
r:set_resource("laen", 50)
|
||||||
return r, u1
|
return r, u1
|
||||||
|
@ -671,7 +671,7 @@ end
|
||||||
|
|
||||||
function test_mine()
|
function test_mine()
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f1 = faction.create("noreply20@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply20@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
|
|
||||||
u1:add_item("money", 1000)
|
u1:add_item("money", 1000)
|
||||||
|
@ -692,9 +692,9 @@ end
|
||||||
function test_guard_resources()
|
function test_guard_resources()
|
||||||
-- this is not quite http://bugs.eressea.de/view.php?id=1756
|
-- this is not quite http://bugs.eressea.de/view.php?id=1756
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f1 = faction.create("noreply21@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply21@eressea.de", "de")
|
||||||
f1.age=20
|
f1.age=20
|
||||||
local f2 = faction.create("noreply22@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply22@eressea.de", "de")
|
||||||
f2.age=20
|
f2.age=20
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
u1:add_item("money", 100)
|
u1:add_item("money", 100)
|
||||||
|
@ -722,7 +722,7 @@ end
|
||||||
|
|
||||||
function test_hero_hero_transfer()
|
function test_hero_hero_transfer()
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f = faction.create("noreply23@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply23@eressea.de", "de")
|
||||||
f.age=20
|
f.age=20
|
||||||
local UFL_HERO = 128
|
local UFL_HERO = 128
|
||||||
|
|
||||||
|
@ -743,7 +743,7 @@ end
|
||||||
|
|
||||||
function test_hero_normal_transfer()
|
function test_hero_normal_transfer()
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f = faction.create("noreply24@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply24@eressea.de", "de")
|
||||||
f.age=20
|
f.age=20
|
||||||
local UFL_HERO = 128
|
local UFL_HERO = 128
|
||||||
|
|
||||||
|
@ -762,7 +762,7 @@ end
|
||||||
|
|
||||||
function test_expensive_skills_cost_money()
|
function test_expensive_skills_cost_money()
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f = faction.create("noreply25@eressea.de", "elf", "de")
|
local f = faction.create("elf", "noreply25@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("money", 10000)
|
u:add_item("money", 10000)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -775,7 +775,7 @@ end
|
||||||
|
|
||||||
function test_food_is_consumed()
|
function test_food_is_consumed()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply26@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply26@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("money", 100)
|
u:add_item("money", 100)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -787,7 +787,7 @@ end
|
||||||
|
|
||||||
function test_food_can_override()
|
function test_food_can_override()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply27@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply27@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("money", 100)
|
u:add_item("money", 100)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -799,7 +799,7 @@ end
|
||||||
|
|
||||||
function test_swim_and_survive()
|
function test_swim_and_survive()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply28@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply28@eressea.de", "de")
|
||||||
f.nam = "chaos"
|
f.nam = "chaos"
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -813,7 +813,7 @@ end
|
||||||
|
|
||||||
function test_swim_and_die()
|
function test_swim_and_die()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply29@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply29@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local uid = u.id
|
local uid = u.id
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -828,7 +828,7 @@ function test_ride_with_horse()
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply30@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply30@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("horse", 1)
|
u:add_item("horse", 1)
|
||||||
local horse_cfg = config.get_resource("horse")
|
local horse_cfg = config.get_resource("horse")
|
||||||
|
@ -851,7 +851,7 @@ function test_ride_with_horses_and_cart()
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply31@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply31@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local horse_cfg = config.get_resource("horse")
|
local horse_cfg = config.get_resource("horse")
|
||||||
local cart_cfg = config.get_resource("cart")
|
local cart_cfg = config.get_resource("cart")
|
||||||
|
@ -904,7 +904,7 @@ function test_walk_and_carry_the_cart()
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
local r = region.create(2, 0, "plain")
|
local r = region.create(2, 0, "plain")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply32@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply32@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 10)
|
local u = unit.create(f, r, 10)
|
||||||
u:add_item("cart", 1)
|
u:add_item("cart", 1)
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ end
|
||||||
|
|
||||||
function test_bug_1795_limit()
|
function test_bug_1795_limit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = one_unit(r,f)
|
local u1 = one_unit(r,f)
|
||||||
u1:add_item("money", 100000000)
|
u1:add_item("money", 100000000)
|
||||||
u1:add_order("REKRUTIEREN 9999")
|
u1:add_order("REKRUTIEREN 9999")
|
||||||
|
@ -940,7 +940,7 @@ end
|
||||||
|
|
||||||
function test_bug_1795_demons()
|
function test_bug_1795_demons()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "demon", "de")
|
local f = faction.create("demon", "noreply@eressea.de", "de")
|
||||||
local u1 = one_unit(r,f)
|
local u1 = one_unit(r,f)
|
||||||
r:set_resource("peasant", 2000)
|
r:set_resource("peasant", 2000)
|
||||||
local peasants = r:get_resource("peasant")
|
local peasants = r:get_resource("peasant")
|
||||||
|
@ -966,7 +966,7 @@ end
|
||||||
|
|
||||||
function test_parser()
|
function test_parser()
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local filename = "orders.txt"
|
local filename = "orders.txt"
|
||||||
|
|
||||||
|
@ -991,7 +991,7 @@ end
|
||||||
|
|
||||||
function test_prefix()
|
function test_prefix()
|
||||||
local r0 = region.create(0, 0, "plain")
|
local r0 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r0, 1)
|
local u1 = unit.create(f1, r0, 1)
|
||||||
|
|
||||||
set_order(u1, "PRAEFIX See")
|
set_order(u1, "PRAEFIX See")
|
||||||
|
@ -1018,7 +1018,7 @@ end
|
||||||
|
|
||||||
function test_recruit()
|
function test_recruit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
u:add_item("money", 1000)
|
u:add_item("money", 1000)
|
||||||
|
@ -1031,7 +1031,7 @@ end
|
||||||
|
|
||||||
function test_give_horses()
|
function test_give_horses()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
r:set_resource("horse", 0)
|
r:set_resource("horse", 0)
|
||||||
|
@ -1047,7 +1047,7 @@ end
|
||||||
|
|
||||||
function test_give_silver()
|
function test_give_silver()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
r:set_resource("peasant", 0)
|
r:set_resource("peasant", 0)
|
||||||
|
|
|
@ -11,7 +11,7 @@ function test_read_race()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
assert_not_nil(eressea.config)
|
assert_not_nil(eressea.config)
|
||||||
eressea.config.parse('{ "races": { "orc" : {}}}')
|
eressea.config.parse('{ "races": { "orc" : {}}}')
|
||||||
f = faction.create("orc@example.com", "orc", "en")
|
f = faction.create("orc", "orc@example.com", "en")
|
||||||
assert_not_nil(f)
|
assert_not_nil(f)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ end
|
||||||
function disabled_test_dont_move_after_destroy()
|
function disabled_test_dont_move_after_destroy()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u.building = building.create(u.region, "castle")
|
u.building = building.create(u.region, "castle")
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -26,8 +26,8 @@ end
|
||||||
|
|
||||||
function test_dont_destroy_after_attack()
|
function test_dont_destroy_after_attack()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local u = unit.create(faction.create("one@example.com", "human", "de"), r1, 10)
|
local u = unit.create(faction.create("human", "one@example.com", "de"), r1, 10)
|
||||||
local u2 = unit.create(faction.create("two@example.com", "human", "de"), r1, 1)
|
local u2 = unit.create(faction.create("human", "two@example.com", "de"), r1, 1)
|
||||||
u.building = building.create(u.region, "castle")
|
u.building = building.create(u.region, "castle")
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("ATTACKIERE " .. itoa36(u2.id))
|
u:add_order("ATTACKIERE " .. itoa36(u2.id))
|
||||||
|
@ -38,7 +38,7 @@ end
|
||||||
|
|
||||||
function test_destroy_is_long()
|
function test_destroy_is_long()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local u = unit.create(faction.create("one@example.com", "human", "de"), r1, 10)
|
local u = unit.create(faction.create("human", "one@example.com", "de"), r1, 10)
|
||||||
u.building = building.create(u.region, "castle")
|
u.building = building.create(u.region, "castle")
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("LERNE Unterhaltung")
|
u:add_order("LERNE Unterhaltung")
|
||||||
|
|
|
@ -18,7 +18,7 @@ end
|
||||||
function test_herbalism()
|
function test_herbalism()
|
||||||
-- OBS: herbalism is currently an E2-only skill
|
-- OBS: herbalism is currently an E2-only skill
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("herbalism@eressea.de", "human", "de")
|
local f = faction.create("human", "herbalism@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
eressea.settings.set("rules.grow.formula", 0) -- plants do not grow
|
eressea.settings.set("rules.grow.formula", 0) -- plants do not grow
|
||||||
|
@ -42,7 +42,7 @@ end
|
||||||
function test_build_harbour()
|
function test_build_harbour()
|
||||||
-- try to reproduce mantis bug 2221
|
-- try to reproduce mantis bug 2221
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("harbour@eressea.de", "human", "de")
|
local f = faction.create("human", "harbour@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
size = 30
|
size = 30
|
||||||
u.number = 20
|
u.number = 20
|
||||||
|
@ -70,8 +70,8 @@ local function one_unit(r, f)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function two_factions()
|
local function two_factions()
|
||||||
local f1 = faction.create("one@eressea.de", "human", "de")
|
local f1 = faction.create("human", "one@eressea.de", "de")
|
||||||
local f2 = faction.create("two@eressea.de", "human", "de")
|
local f2 = faction.create("human", "two@eressea.de", "de")
|
||||||
return f1, f2
|
return f1, f2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ end
|
||||||
function test_learn()
|
function test_learn()
|
||||||
eressea.settings.set("study.random_progress", "0")
|
eressea.settings.set("study.random_progress", "0")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
f.age = 20
|
f.age = 20
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -101,7 +101,7 @@ end
|
||||||
function test_teach()
|
function test_teach()
|
||||||
eressea.settings.set("study.random_progress", "0")
|
eressea.settings.set("study.random_progress", "0")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
f.age = 20
|
f.age = 20
|
||||||
local u = unit.create(f, r, 10)
|
local u = unit.create(f, r, 10)
|
||||||
local u2 = unit.create(f, r)
|
local u2 = unit.create(f, r)
|
||||||
|
@ -118,7 +118,7 @@ end
|
||||||
|
|
||||||
function test_rename()
|
function test_rename()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
u:add_item("aoh", 1)
|
u:add_item("aoh", 1)
|
||||||
assert_equal(u:get_item("ao_healing"), 1)
|
assert_equal(u:get_item("ao_healing"), 1)
|
||||||
|
@ -126,7 +126,7 @@ end
|
||||||
|
|
||||||
function test_unit_limit_is_1500()
|
function test_unit_limit_is_1500()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
for i = 1,1500 do
|
for i = 1,1500 do
|
||||||
unit.create(f, r, 1)
|
unit.create(f, r, 1)
|
||||||
end
|
end
|
||||||
|
@ -142,7 +142,7 @@ function test_ship_capacity()
|
||||||
local r = region.create(0,0, "ocean")
|
local r = region.create(0,0, "ocean")
|
||||||
region.create(1,0, "ocean")
|
region.create(1,0, "ocean")
|
||||||
local r2 = region.create(2,0, "ocean")
|
local r2 = region.create(2,0, "ocean")
|
||||||
local f = faction.create("capacity@eressea.de", "human", "de")
|
local f = faction.create("human", "capacity@eressea.de", "de")
|
||||||
|
|
||||||
-- u1 is at the limit and moves
|
-- u1 is at the limit and moves
|
||||||
local s1 = ship.create(r, "boat")
|
local s1 = ship.create(r, "boat")
|
||||||
|
@ -179,7 +179,7 @@ end
|
||||||
|
|
||||||
function test_levitate()
|
function test_levitate()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 2)
|
local u = unit.create(f, r, 2)
|
||||||
local s = ship.create(r, "boat")
|
local s = ship.create(r, "boat")
|
||||||
u.ship = s
|
u.ship = s
|
||||||
|
@ -205,15 +205,15 @@ end
|
||||||
function test_races()
|
function test_races()
|
||||||
local races = { "wolf", "orc", "human", "demon" }
|
local races = { "wolf", "orc", "human", "demon" }
|
||||||
for k,v in ipairs(races) do
|
for k,v in ipairs(races) do
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
assert_not_equal(nil, f)
|
assert_not_equal(nil, f)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_can_give_person()
|
function test_can_give_person()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
local u2 = unit.create(f2, r, 10)
|
local u2 = unit.create(f2, r, 10)
|
||||||
u1.faction.age = 10
|
u1.faction.age = 10
|
||||||
|
@ -231,7 +231,7 @@ function test_can_give_person()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_no_uruk()
|
function test_no_uruk()
|
||||||
local f1 = faction.create("noreply@eressea.de", "uruk", "de")
|
local f1 = faction.create("uruk", "noreply@eressea.de", "de")
|
||||||
assert_equal(f1.race, "orc")
|
assert_equal(f1.race, "orc")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ end
|
||||||
|
|
||||||
function test_stonegolems()
|
function test_stonegolems()
|
||||||
local r0 = region.create(0, 0, "plain")
|
local r0 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "stonegolem", "de")
|
local f1 = faction.create("stonegolem", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r0, 1)
|
local u1 = unit.create(f1, r0, 1)
|
||||||
local u2 = unit.create(f1, r0, 2)
|
local u2 = unit.create(f1, r0, 2)
|
||||||
local c1 = building.create(r0, "castle")
|
local c1 = building.create(r0, "castle")
|
||||||
|
@ -355,7 +355,7 @@ end
|
||||||
|
|
||||||
function test_birthdaycake()
|
function test_birthdaycake()
|
||||||
r = region.create(0,0, "plain")
|
r = region.create(0,0, "plain")
|
||||||
f = faction.create("cake@eressea.de", "human", "de")
|
f = faction.create("human", "cake@eressea.de", "de")
|
||||||
u = unit.create(f, r, 1)
|
u = unit.create(f, r, 1)
|
||||||
u:add_item("birthdaycake", 1)
|
u:add_item("birthdaycake", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
|
|
@ -11,7 +11,7 @@ end
|
||||||
|
|
||||||
function test_guard_unarmed()
|
function test_guard_unarmed()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("hodor@eressea.de", "human", "de")
|
local f1 = faction.create("human", "hodor@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
assert_equal(false, u1.guard)
|
assert_equal(false, u1.guard)
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -22,7 +22,7 @@ end
|
||||||
|
|
||||||
function test_guard_armed()
|
function test_guard_armed()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("hodor@eressea.de", "human", "de")
|
local f1 = faction.create("human", "hodor@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
assert_equal(false, u1.guard)
|
assert_equal(false, u1.guard)
|
||||||
u1:add_item("sword", 1)
|
u1:add_item("sword", 1)
|
||||||
|
@ -36,10 +36,10 @@ end
|
||||||
function test_guard_allows_move_after_combat() -- bug 1493
|
function test_guard_allows_move_after_combat() -- bug 1493
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f1 = faction.create("bernd@eressea.de", "human", "de")
|
local f1 = faction.create("human", "bernd@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 10)
|
local u1 = unit.create(f1, r1, 10)
|
||||||
local uid1 = u1.id
|
local uid1 = u1.id
|
||||||
local f2 = faction.create("horst@eressea.de", "human", "de")
|
local f2 = faction.create("human", "horst@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r1, 1)
|
local u2 = unit.create(f2, r1, 1)
|
||||||
u1:add_order("BEWACHE")
|
u1:add_order("BEWACHE")
|
||||||
u1:add_item("sword", 10)
|
u1:add_item("sword", 10)
|
||||||
|
@ -59,10 +59,10 @@ end
|
||||||
function test_no_guard_no_move_after_combat() -- bug 1493
|
function test_no_guard_no_move_after_combat() -- bug 1493
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f1 = faction.create("bernd@eressea.de", "human", "de")
|
local f1 = faction.create("human", "bernd@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 10)
|
local u1 = unit.create(f1, r1, 10)
|
||||||
local uid1 = u1.id
|
local uid1 = u1.id
|
||||||
local f2 = faction.create("horst@eressea.de", "human", "de")
|
local f2 = faction.create("human", "horst@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r1, 1)
|
local u2 = unit.create(f2, r1, 1)
|
||||||
u1:add_order("BEWACHE")
|
u1:add_order("BEWACHE")
|
||||||
u1:add_item("sword", 10)
|
u1:add_item("sword", 10)
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
function test_nestwarmth_insect()
|
function test_nestwarmth_insect()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "insect", "de")
|
local f = faction.create("insect", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local flags = u.flags
|
local flags = u.flags
|
||||||
u:add_item("nestwarmth", 2)
|
u:add_item("nestwarmth", 2)
|
||||||
|
@ -29,7 +29,7 @@ end
|
||||||
|
|
||||||
function test_nestwarmth_other()
|
function test_nestwarmth_other()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local flags = u.flags
|
local flags = u.flags
|
||||||
u:add_item("nestwarmth", 2)
|
u:add_item("nestwarmth", 2)
|
||||||
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
function test_meow()
|
function test_meow()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("aoc", 1)
|
u:add_item("aoc", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -59,7 +59,7 @@ end
|
||||||
|
|
||||||
function test_aurapotion50()
|
function test_aurapotion50()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("aurapotion50", 1)
|
u:add_item("aurapotion50", 1)
|
||||||
u:set_skill('magic', 10);
|
u:set_skill('magic', 10);
|
||||||
|
@ -77,7 +77,7 @@ end
|
||||||
|
|
||||||
function test_bagpipe()
|
function test_bagpipe()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
turn_begin()
|
turn_begin()
|
||||||
u:add_item("bagpipeoffear", 1)
|
u:add_item("bagpipeoffear", 1)
|
||||||
|
@ -96,7 +96,7 @@ end
|
||||||
|
|
||||||
function test_speedsail()
|
function test_speedsail()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
turn_begin()
|
turn_begin()
|
||||||
|
@ -115,7 +115,7 @@ end
|
||||||
|
|
||||||
function test_foolpotion()
|
function test_foolpotion()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
turn_begin()
|
turn_begin()
|
||||||
u:add_item("p7", 1)
|
u:add_item("p7", 1)
|
||||||
|
@ -141,7 +141,7 @@ end
|
||||||
|
|
||||||
function test_snowman()
|
function test_snowman()
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("snowman", 1)
|
u:add_item("snowman", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
|
|
@ -13,8 +13,8 @@ end
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local r3 = region.create(-1, 0, "ocean")
|
local r3 = region.create(-1, 0, "ocean")
|
||||||
local f = faction.create("pirate@eressea.de", "human", "de")
|
local f = faction.create("human", "pirate@eressea.de", "de")
|
||||||
local f2 = faction.create("elf@eressea.de", "human", "de")
|
local f2 = faction.create("human", "elf@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r2, 1)
|
local u1 = unit.create(f, r2, 1)
|
||||||
local u2 = unit.create(f2, r3, 1)
|
local u2 = unit.create(f2, r3, 1)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ end
|
||||||
function test_dolphin_on_land()
|
function test_dolphin_on_land()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
u1.race = "dolphin"
|
u1.race = "dolphin"
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -51,7 +51,7 @@ end
|
||||||
function test_dolphin_to_land()
|
function test_dolphin_to_land()
|
||||||
local r1 = region.create(0, 0, "ocean")
|
local r1 = region.create(0, 0, "ocean")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
u1.race = "dolphin"
|
u1.race = "dolphin"
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -63,7 +63,7 @@ end
|
||||||
function test_dolphin_in_ocean()
|
function test_dolphin_in_ocean()
|
||||||
local r1 = region.create(0, 0, "ocean")
|
local r1 = region.create(0, 0, "ocean")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
u1.race = "dolphin"
|
u1.race = "dolphin"
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -75,7 +75,7 @@ end
|
||||||
function test_follow()
|
function test_follow()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
local u2 = unit.create(f, r1, 1)
|
local u2 = unit.create(f, r1, 1)
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -93,7 +93,7 @@ function test_follow_ship()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
region.create(1, 0, "ocean")
|
region.create(1, 0, "ocean")
|
||||||
region.create(2, 0, "ocean")
|
region.create(2, 0, "ocean")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
local u2 = unit.create(f, r1, 1)
|
local u2 = unit.create(f, r1, 1)
|
||||||
u1:add_item("money", 100)
|
u1:add_item("money", 100)
|
||||||
|
|
|
@ -11,8 +11,8 @@ end
|
||||||
function test_landing1()
|
function test_landing1()
|
||||||
local ocean = region.create(1, 0, "ocean")
|
local ocean = region.create(1, 0, "ocean")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
@ -34,8 +34,8 @@ function test_landing_harbour_with_help()
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local harbour = building.create(r, "harbour")
|
local harbour = building.create(r, "harbour")
|
||||||
harbour.size = 25
|
harbour.size = 25
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
@ -60,8 +60,8 @@ function test_landing_harbour_without_help()
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local harbour = building.create(r, "harbour")
|
local harbour = building.create(r, "harbour")
|
||||||
harbour.size = 25
|
harbour.size = 25
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
@ -84,7 +84,7 @@ function test_landing_harbour_unpaid()
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local harbour = building.create(r, "harbour")
|
local harbour = building.create(r, "harbour")
|
||||||
harbour.size = 25
|
harbour.size = 25
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
|
@ -104,8 +104,8 @@ end
|
||||||
function test_landing_terrain()
|
function test_landing_terrain()
|
||||||
local ocean = region.create(1, 0, "ocean")
|
local ocean = region.create(1, 0, "ocean")
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
@ -126,8 +126,8 @@ function test_landing_insects()
|
||||||
local r = region.create(0, 0, "glacier")
|
local r = region.create(0, 0, "glacier")
|
||||||
local harbour = building.create(r, "harbour")
|
local harbour = building.create(r, "harbour")
|
||||||
harbour.size = 25
|
harbour.size = 25
|
||||||
local f = faction.create("noreply@eressea.de", "insect", "de")
|
local f = faction.create("insect", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s = ship.create(ocean, "longboat")
|
local s = ship.create(ocean, "longboat")
|
||||||
local u1 = unit.create(f, ocean, 1)
|
local u1 = unit.create(f, ocean, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
|
|
@ -11,7 +11,7 @@ end
|
||||||
function test_ship_requires_skill()
|
function test_ship_requires_skill()
|
||||||
local r1 = region.create(0, 0, "ocean")
|
local r1 = region.create(0, 0, "ocean")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("fake@eressea.de", "human", "de")
|
local f = faction.create("human", "fake@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
u1.name = "fake"
|
u1.name = "fake"
|
||||||
u1.ship = ship.create(r1, "longboat")
|
u1.ship = ship.create(r1, "longboat")
|
||||||
|
@ -25,7 +25,7 @@ end
|
||||||
function no_test_ship_happy_case()
|
function no_test_ship_happy_case()
|
||||||
local r1 = region.create(0, 0, "ocean")
|
local r1 = region.create(0, 0, "ocean")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("hodor@eressea.de", "human", "de")
|
local f = faction.create("human", "hodor@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r1, 1)
|
local u1 = unit.create(f, r1, 1)
|
||||||
local u2 = unit.create(f, r1, 1)
|
local u2 = unit.create(f, r1, 1)
|
||||||
u1.ship = ship.create(r1, "longboat")
|
u1.ship = ship.create(r1, "longboat")
|
||||||
|
|
|
@ -12,7 +12,7 @@ end
|
||||||
|
|
||||||
function test_shapeshift()
|
function test_shapeshift()
|
||||||
local r = region.create(42, 0, "plain")
|
local r = region.create(42, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "demon", "de")
|
local f = faction.create("demon", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
|
|
@ -21,9 +21,9 @@ function setup()
|
||||||
set_rule('rules.food.flags', '4')
|
set_rule('rules.food.flags', '4')
|
||||||
|
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
f = faction.create("stealthy@eressea.de", "human", "de")
|
f = faction.create("human", "stealthy@eressea.de", "de")
|
||||||
u = unit.create(f, r, 1)
|
u = unit.create(f, r, 1)
|
||||||
f = faction.create("stealth@eressea.de", "human", "de")
|
f = faction.create("human", "stealth@eressea.de", "de")
|
||||||
unit.create(f, r, 1) -- TARNE PARTEI NUMMER <no> must have a unit in the region
|
unit.create(f, r, 1) -- TARNE PARTEI NUMMER <no> must have a unit in the region
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
function test_undead_give_item()
|
function test_undead_give_item()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("hodor@eressea.de", "human", "de")
|
local f1 = faction.create("human", "hodor@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
u1.race = "undead"
|
u1.race = "undead"
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
@ -20,7 +20,7 @@ end
|
||||||
|
|
||||||
function test_undead_dont_give_person()
|
function test_undead_dont_give_person()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("hodor@eressea.de", "human", "de")
|
local f1 = faction.create("human", "hodor@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 2)
|
local u1 = unit.create(f1, r1, 2)
|
||||||
u1.race = "undead"
|
u1.race = "undead"
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
function test_build_watch()
|
function test_build_watch()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("e3build@eressea.de", "human", "de")
|
local f = faction.create("human", "e3build@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
u.number = 20
|
u.number = 20
|
||||||
|
@ -46,9 +46,9 @@ end
|
||||||
|
|
||||||
function test_small_castles()
|
function test_small_castles()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local f2 = faction.create("noreply@eressea.de", "halfling", "de")
|
local f2 = faction.create("halfling", "noreply@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
@ -65,7 +65,7 @@ end
|
||||||
|
|
||||||
function test_build_normal()
|
function test_build_normal()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_item("stone", 10)
|
u:add_item("stone", 10)
|
||||||
|
@ -78,7 +78,7 @@ end
|
||||||
|
|
||||||
function test_build_packice()
|
function test_build_packice()
|
||||||
local r = region.create(0, 0, "packice")
|
local r = region.create(0, 0, "packice")
|
||||||
local f = faction.create("packice@eressea.de", "human", "de")
|
local f = faction.create("human", "packice@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_item("stone", 10)
|
u:add_item("stone", 10)
|
||||||
|
@ -90,7 +90,7 @@ end
|
||||||
|
|
||||||
function test_build_castle_stages()
|
function test_build_castle_stages()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("castle@eressea.de", "human", "de")
|
local f = faction.create("human", "castle@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1000)
|
local u = unit.create(f, r, 1000)
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ end
|
||||||
|
|
||||||
function test_give_horses()
|
function test_give_horses()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
r:set_resource("horse", 0)
|
r:set_resource("horse", 0)
|
||||||
|
@ -23,9 +23,9 @@ end
|
||||||
|
|
||||||
function test_goblins()
|
function test_goblins()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("goblin@eressea.de", "goblin", "de")
|
local f1 = faction.create("goblin", "goblin@eressea.de", "de")
|
||||||
local f2 = faction.create("dwarf@eressea.de", "dwarf", "de")
|
local f2 = faction.create("dwarf", "dwarf@eressea.de", "de")
|
||||||
local f3 = faction.create("elf@eressea.de", "elf", "de")
|
local f3 = faction.create("elf", "elf@eressea.de", "de")
|
||||||
local ud = unit.create(f1, r, 1)
|
local ud = unit.create(f1, r, 1)
|
||||||
local uh = unit.create(f1, r, 1)
|
local uh = unit.create(f1, r, 1)
|
||||||
uh.race = "halfling"
|
uh.race = "halfling"
|
||||||
|
@ -54,7 +54,7 @@ end
|
||||||
function test_make_horse()
|
function test_make_horse()
|
||||||
eressea.settings.set("rules.horses.growth", "0")
|
eressea.settings.set("rules.horses.growth", "0")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("horses@eressea.de", "human", "de")
|
local f = faction.create("human", "horses@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:set_skill("training", 4)
|
u:set_skill("training", 4)
|
||||||
r:set_resource("horse", 100)
|
r:set_resource("horse", 100)
|
||||||
|
|
|
@ -14,7 +14,7 @@ end
|
||||||
function test_when_owner_returns_morale_stays()
|
function test_when_owner_returns_morale_stays()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
assert_equal(1, r.morale)
|
assert_equal(1, r.morale)
|
||||||
local f1 = faction.create("owner_returns@eressea.de", "human", "de")
|
local f1 = faction.create("human", "owner_returns@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
u1:add_item("money", 10000)
|
u1:add_item("money", 10000)
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
@ -38,13 +38,13 @@ end
|
||||||
function test_morale_alliance()
|
function test_morale_alliance()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
assert_equal(1, r.morale)
|
assert_equal(1, r.morale)
|
||||||
local f1 = faction.create("ma1@eressea.de", "human", "de")
|
local f1 = faction.create("human", "ma1@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
u1:add_item("money", 10000)
|
u1:add_item("money", 10000)
|
||||||
local f2 = faction.create("ma2@eressea.de", "human", "de")
|
local f2 = faction.create("human", "ma2@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
u2:add_item("money", 10000)
|
u2:add_item("money", 10000)
|
||||||
local f3 = faction.create("ma3@eressea.de", "human", "de")
|
local f3 = faction.create("human", "ma3@eressea.de", "de")
|
||||||
local u3 = unit.create(f3, r, 1)
|
local u3 = unit.create(f3, r, 1)
|
||||||
u3:add_item("money", 10000)
|
u3:add_item("money", 10000)
|
||||||
|
|
||||||
|
@ -95,9 +95,9 @@ end
|
||||||
function test_bigger_castle_empty()
|
function test_bigger_castle_empty()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
assert_equal(1, r.morale)
|
assert_equal(1, r.morale)
|
||||||
local f1 = faction.create("small1@eressea.de", "human", "de")
|
local f1 = faction.create("human", "small1@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local f2 = faction.create("small2@eressea.de", "human", "de")
|
local f2 = faction.create("human", "small2@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
u1:add_item("money", 10000)
|
u1:add_item("money", 10000)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ end
|
||||||
function test_morale_change()
|
function test_morale_change()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
assert_equal(1, r.morale)
|
assert_equal(1, r.morale)
|
||||||
local f1 = faction.create("mchange@eressea.de", "human", "de")
|
local f1 = faction.create("human", "mchange@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
u1:add_item("money", 10000)
|
u1:add_item("money", 10000)
|
||||||
|
|
||||||
|
@ -195,9 +195,9 @@ end
|
||||||
function test_morale_give_command()
|
function test_morale_give_command()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
assert_equal(1, r.morale)
|
assert_equal(1, r.morale)
|
||||||
local f1 = faction.create("mold1@eressea.de", "human", "de")
|
local f1 = faction.create("human", "mold1@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local f2 = faction.create("mold2@eressea.de", "human", "de")
|
local f2 = faction.create("human", "mold2@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
|
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
function test_set_status_en()
|
function test_set_status_en()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("bug_1882@eressea.de", "human", "en")
|
local f = faction.create("human", "bug_1882@eressea.de", "en")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.status = 1
|
u.status = 1
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -23,7 +23,7 @@ end
|
||||||
|
|
||||||
function test_set_status_de()
|
function test_set_status_de()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("bug_1882@eressea.de", "human", "de")
|
local f = faction.create("human", "bug_1882@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.status = 1
|
u.status = 1
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -34,7 +34,7 @@ end
|
||||||
|
|
||||||
function test_breed_horses()
|
function test_breed_horses()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("bug_1886@eressea.de", "human", "en")
|
local f = faction.create("human", "bug_1886@eressea.de", "en")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local b = building.create(r, "stables")
|
local b = building.create(r, "stables")
|
||||||
b.size = 10
|
b.size = 10
|
||||||
|
|
|
@ -43,7 +43,7 @@ end
|
||||||
|
|
||||||
function disable_test_bug_1738_build_castle_e3()
|
function disable_test_bug_1738_build_castle_e3()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("bug_1738@eressea.de", "human", "de")
|
local f = faction.create("human", "bug_1738@eressea.de", "de")
|
||||||
|
|
||||||
local c = building.create(r, "castle")
|
local c = building.create(r, "castle")
|
||||||
c.size = 228
|
c.size = 228
|
||||||
|
@ -73,10 +73,10 @@ end
|
||||||
|
|
||||||
function disable_test_alliance()
|
function disable_test_alliance()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
u1:add_item("money", u1.number * 100)
|
u1:add_item("money", u1.number * 100)
|
||||||
local f2 = faction.create("info@eressea.de", "human", "de")
|
local f2 = faction.create("human", "info@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
u2:add_item("money", u2.number * 100)
|
u2:add_item("money", u2.number * 100)
|
||||||
assert(f1.alliance==nil)
|
assert(f1.alliance==nil)
|
||||||
|
@ -125,7 +125,7 @@ end
|
||||||
|
|
||||||
function test_no_stealth()
|
function test_no_stealth()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
u:set_skill("stealth", 1)
|
u:set_skill("stealth", 1)
|
||||||
|
@ -138,7 +138,7 @@ end
|
||||||
|
|
||||||
function test_no_teach()
|
function test_no_teach()
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ function test_seecast()
|
||||||
for i = 1,10 do
|
for i = 1,10 do
|
||||||
region.create(i, 0, "ocean")
|
region.create(i, 0, "ocean")
|
||||||
end
|
end
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s1 = ship.create(r, "cutter")
|
local s1 = ship.create(r, "cutter")
|
||||||
local u1 = unit.create(f, r, 2)
|
local u1 = unit.create(f, r, 2)
|
||||||
u1:set_skill("sailing", 3)
|
u1:set_skill("sailing", 3)
|
||||||
|
@ -193,7 +193,7 @@ function test_fishing()
|
||||||
eressea.settings.set("rules.food.flags", "0")
|
eressea.settings.set("rules.food.flags", "0")
|
||||||
local r = region.create(0,0, "ocean")
|
local r = region.create(0,0, "ocean")
|
||||||
local r2 = region.create(1,0, "plain")
|
local r2 = region.create(1,0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local s1 = ship.create(r, "cutter")
|
local s1 = ship.create(r, "cutter")
|
||||||
local u1 = unit.create(f, r, 3)
|
local u1 = unit.create(f, r, 3)
|
||||||
u1.ship = s1
|
u1.ship = s1
|
||||||
|
@ -219,8 +219,8 @@ function test_ship_capacity()
|
||||||
local r = region.create(0,0, "ocean")
|
local r = region.create(0,0, "ocean")
|
||||||
region.create(1,0, "ocean")
|
region.create(1,0, "ocean")
|
||||||
local r2 = region.create(2,0, "ocean")
|
local r2 = region.create(2,0, "ocean")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "goblin", "de")
|
local f2 = faction.create("goblin", "noreply@eressea.de", "de")
|
||||||
|
|
||||||
-- u1 is at the limit and moves
|
-- u1 is at the limit and moves
|
||||||
local s1 = ship.create(r, "cutter")
|
local s1 = ship.create(r, "cutter")
|
||||||
|
@ -273,9 +273,9 @@ end
|
||||||
|
|
||||||
function test_owners()
|
function test_owners()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
local u3 = unit.create(f2, r, 1)
|
local u3 = unit.create(f2, r, 1)
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ function test_taxes()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
r:set_resource("peasant", 1000)
|
r:set_resource("peasant", 1000)
|
||||||
r:set_resource("money", 5000)
|
r:set_resource("money", 5000)
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("LERNE Holzfaellen") -- do not work
|
u:add_order("LERNE Holzfaellen") -- do not work
|
||||||
|
@ -320,7 +320,7 @@ end
|
||||||
|
|
||||||
function test_region_owner_cannot_leave_castle()
|
function test_region_owner_cannot_leave_castle()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
f.id = 42
|
f.id = 42
|
||||||
local b1 = building.create(r, "castle")
|
local b1 = building.create(r, "castle")
|
||||||
b1.size = 10
|
b1.size = 10
|
||||||
|
@ -366,7 +366,7 @@ function market_fixture()
|
||||||
b.size = 10
|
b.size = 10
|
||||||
b.working = true
|
b.working = true
|
||||||
|
|
||||||
local f = faction.create("market1@eressea.de", "human", "de")
|
local f = faction.create("human", "market1@eressea.de", "de")
|
||||||
f.id = 42
|
f.id = 42
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.building = b
|
u.building = b
|
||||||
|
@ -424,7 +424,7 @@ end
|
||||||
function test_multiple_markets()
|
function test_multiple_markets()
|
||||||
local r, u1, b, herbnames, luxurynames, herbtable, luxurytable = market_fixture()
|
local r, u1, b, herbnames, luxurynames, herbtable, luxurytable = market_fixture()
|
||||||
local r2 = get_region(1,0)
|
local r2 = get_region(1,0)
|
||||||
local f = faction.create("multim@eressea.de", "human", "de")
|
local f = faction.create("human", "multim@eressea.de", "de")
|
||||||
local u2 = unit.create(f, r2, 1)
|
local u2 = unit.create(f, r2, 1)
|
||||||
local b2 = building.create(r2, "market")
|
local b2 = building.create(r2, "market")
|
||||||
b2.size = 10
|
b2.size = 10
|
||||||
|
@ -444,7 +444,7 @@ end
|
||||||
|
|
||||||
function test_market()
|
function test_market()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("market2@eressea.de", "human", "de")
|
local f1 = faction.create("human", "market2@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
|
|
||||||
local b = building.create(r, "market")
|
local b = building.create(r, "market")
|
||||||
|
@ -541,7 +541,7 @@ function test_market_gives_items()
|
||||||
r = get_region(0, 0)
|
r = get_region(0, 0)
|
||||||
local b = building.create(r, "market")
|
local b = building.create(r, "market")
|
||||||
b.size = 10
|
b.size = 10
|
||||||
local f = faction.create("market0@eressea.de", "human", "de")
|
local f = faction.create("human", "market0@eressea.de", "de")
|
||||||
f.id = 42
|
f.id = 42
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.building = b
|
u.building = b
|
||||||
|
@ -559,7 +559,7 @@ end
|
||||||
|
|
||||||
function test_spells()
|
function test_spells()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.race = "elf"
|
u.race = "elf"
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -587,7 +587,7 @@ function test_spells()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_canoe_passes_through_land()
|
function test_canoe_passes_through_land()
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local src = region.create(0, 0, "ocean")
|
local src = region.create(0, 0, "ocean")
|
||||||
local land = region.create(1, 0, "plain")
|
local land = region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "ocean")
|
region.create(2, 0, "ocean")
|
||||||
|
@ -610,8 +610,8 @@ end
|
||||||
|
|
||||||
function test_give_50_percent_of_money()
|
function test_give_50_percent_of_money()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
|
local u1 = unit.create(faction.create("human", "noreply@eressea.de", "de"), r, 1)
|
||||||
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
|
local u2 = unit.create(faction.create("orc", "noreply@eressea.de", "de"), r, 1)
|
||||||
u1.faction.age = 10
|
u1.faction.age = 10
|
||||||
u2.faction.age = 10
|
u2.faction.age = 10
|
||||||
u1:add_item("money", 500)
|
u1:add_item("money", 500)
|
||||||
|
@ -637,8 +637,8 @@ end
|
||||||
|
|
||||||
function test_give_100_percent_of_items()
|
function test_give_100_percent_of_items()
|
||||||
r = region.create(0, 0, "plain")
|
r = region.create(0, 0, "plain")
|
||||||
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
|
local u1 = unit.create(faction.create("human", "noreply@eressea.de", "de"), r, 1)
|
||||||
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
|
local u2 = unit.create(faction.create("orc", "noreply@eressea.de", "de"), r, 1)
|
||||||
u1.faction.age = 10
|
u1.faction.age = 10
|
||||||
u2.faction.age = 10
|
u2.faction.age = 10
|
||||||
u1:add_item("money", 500)
|
u1:add_item("money", 500)
|
||||||
|
@ -656,8 +656,8 @@ end
|
||||||
|
|
||||||
function test_cannot_give_person()
|
function test_cannot_give_person()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
local u2 = unit.create(f2, r, 10)
|
local u2 = unit.create(f2, r, 10)
|
||||||
u1.faction.age = 10
|
u1.faction.age = 10
|
||||||
|
@ -675,8 +675,8 @@ end
|
||||||
|
|
||||||
function test_cannot_give_unit()
|
function test_cannot_give_unit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
local u2 = unit.create(f2, r, 10)
|
local u2 = unit.create(f2, r, 10)
|
||||||
u1.faction.age = 10
|
u1.faction.age = 10
|
||||||
|
@ -694,9 +694,9 @@ end
|
||||||
function test_guard_by_owners()
|
function test_guard_by_owners()
|
||||||
-- http://bugs.eressea.de/view.php?id=1756
|
-- http://bugs.eressea.de/view.php?id=1756
|
||||||
local r = region.create(0,0, "mountain")
|
local r = region.create(0,0, "mountain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
f1.age=20
|
f1.age=20
|
||||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
local f2 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
f2.age=20
|
f2.age=20
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
@ -717,7 +717,7 @@ function test_guard_by_owners()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setup_packice(x, onfoot)
|
local function setup_packice(x, onfoot)
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local plain = region.create(0,0, "plain")
|
local plain = region.create(0,0, "plain")
|
||||||
local ice = region.create(1,0, "packice")
|
local ice = region.create(1,0, "packice")
|
||||||
local ocean = region.create(2,0, "ocean")
|
local ocean = region.create(2,0, "ocean")
|
||||||
|
@ -778,7 +778,7 @@ function test_cannot_walk_into_ocean()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_p2()
|
function test_p2()
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
r:set_resource("tree", 0)
|
r:set_resource("tree", 0)
|
||||||
|
@ -795,7 +795,7 @@ end
|
||||||
|
|
||||||
function test_p2_move()
|
function test_p2_move()
|
||||||
-- http://bugs.eressea.de/view.php?id=1855
|
-- http://bugs.eressea.de/view.php?id=1855
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
@ -814,7 +814,7 @@ end
|
||||||
|
|
||||||
function test_golem_use_four_iron()
|
function test_golem_use_four_iron()
|
||||||
local r0 = region.create(0, 0, "plain")
|
local r0 = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "halfling", "de")
|
local f1 = faction.create("halfling", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r0, 3)
|
local u1 = unit.create(f1, r0, 3)
|
||||||
u1.race = "irongolem"
|
u1.race = "irongolem"
|
||||||
u1:set_skill("weaponsmithing", 1)
|
u1:set_skill("weaponsmithing", 1)
|
||||||
|
@ -832,7 +832,7 @@ function test_silver_weight_stops_movement()
|
||||||
local r1 = region.create(1, 1, "plain")
|
local r1 = region.create(1, 1, "plain")
|
||||||
local r2 = region.create(2, 1, "plain")
|
local r2 = region.create(2, 1, "plain")
|
||||||
region.create(3, 1, "plain")
|
region.create(3, 1, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
u1:add_order("NACH OST")
|
u1:add_order("NACH OST")
|
||||||
|
@ -849,7 +849,7 @@ function test_silver_weight_stops_ship()
|
||||||
local r1 = region.create(1, 1, "ocean")
|
local r1 = region.create(1, 1, "ocean")
|
||||||
local r2 = region.create(2, 1, "ocean")
|
local r2 = region.create(2, 1, "ocean")
|
||||||
region.create(3, 1, "ocean")
|
region.create(3, 1, "ocean")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
u1:set_skill("sailing", 3)
|
u1:set_skill("sailing", 3)
|
||||||
local s1 = ship.create(r1, "canoe")
|
local s1 = ship.create(r1, "canoe")
|
||||||
|
@ -866,7 +866,7 @@ end
|
||||||
|
|
||||||
function test_building_owner_can_enter_ship()
|
function test_building_owner_can_enter_ship()
|
||||||
local r1 = region.create(1, 2, "plain")
|
local r1 = region.create(1, 2, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local b1 = building.create(r1, "castle")
|
local b1 = building.create(r1, "castle")
|
||||||
b1.size = 10
|
b1.size = 10
|
||||||
local s1 = ship.create(r1, "cutter")
|
local s1 = ship.create(r1, "cutter")
|
||||||
|
@ -889,7 +889,7 @@ end
|
||||||
|
|
||||||
function test_only_building_owner_can_set_not_paid()
|
function test_only_building_owner_can_set_not_paid()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
local mine = building.create(r, "mine")
|
local mine = building.create(r, "mine")
|
||||||
|
@ -913,7 +913,7 @@ end
|
||||||
|
|
||||||
function test_spyreport_message()
|
function test_spyreport_message()
|
||||||
local r1 = region.create(1, 2, "plain")
|
local r1 = region.create(1, 2, "plain")
|
||||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
local f1 = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r1, 1)
|
local u1 = unit.create(f1, r1, 1)
|
||||||
local u2 = unit.create(f1, r1, 1)
|
local u2 = unit.create(f1, r1, 1)
|
||||||
msg = message.create("spyreport")
|
msg = message.create("spyreport")
|
||||||
|
@ -940,7 +940,7 @@ function test_bug2083()
|
||||||
r:set_resource("peasant", 2000)
|
r:set_resource("peasant", 2000)
|
||||||
r.luxury = "balm"
|
r.luxury = "balm"
|
||||||
|
|
||||||
local f = faction.create("2083@eressea.de", "human", "de")
|
local f = faction.create("human", "2083@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:set_skill("building", 8)
|
u:set_skill("building", 8)
|
||||||
u:add_item("stone", 100)
|
u:add_item("stone", 100)
|
||||||
|
@ -967,7 +967,7 @@ function test_bug2083()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_no_uruk()
|
function test_no_uruk()
|
||||||
local f1 = faction.create("noreply@eressea.de", "uruk", "de")
|
local f1 = faction.create("uruk", "noreply@eressea.de", "de")
|
||||||
assert_equal(f1.race, "orc")
|
assert_equal(f1.race, "orc")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ function test_bug2187()
|
||||||
set_rule("rules.food.flags", "0")
|
set_rule("rules.food.flags", "0")
|
||||||
|
|
||||||
local r = region.create(0,0,"plain")
|
local r = region.create(0,0,"plain")
|
||||||
local f = faction.create("2187@eressea.de", "goblin", "de")
|
local f = faction.create("goblin", "2187@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.race = "demon"
|
u.race = "demon"
|
||||||
u.hp = u.hp_max * u.number
|
u.hp = u.hp_max * u.number
|
||||||
|
|
|
@ -11,7 +11,7 @@ function setup()
|
||||||
eressea.settings.set("rules.food.flags", "4")
|
eressea.settings.set("rules.food.flags", "4")
|
||||||
|
|
||||||
r = region.create(0, 0, "plain")
|
r = region.create(0, 0, "plain")
|
||||||
f = faction.create("spell_payment@eressea.de", "elf", "de")
|
f = faction.create("elf", "spell_payment@eressea.de", "de")
|
||||||
u = unit.create(f, r, 1)
|
u = unit.create(f, r, 1)
|
||||||
u.magic = "gray"
|
u.magic = "gray"
|
||||||
u:set_skill("magic", 12)
|
u:set_skill("magic", 12)
|
||||||
|
|
|
@ -11,7 +11,7 @@ end
|
||||||
|
|
||||||
function test_blessedharvest_lasts_n_turn()
|
function test_blessedharvest_lasts_n_turn()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "halfling", "de")
|
local f = faction.create("halfling", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
local err = 0
|
local err = 0
|
||||||
r:set_resource("peasant", 100)
|
r:set_resource("peasant", 100)
|
||||||
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
function test_magic()
|
function test_magic()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "halfling", "de")
|
local f = faction.create("halfling", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r)
|
local u = unit.create(f, r)
|
||||||
local b = building.create(r, "castle")
|
local b = building.create(r, "castle")
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ function setup()
|
||||||
eressea.settings.set("rules.food.flags", "4")
|
eressea.settings.set("rules.food.flags", "4")
|
||||||
|
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
f = faction.create("stealth1@eressea.de", "human", "de")
|
f = faction.create("human", "stealth1@eressea.de", "de")
|
||||||
u = unit.create(f, r, 1)
|
u = unit.create(f, r, 1)
|
||||||
f = faction.create("stealth2@eressea.de", "human", "de")
|
f = faction.create("human", "stealth2@eressea.de", "de")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_stealth_faction_on()
|
function test_stealth_faction_on()
|
||||||
|
|
|
@ -11,6 +11,50 @@ function setup()
|
||||||
eressea.settings.set("rules.encounters", "0")
|
eressea.settings.set("rules.encounters", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_mine_bonus()
|
||||||
|
local r = region.create(0, 0, "mountain")
|
||||||
|
r:set_resource("iron", 100)
|
||||||
|
local level = r:get_resourcelevel("iron")
|
||||||
|
assert_equal(1, level)
|
||||||
|
local u = unit.create(faction.create("human"), r)
|
||||||
|
u.number = 10
|
||||||
|
u:set_skill("mining", 1)
|
||||||
|
u:add_order("MACHE EISEN")
|
||||||
|
process_orders()
|
||||||
|
assert_equal(10, u:get_item("iron"))
|
||||||
|
assert_equal(90, r:get_resource("iron"))
|
||||||
|
|
||||||
|
u.building = building.create(r, "mine")
|
||||||
|
u.building.size = 10
|
||||||
|
u:add_item("money", 500) -- maintenance
|
||||||
|
process_orders()
|
||||||
|
assert_equal(30, u:get_item("iron"))
|
||||||
|
assert_equal(80, r:get_resource("iron"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function test_mine_example()
|
||||||
|
local r = region.create(0, 0, "mountain")
|
||||||
|
r:set_resource("iron", 100)
|
||||||
|
local level = r:get_resourcelevel("iron")
|
||||||
|
assert_equal(1, level)
|
||||||
|
local u = unit.create(faction.create("dwarf"), r)
|
||||||
|
assert_equal("dwarf", u.faction.race)
|
||||||
|
assert_equal("dwarf", u.race)
|
||||||
|
u.faction.name = "Zwerge"
|
||||||
|
u.number = 10
|
||||||
|
u:set_skill("mining", 1)
|
||||||
|
u:add_order("MACHE EISEN")
|
||||||
|
process_orders()
|
||||||
|
assert_equal(30, u:get_item("iron"))
|
||||||
|
assert_equal(82, r:get_resource("iron"))
|
||||||
|
u.building = building.create(r, "mine")
|
||||||
|
u.building.size = 10
|
||||||
|
u:add_item("money", 500) -- maintenance
|
||||||
|
process_orders()
|
||||||
|
assert_equal(70, u:get_item("iron"))
|
||||||
|
assert_equal(70, r:get_resource("iron"))
|
||||||
|
end
|
||||||
|
|
||||||
function test_no_guards()
|
function test_no_guards()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
r:set_resource("tree", 100)
|
r:set_resource("tree", 100)
|
||||||
|
|
|
@ -12,7 +12,7 @@ function setup()
|
||||||
}]]
|
}]]
|
||||||
eressea.config.reset()
|
eressea.config.reset()
|
||||||
assert(eressea.config.parse(conf)==0)
|
assert(eressea.config.parse(conf)==0)
|
||||||
f = faction.create("faction@eressea.de", "human", "de")
|
f = faction.create("human", "faction@eressea.de", "de")
|
||||||
assert(f~=nil)
|
assert(f~=nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ end
|
||||||
|
|
||||||
function test_mistletoe_okay()
|
function test_mistletoe_okay()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
turn_begin()
|
turn_begin()
|
||||||
u:add_item('mistletoe', 2)
|
u:add_item('mistletoe', 2)
|
||||||
|
@ -29,7 +29,7 @@ end
|
||||||
|
|
||||||
function test_mistletoe_fail()
|
function test_mistletoe_fail()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
turn_begin()
|
turn_begin()
|
||||||
u:add_item('mistletoe', 1)
|
u:add_item('mistletoe', 1)
|
||||||
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
function test_dreameye()
|
function test_dreameye()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("dreameye", 2)
|
u:add_item("dreameye", 2)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -63,7 +63,7 @@ end
|
||||||
|
|
||||||
function test_manacrystal()
|
function test_manacrystal()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("manacrystal", 2)
|
u:add_item("manacrystal", 2)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -81,7 +81,7 @@ end
|
||||||
|
|
||||||
function test_skillpotion()
|
function test_skillpotion()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("skillpotion", 2)
|
u:add_item("skillpotion", 2)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -93,7 +93,7 @@ end
|
||||||
|
|
||||||
function test_studypotion()
|
function test_studypotion()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
turn_begin()
|
turn_begin()
|
||||||
u:add_item("studypotion", 2)
|
u:add_item("studypotion", 2)
|
||||||
|
@ -109,7 +109,7 @@ end
|
||||||
|
|
||||||
function test_antimagic()
|
function test_antimagic()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
|
|
||||||
turn_begin()
|
turn_begin()
|
||||||
|
@ -129,7 +129,7 @@ end
|
||||||
|
|
||||||
function test_ointment()
|
function test_ointment()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local hp = u.hp
|
local hp = u.hp
|
||||||
u.hp = 1
|
u.hp = 1
|
||||||
|
@ -144,7 +144,7 @@ end
|
||||||
|
|
||||||
function test_bloodpotion_demon()
|
function test_bloodpotion_demon()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "demon", "de")
|
local f = faction.create("demon", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("peasantblood", 1)
|
u:add_item("peasantblood", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -157,7 +157,7 @@ end
|
||||||
|
|
||||||
function test_bloodpotion_other()
|
function test_bloodpotion_other()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("peasantblood", 1)
|
u:add_item("peasantblood", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
|
|
@ -30,8 +30,8 @@ end
|
||||||
|
|
||||||
function test_force_leave_on()
|
function test_force_leave_on()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("owner@eressea.de")
|
local f1 = faction.create("human", "owner@eressea.de")
|
||||||
local f2 = faction.create("guest@eressea.de")
|
local f2 = faction.create("human", "guest@eressea.de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
local b1 = building.create(r, "castle")
|
local b1 = building.create(r, "castle")
|
||||||
|
@ -45,8 +45,8 @@ end
|
||||||
|
|
||||||
function test_force_leave_off()
|
function test_force_leave_off()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("owner@eressea.de")
|
local f1 = faction.create("human", "owner@eressea.de")
|
||||||
local f2 = faction.create("guest@eressea.de")
|
local f2 = faction.create("human", "guest@eressea.de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
local b1 = building.create(r, "castle")
|
local b1 = building.create(r, "castle")
|
||||||
|
@ -60,7 +60,7 @@ end
|
||||||
|
|
||||||
function test_make_temp()
|
function test_make_temp()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("owner@eressea.de", "human", "de")
|
local f1 = faction.create("human", "owner@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
local u, u2
|
local u, u2
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ end
|
||||||
|
|
||||||
function test_force_leave_postcombat()
|
function test_force_leave_postcombat()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f1 = faction.create("owner@eressea.de", "human", "de")
|
local f1 = faction.create("human", "owner@eressea.de", "de")
|
||||||
local f2 = faction.create("guest@eressea.de", "human", "de")
|
local f2 = faction.create("human", "guest@eressea.de", "de")
|
||||||
local u1 = unit.create(f1, r, 10)
|
local u1 = unit.create(f1, r, 10)
|
||||||
local u2 = unit.create(f2, r, 10)
|
local u2 = unit.create(f2, r, 10)
|
||||||
local u, u3
|
local u, u3
|
||||||
|
|
|
@ -6,7 +6,7 @@ local u
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
u = unit.create(faction.create("test@example.com", "human", "de"), region.create(0, 0, "plain"), 1)
|
u = unit.create(faction.create("human", "test@example.com", "de"), region.create(0, 0, "plain"), 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_magicbag_weight()
|
function test_magicbag_weight()
|
||||||
|
|
|
@ -48,7 +48,7 @@ end
|
||||||
function test_walk_to_land()
|
function test_walk_to_land()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local f = faction.create("walk@example.com", "human", "de")
|
local f = faction.create("human", "walk@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_order("NACH O")
|
u:add_order("NACH O")
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -58,7 +58,7 @@ end
|
||||||
function test_walk_into_ocean_fails()
|
function test_walk_into_ocean_fails()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_order("NACH O")
|
u:add_order("NACH O")
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -69,7 +69,7 @@ function test_walk_distance()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_order("NACH O O")
|
u:add_order("NACH O O")
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -81,7 +81,7 @@ function test_ride_max_distance()
|
||||||
local r2 = region.create(2, 0, "plain")
|
local r2 = region.create(2, 0, "plain")
|
||||||
region.create(1, 0, "plain")
|
region.create(1, 0, "plain")
|
||||||
region.create(3, 0, "plain")
|
region.create(3, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_item("horse", 1)
|
u:add_item("horse", 1)
|
||||||
u:set_skill("riding", 2)
|
u:set_skill("riding", 2)
|
||||||
|
@ -94,7 +94,7 @@ function test_ride_over_capacity_leads_horse()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 3)
|
local u = unit.create(f, r1, 3)
|
||||||
u:add_item("horse", 1)
|
u:add_item("horse", 1)
|
||||||
u:set_skill("riding", 2)
|
u:set_skill("riding", 2)
|
||||||
|
@ -107,7 +107,7 @@ function test_ride_no_skill_leads_horse()
|
||||||
local r1 = region.create(0, 0, "plain")
|
local r1 = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
region.create(2, 0, "plain")
|
region.create(2, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_item("horse", 1)
|
u:add_item("horse", 1)
|
||||||
u:add_order("NACH O O")
|
u:add_order("NACH O O")
|
||||||
|
|
|
@ -12,7 +12,7 @@ local r, f, u
|
||||||
function setup()
|
function setup()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
r = _G.region.create(0, 0, "mountain")
|
r = _G.region.create(0, 0, "mountain")
|
||||||
f = _G.faction.create("noreply@eressea.de", "human", "de")
|
f = _G.faction.create("human", "noreply@eressea.de", "de")
|
||||||
u = _G.unit.create(f, r, 1)
|
u = _G.unit.create(f, r, 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
eressea.settings.set("rules.food.flags", "4")
|
eressea.settings.set("rules.food.flags", "4")
|
||||||
|
|
|
@ -33,7 +33,7 @@ end
|
||||||
|
|
||||||
function test_give_nopool()
|
function test_give_nopool()
|
||||||
local r = region.create(1, 1, "plain")
|
local r = region.create(1, 1, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
u1:add_item("money", 100)
|
u1:add_item("money", 100)
|
||||||
|
@ -45,7 +45,7 @@ end
|
||||||
|
|
||||||
function test_give_from_faction()
|
function test_give_from_faction()
|
||||||
local r = region.create(1, 1, "plain")
|
local r = region.create(1, 1, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = unit.create(f, r, 1)
|
local u1 = unit.create(f, r, 1)
|
||||||
local u2 = unit.create(f, r, 1)
|
local u2 = unit.create(f, r, 1)
|
||||||
local u3 = unit.create(f, r, 1)
|
local u3 = unit.create(f, r, 1)
|
||||||
|
@ -62,8 +62,8 @@ function test_give_divisor()
|
||||||
eressea.settings.set("rules.items.give_divisor", 2)
|
eressea.settings.set("rules.items.give_divisor", 2)
|
||||||
eressea.settings.set("GiveRestriction", 0)
|
eressea.settings.set("GiveRestriction", 0)
|
||||||
local r = region.create(1, 1, "plain")
|
local r = region.create(1, 1, "plain")
|
||||||
local f1 = faction.create("test@example.com", "human", "de")
|
local f1 = faction.create("human", "test@example.com", "de")
|
||||||
local f2 = faction.create("test@example.com", "human", "de")
|
local f2 = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = unit.create(f1, r, 1)
|
local u1 = unit.create(f1, r, 1)
|
||||||
local u2 = unit.create(f2, r, 1)
|
local u2 = unit.create(f2, r, 1)
|
||||||
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
|
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
|
||||||
|
|
|
@ -7,7 +7,7 @@ local u, r, f,turn
|
||||||
function setup()
|
function setup()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
r = region.create(0, 0, "plain")
|
r = region.create(0, 0, "plain")
|
||||||
f = faction.create("bernd@eressea.de", "human", "de")
|
f = faction.create("human", "bernd@eressea.de", "de")
|
||||||
u = unit.create(f, r, 1)
|
u = unit.create(f, r, 1)
|
||||||
u:add_item("money", 10)
|
u:add_item("money", 10)
|
||||||
turn = get_turn()
|
turn = get_turn()
|
||||||
|
|
|
@ -36,7 +36,7 @@ end
|
||||||
function test_coordinates_unnamed_plane()
|
function test_coordinates_unnamed_plane()
|
||||||
local p = plane.create(0, -3, -3, 7, 7)
|
local p = plane.create(0, -3, -3, 7, 7)
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("unnamed@eressea.de", "human", "de")
|
local f = faction.create("human", "unnamed@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
init_reports()
|
init_reports()
|
||||||
write_report(f)
|
write_report(f)
|
||||||
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
function test_coordinates_no_plane()
|
function test_coordinates_no_plane()
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("noplane@eressea.de", "human", "de")
|
local f = faction.create("human", "noplane@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
init_reports()
|
init_reports()
|
||||||
write_report(f)
|
write_report(f)
|
||||||
|
@ -56,7 +56,7 @@ end
|
||||||
|
|
||||||
function test_show_shadowmaster_attacks()
|
function test_show_shadowmaster_attacks()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.race = "shadowmaster"
|
u.race = "shadowmaster"
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -71,7 +71,7 @@ end
|
||||||
function test_coordinates_named_plane()
|
function test_coordinates_named_plane()
|
||||||
local p = plane.create(0, -3, -3, 7, 7, "Hell")
|
local p = plane.create(0, -3, -3, 7, 7, "Hell")
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
init_reports()
|
init_reports()
|
||||||
write_report(f)
|
write_report(f)
|
||||||
|
@ -82,7 +82,7 @@ end
|
||||||
function test_coordinates_noname_plane()
|
function test_coordinates_noname_plane()
|
||||||
local p = plane.create(0, -3, -3, 7, 7, "")
|
local p = plane.create(0, -3, -3, 7, 7, "")
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
init_reports()
|
init_reports()
|
||||||
write_report(f)
|
write_report(f)
|
||||||
|
@ -93,7 +93,7 @@ end
|
||||||
function test_lighthouse()
|
function test_lighthouse()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
local r = region.create(0, 0, "mountain")
|
local r = region.create(0, 0, "mountain")
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
region.create(1, 0, "mountain")
|
region.create(1, 0, "mountain")
|
||||||
region.create(2, 0, "ocean")
|
region.create(2, 0, "ocean")
|
||||||
region.create(0, 1, "firewall")
|
region.create(0, 1, "firewall")
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
function test_store_unit()
|
function test_store_unit()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("noreply15@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply15@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
local fid = f.id
|
local fid = f.id
|
||||||
u:add_item("money", u.number * 100)
|
u:add_item("money", u.number * 100)
|
||||||
|
@ -20,7 +20,7 @@ function test_store_unit()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
-- recreate world:
|
-- recreate world:
|
||||||
r = region.create(0, 0, "plain")
|
r = region.create(0, 0, "plain")
|
||||||
f = faction.create("noreply16@eressea.de", "human", "de")
|
f = faction.create("human", "noreply16@eressea.de", "de")
|
||||||
f.id = fid
|
f.id = fid
|
||||||
store = storage.create(filename, "rb")
|
store = storage.create(filename, "rb")
|
||||||
assert_not_nil(store)
|
assert_not_nil(store)
|
||||||
|
|
|
@ -24,7 +24,7 @@ end
|
||||||
|
|
||||||
function test_study()
|
function test_study()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_order("LERNEN Armbrust")
|
u:add_order("LERNEN Armbrust")
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -33,7 +33,7 @@ end
|
||||||
|
|
||||||
function test_study_expensive()
|
function test_study_expensive()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
eressea.settings.set("skills.cost.alchemy", "50")
|
eressea.settings.set("skills.cost.alchemy", "50")
|
||||||
eressea.settings.set("rules.encounters", "0")
|
eressea.settings.set("rules.encounters", "0")
|
||||||
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
function test_unit_spells()
|
function test_unit_spells()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u.magic = "gray"
|
u.magic = "gray"
|
||||||
u:set_skill("magic", 1)
|
u:set_skill("magic", 1)
|
||||||
|
@ -76,7 +76,7 @@ end
|
||||||
|
|
||||||
function test_study_no_teacher()
|
function test_study_no_teacher()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = make_student(f, r, 1)
|
local u1 = make_student(f, r, 1)
|
||||||
u1:set_skill("crossbow", 1)
|
u1:set_skill("crossbow", 1)
|
||||||
process_orders()
|
process_orders()
|
||||||
|
@ -85,7 +85,7 @@ end
|
||||||
|
|
||||||
function test_study_with_teacher()
|
function test_study_with_teacher()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = make_student(f, r, 1)
|
local u1 = make_student(f, r, 1)
|
||||||
|
|
||||||
make_teacher(u1)
|
make_teacher(u1)
|
||||||
|
@ -96,7 +96,7 @@ end
|
||||||
|
|
||||||
function test_study_too_many_students()
|
function test_study_too_many_students()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = make_student(f, r, 20, "Taktik")
|
local u1 = make_student(f, r, 20, "Taktik")
|
||||||
u1.name = "Student"
|
u1.name = "Student"
|
||||||
u1:add_item("money", 201*u1.number)
|
u1:add_item("money", 201*u1.number)
|
||||||
|
@ -107,7 +107,7 @@ end
|
||||||
|
|
||||||
function test_study_multiple_teachers()
|
function test_study_multiple_teachers()
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("test@example.com", "human", "de")
|
local f = faction.create("human", "test@example.com", "de")
|
||||||
local u1 = make_student(f, r, 20, "Taktik")
|
local u1 = make_student(f, r, 20, "Taktik")
|
||||||
u1.name = "Student"
|
u1.name = "Student"
|
||||||
u1:add_item("money", 201*u1.number)
|
u1:add_item("money", 201*u1.number)
|
||||||
|
|
|
@ -15,7 +15,7 @@ end
|
||||||
function test_snowglobe_fail()
|
function test_snowglobe_fail()
|
||||||
local r1 = region.create(0, 0, "glacier")
|
local r1 = region.create(0, 0, "glacier")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("snowglobe1@eressea.de", "human", "de")
|
local f = faction.create("human", "snowglobe1@eressea.de", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_item("snowglobe", 1)
|
u:add_item("snowglobe", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -30,7 +30,7 @@ end
|
||||||
function test_snowglobe_missing_direction()
|
function test_snowglobe_missing_direction()
|
||||||
local r1 = region.create(0, 0, "glacier")
|
local r1 = region.create(0, 0, "glacier")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("snowglobe1@eressea.de", "human", "de")
|
local f = faction.create("human", "snowglobe1@eressea.de", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
u:add_item("snowglobe", 1)
|
u:add_item("snowglobe", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
@ -44,7 +44,7 @@ end
|
||||||
function test_snowglobe()
|
function test_snowglobe()
|
||||||
local r1 = region.create(0, 0, "glacier")
|
local r1 = region.create(0, 0, "glacier")
|
||||||
local r2 = region.create(1, 0, "ocean")
|
local r2 = region.create(1, 0, "ocean")
|
||||||
local f = faction.create("snowglobe2@eressea.de", "human", "de")
|
local f = faction.create("human", "snowglobe2@eressea.de", "de")
|
||||||
local u = unit.create(f, r1, 1)
|
local u = unit.create(f, r1, 1)
|
||||||
local fail = 0
|
local fail = 0
|
||||||
u:add_item("snowglobe", have)
|
u:add_item("snowglobe", have)
|
||||||
|
@ -62,7 +62,7 @@ end
|
||||||
|
|
||||||
local function use_tree(terrain)
|
local function use_tree(terrain)
|
||||||
local r = region.create(0, 0, terrain)
|
local r = region.create(0, 0, terrain)
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u1 = unit.create(f, r, 5)
|
local u1 = unit.create(f, r, 5)
|
||||||
r:set_resource("tree", 0)
|
r:set_resource("tree", 0)
|
||||||
u1:add_item("xmastree", 1)
|
u1:add_item("xmastree", 1)
|
||||||
|
@ -86,7 +86,7 @@ function test_stardust()
|
||||||
eressea.settings.set("rules.economy.repopulate_maximum", 0)
|
eressea.settings.set("rules.economy.repopulate_maximum", 0)
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
r:set_resource("peasant", 10)
|
r:set_resource("peasant", 10)
|
||||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
local f = faction.create("human", "noreply@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 5)
|
local u = unit.create(f, r, 5)
|
||||||
u:add_item("stardust", 1)
|
u:add_item("stardust", 1)
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
|
|
|
@ -401,8 +401,8 @@ static int tolua_faction_get(lua_State * L)
|
||||||
|
|
||||||
static int tolua_faction_create(lua_State * L)
|
static int tolua_faction_create(lua_State * L)
|
||||||
{
|
{
|
||||||
const char *email = tolua_tostring(L, 1, 0);
|
const char *racename = tolua_tostring(L, 1, 0);
|
||||||
const char *racename = tolua_tostring(L, 2, 0);
|
const char *email = tolua_tostring(L, 2, 0);
|
||||||
const char *lang = tolua_tostring(L, 3, 0);
|
const char *lang = tolua_tostring(L, 3, 0);
|
||||||
struct locale *loc = lang ? get_locale(lang) : default_locale;
|
struct locale *loc = lang ? get_locale(lang) : default_locale;
|
||||||
faction *f = NULL;
|
faction *f = NULL;
|
||||||
|
|
|
@ -813,7 +813,7 @@ static void manufacture(unit * u, const item_type * itype, int want)
|
||||||
|
|
||||||
skill = effskill(u, sk, 0);
|
skill = effskill(u, sk, 0);
|
||||||
skill =
|
skill =
|
||||||
skillmod(itype->rtype->attribs, u, u->region, sk, skill, SMF_PRODUCTION);
|
skillmod(itype->construction->attribs, u, u->region, sk, skill, SMF_PRODUCTION);
|
||||||
|
|
||||||
if (skill < 0) {
|
if (skill < 0) {
|
||||||
/* an error occured */
|
/* an error occured */
|
||||||
|
|
|
@ -123,6 +123,7 @@ void free_buildingtypes(void) {
|
||||||
|
|
||||||
building_type *bt_get_or_create(const char *name)
|
building_type *bt_get_or_create(const char *name)
|
||||||
{
|
{
|
||||||
|
assert(name && name[0]);
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
building_type *btype = bt_find_i(name);
|
building_type *btype = bt_find_i(name);
|
||||||
if (btype == NULL) {
|
if (btype == NULL) {
|
||||||
|
|
|
@ -79,7 +79,6 @@ extern "C" {
|
||||||
struct rawmaterial_type *raw;
|
struct rawmaterial_type *raw;
|
||||||
struct resource_mod *modifiers;
|
struct resource_mod *modifiers;
|
||||||
/* --- pointers --- */
|
/* --- pointers --- */
|
||||||
struct attrib *attribs;
|
|
||||||
struct item_type *itype;
|
struct item_type *itype;
|
||||||
struct potion_type *ptype;
|
struct potion_type *ptype;
|
||||||
struct luxury_type *ltype;
|
struct luxury_type *ltype;
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
|
|
||||||
#include <skill.h>
|
#include <skill.h>
|
||||||
|
|
||||||
|
struct race;
|
||||||
|
struct unit;
|
||||||
|
struct region;
|
||||||
|
struct attrib;
|
||||||
|
struct attrib_type;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue