BuildingType
    name = "BLD_SCRYING_SPHERE"
    description = "BLD_SCRYING_SPHERE_DESC"
    buildcost = 150 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 5
    location = And [
        Planet
        OwnedBy empire = Source.Owner
        Not WithinStarlaneJumps jumps = 5 condition = Building name = "BLD_SCRYING_SPHERE"
    ]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_BUILDING_STABILITY_EFFECTS]]
    
        EffectsGroup
            scope = And [
                Capital
                OwnedBy empire = Source.Owner
            ]
            activation = Not Unowned
            stackinggroup = "SCRYING_SPHERE_POLICY_SLOT_STACK"
            effects = SetEmpireMeter empire = Source.Owner
                                     meter = "SOCIAL_CATEGORY_NUM_POLICY_SLOTS" value = Value + 1
    
        EffectsGroup
            scope = Or [
                And [
                    Or [
                        Planet
                        Building
                    ]
                    ContainedBy condition = Contains Building name = "BLD_SCRYING_SPHERE"
                    Not OwnedBy empire = Source.Planet.Owner    // would be redundant to re-assign ownership to own planets
                ]
                And [
                    System
                    Contains Building name = "BLD_SCRYING_SPHERE"
                ]
            ]
            activation = And [
                ContainedBy condition = And [
                    Planet
                    Not Unowned
                ]
            ]
            effects = SetVisibility empire = Source.Planet.Owner
                visibility = Max(Partial, Value)
    ]
    icon = "icons/specials_huge/ancient_ruins_excavated.png"

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