
Part
    name = "GT_TROOP_POD"
    description = "GT_TROOP_POD_DESC"
    class = Troops
    capacity = 2
    mountableSlotTypes = [External Internal]
    buildcost = 3 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    tags = "COMFORTABLE"
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/troops.png"

Part
    name = "GT_TROOP_POD_2"
    description = "GT_TROOP_POD_2_DESC"
    class = Troops
    capacity = 4
    mountableSlotTypes = [External Internal]
    buildcost = 6 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/meter/rebels.png"

Part
    name = "SR_WEAPON_1_1"
    description = "SR_WEAPON_1_1_DESC"
    class = ShortRange
    damage = 3
    mountableSlotTypes = External
    buildcost = 20 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/mass-driver-1.png"
    
Part
    name = "SR_WEAPON_1_2"
    description = "SR_WEAPON_1_2_DESC"
    class = ShortRange
    damage = 4
    mountableSlotTypes = External
    buildcost = 20 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/mass-driver-2.png"

Part
    name = "SR_WEAPON_1_3"
    description = "SR_WEAPON_1_3_DESC"
    class = ShortRange
    damage = 5
    mountableSlotTypes = External
    buildcost = 20 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/mass-driver-3.png"
    
Part
    name = "SR_WEAPON_1_4"
    description = "SR_WEAPON_1_4_DESC"
    class = ShortRange
    damage = 6
    mountableSlotTypes = External
    buildcost = 20 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/mass-driver-4.png"
    
Part
    name = "SR_WEAPON_2_1"
    description = "SR_WEAPON_2_1_DESC"
    class = ShortRange
    damage = 5
    mountableSlotTypes = External
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/laser-1.png"

Part
    name = "SR_WEAPON_2_2"
    description = "SR_WEAPON_2_2_DESC"
    class = ShortRange
    damage = 7
    mountableSlotTypes = External
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/laser-2.png"

Part
    name = "SR_WEAPON_2_3"
    description = "SR_WEAPON_2_3_DESC"
    class = ShortRange
    damage = 9
    mountableSlotTypes = External
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/laser-3.png"

Part
    name = "SR_WEAPON_2_4"
    description = "SR_WEAPON_2_4_DESC"
    class = ShortRange
    damage = 11
    mountableSlotTypes = External
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/laser-4.png"
    
Part
    name = "SR_WEAPON_3_1"
    description = "SR_WEAPON_3_1_DESC"
    class = ShortRange
    damage = 9
    mountableSlotTypes = External
    buildcost = 40 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/plasma-1.png"
    
Part
    name = "SR_WEAPON_3_2"
    description = "SR_WEAPON_3_2_DESC"
    class = ShortRange
    damage = 12
    mountableSlotTypes = External
    buildcost = 40 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/plasma-2.png"
    
Part
    name = "SR_WEAPON_3_3"
    description = "SR_WEAPON_3_3_DESC"
    class = ShortRange
    damage = 15
    mountableSlotTypes = External
    buildcost = 40 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/plasma-3.png" 

Part
    name = "SR_WEAPON_3_4"
    description = "SR_WEAPON_3_4_DESC"
    class = ShortRange
    damage = 18
    mountableSlotTypes = External
    buildcost = 40 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/plasma-4.png"

Part
    name = "SR_WEAPON_4_1"
    description = "SR_WEAPON_4_1_DESC"
    class = ShortRange
    damage = 15
    mountableSlotTypes = External
    buildcost = 60 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/death-ray-1.png"    

Part
    name = "SR_WEAPON_4_2"
    description = "SR_WEAPON_4_2_DESC"
    class = ShortRange
    damage = 20
    mountableSlotTypes = External
    buildcost = 60 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/death-ray-2.png"

Part
    name = "SR_WEAPON_4_3"
    description = "SR_WEAPON_4_3_DESC"
    class = ShortRange
    damage = 25
    mountableSlotTypes = External
    buildcost = 60 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/death-ray-3.png"

Part
    name = "SR_WEAPON_4_4"
    description = "SR_WEAPON_4_4_DESC"
    class = ShortRange
    damage = 30
    mountableSlotTypes = External
    buildcost = 60 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/death-ray-4.png"

Part
    name = "AR_STD_PLATE"
    description = "AR_STD_PLATE_DESC"
    class = Armour
    capacity = 6
    mountableSlotTypes = External
    buildcost = 4 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/std_armor_plating.png"

Part
    name = "AR_ZORTRIUM_PLATE"
    description = "AR_ZORTRIUM_PLATE_DESC"
    class = Armour
    capacity = 11
    mountableSlotTypes = External
    buildcost = 6 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/zortrium_plating.png"

