forked from github/server
test for raindance/harvest spells, both games
This commit is contained in:
parent
fb8f63e73b
commit
74673f172f
|
@ -27,7 +27,39 @@ function test_shapeshift()
|
|||
assert_equal("1 Goblin", string.sub(s, string.find(s, "1 Goblin")))
|
||||
end
|
||||
|
||||
-- E3: earn 50 per level of spell
|
||||
function test_raindance()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("halfling", "noreply@eressea.de", "de")
|
||||
local u = unit.create(f, r)
|
||||
local err = 0
|
||||
r:set_resource("peasant", 100)
|
||||
r:set_resource("money", 0)
|
||||
u.magic = "gwyrrd"
|
||||
u.race = "dwarf"
|
||||
u:set_skill("magic", 20)
|
||||
u.aura = 200
|
||||
err = err + u:add_spell("raindance")
|
||||
assert_equal(0, err)
|
||||
|
||||
u:clear_orders()
|
||||
u:add_order("ZAUBERE STUFE 1 Regentanz")
|
||||
assert_equal(0, r:get_resource("money"))
|
||||
|
||||
process_orders()
|
||||
assert_equal(200, r:get_resource("money"))
|
||||
assert_equal(0, u:get_item("money"))
|
||||
|
||||
u:clear_orders()
|
||||
u:add_order("ARBEITEN")
|
||||
process_orders()
|
||||
assert_equal(10, u:get_item("money")) -- only peasants benefit
|
||||
assert_equal(400, r:get_resource("money"))
|
||||
-- this is where the spell ends
|
||||
process_orders()
|
||||
process_orders()
|
||||
assert_equal(600, r:get_resource("money"))
|
||||
end
|
||||
|
||||
function test_earn_silver()
|
||||
local r = region.create(0, 0, "mountain")
|
||||
local f = faction.create("human")
|
||||
|
|
|
@ -9,20 +9,17 @@ function setup()
|
|||
eressea.settings.set("rules.peasants.growth", "0")
|
||||
end
|
||||
|
||||
function test_blessedharvest_lasts_n_turn()
|
||||
function test_raindance()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("halfling", "noreply@eressea.de", "de")
|
||||
local u = unit.create(f, r)
|
||||
local err = 0
|
||||
r:set_resource("peasant", 100)
|
||||
r:set_resource("money", 0)
|
||||
u:add_item("money", 1000)
|
||||
u.magic = "gwyrrd"
|
||||
u.race = "dwarf"
|
||||
u:set_skill("magic", 20)
|
||||
u.aura = 200
|
||||
err = err + u:add_spell("raindance")
|
||||
err = err + u:add_spell("blessedharvest")
|
||||
local err = u:add_spell("raindance")
|
||||
assert_equal(0, err)
|
||||
|
||||
u:clear_orders()
|
||||
|
|
|
@ -704,7 +704,7 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
|||
else {
|
||||
wage = wagetable[esize][2];
|
||||
}
|
||||
if (rule_blessed_harvest() == HARVEST_WORK) {
|
||||
if (r->attribs && rule_blessed_harvest() == HARVEST_WORK) {
|
||||
/* E1 rules */
|
||||
wage += curse_geteffect(get_curse(r->attribs, ct_find("blessedharvest")));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue