#默认规定建筑只能建造一个

#船坞专精
shipyard_enhance = {
	icon = GFX_shipyard_enhance
	construction_days = 720
    category = sm_es_specialization_cat

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}
		upkeep = {
			energy = 20
		}
	}

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_shipyard_enhance
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = requires_shipyard
			or = {
				has_starbase_module = shipyard
				starbase_buildable_is_in_queue_before = {
					first = shipyard
					second = shipyard_enhance
				}
				has_starbase_module = beastport
				starbase_buildable_is_in_queue_before = {
					first = beastport
					second = shipyard_enhance
				}
			}
		}
		custom_tooltip = {
			fail_text = not_other_enchanted
			NOR = {
				has_starbase_building = anchorage_enhance
				has_starbase_building = war_enhance
				has_starbase_building = hangar_enhance
				has_starbase_building = sturdy_enhance
			}
		}
	}

	station_modifier = {
		starbase_shipyard_build_speed_mult = 1.5
		starbase_shipyard_build_cost_mult = -0.20
	}

	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 100 
		modifier = {
			factor = 100
			owner = {
				OR = {
					count_owned_starbase = {
						count = 0
						limit = { has_starbase_module = shipyard }
					}
					AND = {
						num_starbases >= 4
						count_owned_starbase = {
							count < 2
							limit = { has_starbase_module = shipyard }
						}
					}
					AND = {
						num_starbases >= 9
						count_owned_starbase = {
							count < 3
							limit = { has_starbase_module = shipyard }
						}
					}
					AND = {
						num_starbases >= 15
						count_owned_starbase = {
							count < 4
							limit = { has_starbase_module = shipyard }
						}
					}
				}
			}
		}
		modifier = {
			factor = 3
			has_starbase_module = shipyard
			count_starbase_modules = {
				count < 2
				type = shipyard
			}
		}
		modifier = {
			factor = 3
			has_starbase_module = shipyard
			count_starbase_modules = {
				count < 4
				type = shipyard
			}
		}
	}

	#在科技界面显示解锁部件
	show_in_tech = "tech_shipyard_enhance"
}

#锚地专精
anchorage_enhance = {
	icon =GFX_anchorage_enhance
	construction_days = 720
    category = sm_es_specialization_cat

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 400
		}
		upkeep = {
			energy = 10
		}
	}

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_anchorage_enhance
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_naval_logistics_offic"
			OR = {
				has_starbase_building = naval_logistics_office
				# 建造时舰队后勤办公室在锚地增强前即可建造
				starbase_buildable_is_in_queue_before = {
					first = naval_logistics_office
					second = anchorage_enhance
				}
			}
		}
		custom_tooltip = {
			fail_text = "not_other_enchanted"
			NOR = {
				has_starbase_building = shipyard_enhance
				has_starbase_building = war_enhance
				has_starbase_building = hangar_enhance
				has_starbase_building = sturdy_enhance
			}
		}
	}

	custom_tooltip = sm_anchorage_enhance_desc_modifier

	ai_build_at_chokepoint = no
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 100 
	}

	#在科技界面显示解锁部件
	show_in_tech = "tech_anchorage_enhance"
}

#炮台专精
war_enhance = {
	icon = GFX_war_enhance
	construction_days = 720
    category = sm_es_specialization_cat

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
		}
		upkeep = {
			energy = 20
		}
	}
	station_modifier = {
		ship_fire_rate_mult = 0.5
		ship_weapon_damage= 0.5
	}

	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_starbase_6
		}
	}

	possible = {
		custom_tooltip = {
			fail_text = not_other_enchanted
			NOR = {
				has_starbase_building = shipyard_enhance
				has_starbase_building = anchorage_enhance
				has_starbase_building = hangar_enhance
				has_starbase_building = sturdy_enhance
			}
		}
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}

		}
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}
			}
		}
	}

	#在科技界面显示解锁部件
	#show_in_tech = "tech_war_enhance"
}

#飞机专精
hangar_enhance = {
	icon = GFX_hangar_enhance
	construction_days = 720
    category = sm_es_specialization_cat

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
		}
		upkeep = {
			energy = 20
		}
	}
	station_modifier = {
		weapon_type_strike_craft_weapon_damage_mult = 1.0
		weapon_type_strike_craft_weapon_fire_rate_mult = 1.0
	}
	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_starbase_6
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = not_other_enchanted
			NOR = {
				has_starbase_building = shipyard_enhance
				has_starbase_building = anchorage_enhance
				has_starbase_building = war_enhance
				has_starbase_building = sturdy_enhance
			}
		}
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}
			}
		}
	}

	#在科技界面显示解锁部件
	#show_in_tech = "tech_war_enhance"
}

