Zombies koennen Personen gebn

This commit is contained in:
Enno Rehling 2017-06-11 14:43:46 +02:00
parent de1e0ae916
commit 60efb12d70
7 changed files with 103 additions and 2 deletions

View File

@ -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"/>

View File

@ -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"/>

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

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

@ -0,0 +1,66 @@
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
function test_give_other_zombie_fail()
-- cannot give undead units 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, "zombie")
local u2 = unit.create(f2, r, 1, "zombie")
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
u1:add_order("GIB " .. itoa36(u2.id) .. " 1 PERSON")
-- TODO: Migranten blockieren das derzeit, nicht Untoten-Eigenschaften
process_orders()
assert_equal(2, u1.number)
assert_equal(1, u2.number)
end
function test_give_self_zombie_okay()
-- allow giving undead 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")
process_orders()
assert_equal(1, u1.number)
assert_equal(2, u2.number)
end