BuildingType
    name = "BLD_NEST_ERADICATOR"
    description = "BLD_NEST_ERADICATOR_DESC"
    buildcost = 80
    buildtime = 5
    location = And [
        Planet
        OwnedBy empire = Source.Owner
        Not Contains Building name = "BLD_NEST_ERADICATOR"
        Or [
            HasSpecial name = "JUGGERNAUT_NEST_SPECIAL"
            HasSpecial name = "KRAKEN_NEST_SPECIAL"
            HasSpecial name = "SNOWFLAKE_NEST_SPECIAL"
        ]
    ]
    enqueuelocation = Not Enqueued type = Building name = "BLD_NEST_ERADICATOR"
    effectsgroups = [
        [[EG_NEST_REMOVAL(JUGGERNAUT)]]
        [[EG_NEST_REMOVAL(KRAKEN)]]
        [[EG_NEST_REMOVAL(SNOWFLAKE)]]

        EffectsGroup
            scope = Source
            effects = Destroy
    ]
    icon = "icons/building/nest_eradicator.png"

// @1@ Monster name
EG_NEST_REMOVAL
'''EffectsGroup
            scope = And [
                Object id = Source.PlanetID
                Planet
                HasSpecial name = "@1@_NEST_SPECIAL"
            ]

            // Remove the special at very late priority so meter changes based on it
            // (e.g. stability likes/dislikes) are allowed to happen beforehand.
            // This is to consistent with meter prediction in UI (which does not take special removal into account)
            // NB: only works as intended if we do not do a second full effect application round for setting meters of newly created objects)
            //     else the special will be already removed when the second application happens and the meter effects wont happen
            priority = [[SPECIAL_REMOVAL_PRIORITY]]
            effects = [
                RemoveSpecial name = "@1@_NEST_SPECIAL"
                GenerateSitRepMessage
                    message = "EFFECT_NEST_REMOVAL"
                    label = "EFFECT_NEST_REMOVAL_LABEL"
                    icon = "icons/building/nest_eradicator.png"
                    parameters = tag = "planet" data = Target.ID
                    empire = Source.Owner
            ]
'''

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