Configurable monster attack chance, default to 40%.

E3 chance to attack is only 10%.
This commit is contained in:
Enno Rehling 2014-08-19 15:24:30 +02:00
parent fb7c8a898f
commit 68fc4df74d
4 changed files with 7 additions and 5 deletions

View File

@ -118,6 +118,7 @@
<param name="study.speedup" value="0"/>
<param name="world.era" value="3"/>
<param name="rules.migrants" value="0"/>
<param name="rules.monsters.attack_chance" value="0.1"/>
<param name="rules.transfermen" value="0"/>
<param name="rules.stealth.faction" value="1"/>
<param name="rules.stealth.anon_battle" value="0"/>

@ -1 +1 @@
Subproject commit 2a7af5e2347217ea4efcf7fb3f0bc9c2681d1a17
Subproject commit 2d901a238b98b14204f9118abc5040ff4904052c

View File

@ -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

View File

@ -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) {