Part
    name = "SP_CHAOS_WAVE"
    description = "SP_CHAOS_WAVE_DESC"
    class = Bombard
    capacity = 2.0
    mountableSlotTypes = External
    buildcost = 10 * [[FLEET_UPKEEP_MULTIPLICATOR]] * [[SHIP_PART_COST_MULTIPLIER]]
    buildtime = 5
    tags = [ "CTRL_ALWAYS_BOMBARD" "PEDIA_PC_BOMBARD" ]
    location = All
    effectsgroups = [
        EffectsGroup    // players can order chaos wave used on enemies
            scope = And [
                Planet
                InSystem id = Source.SystemID
                OrderedBombardedBy condition = Source
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
                VisibleToEmpire empire = Source.Owner
            ]
            priority = [[EARLY_POPULATION_PRIORITY]]
            effects = [
                SetPopulation value = Value - 2
                RemoveSpecial name = "GAIA_SPECIAL"
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    label = "EFFECT_BIOWEAPON_LABEL"
                    icon = "icons/sitrep/bio_weapon_2.png"
                    parameters = [
                        tag = "planet" data = Target.ID
                        tag = "rawtext" data = "2"
                        tag = "shippart" data = "SP_CHAOS_WAVE"
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup    // monsters use chaos wave on player planets
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
                Stealth high = Source.Detection
            ]
            activation = And [
                            Unowned
                            InSystem
                         ]
            priority = [[EARLY_POPULATION_PRIORITY]]
            effects = [
                SetPopulation value = Value - 2
                RemoveSpecial name = "GAIA_SPECIAL"
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    label = "EFFECT_BIOWEAPON_LABEL"
                    icon = "icons/sitrep/bio_weapon_2.png"
                    parameters = [
                        tag = "planet" data = Target.ID
                        tag = "rawtext" data = "2"
                        tag = "shippart" data = "SP_CHAOS_WAVE"
                    ]
                    empire = Target.Owner
            ]
    ]
    icon = "icons/ship_parts/chaos-wave.png"

#include "/scripting/common/upkeep.macros"
#include "/scripting/common/priorities.macros"