Part
    name = "AR_DIAMOND_PLATE"
    description = "AR_DIAMOND_PLATE_DESC"
    class = Armour
    capacity = 18
    mountableSlotTypes = External
    buildcost = 8 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/diamond_plating.png"

Part
    name = "AR_XENTRONIUM_PLATE"
    description = "AR_XENTRONIUM_PLATE_DESC"
    class = Armour
    capacity = 30
    mountableSlotTypes = External
    buildcost = 12 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/xentronium_plating.png"

Part
    name = "AR_ROCK_PLATE"
    description = "AR_ROCK_PLATE_DESC"
    class = Armour
    capacity = 18
    mountableSlotTypes = External
    buildcost = 6 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = And [
        Number low = 1 high = 999 condition = And [
            Building name = "BLD_SHIPYARD_AST_REF"
            Or [
                OwnedBy empire = Source.Owner
                OwnedBy affiliation = AllyOf empire = Source.Owner
            ]
        ]
        OwnedBy empire = Source.Owner
    ]
    icon = "icons/ship_parts/rock_plating.png"

Part
    name = "AR_CRYSTAL_PLATE"
    description = "AR_CRYSTAL_PLATE_DESC"
    class = Armour
    capacity = 30
    mountableSlotTypes = External
    buildcost = 8 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = And [
        Number low = 1 high = 999 condition = And [
            Building name = "BLD_SHIPYARD_AST_REF"
            Or [
                OwnedBy empire = Source.Owner
                OwnedBy affiliation = AllyOf empire = Source.Owner
            ]
        ]
        OwnedBy empire = Source.Owner
    ]
    icon = "icons/ship_parts/crystal_plating.png"

Part
    name = "AR_NEUTRONIUM_PLATE"
    description = "AR_NEUTRONIUM_PLATE_DESC"
    class = Armour
    capacity = 40
    mountableSlotTypes = External
    buildcost = 15 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = And [
        OwnedBy empire = Source.Owner
        Contains Building name = "BLD_NEUTRONIUM_FORGE"
        Number low = 1 high = 999 condition = And [
            OwnedBy empire = Source.Owner
            Or [
                Building name = "BLD_NEUTRONIUM_EXTRACTOR"
                Building name = "BLD_NEUTRONIUM_SYNTH"
            ]
        ]
    ]
    icon = "icons/ship_parts/neutronium_plating.png"
    
Part
    name = "AR_PRECURSOR_PLATE"
    description = "AR_PRECURSOR_PLATE_DESC"
    class = Armour
    capacity = 400
    mountableSlotTypes = External
    buildcost = 1 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = Not All  // to keep this from making all other armor look redundant in DesignWnd; ok since not player-buildable currently
    icon = ""

Part
    name = "SH_DEFENSE_GRID"
    description = "SH_DEFENSE_GRID_DESC"
    class = Shield
    capacity = 3
    mountableSlotTypes = Internal
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[SHIELD_STACKING]]    //Make sure to add new shields to SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
    icon = "icons/ship_parts/defense_grid.png"

Part
    name = "SH_DEFLECTOR"
    description = "SH_DEFLECTOR_DESC"
    class = Shield
    capacity = 5
    mountableSlotTypes = Internal
    buildcost = 50 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[SHIELD_STACKING]]    //Make sure to add new shields to SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
    icon = "icons/ship_parts/deflector_shield.png"

Part
    name = "SH_PLASMA"
    description = "SH_PLASMA_DESC"
    class = Shield
    capacity = 9
    mountableSlotTypes = Internal
    buildcost = 90 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[SHIELD_STACKING]]    //Make sure to add new shields to SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
    icon = "icons/ship_parts/plasma_shield.png"

Part
    name = "SH_BLACK"
    description = "SH_BLACK_DESC"
    class = Shield
    capacity = 15
    mountableSlotTypes = Internal
    buildcost = 150 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 6
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[SHIELD_STACKING]]    //Make sure to add new shields to SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
    icon = "icons/ship_parts/blackshield.png"

Part
    name = "SH_MULTISPEC"
    description = "SH_MULTISPEC_DESC"
    class = Shield
    capacity = 10
    mountableSlotTypes = Internal
    buildcost = 100 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 8
    location = OwnedBy empire = Source.Owner
    effectsgroups = [
        [[SHIELD_STACKING]]     //Make sure to add new shields to SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
        EffectsGroup
            scope = Source
            activation = Star type = [Red Orange Yellow White Blue]
            stackinggroup = "STEALTH_SOLAR_STACK"
            effects = SetStealth value = Value + 60
    ]
    icon = "icons/ship_parts/multi-spectral.png"

