﻿fmp_interaction = {
	common_interaction = yes

	category = interaction_category_diplomacy

	desc = fmp_interaction_desc

	interface = marriage

	redirect = {
		clear_saved_scope = secondary_actor
		scope:recipient = {
			save_scope_as = secondary_recipient
		}
	}

	populate_actor_list = {
		scope:actor = {
			if = {
				limit = {
					sex_opposite_of = scope:recipient
					allowed_more_spouses = yes
					# My faith allows this level of consanguinity
					OR = {
						NOT = { is_close_or_extended_family_of = scope:recipient }
						AND = {
							is_cousin_of = scope:recipient
							faith = { has_doctrine_parameter = allows_cousin_marriage }
						}
						AND = {
							OR = {
								is_uncle_or_aunt_of = scope:recipient
								is_nibling_of = scope:recipient
							}
							faith = { has_doctrine_parameter = allows_aunt_nephew_and_uncle_niece_marriage }
						}
						faith = { has_doctrine_parameter = allows_unrestricted_marriage }
					}
				}
				add_to_list = characters
			}
			every_courtier = {
				limit = {
					is_at_home = yes
					allowed_more_spouses = yes
					sex_opposite_of = scope:recipient
					NOT = { is_spouse_of = scope:recipient }
					# My faith allows this level of consanguinity
					OR = {
						NOT = { is_close_or_extended_family_of = scope:recipient }
						AND = {
							is_cousin_of = scope:recipient
							faith = { has_doctrine_parameter = allows_cousin_marriage }
						}
						AND = {
							OR = {
								is_uncle_or_aunt_of = scope:recipient
								is_nibling_of = scope:recipient
							}
							faith = { has_doctrine_parameter = allows_aunt_nephew_and_uncle_niece_marriage }
						}
						faith = { has_doctrine_parameter = allows_unrestricted_marriage }
					}
				}
				add_to_list = characters
			}
			every_child = {
				limit = {
					NOT = { is_in_list = characters }
					allowed_more_spouses = yes
					sex_opposite_of = scope:recipient
					NOT = { is_spouse_of = scope:recipient }
					# My faith allows this level of consanguinity
					OR = {
						NOT = { is_close_or_extended_family_of = scope:recipient }
						AND = {
							is_cousin_of = scope:recipient
							faith = { has_doctrine_parameter = allows_cousin_marriage }
						}
						AND = {
							OR = {
								is_uncle_or_aunt_of = scope:recipient
								is_nibling_of = scope:recipient
							}
							faith = { has_doctrine_parameter = allows_aunt_nephew_and_uncle_niece_marriage }
						}
						faith = { has_doctrine_parameter = allows_unrestricted_marriage }
					}
				}
				add_to_list = characters
			}
		}
	}

	populate_recipient_list = {
		scope:recipient = {
			add_to_list = characters
		}
	}

	is_shown = {
		scope:recipient = {
			is_imprisoned_by = scope:actor
			fmp_can_marry_actor_trigger = yes
		}
	}

	on_accept = {
		fmp_interaction_effect = yes
	}

	auto_accept = yes

	ai_will_do = {
		base = -1000
	}
}