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:
Enno Rehling 2017-03-17 22:31:59 +01:00
parent beb498d70c
commit 4c67e0603b
39 changed files with 284 additions and 234 deletions

View file

@ -61,7 +61,7 @@ end
local function seed(r, email, race, lang)
assert(r)
local f = faction.create(email, race, lang)
local f = faction.create(race, email, lang)
assert(f)
local u = unit.create(f, r)
assert(u)

View file

@ -17,8 +17,8 @@ local function two_units(r, f1, f2)
end
local function two_factions()
local f1 = faction.create("one@eressea.de", "human", "de")
local f2 = faction.create("two@eressea.de", "elf", "de")
local f1 = faction.create("human", "one@eressea.de", "de")
local f2 = faction.create("elf", "two@eressea.de", "de")
return f1, f2
end
@ -44,7 +44,7 @@ end
function test_flags()
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 no = itoa36(f.id)
local flags = 50332673
@ -62,7 +62,7 @@ function test_elvenhorse_requires_riding_5()
local r = region.create(0, 0, "plain")
region.create(1, 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)
u:add_item("elvenhorse", 1)
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 goal = region.create(1, 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)
u:add_item("elvenhorse", 1)
u:set_skill("riding", 5) -- halfling has -1 modifier
@ -96,7 +96,7 @@ end
function test_demon_food()
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 p = r:get_resource("peasant")
r:set_resource("peasant", 2000)
@ -136,7 +136,7 @@ function test_plane()
local nx, ny = plane.normalize(pl, 4, 4)
assert_equal(nx, -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")
local r, x, y
for x = -3, 3 do for y = -3, 3 do
@ -155,7 +155,7 @@ end
function test_read_write()
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)
u.number = 2
local fno = f.id
@ -184,7 +184,7 @@ end
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 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 s = _test_create_ship(r)
local b = building.create(r, "castle")
@ -236,7 +236,7 @@ end
function test_faction()
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)
f.info = "Spazz"
assert(f.info=="Spazz")
@ -259,7 +259,7 @@ end
function test_unit()
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)
u.number = 20
u.name = "Enno"
@ -292,7 +292,7 @@ end
function test_building()
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 b = building.create(r, "castle")
u = unit.create(f, r)
@ -318,7 +318,7 @@ end
function test_message()
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 msg = message.create("item_create_spell")
msg:set_unit("mage", u)
@ -346,7 +346,7 @@ function test_events()
plain = region.create(0, 0, "plain")
skill = 8
f = faction.create("noreply2@eressea.de", "elf", "de")
f = faction.create("elf", "noreply2@eressea.de", "de")
f.age = 20
u = unit.create(f, plain)
@ -356,7 +356,7 @@ function test_events()
u:add_order("NUMMER PARTEI test")
u:add_handler("message", msg_handler)
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
u = unit.create(f, plain)
@ -371,7 +371,7 @@ end
function test_renumber_ship()
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 s = ship.create(r, config.ships[1])
u.ship = s
@ -386,7 +386,7 @@ end
function test_recruit2()
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)
u.number = 1
u:add_item("money", 2000)
@ -401,7 +401,7 @@ end
function test_guard()
region.create(1, 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
local u1 = unit.create(f1, r, 10)
u1:add_item("sword", 10)
@ -411,7 +411,7 @@ function test_guard()
u1:add_order("NACH O")
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
local u2 = unit.create(f2, r, 1)
local u3 = unit.create(f2, r, 1)
@ -429,7 +429,7 @@ end
function test_recruit()
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)
u.number = 1
local n = 3
@ -445,7 +445,7 @@ end
function test_produce()
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)
u:clear_orders()
local sword = config.get_resource('sword')
@ -460,7 +460,7 @@ end
function test_work()
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)
u:add_item("money", u.number * 10) -- humans cost 10
u:set_skill("herbalism", 5)
@ -473,7 +473,7 @@ end
function test_upkeep()
eressea.settings.set("rules.food.flags", "0")
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)
u:add_item("money", u.number * 11)
u:clear_orders()
@ -485,7 +485,7 @@ end
function test_id()
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")
assert_not_equal(f, get_faction(42))
assert_equal(f, get_faction("42"))
@ -521,7 +521,7 @@ function test_mallorn()
m:set_resource("tree", 100)
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)
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 pe = plane.create(1, -8761, 3620, 23, 23) -- eternath
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_equal(r.x, 1000)
assert_equal(r.y, 1000)
@ -604,8 +604,8 @@ end
function test_building_other()
local r = region.create(0,0, "plain")
local f1 = faction.create("noreply17@eressea.de", "human", "de")
local f2 = faction.create("noreply18@eressea.de", "human", "de")
local f1 = faction.create("human", "noreply17@eressea.de", "de")
local f2 = faction.create("human", "noreply18@eressea.de", "de")
local b = building.create(r, "castle")
b.size = 10
local u1 = unit.create(f1, r, 3)
@ -632,7 +632,7 @@ end
local function _test_create_laen()
eressea.settings.set("rules.terraform.all", "1")
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)
r:set_resource("laen", 50)
return r, u1
@ -671,7 +671,7 @@ end
function test_mine()
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)
u1:add_item("money", 1000)
@ -692,9 +692,9 @@ end
function test_guard_resources()
-- this is not quite http://bugs.eressea.de/view.php?id=1756
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
local f2 = faction.create("noreply22@eressea.de", "human", "de")
local f2 = faction.create("human", "noreply22@eressea.de", "de")
f2.age=20
local u1 = unit.create(f1, r, 1)
u1:add_item("money", 100)
@ -722,7 +722,7 @@ end
function test_hero_hero_transfer()
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
local UFL_HERO = 128
@ -743,7 +743,7 @@ end
function test_hero_normal_transfer()
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
local UFL_HERO = 128
@ -762,7 +762,7 @@ end
function test_expensive_skills_cost_money()
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)
u:add_item("money", 10000)
u:clear_orders()
@ -775,7 +775,7 @@ end
function test_food_is_consumed()
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)
u:add_item("money", 100)
u:clear_orders()
@ -787,7 +787,7 @@ end
function test_food_can_override()
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)
u:add_item("money", 100)
u:clear_orders()
@ -799,7 +799,7 @@ end
function test_swim_and_survive()
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"
local u = unit.create(f, r, 1)
process_orders()
@ -813,7 +813,7 @@ end
function test_swim_and_die()
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 uid = u.id
process_orders()
@ -828,7 +828,7 @@ function test_ride_with_horse()
region.create(1, 0, "plain")
region.create(2, 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)
u:add_item("horse", 1)
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(2, 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 horse_cfg = config.get_resource("horse")
local cart_cfg = config.get_resource("cart")
@ -904,7 +904,7 @@ function test_walk_and_carry_the_cart()
region.create(1, 0, "plain")
local r = region.create(2, 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)
u:add_item("cart", 1)
@ -925,7 +925,7 @@ end
function test_bug_1795_limit()
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)
u1:add_item("money", 100000000)
u1:add_order("REKRUTIEREN 9999")
@ -940,7 +940,7 @@ end
function test_bug_1795_demons()
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)
r:set_resource("peasant", 2000)
local peasants = r:get_resource("peasant")
@ -966,7 +966,7 @@ end
function test_parser()
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 filename = "orders.txt"
@ -991,7 +991,7 @@ end
function test_prefix()
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)
set_order(u1, "PRAEFIX See")
@ -1018,7 +1018,7 @@ end
function test_recruit()
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)
u:add_item("money", 1000)
@ -1031,7 +1031,7 @@ end
function test_give_horses()
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)
r:set_resource("horse", 0)
@ -1047,7 +1047,7 @@ end
function test_give_silver()
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)
r:set_resource("peasant", 0)

