forked from github/server
Merge pull request #706 from ennorehling/2331-undead-give
BUG 2331: allow GIVE PERSON for undead units
This commit is contained in:
commit
72a1877d26
|
@ -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"/>
|
||||
|
@ -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"/>
|
||||
|
@ -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"/>
|
||||
|
|
|
@ -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"/>
|
||||
|
@ -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"/>
|
||||
|
@ -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"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,3 +21,4 @@ require 'tests.process'
|
|||
require 'tests.xmas'
|
||||
require 'tests.production'
|
||||
require 'tests.spells'
|
||||
require 'tests.undead'
|
||||
|
|
|
@ -14,3 +14,4 @@ require 'tests.items'
|
|||
require 'tests.magicbag'
|
||||
require 'tests.process'
|
||||
require 'tests.production'
|
||||
require 'tests.undead'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
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 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")
|
||||
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
|
||||
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")
|
||||
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
|
||||
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")
|
||||
process_orders()
|
||||
assert_equal(1, u1.number)
|
||||
assert_equal(2, u2.number)
|
||||
end
|
Loading…
Reference in New Issue