
Special
    name = "MODERATE_TECH_NATIVES_SPECIAL"
    description = "MODERATE_TECH_NATIVES_SPECIAL_DESC"
    stealth = 0
    spawnrate = 50
    spawnlimit = 9999
    location = And [
        Planet
        Unowned
        Species
        Not HasTag name = "PRIMITIVE"
        Not HasSpecial name = "HIGH_TECH_NATIVES_SPECIAL"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = Unowned
            effects = [
                SetMaxDefense value = Value + 10
                SetMaxShield value = Value + 10
                SetMaxTroops value = Value + 10
                SetDetection value = Value + 20
            ]

        EffectsGroup
            scope = Source
            activation = OwnedBy affiliation = AnyEmpire
            effects = RemoveSpecial name = "MODERATE_TECH_NATIVES_SPECIAL"
    ]
    graphic = "icons/tech/categories/learning.png"

Special
    name = "HIGH_TECH_NATIVES_SPECIAL"
    description = "HIGH_TECH_NATIVES_SPECIAL_DESC"
    stealth = 0
    spawnrate = 25
    spawnlimit = 9999
    location = And [
        Planet
        Unowned
        Species
        Not HasTag name = "PRIMITIVE"
        Not HasSpecial name = "MODERATE_TECH_NATIVES_SPECIAL"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = Unowned
            effects = [
                SetMaxDefense value = Value + 30
                SetMaxShield value = Value + 30
                SetMaxTroops value = Value + 30
                SetDetection value = Value + 60
            ]

        EffectsGroup
            scope = Source
            activation = Turn low = 1 high = 1
            effects = CreateBuilding type = "BLD_CULTURE_LIBRARY"

        EffectsGroup
            scope = Source
            activation = AND [
                Random probability = 0.2
                Turn low = 1 high = 1
            ]
            effects = CreateBuilding type = "BLD_SCANNING_FACILITY"

        EffectsGroup
            scope = Source
            activation = OwnedBy affiliation = AnyEmpire
            effects = RemoveSpecial name = "HIGH_TECH_NATIVES_SPECIAL"
    ]
    graphic = "icons/tech/categories/learning.png"

Special
    name = "ECCENTRIC_ORBIT_SPECIAL"
    description = "ECCENTRIC_ORBIT_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 9999
    location = And [
        Planet
        Not Capital
        Not Planet type = [Asteroids GasGiant]
    ]
    effectsgroups =
        EffectsGroup
            scope = Source
            activation = Source
            effects = [
                SetTargetResearch value = Value + 3
                SetTargetPopulation value = Value - 3
            ]
    graphic = "icons/specials_huge/eccentric_orbit.png"

Special
    name = "ANCIENT_RUINS_SPECIAL"
    description = "ANCIENT_RUINS_SPECIAL_DESCRIPTION"
    stealth = 0
    spawnrate = 0.7
    spawnlimit = 9999
    location = And [
        Or [
            ValueTest low = 1 testvalue = GalaxyMonsterFrequency
            Random probability = 0.2
        ]
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not ContainedBy And [
            System 
            Contains Or [
                And [ Planet HasSpecial name = "ANCIENT_RUINS_SPECIAL" ]
                Design name = "SM_EXP_OUTPOST"
            ]
        ]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/ruins.png"
            
        EffectsGroup     
            scope = Source     
            activation = AND [
                Turn high = 0
                Random probability = 0.9
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency
            ]
            effects = CreateShip designname = "SM_GUARD_2"
            
        EffectsGroup
            scope = And [
                Source
                Focus type = "FOCUS_RESEARCH"
            ]
            effects = SetTargetResearch value = Value + Target.Population * 5 * [[RESEARCH_PER_POP]]
            
        EffectsGroup
            scope = Source
            activation = And [
                Random probability = .2
                OwnerHasTech name = "LRN_XENOARCH"
            ]
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                CreateShip designname = "SD_DRAGON_TOOTH" empire = Source.Owner species = Source.Species
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_SHIP"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SD_DRAGON_TOOTH"
                    ]
                    empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_SHIP_RUMORS"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "predefinedshipdesign" data = "SD_DRAGON_TOOTH"
                    ]
            ]

        EffectsGroup
            scope = Source
            activation = And [
                Random probability = .25
                OwnerHasTech name = "LRN_XENOARCH"
            ]
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                CreateBuilding type = "BLD_NEUTRONIUM_SYNTH"
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_BUILDING"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "buildingtype" data = "BLD_NEUTRONIUM_SYNTH"
                    ]
                    empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_BUILDING_RUMORS"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "buildingtype" data = "BLD_NEUTRONIUM_SYNTH"
                    ]
            ]

        EffectsGroup
            scope = Source
            activation = And [
                Random probability = .50
                NotOwnerHasTech name = "SHP_WEAPON_4_1"
                OwnerHasTech name = "LRN_XENOARCH"
            ]
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                GiveEmpireTech name = "SHP_WEAPON_4_1" empire = Target.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "tech" data = "SHP_WEAPON_4_1"
                    ]
                    empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH_RUMORS"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "tech" data = "SHP_WEAPON_4_1"
                    ]
            ]

        EffectsGroup
            scope = Source
            activation = And [
                Not OwnerHasTech name = "SHP_MULTISPEC_SHIELD"
                OwnerHasTech name = "LRN_XENOARCH"
            ]
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                GiveEmpireTech name = "SHP_MULTISPEC_SHIELD" empire = Target.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "tech" data = "SHP_MULTISPEC_SHIELD"
                    ]
                    empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH_RUMORS"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "tech" data = "SHP_MULTISPEC_SHIELD"
                    ]
            ]

        EffectsGroup
            scope = Source
            activation = And [
                Not OwnerHasTech name = "SHP_KRILL_SPAWN"
                OwnerHasTech name = "LRN_XENOARCH"
            ]
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                GiveEmpireTech name = "SHP_KRILL_SPAWN" empire = Target.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "tech" data = "SHP_KRILL_SPAWN"
                    ]
                    empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_TECH_RUMORS"
                    icon = "icons/specials_huge/ancient_ruins_excavated.png"
                    parameters = [
                        tag = "tech" data = "SHP_KRILL_SPAWN"
                    ]
            ]

        // make a default sitrep to confirm empty excavation
        EffectsGroup
            scope = Source
            activation = OwnerHasTech name = "LRN_XENOARCH"
            stackinggroup = "ANCIENT_RUINS_TECH_UNLOCK"
            effects = [
                GenerateSitRepMessage
                    message = "EFFECT_ANCIENT_RUINS_EMPTY"
                    icon = "icons/specials_huge/ancient_ruins.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                    ]
                    empire = Source.Owner
            ]

        EffectsGroup
            scope = Source
            activation = OwnerHasTech name = "LRN_XENOARCH"
            effects = [
                AddSpecial name = "ANCIENT_RUINS_DEPLETED_SPECIAL"
                RemoveSpecial name = "ANCIENT_RUINS_SPECIAL"
            ]
    ]
    graphic = "icons/specials_huge/ancient_ruins.png"

