reduce monster spawning with configuration settings.

This commit is contained in:
Enno Rehling 2017-11-07 19:35:21 +01:00
parent fa42423f3c
commit 98be298d72
2 changed files with 12 additions and 3 deletions

View File

@ -18,6 +18,7 @@
"modules.wormhole": true,
"modules.iceberg": true,
"modules.volcano": true,
"monsters.spawn.chance": 50,
"entertain.base": 0,
"entertain.perlevel": 20,
"taxing.perlevel": 20,

View File

@ -874,19 +874,27 @@ void spawn_dragons(void)
{
region *r;
faction *monsters = get_or_create_monsters();
int minage = config_get_int("monsters.spawn.min_age", 100);
int spawn_chance = 100 * config_get_int("monsters.spawn.chance", 100);
if (spawn_chance <= 0) {
/* monster spawning disabled */
return;
}
for (r = regions; r; r = r->next) {
unit *u;
if (r->age < minage) {
continue;
}
if (fval(r->terrain, SEA_REGION)) {
if (rng_int() % 10000 < 1) {
if (rng_int() % spawn_chance < 1) {
u = spawn_seaserpent(r, monsters);
}
}
else if ((r->terrain == newterrain(T_GLACIER)
|| r->terrain == newterrain(T_SWAMP)
|| r->terrain == newterrain(T_DESERT))
&& rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
&& rng_int() % spawn_chance < (5 + 100 * chaosfactor(r))) {
if (chance(0.80)) {
u = create_unit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON), 0, NULL, NULL);
}