Policy
    name = "PLC_VASSALIZATION"
    description = "PLC_VASSALIZATION_DESC"
    short_description = "PLC_VASSALIZATION_SHORT_DESC"
    category = "ECONOMIC_CATEGORY"
    adoptioncost = 5 + floor(5 + 0.1 * Statistic Sum value = LocalCandidate.Population
                                        condition = And [
                                            Planet
                                            Unowned
                                            Species
                                            ContainedBy And [
                                                Object id = RootCandidate.SystemID
                                                Contains And [
                                                    Planet
                                                    Species
                                                    OwnedBy empire = Source.Owner
                                                ]
                                            ]
                                        ])
    prerequisites = [ "PLC_CONFEDERATION" "PLC_SYSTEM_INFRA" ]
    exclusions = [ "PLC_ISOLATION" "PLC_NATIVE_APPROPRIATION" "PLC_RACIAL_PURITY" "PLC_THE_HUNT" ]
    unlock = Item type = Policy name = "PLC_COLONIALISM"
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]

        // influence-focused planets, in systems with unowned populated planets that have a different species from the homeworld and the target planet, get a bonus
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Focus type = "FOCUS_INFLUENCE"
                ContainedBy And [
                    Object id = RootCandidate.SystemID
                    Contains And [
                        InSystem id = RootCandidate.SystemID
                        Planet
                        Unowned
                        Species
                        Not Species name = Source.Species
                        Not Species name = RootCandidate.Species
                        ResourceSupplyConnected empire = Source.Owner condition = RootCandidate
                    ]
                ]
            ]
            effects = SetTargetInfluence value = Value +
                (NamedReal name = "PLC_VASSALIZATION_INFLUENCE_SCALING" value = 2.0) *
                (Statistic Sum value = LocalCandidate.Population condition = And [
                    InSystem id = Target.SystemID
                    Planet
                    Unowned
                    Species
                    Not Species name = Source.Species
                    Not Species name = Target.Species                    
                ] ^ 0.5) / max(1.0,
                (Statistic Count condition = And [ // spreads bonus over eligible recipient planets in system
                    Planet
                    OwnedBy empire = Source.Owner
                    Species
                    Focus type = "FOCUS_INFLUENCE"
                    InSystem id = Target.SystemID
                ]))
    ]
    graphic = "icons/policies/economic_vassalization.png"

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