#防御专精
sturdy_enhance = {
	icon = GFX_sturdy_enhance
	construction_days = 720
    category = sm_es_specialization_cat

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
		}
		upkeep = {
			energy = 20
		}
	}
	station_modifier = {
		ship_armor_mult = 1.0
		ship_hull_mult = 1.0
		ship_shield_mult = 1.0
	}

	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_starbase_6
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = not_other_enchanted
			NOR = {
				has_starbase_building = shipyard_enhance
				has_starbase_building = anchorage_enhance
				has_starbase_building = war_enhance
				has_starbase_building = hangar_enhance
			}
		}
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
		modifier = {
			factor = 2
			exists = owner
			owner = {
				OR = {
					is_preferred_weapons = weapon_type_energy
					is_preferred_weapons = weapon_type_kinetic
				}
			}
		}
	}

	#在科技界面显示解锁部件
	# show_in_tech = "tech_war_enhance"
}


#########################################################################################################


#维护中心 维护费-50%
maintenance_center = {
	icon = GFX_maintenance_center
	construction_days = 720
    category = sm_naval_support_cat

	potential = {
		owner? = {
			has_technology = tech_maintenance_center
		}
        is_orbital_ring = no
        is_space_citadel_ship_size = no
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 20
		}
	}

	orbit_modifier = {
		ship_orbit_upkeep_mult = -0.5
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = yes
	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
	}

	show_in_tech = "tech_maintenance_center"
}

#相位雷达 攻击范围+300% 追踪+5
phase_radar = {
	icon = GFX_phase_radar
	construction_days = 720
    category = sm_defense_cat

	potential = {
		owner? = {
			has_technology = tech_phase_radar
		}
        is_orbital_ring = no
        is_space_citadel_ship_size = no
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 2000
		}

		upkeep = {
			energy = 20
		}
	}

	station_modifier = {
		ship_weapon_range_mult = 3.00
		ship_tracking_add = 5
	}

	defense_platform_modifier = {
		ship_weapon_range_mult = 3.00
		ship_tracking_add = 5
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
	}

	show_in_tech = "tech_phase_radar"
}

#防御平台+20
defense_enhance = {
    icon = GFX_defense_enhance
    construction_days = 720
    category = sm_defense_cat

    potential = {
        owner? = { has_technology = tech_defense_enhance }
        is_orbital_ring = no
        is_space_citadel_ship_size = no
    }

    possible = {
        custom_tooltip = {
            fail_text = "requires_starbase_level_1"
            OR = {
                has_starbase_size >= starbase_citadel
                is_space_citadel_ship_size = yes
            }
        }
    }

    resources = {
        category = starbase_buildings
        cost = {
            alloys = 500
        }

        upkeep = {
            energy = 20
        }
    }

    station_modifier = {
        starbase_defense_platform_capacity_add = 20
    }

    defense_platform_modifier = {
        ships_upkeep_mult = 0.5
    }

    show_in_tech = "tech_defense_enhance"

    ai_build_at_chokepoint = yes
    ai_build_outside_chokepoint = no
    ai_weight = {
        weight = 100 #use same weight here - ai weighting is done in starbase_types.txt
    }
}

#等离子冷链技术 星基和防御平台 攻速+50
plasma_coldchain  = {
	icon = GFX_plasma_coldchain
	construction_days = 720
    category = sm_defense_cat

	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_plasma_coldchain
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 20
		}
	}

	station_modifier = {
		ship_fire_rate_mult = 0.5
	}
	defense_platform_modifier = {
		ship_fire_rate_mult = 0.5
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_plasma_coldchain"
}

#工程部 
engineering_department  = {
	icon = GFX_engineering_department
	construction_days = 720
    category = sm_defense_cat

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_engineering_department
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
		}

		upkeep = {
			energy = 20
		}
	}

	station_modifier = {
		starbase_defensive_war_ship_build_speed_mult = 1.00
		starbase_building_build_speed_mult = 1.00
		starbase_module_build_speed_mult = 1.00
		starbase_upgrade_speed_mult = 1.00
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_engineering_department"
}

