BuildingType
    name = "BLD_AUTO_HISTORY_ANALYSER"
    description = "BLD_AUTO_HISTORY_ANALYSER_DESC"
    buildcost = 100 * [[BUILDING_COST_MULTIPLIER]]
    buildtime = 5
    location = And [
        Planet
        Contains Building name = "BLD_CULTURE_ARCHIVES"
        Not Contains Building name = "BLD_AUTO_HISTORY_ANALYSER"
        OwnedBy empire = Source.Owner
        TargetPopulation low = 1
    ]
    enqueuelocation = [[ENQUEUE_BUILD_ONE_PER_PLANET]]
    effectsgroups = [
        [[SPECIES_LIKES_OR_DISLIKES_BUILDING_STABILITY_EFFECTS]]
    
        EffectsGroup
            scope = And [
                Object id = Source.PlanetID
                Planet
                Not Population high = 0
                OwnedBy empire = Source.Owner
                Happiness low = 0
            ]
            activation = ContainedBy And [
                Object id = Source.PlanetID
                Contains Building name = "BLD_CULTURE_ARCHIVES"
            ]
            priority = [[TARGET_AFTER_2ND_SCALING_PRIORITY]]
            effects =
                SetTargetResearch value = Value + (NamedReal name = "BLD_AUTO_HISTORY_ANALYSER_TARGET_RESEARCH_FLAT" value = 5)
    ]
    icon = "icons/building/science1.png"

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