From b3c1b391efd5085a42200d5ce6dfaf94bb9c5da8 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 23 Sep 2023 19:45:35 +0300 Subject: [PATCH 29/29] 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 f0f621d48d..06029f9241 100644 --- a/data/civ2civ3/effects.ruleset +++ b/data/civ2civ3/effects.ruleset @@ -260,22 +260,14 @@ reqs = "Extra", "Airbase", "Tile" } -; 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", "Tile", 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", "Tile" } [effect_fort_defense] @@ -436,41 +428,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", "Tile", 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", "Tile" + "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", "Tile", 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", "Tile", FALSE + { "type", "name", "range", "present" + "Terrain", "Mountains", "Tile", TRUE + "UnitClassFlag", "Ground", "Local", TRUE + "Extra", "Road", "Tile", FALSE } ; Nuclear power gives +1 moves to sea units @@ -1894,22 +1870,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", "Tile", 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", "Tile" } ; Every Land, Sea, Trireme @@ -1936,17 +1904,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] @@ -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", "Tile", 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", "Tile" + "UnitClassFlag", "Ground", "Local" } [effect_great_wall_1] diff --git a/data/civ2civ3/units.ruleset b/data/civ2civ3/units.ruleset index fa79fd3f8e..d19822a6aa 100644 --- a/data/civ2civ3/units.ruleset +++ b/data/civ2civ3/units.ruleset @@ -63,6 +63,7 @@ class_flags = ; /* xgettext:no-c-format */ _("Gets a 50% defensive bonus while in cities.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -160,7 +161,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 */ @@ -169,7 +170,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 */ @@ -178,7 +179,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 */ @@ -187,7 +188,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 3380f7846e..a1b2418f53 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -260,22 +260,14 @@ reqs = "Extra", "Airbase", "Tile" } -; 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", "Tile", 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", "Tile" } [effect_fort_defense] @@ -514,41 +506,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", "Tile", 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", "Tile" + "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", "Tile", 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", "Tile", FALSE + { "type", "name", "range", "present" + "Terrain", "Mountains", "Tile", TRUE + "UnitClassFlag", "Ground", "Local", TRUE + "Extra", "Road", "Tile", FALSE } ; Nuclear power gives +1 moves to sea units @@ -2010,22 +1986,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", "Tile", 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", "Tile" } ; Every Land, Sea, Trireme @@ -2047,22 +2015,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] @@ -3289,23 +3249,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", "Tile", 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", "Tile" } [effect_great_wall_1] diff --git a/data/sandbox/units.ruleset b/data/sandbox/units.ruleset index 9e76cfc115..2e4fe35c1c 100644 --- a/data/sandbox/units.ruleset +++ b/data/sandbox/units.ruleset @@ -73,6 +73,7 @@ class_flags = ; /* xgettext:no-c-format */ _("Gets a 50% defensive bonus while in cities.") _("Barracks"), _("Benefits from barracks") + _("Ground"), _("Ground units") } [veteran_system] @@ -170,7 +171,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 */ @@ -179,7 +180,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 */ @@ -188,7 +189,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 */ @@ -197,7 +198,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