forked from github/server
Merge pull request #431 from ennorehling/master
magic resistance never higher than 90%
This commit is contained in:
commit
9b5b79e75d
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue