From db5242001c8f985c2a26f16548d4a2eda6942b9d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 1 Apr 2023 18:19:04 +0300 Subject: [PATCH 13/13] civ2civ3/sandbox: Refactor barracks effects - Add user unit class flag "Barracks" - Give that glat to unit classes affected by Barracks - Merge separate Barracks effects differing only by required unit class to one that requires that class flag See osdn #47738 Signed-off-by: Marko Lindqvist --- data/civ2civ3/effects.ruleset | 135 ++++++++-------------------------- data/civ2civ3/units.ruleset | 6 +- data/sandbox/effects.ruleset | 135 ++++++++-------------------------- data/sandbox/units.ruleset | 6 +- 4 files changed, 72 insertions(+), 210 deletions(-) diff --git a/data/civ2civ3/effects.ruleset b/data/civ2civ3/effects.ruleset index 4e3f8152ad..3de7eb0c4c 100644 --- a/data/civ2civ3/effects.ruleset +++ b/data/civ2civ3/effects.ruleset @@ -1789,124 +1789,64 @@ reqs = "OutputType", "Luxury", "Local" } -[effect_barracks] +[effect_barracks_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_b] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Land", "Local", TRUE + { "type", "name", "range", "present" + "Building", "Barracks", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE } -[effect_barracks_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - } - -[effect_barracks_ii] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_ii_b] +[effect_barracks_ii_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks II", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_ii_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Land", "Local", TRUE + { "type", "name", "range", "present" + "Building", "Barracks II", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE } -[effect_barracks_ii_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - } - -[effect_barracks_iii] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks III", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_iii_b] +[effect_barracks_iii_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks III", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks III", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_iii_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range" - "Building", "Barracks III", "City" - "UnitClass", "Land", "Local" - } - -[effect_barracks_iii_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range" - "Building", "Barracks III", "City" - "UnitClass", "Big Land", "Local" + { "type", "name", "range" + "Building", "Barracks III", "City" + "UnitClassFlag", "Barracks", "Local" } [effect_cathedral] @@ -3720,22 +3660,11 @@ reqs = type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_sun_tzus_war_academy_1] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Sun Tzu's War Academy", "Player", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_sun_tzus_war_academy_culture] diff --git a/data/civ2civ3/units.ruleset b/data/civ2civ3/units.ruleset index 61b1604402..746c373516 100644 --- a/data/civ2civ3/units.ruleset +++ b/data/civ2civ3/units.ruleset @@ -54,6 +54,7 @@ class_flags = { "name", "helptxt" _("Airliftable"), _("Can be airlifted from a suitable city.") _("AttFromNonNative"), _("Can launch attack from non-native tiles.") + _("Barracks"), _("Benefits from barracks") } [veteran_system] @@ -153,7 +154,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", - "TerrainDefense", "Airliftable" + "TerrainDefense", "Airliftable", "Barracks" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -169,7 +170,8 @@ name = _("?unitclass:Big Land") min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", - "CollectRansom","ZOC", "CanFortify", "KillCitizen", "Airliftable" + "CollectRansom","ZOC", "CanFortify", "KillCitizen", "Airliftable", + "Barracks" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ diff --git a/data/sandbox/effects.ruleset b/data/sandbox/effects.ruleset index e639950897..80ceff089c 100644 --- a/data/sandbox/effects.ruleset +++ b/data/sandbox/effects.ruleset @@ -1831,124 +1831,64 @@ reqs = "OutputType", "Luxury", "Local" } -[effect_barracks] +[effect_barracks_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_b] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Land", "Local", TRUE + { "type", "name", "range", "present" + "Building", "Barracks", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE } -[effect_barracks_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - } - -[effect_barracks_ii] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_ii_b] +[effect_barracks_ii_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks II", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_ii_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Land", "Local", TRUE + { "type", "name", "range", "present" + "Building", "Barracks II", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE } -[effect_barracks_ii_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks II", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - } - -[effect_barracks_iii] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Barracks III", "City", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_barracks_iii_b] +[effect_barracks_iii_veteran] type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Barracks III", "City", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Barracks III", "City", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_barracks_iii_hp] type = "HP_Regen" value = 100 reqs = - { "type", "name", "range" - "Building", "Barracks III", "City" - "UnitClass", "Land", "Local" - } - -[effect_barracks_iii_b_hp] -type = "HP_Regen" -value = 100 -reqs = - { "type", "name", "range" - "Building", "Barracks III", "City" - "UnitClass", "Big Land", "Local" + { "type", "name", "range" + "Building", "Barracks III", "City" + "UnitClassFlag", "Barracks", "Local" } [effect_cathedral] @@ -3770,22 +3710,11 @@ reqs = type = "Veteran_Build" value = 1 reqs = - { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE - "UnitClass", "Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE - } - -[effect_sun_tzus_war_academy_1] -type = "Veteran_Build" -value = 1 -reqs = - { "type", "name", "range", "present" - "Building", "Sun Tzu's War Academy", "Player", TRUE - "UnitClass", "Big Land", "Local", TRUE - "UnitFlag", "NonMil", "Local", FALSE - "UnitFlag", "NoVeteran", "Local", FALSE + { "type", "name", "range", "present" + "Building", "Sun Tzu's War Academy", "Player", TRUE + "UnitClassFlag", "Barracks", "Local", TRUE + "UnitFlag", "NonMil", "Local", FALSE + "UnitFlag", "NoVeteran", "Local", FALSE } [effect_sun_tzus_war_academy_culture] diff --git a/data/sandbox/units.ruleset b/data/sandbox/units.ruleset index 27cf8233d0..c05a124a07 100644 --- a/data/sandbox/units.ruleset +++ b/data/sandbox/units.ruleset @@ -60,6 +60,7 @@ class_flags = _("BorderPolice"), _("Can peacefully expel certain foreign units.") _("Expellable"), _("Can be peacefully expelled from foreign tiles.") _("AttFromNonNative"), _("Can launch attack from non-native tiles.") + _("Barracks"), _("Benefits from barracks") } [veteran_system] @@ -159,7 +160,7 @@ min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", "CollectRansom", "ZOC", "CanFortify", "CanPillage", - "TerrainDefense", "LightWeight", "BorderPolice" + "TerrainDefense", "LightWeight", "BorderPolice", "Barracks" [unitclass_land_small] ; /* TRANS: Unit class: used adjectivally */ @@ -176,7 +177,8 @@ name = _("?unitclass:Big Land") min_speed = 1 hp_loss_pct = 0 flags = "TerrainSpeed", "DamageSlows", "CanOccupyCity", "BuildAnywhere", - "CollectRansom","ZOC", "CanFortify", "KillCitizen", "MediumWeight" + "CollectRansom","ZOC", "CanFortify", "KillCitizen", "MediumWeight", + "Barracks" [unitclass_merchant] ; /* TRANS: Unit class: used adjectivally */ -- 2.39.2