no more than 4 critical hits

This commit is contained in:
Enno Rehling 2017-05-02 09:59:04 +02:00
parent 83d40962d2
commit 5778bc2c93
1 changed files with 2 additions and 1 deletions

View File

@ -1205,11 +1205,12 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
if (type != AT_COMBATSPELL && type != AT_SPELL) { if (type != AT_COMBATSPELL && type != AT_SPELL) {
if (rule_damage & DAMAGE_CRITICAL) { if (rule_damage & DAMAGE_CRITICAL) {
double kritchance = (sk * 3 - sd) / 200.0; double kritchance = (sk * 3 - sd) / 200.0;
int maxk = 4;
kritchance = MAX(kritchance, 0.005); kritchance = MAX(kritchance, 0.005);
kritchance = MIN(0.9, kritchance); kritchance = MIN(0.9, kritchance);
while (chance(kritchance)) { while (maxk-- && chance(kritchance)) {
da += dice_rand(damage); da += dice_rand(damage);
} }
} }