####################
# MARRIAGE EFFECT EVENTS
####################

namespace = marriage_effect

#MOTHER - Bastard secret is removed if you marry the right person
marriage_effect.0001 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					OR = {
						AND = {
							AND = {
								is_pregnant = yes
								pregnancy_real_father = { this = scope:new_spouse }
							}
							exists = scope:illegitimate_child
						}
						exists = scope:illegitimate_child_2
					}
				}
				desc = marriage_effect.0001.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0001.desc.child
			}
			triggered_desc = {
				trigger = {
					pregnancy_real_father = { this = scope:new_spouse }
				}
				desc = marriage_effect.0001.desc.pregnancy
			}
		}
	}
	theme = marriage
	left_portrait = {
		character = scope:new_spouse
		animation = happiness
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born
	
	trigger = {
		is_female = yes
		OR = {
			AND = {
				OR = {
					has_character_flag = unmarried_bastard_pregnancy
					has_character_flag = bastard_pregnancy
				}
				pregnancy_real_father = { this = scope:spouse }
			}
			any_secret = {
				type = secret_unmarried_illegitimate_child
				secret_target = {
					real_father ?= {
						any_spouse = { this = ROOT }
						this = scope:spouse  #To make sure it is the new spouse
					}
				}
			}
		}
	}

	on_trigger_fail = { #If the mother isn't the "major" party in the marriage we need to trigger this for her
		if = {
			limit = {
				scope:spouse = {
					is_female = yes
					OR = {
						AND = {
							OR = {
								has_character_flag = unmarried_bastard_pregnancy
								has_character_flag = bastard_pregnancy
							}
							pregnancy_real_father = { this = root }
						}
						any_secret = {
							type = secret_unmarried_illegitimate_child
							secret_target = {
								real_father ?= {
									this = root  #To make sure it is the new spouse
								}
							}
						}
					}
				}
			}
			save_scope_as = spouse_scope
			scope:spouse = {
				scope:spouse_scope = {
					save_scope_as = spouse
				}
				trigger_event = marriage_effect.0001
			}
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		save_scope_as = real_mother
		if = {
			limit = {
				any_secret = {
					type = secret_unmarried_illegitimate_child
					secret_target = {
						real_father = {
							any_spouse = { this = ROOT }
							this = scope:spouse #To make sure it is the new spouse
						}
					}
				}
			}
			random_secret = {
				type = secret_unmarried_illegitimate_child
				limit = {
					secret_target = {
						real_father = {
							any_spouse = { this = ROOT }
							this = scope:spouse #To make sure it is the new spouse
						}
					}
				}
				secret_target = {
					real_father = {
						save_scope_as = new_spouse
					}
				}
			}
		}
		else ={
			pregnancy_real_father = { save_scope_as = new_spouse }
			remove_variable = dead_spouse #To make sure the new spouse is set as father
		}
		
	
		if = {
			limit = {
				exists = var:dead_spouse
			}
			var:dead_spouse ={
				save_scope_as = dead_father
			}
		}

		#Marks all the children whose corresponding secret should be cleared
		every_secret = {
			type = secret_unmarried_illegitimate_child
			limit = {
				secret_target = { real_father = { this = scope:new_spouse } }
			}
			secret_target = {
				add_character_flag = clear_bastard_secret
				save_scope_as = illegitimate_child #Save for portrait and desc
				hidden_effect = {
					if = {
						limit = {
							root = { exists = scope:dead_father }
						}
						set_father = scope:dead_father
					}
					else = {
						set_father = scope:new_spouse
					}
				}
			}
		}

		random_child = { #If there is another child, save it as an event target
			limit = {
				has_character_flag = clear_bastard_secret
				this != scope:illegitimate_child
			}
			save_scope_as = illegitimate_child_2
			hidden_effect = {
				if = {
					limit = {
						root = { exists = scope:dead_father }
					}
					set_father = scope:dead_father
				}
				else_if = {
					limit = {
						root = {
							NOT = {
								exists = scope:dead_father
							}
						}
					}
					set_father = scope:new_spouse
				}
			}
		}

		if = { #To trigger an event for the real_father if he is a secret_knower
			limit = {
				OR ={
					any_secret = {
						type = secret_unmarried_illegitimate_child
						secret_target = {
							real_father = { this = scope:new_spouse }
						}
						any_secret_knower = {
							this = scope:new_spouse
						}
					}
					has_character_flag = unmarried_bastard_pregnancy
					has_character_flag = bastard_pregnancy
				}
			}
			scope:new_spouse = {
				trigger_event = marriage_effect.0002
			}
		}
		#To inform all secret knowers
		random_secret = {
			type = secret_unmarried_illegitimate_child
			limit = {
				secret_target = {
					real_father = { this = scope:new_spouse }
				}
			}
			every_secret_knower = {
				limit = {
					NOR = {
						this = scope:new_spouse
						this = root
					}
				}
				trigger_event = marriage_effect.0003
			}
		}

		#If it's a pregnancy then unmark it as a bastard pregnancy
		if = {
			limit = {
				has_character_flag = unmarried_bastard_pregnancy
			}
			remove_character_flag = unmarried_bastard_pregnancy
		}
		if = {
			limit = {
				has_character_flag = bastard_pregnancy
			}
			remove_character_flag = bastard_pregnancy
		}
	}

	option = {
		name = marriage_effect.0001.a

		stress_impact = {
			base = medium_stress_loss
		}

		every_secret = {
			limit = {
				OR = {
					secret_target ?= { has_character_flag = clear_bastard_secret }
					ROOT = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
			}
			remove_secret = yes
		}
		every_child = {
			remove_character_flag = clear_bastard_secret
		}
	}
}





#FATHER - notification event if you marry the mother and knows the secret
marriage_effect.0002 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					exists = scope:illegitimate_child
					exists = scope:illegitimate_child_2
				}
				desc = marriage_effect.0002.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0002.desc.child
			}
			triggered_desc = {
			    trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
						OR = {
							has_character_flag = pregnancy_real_father_knows
							has_character_flag = pregnancy_real_father_of_bastard_is_known_flag
						}
					}
			    }
			    desc = marriage_effect.0002.desc.pregnancy
			}
			triggered_desc = {
				trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
				desc = marriage_effect.0002.desc.pregnancy_not_knowing
			}
		}
	}
	theme = marriage
	right_portrait = {
		character = scope:real_mother
		animation = happiness
	}
	left_portrait = {
		character = scope:new_spouse
		animation = personality_compassionate
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born
	
	trigger = {
		is_male = yes
		any_spouse = {
			this = scope:real_mother
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		#Marks all the children whose corresponding secret should be cleared
		scope:new_spouse = {
			every_secret = {
				type = secret_unmarried_illegitimate_child
				limit = {
					secret_target = {
						real_father = { this = scope:new_spouse }
						mother = { this = scope:real_mother }
					}
				}
				secret_target = {
					add_character_flag = saved_child
					save_scope_as = illegitimate_child #Save for portrait and desc
				}
			}
		}

		random_child = { #If there is another child, save it as an event target
			limit = {
				has_character_flag = saved_child
				this != scope:illegitimate_child
			}
			save_scope_as = illegitimate_child_2
		}
	}

	option = {
		name = {
			trigger = {
				scope:real_mother = {
					is_pregnant = yes
					pregnancy_real_father = {
						this = scope:new_spouse
					}
					NOR = {
						has_character_flag = pregnancy_real_father_knows
						has_character_flag = pregnancy_real_father_of_bastard_is_known_flag
					}
				}
			}
			text = marriage_effect.0001.a_not_knowing
		}
		name = {
			trigger = { always = yes }
			text = marriage_effect.0001.a
		}

		#To block other events on the subject
		scope:real_mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}

		stress_impact = {
			base = medium_stress_loss
		}
	}
}


