Re: Questions on advdiplomacy
Per Inge Mathisen <per-0/[email protected]> Sat, 5 Mar 2005 14:06:46 +0000 (GMT)
| Newsgroups | gmane.games.freeciv.ai |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 2 Mar 2005, Jason Dorje Short wrote: > > I was looking at advdiplomacy.c /Freeciv 2.0.0 Beta 8) and found 3 issues: > > > > * When we evaluate an exchange of a city, we check for the capital city > > to deny a request. > >Why we don't check to see if it's the last city? > > There was one game where an AI player traded me his last city (PR#12287). Ok. > > Why we do not accept a peace state with the boss to give a cease-fire > > to an enemy? Ok. > Personally I don't understand/like any of the AI alliance leader > concepts.They make diplomacy very hard (sometimes you can't even do > diplomacy with one player until you contact another) and make alliances > too rigid. It is an easy way to solve a difficult problem. Feel free to solve it in a better way. > >In computing the desire for war, i think that the first check should > > exchange DS_NEUTRAL and DS_CEASEFIRE because you get a higher penalty > > for breaking a cease-fire instead of a neutral treaty. > > Yes, absolutely.ceasefire is one step "up" from neutral. Ok. Untested patch attached. - Per
adv1.diff
(text/plain, 2.3 KB)
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.67
diff -u -r1.67 advdiplomacy.c
--- ai/advdiplomacy.c 19 Feb 2005 23:26:25 -0000 1.67
+++ ai/advdiplomacy.c 5 Mar 2005 14:06:37 -0000
@@ -355,15 +355,20 @@
break;
}
- /* If this lucky fella got a ceasefire with da boss, then
+ /* If this lucky fella got a ceasefire or peace with da boss, then
* let him live. */
- if (pplayer_get_diplstate(aplayer, ai->diplomacy.alliance_leader)->type
- == DS_CEASEFIRE && pclause->type == CLAUSE_CEASEFIRE) {
+ if ((pplayer_get_diplstate(aplayer, ai->diplomacy.alliance_leader)->type
+ == DS_CEASEFIRE
+ || pplayer_get_diplstate(aplayer, ai->diplomacy.alliance_leader)->type
+ == DS_PEACE)
+ && pclause->type == CLAUSE_CEASEFIRE) {
notify(aplayer, _("*%s (AI)* %s recommended that I give you a ceasefire."
" This is your lucky day."), pplayer->name,
ai->diplomacy.alliance_leader->name);
if (ai->diplomacy.target == aplayer) {
/* Damn, we lost our target, too! Stupid boss! */
+ /* FIXME: We shouldn't do this here - the other player may not
+ * accept the whole treaty! */
ai->diplomacy.target = NULL;
ai->diplomacy.timer = 0;
ai->diplomacy.countdown = 0;
@@ -465,7 +470,7 @@
} else if (give) {
/* AI must be crazy to trade away its cities */
worth -= city_gold_worth(offer);
- if (is_capital(offer)) {
+ if (is_capital(offer) || city_list_size(pplayer->cities) <= 3) {
worth = -BIG_NUMBER; /* Never! Ever! */
} else {
worth *= 15;
@@ -716,9 +721,9 @@
/* Remember: pplayers_allied() returns true when aplayer == eplayer */
if (!cancel_excuse && pplayers_allied(aplayer, eplayer)) {
- if (ds == DS_CEASEFIRE) {
+ if (ds == DS_NEUTRAL) {
kill_desire -= kill_desire / 10; /* 10% off */
- } else if (ds == DS_NEUTRAL) {
+ } else if (ds == DS_CEASEFIRE) {
kill_desire -= kill_desire / 7; /* 15% off */
} else if (ds == DS_PEACE) {
kill_desire -= kill_desire / 5; /* 20% off */