// For long term changes - Do not modify this definition directly
//                     Instead modify and execute col_bld_gen.py and use the result.
BuildingType
    name = "BLD_COL_SETINON"
    description = "BLD_COL_SETINON_DESC"
    buildcost = 50 * [[COLONY_UPKEEP_MULTIPLICATOR]] * [[BUILDING_COST_MULTIPLIER]] * [[COLONIZATION_POLICY_MULTIPLIER]]
    buildtime = 1.0 * max(5.0, 1.0 +
        (Statistic Min value = ShortestPath object = Target.SystemID object = LocalCandidate.SystemID
            condition = And [
                Planet
                OwnedBy empire = Source.Owner
                Species name = "SP_SETINON"
                Population low = [[MIN_RECOLONIZING_SIZE]]
                Happiness low = 5
                ResourceSupplyConnected empire = Source.Owner condition = Target
            ]
        ) / (60
             + 20 * (Statistic If condition = Or [
                 And [ Source OwnerHasTech name = "SHP_MIL_ROBO_CONT" ]
                 And [ Source OwnerHasTech name = "SHP_SPACE_FLUX_BUBBLE" ]
                 And [ Source OwnerHasTech name = "SHP_ORG_HULL" ]
                 And [ Source OwnerHasTech name = "SHP_QUANT_ENRG_MAG" ]
             ])
             + 20 * (Statistic If condition = Or [
                 And [ Source OwnerHasTech name = "SHP_ORG_HULL" ]
                 And [ Source OwnerHasTech name = "SHP_QUANT_ENRG_MAG" ]
             ])
             + 20 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_QUANT_ENRG_MAG" ])
             + 10 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_IMPROVED_ENGINE_COUPLINGS" ])
             + 10 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_N_DIMENSIONAL_ENGINE_MATRIX" ])
             + 10 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_SINGULARITY_ENGINE_CORE" ])
             + 10 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_TRANSSPACE_DRIVE" ])
             + 10 * (Statistic If condition = And [ Source OwnerHasTech name = "SHP_INTSTEL_LOG" ])
        )
    )
    tags = [ "SP_SETINON" ]
    location = And [
        Planet
        OwnedBy empire = Source.Owner
        Population high = 0
        Not Planet environment = Uninhabitable species = "SP_SETINON"
        ResourceSupplyConnected empire = Source.Owner condition = And [
            Planet
            OwnedBy empire = Source.Owner
            Species name = "SP_SETINON"
            Population low = [[MIN_RECOLONIZING_SIZE]]
            Happiness low = 5
        ]
    ]
    enqueuelocation = And [
        Planet
        OwnedBy empire = Source.Owner
        Population high = 0
        Not Planet environment = Uninhabitable species = "SP_SETINON"
        Not Contains And [ Building name = "BLD_COL_SUPER_TEST" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SUPER_TEST"
        Not Contains And [ Building name = "BLD_COL_ABADDONI" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_ABADDONI"
        Not Contains And [ Building name = "BLD_COL_BANFORO" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_BANFORO"
        Not Contains And [ Building name = "BLD_COL_CHATO" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_CHATO"
        Not Contains And [ Building name = "BLD_COL_CRAY" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_CRAY"
        Not Contains And [ Building name = "BLD_COL_DERTHREAN" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_DERTHREAN"
        Not Contains And [ Building name = "BLD_COL_EAXAW" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_EAXAW"
        Not Contains And [ Building name = "BLD_COL_EGASSEM" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_EGASSEM"
        Not Contains And [ Building name = "BLD_COL_ETTY" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_ETTY"
        Not Contains And [ Building name = "BLD_COL_FULVER" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_FULVER"
        Not Contains And [ Building name = "BLD_COL_FURTHEST" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_FURTHEST"
        Not Contains And [ Building name = "BLD_COL_GEORGE" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_GEORGE"
        Not Contains And [ Building name = "BLD_COL_GYSACHE" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_GYSACHE"
        Not Contains And [ Building name = "BLD_COL_HAPPY" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_HAPPY"
        Not Contains And [ Building name = "BLD_COL_HHHOH" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_HHHOH"
        Not Contains And [ Building name = "BLD_COL_HUMAN" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_HUMAN"
        Not Contains And [ Building name = "BLD_COL_KILANDOW" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_KILANDOW"
        Not Contains And [ Building name = "BLD_COL_KOBUNTURA" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_KOBUNTURA"
        Not Contains And [ Building name = "BLD_COL_LAENFA" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_LAENFA"
        Not Contains And [ Building name = "BLD_COL_MISIORLA" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_MISIORLA"
        Not Contains And [ Building name = "BLD_COL_MUURSH" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_MUURSH"
        Not Contains And [ Building name = "BLD_COL_PHINNERT" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_PHINNERT"
        Not Contains And [ Building name = "BLD_COL_SCYLIOR" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SCYLIOR"
        Not Contains And [ Building name = "BLD_COL_SETINON" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SETINON"
        Not Contains And [ Building name = "BLD_COL_SILEXIAN" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SILEXIAN"
        Not Contains And [ Building name = "BLD_COL_SLY" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SLY"
        Not Contains And [ Building name = "BLD_COL_SSLITH" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_SSLITH"
        Not Contains And [ Building name = "BLD_COL_TAEGHIRUS" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_TAEGHIRUS"
        Not Contains And [ Building name = "BLD_COL_TRITH" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_TRITH"
        Not Contains And [ Building name = "BLD_COL_REPLICON" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_REPLICON"
        Not Contains And [ Building name = "BLD_COL_UGMORS" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_UGMORS"
        Not Contains And [ Building name = "BLD_COL_EXOBOT" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_EXOBOT"
        Not Contains And [ Building name = "BLD_COL_BANFORO" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_BANFORO"
        Not Contains And [ Building name = "BLD_COL_KILANDOW" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_KILANDOW"
        Not Contains And [ Building name = "BLD_COL_MISIORLA" OwnedBy empire = Source.Owner ]
        Not Enqueued type = Building name = "BLD_COL_MISIORLA"
        ResourceSupplyConnected empire = Source.Owner condition = And [
            Planet
            OwnedBy empire = Source.Owner
            Species name = "SP_SETINON"
            Population low = [[MIN_RECOLONIZING_SIZE]]
            Happiness low = 5
        ]
    ]
    effectsgroups = [
        [[LIFECYCLE_MANIP_POPULATION_EFFECTS("SP_SETINON")]]

        EffectsGroup
            scope = And [
                Object id = Source.PlanetID
                Planet
            ]
            activation = Turn low = Source.CreationTurn + 1 high = Source.CreationTurn + 1
            effects = [
                GenerateSitRepMessage
                    message = "SITREP_NEW_COLONY_ESTABLISHED"
                    label = "SITREP_NEW_COLONY_ESTABLISHED_LABEL"
                    icon = "icons/species/amorphous-02.png"
                    parameters = [
                        tag = "species" data = "SP_SETINON"
                        tag = "planet" data = Target.ID
                    ]
                    empire = Source.Owner
            ]

        EffectsGroup
            scope = Source
            activation = Turn low = Source.CreationTurn + 2
            effects = Destroy
    ]
    icon = "icons/species/amorphous-02.png"

#include "/scripting/macros/misc.macros"
#include "/scripting/macros/upkeep.macros"
#include "/scripting/macros/priorities.macros"
#include "/scripting/macros/base_prod.macros"
#include "/scripting/macros/misc.macros"
