BuildingType
    name = "BLD_MEGALITH"
    description = "BLD_MEGALITH_DESC"
    buildcost = 250 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 10
    location = And [
        Planet
        Contains Building name = "BLD_IMPERIAL_PALACE"
        Not Contains Building name = "BLD_MEGALITH"
        OwnedBy empire = Source.Owner
        TargetPopulation low = 1
    ]
    EnqueueLocation = [[ENQUEUE_BUILD_ONE_PER_PLANET]]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Object id = Source.PlanetID
                Planet
            ]
            stackinggroup = "BLD_MEGALITH_EFFECT"
            effects = [
                SetTargetConstruction value = Value + 30
                SetEmpireCapital
                SetIndustry value = Target.TargetIndustry
                SetTrade value = Target.TargetTrade
                SetResearch value = Target.TargetResearch
            ]

        EffectsGroup
            scope = And [
                PopulationCenter
                OwnedBy empire = Source.Owner
                TargetPopulation low = 1
            ]
            stackinggroup = "BLD_MEGALITH_EFFECT"
            effects = SetMaxSupply value = Value + 1

        EffectsGroup
            scope = And [
                Planet
                WithinStarlaneJumps jumps = 2 condition = Source
                OwnedBy empire = Source.Owner
            ]
            priority = [[LATE_PRIORITY]]
            effects = SetMaxTroops value = Value + 10 accountinglabel = "MEGALITH_LABEL"
    ]
    icon = "icons/building/megalith.png"

#include "/scripting/common/enqueue.macros"
#include "/scripting/common/priorities.macros"
#include "/scripting/common/base_prod.macros"