2018-07-12 20:24:23 +02:00
|
|
|
-- forward declarations required:
|
2018-05-13 21:58:01 +02:00
|
|
|
local self = {}
|
2018-07-12 20:24:23 +02:00
|
|
|
|
|
|
|
local function equip_first(u)
|
|
|
|
name = 'seed_' .. u.race
|
|
|
|
equip_unit(u, name, 255)
|
2020-07-19 19:48:08 +02:00
|
|
|
local r = u.region
|
|
|
|
r.terrain = 'plain'
|
|
|
|
r:set_flag(1, false) -- kein mallorn
|
|
|
|
r:set_resource('tree', 500)
|
|
|
|
r:set_resource('sapling', 100)
|
|
|
|
r:set_resource('seed', 50)
|
|
|
|
r:set_resource('peasant', 4000)
|
|
|
|
r:set_resource('money', 80000)
|
|
|
|
r:set_resource('horse', 50)
|
2018-07-12 20:24:23 +02:00
|
|
|
end
|
|
|
|
|
2018-05-13 21:58:01 +02:00
|
|
|
local mysets = {
|
2018-05-12 19:10:40 +02:00
|
|
|
['first_unit'] = {
|
|
|
|
['items'] = {
|
|
|
|
['money'] = 2500,
|
|
|
|
['log'] = 10,
|
|
|
|
['stone'] = 4
|
2018-07-12 20:24:23 +02:00
|
|
|
},
|
|
|
|
['callback'] = equip_first
|
2018-05-12 19:10:40 +02:00
|
|
|
},
|
|
|
|
['seed_unit'] = {
|
|
|
|
['items'] = {
|
|
|
|
['log'] = 50,
|
|
|
|
['stone'] = 50,
|
|
|
|
['iron'] = 50,
|
|
|
|
['laen'] = 10,
|
|
|
|
['sword'] = 1,
|
|
|
|
['mallorn'] = 10,
|
|
|
|
['skillpotion'] = 5,
|
|
|
|
['lifepotion'] = 5,
|
|
|
|
['money'] = 20000
|
|
|
|
},
|
|
|
|
['skills'] = {
|
|
|
|
['perception'] = 30,
|
|
|
|
['melee'] = 1
|
|
|
|
}
|
2018-05-12 20:52:10 +02:00
|
|
|
},
|
|
|
|
['seed_dwarf'] = {
|
|
|
|
['items'] = {
|
|
|
|
['axe'] = 1,
|
|
|
|
['chainmail'] = 1,
|
|
|
|
},
|
|
|
|
['skills'] = {
|
|
|
|
['melee'] = 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
['seed_elf'] = {
|
|
|
|
['items'] = {
|
|
|
|
['fairyboot'] = 1,
|
|
|
|
},
|
|
|
|
['callback'] = equip_newunits
|
|
|
|
},
|
|
|
|
['seed_orc'] = {
|
|
|
|
['skills'] = {
|
|
|
|
['polearm'] = 4,
|
|
|
|
['melee'] = 4,
|
|
|
|
['crossbow'] = 4,
|
|
|
|
['catapult'] = 4,
|
|
|
|
['bow'] = 4,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
['seed_goblin'] = {
|
|
|
|
['items'] = {
|
|
|
|
['roi'] = 1
|
|
|
|
},
|
|
|
|
['callback'] = equip_newunits
|
|
|
|
},
|
|
|
|
['seed_human'] = {
|
|
|
|
['callback'] = equip_newunits
|
|
|
|
},
|
|
|
|
['seed_troll'] = {
|
|
|
|
['items'] = {
|
|
|
|
['stone'] = 50,
|
|
|
|
},
|
|
|
|
['skills'] = {
|
|
|
|
['building'] = 1,
|
|
|
|
['perception'] = 3,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
['seed_demon'] = {
|
|
|
|
['skills'] = {
|
|
|
|
['stamina'] = 15
|
2020-03-08 10:07:04 +01:00
|
|
|
},
|
2018-05-12 20:52:10 +02:00
|
|
|
},
|
|
|
|
['seed_insect'] = {
|
|
|
|
['items'] = {
|
2018-07-12 20:24:23 +02:00
|
|
|
['nestwarmth'] = 9
|
2018-05-12 20:52:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
['seed_halfling'] = {
|
|
|
|
['items'] = {
|
|
|
|
['horse'] = 2,
|
|
|
|
['cart'] = 1,
|
|
|
|
['balm'] = 5,
|
|
|
|
['spice'] = 5,
|
|
|
|
['myrrh'] = 5,
|
|
|
|
['jewel'] = 5,
|
|
|
|
['oil'] = 5,
|
|
|
|
['silk'] = 5,
|
|
|
|
['incense'] = 5
|
|
|
|
},
|
|
|
|
['skills'] = {
|
|
|
|
['trade'] = 1,
|
|
|
|
['riding'] = 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
['seed_cat'] = {
|
|
|
|
['items'] = {
|
|
|
|
['roi'] = 1
|
|
|
|
},
|
|
|
|
['callback'] = equip_newunits
|
|
|
|
},
|
|
|
|
['seed_aquarian'] = {
|
|
|
|
['skills'] = {
|
|
|
|
['sailing'] = 1
|
|
|
|
},
|
|
|
|
['callback'] = equip_newunits
|
2018-05-13 16:13:33 +02:00
|
|
|
},
|
2018-05-12 19:10:40 +02:00
|
|
|
}
|
|
|
|
|
2018-05-13 21:58:01 +02:00
|
|
|
function equip_unit(u, name, flags)
|
|
|
|
local set = mysets[name]
|
|
|
|
if set then
|
|
|
|
local items = set['items']
|
|
|
|
if items then
|
2018-05-15 06:58:07 +02:00
|
|
|
for name, count in pairs(items) do
|
|
|
|
u:add_item(name, count * u.number)
|
2018-05-13 21:58:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
local skills = set['skills']
|
|
|
|
if skills then
|
2018-05-15 06:58:07 +02:00
|
|
|
for name, level in pairs(skills) do
|
|
|
|
u:set_skill(name, level)
|
2018-05-13 21:58:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
local spells = set['spells']
|
|
|
|
if spells then
|
2018-11-22 22:13:23 +01:00
|
|
|
for name, level in pairs(spells) do
|
2018-05-15 06:58:07 +02:00
|
|
|
u:add_spell(name, level)
|
2018-05-13 21:58:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
local callback = set['callback']
|
|
|
|
if callback and type(callback) == 'function' then
|
|
|
|
callback(u, flags)
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
self.add = function(name, set)
|
|
|
|
mysets[name] = set
|
|
|
|
end
|
|
|
|
|
|
|
|
self.add_multiple = function(sets)
|
2018-05-15 06:58:07 +02:00
|
|
|
for name, set in pairs(sets) do
|
|
|
|
mysets[name] = set
|
2018-05-13 21:58:01 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
self.get = function(name)
|
|
|
|
return mysets[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
return self
|