(PR#12218) Another stupid AI diplomacy behavior
"Mateusz Stefek" <mstefek-IjDXvh/[email protected]> Fri, 11 Feb 2005 03:45:22 -0800
| Newsgroups | gmane.games.freeciv.ai |
|---|---|
| Message-ID | <[email protected]> |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12218 > I was neutral towards player B and allied with player A. player A attacked player B, so I helped him by creating ZOC in B's territory making B units stay in their cities. The problem is that B never declared war on me. :) AI only declares war when I'm his target or when I'm at war with his ally. Something should be done here. This patch is partial solution, which makes love decrease faster in such cases. -- mateusz
stupid_ai.diff
(text/x-patch, 1.2 KB)
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.64
diff -u -r1.64 advdiplomacy.c
--- ai/advdiplomacy.c 11 Feb 2005 09:36:24 -0000 1.64
+++ ai/advdiplomacy.c 11 Feb 2005 11:43:24 -0000
@@ -766,6 +766,7 @@
int war_desire[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS];
int best_desire = 0;
struct player *target = NULL;
+ int mult;
memset(war_desire, 0, sizeof(war_desire));
@@ -813,12 +814,17 @@
}
pplayer->ai.love[aplayer->player_no] -= ai->diplomacy.love_incr;
}
+
/* Reduce love by number of units in our territory.
* AI is so naive, that we have to count it even if players are allied */
+ mult =
+ pplayers_at_war(pplayer, aplayer) || adip->is_allied_with_enemy ?
+ 2 : 1;
+
pplayer->ai.love[aplayer->player_no] -=
MIN(player_in_territory(pplayer, aplayer) * (MAX_AI_LOVE / 100),
pplayers_allied(aplayer, pplayer) ?
- ai->diplomacy.love_incr - 1 : (MAX_AI_LOVE / 2));
+ ai->diplomacy.love_incr - 1 : (MAX_AI_LOVE / 2)) * mult;
/* Increase the love if aplayer has got a building that makes
* us love him more. Typically it's Eiffel Tower */