forked from github/server
fix lua test for blessed harvest.
This commit is contained in:
parent
7e529f2b4c
commit
6e3ed568ea
|
@ -5,6 +5,9 @@ module("tests.e3.spells", package.seeall, lunit.testcase)
|
||||||
function setup()
|
function setup()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
eressea.settings.set("magic.fumble.enable", "0")
|
eressea.settings.set("magic.fumble.enable", "0")
|
||||||
|
eressea.settings.set("nmr.removenewbie", "0")
|
||||||
|
eressea.settings.set("nmr.timeout", "0")
|
||||||
|
eressea.settings.set("rules.peasants.growth", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_blessedharvest_lasts_n_turn()
|
function test_blessedharvest_lasts_n_turn()
|
||||||
|
@ -25,25 +28,20 @@ function test_blessedharvest_lasts_n_turn()
|
||||||
assert_equal(0, err)
|
assert_equal(0, err)
|
||||||
|
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
local level = 5
|
u:add_order("ZAUBERE STUFE 3 Regentanz")
|
||||||
u:add_order("ZAUBERE STUFE " .. level .. " Regentanz")
|
|
||||||
assert_equal(0, r:get_resource("money"), 0)
|
assert_equal(0, r:get_resource("money"), 0)
|
||||||
|
|
||||||
local m = 0
|
local m = 0
|
||||||
local p = 100
|
local p = 100
|
||||||
for i=1,level+2 do
|
|
||||||
process_orders()
|
process_orders()
|
||||||
local income = p * 12
|
assert_equal(200, r:get_resource("money"))
|
||||||
p = r:get_resource("peasant")
|
u:clear_orders()
|
||||||
income = income - p * 10
|
u:add_order("ARBEITEN")
|
||||||
m = m + income
|
process_orders()
|
||||||
-- print(i, m, p, r:get_resource("money"))
|
process_orders()
|
||||||
if (i>level+1) then
|
process_orders()
|
||||||
assert_not_equal(m, r:get_resource("money"))
|
assert_equal(800, r:get_resource("money"))
|
||||||
else
|
process_orders()
|
||||||
assert_equal(m, r:get_resource("money"))
|
assert_equal(900, r:get_resource("money"))
|
||||||
end
|
|
||||||
u:clear_orders()
|
|
||||||
u:add_order("ARBEITEN")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1606,7 +1606,7 @@ int write_reports(faction * f, time_t ltime)
|
||||||
ctx.userdata = NULL;
|
ctx.userdata = NULL;
|
||||||
get_seen_interval(&ctx);
|
get_seen_interval(&ctx);
|
||||||
get_addresses(&ctx);
|
get_addresses(&ctx);
|
||||||
|
_mkdir(reportpath());
|
||||||
do {
|
do {
|
||||||
report_type *rtype = report_types;
|
report_type *rtype = report_types;
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ static void peasants(region * r)
|
||||||
/* Bis zu 1000 Bauern können Zwillinge bekommen oder 1000 Bauern
|
/* Bis zu 1000 Bauern können Zwillinge bekommen oder 1000 Bauern
|
||||||
* wollen nicht! */
|
* wollen nicht! */
|
||||||
|
|
||||||
if (peasants > 0) {
|
if (peasants > 0 && get_param_int(global.parameters, "rules.peasants.growth", 1)) {
|
||||||
int glueck = 0;
|
int glueck = 0;
|
||||||
double fraction = peasants * 0.0001F * PEASANTGROWTH;
|
double fraction = peasants * 0.0001F * PEASANTGROWTH;
|
||||||
int births = (int)fraction;
|
int births = (int)fraction;
|
||||||
|
@ -938,9 +938,7 @@ void demographics(void)
|
||||||
* und gewandert sind */
|
* und gewandert sind */
|
||||||
|
|
||||||
calculate_emigration(r);
|
calculate_emigration(r);
|
||||||
if (get_param_int(global.parameters, "rules.peasants.growth", 1)) {
|
peasants(r);
|
||||||
peasants(r);
|
|
||||||
}
|
|
||||||
if (r->age > 20) {
|
if (r->age > 20) {
|
||||||
plagues(r, false);
|
plagues(r, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue