﻿####################
# MARRIAGE INTERACTION EVENTS
####################

namespace = marriage_interaction

#Actor broke your betrothal (root is injured party)
marriage_interaction.0001 = {
	type = letter_event
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = {
		desc = marriage_interaction.0001.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = { this = scope:rejecting_betrothed }	
					this = scope:rejected_betrothed
				}
				desc = marriage_interaction.0001.desc.betrothedtobetrothed
			}
			triggered_desc = {
				trigger = {
					scope:actor = { this = scope:rejecting_betrothed }	
					this != scope:rejected_betrothed
				}
				desc = marriage_interaction.0001.desc.betrothedtoliege
			}
			triggered_desc = {
				trigger = {
					NOT = { scope:actor = { this = scope:rejecting_betrothed } }	
					this = scope:rejected_betrothed
				}
				desc = marriage_interaction.0001.desc.liegetobetrothed
			}
			desc = marriage_interaction.0001.desc.liegetoliege
		}
		desc = marriage_interaction.0001.desc.end
	}
	sender = scope:actor

	immediate = {
		if = {
			limit = {
				NOT = { scope:actor = { this = scope:rejecting_betrothed } }
			}
			scope:rejecting_betrothed = { save_scope_as = betrothed_portrait }
		}
	}
	
	option = {
		name = marriage_interaction.0001.a

		if = {
			limit = {
				scope:rejected_betrothed = { is_eunuch_trigger = no }
				scope:rejecting_betrothed = { is_eunuch_trigger = no }
			}
			add_opinion = {
				target = scope:actor
				modifier = broke_betrothal_opinion
			}
		}

		show_as_tooltip = {
			scope:rejecting_betrothed = {
				break_betrothal = scope:rejected_betrothed
			}
		}
	}

	after = {
		hidden_effect = {
			if = {
				limit = { this = scope:rejected_betrothed }
				scope:rejecting_betrothed = {
					break_betrothal = scope:rejected_betrothed
				}
			}
		}
	}
}



#Betrothal timeout (A full year passes after the younger character comes of age, without either side offering a full marriage)
marriage_interaction.0003 = {
	hidden = yes

	trigger = {
		NOR = {
			has_been_promised_grand_wedding = yes
			betrothed = { has_been_promised_grand_wedding = yes }
		}
	}

	immediate = {
		save_scope_as = betrothed_1
		betrothed = {
			save_scope_as = betrothed_2
		}
		break_betrothal = betrothed
		if = {
			limit = {
				OR = {
					is_landed = no #Unlanded characters have a Liege in charge of their betrothal
					AND = { #Landed characters with parent lieges will have the liege in charge of their betrothal
						is_landed = yes
						liege = { is_parent_of = root }
					}
				}
			}
			liege = { trigger_event = marriage_interaction.0004 }
			trigger_event = marriage_interaction.0005
		}
		else = {
			trigger_event = marriage_interaction.0006 #If none of the above are true, the character should be in charge of their own betrothal
		}
		betrothed = {
			if = {
				limit = {
					OR = {
						is_landed = no #Unlanded characters have a Liege in charge of their betrothal
						AND = { #Landed characters with parent lieges will have the liege in charge of their betrothal
							is_landed = yes
							liege = { is_parent_of = prev }
						}
					}
				}
				liege = { trigger_event = marriage_interaction.0004 }
				trigger_event = marriage_interaction.0005
			}
			else = {
				trigger_event = marriage_interaction.0006 #If none of the above are true, the character should be in charge of their own betrothal
			}
		}
	}
}


#Betrothal timeout notification for Liege of unlanded Betrothed/Parent liege of betrothed
marriage_interaction.0004 = {
	type = character_event
	title = marriage_interaction.0004.t
	desc = marriage_interaction.0004.desc
	theme = unfriendly
	left_portrait = scope:betrothed_1
	right_portrait = scope:betrothed_2
	
	immediate = {
		show_as_tooltip = {
			scope:betrothed_1 = {
				break_betrothal = scope:betrothed_2
			}
		}
	}

	option = {
		name = marriage_interaction.0004.a
	}
}


#Betrothal timeout notification for the Betrothed when someone else is in charge of the Betrothal
marriage_interaction.0005 = {
	type = character_event
	title = marriage_interaction.0005.t
	desc = marriage_interaction.0005.desc
	theme = unfriendly
	right_portrait = scope:other_betrothed
	
	immediate = {
		if = {
			limit = { scope:betrothed_1 = root }
			scope:betrothed_2 = {
				save_scope_as = other_betrothed
			}
		}
		else = {
			scope:betrothed_1 = {
				save_scope_as = other_betrothed
			}
		}
		show_as_tooltip = {
			scope:betrothed_1 = {
				break_betrothal = scope:betrothed_2
			}
		}
	}

	option = {
		name = marriage_interaction.0005.a
	}
}


#Betrothal timeout notification for the Betrothed when they themselves are in charge of the Betrothal
marriage_interaction.0006 = {
	type = character_event
	title = marriage_interaction.0006.t
	desc = marriage_interaction.0006.desc
	theme = unfriendly
	right_portrait = scope:other_betrothed
	
	immediate = {
		if = {
			limit = { scope:betrothed_1 = root }
			scope:betrothed_2 = {
				save_scope_as = other_betrothed
			}
		}
		else = {
			scope:betrothed_1 = {
				save_scope_as = other_betrothed
			}
		}
		show_as_tooltip = {
			scope:betrothed_1 = {
				break_betrothal = scope:betrothed_2
			}
		}
	}

	option = {
		name = marriage_interaction.0006.a
	}
}

#One of the betrothed became part of clergy that doesn't allow marriage
marriage_interaction.0007 = {
	hidden = yes

	trigger = {
		is_betrothed = yes
		OR = {
			AND = {
				is_clergy = yes
				faith = {
					NOT = { has_doctrine_parameter = clergy_can_marry }
				}
			}
			betrothed = {
				AND = {
					is_clergy = yes
					faith = {
						NOT = { has_doctrine_parameter = clergy_can_marry }
					}
				}
			}
		}
	}

	immediate = {
		betrothed = {
			save_scope_as = scope_of_betrothed
		}
		if = {
			limit = {
				is_clergy = yes
				faith = {
					NOT = { has_doctrine_parameter = clergy_can_marry }
				}
			}
			save_scope_as = betrothed_clergy
			betrothed = {
				save_scope_as = betrothed_2
			}
		}
		else = {
			save_scope_as = betrothed_2
			betrothed = {
				save_scope_as = betrothed_clergy
			}
		}
		scope:betrothed_clergy = {
			break_betrothal = scope:betrothed_2
		}

		if = {
			limit = {
				OR = {
					is_courtier = yes
					AND = { #Landed characters with parent lieges will have the liege in charge of their betrothal
						is_landed = yes
						liege = { is_parent_of = root }
					}
				}
			}
			liege = { trigger_event = marriage_interaction.0008 }
			trigger_event = marriage_interaction.0009
		}
		else = {
			trigger_event = marriage_interaction.0009 #If none of the above are true, the character should be in charge of their own betrothal
		}
		scope:scope_of_betrothed = {
			if = {
				limit = {
					OR = {
						is_courtier = yes # Courtiers have a Liege in charge of their betrothal
						AND = { # Landed characters with parent lieges will have the liege in charge of their betrothal
							is_landed = yes
							liege = { is_parent_of = prev }
						}
					}
				}
				liege = { trigger_event = marriage_interaction.0008 }
				trigger_event = marriage_interaction.0009
			}
			else = {
				trigger_event = marriage_interaction.0009 #If none of the above are true, the character should be in charge of their own betrothal
			}
		}
	}
}

#For the two betrothed
marriage_interaction.0008 = {
	type = character_event
	title = marriage_interaction.0008.t
	desc = marriage_interaction.0008.desc
	theme = faith
	right_portrait = scope:betrothed_clergy
	left_portrait = scope:betrothed_2
	
	immediate = {
		show_as_tooltip = {
			scope:betrothed_clergy = {
				break_betrothal = scope:betrothed_2
			}
		}
	}

	option = {
		name = marriage_interaction.0008.a
	}
}

