﻿select_preferred_caliph = {
	category = interaction_category_religion
	use_diplomatic_range = no
	is_shown = {
		scope:actor.faith = scope:recipient.faith
		scope:actor = {
			NOT = {
				government_has_flag = government_is_caliphate
			}
			has_religion = religion:islam_religion
		}
		scope:recipient = {
			government_has_flag = government_is_caliphate
		}
	}

	auto_accept = {
		always = yes
	}

	on_accept = {
		scope:actor = {
			if = {
				limit = {
					any_relation = {
						type = preferred_caliph
						count >= 1
					}
				}
				every_relation = {
					type = preferred_caliph
					remove_relation_preferred_caliph = THIS
				}
			}
			set_relation_preferred_caliph = scope:recipient
		}
	}
	
	ai_will_do = {
		base = 75
		
		opinion_modifier = {
			opinion_target = scope:recipient
			multiplier = 0.5
			step = 5
			max = 25
		}
	}
}

send_to_imperial_court = {
	category = interaction_category_friendly
	desc = send_to_imperial_court_desc
	
	is_shown = {
		scope:recipient = {
			is_child_of = scope:actor
			is_landed = no
			NOT = {
				has_trait = training_senator
			}
			is_male = yes
		}
		scope:actor = {
			highest_held_title_tier < tier_empire
			is_independent_ruler = no
			top_liege = {
				highest_held_title_tier >= tier_empire
				OR = {
					access_to_italian_senate = yes
					access_to_eastern_senate = yes
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			OR = {
				intrigue >= 7
				diplomacy >= 7
			}
		}
	}
	auto_accept = {
		always = yes
	}

	on_accept = {
		scope:recipient = {
			add_trait = training_senator
		}
		scope:actor.top_liege = {
			recruit_courtier = scope:recipient
		}
	}
}