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

@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

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

@natural_equilibrium_happiness = 0.02

### Aesthetics 5- Wonders ###
@wonder_build_time = 1080
@wonder_build_cost = 4000
@wonder_influence_cost = 200
@wonder_unity_prod = 2

#Aesthetics 5
building_est_aesthetics_5_wonder_garden = {
	icon = "building_est_aesthetics_5_wonder_garden"
	base_buildtime = @wonder_build_time
	base_cap_amount = 1
	empire_limit = { base = 1 }

	category = pop_assembly

	resources = {
		category = planet_buildings
		cost = {
			minerals = @wonder_build_cost
			influence = @wonder_influence_cost
		}
		produces = {
			unity = @wonder_unity_prod
		}
	}	
	
	planet_modifier = {
		pop_environment_tolerance = 0.10
		pop_growth_speed = 0.10
	}
	
	country_modifier = {
		pop_growth_speed = 0.05
	}
	
	allow = {
		has_major_upgraded_capital = yes
		num_pops >= 100
	}
	
	potential = {
		planet = {
			NOT = { 
				has_building = building_est_aesthetics_5_wonder_monument
				has_building_construction =  building_est_aesthetics_5_wonder_monument
				has_building = building_est_aesthetics_5_wonder_stage
				has_building_construction =building_est_aesthetics_5_wonder_stage
				has_building = building_est_aesthetics_5_wonder_halls
				has_building_construction =building_est_aesthetics_5_wonder_halls
				has_building = building_est_aesthetics_5_wonder_museum
				has_building_construction =building_est_aesthetics_5_wonder_museum
			}			
		}
		owner = {
			has_active_tradition = tr_est_aesthetics_5
			Or = {
				Not = {
					has_country_flag = flag_est_aesthetics_5_built_garden
				}
				root = {
					has_building = building_est_aesthetics_5_wonder_garden
				}
			}
		}
	}

	ai_weight = {
		factor = 30 
	}	
}
#Aesthetics 5
building_est_aesthetics_5_wonder_monument = {
	icon = "building_est_aesthetics_5_wonder_monument"
	base_buildtime = @wonder_build_time
	base_cap_amount = 1
	empire_limit = { base = 1 }

	category = unity

	resources = {
		category = planet_buildings
		cost = {
			minerals = @wonder_build_cost
			influence = @wonder_influence_cost
		}
		produces = {
			unity = @wonder_unity_prod
		}
	}	
	
	planet_modifier = {
		planet_jobs_unity_produces_mult = 0.10
	}
	
	country_modifier = {
		pop_government_ethic_attraction = 0.05	
	}
	
	allow = {
		has_major_upgraded_capital = yes
		num_pops >= 100
	}
	
	potential = {
		planet = {
			NOT = { 
				has_building = building_est_aesthetics_5_wonder_garden
				has_building_construction = building_est_aesthetics_5_wonder_garden
				has_building = building_est_aesthetics_5_wonder_stage
				has_building_construction =building_est_aesthetics_5_wonder_stage
				has_building = building_est_aesthetics_5_wonder_halls
				has_building_construction =building_est_aesthetics_5_wonder_halls
				has_building = building_est_aesthetics_5_wonder_museum
				has_building_construction =building_est_aesthetics_5_wonder_museum
			}			
		}
		owner = {
			has_active_tradition = tr_est_aesthetics_5
			Or = {
				Not = {
					has_country_flag = flag_est_aesthetics_5_built_monument
				}
				root = {
					has_building = building_est_aesthetics_5_wonder_monument
				}
			}
		}
	}

	ai_weight = {
		factor = 30 
	}	
}
#Aesthetics 5
building_est_aesthetics_5_wonder_stage = {
	icon = "building_est_aesthetics_5_wonder_stage"
	base_buildtime = @wonder_build_time
	base_cap_amount = 1
	empire_limit = { base = 1 }

	category = unity

	resources = {
		category = planet_buildings
		cost = {
			minerals = @wonder_build_cost
			influence = @wonder_influence_cost
		}
		produces = {
			unity = @wonder_unity_prod
		}
	}	
	
	planet_modifier = {
		pop_happiness = 0.05
	}
	
	country_modifier = {
		country_base_influence_produces_add = 0.5
	}
	
	allow = {
		has_major_upgraded_capital = yes
		num_pops >= 100
	}
	
	potential = {
		planet = {
			NOT = {  
				has_building = building_est_aesthetics_5_wonder_garden
				has_building_construction = building_est_aesthetics_5_wonder_garden
				has_building = building_est_aesthetics_5_wonder_monument
				has_building_construction =  building_est_aesthetics_5_wonder_monument
				has_building = building_est_aesthetics_5_wonder_halls
				has_building_construction =building_est_aesthetics_5_wonder_halls
				has_building = building_est_aesthetics_5_wonder_museum
				has_building_construction =building_est_aesthetics_5_wonder_museum
			}			
		}
		owner = {
			has_active_tradition = tr_est_aesthetics_5
			Or = {
				Not = {
					has_country_flag = flag_est_aesthetics_5_built_stage
				}
				root = {
					has_building = building_est_aesthetics_5_wonder_stage
				}
			}
		}
	}

	ai_weight = {
		factor = 30 
	}	
}
#Aesthetics 5
building_est_aesthetics_5_wonder_halls = {
	icon = "building_est_aesthetics_5_wonder_halls"
	base_buildtime = @wonder_build_time
	base_cap_amount = 1
	empire_limit = { base = 1 }

	category = unity

	resources = {
		category = planet_buildings
		cost = {
			minerals = @wonder_build_cost
			influence = @wonder_influence_cost
		}
		produces = {
			unity = @wonder_unity_prod
		}
	}	
	
	planet_modifier = {
		planet_stability_add = 5
	}
	
	country_modifier = {
		species_leader_exp_gain = 0.10
	}
	
	allow = {
		has_major_upgraded_capital = yes
		num_pops >= 100
	}
	
	potential = {
		planet = {
			NOT = { 
				has_building = building_est_aesthetics_5_wonder_garden
				has_building_construction = building_est_aesthetics_5_wonder_garden
				has_building = building_est_aesthetics_5_wonder_monument
				has_building_construction =  building_est_aesthetics_5_wonder_monument
				has_building = building_est_aesthetics_5_wonder_stage
				has_building_construction =building_est_aesthetics_5_wonder_stage
				has_building = building_est_aesthetics_5_wonder_museum
				has_building_construction =building_est_aesthetics_5_wonder_museum
			}			
		}
		owner = {
			has_active_tradition = tr_est_aesthetics_5
			Or = {
				Not = {
					has_country_flag = flag_est_aesthetics_5_built_halls
				}
				root = {
					has_building = building_est_aesthetics_5_wonder_halls
				}
			}
		}
	}

	ai_weight = {
		factor = 30 
	}	
}
#Aesthetics 5
building_est_aesthetics_5_wonder_museum = {
	icon = "building_est_aesthetics_5_wonder_museum"
	base_buildtime = @wonder_build_time
	base_cap_amount = 1
	empire_limit = { base = 1 }

	category = unity

	resources = {
		category = planet_buildings
		cost = {
			minerals = @wonder_build_cost
			influence = @wonder_influence_cost
		}
		produces = {
			unity = @wonder_unity_prod
		}
	}	
	
	planet_modifier = {
		planet_amenities_add = 10
	}
	
	country_modifier = {
		country_unity_produces_mult = 0.05
	}
	
	allow = {
		has_major_upgraded_capital = yes
		num_pops >= 100
	}
	
	potential = {
		planet = {
			NOT = { 
				has_building = building_est_aesthetics_5_wonder_garden
				has_building_construction = building_est_aesthetics_5_wonder_garden
				has_building = building_est_aesthetics_5_wonder_monument
				has_building_construction =  building_est_aesthetics_5_wonder_monument
				has_building = building_est_aesthetics_5_wonder_stage
				has_building_construction =building_est_aesthetics_5_wonder_stage
				has_building = building_est_aesthetics_5_wonder_halls
				has_building_construction =building_est_aesthetics_5_wonder_halls
			}			
		}
		owner = {
			has_active_tradition = tr_est_aesthetics_5
			Or = {
				Not = {
					has_country_flag = flag_est_aesthetics_5_built_museum
				}
				root = {
					has_building = building_est_aesthetics_5_wonder_museum
				}
			}
		}
	}

	ai_weight = {
		factor = 30 
	}	
}

#Archivist Finish
building_est_archivist_finish_archive = {
	icon = "building_est_archivist_finish_archive"
	base_buildtime = 360
	base_cap_amount = 1

	category = research

	resources = {
		category = planet_buildings
		cost = {
			minerals = 240
		}
		produces = {
			unity = 3
		}
		upkeep = {
			energy = 2
		}
	}	
	
	planet_modifier = {
		planet_jobs_engineering_research_produces_mult = 0.1
		planet_jobs_physics_research_produces_mult = 0.1
		planet_jobs_society_research_produces_mult = 0.1
	}
	
	allow = {
		has_upgraded_capital = yes
	}
	
	potential = {
		planet = {
			NOT = { is_planet_class = pc_habitat }			
		}
		owner = {
			has_tradition = tr_est_archivist_finish
		}
	}

	ai_weight = {
		factor = 15 
	}	
}

#Cybernetics Finish
building_est_cybernetics_finish_automated_power_plant = {
	icon = "building_est_cybernetics_finish_automated_power_plant"
	base_buildtime = 360
	base_cap_amount = 3

	category = resource
	
	resources = {
		category = planet_buildings
		cost = {
			minerals = 240
		}
		produces = {
			energy = 6
		}
	}	

	planet_modifier = {
		district_generator_max = -1
	}
	
	allow = {
		has_upgraded_capital = yes
		num_free_districts = { 
			type = district_generator
			value > 0
		}
	}
	
	potential = {
		planet = {
			NOT = { is_planet_class = pc_habitat }
		}
		owner = {
			has_active_tradition = tr_est_cybernetics_finish
		}
	}

	ai_weight = {
		factor = 0 #Hard for AI to use.
	}	
}
#Cybernetics Finish
building_est_cybernetics_finish_automated_farm = {
	icon = "building_est_cybernetics_finish_automated_farm"
	base_buildtime = 360
	base_cap_amount = 3

	category = resource
	
	resources = {
		category = planet_buildings
		cost = {
			minerals = 240
		}
		produces = {
			food = 10
		}
		upkeep = {
			energy = 2
		}
	}	

	planet_modifier = {
		district_farming_max = -1
	}
	
	allow = {
		has_upgraded_capital = yes
		num_free_districts = { 
			type = district_farming
			value > 0
		}
	}
	
	potential = {
		planet = {
			NOT = { is_planet_class = pc_habitat }
		}
		owner = {
			has_active_tradition = tr_est_cybernetics_finish
		}
	}

	ai_weight = {
		factor = 0 #Hard for AI to use.
	}	
}

