Policy
    name = "PLC_MODERATION"
    description = "PLC_MODERATION_DESC"
    short_description = "PLC_MODERATION_SHORT_DESC"
    category = "ECONOMIC_CATEGORY"
    adoptioncost = floor(2.0 * [[POPULATION_OWNED_BY_EMPIRE]]^0.5)
    exclusions = [ "PLC_INDUSTRIALISM" "PLC_STOCKPILE_LIQUIDATION" "PLC_TECHNOCRACY" ]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_POLICY_STABILITY_EFFECTS]]
    
        EffectsGroup
            scope = And [
                Capital
                OwnedBy empire = Source.Owner
            ]
            priority = [[TARGET_AFTER_2ND_SCALING_PRIORITY]]
            effects = [
                // want bigger bonus for using equal numbers of each focus settings
                // and for using a greater variety of focus settings
                // focus used equally -> decrease with HistoSpread
                // use more different focus -> increase with CountUnique
                SetTargetInfluence value = Value + ((NamedReal name = "PLC_MODERATION_INFLUENCE_SCALING" value = 3.0) *
                    ((Statistic Count
                        condition = And [ Planet OwnedBy empire = Source.Owner ])
                    / (Statistic HistogramMax
                        value = LocalCandidate.Focus
                        condition = And [ Planet OwnedBy empire = Source.Owner ])
                    - 1.0))
                    
                SetTargetHappiness value = Value + ((NamedReal name = "PLC_MODERATION_STABILITY_SCALING" value = 1.0) *
                    ((Statistic Count
                        condition = And [ Planet OwnedBy empire = Source.Owner ])
                    / (Statistic HistogramMax
                        value = LocalCandidate.Focus
                        condition = And [ Planet OwnedBy empire = Source.Owner ])
                    - 1.0))
            ]
    ]
    graphic = "icons/policies/economic_moderation.png"

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