namespace = est_proselytism

#Proselytism 1, gives Ethics attraction to neighbours with the tradition.
country_event = {
	id = est_proselytism.1
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		has_active_tradition = tr_est_proselytism_1
	}
	
	immediate = {
		every_neighbor_country = {
			limit = {
				Not = {
					has_ethic = ethic_gestalt_consciousness
					has_country_flag = flag_est_just_updated_proselytism_1
				}
			}
			set_timed_country_flag = {
				flag = flag_est_just_got_mod_proselytism_1
				days = 1
			}
			if = {
				limit = {
					Not = {
						has_country_flag = flag_est_got_mod_proselytism_1
					}
				}
				set_country_flag = flag_est_got_mod_proselytism_1
			}
			
			if = {
				limit = {
					prev = {
						has_ethic = ethic_authoritarian
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_authoritarian
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_authoritarian
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_authoritarian_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_egalitarian
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_egalitarian
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_egalitarian
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_egalitarian_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}			
			if = {
				limit = {
					prev = {
						has_ethic = ethic_xenophobe
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_xenophobe
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_xenophobe
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_xenophobe_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_xenophile
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_xenophile
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_xenophile
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_xenophile_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_militarist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_militarist
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_militarist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_militarist_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_pacifist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_pacifist
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_pacifist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_pacifist_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_materialist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_materialist
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_materialist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_materialist_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_spiritualist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_spiritualist
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_spiritualist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_1_spiritualist_fanatic
						}
					}
					country_event = {
						id = est_proselytism.3
					}
				}
			}
		}
	}
}

#Proselytism 1, removes the modifier for countries that should not have it anymore.
country_event = {
	id = est_proselytism.2
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		has_country_flag = flag_est_got_mod_proselytism_1
		Not = {
			has_country_flag = flag_est_just_got_mod_proselytism_1
		}
	}

	immediate = {
		if = {
			limit = {
				Not = {
					any_neighbor_country = {
						has_active_tradition = tr_est_proselytism_1							
					}
				}
			}
			remove_country_flag = flag_est_got_mod_proselytism_1
			switch = {
				trigger = has_modifier 	
				mod_est_proselytism_1_authoritarian = {remove_modifier = "mod_est_proselytism_1_authoritarian"}
				mod_est_proselytism_1_authoritarian_fanatic = {remove_modifier = "mod_est_proselytism_1_authoritarian_fanatic"}
				mod_est_proselytism_1_egalitarian = {remove_modifier = "mod_est_proselytism_1_egalitarian"}
				mod_est_proselytism_1_egalitarian_fanatic = {remove_modifier = "mod_est_proselytism_1_egalitarian_fanatic"}
				mod_est_proselytism_1_xenophobe = {remove_modifier = "mod_est_proselytism_1_xenophobe"}
				mod_est_proselytism_1_xenophobe_fanatic = {remove_modifier = "mod_est_proselytism_1_xenophobe_fanatic"}
				mod_est_proselytism_1_xenophile = {remove_modifier = "mod_est_proselytism_1_xenophile"}
				mod_est_proselytism_1_xenophile_fanatic = {remove_modifier = "mod_est_proselytism_1_xenophile_fanatic"}
				mod_est_proselytism_1_militarist = {remove_modifier = "mod_est_proselytism_1_militarist"}
				mod_est_proselytism_1_militarist_fanatic = {remove_modifier = "mod_est_proselytism_1_militarist_fanatic"}
				mod_est_proselytism_1_pacifist = {remove_modifier = "mod_est_proselytism_1_pacifist"}
				mod_est_proselytism_1_pacifist_fanatic = {remove_modifier = "mod_est_proselytism_1_pacifist_fanatic"}
				mod_est_proselytism_1_materialist = {remove_modifier = "mod_est_proselytism_1_materialist"}
				mod_est_proselytism_1_materialist_fanatic = {remove_modifier = "mod_est_proselytism_1_materialist_fanatic"}
				mod_est_proselytism_1_spiritualist = {remove_modifier = "mod_est_proselytism_1_spiritualist"}
				mod_est_proselytism_1_spiritualist_fanatic = {remove_modifier = "mod_est_proselytism_1_spiritualist_fanatic"}
			}
		}			
	}
}

