update/revolt: Reduce under-strength land unit damage

A land unit with mil military taking N casualties loses N * 100 / mil
points of efficiency.  A 50% inf with 20m dies when it loses more than
8m.  With 100m, it dies when it loses more than 40m.  A land unit
always dies when it loses all military.

In ordinary ground combat, they lose N * 100 / maxmil points of
efficiency, where maxmil is how many military they could load.  This
is less damage when the land unit is under-strength.  A 50% inf dies
when it loses more than 40m, regardless of how many it has.

An inefficient land unit with a sufficiently high number of military
can die before its military are all killed.  A land unit with a
sufficiently low number of military can survive loss of all its
military.  Attacking land units return to their starting position.
Defending land units stay put, and get taken over by a victorious
attacker.  Neither was possible before 4.0.0 made land unit military
loadable.

The rules for ordinary ground combat may be debatable, but it's better
to be consistent: change land unit damage in guerrilla combat to match
ordinary combat.  This reduces damage to under-strength land units.

If che lose, the sector owner profits from the reduced damage.  But if
they win, they may take over land units that got all their military
killed.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-09-18 14:22:03 +02:00
parent 8a3eb898ce
commit 4fd1e889c8
4 changed files with 44 additions and 44 deletions

View file

@ -419,9 +419,10 @@ take_casualties(struct sctstr *sp, int mc)
{
int orig_mil, taken;
int cantake;
int nunits = 0, each, deq, dam;
int nunits = 0, each, deq;
struct lndstr *lp;
struct nstr_item ni;
double eff_per_cas;
/* casualties come out of mil first */
orig_mil = sp->sct_item[I_MILIT];
@ -468,16 +469,16 @@ take_casualties(struct sctstr *sp, int mc)
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT], cantake);
eff_per_cas = 100.0 / lchr[lp->lnd_type].l_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT],
(int)((lp->lnd_effic - 40) / eff_per_cas));
deq = MIN(cantake, MIN(each, mc - taken));
if (deq <= 0)
continue;
taken += deq;
dam = ((double)deq / lp->lnd_item[I_MILIT]) * 100.0;
lp->lnd_effic -= dam;
lp->lnd_mobil -= dam / 2;
lp->lnd_effic -= deq * eff_per_cas;
lp->lnd_mobil -= deq * eff_per_cas / 2;
lnd_submil(lp, deq);
if (taken >= mc)
return taken;
@ -495,16 +496,16 @@ take_casualties(struct sctstr *sp, int mc)
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
continue;
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT], cantake);
eff_per_cas = 100.0 / lchr[lp->lnd_type].l_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT],
(int)((lp->lnd_effic - 40) / eff_per_cas));
deq = MIN(cantake, MIN(each, mc - taken));
if (deq <= 0)
continue;
taken += deq;
dam = ((double)deq / lp->lnd_item[I_MILIT]) * 100.0;
lp->lnd_effic -= dam;
lp->lnd_mobil -= dam / 2;
lp->lnd_effic -= deq * eff_per_cas;
lp->lnd_mobil -= deq * eff_per_cas / 2;
lnd_submil(lp, deq);
if (taken >= mc)
return taken;