From e1ea9f0eb92d23769fd06281f10c86591e83e28a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Sep 2023 20:08:40 +0300 Subject: [PATCH 13/13] 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 | 10 ++-- data/sandbox/effects.ruleset | 100 +++++++++------------------------- data/sandbox/units.ruleset | 10 ++-- 4 files changed, 63 insertions(+), 155 deletions(-) diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset index 22cb44adb6..21daaf6326 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] @@ -377,41 +369,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 @@ -1868,22 +1844,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 @@ -1910,17 +1878,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] @@ -3109,23 +3069,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 0728cada09..8c62497c05 100644 --- a/data/civ2civ3/units.ruleset +++ b/data/civ2civ3/units.ruleset @@ -55,6 +55,7 @@ class_flags = _("Airliftable"), _("Can be airlifted from a suitable city.") _("AttFromNonNative"), _("Can launch attack from non-native tiles.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -154,7 +155,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", - "TerrainDefense", "Airliftable", "Barracks" + "TerrainDefense", "Airliftable", "Barracks", "Ground" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -162,7 +163,8 @@ name = _("?unitclass:Small Land") min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "BuildAnywhere", "CollectRansom", - "ZOC", "CanFortify", "TerrainDefense", "DoesntOccupyTile", "Airliftable" + "ZOC", "CanFortify", "TerrainDefense", "DoesntOccupyTile", "Airliftable", + "Ground" [unitclass_land_big] ; /* TRANS: Unit class: used adjectivally */ @@ -171,7 +173,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom","ZOC", "CanFortify", "KillCitizen", "Airliftable", - "Barracks" + "Barracks", "Ground" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ @@ -179,7 +181,7 @@ name = _("?unitclass:Merchant") min_speed = 1 hp_loss_pct = 0 flags = "BuildAnywhere", "DoesntOccupyTile", - "ZOC", "TerrainDefense", "TerrainSpeed", "Airliftable" + "ZOC", "TerrainDefense", "TerrainSpeed", "Airliftable", "Ground" [unitclass_sea] ; /* TRANS: Unit class: used adjectivally */ diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index 4e9e032193..eac4477f2f 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] @@ -381,41 +373,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 @@ -1910,22 +1886,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 @@ -1947,22 +1915,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] @@ -3159,23 +3119,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 3b6375b43c..bbd621fde2 100644 --- a/data/sandbox/units.ruleset +++ b/data/sandbox/units.ruleset @@ -61,6 +61,7 @@ class_flags = _("Expellable"), _("Can be peacefully expelled from foreign tiles.") _("AttFromNonNative"), _("Can launch attack from non-native tiles.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -160,7 +161,8 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", - "TerrainDefense", "LightWeight", "BorderPolice", "Barracks" + "TerrainDefense", "LightWeight", "BorderPolice", "Barracks", + "Ground" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -169,7 +171,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "BuildAnywhere", "CollectRansom", "ZOC", "TerrainDefense", "DoesntOccupyTile", "LightWeight", - "Expellable" + "Expellable", "Ground" [unitclass_land_big] ; /* TRANS: Unit class: used adjectivally */ @@ -178,7 +180,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom","ZOC", "CanFortify", "KillCitizen", "MediumWeight", - "Barracks" + "Barracks", "Ground" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ @@ -187,7 +189,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "BuildAnywhere", "DoesntOccupyTile", "ZOC", "TerrainDefense", "TerrainSpeed", "MediumWeight", - "Expellable" + "Expellable", "Ground" [unitclass_sea] ; /* TRANS: Unit class: used adjectivally */ -- 2.40.1