From 53d984343240400e0e4c3f77bd67d33af4a5e7ff Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 2 Jun 2008 07:42:14 +0200 Subject: [PATCH] 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. --- src/lib/commands/mfir.c | 10 ---------- src/lib/subs/mission.c | 9 +-------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index 304157ad..4bf6e520 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -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) { diff --git a/src/lib/subs/mission.c b/src/lib/subs/mission.c index e038c12c..c36a5220 100644 --- a/src/lib/subs/mission.c +++ b/src/lib/subs/mission.c @@ -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, §); @@ -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);