Part
    name = "DT_DETECTOR_4"
    description = "DT_DETECTOR_4_DESC"
    class = Detection
    capacity = 200
    mountableSlotTypes = External
    buildcost = 6 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[DETECTOR_STACKING]]   //Make sure to add new detectors to SUM_DETECTOR_CAPACITY and BEST_DETECTOR_EFFECT
    icon = "icons/ship_parts/detector-4.png"

Part
    name = "DT_DETECTOR_3"
    description = "DT_DETECTOR_3_DESC"
    class = Detection
    capacity = 150
    mountableSlotTypes = External
    buildcost = 5 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[DETECTOR_STACKING]]   //Make sure to add new detectors to SUM_DETECTOR_CAPACITY and BEST_DETECTOR_EFFECT
    icon = "icons/ship_parts/detector-3.png"

Part
    name = "DT_DETECTOR_2"
    description = "DT_DETECTOR_2_DESC"
    class = Detection
    capacity = 75
    mountableSlotTypes = External
    buildcost = 3 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[DETECTOR_STACKING]]   //Make sure to add new detectors to SUM_DETECTOR_CAPACITY and BEST_DETECTOR_EFFECT
    icon = "icons/ship_parts/detector-2.png"

Part
    name = "DT_DETECTOR_1"
    description = "DT_DETECTOR_1_DESC"
    class = Detection
    capacity = 25
    mountableSlotTypes = External
    buildcost = 2 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 2
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[DETECTOR_STACKING]]   //Make sure to add new detectors to SUM_DETECTOR_CAPACITY and BEST_DETECTOR_EFFECT
    icon = "icons/ship_parts/detector-1.png"

Part
    name = "FU_IMPROVED_ENGINE_COUPLINGS"
    description = "FU_IMPROVED_ENGINE_COUPLINGS_DESC"
    class = Speed
    capacity = 10
    mountableSlotTypes = Internal
    buildcost = 10 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/engine-1.png"
    
    
Part
    name = "FU_N_DIMENSIONAL_ENGINE_MATRIX"
    description = "FU_N_DIMENSIONAL_ENGINE_MATRIX_DESC"
    class = Speed
    capacity = 20
    mountableSlotTypes = Internal
    buildcost = 20 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/engine-2.png"
    
Part
    name = "FU_SINGULARITY_ENGINE_CORE"
    description = "FU_SINGULARITY_ENGINE_CORE_DESC"
    class = Speed
    capacity = 30
    mountableSlotTypes = Core
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/engine-3.png"
    
Part
    name = "FU_TRANSPATIAL_DRIVE"
    description = "FU_TRANSPATIAL_DRIVE_DESC"
    class = Speed
    capacity = 40
    mountableSlotTypes = Core
    buildcost = 80 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 8
    location = And [
        OwnedBy empire = Source.Owner
        Contains Building name = "BLD_SHIPYARD_CON_ADV_ENGINE"
        ]
    effectsgroups = [
        EffectsGroup
            scope = Source
            activation = ValueTest Low = 1 High = 40 TestValue = [[BEST_CLOAK_EFFECT]]
            stackinggroup = "ENGINE_STEALTH_PART_STACK1"
            accountinglabel = "TRANSPATIAL_CLOAK_INTERACTION"
            effects = SetStealth value = Value - [[BEST_CLOAK_EFFECT]]
        EffectsGroup
            scope = Source
            activation = ValueTest Low = [[BEST_CLOAK_EFFECT]] TestValue = 40
            stackinggroup = "ENGINE_STEALTH_PART_STACK2"
            effects = SetStealth value = Value + 40
    ]
    icon = "icons/ship_parts/engine-4.png"
    
Part
    name = "FU_BASIC_TANK"
    description = "FU_BASIC_TANK_DESC"
    class = Fuel
    capacity = 1
    mountableSlotTypes = Internal
    buildcost = 1 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/basic-tank.png"

Part
    name = "FU_DEUTERIUM_TANK"
    description = "FU_DEUTERIUM_TANK_DESC"
    class = Fuel
    capacity = 2
    mountableSlotTypes = Internal
    buildcost = 2 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/deuterium_tank.png"

Part
    name = "FU_ANTIMATTER_TANK"
    description = "FU_ANTIMATTER_TANK_DESC"
    class = Fuel
    capacity = 5
    mountableSlotTypes = Internal
    buildcost = 3 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 6
    location = OwnedBy empire = Source.Owner
    icon = "icons/ship_parts/antimatter_tank.png"

