Policy
    name = "PLC_CENTRALIZATION"
    description = "PLC_CENTRALIZATION_DESC"
    short_description = "PLC_CENTRALIZATION_SHORT_DESC"
    category = "ECONOMIC_CATEGORY"
    adoptioncost = floor(3.0 * [[POPULATION_OWNED_BY_EMPIRE]]^0.5)
    exclusions = [ "PLC_COLONIZATION" "PLC_CONFEDERATION" "PLC_FEUDALISM" "PLC_ISOLATION" ]
    unlock = [
        Item type = Policy name = "PLC_METROPOLES"
        Item type = Policy name = "PLC_BUREAUCRACY"
    ]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]

        // Makes colony buildings and colony/outpost ship parts more expensive
        // See COLONIZATION_POLICY_MULTIPLIER macro in ../common/upkeep.macros

        // capital bonuses
        EffectsGroup
            scope = And [
                Capital
                OwnedBy empire = Source.Owner
                Happiness low = (NamedReal name = "PLC_CENTRALIZATION_MIN_STABILITY" value = 16)
            ]
            priority = [[TARGET_AFTER_SCALING_PRIORITY]]
            effects = [
                SetTargetIndustry value = Value +
                    (min(Target.Happiness, (NamedReal name = "PLC_CENTRALIZATION_MAX_STABILITY" value = 36)) - NamedRealLookup name = "PLC_CENTRALIZATION_MIN_STABILITY")
                    * Target.Population
                    * (NamedReal name = "PLC_CENTRALIZATION_TARGET_INDUSTRY_PERPOP"
                                 value = 0.05 * [[INDUSTRY_PER_POP]])
                SetTargetResearch value = Value +
                    (min(Target.Happiness, (NamedRealLookup name = "PLC_CENTRALIZATION_MAX_STABILITY")) - NamedRealLookup name = "PLC_CENTRALIZATION_MIN_STABILITY")
                    * Target.Population
                    * (NamedReal name = "PLC_CENTRALIZATION_TARGET_RESEARCH_PERPOP"
                                 value = 0.05 * [[RESEARCH_PER_POP]])
                SetTargetConstruction value = Value
                    + (NamedReal name = "PLC_CENTRALIZATION_TARGET_CONSTRUCTION_FLAT" value = 10)
            ]

        // capital penalties
        EffectsGroup
            scope = And [
                Capital
                OwnedBy empire = Source.Owner
            ]
            effects = SetMaxStockpile value = Value
                + (NamedReal name = "PLC_CENTRALIZATION_MAX_STOCKPILE_FLAT" value = -2)

        // supply penalty to all colonies
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Population low = 0.001
            ]
            effects = SetMaxSupply value = Value
                + (NamedReal name = "PLC_CENTRALIZATION_MAX_SUPPLY_FLAT" value = -1)

        // penalty to populated planets that are not supply-connected to the empire capital
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Population low = 0.001
                Not ResourceSupplyConnected empire = LocalCandidate.Owner condition = And [
                    Planet
                    OwnedBy empire = Source.Owner
                    Capital
                ]
            ]
            priority = [[TARGET_LATE_AFTER_2ND_SCALING_PRIORITY]]
            effects = SetTargetInfluence value = Value
                        + (NamedReal name = "PLC_CENTRALIZATION_TARGET_INFLUENCE_FLAT" value = -2)

        // penalty to planets that are supply connected to the capital
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Population low = 0.001
                ResourceSupplyConnected empire = LocalCandidate.Owner condition = And [
                    Planet
                    OwnedBy empire = Source.Owner
                    Capital
                ]
                Not Capital
            ]
            priority = [[TARGET_LATE_AFTER_2ND_SCALING_PRIORITY]]
            effects = SetTargetInfluence value = Value + max(
                        (NamedReal name = "PLC_CENTRALIZATION_TARGET_INFLUENCE_MAX" value = -2),
                        (NamedReal name = "PLC_CENTRALIZATION_TARGET_INFLUENCE_PERJUMP" value = -0.5)
                            * JumpsBetween object = Source.ID object = Target.ID)
    ]
    graphic = "icons/policies/economic_centralization.png"

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