Policy
    name = "PLC_TERROR_SUPPRESSION"
    description = "PLC_TERROR_SUPPRESSION_DESC"
    short_description = "PLC_TERROR_SUPPRESSION_SHORT_DESC"
    category = "MILITARY_CATEGORY"
    adoptioncost = 0.0
    exclusions = [ "PLC_ARTISAN_WORKSHOPS" "PLC_CONFEDERATION" "PLC_LIBERTY" ]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]

        // makes empire's own planets more stable where military has ships crewed by capital species
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species
                ContainedBy And [
                    Object id = RootCandidate.SystemID
                    Contains And [
                        InSystem id = RootCandidate.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]
                ]
            ]
            effects = [
                SetTargetHappiness value = Value +
                    (Statistic Count condition = And [
                        InSystem id = Target.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]) * (NamedReal name = "PLC_TERROR_SUPPRESSION_TARGET_STABILITY_SCALE" value = 1.0)
                    
                SetRebelTroops value = max(0.0, Value -
                    (Statistic Count condition = And [
                        InSystem id = Target.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]) * (NamedReal name = "PLC_TERROR_SUPPRESSION_REBEL_REDUCTION_SCALE" value = 1.0))
            ]

        // makes empire's enemies' planets less stable and have less rebels where the empire military has ships crewed by capital species
        EffectsGroup
            scope = And [
                Planet
                OwnedBy affiliation = EnemyOf empire = Source.Owner
                Species
                Not Species name = Source.Species
                ContainedBy And [
                    Object id = RootCandidate.SystemID
                    Contains And [
                        InSystem id = RootCandidate.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]
                ]
            ]
            effects = [
                SetTargetHappiness value = Value -
                    (Statistic Count condition = And [
                        InSystem id = Target.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]) * (NamedRealLookup name = "PLC_TERROR_SUPPRESSION_TARGET_STABILITY_SCALE")
                    
                SetRebelTroops value = max(0.0, Value -
                    (Statistic Count condition = And [
                        InSystem id = Target.SystemID
                        Ship
                        OwnedBy empire = Source.Owner
                        Armed
                        Species name = Source.Species
                        Aggressive
                    ]) * (NamedReal name = "PLC_TERROR_SUPPRESSION_REBEL_REDUCTION_SCALE" value = 1.0))
            ]


        // makes armed ships crewed by imperial capital planet's species cost influence
        EffectsGroup
            scope = And [
                Ship
                OwnedBy empire = Source.Owner
                Armed
                Species name = Source.Species
            ]
            effects = [
                SetTargetInfluence value = Value -
                   (NamedReal name = "PLC_TERROR_SUPPRESSION_SHIP_INFLUENCE_FLAT" value = 0.2)
            ]
    ]
    graphic = "icons/policies/military_terror_suppression.png"

#include "/scripting/policies/policies.macros"
