by request: magic resistance never higher than 90%, so highly skilled monsters cannot become completely invincible to magic.
This commit is contained in:
Enno Rehling 2015-12-06 20:48:22 +01:00
parent d04d8e782e
commit 9b7d4adda5
2 changed files with 4 additions and 2 deletions

View File

@ -330,8 +330,9 @@ static void test_magic_resistance(CuTest *tc)
CuAssertDblEquals_Msg(tc, "race reduction", 0.4, magres, 0.01);
rc->magres = 1.5; /* should not cause negative damage multiplier */
CuAssertDblEquals_Msg(tc, "magic resistance is never > 0.9", 0.9, magic_resistance(du), 0.01);
calculate_armor(dt, 0, 0, &magres);
CuAssertDblEquals_Msg(tc, "damage reduction is never < 0", 0.0, magres, 0.01);
CuAssertDblEquals_Msg(tc, "damage reduction is never < 0.1", 0.1, magres, 0.01);
free_battle(b);
test_cleanup();

View File

@ -1177,7 +1177,8 @@ double magic_resistance(unit * target)
if (btype)
probability += btype->magresbonus * 0.01;
}
return probability;
return (probability<0.9) ? probability : 0.9;
}
/* ------------------------------------------------------------- */