From 04dddb6bd13cd09c9f466947c4658651bf6c5026 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 19 Sep 2016 20:05:51 +0200 Subject: [PATCH] update/revolt: Make security bonus proportional to efficiency Land units with capability security get a combat bonus regardless of efficiency. This lets players get the benefits of a security unit at a discount: just don't build it beyond 10%. Multiply the combat bonus by eff/100. Together with the previous commit, this closes bug#64. Note that the the strength of a security unit's commando raid is already proportional to its efficiency. Signed-off-by: Markus Armbruster --- src/lib/update/revolt.c | 6 +++--- tests/update/final.xdump | 4 ++-- tests/update/journal.log | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/update/revolt.c b/src/lib/update/revolt.c index 963b7166d..93de035b5 100644 --- a/src/lib/update/revolt.c +++ b/src/lib/update/revolt.c @@ -129,10 +129,10 @@ guerrilla(struct sctstr *sp) struct sctstr *nsp; int recruit; int move; - int ratio; + double ratio; int che; int mil; - int security_bonus; + double security_bonus; int cc, mc; double odds; int civ; @@ -182,7 +182,7 @@ guerrilla(struct sctstr *sp) if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) { int che_kill, r; - security_bonus += lp->lnd_item[I_MILIT] * 3; + security_bonus += 3 * lp->lnd_item[I_MILIT] * lp->lnd_effic / 100.0; r = (lp->lnd_item[I_MILIT] * lp->lnd_effic) / 500; che_kill = r < 1 ? 0 : roll(r); if (che_kill > che) diff --git a/tests/update/final.xdump b/tests/update/final.xdump index 73a5cac84..e2e92ecc6 100644 --- a/tests/update/final.xdump +++ b/tests/update/final.xdump @@ -157,7 +157,7 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd 3 14 -8 4 9 120 0 112 0 0 0 0 0 14 -8 9 0 34 1 4 0 0 0 0 0 3 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 5 -16 -8 4 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0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 @@ -172,7 +172,7 @@ owner xloc yloc des effic mobil off loyal terr0 terr1 terr2 terr3 dterr xdist yd 3 13 -7 4 11 120 0 112 0 0 0 0 0 13 -7 12 0 38 0 4 0 0 0 0 0 3 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 3 15 -7 4 14 120 0 112 0 0 0 0 0 15 -7 14 0 57 1 4 0 0 0 0 0 3 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 4 -15 -7 4 41 120 0 0 0 0 0 0 0 -15 -7 41 0 100 1 4 0 0 0 0 0 4 130 20 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 -4 -13 -7 4 39 120 0 0 0 0 0 0 0 -13 -7 39 0 100 0 4 0 0 0 0 0 4 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 116 4 0 0 0 0 0 +4 -13 -7 4 39 120 0 0 0 0 0 0 0 -13 -7 39 0 100 0 4 0 0 0 0 0 4 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 156 4 0 0 0 0 0 4 -11 -7 4 41 120 0 0 0 0 0 0 0 -11 -7 42 0 100 0 4 0 0 0 0 0 4 130 20 0 0 0 0 0 0 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 4 -9 -7 4 39 120 0 0 0 0 0 0 0 -9 -7 39 0 100 0 4 0 0 0 0 0 4 130 0 0 0 0 0 0 0 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 4 -7 -7 4 39 120 0 0 0 0 0 0 0 -7 -7 39 0 100 0 4 0 0 0 0 0 4 130 0 0 0 0 0 0 0 96 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 0 0 0 0 0 0 diff --git a/tests/update/journal.log b/tests/update/journal.log index a760dd843..c1aba0902 100644 --- a/tests/update/journal.log +++ b/tests/update/journal.log @@ -1437,7 +1437,7 @@ Play#0 output Play#0 1 own sect eff prd mob uf uf old civ mil uw food work avail fall coa Play#0 output Play#0 1 5 -16,-8 - 0% 120 .. .. 124 5 0 96 100% 0 0 1 Play#0 output Play#0 1 5 -14,-8 b 100% 120 .. .. 124 5 0 97 100% 0 0 1 - Play#0 output Play#0 1 0 -12,-8 - 0% 60 .. .. 124 5 0 97 100% 0 0 1 + Play#0 output Play#0 1 0 -12,-8 - 0% 60 .. .. 123 5 0 97 100% 0 0 1 Play#0 output Play#0 1 4 -10,-8 - 39% 120 .. .. 130 0 0 97 100% 39 0 1 Play#0 output Play#0 1 4 -8,-8 - 39% 120 .. .. 2 130 0 0 97 100% 39 0 1 Play#0 output Play#0 1 4 -6,-8 - 39% 120 .. .. 2 130 0 0 97 100% 39 0 1 @@ -1586,7 +1586,7 @@ Play#0 output Play#0 1 4 -4,-8 - 39% 0 0 0 0 0 0 Play#0 output Play#0 1 4 -2,-8 - 39% 0 0 0 0 0 0 Play#0 output Play#0 1 4 -15,-7 - 41% 0 0 0 0 0 0 - Play#0 output Play#0 1 4 -13,-7 - 39% 0 4 116 0 0 0 + Play#0 output Play#0 1 4 -13,-7 - 39% 0 4 156 0 0 0 Play#0 output Play#0 1 4 -11,-7 - 41% 0 0 0 0 0 0 Play#0 output Play#0 1 4 -9,-7 - 39% 0 0 0 0 0 0 Play#0 output Play#0 1 4 -7,-7 - 39% 0 0 0 0 0 0 -- 2.43.0