namespace = plentiful_traditions_affinity

event = {
	id = plentiful_traditions_affinity.1
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = {
				has_tradition = tr_plentiful_affinity_2
			}
			if = {
				limit = {
					is_at_war = no
				}
				if = {
					limit = {
						Not = {
							has_modifier = modifier_plentiful_traditions_empathetic
						}
					}
				}
				add_modifier = {
					modifier = "modifier_plentiful_traditions_empathetic"
				}
				else = {
					if = {
						limit = {
							has_modifier = modifier_plentiful_traditions_empathetic
						}
					}
					remove_modifier = "modifier_plentiful_traditions_empathetic"
				}
			}
		}
	}
}

event = {
	id = plentiful_traditions_affinity.2
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = {
				has_tradition = tr_plentiful_affinity_finish
			}
			every_owned_colony = {
				if = {
					limit = { num_species < 3 }
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 3 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united1 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united1" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 4 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united2 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united2" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 5 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united3 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united3" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 6 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united4 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united4" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 7 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united5 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united5" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 8 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united6 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united6" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 9 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united7 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united7" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 10 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united8 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united8" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species = 11 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united9 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united9" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united10 }
						remove_modifier = "modifier_plentiful_traditions_united10"
					}
				}
				if = {
					limit = { num_species > 11 }
					if = {
						limit = {
							Not = { has_modifier = modifier_plentiful_traditions_united10 }
						}
						add_modifier = { modifier = "modifier_plentiful_traditions_united10" }
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united1 }
						remove_modifier = "modifier_plentiful_traditions_united1"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united2 }
						remove_modifier = "modifier_plentiful_traditions_united2"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united3 }
						remove_modifier = "modifier_plentiful_traditions_united3"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united4 }
						remove_modifier = "modifier_plentiful_traditions_united4"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united5 }
						remove_modifier = "modifier_plentiful_traditions_united5"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united6 }
						remove_modifier = "modifier_plentiful_traditions_united6"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united7 }
						remove_modifier = "modifier_plentiful_traditions_united7"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united8 }
						remove_modifier = "modifier_plentiful_traditions_united8"
					}
					if = {
						limit = { has_modifier = modifier_plentiful_traditions_united9 }
						remove_modifier = "modifier_plentiful_traditions_united9"
					}
				}
			}
		}
	}
}

event = {
	id = plentiful_traditions_affinity.3
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_country = {
			limit = {
				has_tradition = tr_plentiful_affinity_4
			}
			if = {
				limit = {
					is_at_war = no
				}
				if = {
					limit = {
						Not = {
							has_modifier = modifier_plentiful_traditions_pathfinder
						}
					}
				}
				add_modifier = {
					modifier = "modifier_plentiful_traditions_pathfinder"
				}
				else = {
					if = {
						limit = {
							has_modifier = modifier_plentiful_traditions_pathfinder
						}
					}
					remove_modifier = "modifier_plentiful_traditions_pathfinder"
				}
			}
		}
	}
}