View file

@ -11,7 +11,7 @@ function test_read_race()
eressea.free_game()
assert_not_nil(eressea.config)
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)
end

View file

@ -10,7 +10,7 @@ end
function disabled_test_dont_move_after_destroy()
local r1 = region.create(0, 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)
u.building = building.create(u.region, "castle")
u:clear_orders()
@ -26,8 +26,8 @@ end
function test_dont_destroy_after_attack()
local r1 = region.create(0, 0, "plain")
local u = unit.create(faction.create("one@example.com", "human", "de"), r1, 10)
local u2 = unit.create(faction.create("two@example.com", "human", "de"), r1, 1)
local u = unit.create(faction.create("human", "one@example.com", "de"), r1, 10)
local u2 = unit.create(faction.create("human", "two@example.com", "de"), r1, 1)
u.building = building.create(u.region, "castle")
u:clear_orders()
u:add_order("ATTACKIERE " .. itoa36(u2.id))
@ -38,7 +38,7 @@ end
function test_destroy_is_long()
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:clear_orders()
u:add_order("LERNE Unterhaltung")

View file

@ -18,7 +18,7 @@ end
function test_herbalism()
-- OBS: herbalism is currently an E2-only skill
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)
eressea.settings.set("rules.grow.formula", 0) -- plants do not grow
@ -42,7 +42,7 @@ end
function test_build_harbour()
-- try to reproduce mantis bug 2221
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)
size = 30
u.number = 20
@ -70,8 +70,8 @@ local function one_unit(r, f)
end
local function two_factions()
local f1 = faction.create("one@eressea.de", "human", "de")
local f2 = faction.create("two@eressea.de", "human", "de")
local f1 = faction.create("human", "one@eressea.de", "de")
local f2 = faction.create("human", "two@eressea.de", "de")
return f1, f2
end
@ -82,7 +82,7 @@ end
function test_learn()
eressea.settings.set("study.random_progress", "0")
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
local u = unit.create(f, r)
u:clear_orders()
@ -101,7 +101,7 @@ end
function test_teach()
eressea.settings.set("study.random_progress", "0")
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
local u = unit.create(f, r, 10)
local u2 = unit.create(f, r)
@ -118,7 +118,7 @@ end
function test_rename()
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)
u:add_item("aoh", 1)
assert_equal(u:get_item("ao_healing"), 1)
@ -126,7 +126,7 @@ end
function test_unit_limit_is_1500()
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
unit.create(f, r, 1)
end
@ -142,7 +142,7 @@ function test_ship_capacity()
local r = region.create(0,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("capacity@eressea.de", "human", "de")
local f = faction.create("human", "capacity@eressea.de", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "boat")
@ -179,7 +179,7 @@ end
function test_levitate()
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 s = ship.create(r, "boat")
u.ship = s
@ -205,15 +205,15 @@ end
function test_races()
local races = { "wolf", "orc", "human", "demon" }
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)
end
end
function test_can_give_person()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f1 = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
@ -231,7 +231,7 @@ function test_can_give_person()
end
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")
end
@ -326,7 +326,7 @@ end
function test_stonegolems()
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 u2 = unit.create(f1, r0, 2)
local c1 = building.create(r0, "castle")
@ -355,7 +355,7 @@ end
function test_birthdaycake()
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:add_item("birthdaycake", 1)
u:clear_orders()