#Proselytism 1, updates a countries ethics attraction bonuses.
country_event = {
	id = est_proselytism.3
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		switch = {
			trigger = has_modifier 	
			
			mod_est_proselytism_1_authoritarian = {remove_modifier = "mod_est_proselytism_1_authoritarian"}
			mod_est_proselytism_1_authoritarian_fanatic = {remove_modifier = "mod_est_proselytism_1_authoritarian_fanatic"}
			mod_est_proselytism_1_egalitarian = {remove_modifier = "mod_est_proselytism_1_egalitarian"}
			mod_est_proselytism_1_egalitarian_fanatic = {remove_modifier = "mod_est_proselytism_1_egalitarian_fanatic"}
			mod_est_proselytism_1_xenophobe = {remove_modifier = "mod_est_proselytism_1_xenophobe"}
			mod_est_proselytism_1_xenophobe_fanatic = {remove_modifier = "mod_est_proselytism_1_xenophobe_fanatic"}
			mod_est_proselytism_1_xenophile = {remove_modifier = "mod_est_proselytism_1_xenophile"}
			mod_est_proselytism_1_xenophile_fanatic = {remove_modifier = "mod_est_proselytism_1_xenophile_fanatic"}
			mod_est_proselytism_1_militarist = {remove_modifier = "mod_est_proselytism_1_militarist"}
			mod_est_proselytism_1_militarist_fanatic = {remove_modifier = "mod_est_proselytism_1_militarist_fanatic"}
			mod_est_proselytism_1_pacifist = {remove_modifier = "mod_est_proselytism_1_pacifist"}
			mod_est_proselytism_1_pacifist_fanatic = {remove_modifier = "mod_est_proselytism_1_pacifist_fanatic"}
			mod_est_proselytism_1_materialist = {remove_modifier = "mod_est_proselytism_1_materialist"}
			mod_est_proselytism_1_materialist_fanatic = {remove_modifier = "mod_est_proselytism_1_materialist_fanatic"}
			mod_est_proselytism_1_spiritualist = {remove_modifier = "mod_est_proselytism_1_spiritualist"}
			mod_est_proselytism_1_spiritualist_fanatic = {remove_modifier = "mod_est_proselytism_1_spiritualist_fanatic"}
		}
		set_timed_country_flag = {
			flag = flag_est_just_updated_proselytism_1
			days = 1
		}
		every_neighbor_country = {
			limit = {
				has_active_tradition = tr_est_proselytism_1
			}
			switch = {
				trigger = has_ethic
				
				ethic_authoritarian = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_authoritarian
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_authoritarian"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_authoritarian = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_authoritarian_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_authoritarian_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_egalitarian = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_egalitarian
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_egalitarian"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_egalitarian = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_egalitarian_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_egalitarian_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_xenophobe = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_xenophobe
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_xenophobe"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_xenophobe = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_xenophobe_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_xenophobe_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_xenophile = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_xenophile
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_xenophile"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_xenophile = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_xenophile_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_xenophile_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_militarist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_militarist
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_militarist"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_militarist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_militarist_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_militarist_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_pacifist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_pacifist
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_pacifist"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_pacifist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_pacifist_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_pacifist_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_materialist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_materialist
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_materialist"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_materialist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_materialist_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_materialist_fanatic"
								days = -1
							}
						}
					}
				}
				
				ethic_spiritualist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_spiritualist
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_spiritualist"
								days = -1
							}
						}
					}
				}
				ethic_fanatic_spiritualist = {
					root = {
						if = {
							limit = {
								Not = {
									has_modifier = mod_est_proselytism_1_spiritualist_fanatic
								}
							}
							add_modifier = {
								modifier = "mod_est_proselytism_1_spiritualist_fanatic"
								days = -1
							}
						}
					}
				}
			}
		}
	}
}

#Proselytism 2, gives bonus while at war with war leader with different ethos.
country_event = {
	id = est_proselytism.4
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		has_active_tradition = tr_est_proselytism_2
	}
	
	immediate = {
		if = {
			limit = {
				any_war = {
					any_war_participant = {
						is_war_leader = yes
						is_at_war_with = root
						opposing_ethics_divergence = {
							steps > 1
							who = root
						}					
					}
				}							
			}
			if = {
				limit = {
					Not = {
						has_modifier = mod_est_proselytism_2
					}
				}
				add_modifier = {
					modifier = "mod_est_proselytism_2"
					days = -1
				}
			}	
		}			
		else = {
			if = {
				limit = {
					has_modifier = mod_est_proselytism_2
				}
				remove_modifier = "mod_est_proselytism_2"
			}
		}
	}
}

