update/revolt: Destroy land units only when casualties demand it
take_casualties() first applies casualties without destroying land units, and if any remain, applies them by destroying land units. This is wrong, because the remaining casualties may not suffice to actually kill. Has been that way since land units were added in Chainsaw 3. Apply remaining casualties more carefully: destroy land units only when efficiency falls below 10%. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
4fd1e889c8
commit
35ecc008ce
4 changed files with 42 additions and 26 deletions
|
@ -524,8 +524,17 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||
continue;
|
||||
|
||||
taken += lp->lnd_item[I_MILIT];
|
||||
lnd_dies_fighting_che(lp);
|
||||
eff_per_cas = 100.0 / lchr[lp->lnd_type].l_item[I_MILIT];
|
||||
deq = MIN(lp->lnd_item[I_MILIT], mc - taken);
|
||||
|
||||
taken += deq;
|
||||
lp->lnd_effic -= deq * eff_per_cas;
|
||||
lp->lnd_mobil -= deq * eff_per_cas / 2;
|
||||
lnd_submil(lp, deq);
|
||||
if (lp->lnd_effic < LAND_MINEFF) {
|
||||
taken += lp->lnd_item[I_MILIT];
|
||||
lnd_dies_fighting_che(lp);
|
||||
}
|
||||
if (taken >= mc)
|
||||
return taken;
|
||||
}
|
||||
|
@ -543,8 +552,17 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
|
||||
continue;
|
||||
|
||||
eff_per_cas = 100.0 / lchr[lp->lnd_type].l_item[I_MILIT];
|
||||
deq = MIN(lp->lnd_item[I_MILIT], mc - taken);
|
||||
|
||||
taken += lp->lnd_item[I_MILIT];
|
||||
lnd_dies_fighting_che(lp);
|
||||
lp->lnd_effic -= deq * eff_per_cas;
|
||||
lp->lnd_mobil -= deq * eff_per_cas / 2;
|
||||
lnd_submil(lp, deq);
|
||||
if (lp->lnd_effic < LAND_MINEFF) {
|
||||
taken += lp->lnd_item[I_MILIT];
|
||||
lnd_dies_fighting_che(lp);
|
||||
}
|
||||
if (taken >= mc)
|
||||
return taken;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue