Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Enno Rehling 2017-07-15 12:46:16 +02:00
commit 1f996f1b04
7 changed files with 160 additions and 12 deletions

View File

@ -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"/>
@ -750,7 +750,7 @@
<attack type="2" damage="1d30"/>
</race>
<race name="ghoul" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
<race name="ghoul" magres="30" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" giveperson="yes">
<ai splitsize="10000" 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"/>
@ -783,7 +783,7 @@
<attack type="3" damage="1d1"/>
</race>
<race name="zombie" magres="20" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<race name="zombie" magres="20" maxaura="1.0" regaura="1.0" weight="1000" capacity="540" speed="1.0" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
<ai splitsize="10000" 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"/>
@ -812,7 +812,7 @@
<attack type="1" damage="1d7"/>
</race>
<race name="skeleton" magres="10" maxaura="1.0" regaura="1.0" weight="500" capacity="540" speed="1.0" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<race name="skeleton" magres="10" maxaura="1.0" regaura="1.0" weight="500" capacity="540" speed="1.0" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>

View File

@ -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"/>
@ -1000,7 +1000,7 @@
<attack type="2" damage="1d30"/>
<attack type="2" damage="1d30"/>
</race>
<race name="ghoul" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes">
<race name="ghoul" magres="30" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="30" ac="1" damage="1d7" unarmedattack="3" unarmeddefense="3" attackmodifier="3" defensemodifier="3" scarepeasants="yes" walk="yes" canlearn="no" teach="no" absorbpeasants="yes" noheal="yes" undead="yes" equipment="yes" giveperson="yes">
<ai splitsize="10000" 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"/>
@ -1031,7 +1031,7 @@
<attack type="3" damage="1d1"/>
<attack type="3" damage="1d1"/>
</race>
<race name="zombie" magres="20" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<race name="zombie" magres="20" maxaura="1.000000" regaura="1.000000" weight="1000" capacity="540" speed="1.000000" hp="40" ac="1" damage="1d7" unarmedattack="2" unarmeddefense="2" attackmodifier="5" defensemodifier="5" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
<ai splitsize="10000" 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"/>
@ -1058,7 +1058,7 @@
<attack type="1" damage="1d7"/>
<attack type="1" damage="1d7"/>
</race>
<race name="skeleton" magres="10" maxaura="1.000000" regaura="1.000000" weight="500" capacity="540" speed="1.000000" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes">
<race name="skeleton" magres="10" maxaura="1.000000" regaura="1.000000" weight="500" capacity="540" speed="1.000000" hp="20" ac="1" damage="1d7" unarmedattack="1" unarmeddefense="1" attackmodifier="6" defensemodifier="6" scarepeasants="yes" walk="yes" canlearn="no" teach="no" noheal="yes" undead="yes" equipment="yes" resistcut="yes" resistpierce="yes" giveperson="yes">
<ai splitsize="10000" killpeasants="yes" moverandom="yes"/>
<skill name="crossbow" modifier="1"/>
<skill name="bow" modifier="1"/>

View File

@ -408,3 +408,19 @@ end
function test_calendar_season_2328()
assert_equal("fall", get_season(1026))
end
function test_give_to_other_okay()
-- can give a person to another faction
eressea.settings.set("GiveRestriction", "0")
local r = region.create(0, 0, "plain")
local f1 = faction.create("human")
local f2 = faction.create("human")
local u1 = unit.create(f1, r, 2, "human")
local u2 = unit.create(f2, r, 1, "human")
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
process_orders()
assert_equal(1, u1.number)
assert_equal(2, u2.number)
end

View File

@ -21,3 +21,4 @@ require 'tests.process'
require 'tests.xmas'
require 'tests.production'
require 'tests.spells'
require 'tests.undead'

View File

@ -14,3 +14,4 @@ require 'tests.items'
require 'tests.magicbag'
require 'tests.process'
require 'tests.production'
require 'tests.undead'

View File

@ -991,3 +991,20 @@ function test_bug2187()
set_rule("rules.food.flags", "4")
end
function test_give_to_other_fails()
-- E3: cannot give a person to another faction
local r = region.create(0, 0, "plain")
local f1 = faction.create("human")
local f2 = faction.create("human")
local u1 = unit.create(f1, r, 2, "human")
local u2 = unit.create(f2, r, 1, "human")
-- u2:add_order("HELFE " .. itoa36(f1.id) .. " GIB")
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
process_orders()
assert_equal(2, u1.number)
assert_equal(1, u2.number)
end

113
scripts/tests/undead.lua Normal file
View File

@ -0,0 +1,113 @@
require "lunit"
module("tests.undead", package.seeall, lunit.testcase)
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.peasants.growth", "1")
eressea.settings.set("study.random_progress", "0")
eressea.settings.set("GiveRestriction", "0")
end
function test_give_undead_to_self()
-- generic undead cannot be given
local r = region.create(0, 0, "plain")
local f = faction.create("human")
local u1 = unit.create(f, r, 2, "undead")
local u2 = unit.create(f, r, 1, "undead")
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
process_orders()
assert_equal(2, u1.number)
assert_equal(1, u2.number)
end
function test_give_self_undead_fail()
-- disallow giving basic undead units
local r = region.create(0, 0, "plain")
local f = faction.create("human")
local u1 = unit.create(f, r, 2, "undead")
local u2 = unit.create(f, r, 1, "undead")
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
process_orders()
assert_equal(2, u1.number)
assert_equal(1, u2.number)
end
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, 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")
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)
end
function test_give_self_zombie_okay()
-- allow giving zombie units to own units of same race
u1, u2 = setup_give_self("zombie")
process_orders()
assert_equal(1, u1.number)
assert_equal(2, u2.number)
end
function test_give_self_skeleton_okay()
-- allow giving skeleton units to own units of same race
u1, u2 = setup_give_self("skeleton")
process_orders()
assert_equal(1, u1.number)
assert_equal(2, u2.number)
end
function test_give_self_ghoul_okay()
-- allow giving ghoul units to own units of same race
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)
end