#Proselytism 3, removes recent conquered penalty when planet taken
planet_event = {
	id = est_proselytism.5
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		owner = {
			has_active_tradition = tr_est_proselytism_3
		}	
	}
	
	immediate = {
		every_owned_pop_group = {
			limit = {
				has_modifier = pop_recently_conquered
			}
			remove_modifier = "pop_recently_conquered"
		}
	}
}

#Proselytism 4, gives ethics attraction to subjects of those who have tradition.
country_event = {
	id = est_proselytism.6
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		has_active_tradition = tr_est_proselytism_4
	}
	
	immediate = {
			every_subject = {
				set_timed_country_flag = {
					flag = flag_est_just_got_mod_proselytism_4
					days = 1
				}
				if = {
					limit = {
						Not = {
							has_country_flag = flag_est_got_mod_proselytism_4						
						}
					}
					set_country_flag = flag_est_got_mod_proselytism_4
				}
				if = {
					limit = {
						prev = {
							has_ethic = ethic_authoritarian
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_authoritarian
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_authoritarian"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_authoritarian									
						}
						remove_modifier = "mod_est_proselytism_4_authoritarian"
					}
				}
				if = {
					limit = {
						prev = {
							has_ethic = ethic_fanatic_authoritarian
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_authoritarian_fanatic
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_authoritarian_fanatic"
							days = -1
						}
					}
				}	
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_authoritarian_fanatic								
						}
						remove_modifier = "mod_est_proselytism_4_authoritarian_fanatic"
					}
				}			
				if = {
					limit = {
						prev = {
							has_ethic = ethic_egalitarian
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_egalitarian
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_egalitarian"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_egalitarian									
						}
						remove_modifier = "mod_est_proselytism_4_egalitarian"
					}
				}
				if = {
					limit = {
						prev = {
							has_ethic = ethic_fanatic_egalitarian
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_egalitarian_fanatic
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_egalitarian_fanatic"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_egalitarian_fanatic								
						}
						remove_modifier = "mod_est_proselytism_4_egalitarian_fanatic"
					}
				}			
				if = {
					limit = {
						prev = {
							has_ethic = ethic_xenophobe
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_xenophobe
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_xenophobe"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_xenophobe									
						}
						remove_modifier = "mod_est_proselytism_4_xenophobe"
					}
				}
				if = {
					limit = {
						prev = {
							has_ethic = ethic_fanatic_xenophobe
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_xenophobe_fanatic
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_xenophobe_fanatic"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_xenophobe_fanatic								
						}
						remove_modifier = "mod_est_proselytism_4_xenophobe_fanatic"
					}
				}				
				if = {
					limit = {
						prev = {
							has_ethic = ethic_xenophile
						}
					}
					if = {
						limit = {
							Not = {
								has_modifier = mod_est_proselytism_4_xenophile
							}
						}
						add_modifier = {
							modifier = "mod_est_proselytism_4_xenophile"
							days = -1
						}
					}
				}
				else = {
					if = {
						limit = {
							has_modifier = mod_est_proselytism_4_xenophile									
						}
						remove_modifier = "mod_est_proselytism_4_xenophile"
					}
				}
				if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_xenophile
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_xenophile_fanatic
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_xenophile_fanatic"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_xenophile_fanatic								
					}
					remove_modifier = "mod_est_proselytism_4_xenophile_fanatic"
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_militarist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_militarist
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_militarist"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_militarist									
					}
					remove_modifier = "mod_est_proselytism_4_militarist"
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_militarist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_militarist_fanatic
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_militarist_fanatic"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_militarist_fanatic								
					}
					remove_modifier = "mod_est_proselytism_4_militarist_fanatic"
				}
			}				
			if = {
				limit = {
					prev = {
						has_ethic = ethic_pacifist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_pacifist
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_pacifist"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_pacifist									
					}
					remove_modifier = "mod_est_proselytism_4_pacifist"
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_pacifist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_pacifist_fanatic
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_pacifist_fanatic"
						days = -1
					}
				}
			}	
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_pacifist_fanatic								
					}
					remove_modifier = "mod_est_proselytism_4_pacifist_fanatic"
				}
			}			
			if = {
				limit = {
					prev = {
						has_ethic = ethic_materialist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_materialist
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_materialist"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_materialist									
					}
					remove_modifier = "mod_est_proselytism_4_materialist"
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_materialist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_materialist_fanatic
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_materialist_fanatic"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_materialist_fanatic								
					}
					remove_modifier = "mod_est_proselytism_4_materialist_fanatic"
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_spiritualist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_spiritualist
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_spiritualist"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_spiritualist									
					}
					remove_modifier = "mod_est_proselytism_4_spiritualist"
				}
			}
			if = {
				limit = {
					prev = {
						has_ethic = ethic_fanatic_spiritualist
					}
				}
				if = {
					limit = {
						Not = {
							has_modifier = mod_est_proselytism_4_spiritualist_fanatic
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_4_spiritualist_fanatic"
						days = -1
					}
				}
			}
			else = {
				if = {
					limit = {
						has_modifier = mod_est_proselytism_4_spiritualist_fanatic								
					}
					remove_modifier = "mod_est_proselytism_4_spiritualist_fanatic"
				}
			}
		}
	}
}