View file

@ -11,7 +11,7 @@ end
function test_guard_unarmed()
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)
assert_equal(false, u1.guard)
u1:clear_orders()
@ -22,7 +22,7 @@ end
function test_guard_armed()
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)
assert_equal(false, u1.guard)
u1:add_item("sword", 1)
@ -36,10 +36,10 @@ end
function test_guard_allows_move_after_combat() -- bug 1493
local r1 = region.create(0, 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 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)
u1:add_order("BEWACHE")
u1:add_item("sword", 10)
@ -59,10 +59,10 @@ end
function test_no_guard_no_move_after_combat() -- bug 1493
local r1 = region.create(0, 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 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)
u1:add_order("BEWACHE")
u1:add_item("sword", 10)

View file

@ -13,7 +13,7 @@ end
function test_nestwarmth_insect()
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 flags = u.flags
u:add_item("nestwarmth", 2)
@ -29,7 +29,7 @@ end
function test_nestwarmth_other()
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 flags = u.flags
u:add_item("nestwarmth", 2)
@ -45,7 +45,7 @@ end
function test_meow()
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)
u:add_item("aoc", 1)
u:clear_orders()
@ -59,7 +59,7 @@ end
function test_aurapotion50()
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)
u:add_item("aurapotion50", 1)
u:set_skill('magic', 10);
@ -77,7 +77,7 @@ end
function test_bagpipe()
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)
turn_begin()
u:add_item("bagpipeoffear", 1)
@ -96,7 +96,7 @@ end
function test_speedsail()
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)
turn_begin()
@ -115,7 +115,7 @@ end
function test_foolpotion()
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)
turn_begin()
u:add_item("p7", 1)
@ -141,7 +141,7 @@ end
function test_snowman()
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)
u:add_item("snowman", 1)
u:clear_orders()

View file

@ -13,8 +13,8 @@ end
local r = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
local r3 = region.create(-1, 0, "ocean")
local f = faction.create("pirate@eressea.de", "human", "de")
local f2 = faction.create("elf@eressea.de", "human", "de")
local f = faction.create("human", "pirate@eressea.de", "de")
local f2 = faction.create("human", "elf@eressea.de", "de")
local u1 = unit.create(f, r2, 1)
local u2 = unit.create(f2, r3, 1)
@ -39,7 +39,7 @@ end
function test_dolphin_on_land()
local r1 = region.create(0, 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)
u1.race = "dolphin"
u1:clear_orders()
@ -51,7 +51,7 @@ end
function test_dolphin_to_land()
local r1 = region.create(0, 0, "ocean")
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)
u1.race = "dolphin"
u1:clear_orders()
@ -63,7 +63,7 @@ end
function test_dolphin_in_ocean()
local r1 = region.create(0, 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)
u1.race = "dolphin"
u1:clear_orders()
@ -75,7 +75,7 @@ end
function test_follow()
local r1 = region.create(0, 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 u2 = unit.create(f, r1, 1)
u1:clear_orders()
@ -93,7 +93,7 @@ function test_follow_ship()
local r1 = region.create(0, 0, "plain")
region.create(1, 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 u2 = unit.create(f, r1, 1)
u1:add_item("money", 100)

View file

@ -11,8 +11,8 @@ end
function test_landing1()
local ocean = region.create(1, 0, "ocean")
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local s = ship.create(ocean, "longboat")
local u1 = unit.create(f, ocean, 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 harbour = building.create(r, "harbour")
harbour.size = 25
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local s = ship.create(ocean, "longboat")
local u1 = unit.create(f, ocean, 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 harbour = building.create(r, "harbour")
harbour.size = 25
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local s = ship.create(ocean, "longboat")
local u1 = unit.create(f, ocean, 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 harbour = building.create(r, "harbour")
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 u1 = unit.create(f, ocean, 1)
local u2 = unit.create(f, r, 1)
@ -104,8 +104,8 @@ end
function test_landing_terrain()
local ocean = region.create(1, 0, "ocean")
local r = region.create(0, 0, "glacier")
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local s = ship.create(ocean, "longboat")
local u1 = unit.create(f, ocean, 1)
local u2 = unit.create(f2, r, 1)
@ -126,8 +126,8 @@ function test_landing_insects()
local r = region.create(0, 0, "glacier")
local harbour = building.create(r, "harbour")
harbour.size = 25
local f = faction.create("noreply@eressea.de", "insect", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f = faction.create("insect", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local s = ship.create(ocean, "longboat")
local u1 = unit.create(f, ocean, 1)
local u2 = unit.create(f2, r, 1)

View file

@ -11,7 +11,7 @@ end
function test_ship_requires_skill()
local r1 = region.create(0, 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)
u1.name = "fake"
u1.ship = ship.create(r1, "longboat")
@ -25,7 +25,7 @@ end
function no_test_ship_happy_case()
local r1 = region.create(0, 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 u2 = unit.create(f, r1, 1)
u1.ship = ship.create(r1, "longboat")

View file

@ -12,7 +12,7 @@ end
function test_shapeshift()
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 u2 = unit.create(f, r, 1)
u1:clear_orders()

View file

@ -21,9 +21,9 @@ function setup()
set_rule('rules.food.flags', '4')
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)
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
end

View file

@ -8,7 +8,7 @@ end
function test_undead_give_item()
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)
u1.race = "undead"
u1:clear_orders()
@ -20,7 +20,7 @@ end
function test_undead_dont_give_person()
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)
u1.race = "undead"
u1:clear_orders()

View file

@ -13,7 +13,7 @@ end
function test_build_watch()
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)
u.number = 20
@ -46,9 +46,9 @@ end
function test_small_castles()
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 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 b = building.create(r, "castle")
@ -65,7 +65,7 @@ end
function test_build_normal()
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)
u:clear_orders()
u:add_item("stone", 10)
@ -78,7 +78,7 @@ end
function test_build_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)
u:clear_orders()
u:add_item("stone", 10)
@ -90,7 +90,7 @@ end
function test_build_castle_stages()
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 b = building.create(r, "castle")

View file

@ -10,7 +10,7 @@ end
function test_give_horses()
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)
r:set_resource("horse", 0)
@ -23,9 +23,9 @@ end
function test_goblins()
local r = region.create(0, 0, "plain")
local f1 = faction.create("goblin@eressea.de", "goblin", "de")
local f2 = faction.create("dwarf@eressea.de", "dwarf", "de")
local f3 = faction.create("elf@eressea.de", "elf", "de")
local f1 = faction.create("goblin", "goblin@eressea.de", "de")
local f2 = faction.create("dwarf", "dwarf@eressea.de", "de")
local f3 = faction.create("elf", "elf@eressea.de", "de")
local ud = unit.create(f1, r, 1)
local uh = unit.create(f1, r, 1)
uh.race = "halfling"
@ -54,7 +54,7 @@ end
function test_make_horse()
eressea.settings.set("rules.horses.growth", "0")
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)
u:set_skill("training", 4)
r:set_resource("horse", 100)

View file

@ -14,7 +14,7 @@ end
function test_when_owner_returns_morale_stays()
local r = region.create(0, 0, "plain")
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)
u1:add_item("money", 10000)
local b = building.create(r, "castle")
@ -38,13 +38,13 @@ end
function test_morale_alliance()
local r = region.create(0, 0, "plain")
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)
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)
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)
u3:add_item("money", 10000)
@ -95,9 +95,9 @@ end
function test_bigger_castle_empty()
local r = region.create(0, 0, "plain")
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 f2 = faction.create("small2@eressea.de", "human", "de")
local f2 = faction.create("human", "small2@eressea.de", "de")
local u2 = unit.create(f2, r, 1)
u1:add_item("money", 10000)
@ -129,7 +129,7 @@ end
function test_morale_change()
local r = region.create(0, 0, "plain")
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)
u1:add_item("money", 10000)
@ -195,9 +195,9 @@ end
function test_morale_give_command()
local r = region.create(0, 0, "plain")
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 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 b = building.create(r, "castle")

View file

@ -8,7 +8,7 @@ end
function test_set_status_en()
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)
u.status = 1
u:clear_orders()
@ -23,7 +23,7 @@ end
function test_set_status_de()
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)
u.status = 1
u:clear_orders()
@ -34,7 +34,7 @@ end
function test_breed_horses()
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 b = building.create(r, "stables")
b.size = 10

View file

