Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#18602) [Patch] unit_type flag "Helicopter"
Home

[Freeciv-Dev] Re: (PR#18602) [Patch] unit_type flag "Helicopter"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#18602) [Patch] unit_type flag "Helicopter"
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Sat, 15 Jul 2006 16:55:58 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:
> 
>   New unit_type flag F_HELICOPTER. Units marked with this flag defend 
> badly against F_FIGHTER units.
>   Not an ideal solution, but at least more consistent with F_PIKEMEN & 
> F_HORSE flags. I just want this 'bad defense against fighters' feature 
> separated from move_type so my amphibious tanks won't suffer from it.

  This version adds also "AirUnit" flag. It marks units that are very 
bad at attacking "AEGIS" units (or; against which AEGIS is very good 
defender).



  - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c    2006-07-15 16:10:38.906250000 +0300
+++ freeciv/ai/advmilitary.c    2006-07-15 21:07:15.921875000 +0300
@@ -601,9 +601,9 @@
   /* Sea and helicopters often have their firepower set to 1 when
    * defending. We can't have such units as defenders. */
   if (!unit_type_flag(punittype, F_BADCITYDEFENDER)
-      && get_unit_move_type(punittype) != HELI_MOVING) {
+      && !unit_type_flag(punittype, F_HELICOPTER)) {
     /* Sea units get 1 firepower in Pearl Harbour,
-     * and helicopters very bad against air units */
+     * and helicopters very bad against fighters */
     desire *= punittype->firepower;
   }
   desire *= defense;
diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c   2006-07-15 16:11:36.234375000 +0300
+++ freeciv/client/helpdata.c   2006-07-15 21:29:31.062500000 +0300
@@ -943,6 +943,14 @@
     sprintf(buf + strlen(buf),
            _("* Counts as 'mounted' against certain defenders.\n"));
   }