#For the two betrothed
marriage_interaction.0009 = {
	type = character_event
	title = marriage_interaction.0008.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					root = scope:betrothed_clergy
				}
				desc = marriage_interaction.0009.desc_clergy
			}
			desc = marriage_interaction.0009.desc
		}
	}
	theme = faith
	right_portrait = scope:other_betrothed
	
	immediate = {
		if = {
			limit = { scope:betrothed_clergy = root }
			scope:betrothed_2 = {
				save_scope_as = other_betrothed
			}
		}
		else = {
			scope:betrothed_clergy = {
				save_scope_as = other_betrothed
			}
		}
		
		show_as_tooltip = {
			scope:betrothed_clergy = {
				break_betrothal = scope:betrothed_2
			}
		}
	}

	option = {
		name = marriage_interaction.0009.a
	}
}


# Marriage Proposal: Accepted
marriage_interaction.0010 = {
	type = letter_event
	opening = {
		desc = char_interaction.0010.opening
	}
	desc = {
		first_valid = {
			triggered_desc = { # Betrothal intro (not related)
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
						scope:secondary_actor = { has_been_promised_grand_wedding = yes }
						scope:secondary_recipient = { has_been_promised_grand_wedding = yes }
					}
					scope:secondary_recipient = {
						NOT = {
							is_close_or_extended_family_of = scope:recipient
						}
					}
				}
				desc = marriage_interaction.0010.d_desc
			}
			triggered_desc = { # Betrothal intro (related)
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
						scope:secondary_actor = { has_been_promised_grand_wedding = yes }
						scope:secondary_recipient = { has_been_promised_grand_wedding = yes }
					}
				}
				desc = marriage_interaction.0010.b_desc
			}
			triggered_desc = { # Marrying each other!
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor = scope:actor
				}
				desc = marriage_interaction.0010.e_desc
			}
			triggered_desc = { # Marriage, not related.
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					NOR = {
						scope:secondary_recipient = { is_close_or_extended_family_of = scope:recipient }
						scope:secondary_recipient = scope:recipient
					}
				}
				desc = marriage_interaction.0010.c_desc
			}
			desc = marriage_interaction.0010.desc
		}
		first_valid = {
			triggered_desc = { # (Betrothal) Neither of the parts are actor/recipient
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
					}
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
				}
				desc = marriage_interaction.0010.mid.d_desc
			}
			triggered_desc = { # (Betrothal) The actor is marrying
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
					}
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
				}
				desc = marriage_interaction.0010.mid.e_desc
			}
			triggered_desc = { # (Betrothal) The recipient is marrying (and is a younger child)
				trigger = {
					scope:secondary_recipient = { is_adult = no }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
				}
				desc = marriage_interaction.0010.mid.g_desc
			}
			triggered_desc = { # (Betrothal) The recipient is marrying
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
					}
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
				}
				desc = marriage_interaction.0010.mid.f_desc
			}
			triggered_desc = { # (Betrothal) The actor and recipient are marrying
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
					}
					scope:secondary_actor = scope:actor
					scope:secondary_recipient = scope:recipient
				}
				desc = marriage_interaction.0010.mid.h_desc
			}
			### anti-acquaintance block
			triggered_desc = { # Neither of the parts are actor/recipient (anti-acquaintance version)
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
					scope:secondary_actor = {
						NOT = {
							is_close_or_extended_family_of = scope:actor
						}
					}
				}
				desc = marriage_interaction.0010.mid.a_no_acquaintance_desc
			}
			triggered_desc = { # The recipient is marrying (anti-acquaintance version)
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
					scope:secondary_actor = {
						NOT = {
							is_close_or_extended_family_of = scope:actor
						}
					}
				}
				desc = marriage_interaction.0010.mid.c_no_acquaintance_desc
			}
			### End of anti-acquaintance block
			triggered_desc = { # Neither of the parts are actor/recipient
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
				}
				desc = marriage_interaction.0010.mid.a_desc
			}
			triggered_desc = { # The actor is marrying
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
				}
				desc = marriage_interaction.0010.mid.b_desc
			}
			triggered_desc = { # The recipient is marrying
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
				}
				desc = marriage_interaction.0010.mid.c_desc
			}
		}
		first_valid = {
			# Fruitful in spite of hatred
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_rival = scope:secondary_actor
					}
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
				}
				desc = marriage_interaction.0010.ending.d_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_rival = scope:secondary_actor
					}
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
				}
				desc = marriage_interaction.0010.ending.d_actor_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_rival = scope:secondary_actor
					}
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
				}
				desc = marriage_interaction.0010.ending.d_recipient_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_rival = scope:secondary_actor
					}
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor = scope:actor
				}
				desc = marriage_interaction.0010.ending.d_both_desc
			}
			# Perfect match
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_soulmate = scope:secondary_actor
					}
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
				}
				desc = marriage_interaction.0010.ending.e_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_soulmate = scope:secondary_actor
					}
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
				}
				desc = marriage_interaction.0010.ending.e_actor_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_soulmate = scope:secondary_actor
					}
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
				}
				desc = marriage_interaction.0010.ending.e_recipient_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = {
						is_adult = yes
						has_relation_soulmate = scope:secondary_actor
					}
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor = scope:actor
				}
				desc = marriage_interaction.0010.ending.e_both_desc
			}
			# Recipient hates secondary recipient
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
					scope:recipient = {
						OR = {
							has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:secondary_recipient }
							opinion = {
								target = scope:secondary_recipient
								value <= -70
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.f_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
					scope:recipient = {
						OR = {
							has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:secondary_recipient }
							opinion = {
								target = scope:secondary_recipient
								value <= -70
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.f_actor_desc
			}
			# Sinner, or criminal
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					NOR = {
						scope:secondary_actor = scope:actor
						scope:secondary_recipient = scope:recipient
					}
					OR = {
						scope:secondary_actor = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_actor
									FAITH = scope:recipient.faith
								}
							}
						}
						scope:secondary_recipient = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_recipient
									FAITH = scope:recipient.faith
								}
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.g_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_actor = scope:actor
					scope:secondary_recipient != scope:recipient
					OR = {
						scope:secondary_actor = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_actor
									FAITH = scope:recipient.faith
								}
							}
						}
						scope:secondary_recipient = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_recipient
									FAITH = scope:recipient.faith
								}
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.g_actor_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor != scope:actor
					OR = {
						scope:secondary_actor = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_actor
									FAITH = scope:recipient.faith
								}
							}
						}
						scope:secondary_recipient = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_recipient
									FAITH = scope:recipient.faith
								}
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.g_recipient_desc
			}
			triggered_desc = {
				trigger = {
					scope:secondary_actor = { is_adult = yes }
					scope:secondary_recipient = { is_adult = yes }
					scope:secondary_recipient = scope:recipient
					scope:secondary_actor = scope:actor
					OR = {
						scope:secondary_actor = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_actor
									FAITH = scope:recipient.faith
								}
							}
						}
						scope:secondary_recipient = {
							OR = {
								num_sinful_traits >= 3
								has_any_shunned_or_criminal_trait_in_faith_trigger = {
									CHARACTER = scope:secondary_recipient
									FAITH = scope:recipient.faith
								}
							}
						}
					}
				}
				desc = marriage_interaction.0010.ending.g_both_desc
			}
			desc = { #These are more unspecific and widely applicable, so we use them as random fallbacks!
				random_valid = {
					# Long life and many children
					triggered_desc = {
						trigger = {
							scope:secondary_actor = {
								is_adult = yes
								is_visibly_fertile = yes
							}
							scope:secondary_recipient = {
								is_adult = yes
								is_visibly_fertile = yes
							}
							NOR = {
								scope:secondary_actor = scope:actor
								scope:secondary_recipient = scope:recipient
							}
						}
						desc = marriage_interaction.0010.ending.a_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = {
								is_adult = yes
								is_visibly_fertile = yes
							}
							scope:secondary_recipient = {
								is_adult = yes
								is_visibly_fertile = yes
								can_have_children_with = { CHARACTER = scope:secondary_actor }
							}
							scope:secondary_actor = scope:actor
							scope:secondary_recipient != scope:recipient
						}
						desc = marriage_interaction.0010.ending.a_actor_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = {
								is_adult = yes
								is_visibly_fertile = yes
							}
							scope:secondary_recipient = {
								is_adult = yes
								is_visibly_fertile = yes
								can_have_children_with = { CHARACTER = scope:secondary_actor }
							}
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor != scope:actor
						}
						desc = marriage_interaction.0010.ending.a_recipient_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = {
								is_adult = yes
								is_visibly_fertile = yes
							}
							scope:secondary_recipient = {
								is_adult = yes
								is_visibly_fertile = yes
								can_have_children_with = { CHARACTER = scope:secondary_actor }
							}
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor = scope:actor
						}
						desc = marriage_interaction.0010.ending.a_both_desc
					}
					# May HighGod bless the union
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							NOR = {
								scope:secondary_actor = scope:actor
								scope:secondary_recipient = scope:recipient
							}
						}
						desc = marriage_interaction.0010.ending.b_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_actor = scope:actor
							scope:secondary_recipient != scope:recipient
						}
						desc = marriage_interaction.0010.ending.b_actor_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor != scope:actor
						}
						desc = marriage_interaction.0010.ending.b_recipient_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor = scope:actor
						}
						desc = marriage_interaction.0010.ending.b_both_desc
					}
					# Happy and fulfilling marriage
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							NOR = {
								scope:secondary_actor = scope:actor
								scope:secondary_recipient = scope:recipient
							}
						}
						desc = marriage_interaction.0010.ending.c_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_actor = scope:actor
							scope:secondary_recipient != scope:recipient
						}
						desc = marriage_interaction.0010.ending.c_actor_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor != scope:actor
						}
						desc = marriage_interaction.0010.ending.c_recipient_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor = scope:actor
						}
						desc = marriage_interaction.0010.ending.c_both_desc
					}
					# Strength and support
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							NOR = {
								scope:secondary_actor = scope:actor
								scope:secondary_recipient = scope:recipient
							}
						}
						desc = marriage_interaction.0010.ending.h_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_actor = scope:actor
							scope:secondary_recipient != scope:recipient
						}
						desc = marriage_interaction.0010.ending.h_actor_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor != scope:actor
						}
						desc = marriage_interaction.0010.ending.h_recipient_desc
					}
					triggered_desc = {
						trigger = {
							scope:secondary_actor = { is_adult = yes }
							scope:secondary_recipient = { is_adult = yes }
							scope:secondary_recipient = scope:recipient
							scope:secondary_actor = scope:actor
						}
						desc = marriage_interaction.0010.ending.h_both_desc
					}
				}
			}
		}
		triggered_desc = {
			trigger = {
				OR = {
					scope:secondary_actor = { has_been_promised_grand_wedding = yes }
					scope:secondary_recipient = { has_been_promised_grand_wedding = yes }
				}
			}
			desc = marriage_interaction.0010.gwedding.desc
		}
	}
		
	sender = scope:recipient

	immediate = {
		show_as_tooltip = {
			scope:secondary_actor = {
				if = {
					limit = { matrilinear_betrothal = yes }
					create_betrothal_matrilineal = scope:secondary_recipient
				}
				else_if = {
					limit = { patrilinear_betrothal = yes }
					create_betrothal = scope:secondary_recipient
				}
				else_if = {
					limit = { matrilinear_marriage = yes }
					marry_matrilineal = scope:secondary_recipient
				}
				else = { marry = scope:secondary_recipient }
			}
		}
	}

	option = {
		name = EXCELLENT
	}
}

