diff --git a/scripts/tests/e2/spells.lua b/scripts/tests/e2/spells.lua index a9f49d2b8..6a34d98db 100644 --- a/scripts/tests/e2/spells.lua +++ b/scripts/tests/e2/spells.lua @@ -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 diff --git a/src/battle.c b/src/battle.c index 9e2f841c0..64808747d 100644 --- a/src/battle.c +++ b/src/battle.c @@ -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]; }