# Do not remove or rename this

# Possible Variables for Buildings:
# strategic_resource: strategic resource, deprecated, strategic resource used by the building.
# allow: trigger to check for allowing construction of building.
# prerequisites: Tech requirements for building.
# empire_unique: boolean, can only build one if set to true.
# cost: resource table, cost of building.
# is_orbital: boolean, can only be built in orbital station.
# modifier: modifier, deprecated, applies a modifier to planet.
# base_buildtime: int, number of days for construction.
# requires_pop, boolean, building will require a pop for production.
# required_resources, resource table, required resources for production.
# produced_resources, resource table, produced resources in production.
# upgrades, buildings list, buildings this building can upgrade into.
# is_listed, boolean, toggles if this building is shown in the non-upgrade buildable list.
# planet_unique, toggles if one can build multiple of this type on a single planet.
# ai_weight, weight for AI, default is set to one, weight set to 0 means that AI will never build it

#
# BALANCE
# can change the time and cost of all common buildings with these variables below

@b0time = 120
@b0cost = 30
@b0effect = 1
@b0upkeep = 1

@b1time = 210
@b1cost = 60
@b1effect = 2
@b1upkeep = 1

@b2time = 180
@b2cost = 90
@b2effect = 3
@b2upkeep = 1.5

@b3time = 180
@b3cost = 120
@b3effect = 4
@b3upkeep = 2

@b4time = 180
@b4cost = 150
@b4effect = 5
@b4upkeep = 2.5

@b5time = 180
@b5cost = 180
@b5effect = 8
@b5upkeep = 3

@feupkeep = 4
@feproduction = 12

@science1 = 1
@science2 = 2
@science3 = 3
@science4 = 4
@science5 = 6

#
#	ENERGY
#

building_basic_power_plant = {
	base_buildtime = @b0time
	
	cost = {
		minerals = @b0cost
	}
	
	produced_resources = {
		energy = 5
	}
	
	upgrades = {
		building_power_plant_1
	}
	
	potential = {
		custom_tooltip = {
			text = "requires_shelter"
			planet = {
					has_building = "building_colony_shelter"
			}
		}
	}
}

building_power_plant_1 = {
	base_buildtime = @b1time
	
	cost = {
		minerals = @b1cost
	}
	
	produced_resources = {
		energy = 7
	}
	
	upgrades = {
		building_power_plant_2
	}
	
	prerequisites = {
		"tech_power_plant_1"
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
}

building_power_plant_2 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 10
	}
	
	upgrades = {
		building_power_plant_3
	}

	prerequisites = {
		"tech_power_plant_2"
	}		
}


betharian_power_plant_1 = {
	base_buildtime = @b1time
	icon = "building_betharian_power_plant_1"
	
	cost = {
		minerals = @b1cost
	}
	
	produced_resources = {
		energy = 8
	}
	
	required_resources = {
		sr_betharian = 1
	}
	
	upgrades = {
		betharian_power_plant_2
	}
	
	prerequisites = {
		"tech_mine_betharian"
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
}

betharian_power_plant_2 = {
	base_buildtime = @b2time
	is_listed = no
	icon = "building_betharian_power_plant_1"
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 12
	}
	
	required_resources = {
		sr_betharian = 1
	}
	
	upgrades = {
		betharian_power_plant_3
	}

	prerequisites = {
			"tech_power_plant_1"
	}
}

betharian_power_plant_3 = {
	base_buildtime = @b3time
	is_listed = no
	icon = "building_betharian_power_plant_1"
	
	cost = {
		minerals = @b3cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 14
	}
	
	required_resources = {
		sr_betharian = 1
	}
	
	upgrades = {
		betharian_power_plant_4
	}

	prerequisites = {
			"tech_power_plant_2"
	}
}

