provence_missions_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Emperor"
	}
	potential = {
		tag = PRO
		NOT = { map_setup = map_setup_random }
		has_dlc = "Emperor"
	}
	has_country_shield = yes
	
	emp_pro_aragon = {
		icon = king_of_aragon
		required_missions = { emp_pro_naples }
		position = 3
		provinces_to_highlight = {
			OR = {
				area = aragon_area
				area = catalonia_area
				area = valencia_area
				area = baleares_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				ARA = {
					is_subject_of = ROOT
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 15
					OR = {
						area = aragon_area
						area = catalonia_area
						area = valencia_area
						area = baleares_area
					}
				}
			}
		}
		effect = {
			add_dip_power = 200
			if = {
				limit = {
					exists = HUN
					valid_for_personal_unions_trigger = yes
					HUN = {
						valid_for_personal_unions_trigger = yes
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 1200
					target = HUN
				}
			}
			else = {
				slovakia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				transdanubia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				alfold_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		}
	}
	emp_pro_hungary = {
		icon = king_of_hungary
		required_missions = { emp_pro_aragon }
		position = 4
		provinces_to_highlight = {
			OR = {
				area = transdanubia_area
				area = alfold_area
				area = slovakia_area
				area = transylvania_area
				area = southern_transylvania_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				HUN = {
					is_subject_of = ROOT
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 15
					OR = {
						area = transdanubia_area
						area = alfold_area
						area = slovakia_area
						area = transylvania_area
						area = southern_transylvania_area
					}
				}
			}		
		}
		effect = {
			add_country_modifier = {
				name = "pro_king_of_hungary"
				duration = 7300
			}
		}
	}
}

provence_missions_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Emperor"
	}
	potential = {
		tag = PRO
		NOT = { map_setup = map_setup_random }
		has_dlc = "Emperor"
	}
	has_country_shield = yes
	
	emp_pro_corsica = {
		icon = rule_corsica
		required_missions = {  }
		provinces_to_highlight = {
			province_id = 1247
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				1247 = {
					owned_by = ROOT
				}
				total_development = 100
			}
		}
		effect = {
			if = {
				limit = {
					exists = NAP
					valid_for_personal_unions_trigger = yes
					NAP = {
						valid_for_personal_unions_trigger = yes
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 1200
					target = NAP
				}
			}
			else = {
				naples_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
				calabria_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
				apulia_area = {
					limit = {
						NOT = { is_core = ROOT }
					}
					add_core = ROOT
				}
				120 = {
					if = {
						limit = {
							NOT = { is_core = ROOT }
						}
						add_core = ROOT
					}
				}
			}
			corsica_sardinia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	emp_pro_naples = {
		icon = king_of_naples
		required_missions = { emp_pro_corsica }
		provinces_to_highlight = {
			OR = {
				area = naples_area
				area = calabria_area
				area = apulia_area
				province_id = 120
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				NAP = {
					is_subject_of = ROOT
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 8
					OR = {
						area = naples_area
						area = calabria_area
						area = apulia_area
						province_id = 120
					}
				}
			}
		}
		effect = {
			if = {	
				limit = {
					NOT = { government_rank = 2 }
					is_part_of_hre = no
				}
				set_government_rank = 2
			}
			sicily_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			western_sicily_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					exists = ARA
					valid_for_personal_unions_trigger = yes
					ARA = {
						valid_for_personal_unions_trigger = yes
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 1200
					target = ARA
				}
			}
			else = {
				aragon_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				catalonia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				valencia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
		}
	}
	emp_pro_sicily = {
		icon = king_of_sicily
		required_missions = { emp_pro_naples }
		provinces_to_highlight = {
			OR = {
				area = sicily_area
				area = western_sicily_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				OR = {
					area = sicily_area
					area = western_sicily_area
				}
			}
		}
		effect = {
			palestine_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			syria_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			trans_jordan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	emp_pro_jerusalem = {
		icon = jerusalem
		required_missions = { emp_pro_sicily }
		provinces_to_highlight = {
			OR = {
				area = palestine_area
				area = syria_area
				area = trans_jordan_area
			}
			OR = {
				AND = {
					NOT = { province_id = 379 }
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				AND = {
					province_id = 379
					NOT = { owned_by = ROOT }
				}
			}
		}
		trigger = {
			owns = 379
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				OR = {
					area = palestine_area
					area = syria_area
					area = trans_jordan_area
				}
			}
		}
		effect = {
			if = {
				limit = {
					religion = catholic
				}
				country_event = { id = knights_missions.2 }
			}
			else = {
				add_prestige = 50
			}
		}
	}
	emp_pro_king_of_kings = {
		icon = king_of_kings
		required_missions = { emp_pro_hungary emp_pro_jerusalem emp_pro_join_the_empire emp_pro_france }
		provinces_to_highlight = {
		}
		position = 5
		trigger = {
			total_own_and_non_tributary_subject_development = 1000
		}
		effect = {
			if = {	
				limit = {
					NOT = { government_rank = 3 }
				}
				set_government_rank = 3
			}
			add_country_modifier = {
				name = "pro_king_of_kings"
				duration = -1
			}
		}
	}
}

provence_missions_3 = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Emperor"
	}
	potential = {
		tag = PRO
		NOT = { map_setup = map_setup_random }
		has_dlc = "Emperor"
	}
	has_country_shield = yes

	emp_pro_lorraine = {
		icon = integrate_lorraine
		required_missions = {  }
		position = 3
		provinces_to_highlight = {
			province_id = 189
			NOT = { owned_by = ROOT }
		}
		trigger = {
			189 = {
				owned_by = ROOT
			}
		}
		effect = {
			remove_country_modifier = annexers_legacy
			add_country_modifier = {
				name = "pro_lorraine_modifier"
				duration = 7300
			}
		}
	}
	emp_pro_join_the_empire = {
		icon = join_the_empire
		required_missions = { emp_pro_lorraine }
		provinces_to_highlight = {
		}
		trigger = {
			OR = {
				is_part_of_hre = yes
				is_emperor = yes
				NOT = { hre_size = 1 }
			}
		}
		effect = {
			add_country_modifier = {
				name = "pro_imperial_diplomacy"
				duration = 7300
			}
		}
	}
}

provence_missions_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Emperor"
	}
	potential = {
		tag = PRO
		NOT = { map_setup = map_setup_random }
		has_dlc = "Emperor"
	}
	has_country_shield = yes
		
	emp_pro_avignon = {
		icon = negotiate_for_avignon
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				province_id = 202
				AND = {
					owned_by = PAP
					PAP = { ai = yes}
				}
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			if = {
				limit = {
					PAP = { ai = yes }
				}
				OR = {
					owns_core_province = 202
					AND = {
						PAP = {
							has_opinion = {
								who = ROOT
								value = 150
							}
							owns = 202
						}
						202 = { is_capital = no controlled_by = PAP }
					}
				}
			}
			else = {
				owns_core_province = 202
			}
		}
		effect = {
			if = {
				limit = {
					202 = { is_capital = no controlled_by = PAP }
					PAP = {
						has_opinion = {
							who = ROOT
							value = 100
						}
						owns = 202
						ai = yes
					}
				}
				custom_tooltip = pro_avignon_tt_2
				hidden_effect = {
					PAP = { country_event = { id = emp_mission_events.1 } }
				}
			}
			else_if = {
				limit = {
					PAP = { owns = 202 }
					PAP = { ai = yes }
					NOT = {
						PAP = {
							has_opinion = {
								who = ROOT
								value = 100
							}
						}
					}
				}
				custom_tooltip = pro_avignon_tt
			}
			guyenne_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			languedoc_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			massif_central_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			savoy_dauphine_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			pyrenees_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	emp_pro_occitania = {
		icon = mission_invade_occitania
		required_missions = { emp_pro_avignon }
		provinces_to_highlight = {
			OR = {
				area = provence_area
				area = guyenne_area
				area = languedoc_area
				area = massif_central_area
				area = savoy_dauphine_area
				area = pyrenees_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 20
				OR = {
					area = provence_area
					area = guyenne_area
					area = languedoc_area
					area = massif_central_area
					area = savoy_dauphine_area
					area = pyrenees_area
				}
			}
		}
		effect = {
			france_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	emp_pro_france = {
		icon = king_of_france
		required_missions = { emp_pro_occitania }
		position = 4
		provinces_to_highlight = {
			region = france_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			OR = {
				tag = FRA
				FRA = { is_subject_of = ROOT }
				france_region = {
					type = all
					NOT = { owned_by = FRA }
				}
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 30
				region = france_region
			}
		}
		effect = {
			add_country_modifier = {
				name = "pro_king_of_france"
				duration = 7300
			}
		}
	}
}

provence_missions_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Emperor"
	}
	potential = {
		tag = PRO
		NOT = { map_setup = map_setup_random }
		has_dlc = "Emperor"
	}
	has_country_shield = yes
	
	emp_pro_arts = {
		icon = sponsor_the_arts
		required_missions = {  }
		provinces_to_highlight = {
		}
		trigger = {
			has_institution = renaissance
			num_of_owned_provinces_with = {
				value = 3
				has_tax_building_trigger = yes
			}
		}
		effect = {
			capital_scope = {
				add_base_tax = 1
				add_base_production	= 1
				add_base_manpower = 1
				add_province_modifier = {
					name = "pro_renaissance"
					duration = 7300
				}
			}
		}
	}
	emp_pro_marseille = {
		icon = develop_provence
		required_missions = { emp_pro_arts }
		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 201
					OR = {
						NOT = { owned_by = ROOT }
						development = 30
					}
				}
				AND = {
					area = provence_area
					OR = {
						NOT = { owned_by = ROOT }
						development = 15
					}
				}
			}
		}
		trigger = {
			201 = {
				development = 30
				owned_by = ROOT
			}
			num_of_owned_provinces_with = {
				area = provence_area
				value = 3
				development = 15
			}
		}
		effect = {
			201 = {
				change_province_name = "Marseille"
				rename_capital = "Marseille"
				add_province_modifier = {
					name = "pro_marseille"
					duration = -1
				}
			}
		}
	}
	emp_pro_toulon = {
		icon = toulon_dockyards
		required_missions = { emp_pro_marseille }
		provinces_to_highlight = {
			province_id = 4696
			OR = {
				has_shipyard_building_trigger = no
				NOT = { owned_by = ROOT }
			}
		}
		trigger = {
			4696 = {
				has_shipyard_building_trigger = yes
				owned_by = ROOT
			}
			navy_size_percentage = 1
		}
		effect = {
			4696 = {
				add_province_modifier = {
					name = "toulon_dockyards"
					duration = -1
				}
			}
		}
	}
	emp_pro_la_marseillaise = {
		icon = la_marseillaise
		required_missions = { emp_pro_toulon }
		provinces_to_highlight = {
		}
		trigger = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				army_professionalism = 90
			}
			else = {
				army_tradition = 90
			}
		}
		effect = {
			if = {
				limit = {
					has_dlc = "Cradle of Civilization"
				}
				add_country_modifier = {
					name = "pro_la_marseillaise"
					duration = -1
				}
			}
			else = {
				add_country_modifier = {
					name = "pro_la_marseillaise_2"
					duration = -1
				}
			}
		}
	}
}