Special
    name = "PANOPTICON_SPECIAL"
    description = "PANOPTICON_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 1
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
        Not ContainedBy Contains Design name = "SM_EXP_OUTPOST"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = OwnedBy affiliation = AnyEmpire
            effects = [
                SetDetection value = Value + 75
                SetEmpireMeter empire = Source.Owner meter = "METER_DETECTION_STRENGTH" value = Value + 10
            ]
        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/ruins.png"     
            
        EffectsGroup     
            scope = Source     
            activation = AND [
                Turn high = 0
                Random probability = 0.5
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency                
                Not WithinStarlaneJumps jumps = 1 condition = And [
                    System
                    Contains And [
                        Planet
                        OwnedBy affiliation = AnyEmpire
                    ]
                ]
            ]
            effects = CreateShip designname = "SM_GUARD_2"
        
        EffectsGroup     
            scope = Source     
            activation = And [
                Turn high = 0
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency
            ]                
            effects = CreateShip designname = "SM_GUARD_2"
        ]
        graphic = "icons/meter/detection.png"

Special
    name = "FORTRESS_SPECIAL"
    description = "FORTRESS_SPECIAL_DESC"
    stealth = 0
    spawnrate = 0.2
    spawnlimit = 3
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
        Not ContainedBy Contains Design name = "SM_EXP_OUTPOST"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = Or [
                OwnedBy affiliation = AnyEmpire
                Species
            ]
            effects = [
                SetMaxShield value = Value + 100
                SetMaxDefense value = Value + 30
                SetMaxTroops value = Value + 30
                SetDetection value = Value + 30

                //Regeneration
                SetShield value = Value + min(5.0, max(Value, 0.25*Target.Construction))
                SetDefense value = Value + 1
            ]

        // Mines Start
        EffectsGroup
            scope = And [
                Ship
                ContainedBy And [
                    System 
                    Contains And [
                        Source
                        Not OwnerHasTech name = "DEF_SYST_DEF_MINE_2"
                    ]
                ]
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
            ]
            effects = SetStructure value = Value - 3

        EffectsGroup
            scope = And [
                Fleet
                ContainedBy And [
                    System 
                    Contains And [
                        Source
                        Not OwnerHasTech name = "DEF_SYST_DEF_MINE_2"
                    ]
                ]
                OwnedBy affiliation = EnemyOf empire = Source.Owner
            ]
            effects = [
                GenerateSitRepMessage
                    message = "EFFECT_MINES"
                    icon = "icons/sitrep/combat_damage.png"
                    parameters = [
                        tag = "empire" data = Target.Owner
                        tag = "fleet" data = Target.ID
                        tag = "rawtext" data = "3"
                        tag = "system" data = Target.SystemID
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup
            scope = And [
                Ship
                ContainedBy And [
                    System 
                    Contains And [
                        Source
                        Not OwnerHasTech name = "DEF_SYST_DEF_MINE_2"
                    ]
                ]
                OwnedBy affiliation = EnemyOf empire = Source.Owner
                Structure high = 3
            ]
            effects = [
                GenerateSitRepMessage
                    message = "EFFECT_MINES_SHIP_DESTROYED"
                    icon = "icons/sitrep/combat_destroyed.png"
                    parameters = [
                        tag = "empire" data = Target.Owner
                        tag = "ship" data = Target.ID
                        tag = "system" data = Target.SystemID
                    ]
                    empire = Target.Owner
                Destroy
            ]
        // Mines End

        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
                Not ContainedBy Contains Design name = "SM_GUARD_1"
                Random probability = 0.05
            ]
            effects = [
                CreateShip designname = "SM_GUARD_1" empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_SENTRY_CREATED"
                    icon = "icons/monsters/sentry.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SM_GUARD_1"
                    ]
                    empire = Source.Owner
            ]     

        EffectsGroup     
            scope = Source     
            activation = And [
                Turn high = 0
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency
            ]                
            effects = CreateShip designname = "SM_GUARD_2"
        ]
        graphic = "icons/specials_huge/fortress.png"

