[Freeciv-Dev] (PR#12896) Diplomat fixes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#12896) Diplomat fixes |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Tue, 26 Apr 2005 04:43:34 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12896 >
This patch fixes some issues reported with diplomats, but I was unable to
find the relevant ticket(s), so I made a new one.
CHANGES:
- Diplomat combat calculation now more fair. Does not rely on diplchance.
- Give a message to reveal why a diplomat was caught when trying to steal
from a city you have stolen from before.
- Allow auto-success for diplomats (diplchance=100).
- Limit diplchance to a minimum of 50 to restrict diplchance cheating.
(Players setting diplchance to some absurd low value without other
players noticing.)
- Improve server helptext for diplchance.
- Per
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.70
diff -u -r1.70 diplomats.c
--- server/diplomats.c 21 Mar 2005 12:21:28 -0000 1.70
+++ server/diplomats.c 26 Apr 2005 11:32:54 -0000
@@ -566,10 +566,17 @@
}
}
if (count > 0) {
- notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_FAILED,
- _("Your %s was caught in the attempt of"
- " stealing technology from %s."),
- unit_name(pdiplomat->type), pcity->name);
+ if (pcity->steal > 0 && !unit_flag (pdiplomat, F_SPY)) {
+ notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_FAILED,
+ _("%s was expecting your attempt to steal technology "
+ "again. Your %s was caught and executed."),
+ pcity->name, unit_name(pdiplomat->type));
+ } else {
+ notify_player_ex(pplayer, pcity->tile, E_MY_DIPLOMAT_FAILED,
+ _("Your %s was caught in the attempt of"
+ " stealing technology from %s."),
+ unit_name(pdiplomat->type), pcity->name);
+ }
notify_player_ex(cplayer, pcity->tile, E_ENEMY_DIPLOMAT_FAILED,
_("%s's %s failed to steal technology from %s."),
pplayer->name, unit_name(pdiplomat->type), pcity->name);
@@ -1088,44 +1095,38 @@
/**************************************************************************
This determines if a diplomat/spy succeeds against some defender,
who is also a diplomat or spy.
- (Note: This is weird in order to try to conform to Civ2 rules.)
-
- - Depends entirely upon game.diplchance and the defender:
- - Spies are much better.
- - Veterans are somewhat better.
- - Return TRUE if the "attacker" succeeds.
+ Return TRUE if the "attacker" succeeds.
**************************************************************************/
static bool diplomat_success_vs_defender (struct unit *pattacker,
struct unit *pdefender, struct tile *pdefender_tile)
{
- int att = game.diplchance;
- int def = 100 - game.diplchance;
+ int chance = 50; /* Base 50% chance */
if (unit_flag(pdefender, F_SUPERSPY)) {
return TRUE;
}
if (unit_flag (pattacker, F_SPY)) {
- att *= 2;
+ chance += 25;
}
if (unit_flag (pdefender, F_SPY)) {
- def *= 2;
+ chance -= 25;
}
- att += (att/5.0) * pattacker->veteran;
- def += (def/5.0) * pdefender->veteran;
+ chance += 15 * pattacker->veteran;
+ chance -= 15 * pdefender->veteran;
if (pdefender_tile->city) {
- def = def * (100 + get_city_bonus(pdefender_tile->city,
- EFT_SPY_RESISTANT)) / 100;
+ chance -= chance * get_city_bonus(pdefender_tile->city,
+ EFT_SPY_RESISTANT) / 100;
} else {
if (tile_has_special(pdefender_tile, S_FORTRESS)
|| tile_has_special(pdefender_tile, S_AIRBASE)) {
- def = (def * 5) / 4;/* +25% */
+ chance -= chance * 25 / 100; /* 25% penalty */
}
}
- return myrand(att) > myrand(def);
+ return myrand(100) > chance;
}
/**************************************************************************
Index: server/settings.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.c,v
retrieving revision 1.20
diff -u -r1.20 settings.c
--- server/settings.c 21 Mar 2005 13:05:21 -0000 1.20
+++ server/settings.c 26 Apr 2005 11:40:27 -0000
@@ -722,17 +722,11 @@
GEN_INT("diplchance", game.diplchance,
SSET_RULES_FLEXIBLE, SSET_MILITARY, SSET_SITUATIONAL, SSET_TO_CLIENT,
- N_("Chance in diplomat/spy contests"),
+ N_("Base chance for diplomats and spies to succeed."),
/* xgettext:no-c-format */
- N_("A diplomatic unit acting against a city which has one or "
- "more defending diplomatic units has a diplchance "
- "(percent) chance to defeat each such defender. Also, the "
- "chance of a spy returning from a successful mission is "
- "diplchance percent (diplomats never return). This value is "
- "also the basic chance of success for diplomats and spies. "
- "Defending spies are generally twice as capable as "
- "diplomats; veteran units are 50% more capable than "
- "non-veteran ones."), NULL,
+ N_("The chance of a spy returning from a successful mission and "
+ "the base chance of success for diplomats and spies."),
+ NULL,
GAME_MIN_DIPLCHANCE, GAME_MAX_DIPLCHANCE, GAME_DEFAULT_DIPLCHANCE)
GEN_BOOL("spacerace", game.spacerace,
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.181
diff -u -r1.181 game.h
--- common/game.h 21 Apr 2005 00:28:27 -0000 1.181
+++ common/game.h 26 Apr 2005 11:40:27 -0000
@@ -363,8 +363,8 @@
#define GAME_MAX_DIPLOMACY 4
#define GAME_DEFAULT_DIPLCHANCE 80
-#define GAME_MIN_DIPLCHANCE 1
-#define GAME_MAX_DIPLCHANCE 99
+#define GAME_MIN_DIPLCHANCE 50
+#define GAME_MAX_DIPLCHANCE 100
#define GAME_DEFAULT_FREECOST 0
#define GAME_MIN_FREECOST 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12896) Diplomat fixes,
Per I. Mathisen <=
|
|