Part
    name = "FU_RAMSCOOP"
    description = "FU_RAMSCOOP_DESC"
    class = Fuel
    capacity = 0
    mountableSlotTypes = External
    buildcost = 10 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 6
    location = OwnedBy empire = Source.Owner
    effectsgroups =
        EffectsGroup
            scope = Source
            activation = Stationary
            stackinggroup = "RAMSCOOP_STACK"
            effects = SetFuel value = Value + 0.1
    icon = "icons/ship_parts/antimatter_tank.png"

Part
    name = "FU_ZERO_FUEL"
    description = "FU_ZERO_FUEL_DESC"
    class = Fuel
    capacity = 0
    mountableSlotTypes = Core
    buildcost = 40 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    effectsgroups =
        EffectsGroup
            scope = Source
            activation = Source
            effects = SetFuel value = Target.MaxFuel
    icon = "icons/tech/zero_point_energy.png"

Part
    name = "ST_CLOAK_4"
    description = "ST_CLOAK_4_DESC"
    class = Stealth
    capacity = 80
    mountableSlotTypes = Internal
    buildcost = 30 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 10
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[CLOAK_STACKING]]   //Make sure to add new cloaks to SUM_CLOAK_CAPACITY and BEST_CLOAK_EFFECT
    icon = "icons/ship_parts/cloak-4.png"

Part
    name = "ST_CLOAK_3"
    description = "ST_CLOAK_3_DESC"
    class = Stealth
    capacity = 60
    mountableSlotTypes = Internal
    buildcost = 15 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 7
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[CLOAK_STACKING]]   //Make sure to add new cloaks to SUM_CLOAK_CAPACITY and BEST_CLOAK_EFFECT
    icon = "icons/ship_parts/cloak-3.png"

Part
    name = "ST_CLOAK_2"
    description = "ST_CLOAK_2_DESC"
    class = Stealth
    capacity = 40
    mountableSlotTypes = Internal
    buildcost = 5 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 5
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[CLOAK_STACKING]]   //Make sure to add new cloaks to SUM_CLOAK_CAPACITY and BEST_CLOAK_EFFECT
    icon = "icons/ship_parts/cloak-2.png"

Part
    name = "ST_CLOAK_1"
    description = "ST_CLOAK_1_DESC"
    class = Stealth
    capacity = 20
    mountableSlotTypes = Internal
    buildcost = 2 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    effectsgroups = [[CLOAK_STACKING]]   //Make sure to add new cloaks to SUM_CLOAK_CAPACITY and BEST_CLOAK_EFFECT
    icon = "icons/ship_parts/cloak-1.png"

Part
    name = "CO_COLONY_POD"
    description = "CO_COLONY_POD_DESC"
    class = Colony
    capacity = 1
    mountableSlotTypes = Internal
    buildcost = 120 * [[COLONY_UPKEEP_MULTIPLICATOR]]
    buildtime = 8
    location = And [
        OwnedBy empire = Source.Owner
        Population low = [[MIN_RECOLONIZING_SIZE]] high = 999
    ]
    icon = "icons/ship_parts/colony_pod.png"

Part
    name = "CO_SUSPEND_ANIM_POD"
    description = "CO_SUSPEND_ANIM_POD_DESC"
    class = Colony
    capacity = [[MIN_RECOLONIZING_SIZE]]
    mountableSlotTypes = Internal
    buildcost = 120 * [[COLONY_UPKEEP_MULTIPLICATOR]]
    buildtime = 10
    location = And [
        OwnedBy empire = Source.Owner
        Population low = [[MIN_RECOLONIZING_SIZE]] high = 999
    ]
    icon = "icons/ship_parts/cryonic_colony_pod.png"

