diff -Nur -Xfreecivdiff.ignore freeciv-cvs/server/diplomats.c freeciv-patched/server/diplomats.c --- freeciv-cvs/server/diplomats.c 2003-07-21 13:58:27.000000000 +0100 +++ freeciv-patched/server/diplomats.c 2003-07-24 17:03:47.000000000 +0100 @@ -827,7 +827,8 @@ - Check for infiltration success. Our saboteur may not survive this. - Check for basic success. Again, our saboteur may not survive this. - Determine target, given arguments and constraints. - - If specified, city walls and anything in a capital are 50% likely to fail. + - If specified, city walls and anything in a capital are 50% likely to + fail (with default rulesets, due to Spy_Resistant improvement effects). - Do sabotage! - The saboteur may be captured and executed, or escape to its home town. @@ -838,7 +839,6 @@ struct player *cplayer; int count, which, target; const char *prod; - struct city *capital; /* Fetch target city's player. Sanity checks. */ if (!pcity) @@ -992,12 +992,19 @@ /* * One last chance to get caught: - * If target was specified, and it is in the capital or are - * City Walls, then there is a 50% chance of getting caught. + * If target was specified, we check for any active Spy_Resistant + * effects (e.g. from the Palace or City Walls) which define the + * chance of getting caught. */ - capital = find_palace (city_owner (pcity)); - if ((pcity == capital) || (improvement == B_CITY)) { - if (myrand (2) == 1) { + if (improvement >= 0 && improvement != B_LAST) { + int failchance = 0; + impr_effects_iterate(iter, improvement, pcity, cplayer) { + if (iter.imeff->type == EFT_SPY_RESISTANT) { + failchance += iter.imeff->amount; + } + } impr_effects_iterate_end; + + if (myrand(100) < failchance) { /* Caught! */ notify_player_ex(pplayer, pcity->x, pcity->y, E_MY_DIPLOMAT_FAILED, _("Game: Your %s was caught in the attempt"