# [Freeciv-Dev] [bug #17264] Percentage chance for veteran spies to beat green diplomats is too high

```Follow-up Comment #3, bug #17264 (project freeciv):

> I see MAX_VET_LEVELS defined as 10 in in fc_types.h
> Yet I assume you are using the number 4. ```
```
I'm using _10_ as different rulesets could use more veteran levels as the
default ruleset.

> Note max is 90% not 95%

That's right as I did not start at 0 but at 1 ;-) (and if you set the max to
4). I addapted the calculation a little bit but it does not changes the
result, as the negative bonus due to the defending unit will cancel the
increase ;-)

Lets take the function diplomat_success_vs_defender() step by step for spy
attack agains a green diplomat:

>  int chance = 50; /* Base 50% chance */
* spy win = 50%
* (no superspy)
>  /* Add or remove 25% if spy flag. */
>  if (unit_has_type_flag(pattacker, F_SPY)) {
>    chance += 25;
>  }
* spy win = 75%
>  /* Add or remove up to 20% for veteran level. */
>  chance += 20 * (pattacker->veteran + 1) / MAX_VET_LEVELS;
>  chance -= 20 * (pdefender->veteran + 1) / MAX_VET_LEVELS;
* depending on the veteran level of the spy this will result in different
numbers. For the default ruleset (4 levels) 2, 4, 6 or 8 percent are added,
but also at least 2% are removed due to the veteran level of the defender.
Thus, the spy win chances against a green diplomat are now at 75, 77, 79 or
81%. If 10 veteran level are used it could go up to 93%.

for a diplomat against a green diplomat you get:
* diplomat win = 50%
* (no superspy)
* (no spy)
* using the default ruleset (4 veteran levels) the chances are 50, 52, 54 or
56%

Added percents due to veteran level are negated if the defender has the same
level.

I think this is OK as it keeps the chances at a value around 50%.

(file #11519)
_______________________________________________________

File name: 20101208.2-trunk-fix-diplomat_success_vs_defender.patch Size:1 KB

_______________________________________________________

<http://gna.org/bugs/?17264>

_______________________________________________
Nachricht geschickt von/durch Gna!
http://gna.org/

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev
```