decisions = {

#Unir les Pays-Bas
#Former la Prusse
#Former l'Union de Kalmar
#Former la Hesse
#Former l'Ukraine
#Former l'Autriche Hongrie
#Revendiquer les armoiries françaises
#Usurper le pouvoir du conseil
#Artéfact Décisions
#Restaurer l'Empire romain d'Occident
#Croisade
#République Marchande
#Palefrenier

#################################
####### Unir les Pays-Bas #######
#################################

	unite_netherlands = {
		is_high_prio = yes
		
		potential = {
			independent = yes
			is_female = no
			OR = {
				ai = yes
				AND = {
					capital_scope = { port = yes }
					has_dlc = "The Republic"
				}
			}
			OR = {
				has_landed_title = d_holland
				completely_controls = d_holland
			}
			k_netherlands = {
				has_holder = no
			}
			k_republic_netherlands = {
				has_holder = no
			}
			culture = dutch
			is_feudal = yes
			NOT = { tier = EMPEROR }
		}
		
		allow = {
			culture = dutch
			OR = {
				has_landed_title = d_holland
				completely_controls = d_holland
			}
			OR = {
				has_landed_title = d_gelre
				completely_controls = d_gelre
			}
		}
		
		effect = {
			primary_title = { save_event_target_as = primary_title_target_b }
			set_character_flag = is_founding_character
			narrative_event = { id = RIPMOD.2 }
		}
			
		ai_will_do = {
			factor = 0.5 # On average ca 1 year before taken
			modifier = {
				factor = 2.0
				stewardship = 10
			}
			modifier = {
				factor = 2.0
				is_republic = yes
			}
		}
	}
	
################################
####### Former la Prusse #######
################################

	form_prussia = {
		is_high_prio = yes
		
		potential = {
			OR = {
				AND = {
					religion_group = christian
					OR = {
						culture = german
						culture = new_prussian
						culture = silesian
					}
				}
				OR = {
					has_landed_title = k_teutonic_state
					has_landed_title = d_teutonic_order
				}
			}
			OR = {
				has_landed_title = d_prussia
				completely_controls = d_prussia
				OR = {
					d_prussia = { de_facto_liege_title = k_teutonic_state }
					d_prussia = { de_facto_liege_title = d_teutonic_order }
				}
			}
			independent = yes
			k_prussia = {
				has_holder = no
			}
			is_feudal = yes
			NOT = { tier = EMPEROR }
		}
		
		allow = {
			OR = {
				AND = {
					OR = {
						has_landed_title = d_prussia
						completely_controls = d_prussia
					}
					OR = {
						has_landed_title = d_kuyavia
						completely_controls = d_kuyavia
					}
					OR = {
						has_landed_title = d_greater_poland
						completely_controls = d_greater_poland
					}
					OR = {
						has_landed_title = d_pomeralia
						completely_controls = d_pomeralia
					}
					OR = {
						has_landed_title = d_pommerania
						completely_controls = d_pommerania
					}
				}
				AND = {
					OR = {
						has_landed_title = d_prussia
						completely_controls = d_prussia
						OR = {
							d_prussia = { de_facto_liege_title = k_teutonic_state }
							d_prussia = { de_facto_liege_title = d_teutonic_order }
						}
					}
					OR = {
						has_landed_title = k_teutonic_state
						has_landed_title = d_teutonic_order
					}
				}
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = k_prussia_formed
			set_character_flag = is_founding_character
			primary_title = {
				show_scope_change = no
				k_prussia = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
				}
			}
			
			hidden_tooltip = {
				d_prussia = {
					de_jure_liege = k_prussia
				}
				d_kuyavia = {
					de_jure_liege = k_prussia
				}
				d_greater_poland = {
					de_jure_liege = k_prussia
				}
				d_pomeralia = {
					de_jure_liege = k_prussia
				}
				d_pommerania = {
					de_jure_liege = k_prussia
				}
				if = {
					limit = {
						e_hre = {
							has_holder = yes
						}
						e_hre = {
							holder_scope = {
								culture = german
							}
						}
					}
					k_prussia = {
						de_jure_liege = e_hre
					}
				}
				if = {
					limit = {
						NOT = {
							AND = {
								e_hre = {
									has_holder = yes
								}
								e_hre = {
									holder_scope = {
										culture = german
									}
								}
							}
						}
					}
					k_prussia = {
						de_jure_liege = e_germany
					}
				}
			}
			
			ROOT = { narrative_event = { id = RIPMOD.3 } }
			any_playable_ruler = {
		        limit = {
		            is_within_diplo_range = ROOT
					ai = no
		        }
		        narrative_event = { id = RIPMOD.3 }
		    }
		}
			
		ai_will_do = {
			factor = 1
		}
	}

########################################
####### Former l'Union de Kalmar #######
########################################

	form_kalmar_union = {
		is_high_prio = yes
		
		potential = {
			primary_title = { title = k_denmark }
			culture = danish
			e_kalmar_union = {
				has_holder = no
			}
			is_feudal = yes
		}
		
		allow = {
			ruled_years = 10
			war = no
			prisoner = no
			ROOT = {
				has_regent = no
			}
			OR = {
				has_landed_title = k_sweden
				completely_controls = k_sweden
			}
			OR = {	
				has_landed_title = k_norway
				completely_controls = k_norway
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = e_kalmar_union_formed
			set_character_flag = is_founding_character
			primary_title = {
				show_scope_change = no
				e_kalmar_union = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
				}
			}
			
			ROOT = { narrative_event = { id = RIPMOD.4 } }
			any_playable_ruler = {
		        limit = {
		            is_within_diplo_range = ROOT
					ai = no
		        }
		        narrative_event = { id = RIPMOD.4 }
		    }
		}

		ai_will_do = {
			factor = 1
		}
	}

###############################
####### Former la Hesse #######
###############################

	form_hesse = {
		is_high_prio = yes
		
		potential = {
			religion_group = christian
			OR = {
				culture = german
				culture = hessian
			}
			OR = {
				has_landed_title = d_baden
				completely_controls = d_baden
			}
			
			independent = yes
			k_hesse = {
				has_holder = no
			}
			is_feudal = yes
		}
		
		allow = {
			OR = {
				has_landed_title = d_baden
				completely_controls = d_baden
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = k_hesse_formed
			set_character_flag = is_founding_character
			primary_title = {
				show_scope_change = no
				k_hesse = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
				}
			}
			hidden_tooltip = {
				d_baden = {
					de_jure_liege = k_hesse
				}
				if = {
					limit = {
						e_hre = {
							has_holder = yes
						}
						e_hre = {
							holder_scope = {
								culture = german
							}
						}
					}
					k_hesse = {
						de_jure_liege = e_hre
					}
				}
				if = {
					limit = {
						NOT = {
							AND = {
								e_hre = {
									has_holder = yes
								}
								e_hre = {
									holder_scope = {
										culture = german
									}
								}
							}
						}
					}
					k_hesse = {
						de_jure_liege = e_germany
					}
				}
			}
			
			ROOT = { narrative_event = { id = RIPMOD.6 } }
		}

		ai_will_do = {
			factor = 0
		}
	}

################################
####### Former l'Ukraine #######
################################

	form_ukraine = {
		is_high_prio = yes
		
		potential = {
			OR = {
				culture = russian
				culture = ukrainian
			}
			OR = {
				has_landed_title = d_kiev
				completely_controls = d_kiev
			}
			independent = yes
			k_ukraine = {
				has_holder = no
			}
			is_feudal = yes
			NOT = { tier = EMPEROR }
		}
		
		allow = {
			calc_true_if = {
			    amount >= 3
			    OR = {
					has_landed_title = d_kiev
					completely_controls = d_kiev
				}
				OR = {
					has_landed_title = d_crimea
					completely_controls = d_crimea
				}
				OR = {
					has_landed_title = d_pereyaslavl
					completely_controls = d_pereyaslavl
				}
				OR = {
					has_landed_title = d_cherson
					completely_controls = d_cherson
				}
				OR = {
					has_landed_title = d_sarkel
					completely_controls = d_sarkel
				}
				OR = {
					has_landed_title = d_azov
					completely_controls = d_azov
				}
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = k_ukraine_formed
			set_character_flag = is_founding_character
			primary_title = {
				show_scope_change = no
				k_ukraine = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
				}
			}
			hidden_tooltip = {
				k_ukraine = {
					de_jure_liege = e_russia
				}
				d_kiev = {
					de_jure_liege = k_ukraine
				}
				d_crimea = {
					de_jure_liege = k_ukraine
				}
				d_pereyaslavl = {
					de_jure_liege = k_ukraine
				}
				d_cherson = {
					de_jure_liege = k_ukraine
				}
				d_sarkel = {
					de_jure_liege = k_ukraine
				}
				d_azov = {
					de_jure_liege = k_ukraine
				}
			}
			
			ROOT = { narrative_event = { id = RIPMOD.7 } }
			any_playable_ruler = {
		        limit = {
		            is_within_diplo_range = ROOT
					ai = no
		        }
		        narrative_event = { id = RIPMOD.7 }
		    }
		}
	
		ai_will_do = {
			factor = 1
		}
	}
	
#########################################
####### Former l'Autriche Hongrie #######
#########################################

	form_austria_hungary = {
		is_high_prio = yes
		
		potential = {
			religion_group = christian
			OR = {
				culture = german
				culture = hungarian
				culture = austrian
			}
			OR = {
				has_landed_title = k_austria
				has_landed_title = k_hungary
			}
			e_austria_hungary = {
				has_holder = no
			}
			is_feudal = yes
		}
		
		allow = {
			tier = KING
			ruled_years = 10
			independent = yes
			has_landed_title = k_austria
			has_landed_title = k_hungary
			e_hre = {
				has_holder = no
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = e_austria_hungary_formed
			set_character_flag = is_founding_character
			primary_title = {
				show_scope_change = no
				e_austria_hungary = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
				}
			}
			hidden_tooltip = {
				k_austria = {
					de_jure_liege = e_austria_hungary
				}
				k_hungary = {
					de_jure_liege = e_austria_hungary
				}
			}
			
			ROOT = { narrative_event = { id = RIPMOD.5 } }
			any_playable_ruler = {
		        limit = {
		            is_within_diplo_range = ROOT
					ai = no
		        }
		        narrative_event = { id = RIPMOD.5 }
		    }
		}
	
		ai_will_do = {
			factor = 1
		}
	}
	
####################################################
####### Revendiquer les armoiries françaises #######
####################################################
	
	claim_french_throne = {
		is_high_prio = yes
	
		potential = {
			religion_group = christian
			has_landed_title = k_england
			OR = {
				has_claim = k_france
				completely_controls = k_france
				has_landed_title = k_france
			}
			NOT = {
				has_global_flag = england_france_coa
			}
			ROOT = {
				NOT = {
					has_character_flag = restore_england_coa
				}
			}
			OR = {
				culture = norman
				culture = english
				culture = saxon
				culture = frankish
			}
			is_feudal = yes
		}
		
		allow = {
			war = no
			prisoner = no
			ROOT = {
				has_regent = no
			}
			hidden_tooltip = {
				NOT = {
					ROOT = {
						has_character_flag = event_pause
					}
				}
			}
		}
		
		effect = {
			prestige = 500
			narrative_event = { id = RIPMOD.8 }
			hidden_tooltip = {
				set_character_flag = event_pause
			}
		}
	
		ai_will_do = {
			factor = 1
		}
	}
	
	restore_england_coa = {
		is_high_prio = yes
		
		potential = {
			has_landed_title = k_england
			has_global_flag = england_france_coa
			ROOT = {
				NOT = {
					has_character_flag = changed_england_coa
				}
			}
		}
		
		allow = {
			war = no
			prisoner = no
			ROOT = {
				has_regent = no
			}
			NOT = { has_landed_title = k_france }
			hidden_tooltip = {
				NOT = {
					ROOT = {
						has_character_flag = event_pause
					}
				}
			}
		}
		
		effect = {
			prestige = 250
			narrative_event = { id = RIPMOD.9}
			hidden_tooltip = {
				set_character_flag = event_pause
			}
		}
	
		ai_will_do = {
			factor = 1
		}
	}
	
#############################################
####### Usurper le pouvoir du conseil #######
#############################################
	
	usurp_council_power = {
		ai_check_interval = 12
		
		is_high_prio = yes
		only_playable = yes
		
		potential = {
			NOR = {
				any_courtier_or_vassal = {
					has_job_title = job_chancellor
					liege = {
						character = ROOT
					}
				}
				any_courtier_or_vassal = {
					has_job_title = job_marshal
					liege = {
						character = ROOT
					}
				}
				any_courtier_or_vassal = {
					has_job_title = job_treasurer
					liege = {
						character = ROOT
					}
				}
				any_courtier_or_vassal = {
					has_job_title = job_spiritual
					liege = {
						character = ROOT
					}
				}
				any_courtier_or_vassal = {
					has_job_title = job_spymaster
					liege = {
						character = ROOT
					}
				}
			}
			OR = {
				has_law = law_voting_power_1
				has_law = banish_voting_power_1
				has_law = revoke_title_voting_power_1
				has_law = grant_title_voting_power_1
				has_law = imprison_voting_power_1
				has_law = execution_voting_power_1
				has_law = war_voting_power_1
			}

			is_playable = yes
		}
		
		allow = {
			OR = {
				trait = deceitful
				trait = schemer
				intrigue = 15
				martial = 15
				diplomacy = 15
			}
			NOR = {
				trait = dull
				trait = inbred
				trait = incapable
				trait = slow
				trait = imbecile
			}
		}
		
		effect = {
			character_event = { id = USRP.01 }
		}
		
		ai_will_do = {
			factor = 0.3
		}
	}
	
##################################
####### Artéfact Décisions #######
##################################

	rebuild_sampo = {
		ai_check_interval = 24
		
		only_playable = yes
		is_high_prio = yes
		
		potential = {
			religion_openly_finnish_or_reformed_trigger = yes
			NOT = { has_global_flag = sampo_rebuilt }
		}
		
		allow = {
			wealth = 1000
			prestige = 500
			piety = 250
			custom_tooltip = {
				text = rebuild_sampo_allow
				any_artifact = {
					artifact_type = sampo_fragment
					count = 9
				}
			}	
		}
		
		effect = {
			wealth = -1000
			hidden_tooltip = {
				set_global_flag = sampo_rebuilt
				narrative_event = {id = RIPMOD.22 months = 6 } 
				any_artifact = {
					limit = { artifact_type = sampo_fragment }
					destroy_artifact = yes
				}
			}
		}
		
		ai_will_do = {factor = 1}
	}
	
	forge_meteorite = {
		ai_check_interval = 24
		
		only_playable = yes
		is_high_prio = yes
		
		potential = {
			NOT = { has_global_flag = skai_unav_found }
			OR = {
				religion_openly_tengri_or_reformed_trigger = yes
				culture_group = altaic
			}
			has_artifact = meteorite
		}
		
		allow = {
			prestige = 500
			wealth = 300
			learning = 8
			martial = 18
			has_artifact = meteorite		
		}
		
		effect = {
			wealth = -300
			hidden_tooltip = {
				set_global_flag = skai_unav_found
				character_event = { id = RIPMOD.21 days = 10 }
			}
			random_artifact = {
				limit = { artifact_type = meteorite }
				destroy_artifact = yes
			}
		}
		
		ai_will_do = {factor = 1}
	}

	carve_out_eye = {
		only_playable = yes
		is_high_prio = yes
		
		potential = {
			has_artifact = odins_eye
			NOT = { trait = one_eyed } 
		}
		allow = {
			is_adult = yes
			NOR = {
				trait = wounded
				trait = severely_injured
			}
		}
		effect = { 
			add_trait = one_eyed
			add_trait_severely_injured_effect = yes
			give_nickname = nick_the_son_of_odin
		}
		ai_will_do = { factor = 1 }
		ai_check_interval = 24
	}

	open_pandoras_box = {
		ai_check_interval = 24
		
		only_playable = yes
		is_high_prio = yes
		
		potential = { has_artifact = pandoras_box }
		
		allow = {
			custom_tooltip = {
				text = open_pandoras_box_allow1
				any_artifact = {
					artifact_type = pandoras_box
					is_artifact_active = yes
				}
			}	
			war = no
			is_incapable = no
			custom_tooltip = {
				text = open_pandoras_box_allow2
				NOT = { has_character_modifier = open_pandoras_box_timer }
			}
		}
		
		effect = {
			custom_tooltip = { 
				text = open_pandoras_box_effect
				add_character_modifier = { modifier = open_pandoras_box_timer years = 5 hidden = yes }
				random_list = {
					20 = { character_event = { id = RIPMOD.16 days = 3 } }
					20 = {
						trigger = {
							demesne_size >= 3
							NOT = { any_demesne_province = { has_disease = yes } }
						}
						character_event = { id = RIPMOD.17 days = 3 } 
					}
					20 = { 
						trigger = {
							any_child = { 
								is_alive = yes 
								age < 12 
								OR = {
									is_female = no
									AND = {
										is_female = yes
										ROOT = { 
											OR = {
												has_law = cognatic_succession
												has_law = true_cognatic_succession
											}
										}
									}
								}
							}
						}
						character_event = { id = RIPMOD.18 days = 3 }
					}
					5 = { character_event = { id = RIPMOD.20 days = 3 } }
				}
			}
		}
		
		ai_will_do = { 
			factor = 0.5 
			modifier = { 
				factor = 0.5
				tier = king
			}
			modifier = { 
				factor = 0.25
				tier = emperor
			}
		}
	}
	
	fragments_search = {
	
		only_playable = yes
		is_high_prio = yes
		ai = no
		
		potential = {
			religion_openly_finnish_or_reformed_trigger = yes
			NOR = { 
				has_global_flag = sampo_rebuilt
				check_variable = { which = global_sampo_fragment value = 9 }
			}
		}
		
		allow = {
			is_adult = yes
			is_incapable = no
			prisoner = no
			custom_tooltip = {
				text = custom_fragments_search_allow
				NOT = { has_character_flag = searched_fragments }
			}
		}
		
		effect = {
			hidden_tooltip = {
				set_character_flag = searched_fragments
				character_event = { id = artefact.18 days = 2 }
			}
		}
	}
	
	ai_fragments_search = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 24
		
		potential = {
			ai = yes
			religion_openly_finnish_or_reformed_trigger = yes
			NOT = { 
				has_global_flag = sampo_rebuilt
				check_variable = { which = global_sampo_fragment value = 9 }
			}	
		}
		
		allow = {
			is_adult = yes
			is_incapable = no
			prisoner = no
			custom_tooltip = {
				text = custom_fragments_search_allow
				NOT = { has_character_flag = searched_fragments }
			}
			higher_tier_than = COUNT
			OR = {
				trait = greedy
				trait = ambitious
				trait = envious
			}
			NOT = { trait = content }
			OR = {
				diplomacy = 8
				learning = 8
				martial = 8
				intrigue = 8
				stewardship = 8
			}
		}
		
		effect = {
			hidden_tooltip = {
				set_character_flag = searched_fragments
				character_event = { id = artefact.18 days = 2 }
			}
		}
		
		ai_will_do = { factor = 1 }
	}
	
	african_blessing = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 24
	
		potential = {
			religion_openly_west_african_or_reformed_trigger = yes
			d_west_african_pagan_reformed = { has_holder = yes }
			is_landed = yes
			NOT = { has_landed_title = d_west_african_pagan_reformed }
		}
		
		allow = {
			piety = 100
			d_west_african_pagan_reformed = {
				show_scope_change = no
				holder_scope = {
					opinion = { who = ROOT value = 0 }
				}
			}
			custom_tooltip = {
				text = custom_african_blessing_allow
				NOT = { has_character_flag = requested_african_blessing }
			}
		}
		
		effect = {
			custom_tooltip = {
				text = custom_african_blessing_effect
				d_west_african_pagan_reformed = {
					holder_scope = {
						character_event = {id = artefact.11 days = 10}
					}
				}
				set_character_flag = requested_african_blessing
			}	
		}
		
		ai_will_do = { factor = 1 }
	}
	
	become_herald_of_zun = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 24
		
		potential = {
			religion_openly_zun_or_reformed_trigger = yes
			NOT = { has_global_flag = herald_of_zun_declared }
		}
		
		allow = {
			independent = yes
			religion_authority = 0.75
			realm_size = 150
			custom_tooltip = {
				text = become_herald_of_zun_allow
				any_vassal = {
					OR = {
						religion = zun_pagan
						religion = zun_pagan_reformed
					}
				}
			}
		}
		
		effect = {
			set_global_flag = herald_of_zun_declared
			add_trait = herald_of_zun
			prestige = 500
			piety = 500
			hidden_tooltip = {
				character_event = { id = artefact.37 days = 10 }
			}
		}
		
		ai_will_do = { factor = 1 }
	}
	
	open_jerusalem = {
		only_playable = yes
		is_high_prio = yes
		ai_check_interval = 24
		
		potential = {
			religion = jewish
			completely_controls = c_jerusalem
			NOT = { has_character_flag = opened_jerusalem }
		}
		
		allow = {
			completely_controls = d_jerusalem
			NOT = { trait = zealous }
			piety = 250
			war = no
			independent = yes
		}
		
		effect = {
			piety = -250
			custom_tooltip = {
				text = open_jerusalem_effect
				set_character_flag = opened_jerusalem
				character_event = { id = artefact.44 }
			}
		}
		
		ai_will_do = { factor = 1 }
	}
	
	jerusalem_change_pilgrims = {
		only_playable = yes
		ai = no
		
		potential = { has_character_flag = opened_jerusalem }
		
		allow = {
			piety = 100
			war = no
		}
		
		effect = {
			piety = -100
			custom_tooltip = {
				text = jerusalem_change_pilgrims_effect
				character_event = {id = artefact.44 }
			}
		}
	}
	
