quicklist updates

This commit is contained in:
Enno Rehling 2015-07-11 12:48:03 +02:00
parent 27835dc4e1
commit 6d4f05fad8
2 changed files with 68 additions and 3 deletions

@ -1 +1 @@
Subproject commit 40ae383100a8f012393ab29bc3d98e182fe57c19
Subproject commit 45f4577b8205d87b78d2b1f30b5c9baa25c86779

View File

@ -6,13 +6,19 @@ function setup()
conf = [[{
"races" : { "human" : {} },
"terrains" : { "plain" : { "flags" : [ "land" ] } },
"keywords" : { "de" : { "study": "LERNEN" } },
"skills" : { "de": { "alchemy" : "Alchemie", "crossbow" : "Armbrust" } },
"keywords" : { "de" : { "study": "LERNEN", "teach": "LEHREN" } },
"skills" : { "de": {
"tactics" : "Taktik",
"alchemy" : "Alchemie",
"crossbow" : "Armbrust"
} },
"spells" : { "fireball" : { "syntax" : "u+" } }
}]]
eressea.game.reset()
eressea.config.reset();
eressea.settings.set('rules.magic.playerschools', '')
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set('study.random_progress', '0')
eressea.config.parse(conf)
end
@ -51,3 +57,62 @@ function test_unit_spells()
assert_equal("fireball", sp.name)
assert_equal(2, sp.level)
end
local function make_teacher(student, f, skill)
f = f or student.faction
local u = unit.create(f, student.region, 1)
u:clear_orders()
u:add_order("LEHRE " .. itoa36(student.id))
u:set_skill(skill or "crossbow", 10)
return u
end
local function make_student(f, r, num, skill)
local u = unit.create(f, r, num or 1)
u:clear_orders()
u:add_order("LERNE " .. (skill or "Armbrust"))
return u
end
function test_study_no_teacher()
local r = region.create(0, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u1 = make_student(f, r, 1)
u1:set_skill("crossbow", 1)
process_orders()
assert_equal(1, u1:get_skill("crossbow"))
end
function test_study_with_teacher()
local r = region.create(0, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u1 = make_student(f, r, 1)
make_teacher(u1)
u1:set_skill("crossbow", 1)
process_orders()
assert_equal(2, u1:get_skill("crossbow"))
end
function test_study_too_many_students()
local r = region.create(0, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u1 = make_student(f, r, 20, "Taktik")
u1.name = "Student"
u1:add_item("money", 201*u1.number)
make_teacher(u1, f, "tactics")
process_orders()
assert_equal(u1.number, u1:get_item("money"))
end
function test_study_multiple_teachers()
local r = region.create(0, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u1 = make_student(f, r, 20, "Taktik")
u1.name = "Student"
u1:add_item("money", 201*u1.number)
make_teacher(u1, f, "tactics")
make_teacher(u1, f, "tactics")
process_orders()
assert_equal(u1.number, u1:get_item("money"))
end