Special
    name = "RESONANT_MOON_SPECIAL"
    description = "RESONANT_MOON_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 9999
    location = And [
        Planet
        Not Capital
        Not Planet type = [Asteroids GasGiant]
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Building
                ContainedBy And [
                    Object id = Source.PlanetID
                    Planet
                ]
            ]
            effects = SetStealth value = Value + 10

        EffectsGroup
            scope = And [
                Ship
                ContainedBy And [
                    Object id = Source.SystemID
                    System
                ]
                OwnedBy empire = Source.Owner
            ]
            stackinggroup = "RESONANT_MOON_STACK"
            effects = SetStealth value = Value + 10
    ]
    graphic = "icons/specials_huge/resonant_moon.png"

Special
    name = "COMPUTRONIUM_SPECIAL"
    description = "COMPUTRONIUM_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 9999
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not ContainedBy And [
            System 
            Contains Capital
        ]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Planet
                Focus type = "FOCUS_RESEARCH"
                OwnedBy empire = Source.Owner
            ]
            activation = Focus type = "FOCUS_RESEARCH"
            stackinggroup = "COMPUTRONIUM_STACK"
            effects = SetTargetResearch value = Value + Target.Population * 1 * [[RESEARCH_PER_POP]]
            
            
        [[CHANCE_OF_GUARD_1]]
        
    ]
    graphic = "icons/specials_huge/computronium.png"

Special
    name = "HONEYCOMB_SPECIAL"
    description = "HONEYCOMB_SPECIAL_DESC"
    stealth = 0
    spawnrate = 5.0
    spawnlimit = 1
    location = And [
        Planet
        Not Planet type = Asteroids
        Not WithinStarlaneJumps jumps = 5 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Planet
                Not Species
                Not HasSpecial
                WithinStarlaneJumps jumps = 2 condition = Source
                Not ContainedBy Contains OR [
                    Design name = "SM_EXP_OUTPOST"
                    Building name = "BLD_EXPERIMENTOR_OUTPOST"
                ]
            ]
            activation = Turn high = 0 
            effects = Destroy

        EffectsGroup
            scope = Source
            activation = Turn high = 0 
            effects = [
                SetPlanetSize planetsize = Huge
                SetPlanetType type = Barren
            ]

        EffectsGroup     
            scope = Source     
            activation = AND [
                Turn high = 0
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency                
                Not ContainedBy Contains OR [
                                    Design name = "SM_EXP_OUTPOST"
                                    Building name = "BLD_EXPERIMENTOR_OUTPOST"
                ]
            ]
            effects = CreateShip designname = "SM_GUARD_3"

        EffectsGroup
            scope = And [
                Planet
                Focus type = "FOCUS_INDUSTRY"
                OwnedBy empire = Source.Owner
                ResourceSupplyConnected empire = Source.Owner condition = Source
            ]
            activation = Focus type = "FOCUS_INDUSTRY"
            stackinggroup = "HONEYCOMB_STACK"
            effects = SetTargetIndustry value = Value + Target.Population * 2.5 * [[INDUSTRY_PER_POP]]
        
    ]
    graphic = "icons/specials_huge/honeycomb.png"

Special
    name = "PHILOSOPHER_SPECIAL"
    description = "PHILOSOPHER_SPECIAL_DESC"
    stealth = 0
    spawnrate = 2.0
    spawnlimit = 1
    location = And [
        Planet
        Planet size = tiny
        Not Planet type = [Asteroids GasGiant]
        Not Species
        ContainedBy And [
            System 
            Contains And [
                Planet
                Not Planet size = tiny
            ]
        ]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup     
            scope = Source     
            activation = Turn high = 0
            effects = SetPlanetType type = Radiated
        
        EffectsGroup
            scope = And [
                Planet
                // Focus type = "FOCUS_RESEARCH" // Does not require focus
                InSystem id = Source.SystemID
            ]
            activation = Unowned
            stackinggroup = "PHILOSOPHER_STACK"
            effects = SetTargetResearch value = Value + 5
  
        EffectsGroup
            scope = Source
            activation = Source
            effects = SetTargetConstruction value = Value - 20
    ]
    graphic = "icons/specials_huge/philospher-planet.png"

Special
    name = "ABANDONED_COLONY_SPECIAL"
    description = "ABANDONED_COLONY_SPECIAL_DESC"
    stealth = 0
    spawnrate = 0.4
    spawnlimit = 9999
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not ContainedBy And [
            System 
            Contains Homeworld
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
                Construction low = 10
            ] 
            stackinggroup = "ABANDONED_STACK"
            effects = RemoveSpecial name = "ABANDONED_COLONY_SPECIAL"
            
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
            stackinggroup = "ABANDONED_STACK"
            effects = SetConstruction value = Value + 10
        ]
    graphic = "icons/specials_huge/abandoned-colony.png"