#Cybernetics Finish
building_est_cybernetics_finish_automated_mine = {
	icon = "building_est_cybernetics_finish_automated_mine"
	base_buildtime = 360
	base_cap_amount = 3

	category = resource
	
	resources = {
		category = planet_buildings
		cost = {
			minerals = 240
		}
		produces = {
			minerals = 6
		}
		upkeep = {
			energy = 2
		}
	}	

	planet_modifier = {
		district_mining_max = -1
	}
	
	allow = {
		has_upgraded_capital = yes
		num_free_districts = { 
			type = district_mining
			value > 0
		}
	}
	
	potential = {
		planet = {
			NOT = { is_planet_class = pc_habitat }
		}
		owner = {
			has_active_tradition = tr_est_cybernetics_finish
		}
	}

	ai_weight = {
		factor = 0 #Hard for AI to use.
	}	
}

#Industry 3
building_est_industry_3_blast_furnace = {
	base_buildtime = 480
	base_cap_amount = 1
	icon = "building_est_industry_3_blast_furnace"

	category = manufacturing

	resources = {
		category = planet_buildings
		cost = {
			minerals = 480
		}
		produces = {
			trigger = { 

			}
			unity = 2
		}
		upkeep = {
			energy = 4
		}
	}

	planet_modifier = {
		planet_metallurgists_alloys_produces_add = 1
		planet_metallurgists_energy_upkeep_add = 2
	}
	
	allow = {
		has_major_upgraded_capital = yes
	}
	
	potential = {
		owner = {
			has_tradition = tr_est_industry_3
		}
	}

	ai_weight = {
		weight = 0.1
		modifier = {
			factor = 100
			
		}
	}
}