####################################################
####### Restaurer l'Empire romain d'Occident #######
####################################################

	restore_western_roman_empire = {
		is_high_prio = yes
		ai_check_interval = 24
		
		potential = {
			independent = yes
			is_playable = yes
			has_dlc = "Legacy of Rome"
			OR = {
				religion_group = christian
				religion = hellenic_pagan
				religion = hellenic_pagan_reformed
			}
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
			NOT = { has_global_flag = western_roman_empire_restored }
			NOR = {
				has_alternate_start_parameter = { key = religion_names value = random }
			}
			NOT = { has_landed_title = k_papal_state }
		}
		allow = {
			prestige = 3500
			realm_size = 350
			custom_tooltip = {
			    text = roman_empire_custom_text
			    calc_true_if = {
			        amount >= 7
			        #France
			    	completely_controls = d_valois
			    	completely_controls = d_burgundy
			    	completely_controls = d_aquitaine
			        completely_controls = d_provence
			        #Espagne
			    	completely_controls = d_valencia
			    	completely_controls = d_castilla
			    	completely_controls = d_sevilla
			        completely_controls = d_porto
			        #Italie
			    	completely_controls = d_ferrara
			    	completely_controls = d_lombardia
			    	completely_controls = d_sicily
			        completely_controls = d_apulia
			        #Afrique
			    	completely_controls = d_tunis
			    	completely_controls = d_alexandria
			        completely_controls = d_jerusalem
			    }
			}
		}
		
		effect = {
			prestige = 1000
			set_global_flag = western_roman_empire_restored
			primary_title = {
				show_scope_change = no
				e_western_roman_empire = {
					show_scope_change = no
					grant_title = ROOT
					copy_title_laws = PREV
					copy_title_history = PREV
					set_government_type = roman_imperial_government
					add_law = succ_byzantine_elective
				}
			}
			
			any_demesne_title = {
				limit = { tier = KING }
				de_jure_liege = e_western_roman_empire
			}
			hidden_tooltip = {
				any_demesne_title = {
					if = {
						limit = { tier = EMPEROR }
						any_direct_de_jure_vassal_title = {
							de_jure_liege = e_western_roman_empire
						}
					}
				}
			}
			any_demesne_title = {
				limit = {
					tier = EMPEROR
					NOT = { title = e_western_roman_empire }
				}
				destroy_landed_title = THIS
				hidden_tooltip = { activate_title = { title = THIS status = no } }
			}
			
			ROOT = {
				random_list ={
					25 = { give_nickname = nick_the_augustus }
					25 = { give_nickname = nick_the_caesar }
					25 = { give_nickname = nick_the_princeps }
					25 = { give_nickname = nick_the_pater_patriae }
				}
				narrative_event = { id = roman_empire.1 }
			}
			any_playable_ruler = {
		        limit = {
		            is_within_diplo_range = ROOT
					ai = no
		        }
		        narrative_event = { id = roman_empire.1 }
		    }
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
########################
####### Croisade #######
########################
	
	#Jerusalem
    croisade_jerusalem = {
    	is_high_prio = yes
    
    	potential = {
    	    ai = no
			controls_religion = yes
			primary_title = { title = k_papal_state }
			NOT = { has_global_flag = christian_crusades_unlocked }
    	}
    
    	allow = {
    	    OR = {
			    774 = { # Jerusalem
			        owner = { NOT = { religion_group = christian } }
		        }
				774 = { # Jerusalem
			        top_liege = { NOT = { religion_group = christian } }
		        }
			}
			NOT = { religion_authority = 0.2 }
    	}
    	
    	effect = {
    	    narrative_event = { id = cathimprov.11 }
        }
    	
    	ai_will_do = {
    		factor = 0
    	}
    }
	
	#Byzance
	croisade_empire = {
    	is_high_prio = yes
    
    	potential = {
    	    ai = no
			controls_religion = yes
			primary_title = { title = k_papal_state }
			NOT = { has_global_flag = christian_crusades_unlocked }
    	}
    
    	allow = {
		    OR = {
    	        OR = {
			        e_byzantium = {
			        	holder_scope = {
			        		NOT = { religion_group = christian }
			        	}
			        }
			        496 = { # Constantinople
			        	owner = { NOT = { religion_group = christian } }
			        }
			        753 = { # Ancyra
			        	owner = { NOT = { religion_group = christian } }
			        }
			        AND = {
			        	482 = { # Athens
			        		owner = { NOT = { religion_group = christian } }
			        	}
			        	481 = { # Corinth
			        		owner = { NOT = { religion_group = christian } }
			        	}
			        }
		        }
				OR = {
			        496 = { # Constantinople
			        	top_liege = { NOT = { religion_group = christian } }
			        }
			        753 = { # Ancyra
			        	top_liege = { NOT = { religion_group = christian } }
			        }
			        AND = {
			        	482 = { # Athens
			        		top_liege = { NOT = { religion_group = christian } }
			        	}
			        	481 = { # Corinth
			        		top_liege = { NOT = { religion_group = christian } }
			        	}
			        }
		        }
			}
			NOT = { religion_authority = 0.3 }
    	}
    	
    	effect = {
    	    narrative_event = { id = cathimprov.12 }
        }
    	
    	ai_will_do = {
    		factor = 0
    	}
    }
	
	#Rome
	croisade_rome = {
    	is_high_prio = yes
    
    	potential = {
    	    ai = no
			controls_religion = yes
			primary_title = { title = k_papal_state }
			NOT = { has_global_flag = christian_crusades_unlocked }
    	}
    
    	allow = {
		    OR = {
    	        333 = { # Rome
			        owner = {
			            OR = {
			            	NOT = { religion_group = christian }
			            	is_heretic = yes
			            }
			        }
		        }
				333 = { # Rome
			        top_liege = {
			        	OR = {
			        		NOT = { religion_group = christian }
			        		is_heretic = yes
			        	}
			        }
		        }
			}
    	}
    	
    	effect = {
    	    narrative_event = { id = cathimprov.13 }
        }
    	
    	ai_will_do = {
    		factor = 0
    	}
    }
	
	#Europe
	croisade_europe = {
    	is_high_prio = yes
    
    	potential = {
    	    ai = no
			controls_religion = yes
			primary_title = { title = k_papal_state }
			NOT = { has_global_flag = christian_crusades_unlocked }
    	}
    
    	allow = {
    	    OR = {
			    OR = {
			        221 = { # Provence
			            owner = { NOT = {religion_group = christian } }
			        }
			        214 = { # Toulouse
			            owner = { NOT = {religion_group = christian } }
			        }
			        112 = { # Paris
			            owner = { NOT = {religion_group = christian } }
			        }
			        119 = { # Cologne
			            religion_group = christian
			            owner = { NOT = {religion_group = christian } }
			        }
			        257 = { # Braunschweig
			            religion_group = christian
			     	    owner = { NOT = {religion_group = christian } }
			        }
			    }
			    OR = {
			        221 = { # Provence
			            top_liege = { NOT = {religion_group = christian } }
			        }
			    	214 = { # Toulouse
			            top_liege = { NOT = {religion_group = christian } }
			        }
			    	112 = { # Paris
			            top_liege = { NOT = {religion_group = christian } }
			        }
			    	119 = { # Cologne
			            religion_group = christian
			            top_liege = { NOT = {religion_group = christian } }
			        }
			    	257 = { # Braunschweig
			            religion_group = christian
			    		top_liege = { NOT = {religion_group = christian } }
			        }
			    }
		    }
			NOT = { religion_authority = 0.3 }
    	}
    	
    	effect = {
    	    narrative_event = { id = cathimprov.14 }
        }
    	
    	ai_will_do = {
    		factor = 0
    	}
    }
	
####################################
####### République Marchande #######
####################################
	
	#found_republic_indep  = {
	#	only_independent = yes
	#	is_high_prio = yes
	#	
	#	potential = {
	#		is_playable = yes
	#		tier = DUKE
	#		is_feudal = yes
	#		independent = yes
	#		has_dlc = "The Republic"
	#		ai = no
	#	}
	#	allow = {
	#		is_adult = yes
	#		prisoner = no
	#		NOT = { trait = incapable }
	#		war = no
	#		is_female = no
	#		tier = DUKE
	#		prestige = 1000
	#		NOT = { realm_size = 100 }
	#		custom_tooltip = {
	#			text = TT_NOT_UNREFORMED_PAGAN
	#			hidden_tooltip = {
	#				OR = {
	#					NOT = { religion_group = pagan_group }
	#					is_reformed_religion = yes
	#				}
	#			}
	#		}
	#		primary_title = { has_law = centralization_2 }
	#		capital_scope = {
	#			port = yes
	#		}
	#		capital_holding = {
	#			AND = {
	#				holding_type = castle
	#				has_building = ca_shipyard_2
	#			}
	#		}
	#	}
	#	
	#	effect = {
	#		hidden_tooltip = {
	#			create_family_palace = yes
	#			
	#			set_government_type = merchant_republic_government
	#			
	#			if = {
	#				limit = {
	#					NOT = {
	#						num_of_government_vassals = {
	#							government = merchant_republic_government
	#							value = 1
	#						}
	#					}
	#				}
	#				
	#				any_unique_dynasty_vassal = { # gives random vassals a family palace
	#					count = 4
	#					limit = {
	#						is_female = no
	#						OR = {
	#							is_republic = yes
	#							is_tribal = yes
	#						}
	#						is_patrician = no
	#						prisoner = no
	#						NOT = { trait = incapable }
	#						is_adult = yes
	#						NOT = { 
	#							dynasty = none 
	#						}
	#					}
	#					
	#					if = {
	#						limit = { is_tribal = yes }
	#						
	#						hidden_tooltip = {
	#							any_demesne_title = {
	#								limit = {
	#									tier = baron
	#									holding_type = tribal
	#								}
	#								convert_to = CITY
	#								refill_holding_levy = yes
	#								location = { #Clear Tribal Great Pillars
	#									clr_province_flag = flag_great_pillar_norse
	#									clr_province_flag = flag_great_pillar_tengri
	#									clr_province_flag = flag_great_pillar_slavic
	#									clr_province_flag = flag_great_pillar_baltic
	#									clr_province_flag = flag_great_pillar_finnish
	#									clr_province_flag = flag_great_pillar_west_african
	#									clr_province_flag = flag_great_pillar_aztec
	#									clr_province_flag = flag_great_pillar_bon
	#									clr_province_flag = flag_great_pillar_zun
	#									clr_province_flag = flag_great_pillar_hellenic
	#								}
	#								
	#								if = {
	#									limit = {
	#										dejure_liege_title = {
	#											holder = PREVPREV
	#											location = {
	#												num_of_empty_holdings = 2
	#											}
	#											NOT = {
	#												any_direct_de_jure_vassal_title = {
	#													holding_type = castle
	#												}
	#											}
	#										}
	#									}
	#									location = {
	#										build_holding = {
	#											type = castle
	#										}
	#									}
	#								}
	#								if = {
	#									limit = {
	#										dejure_liege_title = {
	#											holder = PREVPREV
	#											location = {
	#												num_of_empty_holdings = 2
	#											}
	#											NOT = {
	#												any_direct_de_jure_vassal_title = {
	#													holding_type = temple
	#												}
	#											}
	#										}
	#									}
	#									location = {
	#										build_holding = {
	#											type = temple
	#										}
	#									}
	#								}
	#							}
	#						}
	#					}
	#					
	#					create_family_palace = yes
	#				}
	#			}
	#			
	#			any_demesne_title = {
	#				limit = {
	#					tier = baron
	#					holding_type = tribal
	#				}
	#				convert_to = CITY
	#				refill_holding_levy = yes
	#				location = { #Clear Tribal Great Pillars
	#					clr_province_flag = flag_great_pillar_norse
	#					clr_province_flag = flag_great_pillar_tengri
	#					clr_province_flag = flag_great_pillar_slavic
	#					clr_province_flag = flag_great_pillar_baltic
	#					clr_province_flag = flag_great_pillar_finnish
	#					clr_province_flag = flag_great_pillar_west_african
	#					clr_province_flag = flag_great_pillar_aztec
	#					clr_province_flag = flag_great_pillar_bon
	#					clr_province_flag = flag_great_pillar_zun
	#					clr_province_flag = flag_great_pillar_hellenic
	#				}
	#				
	#				if = {
	#					limit = {
	#						dejure_liege_title = {
	#							holder = ROOT
	#							location = {
	#								num_of_empty_holdings = 2
	#							}
	#							NOT = {
	#								any_direct_de_jure_vassal_title = {
	#									holding_type = castle
	#								}
	#							}
	#						}
	#					}
	#					location = {
	#						build_holding = {
	#							type = castle
	#						}
	#					}
	#				}
	#				if = {
	#					limit = {
	#						dejure_liege_title = {
	#							holder = ROOT
	#							location = {
	#								num_of_empty_holdings = 2
	#							}
	#							NOT = {
	#								any_direct_de_jure_vassal_title = {
	#									holding_type = temple
	#								}
	#							}
	#						}
	#					}
	#					location = {
	#						build_holding  ={
	#							type = temple
	#						}
	#					}
	#				}
	#			}
	#		}
	#		
	#		if = {
	#			limit = { ai = no }
	#			set_character_flag = achievement_res_publica
	#		}
	#		
	#		if = {
	#			limit = {
	#				ai = no
	#			}
	#			chronicle = {
	#				entry = CHRONICLE_FOUNDED_MERCHANT_REPUBLIC
	#				picture = GFX_evt_busy_trading_dock_republic
	#			}
	#		}
	#		
	#		set_government_type = merchant_republic_government
	#	}
	#	
	#	ai_will_do = {
	#		factor = 0
	#	}
	#}
	
###########################
####### Palefrenier #######
###########################

	employ_a_horse_smith = {
		only_playable = yes
		ai_check_interval = 36
		potential = {
			is_nomadic = yes
			OR = {
				has_dlc = "Mystics"
				has_dlc = "Jade Dragon"
			}
			age = 16
    		is_incapable = no
			OR = {
				is_landed = yes
				primary_title = { has_title_flag = adventurer_title }
			}
			is_lowborn = no
			
			# Bloquer le joueur de l'action s'il a déjà obtenu tous les artefacts qu'il peut obtenir de cette action.
			NAND = {
				have_all_horse_artifacts_trigger = yes
				have_all_horse_armor_artifacts_trigger = yes
			}
		}
		allow = {
			hidden_trigger = {
				OR = {
					ai = no
					wealth = 800
				}
			}
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = employ_a_horse_smith_cooldown_tt
				hidden_trigger = {
					NOT = {
						has_character_modifier = employ_a_horse_smith_cd
					}
				}
			}
		}
		effect = {
			custom_tooltip = {
				text = employ_a_horse_smith_tt
				hidden_effect = {
					character_event = { id = horse.1 }
					add_character_modifier = {
						name = employ_a_horse_smith_cd
						hidden = yes
						years = 2
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.5
				trait = greedy
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 0.1
				trait = content
			}
			modifier = {
				factor = 0
				any_artifact = { has_artifact_flag = horse_flag }
				any_artifact = { has_artifact_flag = horse_armor }
			}
		}
	}

}