forked from github/server
insects trying to land in glaciers should not damage ships (cf. #1729)
This commit is contained in:
parent
7fc1b4ae8c
commit
929ee605e1
3 changed files with 101 additions and 1 deletions
|
@ -13,7 +13,8 @@
|
|||
<xi:include href="weapons.xml" />
|
||||
<xi:include href="items.xml" />
|
||||
<xi:include href="races.xml"/>
|
||||
<xi:include href="ships.xml"/>
|
||||
<!-- <xi:include href="ships.xml"/> -->
|
||||
<xi:include href="eressea:///core/ships.xml"/>
|
||||
<xi:include href="buildings.xml"/>
|
||||
<xi:include href="eressea:///core/common/buildings.xml"/>
|
||||
<xi:include href="spells.xml"/>
|
||||
|
|
|
@ -2,6 +2,7 @@ require "example.rules"
|
|||
|
||||
local srcpath = config.source_dir
|
||||
tests = {
|
||||
srcpath .. '/example/scripts/tests/rules.lua',
|
||||
srcpath .. '/shared/scripts/tests/common.lua',
|
||||
srcpath .. '/shared/scripts/tests/bson.lua',
|
||||
}
|
||||
|
|
98
scripts/tests/rules.lua
Normal file
98
scripts/tests/rules.lua
Normal file
|
@ -0,0 +1,98 @@
|
|||
require "lunit"
|
||||
|
||||
module("tests.rules", package.seeall, lunit.testcase)
|
||||
|
||||
function setup()
|
||||
free_game()
|
||||
settings.set("nmr.removenewbie", "0")
|
||||
settings.set("nmr.timeout", "0")
|
||||
settings.set("NewbieImmunity", "0")
|
||||
end
|
||||
|
||||
function test_landing1()
|
||||
local ocean = region.create(1, 0, "ocean")
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "insects", "de")
|
||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
||||
local s = ship.create(ocean, "longboat")
|
||||
local u1 = unit.create(f, ocean, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
assert_not_nil(u2)
|
||||
u1:add_item("money", 1000)
|
||||
u2:add_item("money", 1000)
|
||||
|
||||
u1.ship = s
|
||||
u1:set_skill("sailing", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH w")
|
||||
process_orders()
|
||||
|
||||
assert_equal(r.id, u1.region.id) -- the plain case: okay
|
||||
end
|
||||
|
||||
function test_landing2()
|
||||
local ocean = region.create(1, 0, "ocean")
|
||||
local r = region.create(0, 0, "glacier")
|
||||
local harbour = building.create(r, "harbour")
|
||||
harbour.size = 25
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
||||
local s = ship.create(ocean, "longboat")
|
||||
local u1 = unit.create(f, ocean, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
assert_not_nil(u2)
|
||||
u1:add_item("money", 1000)
|
||||
u2:add_item("money", 1000)
|
||||
|
||||
u1.ship = s
|
||||
u1:set_skill("sailing", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH w")
|
||||
process_orders()
|
||||
|
||||
assert_equal(r.id, u1.region.id) -- glacier with harbour -- okay
|
||||
end
|
||||
|
||||
function test_landing3()
|
||||
local ocean = region.create(1, 0, "ocean")
|
||||
local r = region.create(0, 0, "glacier")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
||||
local s = ship.create(ocean, "longboat")
|
||||
local u1 = unit.create(f, ocean, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
assert_not_nil(u2)
|
||||
u1:add_item("money", 1000)
|
||||
u2:add_item("money", 1000)
|
||||
|
||||
u1.ship = s
|
||||
u1:set_skill("sailing", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH w")
|
||||
process_orders()
|
||||
|
||||
assert_equal(ocean.id, u1.region.id) -- cannot land in glacier without harbour
|
||||
end
|
||||
|
||||
function test_landing3()
|
||||
local ocean = region.create(1, 0, "ocean")
|
||||
local r = region.create(0, 0, "glacier")
|
||||
local harbour = building.create(r, "harbour")
|
||||
harbour.size = 25
|
||||
local f = faction.create("noreply@eressea.de", "insects", "de")
|
||||
local f2 = faction.create("noreply@eressea.de", "human", "de")
|
||||
local s = ship.create(ocean, "longboat")
|
||||
local u1 = unit.create(f, ocean, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
assert_not_nil(u2)
|
||||
u1:add_item("money", 1000)
|
||||
u2:add_item("money", 1000)
|
||||
|
||||
u1.ship = s
|
||||
u1:set_skill("sailing", 10)
|
||||
u1:clear_orders()
|
||||
u1:add_order("NACH w")
|
||||
process_orders()
|
||||
|
||||
assert_equal(ocean.id, u1.region.id) -- insects cannot land in glaciers
|
||||
end
|
Loading…
Reference in a new issue