#Mechanicum
building_est_mechanicum_5_guild_of_engineers_1 = {
	base_buildtime = 360
	base_cap_amount = 1

	category = research

	resources = {
		category = planet_buildings
		cost = {
			minerals = 480
		}
		upkeep = {
			energy = 5
		}
	}
	
	potential = {
		owner = { 
			Or = {
				has_active_tradition = tr_est_mechanicum_5
				has_active_tradition = tr_est_mechanicum_5_robots
			}
		}
		NOT = { has_modifier = resort_colony }	
		NOT = { has_modifier = slave_colony }
		NOT = { is_planet_class = pc_habitat }
	}
	
	allow = {
		has_major_upgraded_capital = yes
	}

	planet_modifier = {
		planet_jobs_engineering_research_produces_mult = 0.10
	}
	
	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { 
				is_regular_empire = yes 
				Not = {
					est_uses_robots = yes
				}
			}
		}
		modifier = {
			job_est_engineer_add = 3
			job_technician_add = 3
		}
	}
	
	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { 
				is_regular_empire = yes 
				est_uses_robots = yes
			}
		}
		modifier = {
			job_est_engineer_add = 2
			job_technician_add = 2
			job_roboticist_add = 1
		}
	}
	
	upgrades = {
		building_est_mechanicum_5_guild_of_engineers_2
	}
	
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
			}
		}
		text = job_technician_effect_desc
	}	
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
			}
		}
		text = job_est_engineer_effect_desc
	}
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
				est_uses_robots = yes
			}
		}
		text = job_roboticist_effect_desc
	}
	
	ai_weight = {
		weight = 3
	}
}
#Mechanicum
building_est_mechanicum_5_guild_of_engineers_2 = {
	base_buildtime = 360
	can_build = no

	category = research

	resources = {
		category = planet_buildings
		cost = {
			minerals = 720
			rare_crystals = 50
		}
		upkeep = {
			energy = 7
			rare_crystals = 1
		}
	}
	
	potential = {
		owner = { 
			Or = {
				has_active_tradition = tr_est_mechanicum_5
				has_active_tradition = tr_est_mechanicum_5_robots
			}
		}
		NOT = { has_modifier = resort_colony }	
		NOT = { has_modifier = slave_colony }
		NOT = { is_planet_class = pc_habitat }
	}
	
	planet_modifier = {
		planet_jobs_engineering_research_produces_mult = 0.15
	}

	allow = {
		has_fully_upgraded_capital = yes
	}
	
	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { 
				is_regular_empire = yes 
				Not = {
					est_uses_robots = yes
				}
			}
		}
		modifier = {
			job_est_engineer_add = 5
			job_technician_add = 5
		}
	}
	
	triggered_planet_modifier = {
		potential = {
			exists = owner
			owner = { 
				is_regular_empire = yes 
				est_uses_robots = yes
			}
		}
		modifier = {
			job_est_engineer_add = 4
			job_technician_add = 4
			job_roboticist_add = 1
		}
	}
	
	prerequisites = {
		"tech_basic_science_lab_3"
	}
	
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
			}
		}
		text = job_technician_effect_desc
	}
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
			}
		}
		text = job_est_engineer_effect_desc
	}
	triggered_desc = {
		trigger = { 
			exists = owner
			owner = { 
				is_regular_empire = yes 
				est_uses_robots = yes
			}
		}
		text = job_roboticist_effect_desc
	}
	
	ai_weight = {
		weight = 3
	}
}

#Nature Finisher (Or 5 for GC).
building_est_nature_preservation = {
	base_buildtime = 540
	base_cap_amount = 1

	category = unity

	destroy_trigger = {
		owner = {
			Nor = {
				has_active_tradition = tr_est_nature_finish
				has_active_tradition = tr_est_nature_5_GC
			}
		}
	}

	on_destroy = {
		if = {
			limit = {
				owner = {
					Or = {
						has_active_tradition = tr_est_nature_finish
						has_active_tradition = tr_est_nature_5_GC
					}
				}
			}
			add_modifier = {
				modifier = mod_est_nature_5
				years = 20
			}
		}
	}

	resources = {
		category = planet_buildings
		cost = {
			minerals = 180
		}
		produces = {
			unity = 12
		}
		upkeep = {
			energy = 1
		}
	}	
	
	planet_modifier = {
		planet_non_artificial_max_districts_add = -2
		planet_jobs_minerals_produces_mult = -0.2
		planet_jobs_society_research_produces_mult = 0.2
	}

	allow = {
		free_district_slots > 0
	}
	
	potential = {
		has_upgraded_capital = yes
		owner = {
			Or = {
				has_active_tradition = tr_est_nature_finish
				has_active_tradition = tr_est_nature_5_GC
			}
		}
	}

	ai_weight = {
		factor = 0
	}	
}
