2004-12-22 23:02:31 +01:00
|
|
|
|
function mkunit(f, r, num)
|
|
|
|
|
u = add_unit(f, r)
|
|
|
|
|
u.number = num
|
|
|
|
|
u:add_item("money", num*10)
|
|
|
|
|
return u
|
2004-12-20 23:59:42 +01:00
|
|
|
|
end
|
|
|
|
|
|
2004-12-19 17:39:51 +01:00
|
|
|
|
function test_movement()
|
|
|
|
|
west = direction("west")
|
|
|
|
|
east = direction("east")
|
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
-- im westen ohne strassen
|
|
|
|
|
ocean = terraform(-3, 0, "ocean")
|
|
|
|
|
terraform(-2, 0, "plain")
|
|
|
|
|
terraform(-1, 0, "plain")
|
|
|
|
|
|
|
|
|
|
-- im osten mit strassen
|
2004-12-19 17:39:51 +01:00
|
|
|
|
r0 = terraform(0, 0, "plain")
|
|
|
|
|
r1 = terraform(1, 0, "desert")
|
|
|
|
|
r2 = terraform(2, 0, "glacier")
|
|
|
|
|
r3 = terraform(3, 0, "plain")
|
|
|
|
|
r4 = terraform(4, 0, "glacier")
|
|
|
|
|
|
|
|
|
|
r0:set_road(east, 1.0)
|
|
|
|
|
r1:set_road(west, 1.0)
|
|
|
|
|
r1:set_road(east, 1.0)
|
|
|
|
|
r2:set_road(west, 1.0)
|
|
|
|
|
r2:set_road(east, 1.0)
|
|
|
|
|
r3:set_road(west, 1.0)
|
|
|
|
|
r3:set_road(east, 1.0)
|
|
|
|
|
r4:set_road(west, 1.0)
|
|
|
|
|
|
|
|
|
|
orcs = add_faction("enno@eressea.de", "orc", "de")
|
|
|
|
|
orcs.age = 20
|
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
bugs = add_faction("enno@eressea.de", "insect", "de")
|
|
|
|
|
bugs.age = 20
|
|
|
|
|
|
|
|
|
|
orc = mkunit(orcs, r0, 10)
|
2004-12-19 17:39:51 +01:00
|
|
|
|
orc:add_item("horse", orc.number*3)
|
|
|
|
|
orc:set_skill("sk_riding", 10)
|
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
foot = mkunit(orcs, r0, 1)
|
2004-12-19 17:39:51 +01:00
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
ship = add_ship("boat", r0)
|
|
|
|
|
sail = mkunit(orcs, r0, 1)
|
|
|
|
|
sail.ship = ship
|
|
|
|
|
|
|
|
|
|
bug = mkunit(bugs, r0, 1)
|
|
|
|
|
|
|
|
|
|
sail:clear_orders()
|
|
|
|
|
sail:add_order("NACH O")
|
|
|
|
|
sail:add_order("NUMMER EINHEIT saiL")
|
|
|
|
|
|
|
|
|
|
foot:clear_orders()
|
|
|
|
|
foot:add_order("ROUTE W W")
|
|
|
|
|
foot:add_order("NUMMER EINHEIT foot")
|
2004-12-19 17:39:51 +01:00
|
|
|
|
|
|
|
|
|
orc:clear_orders()
|
|
|
|
|
orc:add_order("NUMMER PARTEI orcs")
|
|
|
|
|
orc:add_order("NUMMER EINHEIT orc")
|
|
|
|
|
orc:add_order("BENENNE EINHEIT Orks")
|
|
|
|
|
orc:add_order("ROUTE O O O P P O W W W W")
|
|
|
|
|
orc:add_order("GIB 0 ALLES Steine")
|
|
|
|
|
orc:add_order("GIB 0 ALLES Holz")
|
|
|
|
|
orc:add_order("TRANSPORTIEREN " .. itoa36(bug.id))
|
|
|
|
|
|
|
|
|
|
bug:clear_orders()
|
|
|
|
|
bug:add_order("NUMMER PARTEI bugs")
|
|
|
|
|
bug:add_order("NUMMER EINHEIT bug")
|
|
|
|
|
bug:add_order("BENENNE EINHEIT K<>fer")
|
|
|
|
|
bug:add_order("GIB 0 ALLES Steine")
|
|
|
|
|
bug:add_order("GIB 0 ALLES Holz")
|
|
|
|
|
bug:add_order("FAHREN " .. itoa36(orc.id))
|
|
|
|
|
|
|
|
|
|
u = add_unit(orcs, r0)
|
|
|
|
|
u.number = 1
|
|
|
|
|
u:add_item("horse", u.number*3)
|
|
|
|
|
u:add_item("money", u.number*10)
|
|
|
|
|
u:set_skill("sk_riding", 10)
|
|
|
|
|
u:set_skill("sk_stealth", 2)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("FOLGEN EINHEIT " .. itoa36(bug.id))
|
|
|
|
|
u:add_order("NACH W")
|
|
|
|
|
u:add_order("NUMMER EINHEIT foLg")
|
|
|
|
|
u:add_order("BENENNE EINHEIT Verfolger")
|
|
|
|
|
|
|
|
|
|
u2 = add_unit(orcs, r0)
|
|
|
|
|
u2.number = 1
|
|
|
|
|
u2:add_item("horse", u2.number*3)
|
|
|
|
|
u2:add_item("money", u.number*10)
|
|
|
|
|
u2:set_skill("sk_riding", 10)
|
|
|
|
|
u2:set_skill("sk_stealth", 2)
|
|
|
|
|
u2:clear_orders()
|
|
|
|
|
u2:add_order("FOLGEN EINHEIT nix")
|
|
|
|
|
u2:add_order("NUMMER EINHEIT Last")
|
|
|
|
|
u2:add_order("BENENNE EINHEIT Verfolger-Verfolger")
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
function test_sail()
|
|
|
|
|
r0 = terraform(0, 0, "plain")
|
|
|
|
|
|
|
|
|
|
orcs = add_faction("enno@eressea.de", "orc", "de")
|
|
|
|
|
orcs.age = 20
|
|
|
|
|
|
|
|
|
|
orc = add_unit(orcs, r0)
|
|
|
|
|
orc.number = 1
|
|
|
|
|
orc:add_item("speedsail", orc.number)
|
|
|
|
|
|
|
|
|
|
orc:clear_orders()
|
|
|
|
|
orc:add_order("NUMMER PARTEI orcs")
|
|
|
|
|
orc:add_order("NUMMER EINHEIT orc")
|
|
|
|
|
orc:add_order("BENENNE EINHEIT Orks")
|
|
|
|
|
orc:add_order("ZEIGEN \"Sonnensegel\"")
|
|
|
|
|
end
|
|
|
|
|
|
2004-08-08 13:02:42 +02:00
|
|
|
|
function test_handler()
|
|
|
|
|
|
|
|
|
|
local function msg_handler(u, evt)
|
|
|
|
|
str = evt:get_string(0)
|
|
|
|
|
u2 = evt:get_unit(1)
|
|
|
|
|
print(u)
|
|
|
|
|
print(u2)
|
|
|
|
|
print(str)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
skill = 8
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "orc", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 1
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("NUMMER PARTEI test")
|
|
|
|
|
u:add_handler("message", msg_handler)
|
|
|
|
|
msg = "BOTSCHAFT EINHEIT " .. itoa36(u.id) .. " Du~Elf~stinken"
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "elf", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 1
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("NUMMER PARTEI eviL")
|
|
|
|
|
u:add_order(msg)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2004-06-24 18:48:47 +02:00
|
|
|
|
function test_combat()
|
|
|
|
|
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
skill = 8
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "orc", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 100
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("sword", u.number)
|
|
|
|
|
u:set_skill("sk_melee", skill)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("NUMMER PARTEI test")
|
|
|
|
|
u:add_order("K<EFBFBD>MPFE")
|
|
|
|
|
u:add_order("BEF<EFBFBD>RDERUNG")
|
|
|
|
|
attack = "ATTACKIERE " .. itoa36(u.id)
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "elf", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 100
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("sword", u.number)
|
|
|
|
|
u:set_skill("sk_melee", skill+2)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("NUMMER PARTEI eviL")
|
|
|
|
|
u:add_order("KAEMPFE")
|
|
|
|
|
u:add_order(attack)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test_rewards()
|
|
|
|
|
-- this script tests manufacturing and fighting.
|
|
|
|
|
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
skill = 5
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "human", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 10
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("greatbow", u.number)
|
|
|
|
|
u:set_skill("sk_bow", skill)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("KAEMPFE")
|
|
|
|
|
attack = "ATTACKIERE " .. itoa36(u.id)
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 7
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("mallorn", u.number*10)
|
|
|
|
|
u:set_skill("sk_weaponsmithing", 7)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("KAEMPFE NICHT")
|
|
|
|
|
u:add_order("MACHEN Elfenbogen")
|
|
|
|
|
u:add_order("NUMMER PARTEI test")
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "elf", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 7
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("greatbow", u.number)
|
|
|
|
|
u:set_skill("sk_bow", skill)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("KAEMPFE HINTEN")
|
|
|
|
|
u:add_order(attack)
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 7
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("mallorn", u.number*10)
|
|
|
|
|
u:set_skill("sk_weaponsmithing", 7)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("KAEMPFE NICHT")
|
|
|
|
|
u:add_order("MACHEN Elfenbogen")
|
|
|
|
|
u:add_order("NUMMER PARTEI eviL")
|
|
|
|
|
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 7
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:add_item("mallorn", u.number*10)
|
|
|
|
|
u:set_skill("sk_weaponsmithing", 7)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("KAEMPFE NICHT")
|
|
|
|
|
|
|
|
|
|
items = { "hornofdancing", "trappedairelemental",
|
|
|
|
|
"aurapotion50", "bagpipeoffear",
|
|
|
|
|
"instantartacademy", "instantartsculpture" }
|
|
|
|
|
for index in items do
|
|
|
|
|
u:add_item(items[index], 1)
|
|
|
|
|
u:add_order('@BENUTZEN "' .. get_string("de", items[index]) .. '"')
|
|
|
|
|
end
|
|
|
|
|
u:add_order("NUMMER PARTEI eviL")
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test_give()
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
f = add_faction("enno@eressea.de", "human", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 10
|
|
|
|
|
u:add_item("money", u.number*100)
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("MACHE TEMP eins")
|
|
|
|
|
u:add_order("REKRUTIERE 1")
|
|
|
|
|
u:add_order("ENDE")
|
|
|
|
|
u:add_order("GIB TEMP eins ALLES silber")
|
|
|
|
|
u:add_order("NUMMER PARTEI test")
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test_write()
|
|
|
|
|
read_game("24")
|
|
|
|
|
read_orders("befehle")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function move_north(u)
|
2004-06-26 22:51:19 +02:00
|
|
|
|
for order in u.orders do
|
|
|
|
|
print(order)
|
|
|
|
|
end
|
2004-06-24 18:48:47 +02:00
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("NACH NORDEN")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function test_monsters()
|
|
|
|
|
read_game("23")
|
2004-06-26 22:51:19 +02:00
|
|
|
|
|
|
|
|
|
-- magrathea = get_region(-67, -5)
|
|
|
|
|
local magrathea = get_region(0, 0)
|
|
|
|
|
if magrathea ~= nil then
|
|
|
|
|
if pcall(dofile, scriptpath .. "/ponnuki.lua") then
|
|
|
|
|
init_ponnuki(magrathea)
|
|
|
|
|
else
|
|
|
|
|
print("could not open ponnuki")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2004-06-24 18:48:47 +02:00
|
|
|
|
set_brain("braineater", move_north)
|
|
|
|
|
plan_monsters()
|
|
|
|
|
end
|
|
|
|
|
|
2004-07-09 20:28:38 +02:00
|
|
|
|
function test_parser()
|
|
|
|
|
-- this script tests the changes to quotes
|
|
|
|
|
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
skill = 5
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "human", "de")
|
|
|
|
|
f.age = 20
|
|
|
|
|
u = add_unit(f, plain)
|
|
|
|
|
u.number = 10
|
|
|
|
|
u:clear_orders()
|
|
|
|
|
u:add_order("Nummer Partei test")
|
|
|
|
|
u:add_order("BENENNE PARTEI \"Diese Partei heisst \\\"Enno's Schergen\\\".\"")
|
|
|
|
|
u:add_order("BENENNE EINHEIT \"Mein Name ist \\\"Enno\\\".\"")
|
|
|
|
|
end
|
|
|
|
|
|
2004-10-16 14:15:22 +02:00
|
|
|
|
function test_fail()
|
|
|
|
|
plain = terraform(0, 0, "plain")
|
|
|
|
|
skill = 5
|
|
|
|
|
|
|
|
|
|
f = add_faction("enno@eressea.de", "human", "de")
|
|
|
|
|
print(f)
|
|
|
|
|
end
|
|
|
|
|
|
2004-12-22 01:53:12 +01:00
|
|
|
|
function run_scripts()
|
|
|
|
|
scripts = {
|
|
|
|
|
"xmas2004.lua"
|
|
|
|
|
}
|
|
|
|
|
for index in scripts do
|
|
|
|
|
local script = scriptpath .. "/" .. scripts[index]
|
|
|
|
|
print("- loading " .. script)
|
|
|
|
|
if pcall(dofile, script)==0 then
|
|
|
|
|
print("Could not load " .. script)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2004-12-20 23:59:42 +01:00
|
|
|
|
-- test_movement()
|
2004-12-19 17:39:51 +01:00
|
|
|
|
-- test_fail()
|
2004-09-26 21:15:36 +02:00
|
|
|
|
-- test_handler()
|
2004-08-08 13:02:42 +02:00
|
|
|
|
-- test_parser()
|
2004-07-09 20:28:38 +02:00
|
|
|
|
-- test_monsters()
|
2004-06-24 18:48:47 +02:00
|
|
|
|
-- test_combat()
|
|
|
|
|
-- test_rewards()
|
|
|
|
|
-- test_give()
|
|
|
|
|
-- test_write()
|
2004-12-22 01:53:12 +01:00
|
|
|
|
|
2004-12-22 23:02:31 +01:00
|
|
|
|
-- test_sail()
|
|
|
|
|
-- write_game("../testg.txt")
|
|
|
|
|
-- read_game("../testg.txt")
|
|
|
|
|
|
|
|
|
|
test_movement()
|
2004-12-22 01:53:12 +01:00
|
|
|
|
run_scripts()
|
|
|
|
|
process_orders()
|
|
|
|
|
write_reports()
|
2004-12-22 23:02:31 +01:00
|
|
|
|
|