forked from github/server
fix demon hunger in E3 and one intermittent test.
tests involving demons can disable skill changes.
This commit is contained in:
parent
cba452786f
commit
73f49ec90a
3 changed files with 22 additions and 12 deletions
|
@ -48,6 +48,7 @@
|
||||||
"healing.forest": 2.0,
|
"healing.forest": 2.0,
|
||||||
"hunger.long": false,
|
"hunger.long": false,
|
||||||
"hunger.damage": "1d9+9",
|
"hunger.damage": "1d9+9",
|
||||||
|
"hunger.demon.skills": true,
|
||||||
"hunger.demon.peasant_tolerance": true,
|
"hunger.demon.peasant_tolerance": true,
|
||||||
"init_spells": 0,
|
"init_spells": 0,
|
||||||
"recruit.allow_merge": true,
|
"recruit.allow_merge": true,
|
||||||
|
|
|
@ -31,10 +31,9 @@ function setup()
|
||||||
end
|
end
|
||||||
|
|
||||||
function teardown()
|
function teardown()
|
||||||
set_rule("rules.move.owner_leave")
|
for k,_ in pairs(settings) do
|
||||||
set_rule("rules.food.flags")
|
set_rule(k)
|
||||||
set_rule("rules.ship.drifting")
|
end
|
||||||
set_rule("rules.ship.storms")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_calendar()
|
function test_calendar()
|
||||||
|
@ -1011,6 +1010,7 @@ end
|
||||||
|
|
||||||
function test_demons_using_mallornlance()
|
function test_demons_using_mallornlance()
|
||||||
-- bug 2392
|
-- bug 2392
|
||||||
|
set_rule("skillchange.demon.up", "0")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create('goblin')
|
local f = faction.create('goblin')
|
||||||
local u = unit.create(f, r, 1, 'demon')
|
local u = unit.create(f, r, 1, 'demon')
|
||||||
|
|
25
src/study.c
25
src/study.c
|
@ -860,19 +860,28 @@ void reduce_skill_days(unit *u, skill_t sk, int days) {
|
||||||
void demon_skillchange(unit *u)
|
void demon_skillchange(unit *u)
|
||||||
{
|
{
|
||||||
skill *sv = u->skills;
|
skill *sv = u->skills;
|
||||||
int upchance = 15;
|
int upchance = 15, downchance = 10;
|
||||||
int downchance = 10;
|
static int config;
|
||||||
|
static bool rule_hunger;
|
||||||
|
static int cfgup, cfgdown;
|
||||||
|
|
||||||
|
if (config_changed(&config)) {
|
||||||
|
rule_hunger = config_get_int("hunger.demon.skills", 0) != 0;
|
||||||
|
cfgup = config_get_int("skillchange.demon.up", 15);
|
||||||
|
cfgdown = config_get_int("skillchange.demon.down", 10);
|
||||||
|
}
|
||||||
|
if (cfgup == 0) {
|
||||||
|
/* feature is disabled */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
upchance = cfgup;
|
||||||
|
downchance = cfgdown;
|
||||||
|
|
||||||
if (fval(u, UFL_HUNGER)) {
|
if (fval(u, UFL_HUNGER)) {
|
||||||
/* hungry demons only go down, never up in skill */
|
/* hungry demons only go down, never up in skill */
|
||||||
static int config;
|
|
||||||
static bool rule_hunger;
|
|
||||||
if (config_changed(&config)) {
|
|
||||||
rule_hunger = config_get_int("hunger.demon.skill", 0) != 0;
|
|
||||||
}
|
|
||||||
if (rule_hunger) {
|
if (rule_hunger) {
|
||||||
|
downchance = upchance;
|
||||||
upchance = 0;
|
upchance = 0;
|
||||||
downchance = 15;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue