(PR#10146) new handicap: H_DIPLOMACY

"Mateusz Stefek" <mstefek-IjDXvh/[email protected]>
Newsgroups gmane.games.freeciv.ai
Message-ID <[email protected]>
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10146 >

This patch implements new handicap for novice player: H_DIPLOMACY
Now maps from novice players are much cheaper.
This patch also lowers the value of seamap.
--
mateusz
h_diplomacy.diff (text/x-patch, 2.8 KB)
? ai/test
? client/civgame-3950.sav.gz
? server/civgame-3700.sav.gz
? server/civgame-3950.sav.gz
Index: ai/advdiplomacy.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdiplomacy.c,v
retrieving revision 1.41
diff -u -r1.41 advdiplomacy.c
--- ai/advdiplomacy.c	15 Sep 2004 09:31:56 -0000	1.41
+++ ai/advdiplomacy.c	16 Sep 2004 11:15:14 -0000
@@ -372,7 +372,12 @@
       /* Very silly algorithm 1: Sea map more worth if enemy has more
          cities. Reasoning is he has more use of seamap for settling
          new areas the more cities he has already. */
-      worth -= 25 * city_list_size(&aplayer->cities);
+      worth -= 15 * city_list_size(&aplayer->cities);
+
+      /* Make maps from novice player cheap */
+      if (ai_handicap(pplayer, H_DIPLOMACY)) {
+        worth /= 2;
+      }
     }
     break;
 
@@ -383,10 +388,14 @@
     } else {
       /* Very silly algorithm 2: Land map more worth the more cities
          we have, since we expose all of these to the enemy. */
-      worth -= 75 * MAX(city_list_size(&pplayer->cities), 3);
+      worth -= 50 * MAX(city_list_size(&pplayer->cities), 3);
       /* Inflate numbers if not peace */
       if (!pplayers_in_peace(pplayer, aplayer)) {
-        worth *= 3;
+        worth *= 4;
+      }
+      /* Make maps from novice player cheap */
+      if (ai_handicap(pplayer, H_DIPLOMACY)) {
+        worth /= 6;
       }
     }
     break;
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.125
diff -u -r1.125 player.h
--- common/player.h	15 Sep 2004 09:31:56 -0000	1.125
+++ common/player.h	16 Sep 2004 11:15:16 -0000
@@ -53,7 +53,8 @@
   H_HUTS = 128,       /* Doesn't know which unseen tiles have huts on them */
   H_FOG = 256,        /* Can't see through fog of war */
   H_NOPLANES = 512,   /* Doesn't build air units */
-  H_MAP = 1024        /* Only knows map_is_known tiles */
+  H_MAP = 1024,       /* Only knows map_is_known tiles */
+  H_DIPLOMACY = 2048  /* Not very good at diplomacy */
 };
 
 struct player_economic {
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.349
diff -u -r1.349 stdinhand.c
--- server/stdinhand.c	15 Sep 2004 09:23:27 -0000	1.349
+++ server/stdinhand.c	16 Sep 2004 11:15:31 -0000
@@ -620,7 +620,8 @@
   int h[11] = { -1,
 		H_AWAY,
  /* novice */   H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
-                        | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE,
+                        | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
+			| H_DIPLOMACY,
  /* easy */	H_RATES | H_TARGETS | H_HUTS | H_NOPLANES 
                         | H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE,
 		H_NONE,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.