Special
    name = "GAIA_SPECIAL"
    description = "GAIA_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 12
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
        Not ContainedBy Contains Design name = "SM_EXP_OUTPOST"
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                Species
                Not Planet environment = Good
                Population low = 0.01
                OwnedBy affiliation = AnyEmpire
                Not And [
                    Species name = "SP_EXOBOT"
                    Planet environment = adequate
                ]
                Random probability = 0.5
            ]
            effects = [
                SetPlanetType type = Target.NextBetterPlanetType
                GenerateSitRepMessage
                    message = "EFFECT_GAIAN_TERRAFORM"
                    icon = "icons/building/terraform.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                    ]
                    empire = Source.Owner
            ]

        // population effects in species.txt

        EffectsGroup
            scope = Source
            activation = And [
                Turn high = 0
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency
            ]
            stackinggroup = "GAIAN_STACK"
            effects = CreateShip designname = "SM_GUARD_2"

        EffectsGroup
            scope = Source
            activation = Turn high = 0
            stackinggroup = "GAIAN_STACK"
            effects = Destroy
    ]
    graphic = "icons/specials_huge/gaia.png"

Special
    name = "WORLDTREE_SPECIAL"
    description = "WORLDTREE_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 1
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not Planet size = [tiny huge]
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = Source
            effects = [
                SetDetection value = Value + 10
                SetMaxSupply value = Value + 1
                SetTargetHappiness value = Value + 5
            ]
        EffectsGroup
            scope = And [
                Planet
                Not Source
                OwnedBy affiliation = TheEmpire empire = Source.Owner
                Population low = 0.0001
            ]
            effects = SetTargetHappiness value = Value + 1
    ]
    graphic = "icons/specials_huge/worldtree.png"

Special
    name = "ANCIENT_RUINS_DEPLETED_SPECIAL"
    description = "ANCIENT_RUINS_DEPLETED_SPECIAL_DESC"
    stealth = 0
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/ruins.png"

        EffectsGroup
            scope = And [
                Source
                Focus type = "FOCUS_RESEARCH"
            ]
            effects = SetTargetResearch value = Value + Target.Population * 5 * [[RESEARCH_PER_POP]]
        ]
    graphic = "icons/specials_huge/ancient_ruins_excavated.png"
    
Special
    name = "KRAKEN_NEST_SPECIAL"
    description = "KRAKEN_NEST_SPECIAL_DESC"
    spawnrate = 0.0
    location = And [
        ValueTest low = 1 testvalue = GalaxyMonsterFrequency    
        Planet        
        Planet type = GasGiant
        Not WithinStarlaneJumps jumps = 3 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
                OwnerHasTech name = "SHP_DOMESTIC_MONSTER"
                Random probability = 0.05
            ]
            stackinggroup = "KRAKEN_NEST_STACK"
            effects = [
                CreateShip designname = "SM_KRAKEN_1" empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_TAME_MONSTER_HATCHED"
                    icon = "icons/monsters/kraken-1.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SM_KRAKEN_1"
                    ]
                    empire = Source.Owner
            ]
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                Turn low = 10
                Unowned
                Random probability = 0.12 * GalaxyMonsterFrequency / 2.0
            ]
            stackinggroup = "KRAKEN_NEST_STACK"
            effects = CreateShip designname = "SM_KRAKEN_1"
        ]
    graphic = "icons/specials_huge/kraken-nest.png"
    
Special
    name = "SNOWFLAKE_NEST_SPECIAL"
    description = "SNOWFLAKE_NEST_SPECIAL_DESC"
    spawnrate = 0.0
    location = And [
        Planet
        Planet size = Small
        Not WithinStarlaneJumps jumps = 2 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
                OwnerHasTech name = "SHP_DOMESTIC_MONSTER"
                Random probability = 0.08
            ]
            stackinggroup = "SNOWFLAKE_NEST_STACK"
            effects = [
                CreateShip designname = "SM_SNOWFLAKE_1" empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_TAME_MONSTER_HATCHED"
                    icon = "icons/monsters/snowflake-1.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SM_SNOWFLAKE_1"
                    ]
                    empire = Source.Owner
            ]
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                Turn low = 10
                Unowned
                Random probability = 0.12 * GalaxyMonsterFrequency / 2.0
            ]
            stackinggroup = "SNOWFLAKE_NEST_STACK"
            effects = CreateShip designname = "SM_SNOWFLAKE_1"
        ]
    graphic = "icons/specials_huge/snowflake-nest.png"
    
Special
    name = "JUGGERNAUT_NEST_SPECIAL"
    description = "JUGGERNAUT_NEST_SPECIAL_DESC"
    spawnrate = 0.0
    location = And [
        Planet
        ValueTest low = 1 testvalue = GalaxyMonsterFrequency        
        Planet type = Asteroids
        Not WithinStarlaneJumps jumps = 4 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                OwnedBy affiliation = AnyEmpire
                OwnerHasTech name = "SHP_DOMESTIC_MONSTER"
                Random probability = 0.06 
            ]
            stackinggroup = "JUGGERNAUT_NEST_STACK"
            effects = [
                CreateShip designname = "SM_JUGGERNAUT_1" empire = Source.Owner
                GenerateSitRepMessage
                    message = "EFFECT_TAME_MONSTER_HATCHED"
                    icon = "icons/monsters/juggernaut-1.png"
                    parameters = [
                        tag = "planet" data = Source.ID
                        tag = "predefinedshipdesign" data = "SM_JUGGERNAUT_1"
                    ]
                    empire = Source.Owner
            ]
        EffectsGroup
            scope = Source
            activation = AND [
                Planet
                Turn low = 10
                Unowned
                Random probability = 0.12 * GalaxyMonsterFrequency / 2.0
            ]
            stackinggroup = "JUGGERNAUT_NEST_STACK"
            effects = CreateShip designname = "SM_JUGGERNAUT_1"
        ]
        
    graphic = "icons/specials_huge/juggernaut-nest.png"

