From 02e6d98f6ded8e46c3aa626b4f6031f92db008c6 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Sep 2023 20:00:15 +0300 Subject: [PATCH 19/19] civ2civ3/sandbox: Add "Ground" unit class flag Simplifies effect requirement lists. See osdn #48711 Signed-off-by: Marko Lindqvist --- data/civ2civ3/effects.ruleset | 98 +++++++++------------------------ data/civ2civ3/units.ruleset | 9 +-- data/sandbox/effects.ruleset | 100 +++++++++------------------------- data/sandbox/units.ruleset | 9 +-- 4 files changed, 61 insertions(+), 155 deletions(-) diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset index 35ab721565..e828219e3b 100644 --- a/data/civ2civ3/effects.ruleset +++ b/data/civ2civ3/effects.ruleset @@ -245,22 +245,14 @@ reqs = "Extra", "Airbase", "Local" } -; Fortress HP regen (Every Land units) +; Fortress HP regen (All Ground units) [effect_fortress_hp_regen] type = "HP_Regen" value = 25 reqs = - { "type", "name", "range", "present" - "Extra", "Fortress", "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" + "UnitClassFlag", "Ground", "Local" + "Extra", "Fortress", "Local" } [effect_fort_defense] @@ -421,41 +413,25 @@ reqs = "Tech", "Electricity", "Player" } -; Vision benefit from mountains (for every land unit) +; Vision benefit from mountains (All Ground unit) [effect_mountains_vision] type = "Unit_Vision_Radius_Sq" value = 4 reqs = - { "type", "name", "range", "present" - "Terrain", "Mountains", "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" + "Terrain", "Mountains", "Local" + "UnitClassFlag", "Ground", "Local" } -; Movement penalty if ended turn at mountains (for every land unit) +; Movement penalty if ended turn at mountains (All Ground units) [effect_mountains_movement] type = "Move_Bonus" value = -1 reqs = - { "type", "name", "range", "present" - "Terrain", "Mountains", "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 - "Extra", "Road", "Local", FALSE + { "type", "name", "range", "present" + "Terrain", "Mountains", "Local", TRUE + "UnitClassFlag", "Ground", "Local", TRUE + "Extra", "Road", "Local", FALSE } ; Nuclear power gives +1 moves to sea units @@ -1912,22 +1888,14 @@ reqs = "Gov", "Communism", "Player", FALSE } -; Every Land +; All Ground units [effect_city_defense_0] type = "Defend_Bonus" value = 50 reqs = - { "type", "name", "range", "present" - "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" + "UnitClassFlag", "Ground", "Local" + "CityTile", "Center", "Local" } ; Every Land, Sea, Trireme @@ -1954,17 +1922,9 @@ reqs = type = "Defend_Bonus" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "City Walls", "City", 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" + "Building", "City Walls", "City" + "UnitClassFlag", "Ground", "Local" } [effect_city_walls_1] @@ -3138,23 +3098,15 @@ reqs = "Building", "Great Library", "City" } -; Every Land unit +; All Ground units [effect_great_wall] type = "Defend_Bonus" value = 50 reqs = - { "type", "name", "range", "present" - "Building", "Great Wall", "Player", 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" + "Building", "Great Wall", "Player" + "CityTile", "Center", "Local" + "UnitClassFlag", "Ground", "Local" } [effect_great_wall_1] diff --git a/data/civ2civ3/units.ruleset b/data/civ2civ3/units.ruleset index d491ca02b4..c626a7892b 100644 --- a/data/civ2civ3/units.ruleset +++ b/data/civ2civ3/units.ruleset @@ -62,6 +62,7 @@ class_flags = ; /* xgettext:no-c-format */ _("Gets a 50% defensive bonus while in cities.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -159,7 +160,7 @@ hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", "TerrainDefense", "Airliftable", "NonNatBombardTgt", - "Barracks" + "Barracks", "Ground" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -168,7 +169,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "TerrainDefense", "DoesntOccupyTile", - "Airliftable", "NonNatBombardTgt", "Barracks" + "Airliftable", "NonNatBombardTgt", "Barracks", "Ground" [unitclass_land_big] ; /* TRANS: Unit class: used adjectivally */ @@ -177,7 +178,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom","ZOC", "CanFortify", "KillCitizen", "Airliftable", - "NonNatBombardTgt", "Barracks" + "NonNatBombardTgt", "Barracks", "Ground" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ @@ -186,7 +187,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "BuildAnywhere", "DoesntOccupyTile", "ZOC", "TerrainDefense", "TerrainSpeed", "Airliftable", - "NonNatBombardTgt", "Barracks" + "NonNatBombardTgt", "Barracks", "Ground" [unitclass_sea] ; /* TRANS: Unit class: used adjectivally */ diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index b49717361a..66af9b6425 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -245,22 +245,14 @@ reqs = "Extra", "Airbase", "Local" } -; Fortress HP regen (Every Land units) +; Fortress HP regen (All Ground units) [effect_fortress_hp_regen] type = "HP_Regen" value = 25 reqs = - { "type", "name", "range", "present" - "Extra", "Fortress", "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" + "UnitClassFlag", "Ground", "Local" + "Extra", "Fortress", "Local" } [effect_fort_defense] @@ -499,41 +491,25 @@ reqs = "Tech", "Electricity", "Player" } -; Vision benefit from mountains (for every land unit) +; Vision benefit from mountains (All Ground units) [effect_mountains_vision] type = "Unit_Vision_Radius_Sq" value = 4 reqs = - { "type", "name", "range", "present" - "Terrain", "Mountains", "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" + "Terrain", "Mountains", "Local" + "UnitClassFlag", "Ground", "Local" } -; Movement penalty if ended turn at mountains (for every land unit) +; Movement penalty if ended turn at mountains (All Ground units) [effect_mountains_movement] type = "Move_Bonus" value = -1 reqs = - { "type", "name", "range", "present" - "Terrain", "Mountains", "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 - "Extra", "Road", "Local", FALSE + { "type", "name", "range", "present" + "Terrain", "Mountains", "Local", TRUE + "UnitClassFlag", "Ground", "Local", TRUE + "Extra", "Road", "Local", FALSE } ; Nuclear power gives +1 moves to sea units @@ -2028,22 +2004,14 @@ reqs = "Gov", "Communism", "Player", FALSE } -; Every Land +; All Ground units [effect_city_defense_0] type = "Defend_Bonus" value = 50 reqs = - { "type", "name", "range", "present" - "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" + "UnitClassFlag", "Ground", "Local" + "CityTile", "Center", "Local" } ; Every Land, Sea, Trireme @@ -2065,22 +2033,14 @@ reqs = "UnitClass", "Missile", "Local", FALSE } -; Every Land +; All Ground units [effect_city_walls_0] type = "Defend_Bonus" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "City Walls", "City", 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" + "UnitClassFlag", "Ground", "Local" + "Building", "City Walls", "City" } [effect_city_walls_1] @@ -3270,23 +3230,15 @@ reqs = "Building", "Great Library", "City" } -; Every Land unit +; All Ground units [effect_great_wall] type = "Defend_Bonus" value = 50 reqs = - { "type", "name", "range", "present" - "Building", "Great Wall", "Player", 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" + "UnitClassFlag", "Ground", "Local" + "Building", "Great Wall", "Player" + "CityTile", "Center", "Local" } [effect_great_wall_1] diff --git a/data/sandbox/units.ruleset b/data/sandbox/units.ruleset index 889d539a09..1bb53550e9 100644 --- a/data/sandbox/units.ruleset +++ b/data/sandbox/units.ruleset @@ -72,6 +72,7 @@ class_flags = ; /* xgettext:no-c-format */ _("Gets a 50% defensive bonus while in cities.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -169,7 +170,7 @@ hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", "TerrainDefense", "LightWeight", "BorderPolice", - "NonNatBombardTgt", "Barracks" + "NonNatBombardTgt", "Barracks", "Ground" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -178,7 +179,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "BuildAnywhere", "CollectRansom", "ZOC", "TerrainDefense", "DoesntOccupyTile", "LightWeight", - "Expellable", "NonNatBombardTgt", "Barracks" + "Expellable", "NonNatBombardTgt", "Barracks", "Ground" [unitclass_land_big] ; /* TRANS: Unit class: used adjectivally */ @@ -187,7 +188,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom","ZOC", "CanFortify", "KillCitizen", "MediumWeight", - "NonNatBombardTgt", "Barracks" + "NonNatBombardTgt", "Barracks", "Ground" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ @@ -196,7 +197,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "BuildAnywhere", "DoesntOccupyTile", "ZOC", "TerrainDefense", "TerrainSpeed", "MediumWeight", - "Expellable", "NonNatBombardTgt", "Barracks" + "Expellable", "NonNatBombardTgt", "Barracks", "Ground" [unitclass_sea] ; /* TRANS: Unit class: used adjectivally */ -- 2.40.1