Tech
    name = "DEF_ROOT_DEFENSE"
    description = "DEF_ROOT_DEFENSE_DESC"
    short_description = "TROOPS_SHORT_DESC"
    category = "DEFENSE_CATEGORY"
    researchcost = 1
    researchturns = 1
    tags = [ "PEDIA_DEFENSE_CATEGORY" ]
    effectsgroups = [
        EffectsGroup
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
            ]
            stackinggroup = "PLANET_SHIELDS_STACK_ROOT"
            priority = [[DEFAULT_PRIORITY]]
            effects = SetMaxShield value = Value + 1 accountinglabel = "DEF_ROOT_DEFENSE"
        
        EffectsGroup    // regenerate 1 per turn
            scope = And [
                Planet
                OwnedBy empire = Source.Owner
                (LocalCandidate.LastTurnAttackedByShip   < CurrentTurn)
            ]
            priority = [[AFTER_ALL_TARGET_MAX_METERS_PRIORITY]]
            effects = [
                SetShield value = min(Value + 1, Value(Target.MaxShield))
                SetDefense value = min(Value + 1, Value(Target.MaxDefense))
                SetTroops value = min(Value + 1, Value(Target.MaxTroops))
            ]
    ]
    graphic = ""

Tech
    name = "DEF_PLANET_CLOAK"
    description = "DEF_PLANET_CLOAK_DESC"
    short_description = "BUILDING_UNLOCK_SHORT_DESC"
    category = "DEFENSE_CATEGORY"
    researchcost = 9999 * [[TECH_COST_MULTIPLIER]]
    researchturns = 9999
    Unresearchable
    tags = [ "PEDIA_DEFENSE_CATEGORY" ]
    prerequisites = "SPY_STEALTH_3"
    unlock = Item type = Building name = "BLD_PLANET_CLOAK"

Tech
    name = "DEF_SYST_DEF_MINE_1"
    description = "DEF_SYST_DEF_MINE_1_DESC"
    short_description = "DEFENSE_SHORT_DESC"
    category = "DEFENSE_CATEGORY"
    researchcost = 120 * [[TECH_COST_MULTIPLIER]]
    researchturns = 4
    tags = [ "PEDIA_DEFENSE_CATEGORY" ]
    prerequisites = "DEF_DEFENSE_NET_1"
    effectsgroups = [
        [[EG_SYSTEM_MINES(2,75,EMPIRE)]] 
    ] //Priority deliberately not a macro and before all priority macros
    graphic = "icons/tech/system_defense_mines.png"

Tech
    name = "DEF_SYST_DEF_MINE_2"
    description = "DEF_SYST_DEF_MINE_2_DESC"
    short_description = "DEFENSE_SHORT_DESC"
    category = "DEFENSE_CATEGORY"
    researchcost = 240 * [[TECH_COST_MULTIPLIER]]
    researchturns = 6
    tags = [ "PEDIA_DEFENSE_CATEGORY" ]
    prerequisites = "DEF_SYST_DEF_MINE_1"
    effectsgroups = [
        [[EG_SYSTEM_MINES(6,65,EMPIRE)]]
    ]
    graphic = "icons/tech/system_defense_mines.png"

Tech
    name = "DEF_SYST_DEF_MINE_3"
    description = "DEF_SYST_DEF_MINE_3_DESC"
    short_description = "DEFENSE_SHORT_DESC"
    category = "DEFENSE_CATEGORY"
    researchcost = 500 * [[TECH_COST_MULTIPLIER]]
    researchturns = 8
    tags = [ "PEDIA_DEFENSE_CATEGORY" ]
    prerequisites = "DEF_SYST_DEF_MINE_2"
    effectsgroups = [
        [[EG_SYSTEM_MINES(14,60,EMPIRE)]]
    ]
    graphic = "icons/tech/system_defense_mines.png"

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