Part
    name = "CO_OUTPOST_POD"
    description = "CO_OUTPOST_POD_DESC"
    class = Colony
    capacity = 0
    mountableSlotTypes = Internal
    buildcost = 50 * [[COLONY_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = OwnedBy empire = Source.Owner
    icon = "icons/tech/habitation_domes.png"
    
Part
    name = "SP_DISTORTION_MODULATOR"
    description = "SP_DISTORTION_MODULATOR_DESC"
    class = General
    mountableSlotTypes = Internal
    buildcost = 15 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 10
    location = OwnedBy empire = Source.Owner
    effectsgroups =
        EffectsGroup
            scope = WithinDistance distance = 0 condition = Source
            activation = Source
            stackinggroup = "SP_DISTORTION_MODULATOR_STACK"
            effects = SetStealth value = Value - 20
    icon = "icons/ship_parts/distortion_modulator.png"

Part
    name = "SP_CLOUD"
    description = "SP_CLOUD"
    class = General
    mountableSlotTypes = Internal
    buildcost = 1
    buildtime = 1
    location = All
    effectsgroups = [
        EffectsGroup
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
                Not Planet type = [Asteroids GasGiant Barren Desert]
            ]
            activation = And [
                Random probability = 0.15
                InSystem
            ]
            effects = AddSpecial name = "CLOUD_COVER_MASTER_SPECIAL"

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_2"
            effects = [
                CreateShip designname = "SM_ASH" empire = Source.Owner
                Destroy
            ]

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_3"
            effects = [
                CreateShip designname = "SM_DIM" empire = Source.Owner
                Destroy
            ]

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_4"
            effects = [
                CreateShip designname = "SM_VOID" empire = Source.Owner
                Destroy
            ]
    ]
    icon = ""

Part
    name = "SP_ASH"
    description = "SP_ASH"
    class = General
    mountableSlotTypes = Internal
    buildcost = 1
    buildtime = 1
    location = All
    effectsgroups = [
        EffectsGroup
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
            ]
            activation = And [
                Random probability = 0.15
                InSystem
            ]
            effects = AddSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_3"
            effects = [
                CreateShip designname = "SM_DIM" empire = Source.Owner
                Destroy
            ]

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_4"
            effects = [
                CreateShip designname = "SM_VOID" empire = Source.Owner
                Destroy
            ]

        EffectsGroup
            scope = HasSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
                AddSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
            ]
    ]
    icon = ""

Part
    name = "SP_DIM"
    description = "SP_DIM"
    class = General
    mountableSlotTypes = Internal
    buildcost = 1
    buildtime = 1
    location = All
    effectsgroups = [
        EffectsGroup
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
            ]
            activation = And [
                Random probability = 0.15
                InSystem
            ]
            effects = AddSpecial name = "DIM_RIFT_MASTER_SPECIAL"

        EffectsGroup
            scope = Source
            activation = Number low = 1 condition = OwnerHasTech name = "SPY_STEALTH_4"
            effects = [
                CreateShip designname = "SM_VOID" empire = Source.Owner
                Destroy
            ]

        EffectsGroup
            scope = HasSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
                AddSpecial name = "DIM_RIFT_MASTER_SPECIAL"
            ]

        EffectsGroup
            scope = HasSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
                AddSpecial name = "DIM_RIFT_MASTER_SPECIAL"
            ]
    ]
    icon = ""

Part
    name = "SP_VOID"
    description = "SP_VOID"
    class = General
    mountableSlotTypes = Internal
    buildcost = 1
    buildtime = 1
    location = All
    effectsgroups = [
        EffectsGroup
            scope = NumberOf number = 1 condition = And [
                Planet
                InSystem id = Source.SystemID
            ]
            activation = And [
                Random probability = 0.15
                InSystem
            ]
            effects = AddSpecial name = "VOID_MASTER_SPECIAL"

        EffectsGroup
            scope = HasSpecial name = "DIM_RIFT_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "DIM_RIFT_MASTER_SPECIAL"
                AddSpecial name = "VOID_MASTER_SPECIAL"
            ]

        EffectsGroup
            scope = HasSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "VOLCANIC_ASH_MASTER_SPECIAL"
                AddSpecial name = "VOID_MASTER_SPECIAL"
            ]

        EffectsGroup
            scope = HasSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
            activation = Source
            effects = [
                RemoveSpecial name = "CLOUD_COVER_MASTER_SPECIAL"
                AddSpecial name = "VOID_MASTER_SPECIAL"
            ]
    ]
    icon = ""

