targetted_decisions = {
######################################
####### Demander un prisonnier #######
######################################
	pretre-aider-list = {
		filter = all
		ai_target_filter = all
		ai = no
		diplomacy_icon = GFX_icon_pretre-aider_Vatican
		third_party_filter = all
        third_party = ROOT		
        third_party_potential = {
            FROMFROM = {
				age = 0
				religion = FROM
                prisoner = yes
			#	is_theocracy = yes
				OR = {
					AND = {
						host = {
							character = ROOT
						}
						religion = ROOT
					}	
					vassal_of = ROOT
				}
			#	in_revolt = no
				host = {
					religion = FROM
				#	rightful_religious_head = FROM # marche pas
					NOT = {
						any_liege = {
							has_claim = k_papal_state
						}
						has_claim = k_papal_state
						any_vassal = {
							has_claim = k_papal_state
						}
					}
					NOT = {
						top_liege = {
						#	custom_tooltip = {
						#		text = any_realm_character_pretre-aider
								any_realm_character = {
									has_claim = k_papal_state
								}
						#	}
						}
					}
					NOT = {
						has_landed_title = k_papal_state
					}
				}
			#	NOT = {
			#		trait = excommunicated
			#	}
				NOT = {
					has_flag = prisonnier_candidate
				}
				NOT = {
					any_liege = {
						has_claim = k_papal_state
					}
					has_claim = k_papal_state
					any_vassal = {
						has_claim = k_papal_state
					}
				}
				NOT = {
					top_liege = {
					#	custom_tooltip = {
					#		text = any_realm_character_pretre-aider
							any_realm_character = {
								has_claim = k_papal_state
							}
					#	}
					}
				}
			}
        }
		from_potential = {
			has_landed_title = k_papal_state
		}
		allow = {
			age = 0
			is_landed = yes
			religion = FROM
			rightful_religious_head = FROM
			NOT = {
				any_liege = {
					has_claim = k_papal_state
				}
				has_claim = k_papal_state
				any_vassal = {
					has_claim = k_papal_state
				}
			}
			NOT = {
				top_liege = {
					custom_tooltip = {
						text = any_realm_character_pretre-aider
						any_realm_character = {
							has_claim = k_papal_state
						}
					}
				}
			}
			custom_tooltip = {
				text = liberer_un_prisonnier
				NOT = {
					has_character_flag = aide_pretre_flag
				}
			}
			OR = {
				any_vassal = {
					age = 0
					religion = FROM
					rightful_religious_head = FROM
					prisoner = yes
				#	is_theocracy = yes
					host = {
						religion = FROM
					#	rightful_religious_head = FROM # marche pas
						NOT = {
							any_liege = {
								has_claim = k_papal_state
							}
							has_claim = k_papal_state
							any_vassal = {
								has_claim = k_papal_state
							}
						}
						NOT = {
							top_liege = {
								custom_tooltip = {
									text = any_realm_character_pretre-aider
									any_realm_character = {
										has_claim = k_papal_state
									}
								}
							}
						}
						NOT = {
							has_landed_title = k_papal_state
						}
					}
				#	NOT = {
				#		trait = excommunicated
				#	}
					custom_tooltip = {
						text = demande_prisonnier
						NOT = {
							has_flag = prisonnier_candidate
						}
					}
					NOT = {
						any_liege = {
							has_claim = k_papal_state
						}
						has_claim = k_papal_state
						any_vassal = {
							has_claim = k_papal_state
						}
					}
					NOT = {
						top_liege = {
							custom_tooltip = {
								text = any_realm_character_pretre-aider
								any_realm_character = {
									has_claim = k_papal_state
								}
							}
						}
					}
				}
				any_courtier = {
					age = 0
					religion = FROM
					rightful_religious_head = FROM
					prisoner = yes
				#	is_theocracy = yes
					host = {
						religion = FROM
					#	rightful_religious_head = FROM # marche pas
						NOT = {
							any_liege = {
								has_claim = k_papal_state
							}
							has_claim = k_papal_state
							any_vassal = {
								has_claim = k_papal_state
							}
						}
						NOT = {
							top_liege = {
								custom_tooltip = {
									text = any_realm_character_pretre-aider
									any_realm_character = {
										has_claim = k_papal_state
									}
								}
							}
						}
						NOT = {
							has_landed_title = k_papal_state
						}
					}
				#	NOT = {
				#		trait = excommunicated
				#	}
					custom_tooltip = {
						text = demande_prisonnier
						NOT = {
							has_flag = prisonnier_candidate
						}
					}
					NOT = {
						any_liege = {
							has_claim = k_papal_state
						}
						has_claim = k_papal_state
						any_vassal = {
							has_claim = k_papal_state
						}
					}
					NOT = {
						top_liege = {
							custom_tooltip = {
								text = any_realm_character_pretre-aider
								any_realm_character = {
									has_claim = k_papal_state
								}
							}
						}
					}
				}
			}
		}
		effect = {
			if = {
				limit = {
					FROMFROM = {
						age = 0
						religion = FROM
						prisoner = yes
					#	is_theocracy = yes
						OR = {
							AND = {
								host = {
									character = ROOT
								}
								religion = ROOT
							}	
							vassal_of = ROOT
						}
					#	in_revolt = no
						host = {
							religion = FROM
						#	rightful_religious_head = FROM # marche pas
							NOT = {
								any_liege = {
									has_claim = k_papal_state
								}
								has_claim = k_papal_state
								any_vassal = {
									has_claim = k_papal_state
								}
							}
							NOT = {
								top_liege = {
								#	custom_tooltip = {
								#		text = any_realm_character_pretre-aider
										any_realm_character = {
											has_claim = k_papal_state
										}
								#	}
								}
							}
							NOT = {
								has_landed_title = k_papal_state
							}
						}
					#	NOT = {
					#		trait = excommunicated
					#	}
						NOT = {
							has_flag = prisonnier_candidate
						}
						NOT = {
							any_liege = {
								has_claim = k_papal_state
							}
							has_claim = k_papal_state
							any_vassal = {
								has_claim = k_papal_state
							}
						}
						NOT = {
							top_liege = {
							#	custom_tooltip = {
							#		text = any_realm_character_pretre-aider
									any_realm_character = {
										has_claim = k_papal_state
									}
							#	}
							}
						}
					}
				}
				ROOT = {
					save_event_target_as = host_prisoner_flag
					set_character_flag = aide_pretre_flag
				}
				FROMFROM = {
					save_event_target_as = aide_pretre_candidate
					set_character_flag = prisonnier_candidate
					character_event = {
						id = pretre-aider-list.1
					#	days = 1
					}
				}
			}
		}	
	}
}