#Notification event for every other secret knower
marriage_effect.0003 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
				desc = marriage_effect.0003.desc.pregnancy
			}
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					exists = scope:illegitimate_child
					exists = scope:illegitimate_child_2
				}
				desc = marriage_effect.0003.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0003.desc
			}
		}
	}
	theme = marriage
		right_portrait = {
		character = scope:real_mother
		animation = happiness
	}
	left_portrait = {
		character = scope:new_spouse
		animation = personality_compassionate
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born

	immediate = { play_music_cue_once = { TRACK = mx_cue_marriage } }

	option = {
		name = marriage_effect.0001.a
	}
}


#MOTHER - Bastard secret is removed if you become the concubine of the right person
marriage_effect.0011 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					OR = {
						AND = {
							AND = {
								is_pregnant = yes
								pregnancy_real_father = { this = scope:new_spouse }
							}
							exists = scope:illegitimate_child
						}
						exists = scope:illegitimate_child_2
					}
				}
				desc = marriage_effect.0011.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0011.desc.child
			}
			triggered_desc = {
				trigger = {
					pregnancy_real_father = { this = scope:new_spouse }
				}
				desc = marriage_effect.0011.desc.pregnancy
			}
		}
	}
	theme = marriage
	left_portrait = {
		character = scope:new_spouse
		animation = happiness
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born
	
	trigger = {
		is_female = yes
		OR = {
			AND = {
				OR = {
					has_character_flag = unmarried_bastard_pregnancy
					has_character_flag = bastard_pregnancy
				}
				pregnancy_real_father = { this = scope:consort }
			}
			any_secret = {
				type = secret_unmarried_illegitimate_child
				secret_target = {
					real_father ?= {
						any_consort = { this = ROOT }
						this = scope:consort  #To make sure it is the new partner
					}
				}
			}
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		save_scope_as = real_mother
		if = {
			limit = {
				any_secret = {
					type = secret_unmarried_illegitimate_child
					secret_target = {
						real_father = {
							any_spouse = { this = ROOT }
							this = scope:consort #To make sure it is the new partner
						}
					}
				}
			}
			random_secret = {
				type = secret_unmarried_illegitimate_child
				limit = {
					secret_target = {
						real_father = {
							any_spouse = { this = ROOT }
							this = scope:consort #To make sure it is the new partner
						}
					}
				}
				secret_target = {
					real_father = {
						save_scope_as = new_spouse
					}
				}
			}
		}
		else ={
			pregnancy_real_father = { save_scope_as = new_spouse }
			remove_variable = dead_spouse #To make sure the new spouse is set as father
		}
	
		if = {
			limit = {
				exists = var:dead_spouse
			}
			var:dead_spouse ={
				save_scope_as = dead_father
			}
		}

		#Marks all the children whose corresponding secret should be cleared
		every_secret = {
			type = secret_unmarried_illegitimate_child
			limit = {
				secret_target = { real_father = { this = scope:new_spouse } }
			}
			secret_target = {
				add_character_flag = clear_bastard_secret
				save_scope_as = illegitimate_child #Save for portrait and desc
				hidden_effect = {
					if = {
						limit = {
							root = { exists = scope:dead_father }
						}
						set_father = scope:dead_father
					}
					else = {
						set_father = scope:new_spouse
					}
				}
			}
		}

		random_child = { #If there is another child, save it as an event target
			limit = {
				has_character_flag = clear_bastard_secret
				this != scope:illegitimate_child
			}
			save_scope_as = illegitimate_child_2
			hidden_effect = {
				if = {
					limit = {
						root = { exists = scope:dead_father }
					}
					set_father = scope:dead_father
				}
				else_if = {
					limit = {
						root = {
							NOT = {
								exists = scope:dead_father
							}
						}
					}
					set_father = scope:new_spouse
				}
			}
		}

		if = { #To trigger an event for the real_father if he is a secret_knower
			limit = {
				OR ={
					any_secret = {
						type = secret_unmarried_illegitimate_child
						secret_target = {
							real_father = { this = scope:new_spouse }
						}
						any_secret_knower = {
							this = scope:new_spouse
						}
					}
					has_character_flag = unmarried_bastard_pregnancy
					has_character_flag = bastard_pregnancy
				}
			}
			scope:new_spouse = {
				trigger_event = marriage_effect.0012
			}
		}

		#To inform all secret knowers
		random_secret = {
			type = secret_unmarried_illegitimate_child
			limit = {
				secret_target = {
					real_father = { this = scope:new_spouse }
				}
			}
			every_secret_knower = {
				limit = {
					NOR = {
						this = scope:new_spouse
						this = root
					}
				}
				trigger_event = marriage_effect.0013
			}
		}

		#If it's a pregnancy then unmark it as a bastard pregnancy
		if = {
			limit = {
				has_character_flag = unmarried_bastard_pregnancy
			}
			remove_character_flag = unmarried_bastard_pregnancy
		}
		if = {
			limit = {
				has_character_flag = bastard_pregnancy
			}
			remove_character_flag = bastard_pregnancy
		}
	}

	option = {
		name = marriage_effect.0001.a

		stress_impact = {
			base = medium_stress_loss
		}

		every_secret = {
			limit = {
				exists = secret_target
				OR = {
					secret_target = { has_character_flag = clear_bastard_secret }
					ROOT = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
			}
			remove_secret = yes
		}
		every_child = {
			remove_character_flag = clear_bastard_secret
		}
	}
}


#FATHER - Concubine - notification event if you marry the mother and knows the secret (basically a copy of marriage_effect.0002)
marriage_effect.0012 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					exists = scope:illegitimate_child
					exists = scope:illegitimate_child_2
				}
				desc = marriage_effect.0012.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0012.desc.child
			}
			triggered_desc = {
				trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
						OR = {
							has_character_flag = pregnancy_real_father_knows
							has_character_flag = pregnancy_real_father_of_bastard_is_known_flag
						}
					}
				}
				desc = marriage_effect.0012.desc.pregnancy
			}
			triggered_desc = {
				trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
				desc = marriage_effect.0012.desc.pregnancy_not_knowing
			}
		}
	}
	theme = marriage
	right_portrait = {
		character = scope:real_mother
		animation = happiness
	}
	left_portrait = {
		character = scope:new_spouse
		animation = personality_compassionate
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born
	
	trigger = {
		is_male = yes
		any_consort = {
			this = scope:real_mother
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		#Marks all the children whose corresponding secret should be cleared
		scope:new_spouse = {
			every_secret = {
				type = secret_unmarried_illegitimate_child
				limit = {
					secret_target = {
						real_father = { this = scope:new_spouse }
						mother = { this = scope:real_mother }
					}
				}
				secret_target = {
					add_character_flag = saved_child
					save_scope_as = illegitimate_child #Save for portrait and desc
				}
			}
		}

		random_child = { #If there is another child, save it as an event target
			limit = {
				has_character_flag = saved_child
				this != scope:illegitimate_child
			}
			save_scope_as = illegitimate_child_2
		}
	}

	option = {
		name = {
			trigger = {
				scope:real_mother = {
					is_pregnant = yes
					pregnancy_real_father = {
						this = scope:new_spouse
					}
					NOR = {
						has_character_flag = pregnancy_real_father_knows
						has_character_flag = pregnancy_real_father_of_bastard_is_known_flag
					}
				}
			}
			text = marriage_effect.0001.a_not_knowing
		}
		name = {
			trigger = { always = yes }
			text = marriage_effect.0001.a
		}

		#To block other events on the subject
		scope:real_mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}

		stress_impact = {
			base = medium_stress_loss
		}
	}
}


#Concubine - Notification event for every other secret knower (basically a copy of marriage_effect.0003)
marriage_effect.0013 = {
	type = character_event
	title = marriage_effect.0001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:real_mother = {
						is_pregnant = yes
						pregnancy_real_father = {
							this = scope:new_spouse
						}
					}
				}
				desc = marriage_effect.0013.desc.pregnancy
			}
			triggered_desc = { #Multiple illegitimate children now legitimate
				trigger = {
					exists = scope:illegitimate_child
					exists = scope:illegitimate_child_2
				}
				desc = marriage_effect.0013.desc.multiple
			}
			triggered_desc = {
				trigger = { exists = scope:illegitimate_child }
				desc = marriage_effect.0013.desc
			}
		}
	}
	theme = marriage
		right_portrait = {
		character = scope:real_mother
		animation = happiness
	}
	left_portrait = {
		character = scope:new_spouse
		animation = personality_compassionate
	}
	lower_left_portrait = scope:illegitimate_child #Only appears if child is already born
	lower_center_portrait = scope:illegitimate_child_2 #Only appears if there are multiple bastards already born

	immediate = { play_music_cue_once = { TRACK = mx_cue_marriage } }

	option = {
		name = marriage_effect.0001.a
	}
}



#If you marry your lover - root
marriage_effect.1001 = {
	type = character_event
	title = marriage_effect.1001.t
	desc = marriage_effect.1001.desc
	theme = marriage
	left_portrait = {
		character = scope:spouse
		animation = happiness
	}
	
	trigger = {
		any_relation = {
			type = lover
			this = scope:spouse
		}
		# We don't want regular events concerning weddings to popup outside the wedding activity
		OR = {
			NOT = { exists = involved_activity }
			involved_activity = {
				NOT = { has_activity_type = activity_wedding }
			}
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		#If the marriage was set via event, configure scopes for the description correctly.
		if = {
			limit = {
				NOT = { exists = scope:spouse }
			}
			random_relation = {
				type = lover
				limit = { is_spouse_of = root }
				save_scope_as = spouse
			}
		}
	}

	option = {
		name = marriage_effect.1001.a
		save_scope_as = spouse_2
		
		scope:spouse = {
			trigger_event = marriage_effect.1002
		}
	}
}

#If you marry your lover - spouse
marriage_effect.1002 = {
	type = character_event
	title = marriage_effect.1001.t
	desc = marriage_effect.1002.desc
	theme = marriage
	left_portrait = {
		character = scope:spouse_2
		animation = happiness
	}

	immediate = { play_music_cue_once = { TRACK = mx_cue_marriage } }

	option = {
		name = marriage_effect.1002.a
		
	}
}

# Monogamous wedding event
marriage_effect.2001 = {
	type = character_event
	title = marriage_effect.2001.t
	override_background = { reference = ep2_wedding_ceremony }
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:new_spouse = {
						is_imprisoned = yes
					}
				}
				desc = marriage_effect.2001.desc.start_prison
			}
			triggered_desc = {
				trigger = {
					faith = {
						has_doctrine_parameter = divine_marriage_piety_gain_active
					}
					scope:new_spouse = {
						is_close_family_of = root
					}
				}
				desc = marriage_effect.2001.desc.start_divine_marriage
			}
			desc = marriage_effect.2001.desc.start_normal
		}
		desc = marriage_effect.2001.desc.end
	}
	theme = marriage
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { 
				scope:new_spouse = {
					is_imprisoned = yes 
				}
			}
			animation = shame
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = happiness
		}
	}
	right_portrait = {
		character = scope:new_spouse
		triggered_animation = {
			trigger = { is_imprisoned = yes }
			animation = shame
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = flirtation_left
		}
	}
	
	trigger = {
		# Only rulers are important enough for people to care about their marriage.
		is_ruler = yes

		# Is not a LAAMP
		is_landed_or_landless_administrative = yes

		# Only monogamous faiths care enough about a single marriage for the event.
		faith = {
			has_doctrine_parameter = marriage_event
		}

		# Only a character's first spouse counts.
		NOT ={
			any_spouse = {
				even_if_dead = yes
				this != scope:spouse
			}
		}

		# Spouse also needs to be alive
		scope:spouse = {
			is_alive = yes
		}

		# If a family was previously generated for us, don't fire the marriage event (we were presumably married before the game started).
		# This flag is also used for divorce cases
		NOT = { has_character_flag = ignore_marriage_event }

		# We don't want regular events concerning weddings to popup outside the wedding activity
		OR = {
			NOT = { exists = involved_activity }
			involved_activity = {
				NOT = { has_activity_type = activity_wedding }
			}
		}
	}

	immediate = {
		play_music_cue_once = { TRACK = mx_cue_marriage }
		scope:spouse = {
			save_scope_as = new_spouse
		}
	}

	option = {
		name = marriage_effect.2001.a
		add_treasury_or_gold = major_treasury_or_gold_value
	}

	option = {
		name = marriage_effect.2001.b
		add_prestige = major_prestige_value
	}

	after = {
		if = {
			limit = {
				faith = {
					has_doctrine_parameter = divine_marriage_piety_gain_active
				}
				scope:new_spouse = {
					is_close_family_of = root
				}
			}
			add_piety = massive_piety_value
		}
		save_scope_as = spouse_scope
		scope:spouse = {
			scope:spouse_scope = {
				save_scope_as = spouse
			}
			trigger_event = marriage_effect.0001
		}

		hidden_effect = {
			# To disable prestige & gold remarrying exploit
			add_character_flag = ignore_marriage_event
		}
	}
}


#Your spouse that you loved divorced you
marriage_effect.3001 = {
	hidden = yes
	
	trigger = {
		opinion = {
			target = scope:spouse_2
			value >= 30
		}
		OR = {
			has_relation_lover = scope:spouse_2
			has_opinion_modifier = {
				modifier = love_opinion
				target = scope:spouse_2
			}
			opinion = {
				target = scope:spouse_2
				value >= 60
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = make_suicide_available
			years = 10
		}
		set_variable = {
				name = messy_divorce
				value = yes
		}
	}
}