# Marriage Proposal: Refused
marriage_interaction.0011 = {
	type = letter_event
	opening = {
		desc = char_interaction.0001.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						scope:secondary_actor = { is_adult = no }
						scope:secondary_recipient = { is_adult = no }
						scope:secondary_actor = { has_been_promised_grand_wedding = yes }
						scope:secondary_recipient = { has_been_promised_grand_wedding = yes }
					}
				}
				desc = marriage_interaction.0011.b_desc
			}
			desc = marriage_interaction.0011.desc
		}
	}
		
	sender = {
		character = scope:recipient
		animation = dismissal
	}

	option = {
		name = marriage_interaction.0011.a
	}
}

# Betrothal Broken
marriage_interaction.0020 = {
	type = letter_event
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:actor = scope:rejecting_betrothed
					scope:recipient = scope:rejected_betrothed
				}
				desc = marriage_interaction.0020.both_desc
			}
			triggered_desc = {
				trigger = {
					scope:actor = scope:rejecting_betrothed
				}
				desc = marriage_interaction.0020.actor_desc
			}
			triggered_desc = {
				trigger = {
					scope:recipient = scope:rejected_betrothed
				}
				desc = marriage_interaction.0020.recipient_desc
			}
			desc = marriage_interaction.0020.desc
		}
	}

	sender = {
		character = scope:actor
		animation = dismissal
	}

	option = {
		name = marriage_interaction.0020.a
	}
}

