convert shoot: Make security bonus proportional to efficiency

Land units with capability security reduce the mobility cost and have
their military count double, regardless of efficiency.  This lets
players get the benefits of a security unit at a discount: just don't
build it beyond 10%.

Count security unit's military times 1 + eff/100 instead of double.
Change the mobility bonus term from number of security units to sum of
security unit efficiency / 100.  Partial fix for bug#64.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-09-16 13:30:47 +02:00
parent ffd6651f86
commit 3c1c68f16d
4 changed files with 26 additions and 25 deletions

View file

@ -42,28 +42,29 @@
/*
* Return strength of security detail in @sp.
* Store number of land units with security capability in @nsecurity.
* Store sum of efficiency of land units with security capability in
* @seceffp.
*/
int
security_strength(struct sctstr *sp, int *nsecurity)
double
security_strength(struct sctstr *sp, int *seceffp)
{
int strength;
int nsec;
double strength;
int seceff;
struct nstr_item ni;
struct lndstr land;
strength = sp->sct_item[I_MILIT];
nsec = 0;
seceff = 0;
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (nxtitem(&ni, &land)) {
strength += land.lnd_item[I_MILIT];
if (lchr[land.lnd_type].l_flags & L_SECURITY) {
strength += land.lnd_item[I_MILIT];
nsec++;
strength += land.lnd_item[I_MILIT] * land.lnd_effic / 100.0;
seceff += land.lnd_effic;
}
}
*nsecurity = nsec;
*seceffp = seceff;
return strength;
}