betharian_power_plant_4 = {
	base_buildtime = @b4time
	is_listed = no
	icon = "building_power_plant_1"
	
	cost = {
		minerals = @b4cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 15
	}
	
	required_resources = {
		sr_betharian = 1
	}	
	
	prerequisites = {
			"tech_power_plant_2"
	}
}

building_power_hub_1 = {
	base_buildtime = @b2time
	planet_unique = yes
	
	cost = {
		minerals = 150
		influence = 25
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 10
	}
	
	planet_modifier  = {
		tile_resource_energy_mult = 0.10
	}
	
	upgrades = {
		building_power_hub_2
	}
	
	prerequisites = {
		"tech_power_hub_1"
	}
}

building_power_hub_2 = {
	base_buildtime = @b3time
	is_listed = no
	planet_unique = yes
	
	cost = {
		minerals = 250
		influence = 25
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		energy = 10
	}
	
	planet_modifier  = {
		tile_resource_energy_mult = 0.15
	}
	
	prerequisites = {
		"tech_power_hub_2"
	}
}

#
#	FOOD
#

building_basic_farm = {
	base_buildtime = @b0time
	
	cost = {
		minerals = @b0cost
	}
	
	produced_resources = {
		food = 5
	}
	
	upgrades = {
		building_hydroponics_farm_1
	}
	
	potential = {
		custom_tooltip = {
			text = "requires_shelter"
			planet = {
					has_building = "building_colony_shelter"
			}
		}
	}
}

building_hydroponics_farm_1 = {
	base_buildtime = @b1time
	
	cost = {
		minerals = @b1cost
	}
	
	produced_resources = {
		food = 8
	}
	
	required_resources = {
		energy = @b1upkeep
	}
	
	upgrades = {
		building_hydroponics_farm_2
	}	

	prerequisites = {
		"tech_eco_simulation"
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}		
}

building_hydroponics_farm_2 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		food = 10
	}
	
	required_resources = {
		energy = @b2upkeep
	}
	
	upgrades = {
		building_hydroponics_farm_3
	}	
	
	prerequisites = {
		"tech_hydroponics"
	}	
}


#
#	MINERALS
#

building_mineral_silo_1 = {
	base_buildtime = @b1time
	
	cost = {
		minerals = @b1cost
	}
	
	country_modifier = {
		max_minerals = 100000
	}
	
	upgrades = {
		building_mineral_silo_2
	}		
}

building_mineral_silo_2 = {
	base_buildtime = @b2time
	icon = "building_mineral_silo_1"
	
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	required_resources = {
	}
	
	country_modifier = {
		max_minerals = 150000
	}
	
	prerequisites = {
		"tech_mineral_processing_1"
	}
	
	upgrades = {
		building_mineral_silo_3
	}	
}

building_mineral_silo_3 = {
	base_buildtime = @b3time
	icon = "building_mineral_silo_1"
	
	is_listed = no
	
	cost = {
		minerals = @b3cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	required_resources = {
	}
	
	country_modifier = {
		max_minerals = 200000
	}
	
	prerequisites = {
		"tech_mineral_processing_2"
	}
}


building_basic_mine = {
	base_buildtime = @b0time
	
	cost = {
		minerals = @b0cost
	}
	
	produced_resources = {
		minerals = 5
	}
	
	upgrades = {
		building_mining_network_1
	}
	
	potential = {
		custom_tooltip = {
			text = "requires_shelter"
			planet = {
					has_building = "building_colony_shelter"
			}
		}
	}
}

building_mining_network_1 = {
	base_buildtime = @b1time
	
	cost = {
		minerals = @b1cost
	}
	
	produced_resources = {
		minerals = 7
	}
	
	required_resources = {
		energy = @b1upkeep
	}
	
	upgrades = {
		building_mining_network_2
	}	
	
	prerequisites = {
		"tech_basic_industry"
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
}

building_mining_network_2 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		minerals = 9
	}
	
	required_resources = {
		energy = @b2upkeep
	}
	
	prerequisites = {
		"tech_mining_network_2"
	}	
}

