From 9865830ad7a1702a4fdb11114375cd40360f5501 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Wed, 27 Sep 2023 20:49:27 +0300
Subject: [PATCH 35/35] civ2civ3/sandbox: Add "Aerial" unit class flag

Simplifies effect requirement lists.

See osdn #47737

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 data/civ2civ3/effects.ruleset | 76 +++++++++--------------------------
 data/civ2civ3/units.ruleset   |  8 ++--
 data/sandbox/effects.ruleset  | 76 +++++++++--------------------------
 data/sandbox/units.ruleset    |  8 ++--
 4 files changed, 48 insertions(+), 120 deletions(-)

diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset
index e828219e3b..4b2c0ff07d 100644
--- a/data/civ2civ3/effects.ruleset
+++ b/data/civ2civ3/effects.ruleset
@@ -259,17 +259,9 @@ reqs    =
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Fort", "Local", TRUE
-;      "UnitClass", "Land", "Local", FALSE
-;      "UnitClass", "Small Land", "Local", FALSE
-;      "UnitClass", "Big Land", "Local", FALSE
-;      "UnitClass", "Merchant", "Local", FALSE
-;      "UnitClass", "Sea", "Local", FALSE
-;      "UnitClass", "Trireme", "Local", FALSE
-      "UnitClass", "Helicopter", "Local", FALSE
-      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",   "range", "present"
+      "Extra",         "Fort",   "Local", TRUE
+      "UnitClassFlag", "Aerial", "Local", FALSE
     }
 
 ; Cumulative with fort
@@ -282,22 +274,15 @@ reqs    =
       "Extra", "Fortress", "Local", TRUE
     }
 
-; Airstrip HP regen (Every Air unit)
+; Airstrip HP regen (All Aerial units except Missiles)
 [effect_airstrip_hp_regen]
 type    = "HP_Regen"
 value   = 10
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airstrip", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",     "range", "present"
+      "Extra",         "Airstrip", "Local", TRUE
+      "UnitClassFlag", "Aerial",   "Local", TRUE
+      "UnitClassFlag", "Missile",  "Local", FALSE
     }
 
 ; Airbase HP regen: cumulative with airstrip
@@ -307,34 +292,19 @@ reqs    =
 type    = "HP_Regen"
 value   = 24
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airbase", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",    "range", "present"
+      "Extra",         "Airbase", "Local", TRUE
+      "UnitClassFlag", "Aerial",  "Local", TRUE
+      "UnitClassFlag", "Missile", "Local", FALSE
     }
 
 [effect_airstrip_defense]
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airstrip", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-;      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",     "range"
+      "Extra",         "Airstrip", "Local"
+      "UnitClassFlag", "Aerial",   "Local"
     }
 
 ; Cumulative with airstrip
@@ -1903,18 +1873,10 @@ reqs    =
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "MinSize", "9", "City", TRUE
-      "CityTile", "Center", "Local", TRUE
-;      "UnitClass", "Land", "Local", FALSE
-;      "UnitClass", "Small Land", "Local", FALSE
-;      "UnitClass", "Big Land", "Local", FALSE
-;      "UnitClass", "Merchant", "Local", FALSE
-;      "UnitClass", "Sea", "Local", FALSE
-;      "UnitClass", "Trireme", "Local", FALSE
-      "UnitClass", "Helicopter", "Local", FALSE
-      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",   "range", "present"
+      "MinSize",       "9",      "City",  TRUE
+      "CityTile",      "Center", "Local", TRUE
+      "UnitClassFlag", "Aerial", "Local", FALSE
     }
 
 ; Every Land
diff --git a/data/civ2civ3/units.ruleset b/data/civ2civ3/units.ruleset
index c626a7892b..46a53a0745 100644
--- a/data/civ2civ3/units.ruleset
+++ b/data/civ2civ3/units.ruleset
@@ -63,6 +63,7 @@ class_flags =
                      _("Gets a 50% defensive bonus while in cities.")
     _("Barracks"), _("Benefits from barracks")
     _("Ground"), _("Ground units")
+    _("Aerial"), _("Aerial units")
   }
 
 [veteran_system]
@@ -150,7 +151,7 @@ name          = _("?unitclass:Missile")
 min_speed     = 0
 hp_loss_pct   = 0
 flags         = "Missile", "Unreachable", "DoesntOccupyTile", "Airliftable",
-                "HutFrighten"
+                "HutFrighten", "Aerial"
 
 [unitclass_land]
 ; /* TRANS: Unit class: used adjectivally */
@@ -208,7 +209,8 @@ flags         = "ZOC", "DamageSlows", "AttFromNonNative"
 name          = _("?unitclass:Helicopter")
 min_speed     = 1
 hp_loss_pct   = 10
-flags         = "Unreachable", "DoesntOccupyTile", "CanOccupyCity", "CollectRansom", "Airliftable"
+flags         = "Unreachable", "DoesntOccupyTile", "CanOccupyCity", "CollectRansom", "Airliftable",
+                "Aerial"
 
 [unitclass_air]
 ; /* TRANS: Unit class: used adjectivally */
@@ -216,7 +218,7 @@ name          = _("?unitclass:Air")
 min_speed     = 1
 hp_loss_pct   = 10
 flags         = "Unreachable", "DoesntOccupyTile", "CanPillage",
-                "Airliftable", "HutFrighten"
+                "Airliftable", "HutFrighten", "Aerial"
 
 ; /* <-- avoid gettext warnings
 ;
diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset
index 66af9b6425..9b23ef13b9 100644
--- a/data/sandbox/effects.ruleset
+++ b/data/sandbox/effects.ruleset
@@ -259,17 +259,9 @@ reqs    =
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Fort", "Local", TRUE
-;      "UnitClass", "Land", "Local", FALSE
-;      "UnitClass", "Small Land", "Local", FALSE
-;      "UnitClass", "Big Land", "Local", FALSE
-;      "UnitClass", "Merchant", "Local", FALSE
-;      "UnitClass", "Sea", "Local", FALSE
-;      "UnitClass", "Trireme", "Local", FALSE
-      "UnitClass", "Helicopter", "Local", FALSE
-      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",   "range", "present"
+      "Extra",         "Fort",   "Local", TRUE
+      "UnitClassFlag", "Aerial", "Local", FALSE
     }
 
 ; Cumulative with fort
@@ -282,22 +274,15 @@ reqs    =
       "Extra", "Fortress", "Local", TRUE
     }
 
-; Airstrip HP regen (Every Air unit)
+; Airstrip HP regen (All Aerial units except Missiles)
 [effect_airstrip_hp_regen]
 type    = "HP_Regen"
 value   = 10
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airstrip", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",     "range", "present"
+      "Extra",         "Airstrip", "Local", TRUE
+      "UnitClassFlag", "Aerial",   "Local", TRUE
+      "UnitClassFlag", "Missile",  "Local", FALSE
     }
 
 ; Airbase HP regen: cumulative with airstrip
@@ -307,34 +292,19 @@ reqs    =
 type    = "HP_Regen"
 value   = 24
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airbase", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",    "range", "present"
+      "Extra",         "Airbase", "Local", TRUE
+      "UnitClassFlag", "Aerial",  "Local", TRUE
+      "UnitClassFlag", "Missile", "Local", FALSE
     }
 
 [effect_airstrip_defense]
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "Extra", "Airstrip", "Local", TRUE
-      "UnitClass", "Land", "Local", FALSE
-      "UnitClass", "Small Land", "Local", FALSE
-      "UnitClass", "Big Land", "Local", FALSE
-      "UnitClass", "Merchant", "Local", FALSE
-      "UnitClass", "Sea", "Local", FALSE
-      "UnitClass", "Trireme", "Local", FALSE
-;      "UnitClass", "Helicopter", "Local", FALSE
-;      "UnitClass", "Air", "Local", FALSE
-;      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",     "range"
+      "Extra",         "Airstrip", "Local"
+      "UnitClassFlag", "Aerial",   "Local"
     }
 
 ; Cumulative with airstrip
@@ -2019,18 +1989,10 @@ reqs    =
 type    = "Defend_Bonus"
 value   = 50
 reqs    =
-    { "type", "name", "range", "present"
-      "MinSize", "9", "City", TRUE
-      "CityTile", "Center", "Local", TRUE
-;      "UnitClass", "Land", "Local", FALSE
-;      "UnitClass", "Small Land", "Local", FALSE
-;      "UnitClass", "Big Land", "Local", FALSE
-;      "UnitClass", "Merchant", "Local", FALSE
-;      "UnitClass", "Sea", "Local", FALSE
-;      "UnitClass", "Trireme", "Local", FALSE
-      "UnitClass", "Helicopter", "Local", FALSE
-      "UnitClass", "Air", "Local", FALSE
-      "UnitClass", "Missile", "Local", FALSE
+    { "type",          "name",   "range", "present"
+      "MinSize",       "9",      "City",  TRUE
+      "CityTile",      "Center", "Local", TRUE
+      "UnitClassFlag", "Aerial", "Local", FALSE
     }
 
 ; All Ground units
diff --git a/data/sandbox/units.ruleset b/data/sandbox/units.ruleset
index 1bb53550e9..8cfdaf2e78 100644
--- a/data/sandbox/units.ruleset
+++ b/data/sandbox/units.ruleset
@@ -73,6 +73,7 @@ class_flags =
                      _("Gets a 50% defensive bonus while in cities.")
     _("Barracks"), _("Benefits from barracks")
     _("Ground"), _("Ground units")
+    _("Aerial"), _("Aerial units")
   }
 
 [veteran_system]
@@ -160,7 +161,7 @@ name          = _("?unitclass:Missile")
 min_speed     = 0
 hp_loss_pct   = 0
 flags         = "Missile", "Unreachable", "DoesntOccupyTile",
-                "MediumWeight", "HutFrighten"
+                "MediumWeight", "HutFrighten", "Aerial"
 
 [unitclass_land]
 ; /* TRANS: Unit class: used adjectivally */
@@ -221,7 +222,8 @@ flags         = "ZOC", "DamageSlows", "AttFromNonNative", "MediumWeight"
 name          = _("?unitclass:Helicopter")
 min_speed     = 1
 hp_loss_pct   = 10
-flags         = "Unreachable", "DoesntOccupyTile", "CanOccupyCity", "CollectRansom", "MediumWeight"
+flags         = "Unreachable", "DoesntOccupyTile", "CanOccupyCity", "CollectRansom", "MediumWeight",
+                "Aerial"
 
 [unitclass_air]
 ; /* TRANS: Unit class: used adjectivally */
@@ -229,7 +231,7 @@ name          = _("?unitclass:Air")
 min_speed     = 1
 hp_loss_pct   = 10
 flags         = "Unreachable", "DoesntOccupyTile", "CanPillage",
-                "MediumWeight", "HutFrighten"
+                "MediumWeight", "HutFrighten", "Aerial"
 
 ; /* <-- avoid gettext warnings
 ;
-- 
2.40.1