# Divorce
marriage_interaction.0030 = {
	type = letter_event
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = marriage_interaction.0030.desc

	sender = {
		character = scope:actor
		animation = dismissal
	}

	option = {
		name = {
			trigger = {
				scope:recipient = {
					OR = {
						has_relation_lover = scope:actor
						opinion = {
							target = scope:actor
							value > 25
						}
					}
				}
			}
			text = marriage_interaction.0030.a_love
		}
		name = {
			trigger = {
				scope:recipient = {
					NOT = { has_relation_lover = scope:actor }
					opinion = {
						target = scope:actor
						value <= 25
					}
				}
			}
			text = marriage_interaction.0030.a
		}
	}
}


#Made you a concubine
marriage_interaction.0040 = {
	type = letter_event
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = marriage_interaction.0040.desc

	sender = scope:actor

	option = {
		name = marriage_interaction.0040.a
	}
}

#Made your imprisoned spouse a concubine
marriage_interaction.0041 = {
	type = letter_event
	opening = {
		desc = call_ally.0001.opening
	}
	desc = marriage_interaction.0041.desc

	sender = scope:actor

	immediate = {
		if = {
			limit = {
				is_spouse_of = scope:recipient
			}
			add_opinion = {
				target = scope:actor
				modifier = forced_spouse_concubine_marriage_opinion
			}
			scope:recipient = {
				divorce = root # no opinion hit, no scripted effect
			}
		}
		else_if = {
			limit = {
				scope:recipient = {
					is_concubine_of = root
				}
			}
			add_opinion = {
				target = scope:actor
				modifier = stole_concubine_opinion
			}
			remove_concubine = scope:recipient
		}
	}

	option = {
		name = marriage_interaction.0041.a
	}
}

