fix magic resistance (bug 2480)

This commit is contained in:
Steffen Mecke 2018-09-04 16:41:46 +02:00
parent 7544565237
commit aed7432bb2
2 changed files with 13 additions and 1 deletions

View file

@ -136,3 +136,16 @@ function test_familiar_lynx()
assert_equal(1, u:get_skill('magic'))
assert_equal(1, u:get_skill('perception'))
end
function test_bug_2480()
local r = region.create(0, 0, "plain")
local f = faction.create("human", "hodor@eressea.de", "de")
local u1 = unit.create(f, r, 1)
local monster = unit.create(get_monsters(), r, 1, "wyrm")
u1.number = 30
u1.hp = u1.hp_max * u1.number
monster:add_order("ATTACK " .. itoa36(u1.id))
process_orders()
assert_equal(0, u1.number);
write_reports()
end

View file

@ -1169,7 +1169,6 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
}
if (magic) {
res = frac_sub(frac_one, res);
res = frac_mul(frac_make(da, 1), res);
da = res.sa[0] / res.sa[1];
}