@ -43,7 +43,7 @@ end
function disable_test_bug_1738_build_castle_e3()
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")
c.size = 228
@ -73,10 +73,10 @@ end
function disable_test_alliance()
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)
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)
u2:add_item("money", u2.number * 100)
assert(f1.alliance==nil)
@ -125,7 +125,7 @@ end
function test_no_stealth()
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)
u:set_skill("stealth", 1)
@ -138,7 +138,7 @@ end
function test_no_teach()
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 u2 = unit.create(f, r, 1)
@ -160,7 +160,7 @@ function test_seecast()
for i = 1,10 do
region.create(i, 0, "ocean")
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 u1 = unit.create(f, r, 2)
u1:set_skill("sailing", 3)
@ -193,7 +193,7 @@ function test_fishing()
eressea.settings.set("rules.food.flags", "0")
local r = region.create(0,0, "ocean")
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 u1 = unit.create(f, r, 3)
u1.ship = s1
@ -219,8 +219,8 @@ function test_ship_capacity()
local r = region.create(0,0, "ocean")
region.create(1,0, "ocean")
local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "goblin", "de")
local f = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("goblin", "noreply@eressea.de", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "cutter")
@ -273,9 +273,9 @@ end
function test_owners()
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 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 u3 = unit.create(f2, r, 1)
@ -304,7 +304,7 @@ function test_taxes()
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 1000)
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)
u:clear_orders()
u:add_order("LERNE Holzfaellen") -- do not work
@ -320,7 +320,7 @@ end
function test_region_owner_cannot_leave_castle()
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
local b1 = building.create(r, "castle")
b1.size = 10
@ -366,7 +366,7 @@ function market_fixture()
b.size = 10
b.working = true
local f = faction.create("market1@eressea.de", "human", "de")
local f = faction.create("human", "market1@eressea.de", "de")
f.id = 42
local u = unit.create(f, r, 1)
u.building = b
@ -424,7 +424,7 @@ end
function test_multiple_markets()
local r, u1, b, herbnames, luxurynames, herbtable, luxurytable = market_fixture()
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 b2 = building.create(r2, "market")
b2.size = 10
@ -444,7 +444,7 @@ end
function test_market()
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 b = building.create(r, "market")
@ -541,7 +541,7 @@ function test_market_gives_items()
r = get_region(0, 0)
local b = building.create(r, "market")
b.size = 10
local f = faction.create("market0@eressea.de", "human", "de")
local f = faction.create("human", "market0@eressea.de", "de")
f.id = 42
local u = unit.create(f, r, 1)
u.building = b
@ -559,7 +559,7 @@ end
function test_spells()
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)
u.race = "elf"
u:clear_orders()
@ -587,7 +587,7 @@ function test_spells()
end
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 land = region.create(1, 0, "plain")
region.create(2, 0, "ocean")
@ -610,8 +610,8 @@ end
function test_give_50_percent_of_money()
local r = region.create(0, 0, "plain")
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
local u1 = unit.create(faction.create("human", "noreply@eressea.de", "de"), r, 1)
local u2 = unit.create(faction.create("orc", "noreply@eressea.de", "de"), r, 1)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
@ -637,8 +637,8 @@ end
function test_give_100_percent_of_items()
r = region.create(0, 0, "plain")
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
local u1 = unit.create(faction.create("human", "noreply@eressea.de", "de"), r, 1)
local u2 = unit.create(faction.create("orc", "noreply@eressea.de", "de"), r, 1)
u1.faction.age = 10
u2.faction.age = 10
u1:add_item("money", 500)
@ -656,8 +656,8 @@ end
function test_cannot_give_person()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f1 = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
@ -675,8 +675,8 @@ end
function test_cannot_give_unit()
local r = region.create(0, 0, "plain")
local f1 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f1 = faction.create("human", "noreply@eressea.de", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
u1.faction.age = 10
@ -694,9 +694,9 @@ end
function test_guard_by_owners()
-- http://bugs.eressea.de/view.php?id=1756
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
local f2 = faction.create("noreply@eressea.de", "human", "de")
local f2 = faction.create("human", "noreply@eressea.de", "de")
f2.age=20
local u1 = unit.create(f1, r, 1)
local b = building.create(r, "castle")
@ -717,7 +717,7 @@ function test_guard_by_owners()
end
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 ice = region.create(1,0, "packice")
local ocean = region.create(2,0, "ocean")
@ -778,7 +778,7 @@ function test_cannot_walk_into_ocean()
end
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 u = unit.create(f, r, 1)
r:set_resource("tree", 0)
@ -795,7 +795,7 @@ end
function test_p2_move()
-- 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")
region.create(1, 0, "plain")
local u = unit.create(f, r, 1)
@ -814,7 +814,7 @@ end
function test_golem_use_four_iron()
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)
u1.race = "irongolem"
u1:set_skill("weaponsmithing", 1)
@ -832,7 +832,7 @@ function test_silver_weight_stops_movement()
local r1 = region.create(1, 1, "plain")
local r2 = region.create(2, 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)
u1:clear_orders()
u1:add_order("NACH OST")
@ -849,7 +849,7 @@ function test_silver_weight_stops_ship()
local r1 = region.create(1, 1, "ocean")
local r2 = region.create(2, 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)
u1:set_skill("sailing", 3)
local s1 = ship.create(r1, "canoe")
@ -866,7 +866,7 @@ end
function test_building_owner_can_enter_ship()
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")
b1.size = 10
local s1 = ship.create(r1, "cutter")
@ -889,7 +889,7 @@ end
function test_only_building_owner_can_set_not_paid()
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 u2 = unit.create(f, r, 1)
local mine = building.create(r, "mine")
@ -913,7 +913,7 @@ end
function test_spyreport_message()
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 u2 = unit.create(f1, r1, 1)
msg = message.create("spyreport")
@ -940,7 +940,7 @@ function test_bug2083()
r:set_resource("peasant", 2000)
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)
u:set_skill("building", 8)
u:add_item("stone", 100)
@ -967,7 +967,7 @@ function test_bug2083()
end
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")
end
@ -975,7 +975,7 @@ function test_bug2187()
set_rule("rules.food.flags", "0")
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)
u.race = "demon"
u.hp = u.hp_max * u.number

View file

@ -11,7 +11,7 @@ function setup()
eressea.settings.set("rules.food.flags", "4")
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.magic = "gray"
u:set_skill("magic", 12)

View file

@ -11,7 +11,7 @@ end
function test_blessedharvest_lasts_n_turn()
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 err = 0
r:set_resource("peasant", 100)
@ -46,7 +46,7 @@ end
function test_magic()
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 b = building.create(r, "castle")

View file

@ -10,9 +10,9 @@ function setup()
eressea.settings.set("rules.food.flags", "4")
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)
f = faction.create("stealth2@eressea.de", "human", "de")
f = faction.create("human", "stealth2@eressea.de", "de")
end
function test_stealth_faction_on()

View file

@ -11,6 +11,50 @@ function setup()
eressea.settings.set("rules.encounters", "0")
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()
local r = region.create(0, 0, "plain")
r:set_resource("tree", 100)

View file

@ -12,7 +12,7 @@ function setup()
}]]
eressea.config.reset()
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)
end

View file

