diff --git a/src/battle.c b/src/battle.c index a63caa291..52d0456ad 100644 --- a/src/battle.c +++ b/src/battle.c @@ -1141,7 +1141,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile) const weapon_type *dwtype = NULL; const weapon_type *awtype = NULL; const weapon *weapon; - variant res = frac_make(1, 1); + variant res = frac_one; int rda, sk = 0, sd; bool magic = false; @@ -1185,6 +1185,7 @@ 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]; } diff --git a/src/items/weapons.c b/src/items/weapons.c index acb47f0e0..53721bca6 100644 --- a/src/items/weapons.c +++ b/src/items/weapons.c @@ -76,7 +76,7 @@ int *casualties) killed += terminate(dt, *at, AT_SPELL, damage, 1); } } while (force && killed < enemies); - if (casualties) + if (killed > 0 && casualties) *casualties = killed; return true; } diff --git a/src/kernel/build.c b/src/kernel/build.c index 1f4e143df..81a6a90c8 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -405,7 +405,7 @@ static int required(int size, int msize, int maxneed) static int matmod(const unit * u, const resource_type * rtype, int value) { if (rtype->modifiers) { - variant save = frac_make(1, 1); + variant save = frac_one; const struct building_type *btype = NULL; const struct race *rc = u_race(u); resource_mod *mod; diff --git a/src/volcano.c b/src/volcano.c index db7166de0..c912bc0df 100644 --- a/src/volcano.c +++ b/src/volcano.c @@ -106,8 +106,8 @@ damage_unit(unit * u, const char *dam, bool physical, bool magic) int damage = dice_rand(dam); if (magic) { variant magres = magic_resistance(u); - magres = frac_sub(frac_make(1, 1), magres); - damage = damage * magres.sa[0] / magres.sa[1]; + int save = magres.sa[0] / magres.sa[1]; + damage -= damage * save; } if (physical) { damage -= nb_armor(u, i);