Special
    name = "HEAD_ON_A_SPIKE_SPECIAL"
    description = "HEAD_ON_A_SPIKE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = Source
            effects = [
                SetMaxDefense value = Value + 1
                SetMaxShield value = Value + 1
            ]

        EffectsGroup
            scope = And [
                Ship
                Not OwnedBy empire = Source.Owner
                OwnedBy affiliation = AnyEmpire
                WithinDistance distance = 100 condition = Source
            ]
        stackinggroup = "HEAD_ON_A_SPIKE_SPECIAL_EFFECT"
        effects = [
            SetMaxShield value = Value - 1
            SetMaxStructure value = Value -1 
            SetDamage partname = "SR_WEAPON_1_1" value = Value - 1
            SetDamage partname = "SR_WEAPON_1_2" value = Value - 1
            SetDamage partname = "SR_WEAPON_1_3" value = Value - 1
            SetDamage partname = "SR_WEAPON_1_4" value = Value - 1
            SetDamage partname = "SR_WEAPON_2_1" value = Value - 1
            SetDamage partname = "SR_WEAPON_2_2" value = Value - 1
            SetDamage partname = "SR_WEAPON_2_3" value = Value - 1
            SetDamage partname = "SR_WEAPON_2_4" value = Value - 1
            SetDamage partname = "SR_WEAPON_3_1" value = Value - 1
            SetDamage partname = "SR_WEAPON_3_2" value = Value - 1
            SetDamage partname = "SR_WEAPON_3_3" value = Value - 1
            SetDamage partname = "SR_WEAPON_3_4" value = Value - 1
            SetDamage partname = "SR_WEAPON_4_1" value = Value - 1
            SetDamage partname = "SR_WEAPON_4_2" value = Value - 1
            SetDamage partname = "SR_WEAPON_4_3" value = Value - 1
            SetDamage partname = "SR_WEAPON_4_4" value = Value - 1
        ]
    ]
    graphic = "icons/sitrep/empire_eliminated.png"

Special
    name = "CONC_CAMP_MASTER_SPECIAL"
    description = "CONC_CAMP_MASTER_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = And [
                Not Contains Building name = "BLD_CONC_CAMP"
                Population low = 0.0001
            ]
            effects = [                
                AddSpecial name = "CONC_CAMP_SLAVE_SPECIAL"
                RemoveSpecial name = "CONC_CAMP_MASTER_SPECIAL"
            ]
        EffectsGroup
            scope = Source
            activation = AND [ 
                Not Contains Building name = "BLD_CONC_CAMP"
                Not Contains Building name = "BLD_CONC_CAMP_REMNANT"
                Population low = 0.0001
            ]
            effects = CreateBuilding type = "BLD_CONC_CAMP_REMNANT"
        EffectsGroup
            scope = Source
            activation = And [
                Not Contains Building name = "BLD_CONC_CAMP"
                Population high = 0.0001
            ]
            effects = RemoveSpecial name = "CONC_CAMP_MASTER_SPECIAL"
    ]
    graphic = "icons/building/concentration-camp.png"

Special
    name = "CONC_CAMP_SLAVE_SPECIAL"
    description = "CONC_CAMP_SLAVE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            effects = SetPopulation value = Value + 0.5*(101+Target.TargetPopulation-2*Value - ((101+Target.TargetPopulation-2*Value)^2 -4*(Value*(Value-1-Target.TargetPopulation)-2*100))^0.5)
        EffectsGroup
            scope = Source
            activation = And [
                PopulationCenter
                Not Contains Building name = "BLD_CONC_CAMP"
                Not Contains Building name = "BLD_CONC_CAMP_REMNANT"
            ]
            effects = CreateBuilding type = "BLD_CONC_CAMP_REMNANT"
        EffectsGroup
            scope = Source
            activation = OR [
                Random probability = 0.167
                Population high = 0
            ]
            effects = RemoveSpecial name = "CONC_CAMP_SLAVE_SPECIAL"
    ]
    graphic = "icons/building/concentration-camp.png"

Special
    name = "CLOUD_COVER_MASTER_SPECIAL"
    description = "CLOUD_COVER_MASTER_SPECIAL_DESC"
    stealth = 25
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            stackinggroup = "STEALTH_SPECIAL_MASTER_STACK"
            effects = AddSpecial name = "CLOUD_COVER_SLAVE_SPECIAL"
        /*[[STEALTH_BOOST_PLUS_PLUS]]
        [[SYSTEM_STEALTH_PLUS_PLUS]]
        */
    ]
    graphic = "icons/specials_huge/cloud_cover.png"

Special
    name = "CLOUD_COVER_SLAVE_SPECIAL"
    description = "CLOUD_COVER_SLAVE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        [[STEALTH_BOOST_LOW_NO_ORBITAL]]

        EffectsGroup
            scope = Source
            activation = Not Or [
                HasSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
                OwnerHasTech name = "SPY_STEALTH_1"
            ]
            effects = RemoveSpecial name = "CLOUD_COVER_SLAVE_SPECIAL"

        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/clouds.png" 
    ]
    graphic = "icons/specials_huge/cloud_cover.png"

