Policy
    name = "PLC_RACIAL_PURITY"
    description = "PLC_RACIAL_PURITY_DESC"
    short_description = "PLC_RACIAL_PURITY_SHORT_DESC"
    category = "SOCIAL_CATEGORY"
    adoptioncost = floor(2.0 * [[POPULATION_OWNED_BY_EMPIRE]]^0.5)
    exclusions = [ "PLC_AUGMENTATION" "PLC_COLONIALISM" "PLC_DIVERSITY" "PLC_NATIVE_APPROPRIATION" "PLC_VASSALIZATION" ]
    unlock = Item type = Policy name = "PLC_THE_HUNT"
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]
        
        // This policy disables influence and research foci for non-capital, non-exobot species
        // See /species/common/focus.macros

        // Creates a special to ensure that deadopting this policy has bad consequencies for a while
        EffectsGroup
            scope = Source
            activation = Not HasSpecial name = "RACIAL_PURITY_SENTINEL_SPECIAL"
            effects = AddSpecial name = "RACIAL_PURITY_SENTINEL_SPECIAL"

        // Stability bonus to capital species, grows slowly.
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species name = Source.Species
            ]
            effects = SetTargetHappiness value = Value
                + min((NamedReal name = "PLC_RACIAL_PURITY_TARGET_STABILITY_SELF" value = 5),
                    (TurnsSincePolicyAdopted empire = Source.Owner name = ThisPolicy) *
                    (NamedReal name = "PLC_RACIAL_PURITY_STABILITY_PER_TURN" value = 0.5))

        // Influence bonus to influence-focused, capital species 
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species name = Source.Species
                Focus type = "FOCUS_INFLUENCE"
            ]
            effects = SetTargetInfluence value = Value
                + (NamedReal name = "PLC_RACIAL_PURITY_TARGET_INFLUENCE_SELF" value = 1)

        // Stability and influence penalty to all non-capital, non-exobot species
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species
                Not Species name = Source.Species
                Not Species name = "SP_EXOBOT"
            ]
            effects = [
                SetTargetHappiness value = Value
                    + (NamedReal name = "PLC_RACIAL_PURITY_TARGET_STABILITY_OTHER" value = -10)
                SetTargetInfluence value = Value
                    + (NamedReal name = "PLC_RACIAL_PURITY_TARGET_INFLUENCE_OTHER" value = -1)
            ]

        // Industry bonus to industry-focused, non-capital, non-exobot species (slavery)
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species
                Not Species name = Source.Species
                Not Species name = "SP_EXOBOT"
                Focus type = "FOCUS_INDUSTRY"
            ]
            effects = SetTargetIndustry value = Value + Target.Population
                * (NamedReal name = "PLC_RACIAL_PURITY_TARGET_INDUSTRY_OTHER" value = 0.25 * [[RESEARCH_PER_POP]])
    ]
    graphic = "icons/policies/social_racial_purity.png"

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