building_mineral_processing_plant_1 = {
	base_buildtime = @b2time
	planet_unique = yes
	
	cost = {
		minerals = 150
		influence = 25
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		minerals = 10
	}
	
	planet_modifier  = {
		tile_resource_minerals_mult = 0.10
	}
	
	required_resources = {
		energy = 2
	}
	
	upgrades = {
		building_mineral_processing_plant_2
	}
	
	prerequisites = {
		"tech_mineral_processing_1"
	}
}

building_mineral_processing_plant_2 = {
	base_buildtime = @b3time
	is_listed = no
	planet_unique = yes
	
	cost = {
		minerals = 250
		influence = 25
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		minerals = 10
	}
	
	planet_modifier  = {
		tile_resource_minerals_mult = 0.15
	}
	
	required_resources = {
		energy = 3
	}
	
	prerequisites = {
		"tech_mineral_processing_2"
	}
}

#
# BASIC SCIENCE
#

building_basic_science_lab_1 = {
	base_buildtime = @b1time
	
	cost = {
		minerals = @b1cost
	}
	
	produced_resources = {
		engineering_research = 2
		physics_research = 2
		society_research = 2
	}
	
	required_resources = {
		energy = @b1upkeep
	}
	
	upgrades = {
		building_engineering_facility_1
		building_physics_lab_1
		building_biolab_1
	}	
	
	prerequisites = {
		"tech_basic_science_lab_1"
	}	
}

#
#	ENGINEERING
#

building_engineering_facility_1 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		engineering_research = 5
		physics_research = 3
		society_research = 3
	}
	
	required_resources = {
		energy = @b2upkeep
	}
			
	prerequisites = {
		"tech_engineering_lab_1"
	}
}


#
#	PHYSICS
#

building_physics_lab_1 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		engineering_research = 3
		physics_research = 5
		society_research = 3
	}
	
	required_resources = {
		energy = @b2upkeep
	}
	
	prerequisites = {
		"tech_physics_lab_1"
	}	
}


#
#	SOCIETY
#

building_biolab_1 = {
	base_buildtime = @b2time
	is_listed = no
	
	cost = {
		minerals = @b2cost
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	produced_resources = {
		engineering_research = 3
		physics_research = 3
		society_research = 5
	}
	
	required_resources = {
		energy = @b2upkeep
	}
		
	prerequisites = {
		"tech_biolab_1"
	}	
}

#
# OTHER
#

# Colony Shelter
building_colony_shelter = {
	base_buildtime = 180
	
	cost = {
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.05
	}
	
	potential = {
		planet = {
			NOT = {
				has_building = building_colony_shelter
				has_building = building_capital_1
				has_building = building_capital_2
				has_building = building_capital_3
			}
		}
	}
	
	allow = {
		always = yes
	}
	
	planet_unique = yes
	capital = yes
	level = 0
	
	produced_resources = {
		food = 5
	}
	
	upgrades = {
		building_capital_1
	}
}

# Planetary Administration
building_capital_1 = {
	base_buildtime = 360
	
	cost = {
		minerals = 350
		influence = 50
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.15
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_pops_5"
			planet = {
				count_pops = {
					count > 4
					limit = {
						is_colony_pop = yes
					}
				}
			}
		}
	}
	
	planet_unique = yes
	capital = yes
	level = 1
	
	produced_resources = {
		food = 6
		minerals = 6
	}
	
	adjacency_bonus = {
		resource_minerals_add = 1
		resource_food_add = 1
		resource_energy_add = 1
	}
	
	upgrades = {
		building_capital_2
	}
	
	prerequisites = {
		"tech_planetary_government"
	}

	ai_replace = no
}