Special
    name = "VOLCANIC_ASH_MASTER_SPECIAL"
    description = "VOLCANIC_ASH_MASTER_SPECIAL_DESC"
    stealth = 45
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            stackinggroup = "STEALTH_SPECIAL_MASTER_STACK"
            effects = AddSpecial name = "VOLCANIC_ACTIVITY_SPECIAL"

        [[REMOVE_CLOUD_COVER]]
        /*[[STEALTH_BOOST_PLUS_PLUS]]
        [[SYSTEM_STEALTH_PLUS_PLUS]]
*/
    ]
    graphic = "icons/specials_huge/volcanic_ash.png"

Special
    name = "VOLCANIC_ACTIVITY_SPECIAL"
    description = "VOLCANIC_ACTIVITY_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups =
        EffectsGroup
            scope = Source
            activation = Not HasSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
            effects = RemoveSpecial name = "VOLCANIC_ACTIVITY_SPECIAL"
    graphic = "icons/specials_huge/volcanic_ash.png"

Special
    name = "VOLCANIC_ASH_SLAVE_SPECIAL"
    description = "VOLCANIC_ASH_SLAVE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        [[STEALTH_BOOST_MEDIUM_NO_ORBITAL]]

        EffectsGroup
            scope = Source
            activation = Not Or [
                HasSpecial name = "VOLCANIC_ACTIVITY_SPECIAL"
                OwnerHasTech name = "SPY_STEALTH_2"
            ]
            effects = RemoveSpecial name = "VOLCANIC_ASH_SLAVE_SPECIAL"

        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/ash.png" 
    ]
    graphic = "icons/specials_huge/volcanic_ash.png"

Special
    name = "DIM_RIFT_MASTER_SPECIAL"
    description = "DIM_RIFT_MASTER_SPECIAL_DESC"
    stealth = 65
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            stackinggroup = "STEALTH_SPECIAL_MASTER_STACK"
            effects = [
                AddSpecial name = "DIM_RIFT_SLAVE_SPECIAL"
                SetTargetPopulation value = Value - 4
            ]

        [[REMOVE_CLOUD_COVER]]
        [[REMOVE_ASH]]
        /*[[STEALTH_BOOST_PLUS_PLUS]]
        [[SYSTEM_STEALTH_PLUS_PLUS]]
*/
    ]
    graphic = "icons/specials_huge/dim_rift.png"

Special
    name = "DIM_RIFT_SLAVE_SPECIAL"
    description = "DIM_RIFT_SLAVE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        [[STEALTH_BOOST_HIGH_NO_ORBITAL]]

        EffectsGroup
            scope = Source
            activation = Not Or [
                HasSpecial name = "DIM_RIFT_MASTER_SPECIAL"
                OwnerHasTech name = "SPY_STEALTH_3"
            ]
            effects = RemoveSpecial name = "DIM_RIFT_SLAVE_SPECIAL"

        EffectsGroup
            scope = Source
            effects = SetTexture name = "planets/overlays/rift.png" 
    ]
    graphic = "icons/specials_huge/dim_rift.png"

Special
    name = "VOID_MASTER_SPECIAL"
    description = "VOID_MASTER_SPECIAL_DESC"
    stealth = 85
    spawnrate = 0.0
    effectsgroups = [
        EffectsGroup
            scope = Source
            stackinggroup = "STEALTH_SPECIAL_MASTER_STACK"
            effects = AddSpecial name = "VOID_SLAVE_SPECIAL"

        [[REMOVE_CLOUD_COVER]]
        [[REMOVE_ASH]]
        [[REMOVE_DIM]]
        /*[[STEALTH_BOOST_PLUS_PLUS]]
        [[SYSTEM_STEALTH_PLUS_PLUS]]
*/
    ]
    graphic = "icons/specials_huge/void.png"

Special
    name = "VOID_SLAVE_SPECIAL"
    description = "VOID_SLAVE_SPECIAL_DESC"
    spawnrate = 0.0
    effectsgroups = [
        [[STEALTH_BOOST_ULTIMATE_NO_ORBITAL]]

        EffectsGroup
            scope = Source
            activation = And [
                Not HasSpecial name = "VOID_MASTER_SPECIAL"
                Not OwnerHasTech name = "SPY_STEALTH_4"
            ]
            effects = RemoveSpecial name = "VOID_SLAVE_SPECIAL"
    ]
    graphic = "icons/specials_huge/void.png"