#修理部门 每日+3%
living_metal_department  = {
	icon = GFX_living_metal_department
	construction_days = 900
    category = sm_defense_cat

	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_mine_living_metal
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 2500
			sr_living_metal = 1000
		}

		upkeep = {
			sr_living_metal = 3
		}
	}

	station_modifier = {
		ship_hull_regen_add_perc = 3
		ship_armor_regen_add_perc = 3
		ship_shield_regen_add_perc = 3
	}

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_mine_living_metal"
}


##########
## 光环建筑
##########

#粒子紊乱装置 星系护盾-100%
particle_chaos = {
    icon = GFX_particle_chaos
    construction_days = 720
    category = sm_aura_cat

    potential = {
        owner? = {
            has_technology = tech_particle_chaos
        }
        is_orbital_ring = no
        is_space_citadel_ship_size = no
    }
    possible = {
        custom_tooltip = {
            fail_text = "requires_starbase_level_1"
            has_starbase_size >= starbase_citadel
        }
    }

    resources = {
        category = starbase_buildings
        cost = {
            alloys = 500
        }

        upkeep = {
            energy = 20
        }
    }

    equipped_component = "STARBASE_PARTICLE_CHAOS"

    ai_build_at_chokepoint = yes
    ai_build_outside_chokepoint = no
    ai_weight = {
        weight = 100
    }

    show_in_tech = "tech_particle_chaos"
}

#指挥中心强化 射速+20 伤害+20
command_center_enhance = {
	icon = GFX_command_center_1
	construction_days = 720
    category = sm_aura_cat

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_command_matrix_1
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 10
		}
	}

	equipped_component = "STARBASE_AURA_COMMAND_CENTER_1"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100
	}

	show_in_tech = "tech_command_matrix_1"
}

#干扰场发生器增强  护盾-50
disruption_field_enhance = {
	icon = GFX_disruption_field_enhance
	construction_days = 720
    category = sm_aura_cat

	potential = {
		owner? = {
			has_technology = tech_disruption_field_enhance
		}
        is_orbital_ring = no
        is_space_citadel_ship_size = no
	}

	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}

	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 20
		}
	}

	equipped_component = "STARBASE_AURA_DISRUPTION_FIELD_1"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_disruption_field_enhance"
}

#引力边界 战斗撤离几率-90
gravity_edge = {
	icon = GFX_gravity_edge
	construction_days = 720
    category = sm_aura_cat

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_gravity_edge
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 10
		}
	}

	equipped_component = "STARBASE_GRAVITY_EDGE"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_gravity_edge"
}

#星云波动仪 亚光速-40 闪避70 追踪-10
nebula_fluctuator = {
	icon = GFX_nebula_fluctuator
	construction_days = 720
    category = sm_aura_cat

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_nebula_fluctuator
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 1000
		}

		upkeep = {
			energy = 10
		}
	}

	equipped_component = "STARBASE_NEBULA_FLUCTUATOR"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_nebula_fluctuator"
}

#引力灯塔 闪避+30 战斗撤离几率+50
gravity_beacon = {
	icon = GFX_gravity_beacon
	construction_days = 720
    category = sm_aura_cat

	potential = {
		is_orbital_ring = no
		is_space_citadel_ship_size = no
		exists = owner
		owner = {
			has_technology = tech_gravity_beacon
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			has_starbase_size >= starbase_citadel
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 500
		}

		upkeep = {
			energy = 10
		}
	}

	equipped_component = "STARBASE_GRAVITY_BEACON"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_gravity_beacon"
}

#亚空间供能 护盾+50
subspace_energy = {
	icon = GFX_subspace_energy
	construction_days = 720
    category = sm_aura_cat

	potential = {
		is_orbital_ring = no
		exists = owner
		owner = {
			has_technology = tech_subspace_energy
		}
	}
	possible = {
		custom_tooltip = {
			fail_text = "requires_starbase_level_1"
			OR = {
				has_starbase_size >= starbase_citadel
				is_space_citadel_ship_size = yes
			}
		}
	}
	resources = {
		category = starbase_buildings
		cost = {
			alloys = 2000
			sr_zro = 500
		}

		upkeep = {
			sr_zro = 5
			energy = 15
		}
	}

	equipped_component = "STARBASE_SUBSPACE_ENERGY"

	ai_build_at_chokepoint = yes
	ai_build_outside_chokepoint = no
	ai_weight = {
		weight = 100 
	}

	show_in_tech = "tech_subspace_energy"
}