tr_est_cooperativity_adopt = {
	custom_tooltip = tr_est_cooperativity_adopt_desc
	unlocks_agenda = agenda_est_cooperativity

	on_enabled = {
		every_owned_planet = {
			if = {
				limit = {
					num_pops > 23
				}
				add_modifier = {
					modifier = "mod_est_cooperativity_adopt_3"
					days = -1
				}
			}
			else = {
				if = {
					limit = {
						num_pops > 19
					}
					add_modifier = {
						modifier = "mod_est_cooperativity_adopt_2"
						days = -1
					}
				}
				else = {
					if = {
						limit = {
							num_pops > 15
						}
						add_modifier = {
							modifier = "mod_est_cooperativity_adopt_1"
							days = -1
						}
					}
				}
			
			}
		}
	}
}

tr_est_cooperativity_finish = {
	modifier = {
		colony_start_num_pops_add = 2
		ascension_perks_add = 1
	}
}


tr_est_cooperativity_1 = {
	modifier = {
		army_damage_mult = 0.20
		armies_upkeep_mult = -0.10
	}

	ai_weight = { factor = 5000 }
}

tr_est_cooperativity_2 = {
	possible = { has_tradition = tr_est_cooperativity_1 }	

	modifier = {
		planet_jobs_simple_drone_food_produces_mult = 0.10
		planet_jobs_simple_drone_minerals_produces_mult = 0.10
	}
	
	tradition_swap = {
		name = tr_est_cooperativity_2_machines
		inherit_name = yes
		trigger = {
			is_machine_empire = yes
		}	
		modifier = {
			planet_jobs_simple_drone_energy_produces_mult = 0.10
			planet_jobs_simple_drone_minerals_produces_mult = 0.10
		}
		weight = { factor = 1 }
	}

	ai_weight = { factor = 5000 }
}

tr_est_cooperativity_3 = {
	modifier = {
		species_leader_exp_gain = 0.25
	}

	ai_weight = { factor = 5000 }
}

tr_est_cooperativity_4 = {
	custom_tooltip = tr_est_cooperativity_4_desc

	possible = { has_tradition = tr_est_cooperativity_3 }	

	on_enabled = {
		every_owned_leader = {
			limit = {
				Not = {
					has_trait =	leader_trait_admiral_est_cognition_central
					has_trait =	leader_trait_general_est_cognition_central
					has_trait =	leader_trait_official_est_cognition_central
					has_trait =	leader_trait_scientist_est_cognition_central
#					has_ruler_trait = leader_trait_ruler_est_cognition_central #(Ben_D): "ruler" is irrelevant now
				}
			}
			if = {
				limit = {
					has_trait = subclass_commander_admiral
				}
				add_trait = leader_trait_admiral_est_cognition_central
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
			}
			if = {
				limit = {
					has_trait = subclass_commander_general
				}
				add_trait = leader_trait_general_est_cognition_central
#				add_trait = leader_trait_ruler_est_cognition_central
			}
			if = {
				limit = { leader_class = official }
				add_trait = leader_trait_official_est_cognition_central
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
			}
			if = {
				limit = { leader_class = scientist }
				add_trait = leader_trait_scientist_est_cognition_central
#				add_trait = leader_trait_ruler_est_cognition_central
			}
#			if = {
#				limit = { leader_class = ruler }
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
#			}
		}
		every_pool_leader = {
			limit = {
				Not = {
					has_trait = leader_trait_admiral_est_cognition_central
					has_trait = leader_trait_general_est_cognition_central
					has_trait = leader_trait_official_est_cognition_central
					has_trait = leader_trait_scientist_est_cognition_central
#					has_trait = leader_trait_ruler_est_cognition_central
				}
			}
#			if = { #Shouldn't give traits before sub class is determined
#				limit = {leader_class = commander }
#				add_trait = leader_trait_admiral_est_cognition_central
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
#			}
			if = {
				limit = { leader_class = commander }
				add_trait = leader_trait_admiral_est_cognition_central
			}
			if = {
				limit = { leader_class = official }
				add_trait = leader_trait_official_est_cognition_central
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
			}
			if = {
				limit = { leader_class = scientist }
				add_trait = leader_trait_scientist_est_cognition_central
#				add_ruler_trait = leader_trait_ruler_est_cognition_central
			}
#			if = {
#				limit = { leader_class = ruler }
#				add_trait = leader_trait_ruler_est_cognition_central
#			}
		}	
	}

	ai_weight = { factor = 5000 }
}

tr_est_cooperativity_5 = {
	custom_tooltip = tr_est_cooperativity_5_desc

	tradition_swap = {
		name = tr_est_cooperativity_5_AI
		trigger = {
			is_hive_empire = yes
			is_ai = yes
		}	
		modifier = {
			pop_growth_speed = 0.15
		}
		weight = { factor = 1 }
	}
	
	tradition_swap = {
		custom_tooltip = tr_est_cooperativity_5_machines_desc
	
		name = tr_est_cooperativity_5_machines
		trigger = {
			is_machine_empire = yes
			is_ai = no
		}	
		weight = { factor = 1 }
	}
	
	tradition_swap = {
		name = tr_est_cooperativity_5_machines_AI
		inherit_effects = no
		inherit_icon = no
		trigger = {
			is_machine_empire = yes
			is_ai = yes
		}	
		modifier = {
			planet_pop_assembly_mult = 0.15
		}
		weight = { factor = 1 }
	}

	ai_weight = { factor = 5000 }
}