# Planetary Capital
building_capital_2 = {
	base_buildtime = 720
	is_listed = no
	
	cost = {
		minerals = 500
		influence = 100
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.15
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_pops_10"
			planet = {
				count_pops = {
					count > 9
					limit = {
						is_colony_pop = yes
					}
				}
			}
		}
	}
	
	planet_unique = yes
	capital = yes
	level = 2
	
	produced_resources = {
		food = 8
		minerals = 8
	}
	
	adjacency_bonus = {
		resource_minerals_add = 2
		resource_food_add = 2
		resource_energy_add = 2
	}
	
	upgrades = {
		building_capital_3
	}
	
	prerequisites = {
		"tech_colonial_centralization"
	}	
}

# Empire Capital-Complex
building_capital_3 = {
	base_buildtime = 1080
	is_listed = no
	
	cost = {
		minerals = 1000
		influence = 200
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.15
	}
	
	potential = {
		planet = { is_capital = yes }
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_pops_15"
			planet = {
				count_pops = {
					count > 14
					limit = {
						is_colony_pop = yes
					}
				}
			}
		}
	}

	planet_unique = yes
	capital = yes
	empire_unique = yes
	level = 3
	
	produced_resources = {
		food = 10
		minerals = 10
		influence = 1
	}
	
	adjacency_bonus = {
		resource_minerals_add = 3
		resource_food_add = 3
		resource_energy_add = 3
	}
	
	prerequisites = {
		"tech_galactic_administration"
	}	
}

# Clone Vats are required to build Clone Armies
building_clone_vats = {
	base_buildtime = 360	
	planet_unique = yes
	
	cost = {
		minerals = 350
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_cloning"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			NOT = { has_ethic = ethic_militarist }
			NOT = { has_ethic = ethic_fanatic_militarist }
		}
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}
	}
}

# Grants additional fortification strength to planets
building_planetary_shield_generator = {
	icon = "building_shield_generator"
	base_buildtime = 360	
	planet_unique = yes
	
	cost = {
		minerals = 350
	}
	
	planet_modifier = {
		planet_fortification_strength = 0.5
	}	
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_planetary_shield_generator"
	}
	ai_special_building = yes

	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}
	}
}

## Slave Processing Facility is required to build Slave Armies
## They also improve the output of Enslaved Pops on the planet
building_slave_processing = {
	base_buildtime = 720
	planet_unique = yes
	
	cost = {
		minerals = 350
	}
	
	planet_modifier = {
		slave_production_output = 0.15
		slave_food_output = 0.15
	}	
	
	allow = {
		custom_tooltip = {
			text = "requirement_slave_facility"
			planet = {
				owner = {
					NOT = { has_policy_flag = slavery_not_allowed }
				}
			}
		}
	}

	prerequisites = {
		"tech_neural_implants"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
		modifier = {
			weight = 0
			NOT = {
				has_ai_personality_behaviour = slaver
			}
		}
	}
}

# Fallen Empire buildings
building_ancient_factory = {
	is_listed = no

	allow = {
		always = no
	}
	
	produced_resources = {
		minerals = @feproduction
	}
	
	required_resources = {
		energy = @feupkeep
	}	
	
	prerequisites = {
	}
	
	ai_replace = no
}

building_dark_matter_power_plant = {
	is_listed = no
	
	allow = {
		always = no
	}
	
	produced_resources = {
		energy = 15
	}
	
	prerequisites = {
	}
	
	ai_replace = no
}

building_agri_processing_complex = {
	is_listed = no
	
	produced_resources = {
		food = @feproduction
	}
	
	required_resources = {
		energy = @feupkeep
	}
	
	ai_replace = no
}