@ -13,7 +13,7 @@ end
function test_mistletoe_okay()
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)
turn_begin()
u:add_item('mistletoe', 2)
@ -29,7 +29,7 @@ end
function test_mistletoe_fail()
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)
turn_begin()
u:add_item('mistletoe', 1)
@ -46,7 +46,7 @@ end
function test_dreameye()
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)
u:add_item("dreameye", 2)
u:clear_orders()
@ -63,7 +63,7 @@ end
function test_manacrystal()
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)
u:add_item("manacrystal", 2)
u:clear_orders()
@ -81,7 +81,7 @@ end
function test_skillpotion()
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)
u:add_item("skillpotion", 2)
u:clear_orders()
@ -93,7 +93,7 @@ end
function test_studypotion()
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)
turn_begin()
u:add_item("studypotion", 2)
@ -109,7 +109,7 @@ end
function test_antimagic()
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)
turn_begin()
@ -129,7 +129,7 @@ end
function test_ointment()
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 hp = u.hp
u.hp = 1
@ -144,7 +144,7 @@ end
function test_bloodpotion_demon()
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)
u:add_item("peasantblood", 1)
u:clear_orders()
@ -157,7 +157,7 @@ end
function test_bloodpotion_other()
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)
u:add_item("peasantblood", 1)
u:clear_orders()

View file

@ -30,8 +30,8 @@ end
function test_force_leave_on()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de")
local f2 = faction.create("guest@eressea.de")
local f1 = faction.create("human", "owner@eressea.de")
local f2 = faction.create("human", "guest@eressea.de")
local u1 = unit.create(f1, r, 1)
local u2 = unit.create(f2, r, 1)
local b1 = building.create(r, "castle")
@ -45,8 +45,8 @@ end
function test_force_leave_off()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de")
local f2 = faction.create("guest@eressea.de")
local f1 = faction.create("human", "owner@eressea.de")
local f2 = faction.create("human", "guest@eressea.de")
local u1 = unit.create(f1, r, 1)
local u2 = unit.create(f2, r, 1)
local b1 = building.create(r, "castle")
@ -60,7 +60,7 @@ end
function test_make_temp()
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 u, u2
@ -86,8 +86,8 @@ end
function test_force_leave_postcombat()
local r = region.create(0, 0, "plain")
local f1 = faction.create("owner@eressea.de", "human", "de")
local f2 = faction.create("guest@eressea.de", "human", "de")
local f1 = faction.create("human", "owner@eressea.de", "de")
local f2 = faction.create("human", "guest@eressea.de", "de")
local u1 = unit.create(f1, r, 10)
local u2 = unit.create(f2, r, 10)
local u, u3

View file

@ -6,7 +6,7 @@ local u
function setup()
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
function test_magicbag_weight()

View file

@ -48,7 +48,7 @@ end
function test_walk_to_land()
local r1 = region.create(0, 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)
u:add_order("NACH O")
process_orders()
@ -58,7 +58,7 @@ end
function test_walk_into_ocean_fails()
local r1 = region.create(0, 0, "plain")
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)
u:add_order("NACH O")
process_orders()
@ -69,7 +69,7 @@ function test_walk_distance()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 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)
u:add_order("NACH O O")
process_orders()
@ -81,7 +81,7 @@ function test_ride_max_distance()
local r2 = region.create(2, 0, "plain")
region.create(1, 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)
u:add_item("horse", 1)
u:set_skill("riding", 2)
@ -94,7 +94,7 @@ function test_ride_over_capacity_leads_horse()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 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)
u:add_item("horse", 1)
u:set_skill("riding", 2)
@ -107,7 +107,7 @@ function test_ride_no_skill_leads_horse()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 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)
u:add_item("horse", 1)
u:add_order("NACH O O")

View file

@ -12,7 +12,7 @@ local r, f, u
function setup()
eressea.free_game()
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:clear_orders()
eressea.settings.set("rules.food.flags", "4")

View file

@ -33,7 +33,7 @@ end
function test_give_nopool()
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 u2 = unit.create(f, r, 1)
u1:add_item("money", 100)
@ -45,7 +45,7 @@ end
function test_give_from_faction()
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 u2 = 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("GiveRestriction", 0)
local r = region.create(1, 1, "plain")
local f1 = faction.create("test@example.com", "human", "de")
local f2 = faction.create("test@example.com", "human", "de")
local f1 = faction.create("human", "test@example.com", "de")
local f2 = faction.create("human", "test@example.com", "de")
local u1 = unit.create(f1, r, 1)
local u2 = unit.create(f2, r, 1)
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))

View file

@ -7,7 +7,7 @@ local u, r, f,turn
function setup()
eressea.free_game()
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:add_item("money", 10)
turn = get_turn()

View file

