Policy
    name = "PLC_DREAM_RECURSION"
    description = "PLC_DREAM_RECURSION_DESC"
    short_description = "PLC_DREAM_RECURSION_SHORT_DESC"
    category = "SOCIAL_CATEGORY"
    adoptioncost = 1.0
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]

        // makes planets more stable at cost of influence (1:1)
        // increases target stability by whatever increase brings it up to 5.0
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                Species
            ]
            activation = EmpireStockpile empire = Source.Owner resource = Influence low = 0
            priority = [[TARGET_LAST_BEFORE_OVERRIDE_PRIORITY]]
            effects = [
                SetTargetInfluence value = Value - max(0.0,
                    (NamedReal name = "PLC_INDOCTRINATION_STRENGTH_BASE" value = 5.0) +
                    (NamedReal name = "PLC_INDOCTRINATION_STRENGTH_PER_COLLECTIVE_NET" value = 2.0) *
                        (Statistic Count condition = And [ Building name = "BLD_COLLECTIVE_NET" OwnedBy empire = Source.Owner ]) -
                    Value(Target.TargetHappiness))^0.5
                SetTargetHappiness value = Value + max(0.0, 
                    (NamedRealLookup name = "PLC_INDOCTRINATION_STRENGTH_BASE") +
                    (NamedRealLookup name = "PLC_INDOCTRINATION_STRENGTH_PER_COLLECTIVE_NET") *
                        (Statistic Count condition = And [ Building name = "BLD_COLLECTIVE_NET" OwnedBy empire = Source.Owner ]) -
                    Value(Target.TargetHappiness))
            ]
    ]
    graphic = "icons/policies/social_dream_recursion.png"

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