# Grand Mausoleum
building_grand_mausoleum = {
	base_buildtime = 1000
	built_for_ruler = yes
	planet_unique = yes
	
	cost = { 
		minerals = 250 
		influence = 100
	}  
	
	planet_modifier = {
		pop_ethic_shift = -0.1
	}
	
	potential = {
		planet = {
			exists = owner
			owner = {
				OR = {
					has_government = divine_mandate
					has_government = transcendent_empire
				}
			}
		}
	}
	
	allow = {
		custom_tooltip = {
			text = building_grand_mausoleum_allowed_tooltip
			exists = ruler
			ruler = {
				NOT = { has_leader_flag = built_monument }
			}
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	on_queued = {
		ruler = {
			set_leader_flag = built_monument
		}
	}
	
	on_unqueued = {
		ruler = {
			remove_leader_flag = built_monument
		}
	}
	
	ai_special_building = yes

	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

# Royal Gardens
building_royal_gardens = {
	base_buildtime = 720
	built_for_ruler = yes
	planet_unique = yes
	
	cost = { 
		minerals = 200 
		influence = 50 
	}
	
	planet_modifier = {
		pop_happiness = 0.10
	}
	
	potential = {
		planet = {
			owner = {
				OR = {
					has_government = enlightened_monarchy
					has_government = irenic_monarchy
				}
			}
		}
	}
	
	allow = {
		exists = ruler
		ruler = {
			NOT = { has_leader_flag = built_monument }
		}
	}
	
	on_queued = {
		ruler = {
			set_leader_flag = built_monument
		}
	}
	
	on_unqueued = {
		ruler = {
			remove_leader_flag = built_monument
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

####################################
### Strategic resource buildings ###
####################################

building_garanthiumworks = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 200
	}
	
	required_resources = {
		sr_garanthium = 1
		energy = 2
	}
	
	country_modifier = {
		building_time_mult = -0.10
		planet_building_cost_mult = -0.10
	}
	
	planet_modifier = {
		building_time_mult = -0.10
		planet_building_cost_mult = -0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_lythuric_manipulator = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 350
	}
	
	required_resources = {
		sr_lythuric = 1
		energy = 2
	}
	
	country_modifier = {
		pop_ethic_shift = -0.10
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_teldar_plant = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 350
	}
	
	required_resources = {
		sr_teldar = 1
		energy = 2
	}
	
	country_modifier = {
		pop_happiness = 0.10
	}
	
	planet_modifier = {
		pop_happiness = 0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes

	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_orillium_factory = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 350
	}
	
	required_resources = {
		sr_orillium = 1
		energy = 2
	}
	
	country_modifier = {
		tile_resource_minerals_mult = 0.10
	}
	
	planet_modifier = {
		tile_resource_minerals_mult = 0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_pitharan_plant = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 350
	}
	
	required_resources = {
		sr_pitharan = 1
		energy = 2
	}
	
	country_modifier = {
		tile_resource_food_mult = 0.10
	}
	
	planet_modifier = {
		tile_resource_food_mult = 0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_engos_plant = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 350
	}
	
	required_resources = {
		sr_engos = 1
		energy = 2
	}
	
	country_modifier = {
		pop_environment_tolerance = 0.05
	}
	
	planet_modifier = {
		pop_environment_tolerance = 0.05
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

###############################
### Planet Unique buildings ###
###############################

building_clinic = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 150
	}
	
	allow = {
		custom_tooltip = {
			text = "requirement_not_homeworld"
			planet = {
				NOT = { has_modifier = "capital" }
			}
		}		
	}
	
	required_resources = {
		energy = 1
	}
	
	produced_resources = {
		food = 2
	}
	
	planet_modifier = {
		pop_environment_tolerance = 0.05
	}
	
	prerequisites = {
		"tech_frontier_health"
	}
	
	ai_weight = {
		factor = 10
	}
}

building_military_academy = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 150
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	required_resources = {
		energy = 1
	}

	army_modifier = {
		army_damage_mult = 0.10
	}
	
	planet_modifier = {
		planet_army_build_speed_mult = 0.25
	}
	
	prerequisites = {
		"tech_centralized_command"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_paradise_dome = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 300
		influence = 10
	}
	
	required_resources = {
		energy = 2
	}
	
	planet_modifier = {
		pop_happiness = 0.10
		pop_environment_tolerance = 0.05
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_paradise_dome"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000	
	}
}

building_xeno_zoo = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 300
		influence = 10
	}
	
	required_resources = {
		sr_alien_pets = 1
		energy = 2
	}
	
	planet_modifier = {
		pop_happiness = 0.10
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_xeno_zoo"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_hyper_entertainment_forum = {
	base_buildtime = 720
	planet_unique = yes
	
	cost = {
		minerals = 550
		influence = 25
	}
	
	required_resources = {
		energy = 6
	}
	
	planet_modifier = {
		pop_happiness = 0.15
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_hyper_entertainment_forum"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
	}
}

building_monument_purity = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 150
		influence = 10
	}
	
	planet_modifier = {
		pop_happiness = 0.10
	}
	
	prerequisites = {
		"tech_purity_campaigns"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000	
	}
}

