Firing damage reduction for range is a feature that was always there
and never really documented. Different ways to fire reduced damage
differently for range, or not at all. Fix that by dropping the
reduction everywhere.
The reduction happened randomly, with probability p = (d/m)^2, where d
is the distance to the target, and m is the maximum firing range. The
fire command printed "Wind deflects shells" when it happened.
The old fire command (before MULTIFIRE) either halved damage (50%
chance), or reduced it by a factor of 1-p.
MULTIFIRE's fire command halved damage. v4.0.2 reduced that loss to
10-20%.
Interdiction halved damage, but only when firing from ships.
Other ways to fire (support, return fire, interdiction from forts and
land units) did not reduce damage for range.
int dam;
int totaldefdam = 0;
int vshipno;
- double prb;
natid vict;
struct shpstr fship;
struct lndstr fland;
default:
pr_beep();
pr("Kaboom!!!\n");
- prb = range2 ? (double)trange / range2 : 1.0;
- prb *= prb;
- if (chance(prb)) {
- pr("Wind deflects shells.\n");
-/* dam = (int)(dam / 2.0);*/
- dam *= (90 - (random() % 11)) / 100.0;
- if (dam < 0)
- dam = 0;
- }
break;
}
switch (target) {
int dam = 0, dam2, mission_flags;
natid plane_owner = 0;
int md, range, air_dam = 0;
- double prb, hitchance, vrange;
+ double hitchance, vrange;
getsect(x, y, §);
putship(sp->shp_uid, sp);
if (dam2 < 0)
continue;
- if (range == 0.0)
- prb = 1.0;
- else
- prb = (double)md / range;
- prb *= prb;
- if (chance(prb))
- dam2 /= 2;
dam += dam2;
if (sect.sct_type == SCT_WATER)
nreport(sp->shp_own, N_SHP_SHELL, victim, 1);