Remove inconsistent shelling damage reduction for range

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.
This commit is contained in:
Markus Armbruster 2008-06-02 07:42:14 +02:00
parent fa7e3aa9be
commit 53d9843432
2 changed files with 1 additions and 18 deletions

View file

@ -76,7 +76,6 @@ multifire(void)
int dam;
int totaldefdam = 0;
int vshipno;
double prb;
natid vict;
struct shpstr fship;
struct lndstr fland;
@ -448,15 +447,6 @@ multifire(void)
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) {

View file

@ -411,7 +411,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
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, &sect);
@ -539,13 +539,6 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
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);