#Proselytism 4, removes the modifier from countries that should no longer have it.
country_event = {
	id = est_proselytism.7
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		has_country_flag = flag_est_got_mod_proselytism_4
		Not = {
			has_country_flag = flag_est_just_got_mod_proselytism_4
		}
	}

	immediate = {
		remove_country_flag = flag_est_got_mod_proselytism_4
		switch = {
			trigger = has_modifier 	
			mod_est_proselytism_4_authoritarian = {remove_modifier = "mod_est_proselytism_4_authoritarian"}
			mod_est_proselytism_4_authoritarian_fanatic = {remove_modifier = "mod_est_proselytism_4_authoritarian_fanatic"}
			mod_est_proselytism_4_egalitarian = {remove_modifier = "mod_est_proselytism_4_egalitarian"}
			mod_est_proselytism_4_egalitarian_fanatic = {remove_modifier = "mod_est_proselytism_4_egalitarian_fanatic"}
			mod_est_proselytism_4_xenophobe = {remove_modifier = "mod_est_proselytism_4_xenophobe"}
			mod_est_proselytism_4_xenophobe_fanatic = {remove_modifier = "mod_est_proselytism_4_xenophobe_fanatic"}
			mod_est_proselytism_4_xenophile = {remove_modifier = "mod_est_proselytism_4_xenophile"}
			mod_est_proselytism_4_xenophile_fanatic = {remove_modifier = "mod_est_proselytism_4_xenophile_fanatic"}
			mod_est_proselytism_4_militarist = {remove_modifier = "mod_est_proselytism_4_militarist"}
			mod_est_proselytism_4_militarist_fanatic = {remove_modifier = "mod_est_proselytism_4_militarist_fanatic"}
			mod_est_proselytism_4_pacifist = {remove_modifier = "mod_est_proselytism_4_pacifist"}
			mod_est_proselytism_4_pacifist_fanatic = {remove_modifier = "mod_est_proselytism_4_pacifist_fanatic"}
			mod_est_proselytism_4_materialist = {remove_modifier = "mod_est_proselytism_4_materialist"}
			mod_est_proselytism_4_materialist_fanatic = {remove_modifier = "mod_est_proselytism_4_materialist_fanatic"}
			mod_est_proselytism_4_spiritualist = {remove_modifier = "mod_est_proselytism_4_spiritualist"}
			mod_est_proselytism_4_spiritualist_fanatic = {remove_modifier = "mod_est_proselytism_4_spiritualist_fanatic"}
		}	
	}
}

#Proselytism 5, gives/removes/updates bonus when war is finishes.
country_event = {
	id = est_proselytism.8
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {	
		fromfrom = {
			any_war_participant = {
				has_active_tradition = tr_est_proselytism_5			
			}
		}
	}
	
	immediate = {
		fromfrom = {
			every_war_participant = {
				limit = {
					has_active_tradition = tr_est_proselytism_5
				}
				if = {
					limit = {
						has_modifier = mod_est_proselytism_5
					}
					remove_modifier = "mod_est_proselytism_5"
				}	
				if = {
					limit = {
						fromfrom = {
							is_war_participant = {
								who = prev
								side = Root
							}					
						}
					}
					add_modifier = {
						modifier = "mod_est_proselytism_5"
						days = 3600
					}
				}
			}
		}
	}
}