forked from github/server
allow GIVE for juju, ghast, skelord, too.
make the tests nicer.
This commit is contained in:
parent
2107a84b0d
commit
8344f41a70
|
@ -732,7 +732,7 @@
|
|||
<attack type="1" damage="0d0"/>
|
||||
</race>
|
||||
|
||||
<race name="ghast" magres="60" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
|
||||
<race name="ghast" magres="60" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -767,7 +767,7 @@
|
|||
<attack type="2" damage="1d30"/>
|
||||
</race>
|
||||
|
||||
<race name="juju" magres="50" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="80" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistbash="yes" resistcut="yes" resistpierce="yes">
|
||||
<race name="juju" magres="50" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="80" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistbash="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -797,7 +797,7 @@
|
|||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
|
||||
<race name="skeletonlord" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
|
||||
<race name="skeletonlord" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
|
|
@ -983,7 +983,7 @@
|
|||
<attack type="2" damage="5d600"/>
|
||||
<attack type="1" damage="1d4"/>
|
||||
</race>
|
||||
<race name="ghast" magres="60" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
|
||||
<race name="ghast" magres="60" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -1016,7 +1016,7 @@
|
|||
<attack type="3" damage="1d2"/>
|
||||
<attack type="2" damage="1d30"/>
|
||||
</race>
|
||||
<race name="juju" magres="50" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="80" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistbash="yes" resistcut="yes" resistpierce="yes">
|
||||
<race name="juju" magres="50" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="80" ac="2" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistbash="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
@ -1044,7 +1044,7 @@
|
|||
<skill name="unarmed" modifier="1"/>
|
||||
<attack type="1" damage="1d7"/>
|
||||
</race>
|
||||
<race name="skeletonlord" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
|
||||
<race name="skeletonlord" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="60" ac="4" damage="1d7" unarmedattack="6" unarmeddefense="6" attackmodifier="8" defensemodifier="8" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
|
||||
<ai splitsize="2000" killpeasants="yes" moverandom="yes"/>
|
||||
<skill name="crossbow" modifier="1"/>
|
||||
<skill name="bow" modifier="1"/>
|
||||
|
|
|
@ -37,17 +37,28 @@ function test_give_self_undead_fail()
|
|||
assert_equal(1, u2.number)
|
||||
end
|
||||
|
||||
function test_give_other_zombie_fail()
|
||||
-- cannot give undead units to another faction
|
||||
local function setup_give_self(race)
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 2, race)
|
||||
local u2 = unit.create(f, r, 1, race)
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
|
||||
return u1, u2
|
||||
end
|
||||
|
||||
local function setup_give_other(race)
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create("human")
|
||||
local f2 = faction.create("human")
|
||||
|
||||
local u1 = unit.create(f1, r, 2, "zombie")
|
||||
local u2 = unit.create(f2, r, 1, "zombie")
|
||||
local u1 = unit.create(f1, r, 2, race)
|
||||
local u2 = unit.create(f2, r, 1, race)
|
||||
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
|
||||
-- TODO: Migranten blockieren das derzeit, nicht Untoten-Eigenschaften
|
||||
return u1, u2
|
||||
end
|
||||
|
||||
function test_give_other_zombie_fail()
|
||||
u1, u2 = setup_give_other("zombie")
|
||||
process_orders()
|
||||
assert_equal(2, u1.number)
|
||||
assert_equal(1, u2.number)
|
||||
|
@ -55,11 +66,7 @@ end
|
|||
|
||||
function test_give_self_zombie_okay()
|
||||
-- allow giving zombie units to own units of same race
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 2, "zombie")
|
||||
local u2 = unit.create(f, r, 1, "zombie")
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
|
||||
u1, u2 = setup_give_self("zombie")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
|
@ -67,11 +74,7 @@ end
|
|||
|
||||
function test_give_self_skeleton_okay()
|
||||
-- allow giving skeleton units to own units of same race
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 2, "skeleton")
|
||||
local u2 = unit.create(f, r, 1, "skeleton")
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
|
||||
u1, u2 = setup_give_self("skeleton")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
|
@ -79,11 +82,31 @@ end
|
|||
|
||||
function test_give_self_ghoul_okay()
|
||||
-- allow giving ghoul units to own units of same race
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("human")
|
||||
local u1 = unit.create(f, r, 2, "ghoul")
|
||||
local u2 = unit.create(f, r, 1, "ghoul")
|
||||
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
|
||||
u1, u2 = setup_give_self("ghoul")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
end
|
||||
|
||||
function test_give_self_ghast_okay()
|
||||
-- allow giving ghast units to own units of same race
|
||||
u1, u2 = setup_give_self("ghast")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
end
|
||||
|
||||
function test_give_self_juju_okay()
|
||||
-- allow giving juju units to own units of same race
|
||||
u1, u2 = setup_give_self("juju")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
end
|
||||
|
||||
function test_give_self_skeletonlord_okay()
|
||||
-- allow giving skeletonlord units to own units of same race
|
||||
u1, u2 = setup_give_self("skeletonlord")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
|
|
Loading…
Reference in New Issue