]> git.pond.sub.org Git - empserver/commitdiff
Remove inconsistent shelling damage reduction for range
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 2 Jun 2008 05:42:14 +0000 (07:42 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 6 Jun 2008 19:31:55 +0000 (21:31 +0200)
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.

src/lib/commands/mfir.c
src/lib/subs/mission.c

index 304157ad1b8ac415b3cb990609af9307e9db36cd..4bf6e5200e0fad9d748e76f9090c6984bda3214a 100644 (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) {
index e038c12c6207f3265d3bd7b63a7bd43744d8c91d..c36a5220813b87f12b0c1442816968880ac01987 100644 (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);