Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12263) Modify AI building wants a bit
Home

[Freeciv-Dev] (PR#12263) Modify AI building wants a bit

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12263) Modify AI building wants a bit
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 15 Feb 2005 04:44:11 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12263 >

This patch changes the AI building wants a bit, so that unhappy buildings
are emphasised more, especially with empires that have high unhappy
ratings, and military wonders like Sun Tzu are emphasised less.

  - Per

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.194
diff -u -r1.194 aicity.c
--- ai/aicity.c 14 Feb 2005 21:47:35 -0000      1.194
+++ ai/aicity.c 15 Feb 2005 12:41:46 -0000
@@ -332,28 +332,41 @@
          }
          break;
        case EFT_MAKE_HAPPY:
-         /* TODO */
+         v += (get_entertainers(pcity) + pcity->ppl_unhappy[4]) * 5 * amount;
+          if (city_list_size(pplayer->cities)
+                > game.cityfactor + gov->empire_size_mod) {
+            v += c * amount; /* offset large empire size */
+          }
+          v += c * amount;
          break;
        case EFT_UNIT_RECOVER:
          /* TODO */
          break;
        case EFT_NO_UNHAPPY:
-         v += (get_entertainers(pcity)
-               + pcity->ppl_unhappy[4]) * 20;
+         v += (get_entertainers(pcity) + pcity->ppl_unhappy[4]) * 30;
          break;
        case EFT_FORCE_CONTENT:
+       case EFT_MAKE_CONTENT:
          if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
-           v += (pcity->ppl_unhappy[4]
-                 + get_entertainers(pcity)) * 20;
-           v += 5 * c;
+            int factor = 2;
+
+           v += MIN(amount, pcity->ppl_unhappy[4] + get_entertainers(pcity)) * 
35;
+
+            /* Try to build wonders to offset empire size unhappiness */
+            if (city_list_size(pplayer->cities) 
+                > game.cityfactor + gov->empire_size_mod) {
+              if (gov->empire_size_mod > 0) {
+                factor += city_list_size(pplayer->cities) / 
gov->empire_size_inc;
+              }
+              factor += 2;
+            }
+           v += factor * c * amount;
          }
          break;
        case EFT_MAKE_CONTENT_MIL_PER:
-       case EFT_MAKE_CONTENT:
          if (!government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
-           v += MIN(pcity->ppl_unhappy[4]
-                    + get_entertainers(pcity),
-                    amount) * 20;
+           v += MIN(pcity->ppl_unhappy[4] + get_entertainers(pcity),
+                    amount) * 25;
            v += MIN(amount, 5) * c;
          }
          break;
@@ -453,19 +466,19 @@
          v += unit_list_size(ptile->units) * 2;
          break;
        case EFT_LAND_REGEN:
-         v += 15 * c + ai->stats.units[UCL_LAND] * 3;
+         v += 5 * c + ai->stats.units[UCL_LAND] * 3;
          break;
        case EFT_SEA_REGEN:
-         v += 15 * c + ai->stats.units[UCL_SEA] * 3;
+         v += 5 * c + ai->stats.units[UCL_SEA] * 3;
          break;
        case EFT_AIR_REGEN:
-         v += 15 * c + ai->stats.units[UCL_AIR] * 3;
+         v += 5 * c + ai->stats.units[UCL_AIR] * 3;
          break;
        case EFT_LAND_VET_COMBAT:
          v += 2 * c + ai->stats.units[UCL_LAND] * 2;
          break;
        case EFT_LAND_VETERAN:
-         v += 5 * c + ai->stats.units[UCL_LAND];
+         v += 3 * c + ai->stats.units[UCL_LAND];
          break;
        case EFT_SEA_VETERAN:
          v += 5 * c + ai->stats.units[UCL_SEA];

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12263) Modify AI building wants a bit, Per I. Mathisen <=