Part
    name = "SP_DARK_RAY"
    description = "SP_DARK_RAY_DESC"
    class = Bombard
    capacity = 0.5
    mountableSlotTypes = External
    buildcost = 5 * [[FLEET_UPKEEP_MULTIPLICATOR]] * [[SHIP_PART_COST_MULTIPLIER]]
    buildtime = 3
    tags = [ "CTRL_BOMBARD_PHOTOTROPHIC" "PEDIA_PC_BOMBARD" ]
    location = All
    effectsgroups = [
        EffectsGroup    // players can order dark ray 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
                /// @content_tag{PHOTOTROPHIC} When bombarding in-system enemy with this part, reduces population on visible populated Planet with tag
                HasTag name = "PHOTOTROPHIC"
            ]
            priority = [[POPULATION_DEFAULT_PRIORITY]]
            effects = [
                SetPopulation value = Value - 0.5
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    label = "EFFECT_BIOWEAPON_LABEL"
                    icon = "icons/sitrep/bio_weapon_1.png"
                    parameters = [
                        tag = "planet" data = Target.ID
                        tag = "rawtext" data = "0.5"
                        tag = "shippart" data = "SP_DARK_RAY"
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup    // monsters use dark ray on player planets
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
                Stealth high = Source.Detection
                /// @content_tag{PHOTOTROPHIC} Each part owned by Unowned in system will reduce population on one visible populated empire Planet with tag
                HasTag name = "PHOTOTROPHIC"
            ]
            activation = And [
                Unowned
                InSystem
            ]
            priority = [[POPULATION_DEFAULT_PRIORITY]]
            effects = [
                SetPopulation value = Value - 0.5
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    label = "EFFECT_BIOWEAPON_LABEL"
                    icon = "icons/sitrep/bio_weapon_1.png"
                    parameters = [
                        tag = "planet" data = Target.ID
                        tag = "rawtext" data = "0.5"
                        tag = "shippart" data = "SP_DARK_RAY"
                    ]
                    empire = Target.Owner
            ]
    ]
    icon = "icons/ship_parts/dark-ray.png"

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