From 68fc4df74de50aa6221d0d74e01786f97ece33dd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 19 Aug 2014 15:24:30 +0200 Subject: [PATCH] Configurable monster attack chance, default to 40%. E3 chance to attack is only 10%. --- conf/e3/config.xml | 1 + critbit | 2 +- src/kernel/config.h | 3 --- src/monsters.c | 6 +++++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/conf/e3/config.xml b/conf/e3/config.xml index 55d020ae6..36b5a692c 100644 --- a/conf/e3/config.xml +++ b/conf/e3/config.xml @@ -118,6 +118,7 @@ + diff --git a/critbit b/critbit index 2a7af5e23..2d901a238 160000 --- a/critbit +++ b/critbit @@ -1 +1 @@ -Subproject commit 2a7af5e2347217ea4efcf7fb3f0bc9c2681d1a17 +Subproject commit 2d901a238b98b14204f9118abc5040ff4904052c diff --git a/src/kernel/config.h b/src/kernel/config.h index 4a2870f81..1305bd473 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -65,9 +65,6 @@ extern "C" { #define PLAGUE_HEALCHANCE 0.25F /* Wahrscheinlichkeit Heilung */ #define PLAGUE_HEALCOST 30 /* Heilkosten */ - /* Chance of a monster attack */ -#define MONSTERATTACK 0.4F - /* Bewegungsweiten: */ #define BP_WALKING 4 #define BP_RIDING 6 diff --git a/src/monsters.c b/src/monsters.c index af35dc54f..0edc5cda2 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -132,6 +132,10 @@ static void reduce_weight(unit * u) } } +static float monster_attack_chance(void) { + return get_param_flt(global.parameters, "rules.monsters.attack_chance", 0.4f); +} + static order *monster_attack(unit * u, const unit * target) { if (u->region != target->region) @@ -747,7 +751,7 @@ void plan_monsters(faction * f) for (r = regions; r; r = r->next) { unit *u; - double attack_chance = MONSTERATTACK; + double attack_chance = monster_attack_chance(); bool attacking = false; for (u = r->units; u; u = u->next) {