#Gave you away as a concubine
marriage_interaction.0042 = {
	type = letter_event
	orphan = yes # Players can't be unlanded concubines
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = marriage_interaction.0042.desc

	sender = scope:actor

	option = {
		name = marriage_interaction.0040.a
	}
}

#Gave your imprisoned spouse away as a concubine
marriage_interaction.0043 = {
	type = letter_event
	opening = {
		desc = call_ally.0001.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					exists = scope:was_concubine
			    }
			    desc = marriage_interaction.0043.desc_concubine
			}
			desc = marriage_interaction.0043.desc_spouse
		}
	}

	sender = scope:actor

	immediate = {
		show_as_tooltip = {
			if = {
				limit = {
					exists = scope:was_concubine
				}
				remove_concubine = scope:secondary_recipient
			}
			else_if = {
				limit = {
					exists = scope:was_spouse
				}
				scope:secondary_recipient = {
					divorce = root # no opinion hit, no scripted effect
				}
			}
			scope:recipient = {
				make_concubine = scope:secondary_recipient
			}
		}
	}

	option = {
		name = marriage_interaction.0041.a
		remove_character_flag = block_release_from_prison_event
	}
}

#Dismissed you as concubine
marriage_interaction.0050 = {
	type = letter_event
	orphan = yes 	 # No point in sending a notification since the player can't be an unlanded concubine in any case
	opening = {
		desc = char_interaction.0020.opening
	}
	desc = marriage_interaction.0050.desc

	sender = scope:actor

	option = {
		name = marriage_interaction.0050.a
	}
}