Special
    name = "DERELICT_SPECIAL2"               //  MAP / DETECTION
    description = "DERELICT_SPECIAL_DESC"
    stealth = 45
    spawnrate = 0.5
    spawnlimit = 100
    location = And [
        System
        Not Contains Capital
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Source
                Ship
            ]
            effects = [
                SetDetection value = Value + 60
                RemoveSpecial name = "DERELICT_SPECIAL2"
            ]

        EffectsGroup
            scope = And [
                Source
                Ship
            ]
            activation = And [
                Ship
                Number low = 1 condition = And [
                    Object id = Source.SystemID
                    HasSpecial name = "DERELICT_SPECIAL2"
                ]
            ]
            effects = [
                AddSpecial name = "DERELICT_SPECIAL2" // renew the special (that was just removed above) if have moved into system that has (had) the special
            ]

        EffectsGroup
            scope = NumberOf number = 1 condition = And [
                Ship
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
            ]
            activation = And [
                System
                Contains And [
                    Ship
                    OwnedBy affiliation = AnyEmpire
                ]
            ]
            effects = [
                AddSpecial name = "DERELICT_SPECIAL2"
                GenerateSitRepMessage
                    message = "EFFECT_DERELICT_MAP"
                    parameters = [
                        tag = "system" data = Source.ID
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup
            scope = And [
                Source
                System
            ]
            activation = And [
                System
                Contains And [
                    Ship
                    OwnedBy affiliation = AnyEmpire
                ]
            ]
            effects = [
                RemoveSpecial name = "DERELICT_SPECIAL2"
            ]
    ]
    graphic = "icons/specials_huge/derelict.png"

Special
    name = "DERELICT_SPECIAL3"               //  FUEL
    description = "DERELICT_SPECIAL_DESC"
    stealth = 45
    spawnrate = 0.5
    spawnlimit = 100
    location = And [
        System
        Not Contains Capital
    ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Ship
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
            ]
            activation = And [
                System
                Contains And [
                    Ship
                    OwnedBy affiliation = AnyEmpire
                ]
            ]
            effects = [
                AddSpecial name = "DERELICT_SPECIAL3"
                GenerateSitRepMessage
                    message = "EFFECT_DERELICT_FUEL"
                    icon = "icons/meter/fuel.png"
                    parameters = [
                        tag = "system" data = Source.ID
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup
            scope = And [
                Source
                System
            ]
            activation = And [
                System
                Contains And [
                    Ship
                    OwnedBy affiliation = AnyEmpire
                ]
            ]
            effects = [
                RemoveSpecial name = "DERELICT_SPECIAL3"
            ]

        EffectsGroup
            scope = And [
                Source
                Ship
            ]
            effects = [
                SetFuel value = Value + 100
                RemoveSpecial name = "DERELICT_SPECIAL3"
            ]
    ]
    graphic = "icons/specials_huge/derelict.png"

Special
    name = "SUPERNOVA_SPECIAL"
    description = "SUPERNOVA_SPECIAL_DESC"
    spawnrate = 0
    spawnlimit = 0
    effectsgroups =
        EffectsGroup
            scope = Source
            effects = [
                SetOverlayTexture name = "stars/nova-boom1.png" size = 120
                SetStealth value = Value - 1000     // should be visible from afar...
                RemoveSpecial name = "NOVA_BOMB_ACTIVATOR_SPECIAL"
                RemoveSpecial name = "SUPERNOVA_SPECIAL"
                AddSpecial name = "SUPERNOVA_SPECIAL2"
            ]
    graphic = "icons/specials_huge/nova_boom.png"

Special
    name = "SUPERNOVA_SPECIAL2"
    description = "SUPERNOVA_SPECIAL_DESC"
    spawnrate = 0
    spawnlimit = 0
    effectsgroups =
        EffectsGroup
            scope = Source
            effects = [
                SetOverlayTexture name = "stars/nova-boom2.png" size = 120
                SetStealth value = Value - 1000     // should be visible from afar...
                RemoveSpecial name = "SUPERNOVA_SPECIAL2"
                AddSpecial name = "SUPERNOVA_SPECIAL3"
            ]
    graphic = "icons/specials_huge/nova_boom.png"

Special
    name = "SUPERNOVA_SPECIAL3"
    description = "SUPERNOVA_SPECIAL_DESC"
    spawnrate = 0
    spawnlimit = 0
    effectsgroups =
        EffectsGroup
            scope = Source
            effects = [
                SetOverlayTexture name = "stars/nova-boom3.png" size = 120
                SetStealth value = Value - 1000     // should be visible from afar...
                RemoveSpecial name = "SUPERNOVA_SPECIAL3"
                AddSpecial name = "SUPERNOVA_SPECIAL4"
            ]
    graphic = "icons/specials_huge/nova_boom.png"

Special
    name = "SUPERNOVA_SPECIAL4"
    description = "SUPERNOVA_SPECIAL_DESC"
    spawnrate = 0
    spawnlimit = 0
    effectsgroups =
        EffectsGroup
            scope = Source
            effects = [
                SetOverlayTexture name = "stars/nova-boom4.png" size = 120
                SetStealth value = Value - 1000     // should be visible from afar...
                RemoveSpecial name = "SUPERNOVA_SPECIAL4"
            ]
    graphic = "icons/specials_huge/nova_boom.png"
    
Special
    name = "NOVA_BOMB_ACTIVATOR_SPECIAL"
    description = "NOVA_BOMB_ACTIVATOR_SPECIAL_DESC"
    spawnrate = 0
    spawnlimit = 0
    graphic = "icons/specials_huge/nova_boom.png"

Special
    name = "PROBIOTIC_SPECIAL"
    description = "PROBIOTIC_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Ocean Swamp Toxic]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [       
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ORGANIC"
                //TargetPopulation low = 0
                ResourceSupplyConnected empire = Source.Owner condition = Source
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "PROBIOTIC_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ORGANIC"
            ]
            stackinggroup = "PROBIOTIC_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]

    ]
    graphic = "icons/specials_huge/probiotic.png"
    
Special
    name = "FRUIT_SPECIAL"
    description = "FRUIT_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Desert Terran Ocean Swamp]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [       
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ORGANIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "FRUIT_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ORGANIC"
            ]
            stackinggroup = "FRUIT_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]
    ]
    graphic = "icons/specials_huge/fruit.png"

