coronation_anointment_request = {
	category = interaction_category_religion
	icon = coronation_icon

	desc = coronation_anointment_request_desc

	ai_targets = {
		ai_recipients = head_of_faith
	}
	ai_target_quick_trigger = {
		adult = yes
	}
	ai_frequency_by_tier = {
		barony = 0
		county = 0
		duchy = 0
		kingdom = 0
		empire = 12
		hegemony = 12
	}
	popup_on_receive = yes
	pause_on_receive = yes
	
	cooldown_against_recipient = { years = 5 }

	is_shown = {
		NOT = { scope:actor = scope:recipient }
		scope:actor = {
			NOT = { has_realm_law = crowned_emperor }
			coronation_trigger = yes
			highest_held_title_tier >= tier_empire
			faith = {
				OR = {
					has_doctrine = doctrine_anointment_permitted
					has_doctrine = doctrine_imperial_anointment
				}
			}
		}
		scope:recipient = {
			this = scope:actor.faith.religious_head
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			faith = {
				has_doctrine = doctrine_spiritual_head
			}
			is_imprisoned = no
			NOT = { has_trait = excommunicated }
			age >= 10
		}
		scope:recipient = {
			is_imprisoned = no
			custom_tooltip = {
				text = anointment_request_already_supported
				NOT = {
					is_target_in_variable_list = {
						name = supported_anointments
						target = scope:actor
					}
				}
			}
		}
	}

	cost = {
		piety = {
			value = 500
			if = {
				limit = {
					scope:actor = { is_ai = yes }
				}
				subtract = 500
			}
			if = {
				limit = { scope:piety_send_option = yes }
				add = scope:actor.monumental_piety_value
				desc = PIETY_INTERACTION_ACCEPTANCE_SEND_OPTION
			}
			if = {
				limit = { scope:hook = yes }
				value = 0
			}
		}
		gold = {
			value = 0
			if = {
				limit = { scope:gold_send_option = yes }
				add = scope:actor.major_gold_value
				desc = GOLD_INTERACTION_ACCEPTANCE_SEND_OPTION
			}
		}
	}

	greeting = positive
	notification_text = CORONATION_ANOINTMENT_REQUEST_INTERACTION_NOTIFICATION

	ai_accept = {
		base = -60
		modifier = {
			add = 80
			scope:actor = {
				is_ai = yes
			}
		}
		opinion_modifier = {
			opinion_target = scope:actor
			who = scope:recipient
			multiplier = 0.5
		}

		modifier = { # Same language
			add = 5
			desc = speaks_same_language_interaction_reason
			trigger = {
				scope:actor = {
					knows_language_of_culture = scope:recipient.culture
				}
			}
		}

		modifier = {
			add = -40
			desc = I_AM_SODOMITE
			scope:actor = {
				has_trait = sodomite
				trait_is_criminal_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:sodomite
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -20
			desc = I_AM_SODOMITE
			scope:actor = {
				has_trait = sodomite
				trait_is_shunned_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:sodomite
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -40
			desc = I_AM_DEVIANT
			scope:actor = {
				has_trait = deviant
				trait_is_criminal_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:deviant
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -20
			desc = I_AM_DEVIANT
			scope:actor = {
				has_trait = deviant
				trait_is_shunned_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:deviant
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -40
			desc = I_AM_ADULTERER
			scope:actor = {
				has_trait = adulterer
				trait_is_criminal_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:adulterer
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -20
			desc = I_AM_ADULTERER
			scope:actor = {
				has_trait = adulterer
				trait_is_shunned_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:adulterer
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -20
			desc = I_AM_ADULTERER
			scope:actor = {
				has_trait = fornicator
				trait_is_criminal_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:fornicator
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -10
			desc = I_AM_ADULTERER
			scope:actor = {
				has_trait = fornicator
				trait_is_shunned_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:fornicator
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -40
			desc = I_AM_WITCH
			scope:actor = {
				has_trait = witch
				trait_is_criminal_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:witch
					GENDER_CHARACTER = scope:actor
				}
			}
		}
		modifier = {
			add = -20
			desc = I_AM_WITCH
			scope:actor = {
				has_trait = witch
				trait_is_shunned_in_faith_trigger = {
					FAITH = scope:actor.faith
					TRAIT = trait:witch
					GENDER_CHARACTER = scope:actor
				}
			}
		}

		modifier = { # I am a Murderer
			add = -50
			desc = I_AM_MURDERER
			scope:actor = {
				has_trait = murderer
			}
		}
		
		modifier = { # I am Incestous
			add = -50
			desc = I_AM_INCESTOUS
			scope:actor = {
				NOT = { scope:recipient = { faith = { has_doctrine = doctrine_consanguinity_unrestricted } } }
				has_trait = incestuous
			}
		}
			
		modifier = { # I am a Kinslayer
			add = -30
			desc = I_AM_A_KINSLAYER
			scope:actor = {
				OR = {
					AND = {
						has_trait = kinslayer_1
						trait_is_criminal_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_1 GENDER_CHARACTER = scope:actor }
					}
					AND = {
						has_trait = kinslayer_2
						trait_is_criminal_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_2 GENDER_CHARACTER = scope:actor }
					}
					AND = {
						has_trait = kinslayer_3
						trait_is_criminal_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_3 GENDER_CHARACTER = scope:actor }
					}
				}
			}
		}
		modifier = { # I am a Kinslayer
			add = -15
			desc = I_AM_A_KINSLAYER
			scope:actor = {
				OR = {
					AND = {
						has_trait = kinslayer_1
						trait_is_shunned_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_1 GENDER_CHARACTER = scope:actor }
					}
					AND = {
						has_trait = kinslayer_2
						trait_is_shunned_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_2 GENDER_CHARACTER = scope:actor }
					}
					AND = {
						has_trait = kinslayer_3
						trait_is_shunned_in_faith_trigger = { FAITH = faith TRAIT = trait:kinslayer_3 GENDER_CHARACTER = scope:actor }
					}
				}
			}
		}
		modifier = {
			add = 10
			scope:actor = {
				has_trait = zealous
			}
			desc = ai_acceptance_trait_zealous
		}
		modifier = {
			add = 10
			scope:actor = {
				has_trait = pilgrim
			}
			desc = ai_acceptance_trait_pilgrim
		}
		modifier = {
			add = 5
			scope:actor = {
				has_trait = holy_warrior
			}
			desc = ai_acceptance_trait_holy_warrior
		}
		modifier = {
			add = 25
			scope:recipient = {
				is_landed = no
			}
			OR = {
				scope:recipient.liege ?= scope:actor
				scope:recipient.top_liege ?= scope:actor
			}
			desc = I_AM_LIEGE_TOP_LIEGE
		}
		modifier = {
			add = 15
			scope:recipient = {
				is_landed = yes
			}
			OR = {
				scope:recipient.liege ?= scope:actor
				scope:recipient.top_liege ?= scope:actor
			}
			desc = I_AM_LIEGE_TOP_LIEGE
		}

		modifier = {
			desc = RELIGIOUS_HEAD_INTERACTION_SAVIOR
			add = 15
			scope:actor = {
				has_trait = savior
			}
		}
		modifier = {
			desc = RELIGIOUS_HEAD_INTERACTION_DIVINE_BLOOD
			add = 5
			scope:actor = {
				has_trait = divine_blood
			}
		}
		modifier = {
			desc = RELIGIOUS_HEAD_INTERACTION_PARAGON
			add = 15
			scope:actor = {
				has_trait = paragon
			}
		}
		modifier = {
			desc = RELIGIOUS_HEAD_INTERACTION_CONSECRATED_BLOOD
			add = 5
			scope:actor = {
				has_trait = consecrated_blood
			}
		}
		
		modifier = { # You are of the same dynasty as the Head of Faith
			add = 5
			desc = YOU_ARE_MY_DYNASTY_MEMBER
			scope:recipient = {
				is_lowborn = no
				dynasty = scope:actor.dynasty
				NOR = {
					is_close_or_extended_family_of = scope:actor
					is_cousin_of = scope:actor
					is_child_of = scope:actor
					scope:recipient.dynasty = scope:secondary_recipient.dynasty
				}
			}
		}
		
		modifier = { # You are of the same house as the Head of Faith
			add = 10
			desc = YOU_ARE_MY_HOUSE_MEMBER
			scope:recipient = {
				is_lowborn = no
				house = scope:actor.house
				NOR = {
					is_close_or_extended_family_of = scope:actor
					is_cousin_of = scope:actor
					is_child_of = scope:actor
					scope:recipient.house = scope:secondary_recipient.house
				}
			}
		}
		
		modifier = { # Related to the Head of Faith
			add = 10
			desc = YOU_ARE_MY_RELATIVE
			scope:recipient = {
				OR = {
					is_close_or_extended_family_of = scope:actor
					is_cousin_of = scope:actor
				}
				NOT = { is_child_of = scope:actor }
			}
		}
		
		modifier = { # Parent of the Head of Faith
			add = 25
			desc = YOU_ARE_MY_PARENT
			scope:recipient = {
				is_child_of = scope:actor
			}
		}
		
		modifier = { # Friend of the Head of Faith
			add = 25
			desc = WE_ARE_FRIENDS
			scope:recipient = {
				has_relation_friend = scope:actor
			}
		}
		
		modifier = { # Best Friend of the Head of Faith
			add = 50
			desc = WE_ARE_BEST_FRIENDS
			scope:recipient = {
				has_relation_best_friend = scope:actor
			}
		}
		
		modifier = { # Lover of the Head of Faith
			add = 10
			desc = WE_ARE_LOVERS
			scope:recipient = {
				has_relation_lover = scope:actor
			}
		}
		
		modifier = { # Rival of the Head of Faith
			add = -100
			desc = WE_ARE_RIVALS
			scope:recipient = {
				has_relation_rival = scope:actor
			}
		}
		
		modifier = { # Nemesis of the Head of Faith
			add = -500
			desc = WE_ARE_NEMESES
			scope:recipient = {
				has_relation_nemesis = scope:actor
			}
		}

		modifier = {
			add = {
				add = 10
				multiply = scope:actor.num_virtuous_traits
			}
			scope:actor.num_virtuous_traits > 0
			desc = I_AM_VIRTUOUS
		}
		
		modifier = {
			add = {
				add = 5
				multiply = scope:actor.piety_level
			}
			scope:actor.piety_level > 1
			desc = I_AM_PIOUS
		}

		modifier = {
			add = -30
			scope:actor.piety_level = 0
			desc = I_HAVE_LOW_PIETY
		}
		
		modifier = {
			add = {
				add = 5
				multiply = scope:actor.piety_level
			}
			scope:actor.piety_level > 2
			scope:actor.gold < 0
			desc = I_AM_PIOUS_AND_BROKE
		}
		
		modifier = {
			add = {
				add = -10
				multiply = scope:actor.num_sinful_traits
			}
			scope:actor.num_sinful_traits > 0
			desc = I_AM_SINFUL
		}

		modifier = {
			add = 20
			scope:actor = {
				has_trait = crusader_king
			}
			desc = I_HAVE_CRUSADER_KING_TRAIT
		}

		modifier = {
			add = 20
			scope:actor = {
				has_trait = saint
			}
			desc = I_HAVE_SAINT_TRAIT
		}

		modifier = {
			add = 30
			scope:actor = {
				has_trait = saoshyant
			}
			desc = I_HAVE_SAOSHYANT_TRAIT
		}

		modifier = {
			add = 10
			scope:actor = {
				has_trait = saoshyant_descendant
			}
			desc = I_HAVE_SAOSHYANT_DESCENDANT_TRAIT
		}

		modifier = {
			add = 10
			scope:actor = {
				has_trait = sayyid
			}
			desc = I_HAVE_SAYYID_TRAIT
		}

		modifier = {
			add = 10
			scope:actor = {
				has_trait = order_member
			}
			desc = I_HAVE_ORDER_MEMBER_TRAIT
		}

		modifier = {
			add = 10
			scope:actor = {
				has_trait = faith_warrior
			}
			desc = I_HAVE_FAITH_WARRIOR_TRAIT
		}

		modifier = {
			add = 10
			scope:actor = {
				has_trait = theologian
			}
			desc = I_HAVE_THEOLOGIAN_TRAIT
		}

		modifier = {
			add = -25
			scope:actor = {
				has_trait = despoiler_of_byzantium
			}
			desc = I_HAVE_DESPOILER_OF_BYZANTIUM_TRAIT
		}

		modifier = {
			add = -25
			scope:actor = {
				has_trait = gallowsbait
			}
			desc = I_HAVE_GALLOWSBAIT_TRAIT
		}

		modifier = {
			add = -25
			scope:actor = {
				has_trait = decadent
			}
			desc = I_HAVE_DECADENT_TRAIT
		}
		
		modifier = {
			add = -25
			desc = BASE_RELUCTANCE
			trigger = {
				has_game_rule = hard_difficulty
				scope:actor = {
					is_ai = no
				}
			}
		}
		
		modifier = {
			add = -75
			desc = BASE_RELUCTANCE
			trigger = {
				has_game_rule = very_hard_difficulty
				scope:actor = {
					is_ai = no
				}
			}
		}

		modifier = {
			add = 60
			desc = TRADE_GOLD_FOR_BETTER_AI_ACCEPTANCE_TT
			scope:gold_send_option = yes
		}

		modifier = {
			add = 40
			desc = PIETY_INTERACTION_ACCEPTANCE_SEND_OPTION
			scope:piety_send_option = yes
		}

		modifier = {
			add = {
				value = 0
				scope:recipient = {
					every_held_title = {
						limit = {
							is_head_of_faith = no
						}
						every_de_jure_county = {
							limit = {
								holder = scope:actor
							}
							add = 20
						}
					}
				}
			}
			desc = TRADE_LAND_ACCEPTANCE_SEND_OPTION
			scope:land_send_option = yes
		}
		modifier = {
			add = -20
			scope:recipient = { 
				faith_dominant_gender_female_or_equal = no
			}
			scope:actor = {
				is_female = yes
			}
			desc = I_AM_FEMALE_WHEN_MALE_IS_PREFERRED
		}
		modifier = {
			add = -20
			scope:recipient = { 
				faith_dominant_gender_male_or_equal = no
			}
			scope:actor = {
				is_male = yes
			}
			desc = I_AM_MALE_WHEN_FEMALE_IS_PREFERRED
		}
		modifier = {
			desc = "LOW_LEGITIMACY_REASON"
			scope:actor = {
				is_ai = no
				legitimacy_level <= 0
			}
			add = -15
		}
		modifier = {
			desc = "LOW_LEGITIMACY_REASON"
			scope:actor = {
				is_ai = no
				legitimacy_level = 1
			}
			add = -10
		}
		modifier = {
			desc = "LOW_LEGITIMACY_REASON"
			scope:actor = {
				is_ai = no
				legitimacy_level = 2
			}
			add = -5
		}
		modifier = {
			desc = "HIGH_LEGITIMACY_REASON"
			scope:actor = {
				legitimacy_level = 4
			}
			add = 10
		}
		modifier = {
			desc = "HIGH_LEGITIMACY_REASON"
			scope:actor = {
				legitimacy_level >= 5
			}
			add = 15
		}
	}

	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
		}
	}

	send_option = { # Hook
		flag = hook
		is_valid = {
			scope:actor = {
				has_usable_hook = scope:recipient
			}
		}
		localization = GENERIC_SPEND_A_HOOK
	}

	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_option = { # Piety
		is_shown = {
			always = yes
		}
		is_valid = {
			scope:actor = { piety >= monumental_piety_value }
			custom_tooltip = {
				text = already_using_hook
				NOT = { scope:hook = yes }
			}
		}
		flag = piety_send_option
		localization = TRADE_PIETY_FOR_BETTER_AI_ACCEPTANCE
	}

	send_option = { # Gold
		is_shown = {
			always = yes
		}
		is_valid = {
			scope:actor = { gold >= major_gold_value }
			custom_tooltip = {
				text = already_using_hook
				NOT = { scope:hook = yes }
			}
		}
		flag = gold_send_option
		localization = TRADE_GOLD_FOR_BETTER_AI_ACCEPTANCE
	}

	send_option = { # Return land
		is_shown = {
			always = yes
		}
		is_valid = {
			custom_tooltip = {
				text = coronation_request_return_land_trigger
				scope:recipient = {
					any_held_title = {
						is_head_of_faith = no
						any_de_jure_county = {
							holder = scope:actor
						}
					}
				}
			}
		}
		flag = land_send_option
		localization = TRADE_LAND_FOR_BETTER_AI_ACCEPTANCE
	}

	send_options_exclusive = no

	on_accept = {
		scope:recipient = {
			custom_tooltip = anoinment_request_accepted_tt
			add_to_variable_list = {
				name = supported_anointments
				target = scope:actor
			}
		}
		if = {
			limit = {
				scope:gold_send_option = yes
			}
			scope:recipient = {
				add_short_term_gold = scope:actor.major_gold_value
			}
		}
		if = {
			limit = {
				scope:land_send_option = yes
			}
			create_title_and_vassal_change = {
				type = returned
				save_scope_as = change
			}
			scope:recipient = {
				every_held_title = {
					limit = {
						is_head_of_faith = no
					}
					every_de_jure_county = {
						limit = {
							holder = scope:actor
						}
						change_title_holder_include_vassals = {
							holder = scope:recipient
							change = scope:change
						}
					}
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
		scope:actor = {
			trigger_event = coronation_events.0400
		}
	}

	on_decline = {
		scope:actor = {
			trigger_event = religious_interaction.32
		}
	}

	ai_potential = {
		age >= 16
		coronation_trigger = yes
	}

	ai_will_do = {
		base = 50
		modifier = {
			has_game_rule = coronation_laws_off
			add = -25
		}
	}
}
