tr_est_friendship_adopt = {
	custom_tooltip = tr_est_friendship_adopt_desc

	on_enabled = {	
		every_country = {
			limit = {
				has_opinion_modifier = { 
					who = root
					modifier = opinion_new_contact
				}
			}
			remove_opinion_modifier = { 
				who = root
				modifier = opinion_new_contact
			}
		}
	}
	
	modifier = {
		envoy_improve_relations_mult = 0.25
	}
}

tr_est_friendship_finish = {
	custom_tooltip = tr_est_friendship_finish_desc

	modifier = {
		ascension_perks_add = 1
	}

	on_enabled = {
		every_owned_planet = {
			if = {
				limit = {
					num_species > 2
				}
				log = "Debug Message 02"
				add_modifier = {
					modifier = "mod_est_friendship_finish"
					days = -1
				}
			}
		}	
	}
}

tr_est_friendship_1 = {
	custom_tooltip = tr_est_friendship_1_desc

	ai_weight = { factor = 5000 }
}

tr_est_friendship_2 = {
	possible = { has_tradition = tr_est_friendship_1 }
	
	modifier = {
		all_technology_research_speed = 0.05
	}

	ai_weight = { factor = 5000 }
}

tr_est_friendship_3 = {
	modifier = {
		job_healthcare_add = 1
		planet_doctors_society_research_produces_add = 2
	}

	ai_weight = { factor = 5000 }
}

tr_est_friendship_4 = {
	possible = { has_tradition = tr_est_friendship_3 }	
	
	modifier = {
		country_border_friction_mult = -0.50
		army_collateral_damage_mult = -0.50
	}
	
	tradition_swap = {
		custom_tooltip = tr_est_friendship_4_militarist_desc
	
		name = tr_est_friendship_4_militarist
		inherit_effects = no
		inherit_icon = yes
		inherit_name = yes
		trigger = {
			Or = {
				has_ethic = ethic_fanatic_militarist
				has_ethic = ethic_militarist
			}
		}	
		on_enabled = {
			if = {
				limit = {
					any_war = {
						Or = {
							And = {
								any_defender = {
									is_same_value = root
								}
								any_defender = {
									Not = {
										is_same_value = root
									}
								}
							}
							And = {
								any_attacker = {
									is_same_value = root
								}
								any_attacker = {
									Not = {
										is_same_value = root
									}
								}
							}
						}
					}
				}
				add_modifier = {
					modifier = "mod_est_friendship_4_militarist"
					days = -1
				}
			}
		}
		weight = { factor = 1 }
	}

	ai_weight = { factor = 5000 }
}

tr_est_friendship_5 = {
	possible = {
		has_tradition = tr_est_friendship_2
		has_tradition = tr_est_friendship_4
	}
	
	modifier = {
		planet_immigration_pull_mult  = 0.40
		pop_ethic_xenophile_attraction_mult = 0.15
	}
	
	tradition_swap = {
		name = tr_est_friendship_5_not_xenophile
		inherit_icon = yes
		inherit_name = yes
		trigger = {
			NOR = {
				has_ethic = ethic_fanatic_xenophile
				has_ethic = ethic_xenophile
			}
		}	
		modifier = {
			planet_immigration_pull_mult  = 0.50
		}
		weight = { factor = 1 }
	}

	ai_weight = { factor = 5000 }
}