Special
    name = "SPICE_SPECIAL"
    description = "SPICE_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Tundra Desert Terran]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [       
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ORGANIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "SPICE_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ORGANIC"
            ]
            stackinggroup = "SPICE_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]
    ]
    graphic = "icons/specials_huge/spice.png"

Special
    name = "MONOPOLE_SPECIAL"
    description = "MONOPOLE_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Radiated Barren Inferno]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]
        
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ROBOTIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "MONOPOLE_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ROBOTIC"
            ]
            stackinggroup = "MONOPOLE_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]
    ]
    graphic = "icons/specials_huge/monopole.png"

Special
    name = "SUPERCONDUCTOR_SPECIAL"
    description = "SUPERCONDUCTOR_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Radiated Barren Inferno]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]
        
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ROBOTIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "SUPERCONDUCTOR_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ROBOTIC"
            ]
            stackinggroup = "SUPERCONDUCTOR_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]

    ]
    graphic = "icons/specials_huge/superconductor.png"

Special
    name = "POSITRONIUM_SPECIAL"
    description = "POSITRONIUM_SPECIAL_DESC"
    stealth = 0
    spawnrate = 9.0
    spawnlimit = 8
    location = And [
        Planet
        Planet type = [Radiated Barren Inferno]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]
        
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "ROBOTIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "POSITRONIUM_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ROBOTIC"
            ]
            stackinggroup = "POSITRONIUM_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]

    ]
    graphic = "icons/specials_huge/positronium.png"

Special
    name = "MINERALS_SPECIAL"
    description = "MINERALS_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 8
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]

        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "LITHIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "MINERALS_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "LITHIC"
            ]
            stackinggroup = "MINERALS_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]
    ]
    graphic = "icons/specials_huge/minerals.png"

Special
    name = "CRYSTALS_SPECIAL"
    description = "CRYSTALS_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 8
    location = And [
        Planet
        Not Planet type = [GasGiant]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]

        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "LITHIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "CRYSTALS_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "LITHIC"
            ]
            stackinggroup = "CRYSTALS_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]

    ]
    graphic = "icons/specials_huge/crystals.png"

Special
    name = "ELERIUM_SPECIAL"
    description = "ELERIUM_SPECIAL_DESC"
    stealth = 0
    spawnrate = 1.0
    spawnlimit = 8
    location = And [
        Planet
        Not Planet type = [Asteroids GasGiant]
        Not WithinStarlaneJumps jumps = 1 condition = And [
            System
            Contains And [
                Planet
                OwnedBy affiliation = AnyEmpire
            ]
        ]
    ]
    effectsgroups = [
        [[STANDARD_INDUSTRY_BOOST]]

        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                HasTag name = "LITHIC"
                ResourceSupplyConnected empire = Source.Owner condition = Source
                //TargetPopulation low = 0
            ]
            activation =  Focus type = "FOCUS_GROWTH"
            stackinggroup = "ELERIUM_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble
            
        EffectsGroup
            scope = And [
                Source
                HasTag name = "LITHIC"
            ]
            stackinggroup = "ELERIUM_STACK"
            effects = SetTargetPopulation value = Value + 1 * Target.SizeAsDouble  // Provides the bonus locally, no matter the focus
            
           [[CHANCE_OF_GUARD_1]]

    ]
    graphic = "icons/specials_huge/metaloids.png"


//##########################################################
//###                     M A C R O S                    ###
//##########################################################


STANDARD_MINERAL_BOOST
'''EffectsGroup
            scope = Source
            activation = Focus type = "FOCUS_MINING"
            effects = SetTargetIndustry value = Value + 25
'''

STANDARD_INDUSTRY_BOOST
'''EffectsGroup
            scope = Source
            activation = Focus type = "FOCUS_INDUSTRY"
            effects = SetTargetIndustry value = Value + Target.Population * 1.0 * [[INDUSTRY_PER_POP]]

'''

REMOVE_CLOUD_COVER
'''EffectsGroup
        scope = Source
        activation = Source
        effects = RemoveSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
'''

REMOVE_ASH
'''EffectsGroup
        scope = Source
        activation = Source
        effects = RemoveSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
'''

REMOVE_DIM
'''EffectsGroup
        scope = Source
        activation = Source
        effects = RemoveSpecial name = "DIM_RIFT_MASTER_SPECIAL"
'''

REMOVE_VOID
'''EffectsGroup
        scope = Source
        activation = Source
        effects = RemoveSpecial name = "VOID_MASTER_SPECIAL"
'''

CHANCE_OF_GUARD_1
'''        EffectsGroup     
            scope = Source     
            activation = AND [
                Turn high = 0
                Random probability = 0.60
                ValueTest low = 1 testvalue = GalaxyMaxAIAggression
                ValueTest low = 1 testvalue = GalaxyMonsterFrequency                
                Not ContainedBy Contains OR [
                                    Design name = "SM_EXP_OUTPOST"
                                    Building name = "BLD_EXPERIMENTOR_OUTPOST"
                                    And [ Planet HasSpecial name = "HIGH_TECH_NATIVES_SPECIAL" ]
                                    ]
            ]
            effects = CreateShip designname = OneOf("SM_GUARD_0", "SM_GUARD_1")
'''

// keep this entry at bottom, to best preserve line numbering for debugging
#include "shared_macros.txt"
