Merge branch 'master' into develop

Conflicts:
	src/buildno.h
This commit is contained in:
Enno Rehling 2015-12-06 20:51:14 +01:00
commit 1a9e3db423
2 changed files with 4 additions and 2 deletions

View File

@ -348,8 +348,9 @@ static void test_magic_resistance(CuTest *tc)
CuAssertDblEquals_Msg(tc, "race reduction", 0.4, magres, 0.01); CuAssertDblEquals_Msg(tc, "race reduction", 0.4, magres, 0.01);
rc->magres = 1.5; /* should not cause negative damage multiplier */ 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); 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); free_battle(b);
test_cleanup(); test_cleanup();

View File

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