diff --git a/scripts/eressea/equipment.lua b/scripts/eressea/equipment.lua index 6e4ccfc9b..8852dfb27 100644 --- a/scripts/eressea/equipment.lua +++ b/scripts/eressea/equipment.lua @@ -1,13 +1,20 @@ --- forward declaration required: - +-- forward declarations required: local self = {} + +local function equip_first(u) + equip_newunits(u) + name = 'seed_' .. u.race + equip_unit(u, name, 255) +end + local mysets = { ['first_unit'] = { ['items'] = { ['money'] = 2500, ['log'] = 10, ['stone'] = 4 - } + }, + ['callback'] = equip_first }, ['seed_unit'] = { ['items'] = { @@ -75,7 +82,7 @@ local mysets = { }, ['seed_insect'] = { ['items'] = { - ['nestwarmth'] =9 + ['nestwarmth'] = 9 } }, ['seed_halfling'] = { diff --git a/scripts/tests/config.lua b/scripts/tests/config.lua index a3104a6b6..316a8ccca 100644 --- a/scripts/tests/config.lua +++ b/scripts/tests/config.lua @@ -14,6 +14,22 @@ function test_read_race() assert_not_nil(f) end +function test_first_insect() + local f = faction.create('insect') + local r = region.create(0, 0, "plain") + local u = unit.create(f, r, 1) + u:equip('first_unit') + assert_equal(9, u:get_item('nestwarmth')) +end + +function test_first_troll() + local f = faction.create('troll') + local r = region.create(0, 0, "plain") + local u = unit.create(f, r, 1) + u:equip('first_unit') + assert_equal(2, u:eff_skill('perception')) +end + function test_seed_unit() local r = region.create(0, 0, "plain") local f = faction.create('human')