@ -36,7 +36,7 @@ end
function test_coordinates_unnamed_plane()
local p = plane.create(0, -3, -3, 7, 7)
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)
init_reports()
write_report(f)
@ -46,7 +46,7 @@ end
function test_coordinates_no_plane()
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)
init_reports()
write_report(f)
@ -56,7 +56,7 @@ end
function test_show_shadowmaster_attacks()
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)
u.race = "shadowmaster"
u:clear_orders()
@ -71,7 +71,7 @@ end
function test_coordinates_named_plane()
local p = plane.create(0, -3, -3, 7, 7, "Hell")
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)
init_reports()
write_report(f)
@ -82,7 +82,7 @@ end
function test_coordinates_noname_plane()
local p = plane.create(0, -3, -3, 7, 7, "")
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)
init_reports()
write_report(f)
@ -93,7 +93,7 @@ end
function test_lighthouse()
eressea.free_game()
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(2, 0, "ocean")
region.create(0, 1, "firewall")

View file

@ -8,7 +8,7 @@ end
function test_store_unit()
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 fid = f.id
u:add_item("money", u.number * 100)
@ -20,7 +20,7 @@ function test_store_unit()
eressea.free_game()
-- recreate world:
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
store = storage.create(filename, "rb")
assert_not_nil(store)

View file

@ -24,7 +24,7 @@ end
function test_study()
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)
u:add_order("LERNEN Armbrust")
process_orders()
@ -33,7 +33,7 @@ end
function test_study_expensive()
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)
eressea.settings.set("skills.cost.alchemy", "50")
eressea.settings.set("rules.encounters", "0")
@ -46,7 +46,7 @@ end
function test_unit_spells()
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)
u.magic = "gray"
u:set_skill("magic", 1)
@ -76,7 +76,7 @@ end
function test_study_no_teacher()
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)
u1:set_skill("crossbow", 1)
process_orders()
@ -85,7 +85,7 @@ end
function test_study_with_teacher()
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)
make_teacher(u1)
@ -96,7 +96,7 @@ end
function test_study_too_many_students()
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")
u1.name = "Student"
u1:add_item("money", 201*u1.number)
@ -107,7 +107,7 @@ end
function test_study_multiple_teachers()
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")
u1.name = "Student"
u1:add_item("money", 201*u1.number)

View file

@ -15,7 +15,7 @@ end
function test_snowglobe_fail()
local r1 = region.create(0, 0, "glacier")
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)
u:add_item("snowglobe", 1)
u:clear_orders()
@ -30,7 +30,7 @@ end
function test_snowglobe_missing_direction()
local r1 = region.create(0, 0, "glacier")
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)
u:add_item("snowglobe", 1)
u:clear_orders()
@ -44,7 +44,7 @@ end
function test_snowglobe()
local r1 = region.create(0, 0, "glacier")
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 fail = 0
u:add_item("snowglobe", have)
@ -62,7 +62,7 @@ end
local function use_tree(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)
r:set_resource("tree", 0)
u1:add_item("xmastree", 1)
@ -86,7 +86,7 @@ function test_stardust()
eressea.settings.set("rules.economy.repopulate_maximum", 0)
local r = region.create(0, 0, "plain")
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)
u:add_item("stardust", 1)
u:clear_orders()

View file

@ -401,8 +401,8 @@ static int tolua_faction_get(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, 2, 0);
const char *racename = tolua_tostring(L, 1, 0);
const char *email = tolua_tostring(L, 2, 0);
const char *lang = tolua_tostring(L, 3, 0);
struct locale *loc = lang ? get_locale(lang) : default_locale;
faction *f = NULL;

View file

@ -813,7 +813,7 @@ static void manufacture(unit * u, const item_type * itype, int want)
skill = effskill(u, sk, 0);
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) {
/* an error occured */

View file

@ -123,6 +123,7 @@ void free_buildingtypes(void) {
building_type *bt_get_or_create(const char *name)
{
assert(name && name[0]);
if (name != NULL) {
building_type *btype = bt_find_i(name);
if (btype == NULL) {

View file

@ -79,7 +79,6 @@ extern "C" {
struct rawmaterial_type *raw;
struct resource_mod *modifiers;
/* --- pointers --- */
struct attrib *attribs;
struct item_type *itype;
struct potion_type *ptype;
struct luxury_type *ltype;

View file

@ -15,6 +15,12 @@
#include <skill.h>
struct race;
struct unit;
struct region;
struct attrib;
struct attrib_type;
#ifdef __cplusplus
extern "C" {
#endif