building_virtual_combat_arena = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 350
		influence = 10
	}
	
	required_resources = {
		energy = 3
	}
	
	planet_modifier = {
		pop_happiness = 0.05
		pop_ethic_shift = -0.05
	}

	army_modifier = {
		army_damage_mult = 0.10
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_1"
			planet = {
				OR = {
					has_building = "building_capital_1"
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_virtual_combat_arena"
	}
	
	ai_weight = {
		factor = 1000	
	}	
}

building_symbol_unity = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 200
	}
	
	planet_modifier = {
		pop_ethic_shift = -0.10
	}
	
	prerequisites = {
		"tech_symbol_unity"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
	}
}

building_visitor_center = {
	base_buildtime = 360
	planet_unique = yes
	
	cost = {
		minerals = 200
	}
	
	required_resources = {
		energy = 2
	}
	
	planet_modifier = {
		pop_environment_tolerance = 0.05
		pop_xenophobia = -0.10
		planet_migration_xeno_pull = 0.50
	}
	
	prerequisites = {
		"tech_visitor_center"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}	
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

########################
### Empire Unique buildings ###
########################

building_galactic_stock_exchange = {
	base_buildtime = 360
	empire_unique = yes
	
	cost = {
		minerals = 450
		influence = 35
	}
	
	required_resources = {
		energy = 2
	}
	
	potential = {
		planet = { is_capital = yes }
	}	
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_3"
			planet = {
				has_building = "building_capital_3"
			}
		}
	}
	
	country_modifier = {
		tile_resource_energy_mult = 0.10
	}
	
	prerequisites = {
		"tech_galactic_markets"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_ministry_benevolence = {
	base_buildtime = 720
	empire_unique = yes
	
	cost = {
		minerals = 400
		influence = 50
	}
	
	required_resources = {
		energy = 7
	}
	
	country_modifier = {
		pop_ethic_shift = -0.15
	}
	
	potential = {
		planet = { is_capital = yes }
	}	
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_3"
			planet = {
				has_building = "building_capital_3"
			}
		}
	}
	
	prerequisites = {
		"tech_galactic_benevolence"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}

building_institute = {
	base_buildtime = 720
	empire_unique = yes
	
	cost = {
		minerals = 600
		influence = 50
	}
	
	produced_resources = {
		engineering_research = 5
		physics_research = 5
		society_research = 5
	}
	
	required_resources = {
		energy = 10
	}
	
	country_modifier = {
		all_technology_research_speed = 0.05
	}
	
	allow = {
		custom_tooltip = {
			text = "requires_building_capital_2"
			planet = {
				OR = {
					has_building = "building_capital_2"
					has_building = "building_capital_3"
				}
			}
		}
	}
	
	prerequisites = {
		"tech_global_research_initiative"
	}
	
	ai_special_building = yes
	
	ai_allow = {
		has_any_resource = no
	}
	
	ai_weight = {
		factor = 1000
		modifier = {
			factor = 0
			from = { sector_controlled = yes }
		}	
	}
}