Part
    name = "SP_DEATH_SPORE"
    description = "SP_DEATH_SPORE_DESC"
    class = Bombard
    mountableSlotTypes = External
    buildcost = 5 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = All
    effectsgroups = [
        EffectsGroup    // players can order death spores used on enemies
            scope = And [
                Planet
                Species
                InSystem id = Source.SystemID
                OrderedBombardedBy condition = Source
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
                VisibleToEmpire empire = Source.Owner
            ]
            effects = [
                SetPopulation value = Value - 0.5
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    parameters = [
                        tag = "system" data = Source.System.ID
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup    // monsters use death spores on player planets
            scope = And [
                Planet
                Species
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
                Stealth high = Source.Detection
            ]
            activation = And [
                Unowned
                InSystem
            ]
            effects = [
                SetPopulation value = Value - 0.5
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    parameters = [
                        tag = "system" data = Source.System.ID
                    ]
                    empire = Target.Owner
            ]
    ]
    icon = "icons/ship_parts/death-spore.png"

Part
    name = "SP_BIOTERM"
    description = "SP_BIOTERM_DESC"
    class = Bombard
    mountableSlotTypes = External
    buildcost = 5 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 3
    location = All
    effectsgroups = [
        EffectsGroup    // players can order terminators used on enemies
            scope = And [
                Planet
                Species
                InSystem id = Source.SystemID
                OrderedBombardedBy condition = Source
                Or [
                    OwnedBy affiliation = EnemyOf empire = Source.Owner
                    Unowned
                ]
                VisibleToEmpire empire = Source.Owner
            ]
            effects = [
                SetPopulation value = Value - 1
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    parameters = [
                        tag = "system" data = Source.System.ID
                    ]
                    empire = Target.Owner
            ]

        EffectsGroup    // monsters use terminators on player planets
            scope = And [
                Planet
                Species
                InSystem id = Source.SystemID
                OwnedBy affiliation = AnyEmpire
                Stealth high = Source.Detection
            ]
            activation = And [
                Unowned
                InSystem
            ]
            effects = [
                SetPopulation value = Value - 1
                GenerateSitRepMessage
                    message = "EFFECT_BIOWEAPON"
                    parameters = [
                        tag = "system" data = Source.System.ID
                    ]
                    empire = Target.Owner
            ]
    ]
    icon = "icons/ship_parts/bioterm.png"

Part
    name = "SP_NOVA_BOMB"
    description = "SP_NOVA_BOMB_DESC"
    class = General
    mountableSlotTypes = External
    buildcost = 5000 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 12
    location = All
    effectsgroups = [
        EffectsGroup
            scope = And [
                Object id = Source.SystemID
                System
            ]
            activation = Number low = 1 condition = And [
                Building name = "BLD_NOVA_BOMB_ACTIVATOR"
                OwnedBy empire = Source.Owner
                WithinStarlaneJumps jumps = 1 condition = Source
            ]
            effects = [
                SetStarType type = NoStar
                AddSpecial name = "SUPERNOVA_SPECIAL"
            ]

        EffectsGroup
            scope = ContainedBy And [
                Object id = Source.SystemID
                System
            ]
            activation = Or [
                Number low = 1 condition = And [
                    Building name = "BLD_NOVA_BOMB_ACTIVATOR"
                    OwnedBy empire = Source.Owner
                    WithinStarlaneJumps jumps = 1 condition = Source
                ]
                ContainedBy And [
                    System 
                    Contains HasSpecial name = "NOVA_BOMB_ACTIVATOR_SPECIAL"
                ]
            ]
            effects = Destroy
    ]
    icon = "icons/ship_parts/nova-bomb.png"

Part
    name = "SP_KRILL_SPAWNER"
    description = "SP_KRILL_SPAWNER_DESC"
    class = General
    mountableSlotTypes = Internal
    buildcost = 100 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 9
    location = All
    effectsgroups = [
        EffectsGroup
            scope = And [
                Planet
                Planet type = Asteroids
                InSystem id = Source.SystemID
                Unowned
            ]
            activation = And [
                InSystem
                Not ContainedBy And [
                    Object id = Source.SystemID
                    System
                    Contains And [
                        Ship
                        InSystem id = Source.SystemID
                        Or [
                            DesignHasHull name = "SH_KRILL_1_BODY"
                            DesignHasHull name = "SH_KRILL_2_BODY"
                            DesignHasHull name = "SH_KRILL_3_BODY"
                            DesignHasHull name = "SH_KRILL_4_BODY"
                        ]
                    ]
                ]
            ]
            stackinggroup = "SP_KRILL_SPAWN_STACK"
            effects = CreateShip designname = "SM_KRILL_1"
        
        EffectsGroup
            scope = Source
            activation = And [
                            Not DesignHasPartClass Low=1 High=999 Class=Stealth
                            Not Armed
                        ]
            effects = SetStealth value = Value + 40
    ]
            
    icon = ""

/*
Part
    name = "RS_AUTOLAB"
    description = "RS_AUTOLAB_DESC"
    class = Research
    capacity = 80
    mountableSlotTypes = Internal
    buildcost = 1 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    Unproducible
    location = OwnedBy empire = Source.Owner
    icon = "icons/tech/categories/learning.png"

Part
    name = "RS_AUTOFACTORY"
    description = "RS_AUTOFACTORY_DESC"
    class = Industry
    capacity = 80
    mountableSlotTypes = Internal
    buildcost = 1 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    Unproducible
    location = OwnedBy empire = Source.Owner
    icon = "icons/tech/categories/production.png"

Part
    name = "RS_AUTOTRADER"
    description = "RS_AUTOTRADER_DESC"
    class = Trade
    capacity = 80
    mountableSlotTypes = Internal
    buildcost = 1 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 1
    Unproducible
    location = OwnedBy empire = Source.Owner
    icon = "icons/tech/categories/economics.png"
*/

Part
    name = "SH_ROBOTIC_INTERFACE_SHIELDS"
    description = "SH_ROBOTIC_INTERFACE_SHIELDS_DESC"
    class = Shield
    capacity = 0
    mountableSlotTypes = [Internal]
    buildcost = 70 * [[FLEET_UPKEEP_MULTIPLICATOR]]
    buildtime = 4
    location = And [
        OwnedBy empire = Source.Owner
        HasTag name = "ROBOTIC"
    ]
    effectsgroups =
        EffectsGroup
            scope = And [
                Source
                HasTag name = "ROBOTIC"
                Or [
                    DesignHasHull name = "SH_ROBOTIC"
                    DesignHasHull name = "SH_SELF_GRAVITATING"
                    DesignHasHull name = "SH_NANOROBOTIC"
                    DesignHasHull name = "SH_LOGISTICS_FACILITATOR"
                    DesignHasHull name = "SH_TITANIC"
                ]
            ]
            activation = ValueTest Low = [[BEST_SHIELD_EFFECT]] TestValue= [[ROBOTIC_SHIELD_EFFECT]]
            stackinggroup = "ROBOTIC_SHIELD_PART_STACK"
            accountinglabel = "ROBOTIC_INTERFACE_EFFECT"
            effects = SetMaxShield value = Value - [[BEST_SHIELD_EFFECT]] + [[ROBOTIC_SHIELD_EFFECT]]
    icon = "icons/ship_parts/robotic-interface-shields.png"


COUNT_OF_LOCAL_ROBOTIC_INTERFACE_SHIELDS
'''
Count condition = And [
                Ship
                OwnedBy empire = Source.Owner
                VisibleToEmpire empire = Source.Owner
                HasTag name = "ROBOTIC"
                Not Source
                DesignHasPart low = 1 high = 999 name = "SH_ROBOTIC_INTERFACE_SHIELDS"
                Or [
                    DesignHasHull name = "SH_ROBOTIC"
                    DesignHasHull name = "SH_SELF_GRAVITATING"
                    DesignHasHull name = "SH_NANOROBOTIC"
                    DesignHasHull name = "SH_LOGISTICS_FACILITATOR"
                    DesignHasHull name = "SH_TITANIC"
                ]
                WithinStarlaneJumps jumps = 0 condition = Source
            ]
'''


BEST_DETECTOR_EFFECT
'''
max(max(max(
    min(1, PartsInShipDesign Name = "DT_DETECTOR_1" design = Source.DesignID)
    * PartCapacity name = "DT_DETECTOR_1",
    min(1, PartsInShipDesign Name = "DT_DETECTOR_2" design = Source.DesignID)
    * PartCapacity name = "DT_DETECTOR_2"),
    min(1, PartsInShipDesign Name = "DT_DETECTOR_3" design = Source.DesignID)
    * PartCapacity name = "DT_DETECTOR_3"),
    min(1, PartsInShipDesign Name = "DT_DETECTOR_4" design = Source.DesignID)
    * PartCapacity name = "DT_DETECTOR_4")
'''


SUM_DETECTOR_CAPACITY
'''
((PartCapacity name = "DT_DETECTOR_1")* (PartsInShipDesign Name = "DT_DETECTOR_1" design = Source.DesignID)
+(PartCapacity name = "DT_DETECTOR_2")* (PartsInShipDesign Name = "DT_DETECTOR_2" design = Source.DesignID)
+(PartCapacity name = "DT_DETECTOR_3")* (PartsInShipDesign Name = "DT_DETECTOR_3" design = Source.DesignID)
+(PartCapacity name = "DT_DETECTOR_4")* (PartsInShipDesign Name = "DT_DETECTOR_4" design = Source.DesignID))
'''


DETECTOR_STACKING
'''
EffectsGroup    // Make sure to add new detector parts to the macros SUM_DETECTOR_CAPACITY and BEST_DETECTOR_EFFECT
    scope = Source
    activation = DesignHasPartClass Low=2 High=999 Class=Detection
    stackinggroup = "DETECTOR_PART_STACK"
    accountinglabel = "DETECTOR_INTERFERENCE"
    effects = SetDetection value = Value - [[SUM_DETECTOR_CAPACITY]] + [[BEST_DETECTOR_EFFECT]]
'''

BEST_CLOAK_EFFECT
'''
max(max(max(
    min(1, PartsInShipDesign Name = "ST_CLOAK_1" design = Source.DesignID)
    * PartCapacity name = "ST_CLOAK_1",
    min(1, PartsInShipDesign Name = "ST_CLOAK_2" design = Source.DesignID)
    * PartCapacity name = "ST_CLOAK_2"),
    min(1, PartsInShipDesign Name = "ST_CLOAK_3" design = Source.DesignID)
    * PartCapacity name = "ST_CLOAK_3"),
    min(1, PartsInShipDesign Name = "ST_CLOAK_4" design = Source.DesignID)
    * PartCapacity name = "ST_CLOAK_4")
'''


SUM_CLOAK_CAPACITY
'''
((PartCapacity name = "ST_CLOAK_1")* (PartsInShipDesign Name = "ST_CLOAK_1" design = Source.DesignID)
+(PartCapacity name = "ST_CLOAK_2")* (PartsInShipDesign Name = "ST_CLOAK_2" design = Source.DesignID)
+(PartCapacity name = "ST_CLOAK_3")* (PartsInShipDesign Name = "ST_CLOAK_3" design = Source.DesignID)
+(PartCapacity name = "ST_CLOAK_4")* (PartsInShipDesign Name = "ST_CLOAK_4" design = Source.DesignID))
'''


CLOAK_STACKING
'''
EffectsGroup    // Make sure to add new cloak parts to the macros SUM_CLOAK_CAPACITY and BEST_CLOAK_EFFECT
    scope = Source
    activation = DesignHasPartClass Low=2 High=999 Class=Stealth
    stackinggroup = "STEALTH_PART_STACK"
    accountinglabel = "CLOAK_INTERFERENCE"
    effects = SetStealth value = Value - [[SUM_CLOAK_CAPACITY]] + [[BEST_CLOAK_EFFECT]]
'''


BEST_SHIELD_EFFECT
'''
max(max(max(max(
    min(1, PartsInShipDesign Name = "SH_DEFENSE_GRID" design = Source.DesignID)
    * PartCapacity name = "SH_DEFENSE_GRID",
    min(1, PartsInShipDesign Name = "SH_DEFLECTOR" design = Source.DesignID)
    * PartCapacity name = "SH_DEFLECTOR"),
    min(1, PartsInShipDesign Name = "SH_PLASMA" design = Source.DesignID)
    * PartCapacity name = "SH_PLASMA"),
    min(1, PartsInShipDesign Name = "SH_BLACK" design = Source.DesignID)
    * PartCapacity name = "SH_BLACK"),
    min(1, PartsInShipDesign Name = "SH_MULTISPEC" design = Source.DesignID)
    * PartCapacity name = "SH_MULTISPEC" 
    )
'''


SUM_SHIELD_CAPACITY
'''
((PartCapacity name = "SH_DEFENSE_GRID")* (PartsInShipDesign Name = "SH_DEFENSE_GRID" design = Source.DesignID)
+(PartCapacity name = "SH_DEFLECTOR")* (PartsInShipDesign Name = "SH_DEFLECTOR" design = Source.DesignID)
+(PartCapacity name = "SH_PLASMA")* (PartsInShipDesign Name = "SH_PLASMA" design = Source.DesignID)
+(PartCapacity name = "SH_BLACK")* (PartsInShipDesign Name = "SH_BLACK" design = Source.DesignID)
+(PartCapacity name = "SH_MULTISPEC")* (PartsInShipDesign Name = "SH_MULTISPEC" design = Source.DesignID))
'''


SHIELD_STACKING
'''
EffectsGroup    // Make sure to add new shield parts to the macros SUM_SHIELD_CAPACITY and BEST_SHIELD_EFFECT
    scope = Source
    activation = DesignHasPartClass Low=2 High=999 Class=Shield
    stackinggroup = "SHIELD_PART_STACK"
    accountinglabel = "SHIELD_INTERFERENCE"
    effects = SetMaxShield value = Value - [[SUM_SHIELD_CAPACITY]] + [[BEST_SHIELD_EFFECT]]
'''


ROBOTIC_SHIELD_EFFECT
'''
min(min(
        [[COUNT_OF_LOCAL_ROBOTIC_INTERFACE_SHIELDS]],            
        (([[COUNT_OF_LOCAL_ROBOTIC_INTERFACE_SHIELDS]] * 7 ) ^ 0.5 )),
        20)
'''

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