+  if (unit_type_flag(utype, F_HELICOPTER)) {
+    sprintf(buf + strlen(buf),
+            _("* Defends very badly agains fighter type units.\n"));
+  }
+  if (unit_type_flag(utype, F_AIRUNIT)) {
+    sprintf(buf + strlen(buf),
+            _("* Very bad at attacking AEGIS units.\n"));
+  }
   if (!unit_class_flag(get_unit_class(utype), UCF_MISSILE)
       && unit_type_flag(utype, F_ONEATTACK)) {
     sprintf(buf + strlen(buf),
diff -Nurd -X.diff_ignore freeciv/common/combat.c freeciv/common/combat.c
--- freeciv/common/combat.c     2006-07-15 16:11:45.250000000 +0300
+++ freeciv/common/combat.c     2006-07-15 21:14:38.468750000 +0300
@@ -276,7 +276,7 @@
    * When attacked by fighters, helicopters have their firepower
    * reduced to 1.
    */
-  if (is_heli_unit(defender) && unit_flag(attacker, F_FIGHTER)) {
+  if (unit_flag(defender, F_HELICOPTER) && unit_flag(attacker, F_FIGHTER)) {
     *def_fp = 1;
   }
 
@@ -447,8 +447,8 @@
       defensepower *= 2;
     }
 
-    if (unit_type_flag(def_type, F_AEGIS) &&
-       (is_air_unittype(att_type) || is_heli_unittype(att_type))) {
+    if (unit_type_flag(def_type, F_AEGIS)
+        && unit_type_flag(att_type, F_AIRUNIT)) {
       defensepower *= 5;
     }
 
@@ -459,7 +459,7 @@
       defensepower = MAX(0, defensepower * mod / 100);
     }
 
-    if (unit_type_flag(att_type, F_FIGHTER) && is_heli_unittype(def_type)) {
+    if (unit_type_flag(att_type, F_FIGHTER) && unit_type_flag(def_type, 
F_HELICOPTER)) {
       defensepower /= 2;
     }
   }
diff -Nurd -X.diff_ignore freeciv/common/unittype.c freeciv/common/unittype.c
--- freeciv/common/unittype.c   2006-07-15 16:11:48.109375000 +0300
+++ freeciv/common/unittype.c   2006-07-15 21:08:23.015625000 +0300
@@ -50,7 +50,8 @@
   "Airbase", "Cities", "Missile_Carrier", "No_Land_Attack",
   "AddToCity", "Fanatic", "GameLoss", "Unique", "Unbribable", 
   "Undisbandable", "SuperSpy", "NoHome", "NoVeteran", "Bombarder",
-  "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender"
+  "CityBuster", "NoBuild", "BadWallAttacker", "BadCityDefender",
+  "Helicopter", "AirUnit"
 };
 static const char *role_names[] = {
   "FirstBuild", "Explorer", "Hut", "HutTech", "Partisan",
diff -Nurd -X.diff_ignore freeciv/common/unittype.h freeciv/common/unittype.h
--- freeciv/common/unittype.h   2006-07-15 16:11:48.125000000 +0300
+++ freeciv/common/unittype.h   2006-07-15 21:17:36.609375000 +0300
@@ -94,6 +94,8 @@
   F_NOBUILD,          /* Unit cannot be built (barb leader etc) */
   F_BADWALLATTACKER,  /* Firepower set to 1 when attacking city wall */
   F_BADCITYDEFENDER,  /* Firepower set to 1 and attackers x2 when in city */
+  F_HELICOPTER,       /* Defends badly against F_FIGHTER units */
+  F_AIRUNIT,          /* Bad at attacking F_AEGIS units */
   F_LAST
 };
 #define F_MAX 64
diff -Nurd -X.diff_ignore freeciv/data/civ1/units.ruleset 
freeciv/data/civ1/units.ruleset
--- freeciv/data/civ1/units.ruleset     2006-07-15 16:11:55.953125000 +0300
+++ freeciv/data/civ1/units.ruleset     2006-07-15 21:12:48.765625000 +0300
@@ -586,7 +586,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "Fighter"
+flags         = "FieldUnit", "Fighter", "AirUnit"
 roles         = ""
 
 [unit_bomber]
@@ -614,7 +614,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 
 [unit_trireme]
@@ -903,7 +903,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack", "Nuclear"
+flags         = "FieldUnit", "OneAttack", "Nuclear", "AirUnit"
 roles         = ""
 helptext      = _("\
 You can build Nuclear units when you have the required advance, and\
diff -Nurd -X.diff_ignore freeciv/data/civ2/units.ruleset 
freeciv/data/civ2/units.ruleset
--- freeciv/data/civ2/units.ruleset     2006-07-15 16:11:57.265625000 +0300
+++ freeciv/data/civ2/units.ruleset     2006-07-15 21:12:16.312500000 +0300
@@ -983,7 +983,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Fighter"
+flags         = "Fighter", "AirUnit"
 roles         = ""
 
 [unit_bomber]
@@ -1011,7 +1011,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 
 [unit_helicopter]
@@ -1039,7 +1039,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "Helicopter", "AirUnit"
 roles         = ""
 helptext      = _("\
 The Helicopter is a very powerful unit, as it can both fly and\
@@ -1073,7 +1073,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Fighter"
+flags         = "Fighter", "AirUnit"
 roles         = ""
 helptext      = _("\
 An improved Fighter, with improved attack and a higher movement\
@@ -1105,7 +1105,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
 An improved Bomber, with improved attack and a higher movement\
@@ -1487,7 +1487,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
 TIP:  A handful of these can successfully keep the waters around\
@@ -1519,7 +1519,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack", "Nuclear"
+flags         = "FieldUnit", "OneAttack", "Nuclear", "AirUnit"
 roles         = ""
 helptext      = _("\
 You can build Nuclear units when you have the required advance, and\
diff -Nurd -X.diff_ignore freeciv/data/default/units.ruleset 
freeciv/data/default/units.ruleset
--- freeciv/data/default/units.ruleset  2006-07-15 16:11:59.203125000 +0300
+++ freeciv/data/default/units.ruleset  2006-07-15 21:10:59.078125000 +0300
@@ -155,7 +155,7 @@
 ; "Horse"      = (no effect)
 ; "IgWall"     = ignore effect of city walls
 ; "FieldUnit"  = cause unhappiness even when not being aggressive
-; "AEGIS"      = fivefold increased defence against air attacks and missiles
+; "AEGIS"      = fivefold increased defence against "AirUnit" attacks
 ; "Fighter"    = can attack air units (no other units can normally do this)
 ; "Marines"    = (land only) can attack from transports
 ; "Partial_Invis" = visible only to adjancent units; does not hide transported
@@ -202,6 +202,8 @@
 ; "BadCityDefender"    = if attacked while in a city, firepower is set to 1
 ;                and firepower of attacker is doubled (the Pearl Harbour
 ;                 rule)
+; "Helicopter"  = defends very badly against "Fighter" units
+; "AirUnit"     = very bad at attacking "AEGIS" units
 ;
 ; Following flag strings require extra fields:
 ;  "Paratroopers"
@@ -1038,7 +1040,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Fighter"
+flags         = "Fighter", "AirUnit"
 roles         = ""
 
 [unit_bomber]
@@ -1066,7 +1068,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 
 [unit_helicopter]
@@ -1094,7 +1096,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "Helicopter", "AirUnit"
 roles         = ""
 helptext      = _("\
 The Helicopter is a very powerful unit, as it can both fly and\
@@ -1128,7 +1130,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Partial_Invis", "Fighter"
+flags         = "Partial_Invis", "Fighter", "AirUnit"
 roles         = ""
 helptext      = _("\
 An improved Fighter, with improved attack and a higher movement\
@@ -1160,7 +1162,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "Partial_Invis", "FieldUnit", "OneAttack"
+flags         = "Partial_Invis", "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
 An improved Bomber, with improved attack and a higher movement\
@@ -1542,7 +1544,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack"
+flags         = "FieldUnit", "OneAttack", "AirUnit"
 roles         = ""
 helptext      = _("\
 TIP:  A handful of these can successfully keep the waters around\
@@ -1574,7 +1576,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = "FieldUnit", "OneAttack", "Nuclear"
+flags         = "FieldUnit", "OneAttack", "Nuclear", "AirUnit"
 roles         = ""
 helptext      = _("\
 You can build Nuclear units when you have the required advance, and\
@@ -1878,7 +1880,7 @@
 uk_shield     = 1
 uk_food       = 0
 uk_gold       = 0
-flags         = ""
+flags         = "AirUnit"
 roles         = ""
 helptext      = _("\
 The AWACS (Airborne Warning and Control System) is an airplane with an \

[Prev in Thread] Current Thread [Next in Thread]