Skip to content

Instantly share code, notes, and snippets.

@ennorehling
Last active September 10, 2019 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ennorehling/3fcd3289e8263109749f1cbb23816713 to your computer and use it in GitHub Desktop.
Save ennorehling/3fcd3289e8263109749f1cbb23816713 to your computer and use it in GitHub Desktop.
function test_bug_2605()
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local r3 = region.create(3, 0, "plain")
local f = faction.create("human")
-- 1. two walkers, each with two horses and a cart:
local u1 = unit.create(f, r0, 2)
u1:add_item("horse", 2)
u1:add_item("cart", 1)
u1:add_order("NACH O O O")
-- 2. two riders, each with two horses and a cart:
local u2 = unit.create(f, r0, 2)
u2:set_skill("riding", 1)
u2:add_item("horse", 4)
u2:add_item("cart", 2)
u2:add_order("NACH O O O")
-- 2. two riders, each with five horses, and max carts:
local u3 = unit.create(f, r0, 2)
u3:set_skill("riding", 1)
u3:add_item("horse", 10)
u3:add_item("cart", 5)
u3:add_order("NACH O O O")
process_orders()
assert_equal(r1, u1.region)
assert_equal(r2, u2.region)
assert_equal(r1, u3.region)
end
function test_eon_2605()
local r0 = region.create(0, 0, "plain")
local r1 = region.create(1, 0, "plain")
local r2 = region.create(2, 0, "plain")
local r3 = region.create(3, 0, "plain")
local f = faction.create("human")
-- 1. ten riders walk with 50 horses and 25 carts:
local u1 = unit.create(f, r0, 10)
u1:set_skill("riding", 1)
u1:add_item("horse", 50)
u1:add_item("cart", 25)
u1:add_order("NACH O O O")
process_orders()
assert_equal(r1, u1.region)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment