#Events fired by the Lover relation

namespace = lover

############################
## Relation status changes
## 0000-0999
## by Linnéa Thimrén and Petter Vilberg
############################
#lover.0001 - You consider abandoning a Lover you have a low opinion of
#lover.0003 - Too many lovers, choice whether to break up with one or not
#lover.0101 - Break up - your lover imprisoned you!
#lover.0103 - Break up - waging war against your lover!
#lover.0201 - Normal interaction break-up
#lover.0202 - Spouse interaction break-up
#lover.0203 - Relived interaction break-up
#lover.0300 - Ask lover to be exclusive (Lover -> Soulmate)

############################
## Positive effects
## 1000-1999
## by Linnéa Thimrén and Petter Vilberg
############################
#lover.1001 - An unlanded Lover shares a secret about someone else with you
#lover.1002 - A Lover adds a progress modifier to a diplomatic scheme
#lover.1003 - Lover helps you lose stress
#lover.1004 - Go on "vacation" with lover
#lover.1006 - Liege lover granting council position
#lover.1007 - Liege lover granting better contract
#lover.1008 - Liege lover granting county modifier

############################
## Negative effects
## 2000-2999
## by Linnéa Thimrén and Petter Vilberg
############################
#lover.2001 - Having a secret lover is stressful
#lover.2002 - High stress deteriorates your relationship to a lover
#lover.2004 - Question soulmate about spouse

############################
## Other ongoing events
## 3000-3999
## by Linnéa Thimrén and Petter Vilberg
############################
#lover.3002 - Love letter complex
#lover.3201 - Leave lover_object_of_importance for lover to find
#lover.3203 - Go to your spouse or your lover
#lover.3204 - Your lover is far far away
#lover.3206 - You're forced to wage war against your lover
#lover.3207 - Write letter to beloved! (long-distance relationship)
#lover.3211 - Send lover a painting (long-distance relationship)
#lover.3215 - Send a troubadour to lover's court (long-distance relationship)
#lover.3219 - Send a personal object to lover (long-distance relationship)

############################
## Gain potential lover relation
## 7000-7999
## by Linnéa Thimrén
############################
#lover.7001 - Gain potential lover relation with a friend
#lover.7003 - Gain potential lover relation with rival
#lover.7005 - Gain potential lover relation with close family

#####################################################################################


#####################################
# RELATION STATUS CHANGES
# 0000-0999
#####################################

#####################
# Lover with low opinion abandons Lover
# 0001-0002
# by Petter Vilberg and Linnéa Thimrén
#####################

#A lover with low opinion of you considers breaking the relation off

scripted_trigger lover_0001_breakup_candidate_trigger = {
	save_temporary_scope_as = lover_check
	lover_0001_breakup_opinion_trigger = yes
	NOT = {
		has_relation_flag = {
			target = root
			relation = lover
			flag = delay_further_breakup_events
		}
	}
}

scripted_trigger lover_0001_breakup_opinion_trigger = {
	#Why are they doubting the relationship?
	OR = {
		opinion = { #They simply dislike you
			target = root
			value <= -30
		}
		AND = { #You're a known murderer
			root = { has_trait = murderer }
			opinion = {
				target = root
				value <= -5
			}
			NOR = {
				has_trait = sadistic
				has_trait = callous
				has_trait = murderer
				any_secret = {
					secret_type = secret_murder
				}
			}
		}
		AND = { #They know you're a murderer
			root = {
				any_secret = {
					secret_type = secret_murder
					is_known_by = scope:lover_check
				}
			}
			opinion = {
				target = root
				value <= -5
			}
			NOR = {
				has_trait = sadistic
				has_trait = callous
				has_trait = murderer
				any_secret = {
					secret_type = secret_murder
				}
			}
		}
	}
}

lover.0001 = {
	type = character_event
	title = lover.0001.t
	desc = {
		desc = lover.0001.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:lover = {
						lover_0001_breakup_opinion_trigger = yes
					}
				}
				desc = lover.0001.desc_murder
			}
			desc = lover.0001.desc
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = sadness
	}

	trigger = {
		any_relation = {
			type = lover
			lover_0001_breakup_candidate_trigger = yes
		}
		NOT = { has_character_flag = had_lover_breakup_event }
	}

	immediate = {
		save_scope_as = first_lover
		random_relation = {
			type = lover
			limit = {
				lover_0001_breakup_candidate_trigger = yes
			}
			save_scope_as = lover
		}
		add_character_flag = {
			flag = had_lover_breakup_event
			days = 730
		}
	}

	option = { #It was nice, but it is time to break up
		name = lover.0001.a
		show_as_tooltip = {
			remove_relation_lover = scope:lover
		}
		hidden_effect = {
			#The notification event actually removes the relation
			scope:lover = {
				trigger_event = lover.0002
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:lover
				multiplier = -1
			}
		}
	}

	option = { #I'm in this for other reasons
		name = lover.0001.b
		custom_tooltip = lover.0001.b.tt
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 10
			}
		}
		if = {
			limit = { is_ai = no }
			add_relation_flag = {
				target = scope:lover
				relation = lover
				flag = delay_further_breakup_events
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.25
				ai_compassion = 0.25
			}
			modifier = {
				add = 100
				any_scheme = {
					scheme_is_character_agent = scope:lover
				}
			}
			modifier = {
				add = 100
				scope:lover = {
					any_spouse = {
						has_relation_rival = root
					}
				}
			}
		}
	}
}


#Lover with a low opinion of you breaks up
lover.0002 = {
	type = character_event
	title = lover.0002.t
	desc = {
		first_valid = {
			#Trait dependent descs
			random_valid = {
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						has_trait = vengeful
					}
					desc = lover.0002.like.vengeful
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 20
						}
						has_trait = vengeful
					}
					desc = lover.0002.dislike.vengeful
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						has_trait = humble
					}
					desc = lover.0002.like.humble
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						has_trait = arrogant
					}
					desc = lover.0002.like.arrogant
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 20
						}
						has_trait = arrogant
					}
					desc = lover.0002.dislike.arrogant
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						has_trait = lustful
					}
					desc = lover.0002.like.lustful
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 20
						}
						has_trait = lustful
					}
					desc = lover.0002.dislike.lustful
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						has_trait = paranoid
					}
					desc = lover.0002.like.paranoid
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 20
						}
						has_trait = paranoid
					}
					desc = lover.0002.dislike.paranoid
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 20
						}
						OR = {
							has_trait = forgiving
							has_trait = compassionate
						}
					}
					desc = lover.0002.like.understanding
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 20
						}
						OR = {
							has_trait = forgiving
							has_trait = compassionate
						}
					}
					desc = lover.0002.dislike.understanding
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value > 10
						}
						OR = {
							has_trait = wrathful
							has_trait = callous
							has_trait = sadistic
						}
					}
					desc = lover.0002.like.angry
				}
				triggered_desc = {
					trigger = {
						opinion = {
							target = scope:first_lover
							value <= 10
						}
						OR = {
							has_trait = wrathful
							has_trait = callous
							has_trait = sadistic
						}
					}
					desc = lover.0002.dislike.angry
				}
			}

			#Desc depends on how heartbroken you theoretically are
			triggered_desc = {
				trigger = {
					opinion = {
						target = scope:first_lover
						value > 40
					}
				}
				desc = lover.0002.still_in_love
			}
			triggered_desc = {	
				trigger = {
					opinion = {
						target = scope:first_lover
						value > 20
					}
				}
				desc = lover.0002.still_likes
			}
			triggered_desc = {
				trigger = {
					opinion = {
						target = scope:first_lover
						value > 0
					}
				}
				desc = lover.0002.neutral
			}
			triggered_desc = {
				trigger = {
					opinion = {
						target = scope:first_lover
						value > -20
					}
				}
				desc = lover.0002.dislike
			}
			desc = lover.0002.hate
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = dismissal
	}

	immediate = {
		remove_relation_lover = scope:first_lover
	}

	option = { #But why...
		name = lover.0002.a
		trigger = {
			opinion = {
				target = scope:first_lover
				value > 20
			}
		}
		add_opinion = {
			modifier = lover_hurt_me_opinion
			target = scope:first_lover
		}
		show_as_tooltip = {
			remove_relation_lover = scope:first_lover
		}
	}

	option = { #Probably for the best
		name = lover.0002.c
		trigger = {
			opinion = {
				target = scope:first_lover
				value <= 20
			}
			opinion = {
				target = scope:first_lover
				value >= 0
			}
		}
		add_opinion = {
			modifier = lover_hurt_me_opinion
			target = scope:first_lover
		}
		show_as_tooltip = {
			remove_relation_lover = scope:first_lover
		}
	}

	option = { #Thank God
		name = lover.0002.d
		trigger = {
			opinion = {
				target = scope:first_lover
				value < 0
			}
		}
		stress_impact = {
			base = minor_stress_loss
		}
		show_as_tooltip = {
			remove_relation_lover = scope:first_lover
		}
	}

	option = { #I shall never forgive
		name = lover.0002.e
		trigger = {
			OR = {
				has_trait = vengeful
				has_trait = arrogant
				has_trait = callous
				has_trait = sadistic
				has_trait = lunatic
				has_trait = possessed
				opinion = {
					target = scope:first_lover
					value < -10
				}
			}
			NOR = {
				has_trait = forgiving
				has_trait = compassionate
			}
		}

		show_as_tooltip = {
			remove_relation_lover = scope:first_lover
			set_relation_rival = scope:first_lover #Is set in the follow-up
		}

		hidden_effect = {
			#The notification event actually removes the relation
			scope:first_lover = {
				trigger_event = lover.0005
			}
		}
	}
}

#Lover becomes your rival after you break up with them
lover.0005 = {
	type = character_event
	title = lover.0005.t
	desc = lover.0005.desc
	theme = rival_relation
	left_portrait = {
		character = scope:lover
		animation = anger
	}

	trigger = {
		NOT = { has_relation_lover = scope:lover }
	}
	
	immediate = {
		play_music_cue = mx_cue_combat_2
		if = {
			limit = {		
				NOT = {
					has_relation_rival = scope:lover
					has_relation_nemesis = scope:lover
				}
			}
			set_relation_rival = scope:lover
		}
		else_if = {
			limit = {
				has_relation_rival = scope:lover
			}
			set_relation_nemesis = scope:lover
		}
		else = {
			scope:lover = {		
				add_opinion = {
					modifier = hate_opinion
					target = root
					opinion = -50
				}
			}
		}	
	}

	option = {
		name = lover_0005.a
	}
}


#####################
# Too many lovers, choice whether to break up with one or not
# 0003-0004
# by Petter Vilberg
#####################
lover.0003 = {
	type = character_event
	title = lover.0003.t
	desc = {
		desc = lover.0003.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { NOT = { exists = scope:lover_3 } }
				desc = lover.0003.desc.twolovers
			}
			triggered_desc = {
				trigger = { exists = scope:lover_3 }
				desc = lover.0003.desc.threelovers
			}
		}
		desc = lover.0003.desc.end1
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:lover_1 = { is_male = yes }
					scope:lover_2 = { is_male = yes }
					OR = {
						scope:lover_3 = { is_male = yes }
						NOT = { exists = scope:lover_3 }
					}
				}
				desc = lover.0003.desc.end2men
			}
			triggered_desc = {
				trigger = {
					scope:lover_1 = { is_female = yes }
					scope:lover_2 = { is_female = yes }
					OR = {
						scope:lover_3 = { is_female = yes }
						NOT = { exists = scope:lover_3 }
					}
				}
				desc = lover.0003.desc.end2women
			}
			desc = lover.0003.desc.end2people
		}
		desc = lover.0003.desc.end3
	}
	theme = lover_relation
	left_portrait = scope:lover_1
	right_portrait = scope:lover_2
	lower_center_portrait = scope:lover_3
	
	trigger = {
		any_relation = {
			type = lover
			count >= 2
		}
		NOT = { has_character_flag = had_too_many_lovers_event }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			has_trait = seducer
			add = -0.4
		}
		modifier = {
			has_trait = lustful
			add = -0.2
		}
		modifier = {
			has_trait = gregarious
			add = -0.15
		}
		modifier = {
			has_trait = diligent
			add = -0.15
		}
		modifier = {
			has_trait = chaste
			any_relation = {
				type = lover
				NOR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
			add = 0.4
		}
		compare_modifier = {
			target = ROOT
			factor = stress
			multiplier = 0.03
			step = 0.1
		}
		modifier = {
			any_relation = { type = lover count >= 3 }
			factor = 5
		}
		modifier = {
			any_relation = { type = lover count >= 4 }
			factor = 5
		}
	}

	immediate = {
		save_scope_as = first_lover
		#Cooldown
		add_character_flag = {
			flag = had_too_many_lovers_event
			years = 5
		}
		#Find lovers and set activities for them (desc)
		random_relation = {
			type = lover
			save_scope_as = lover_1
			lover_activity_set_variable_effect = yes
		}
		random_relation = {
			type = lover
			limit = {

				NOT = { this = scope:lover_1 }
			}
			save_scope_as = lover_2
			lover_activity_set_variable_effect = yes
		}
		random_relation = {
			type = lover
			limit = {
				NOR = {
					this = scope:lover_1
					this = scope:lover_2
				}
			}
			save_scope_as = lover_3
			lover_activity_set_variable_effect = yes
		}
		#Make sure characters don't have the same activity
		while = {
			limit = {
				scope:lover_1.var:lover_activity = scope:lover_2.var:lover_activity
			}
			scope:lover_2 = { lover_activity_set_variable_effect = yes }
		}
		if = {
			limit = { exists = scope:lover_3 }
			while = {
				limit = {
					OR = {
						scope:lover_1.var:lover_activity = scope:lover_3.var:lover_activity
						scope:lover_2.var:lover_activity = scope:lover_3.var:lover_activity
					}
				}
				scope:lover_3 = { lover_activity_set_variable_effect = yes }
			}
		}
	}

	#Break up with lover 1
	option = {
		name = lover_0003.a

		show_as_tooltip = {
			remove_relation_lover = scope:lover_1
			scope:lover_1 = {
				add_opinion = {
					modifier = lover_abandoned_me_opinion
					target = root
				}
			}
		}

		hidden_effect = {
			scope:lover_1 = {
				trigger_event = lover.0004
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:lover_1
			}
		}
	}

	#Break up with lover 2
	option = {
		name = lover_0003.b

		show_as_tooltip = {
			remove_relation_lover = scope:lover_2
			scope:lover_2 = {
				add_opinion = {
					modifier = lover_abandoned_me_opinion
					target = root
				}
			}
		}

		hidden_effect = {
			scope:lover_2 = {
				trigger_event = lover.0004
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:lover_1
			}
		}
	}
	
	#Break up with lover 3
	option = {
		trigger = { exists = scope:lover_3 }
		name = lover_0003.c

		show_as_tooltip = {
			remove_relation_lover = scope:lover_3
			scope:lover_3 = {
				add_opinion = {
					modifier = lover_abandoned_me_opinion
					target = root
				}
			}
		}

		hidden_effect = {
			scope:lover_3 = {
				trigger_event = lover.0004
			}
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:lover_1
			}
		}
	}

	#Keep them all with my masterful lover skills
	option = {
		trigger = {
			OR = {
				has_trait = lustful
				has_trait = seducer
			}
			NOT = { has_character_flag = used_romancing_skills_to_keep_lovers }
		}
		name = lover_0003.d
		custom_tooltip = lover_0003.d.tt

		hidden_effect = {
			add_character_flag = {
				flag = used_romancing_skills_to_keep_lovers
				years = 15
			}
		}
		ai_chance = {
			base = 1000
		}
	}

	#Keep them for stress cost
	option = {
		trigger = {
			OR = {
				NOR = {
					has_trait = lustful
					has_trait = seducer
				}
				has_character_flag = used_romancing_skills_to_keep_lovers
			}
		}
		name = lover_0003.e
		stress_impact = {
			base = major_stress_gain
		}
		ai_chance = {
			base = 100
			compare_modifier = {
				value = stress
				multiplier = -1
			}
		}
	}
}

#Notification to lover about being abandoned
lover.0004 = {
	type = character_event
	title = lover.0004.t
	desc = lover.0004.desc
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = dismissal
	}

	immediate = {
		add_opinion = {
			modifier = lover_abandoned_me_opinion
			target = scope:first_lover
		}
	}

	option = {
		name = lover_0004.a

		remove_relation_lover = scope:first_lover
		show_as_tooltip = {
			add_opinion = {
				modifier = lover_abandoned_me_opinion
				target = scope:first_lover
			}
		}
	}
}


#Event handling effects upon gaining a lover
lover.0010 = {
	hidden = yes

	immediate = {
		give_incest_secret_or_nothing_with_target_effect = { CHARACTER = scope:target }
		scope:target = { give_incest_secret_or_nothing_with_target_effect = { CHARACTER = root } }
		give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = scope:target }
		scope:target = { give_homosexual_secret_or_nothing_with_target_effect = { CHARACTER = root } }
	}
}


#####################
# Break up - your lover imprisoned you! (triggers from the interaction)
# 0101-0102
# by Linnéa Thimrén
#####################
lover.0101 = {
	type = character_event
	title = lover.0101.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_in_prison_type = dungeon
				}
				desc = lover.0101.desc_dungeon
			}
			desc = lover.0101.desc_house_arrest
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = dismissal
	}

	trigger = {
		NOT = { has_character_flag = had_event_lover_0101 } #Since the choice to stay together can be made
		any_relation = {
			type = lover
			NOT = { has_relation_rival = root }
			any_prisoner = {
				this = root
			}
		}
	}

	immediate = {
		save_scope_as = imprisoned_lover
		add_character_flag = {
			flag = had_event_lover_0101
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				NOT = { has_relation_rival = root }
				any_prisoner = {
					this = root
				}
			}
			save_scope_as = lover
		}
	}

	option = { #Break up
		name = lover.0101.a
		show_as_tooltip = {
			remove_relation_lover = scope:lover
		}
		scope:lover = { #Response event for the imprisoner
			trigger_event = lover.0102
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 0.5
				ai_boldness = 0.5
			}
		}
	}

	option = { #Chance to keep it going if its house arrest you're in
		name = lover.0101.b
		trigger = {
			is_in_prison_type = house_arrest
		}
		stress_impact = {
			base = medium_stress_gain
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}
}


#Response for imprisoner, lover broke up with me!
lover.0102 = {
	type = character_event
	title = lover.0102.t
	desc = lover.0102.desc
	theme = lover_relation
	left_portrait = {
		character = scope:imprisoned_lover
		animation = anger
	}

	immediate = {
		scope:imprisoned_lover = {
			remove_relation_lover = root
		}
	}

	option = {
		name = lover.0102.a
	}
}

#####################
# Break up - waging war against your lover! (triggers from the interaction)
# 0103-0104
# by Linnéa Thimrén
#####################
lover.0103 = {
	type = character_event
	title = lover.0103.t
	desc = lover.0103.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = dismissal
	}

	trigger = {
		NOT = { has_character_flag = had_event_lover_0103 }
	}

	immediate = {
		save_scope_as = war_lover
		add_character_flag = {
			flag = had_event_lover_0103
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				NOT = { has_relation_rival = root }
				is_at_war_with = root
			}
			save_scope_as = lover
		}
	}

	option = {
		name = lover.0103.a
		show_as_tooltip = {
			remove_relation_lover = scope:lover
		}
		scope:lover = { #Response event for the war-declarer
			trigger_event = lover.0104
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #players can keep the relationship alive
		name = lover.0103.b
		trigger = {
			is_ai = no
		}
		custom_tooltip = lover.0103.b.tt
		add_prestige = medium_prestige_loss
		stress_impact = {
			base = minor_stress_gain
			wrathful = medium_stress_impact_gain
			vengeful = medium_stress_impact_gain
		}
	}
}

#Response for war-declarer, lover broke up with me!
lover.0104 = {
	type = character_event
	title = lover.0103.t
	desc = lover.0104.desc
	theme = lover_relation
	left_portrait = {
		character = scope:war_lover
		animation = anger
	}

	immediate = {
		remove_relation_lover = scope:war_lover
		random_character_war = {
			limit = {
			casus_belli = {
					primary_attacker = root
					primary_defender = scope:war_lover
					any_target_title = { count >= 1 }
				}
			}
			casus_belli = {
				random_target_title = {
					save_scope_as = war_title
				}
			}
		}
	}

	option = {
		name = lover.0104.a
	}
}


####################
# Interaction breakup events
# 0201-0205
####################

#Normal breakup
# by Petter Vilberg
lover.0201 = {
	type = character_event
	title = lover.0201.t
	desc = {
		desc = lover.0201.desc
		triggered_desc = {
			trigger = { exists = scope:other_lover }
			desc = lover.0201.other_lover
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:breaker
		animation = dismissal
	}
	right_portrait = {
		character = scope:other_lover
		animation = sadness
	}
	
	immediate = {
		if = {
			limit = {
				scope:breaker = {
					OR = {
						is_married = yes
						any_relation = {
							type = lover
							NOT = { this = root }
						}
					}
				}
			}
			#Roll to see if jealousy causes rivalry
			lover_breakup_rivalry_chance_effect = yes
		}
		scope:breaker = {
			remove_lover_or_soulmate_relation_effect = { CHARACTER = root }
		}
	}

	option = {
		name = lover.0201.a
		add_opinion = {
			target = scope:breaker
			modifier = lover_breakup_opinion
		}
		if = {
			limit = {
				exists = scope:other_lover
			}
			show_as_tooltip = {
				set_relation_rival = scope:other_lover
			}
			hidden_effect = {
				scope:other_lover = {
					trigger_event = lover.0204
				}
			}
		}
	}
}

#Spouse breakup
# by Petter Vilberg
lover.0202 = {
	type = character_event
	title = lover.0202.t
	desc = {
		desc = lover.0202.desc
		triggered_desc = {
			trigger = { exists = scope:other_lover }
			desc = lover.0201.other_lover
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:breaker
		animation = dismissal
	}
	right_portrait = {
		character = scope:other_lover
		animation = sadness
	}
	
	immediate = {
		if = {
			limit = {
				scope:breaker = {
					OR = {
						any_consort = {
							NOT = { this = root }
						}
						any_relation = {
							type = lover
							NOT = { this = root }
						}
					}
				}
			}
			#Roll to see if jealousy causes rivalry
			lover_breakup_rivalry_chance_effect = yes
		}
		scope:breaker = {
			remove_lover_or_soulmate_relation_effect = { CHARACTER = root }
		}
	}

	option = {
		name = lover.0202.a
		add_opinion = {
			target = scope:breaker
			modifier = lover_breakup_opinion
		}
		if = {
			limit = {
				exists = scope:other_lover
			}
			show_as_tooltip = {
				set_relation_rival = scope:other_lover
			}
			hidden_effect = {
				scope:other_lover = {
					trigger_event = lover.0204
				}
			}
		}
	}
}

#Relieved breakup
# by Petter Vilberg
lover.0203 = {
	type = character_event
	title = lover.0203.t
	desc = lover.0203.desc
	theme = lover_relation
	left_portrait = {
		character = scope:breaker
		animation = dismissal
	}
	right_portrait = {
		character = scope:other_lover
		animation = happiness
	}
	
	immediate = {
		scope:breaker = {
			remove_lover_or_soulmate_relation_effect = { CHARACTER = root }
		}
	}

	option = {
		name = lover.0203.a
		stress_impact = {
			base = medium_stress_loss
			lustful = minor_stress_impact_gain
		}
	}
}



#The other lover has become your rival
#by Bianca Savazzi
lover.0204 = {
	type = character_event
	title = lover.0204.t
	desc = lover.0204.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = anger
	}
	right_portrait = {
		character = scope:breaker
		animation = shock
	}

	option = {
		name = lover.0204.a
		scope:lover = {
			set_relation_rival = root
		}
	}
}


#Break up consideration after marriage
#by Bianca Savazzi
lover.0205 = {
	hidden = yes

	trigger = {
		num_of_relation_lover >= 1
		is_ai = yes
	}

	immediate = {
		#Dealbreakers
		if = {
			limit = {
				any_relation = {
 					type = lover
					NOT = { in_diplomatic_range = root }
					is_ai = yes
				}
			}	
			every_relation = {
 				type = lover
 				limit = {
 					NOT = { in_diplomatic_range = root }
 					is_ai = yes
 				}
 				remove_lover_or_soulmate_relation_effect = { CHARACTER = root }
			}
		}

		#Evaluation
		if = {
			limit = {
				any_relation = {
 					type = lover
 					is_ai = yes
 					NOT = { is_consort_of = root }
 				}
			}

			every_relation = {
		  		type = lover
		  		limit = { 
		  			NOT = { is_consort_of = root } 
		  			is_ai = yes 
		  		}

				random_list = {
					50 = {
						#Break things off
						modifier = {
		 					add = 15
		 					root = {
								faith = { has_doctrine = doctrine_monogamy }
								has_trait = zealous 
							}
		 				}
		 				modifier = {
		 					add = 10
		 					root = {
		 						exists = scope:new_spouse_secondary_actor 
			 					NOT = { scope:new_spouse_secondary_actor = root }
			 					opinion = {
									target = scope:new_spouse_secondary_actor
									value >= 20
								}
							}
		 				}
		 				modifier = {
		 					add = 10
		 					root = {
			 					exists = scope:new_spouse_secondary_recipient 
			 					NOT = { scope:new_spouse_secondary_recipient = root }
			 					opinion = {
									target = scope:new_spouse_secondary_recipient
									value >= 20
								}
							}
		 				}
		 				modifier = {
		 					add = 30
		 					root = {
			 					exists = scope:new_spouse_secondary_actor 
			 					NOT = { scope:new_spouse_secondary_actor = root }
			 					OR = {
			 						has_relation_lover = scope:new_spouse_secondary_actor
			 						has_relation_soulmate = scope:new_spouse_secondary_actor
			 					}
		 					}
		 				}
		 				modifier = {
		 					add = 30
		 					root = {
			 					exists = scope:new_spouse_secondary_recipient 
			 					NOT = { scope:new_spouse_secondary_recipient = root }
			 					OR = {
			 						has_relation_lover = scope:new_spouse_secondary_recipient
			 						has_relation_soulmate = scope:new_spouse_secondary_recipient
			 					}
		 					}
		 				}
		 				modifier = {
		 					add = 10
							reverse_opinion = {
								target = root
								value <= 20
							}
		 				}
		 				remove_lover_or_soulmate_relation_effect = { CHARACTER = root }
					}
					50 = {
						#Keep the romance going
						modifier = {
		 					add = 15
		 					root = {
								faith = { has_doctrine = doctrine_monogamy }
								has_trait = cynical
							}
		 				}
		 				modifier = {
		 					add = 10
		 					root = {
			 					exists = scope:new_spouse_secondary_actor 
			 					NOT = { scope:new_spouse_secondary_actor = root }
			 					opinion = {
									target = scope:new_spouse_secondary_actor
									value <= 0
								}
							}
		 				}
		 				modifier = {
		 					add = 10
		 					root = {
			 					exists = scope:new_spouse_secondary_recipient 
			 					NOT = { scope:new_spouse_secondary_recipient = root }
			 					opinion = {
									target = scope:new_spouse_secondary_recipient
									value <= 0
								}
							}
		 				}
		 				modifier = {
		 					add = 30
		 					root = {
			 					exists = scope:new_spouse_secondary_actor 
			 					NOT = { scope:new_spouse_secondary_actor = root }
			 					OR = {
			 						has_relation_rival = scope:new_spouse_secondary_actor
			 						has_relation_nemesis = scope:new_spouse_secondary_actor
			 					}
		 					}
		 				}
		 				modifier = {
		 					add = 30
		 					root = {
			 					exists = scope:new_spouse_secondary_recipient 
			 					NOT = { scope:new_spouse_secondary_recipient = root }
			 					OR = {
			 						has_relation_rival = scope:new_spouse_secondary_recipient
			 						has_relation_nemesis = scope:new_spouse_secondary_recipient
			 					}
		 					}
		 				}
		 				modifier = {
		 					add = 10
							reverse_opinion = {
								target = root
								value >= 20
							}
		 				}
					}
				}
			}
		}
	}
}


#########################
# Ask lover to be exclusive (lover -> soulmate)
# 0300-0304
# by Linnéa Thimrén & Mathilda Bjarnehed
##########################

scripted_trigger lover_0300_potential_soulmate_trigger = {
	can_set_relation_soulmate_trigger = { CHARACTER = root }
	opinion = {
		target = root
		value >= high_positive_opinion
	}
}

scripted_effect lover_0300_break_up_with_other_lovers_effect = {
	save_scope_as = dumper
	if = {
		limit = {
			any_relation = {
				type = lover
				NOT = { this = $SOULMATE$ }
				count = 1
			}
		}
		random_relation = {
			type = lover
			limit = { NOT = { this = $SOULMATE$ } }
			show_as_tooltip = { remove_relation_lover = scope:dumper }
			trigger_event = lover.0304
			add_opinion = {
				target = scope:dumper
				modifier = break_up_opinion
			}
		}
	}
	else_if = {
		limit = {
			any_relation = {
				type = lover
				NOT = { this = $SOULMATE$ }
				count >= 2
			}
		}
		every_relation = {
			type = lover
			custom = lover_0300_break_up_with_other_lovers_effect.tt
			limit = { NOT = { this = $SOULMATE$ } }
			show_as_tooltip = { remove_relation_lover = scope:dumper }
			trigger_event = lover.0304
			add_opinion = {
				target = scope:dumper
				modifier = break_up_opinion
			}
		}
	}
}

scripted_effect lover_0300_exclusivity_denied_effect = {

	# Lover's reaction
	if = {
		limit = { root = scope:proposing_lover }

		reverse_add_opinion = {
			modifier = refusal_opinion
			target = scope:lover
			opinion = -15
		}
	}
	else = {
		hidden_effect = {
			reverse_add_opinion = {
				modifier = refusal_opinion
				target = scope:lover
				opinion = -15
			}
		}
	}

	# Proposing_lover's reaction
	if = {
		limit = { root = scope:lover }

		reverse_add_opinion = {
			modifier = hurt_opinion
			target = scope:proposing_lover
			opinion = -20
		}
	}
	else = {
		hidden_effect = {
			reverse_add_opinion = {
				modifier = hurt_opinion
				target = scope:proposing_lover
				opinion = -20
			}
		}
	}
}

lover.0300 = {
	type = character_event
	title = lover.3111.t
	desc = lover.3111.desc
	theme = love
	left_portrait = {
		character = scope:lover
		animation = flirtation
	}
	
	trigger = {
		any_relation = {
			type = lover
			lover_0300_potential_soulmate_trigger = yes
		}
		NOT = {
			has_character_flag = event_lover_0300_cooldown
		}
	}

	weight_multiplier = {
		base = 0.2

		# Needs very_high_positive_opinion to get to 1
		modifier = {
			any_relation = {
				type = lover
				lover_0300_potential_soulmate_trigger = yes
				opinion = {
					target = root
					value >= very_high_positive_opinion
				}
			}
			add = 0.8
		}

		modifier = {
			any_relation = {
				type = lover
				lover_0300_potential_soulmate_trigger = yes
				is_consort_of = root
			}
		}
	}

	immediate = {
		save_scope_as = proposing_lover

		random_relation = {
			type = lover
			limit = {
				lover_0300_potential_soulmate_trigger = yes
			}
			weight = {
				base = 1
				opinion_modifier = {
					opinion_target = root
				}
				opinion_modifier = {
					trigger = { root = { is_ai = yes } }
					who = root
					opinion_target = this
				}
				compatibility_modifier = {
					compatibility_target = root
					multiplier = 0.5
				}
				modifier = {
					is_consort_of = root
					add = 30
				}
			}
			save_scope_as = lover
		}
	}

	option = { #I will ask them!
		name = lover.3111.a

		show_as_tooltip = {
			random_list = {
				1 = {
					show_chance = no
					desc = lover.3111.a.success
					set_relation_soulmate = scope:lover
					lover_0300_break_up_with_other_lovers_effect = { SOULMATE = scope:lover }
				}
				1 = {
					show_chance = no
					desc = lover.3111.a.failure
					lover_0300_exclusivity_denied_effect = yes
				}
			}
		}

		scope:lover = {
			trigger_event = {
				id = lover.0301
				days = 3
			}
		}

		ai_chance = {
			base = 50
			modifier = {
				add = 50
				has_trait = chaste
			}
			opinion_modifier = {
				opinion_target = scope:lover
			}
			ai_value_modifier = {
				ai_honor = 1
				ai_compassion = 1
				min = -60
			}
		}
	}

	option = { #Nah.
		name = lover.3111.b
		
		stress_impact = {
			base = medium_stress_loss
			fickle = minor_stress_impact_loss
			lustful = minor_stress_impact_loss
		}

		add_character_flag = {
			flag = event_lover_0300_cooldown
			years = 15
		}

		ai_chance = {
			base = 0

			modifier = {
				might_cheat_on_partner_trigger = { PARTNER = scope:lover }
				add = 30
			}

			# Opinion of other lovers
			modifier = {
				add = {
					every_relation = {
						type = lover
						limit = { NOT = { this = scope:lover } }

						if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= very_high_positive_opinion
								}
							}
							add = very_high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= high_positive_opinion
								}
							}
							add = high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= medium_positive_opinion
								}
							}
							add = medium_positive_opinion
						}
					}
				}
			}

			modifier = {
				add = 50
				has_trait = lustful
			}
			
			ai_value_modifier = {
				ai_greed = -0.5
				ai_honor = -0.5
				min = -25
			}
		}
	}
}


#A lover approaches you about being exclusive
lover.0301 = {
	type = character_event
	title = lover.3111.t
	desc = lover.3112.desc
	theme = love
	left_portrait = {
		character = scope:proposing_lover
		animation = love
	}

	immediate = {
		# Other lovers for ai weights
		random_relation = {
			type = lover
			limit = {
				NOT = { this = scope:lover }
			}
			save_scope_as = other_lover
		}
		if = {
			limit = { exists = scope:other_lover }
			random_relation = {
				type = lover
				limit = {
					NOR = {
						this = scope:other_lover
						this = scope:lover
					}
				}
				save_scope_as = too_many_lovers
			}
		}
	}


	trigger = {
		exists = scope:proposing_lover
		scope:proposing_lover = { is_alive = yes }
		can_set_relation_soulmate_trigger = { CHARACTER = scope:proposing_lover }
	}

	option = { #Sure. Let's go for exclusivity!
		name = lover.3112.a
		
		show_as_tooltip = { set_relation_soulmate = scope:proposing_lover }

		lover_0300_break_up_with_other_lovers_effect = { SOULMATE = scope:proposing_lover }
		
		scope:proposing_lover = {
			trigger_event = lover.0302
		}

		stress_impact = {
			lustful = medium_stress_impact_gain
			fickle = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50

			modifier = {
				add = 50
				has_trait = chaste
			}
			opinion_modifier = {
				opinion_target = scope:proposing_lover	
			}
			ai_value_modifier = {
				ai_honor = 1
				ai_compassion = 1
				min = -60
			}
		}
	}

	option = { #Sure. Let's go for "exclusivity"!
		trigger = {
			any_secret = {
				secret_type = secret_lover
				NOT = { is_known_by = scope:proposing_lover }
			}
		}
		name = lover.3112.b
		flavor = lover.3112.b.tt

		show_as_tooltip = { set_relation_soulmate = scope:proposing_lover }

		every_relation = {
			type = lover
			limit = {
				NOR = {
					any_secret = {
						secret_type = secret_lover
						secret_target = root
						NOT = { is_known_by = scope:proposing_lover }
					}
					this = scope:proposing_lover
				}
			}
			show_as_tooltip = { remove_relation_lover = root }
			root = { save_scope_as = dumper }
			trigger_event = lover.0304
			add_opinion = {
				target = root
				modifier = break_up_opinion
			}
		}
		every_relation = {
			type = lover
			limit = {
				any_secret = {
					secret_type = secret_lover
					secret_target = root
					NOT = { is_known_by = scope:proposing_lover }
				}
			}
			custom_tooltip = lover.3112.b.remain_together.tt
		}
		
		scope:proposing_lover = {
			trigger_event = lover.0302
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			honest = major_stress_impact_gain
		}

		ai_chance = {
			base = 0

			modifier = {
				might_cheat_on_partner_trigger = { PARTNER = scope:proposing_lover }
				add = 30
			}

			# Opinion of other lovers
			modifier = {
				add = {
					every_relation = {
						type = lover
						limit = { NOT = { this = scope:proposing_lover } }

						if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= very_high_positive_opinion
								}
							}
							add = very_high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= high_positive_opinion
								}
							}
							add = high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= medium_positive_opinion
								}
							}
							add = medium_positive_opinion
						}
					}
				}
			}

			modifier = {
				add = 50
				has_trait = lustful
			}
			
			ai_value_modifier = {
				ai_greed = -0.5
				ai_honor = -2
				min = -25
			}
		}
	}

	option = { #Nah.
		name = lover.3112.c
		
		show_as_tooltip = { lover_0300_exclusivity_denied_effect = yes }

		scope:lover = {
			trigger_event = {
				id = lover.0303
			}
		}

		stress_impact = {
			chaste = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 0

			modifier = {
				might_cheat_on_partner_trigger = { PARTNER = scope:proposing_lover }
				add = 30
			}

			# Opinion of other lovers
			modifier = {
				add = {
					every_relation = {
						type = lover
						limit = { NOT = { this = scope:proposing_lover } }

						if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= very_high_positive_opinion
								}
							}
							add = very_high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= high_positive_opinion
								}
							}
							add = high_positive_opinion
						}
						else_if = {
							limit = {
								reverse_opinion = {
									target = root
									value >= medium_positive_opinion
								}
							}
							add = medium_positive_opinion
						}
					}
				}
			}

			modifier = {
				add = 50
				has_trait = lustful
			}
			
			ai_value_modifier = {
				ai_greed = -0.5
				ai_honor = -0.5
				min = -25
			}
		}
	}
}

#Lover agreed to swear fealty!
lover.0302 = {
	type = character_event
	title = lover.3111.t
	desc = lover.3113.desc
	theme = love
	left_portrait = {
		character = scope:lover
		animation = love
	}

	option = {
		name = lover.3113.a
		flavor = lover.3113.a.tt
		
		set_relation_soulmate = scope:lover
		lover_0300_break_up_with_other_lovers_effect = { SOULMATE = scope:lover }
	}
}


#Lover refused to swear themselves exclusively to one person
lover.0303 = {
	type = character_event
	title = lover.3111.t
	desc = lover.3114.desc
	theme = love
	left_portrait = {
		character = scope:lover
		animation = disgust
	}

	immediate = {
		scope:lover = {
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = {
		name = lover.3114.a
		lover_0300_exclusivity_denied_effect = yes
	}
}


# Break up letter (dumper has a soulmate now)
lover.0304 = {
	type = letter_event
	opening = lover.0304.opening
	desc = lover.0304.desc
	sender = {
		character = scope:dumper
		animation = sadness
	}


	immediate = {
		remove_relation_lover = scope:dumper
	}

	option = {
		name = lover.0304.a
	}	
}





#####################################
# POSITIVE EFFECTS
# 1000-1999
#####################################

#####################
# An unlanded Lover shares a secret about someone else with you
# by Petter Vilberg
#####################
scripted_trigger lover_1001_secret_trigger = {
	NOT = { is_known_by = root }
	NOT = { secret_owner = scope:snoopy_lover }
	trigger_if = {
		limit = {
			exists = secret_target
		}
		NOR = {
			secret_target = scope:snoopy_lover
			secret_target = root
		}
	}
}

scripted_trigger lover_1001_snoopy_lover_trigger = {
	is_landed = no
	opinion = {
		target = root
		value > 15
	}
	save_temporary_scope_as = snoopy_lover
	#Look for the character's liege, and suitable characters in their realm
	exists = court_owner
	court_owner = {
		OR = {
			any_courtier_or_guest = {
				NOT = { this = scope:snoopy_lover }
				any_secret = {
					lover_1001_secret_trigger = yes
				}
			}
			any_vassal = {
				NOT = { this = scope:snoopy_lover }
				any_secret = {
					lover_1001_secret_trigger = yes
				}
			}
		}
	}
}

lover.1001 = {
	type = character_event
	title = lover.1001.t
	desc = lover.1001.desc
	theme = lover_relation
	left_portrait = {
		character = scope:snoopy_lover
		animation = scheme
	}
	right_portrait = {
		character = scope:secret_holder
		animation = worry
	}

	trigger = {
		any_relation = {
			type = lover
			lover_1001_snoopy_lover_trigger = yes
		}
	}

	immediate = {
		random_relation = {
			type = lover
			limit = {
				lover_1001_snoopy_lover_trigger = yes
			}
			save_scope_as = snoopy_lover
			court_owner = {
				#Prioritise finding a regular courtier (suitable agent for a scheme)
				random_courtier_or_guest = {
					limit = {
						NOT = { this = scope:snoopy_lover }
						any_secret = {
							lover_1001_secret_trigger = yes
						}
					}
					save_scope_as = secret_holder
					random_secret = {
						limit = {
							lover_1001_secret_trigger = yes
						}
						save_scope_as = secret
					}
				}
				#Otherwise a vassal will probably be useful
				if = {
					limit = {
						NOT = { exists = scope:secret }
					}
					random_vassal = {
						limit = {
							NOT = { this = scope:snoopy_lover }
							any_secret = {
								lover_1001_secret_trigger = yes
							}
						}
						save_scope_as = secret_holder
						random_secret = {
							limit = {
								lover_1001_secret_trigger = yes		
							}
							save_scope_as = secret
						}
					}
				}
			}
		}
		add_stress = minor_stress_impact_loss
	}

	option = {
		name = lover.1001.a
		scope:secret = {
			reveal_to = root
		}
		hidden_effect = {
			add_opinion = {
				modifier = lover_shared_secret_with_me_opinion
				target = scope:snoopy_lover	
			}
		}
	}
}



#####################
# A Lover adds a progress modifier to a diplomatic scheme
# by Petter Vilberg
#####################
scripted_trigger lover_1002_scheme_trigger = {
	diplomacy_scheme_trigger = yes
	scheme_target = {
		NOT = { has_relation_lover = root }
	}
}

lover.1002 = {
	type = character_event
	title = lover.1002.t
	desc = lover.1002.desc
	theme = lover_relation
	left_portrait = scope:lover
	right_portrait = scope:target

	trigger = {
		NOT = { has_character_flag = had_lover_diplo_scheme_event }
		any_relation = { type = lover #Find a Lover that can realistically help
			diplomacy > mediocre_skill_rating
		}
		any_scheme = { #Have a suitable scheme
			lover_1002_scheme_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0.25
		modifier = {
			add = 0.75
			#Should be unlikely unless target is in the same court as lover
			any_relation = {
				type = lover
				diplomacy > mediocre_skill_rating
				save_temporary_scope_as = lover_check
			}
			any_scheme = {
				lover_1002_scheme_trigger = yes
				scheme_target = {
					is_in_the_same_court_as = scope:lover_check
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_lover_diplo_scheme_event
			years = 5
		}
		random_relation = {
			type = lover
			limit = { diplomacy > mediocre_skill_rating }
			save_scope_as = lover
		}
		random_scheme = {	
			limit = {
				lover_1002_scheme_trigger = yes
			}
			save_scope_as = scheme
			scheme_target = {
				save_scope_as = target
			}
		}
	}

	option = {
		name = lover.1002.a
		scope:scheme = {
			add_scheme_progress = scheme_progress_gain
		}
		stress_impact = {
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = lover.1002.b
		trigger = {
			has_trait = paranoid
		}
		trait = paranoid
		add_stress = medium_stress_loss
		ai_chance = {
			base = 200
		}
	}
}

#####################
# Lover helps you lose stress
# by Linnéa Thimrén
#####################
scripted_trigger lover_1003_find_lover_trigger = {
	is_available_ai = yes
	reverse_has_opinion_modifier = {
		target = root
		modifier = love_opinion
		value >= 15
	}
	has_opinion_modifier = {
		target = root
		modifier = love_opinion
		value >= 15
	}
}

lover.1003 = {
	type = character_event
	title = lover.1003.t
	desc = lover.1003.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = love
	}
	
	trigger = {
		stress >= normal_baseline_stress
		NOT = { has_character_flag = had_event_lover_1003 }
		any_relation = {
			type = lover
			lover_1003_find_lover_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			any_relation = {
				type = lover
				lover_1003_find_lover_trigger = yes
				has_trait = calm
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_1003
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				lover_1003_find_lover_trigger = yes
			}
			weight = {
				base = 100
				modifier = {
					add = 100
					has_trait = calm
				}
			}
			save_scope_as = lover
		}
	}

	option = {
		name = lover.1003.a
		add_prestige = minor_prestige_gain
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
		scope:lover = {
			add_stress = medium_stress_loss
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 20
			}
		}
		stress_impact = {
			base = medium_stress_loss
			greedy = medium_stress_impact_gain
			callous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
				ai_rationality = 0.25
			}
		}
	}

	option = {
		name = lover.1003.b
		stress_impact = {
			base = major_stress_loss
			generous = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
				ai_vengefulness = 0.5
			}
		}
	}
}

#####################
# Go on "vacation" with lover
# 1004-1005
# by Linnéa Thimrén
#####################
lover.1004 = {
	type = character_event
	title = lover.1004.t
	desc = lover.1004.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		stress >= higher_than_baseline_stress
		NOT = { has_character_flag = had_event_lover_1004 }
		is_available = yes
		any_relation = {
			type = lover
			is_available_ai = yes
		}
		any_sub_realm_county = {
			holder = {
				NOT = { has_relation_lover = root }
			}
			NOT = { has_county_modifier = encouraged_improvement_modifier }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			stress >= medium_stress
			stress < high_stress
		}
		modifier = {
			add = 1
			stress >= high_stress
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_1004
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available_ai = yes
			}
			save_scope_as = lover
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
		random_sub_realm_county = {
			limit = {
				holder = {
					NOT = { has_relation_lover = root }
				}
				NOT = { has_county_modifier = encouraged_improvement_modifier }
			}
			save_scope_as = county
		}
	}

	option = {
		name = lover.1004.a
		flavor = lover.1004.a.tt
		trigger_event = {
			id = lover.1005
			days = { 14 30 }
		}
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = lover.1004.b
		stress_impact = {
			base = minor_stress_impact_loss
			lustful = minor_stress_impact_loss
			chaste = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}



# You decided to travel somewhere together
lover.1005 = {
	type = character_event
	title = lover.1004.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_in_the_same_court_as = scope:lover
				}
				desc = lover.1005.desc_opening_same_court
			}
			desc = lover.1005.desc_opening_other_court
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:lover = {
						object_of_importance_exist_trigger = {
							LOVER = root
						}
					}
				}
				desc = lover.1005.desc_object_of_importance
			}
			desc = lover.1005.desc
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = love
	}

	immediate = {
		if = {
			limit = {
				any_spouse = {
					NOT = { this = scope:lover }
				}
			}
			random_spouse = {
				save_scope_as = spouse
			}
		}
		else_if = {
			limit = {
				any_courtier = {
					NOT = { this = scope:lover }
				}
			}
			random_courtier = {
				limit = {
					NOT = { this = scope:lover }
				}
				save_scope_as = courtier
			}
		}
		if = {
			limit = {
				any_secret = {
					secret_type = secret_lover
					secret_target = scope:lover
					OR = {
						NOT = { exists = scope:spouse }
						any_secret_knower = {
							NOT = {
								this = scope:spouse
							}
						}
					}
				}
			}
			random_secret = {
				limit = {
					secret_type = secret_lover
					secret_target = scope:lover
					OR = {
						NOT = { exists = scope:spouse }
						any_secret_knower = {
							NOT = {
								this = scope:spouse
							}
						}
					}
				}
				save_scope_as = lover_secret
			}
		}
	}

	option = {
		name = lover.1005.a
		flavor = lover.1005.a.tt
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 25
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 25
		}
		hidden_effect = {
			random_list = {
				10 = {
					trigger = {
						exists = scope:spouse
						exists = scope:lover_secret
					}
					compare_modifier = {
						target = scope:spouse
						value = intrigue
						multiplier = 0.5
					}
					scope:lover_secret = {
						reveal_to = scope:spouse
					}
				}
				10 = {
					trigger = {
						exists = scope:courtier
						exists = scope:lover_secret
					}
					compare_modifier = {
						target = scope:courtier
						value = intrigue
						multiplier = 0.5
					}
					scope:lover_secret = {
						reveal_to = scope:courtier
					}
				}
				100 = { }
			}
		}
		stress_impact = {
			base = medium_stress_loss
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.25
			}
		}
	}

	option = {
		name = lover.1005.b
		stress_impact = {
			base = major_stress_loss
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 200
				has_trait = paranoid
			}
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 0.25
				ai_energy = 0.25
			}
		}
	}

	option = {
		name = lover.1005.c
		scope:county = {
			add_county_modifier = {
				modifier = encouraged_improvement_modifier
				days = 730
			}
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = -10
		}
		if = {
			limit = {
				OR = {
					has_education_stewardship_trigger = yes
					has_lifestyle = stewardship_lifestyle
				}
			}
			stress_impact = {
				base = medium_stress_impact_loss
			}
		}
		else = {
			stress_impact = {
				base = medium_stress_gain
				diligent = medium_stress_impact_loss
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				OR = {
					has_education_stewardship_trigger = yes
					has_lifestyle = stewardship_lifestyle
				}
			}
			modifier = {
				add = 20
				OR = {
					has_trait = diligent
					has_trait = callous
				}
			}
		}
	}
}



#####################
# Liege lover granting council position
# by Linnéa Thimrén
#####################

scripted_trigger lover_1006_lover_council_position_trigger = {
	is_ai = yes
	OR = {
		any_vassal = { this = root }
		any_courtier = { this = root }
	}
	save_temporary_scope_as = lover	
	root = {
		OR = { #Either you are VERY skilled, or they have a free spot
			AND = {
				OR = {
					diplomacy >= very_high_skill_rating
					NOT = { scope:lover = { exists = cp:councillor_chancellor } }
				}
				can_be_chancellor_trigger = { COURT_OWNER = scope:lover }
			}
			AND = {
				OR = {
					stewardship >= very_high_skill_rating
					NOT = { scope:lover = { exists = cp:councillor_steward } }
				}
				can_be_steward_trigger = { COURT_OWNER = scope:lover }
			}
			AND = {
				OR = {
					martial >= very_high_skill_rating
					NOT = { scope:lover = { exists = cp:councillor_marshal } }
				}
				can_be_marshal_trigger = { COURT_OWNER = scope:lover }
			}
			AND = {
				OR = {
					intrigue >= very_high_skill_rating
					NOT = { scope:lover = { exists = cp:councillor_spymaster } }
				}
				can_be_spymaster_trigger = { COURT_OWNER = scope:lover }
			}
			AND = {
				OR = {
					learning >= very_high_skill_rating
					NOT = { scope:lover = { exists = cp:councillor_court_chaplain } }
				}
				can_be_court_chaplain_trigger = { COURT_OWNER = scope:lover }
			}
		}
	}
}

lover.1006 = {
	type = letter_event
	opening = {
		desc = lover.1006.opening
	}
	desc = {
		desc = lover.1006.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:council_position = flag:chancellor
				}
				desc = lover.1006.desc_chancellor
			}
			triggered_desc = {
				trigger = {
					scope:council_position = flag:steward
				}
				desc = lover.1006.desc_steward
			}
			triggered_desc = {
				trigger = {
					scope:council_position = flag:marshal
				}
				desc = lover.1006.desc_marshal
			}
			triggered_desc = {
				trigger = {
					scope:council_position = flag:spymaster
				}
				desc = lover.1006.desc_spymaster
			}
			triggered_desc = {
				trigger = {
					scope:council_position = flag:court_chaplain
				}
				desc = lover.1006.desc_court_chaplain
			}
		}
		desc = lover.1006.desc_end
	}
	sender = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_1006 }
		is_councillor = no
		any_relation = {
			type = lover
			lover_1006_lover_council_position_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			OR = {
				martial > very_high_skill_rating
				diplomacy > very_high_skill_rating
				intrigue > very_high_skill_rating
				learning > very_high_skill_rating
				stewardship > very_high_skill_rating
			}
		}
		modifier = {
			add = 0.5
			OR = {
				martial > extremely_high_skill_rating
				diplomacy > extremely_high_skill_rating
				intrigue > extremely_high_skill_rating
				learning > extremely_high_skill_rating
				stewardship > extremely_high_skill_rating
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_1006
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				lover_1006_lover_council_position_trigger = yes
			}
			save_scope_as = lover
		}
		hidden_effect = {
			random_list = {
				10 = {
					trigger = {
						OR = {
							diplomacy >= very_high_skill_rating
							NOT = { scope:lover = { exists = cp:councillor_chancellor } }
						}
						can_be_chancellor_trigger = { COURT_OWNER = scope:lover }
					}
					save_scope_value_as = {
						name = council_position
						value = flag:chancellor
					}
					compare_modifier = {
						target = scope:lover
						value = diplomacy
						multiplier = 4
					}
				}
				10 = {
					trigger = {
						OR = {
							stewardship >= very_high_skill_rating
							NOT = { scope:lover = { exists = cp:councillor_steward } }
						}
						can_be_steward_trigger = { COURT_OWNER = scope:lover }
					}
					save_scope_value_as = {
						name = council_position
						value = flag:steward
					}
					compare_modifier = {
						target = scope:lover
						value = stewardship
						multiplier = 4
					}
				}
				10 = {
					trigger = {
						OR = {
							martial >= very_high_skill_rating
							NOT = { scope:lover = { exists = cp:councillor_marshal } }
						}
						can_be_marshal_trigger = { COURT_OWNER = scope:lover }
					}
					save_scope_value_as = {
						name = council_position
						value = flag:marshal
					}
					compare_modifier = {
						target = scope:lover
						value = martial
						multiplier = 4
					}
				}
				10 = {
					trigger = {
						OR = {
							intrigue >= very_high_skill_rating
							NOT = { scope:lover = { exists = cp:councillor_spymaster } }
						}
						can_be_spymaster_trigger = { COURT_OWNER = scope:lover }
					}
					save_scope_value_as = {
						name = council_position
						value = flag:spymaster
					}
					compare_modifier = {
						target = scope:lover
						value = intrigue
						multiplier = 4
					}
				}
				10 = {
					trigger = {
						OR = {
							learning >= very_high_skill_rating
							NOT = { scope:lover = { exists = cp:councillor_court_chaplain } }
						}
						can_be_court_chaplain_trigger = { COURT_OWNER = scope:lover }
					}
					save_scope_value_as = {
						name = council_position
						value = flag:court_chaplain
					}
					compare_modifier = {
						target = scope:lover
						value = learning
						multiplier = 4
					}
				}
			}
		}
	}

	option = { #Sure
		name = lover.1006.a
		scope:lover = {
			if = {
				limit = {
					scope:council_position = flag:chancellor
				}
				if = {
					limit = {
						exists = cp:councillor_chancellor
					}
					fire_councillor = cp:councillor_chancellor
				}
				assign_councillor_type = {
					type = councillor_chancellor
					target = root
				}
			}
			if = {
				limit = {
					scope:council_position = flag:steward
				}
				if = {
					limit = {
						exists = cp:councillor_steward
					}
					fire_councillor = cp:councillor_steward
				}
				assign_councillor_type = {
					type = councillor_steward
					target = root
				}
			}
			if = {
				limit = {
					scope:council_position = flag:marshal
				}
				if = {
					limit = {
						exists = cp:councillor_marshal
					}
					fire_councillor = cp:councillor_marshal
				}
				assign_councillor_type = {
					type = councillor_marshal
					target = root
				}
			}
			if = {
				limit = {
					scope:council_position = flag:spymaster
				}
				if = {
					limit = {
						exists = cp:councillor_spymaster
					}
					fire_councillor = cp:councillor_spymaster
				}
				assign_councillor_type = {
					type = councillor_spymaster
					target = root
				}
			}
			if = {
				limit = {
					scope:council_position = flag:court_chaplain
				}
				if = {
					limit = {
						exists = cp:councillor_court_chaplain
					}
					fire_councillor = cp:councillor_court_chaplain
				}
				assign_councillor_type = {
					type = councillor_court_chaplain
					target = root
				}
			}
		}
		
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 10
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 50
				has_trait = ambitious
			}
			ai_value_modifier = {
				ai_energy = 0.25
				ai_boldness = 0.25
			}
		}
	}

	option = { #Nah
		name = lover.1006.b
		scope:lover = {
			add_opinion = {
				target = root
				modifier = refusal_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				OR = {
					has_trait = content
					has_trait = lazy
				}
			}
			ai_value_modifier = {
				ai_energy = -0.25
				ai_rationality = 0.5
			}
		}
	}
}



#####################
# Liege lover granting better contract
# by Linnéa Thimrén
#####################

scripted_trigger lover_1007_can_decrease_vassal_contract_trigger = {
	vassal_contract_can_be_modified_trigger = yes
	OR = {
		vassal_contract_obligation_level_can_be_decreased = feudal_government_taxes
		vassal_contract_obligation_level_can_be_decreased = feudal_government_levies
	}
}

lover.1007 = {
	type = character_event
	title = lover.1007.t
	desc = lover.1007.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_1007 }
		lover_1007_can_decrease_vassal_contract_trigger = yes
		any_relation = {
			type = lover
			is_ai = yes
			any_vassal = { this = root }
		}
	}

	weight_multiplier = {
		base = 0.7
		modifier = { # Liege-lover is greedy? Darn.
			add = -0.5
			any_relation = {
				type = lover
				has_trait = greedy
				is_ai = yes
				any_vassal = { this = root }
			}
		}
		modifier = { # Liege-lover is generous? Lucky you!
			add = 0.3
			any_relation = {
				type = lover
				has_trait = generous
				is_ai = yes
				any_vassal = { this = root }
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_1007
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_ai = yes
				any_vassal = { this = root }
			}
			save_scope_as = lover
		}

		#What will be decreased?
		hidden_effect = {
			random_list = {
				50 = {
					trigger = {
						vassal_contract_obligation_level_can_be_decreased = feudal_government_taxes
					}
					save_scope_value_as = {
						name = taxes
						value = yes
					}
				}
				50 = {
					trigger = {
						vassal_contract_obligation_level_can_be_decreased = feudal_government_levies
					}
				}
			}
			#Have to set the variables here so we don't get errors when generating the tooltips
			set_local_variable = {
				name = coinage_rights
				value = 0
			}
			set_local_variable = {
				name = war_declaration_rights
				value = 0
			}
			set_local_variable = {
				name = council_rights
				value = 0
			}
			set_local_variable = {
				name = title_revocation_rights
				value = 0
			}
			set_local_variable = {
				name = fortification_rights
				value = 0
			}
			set_local_variable = {
				name = religious_rights
				value = 0
			}
		}
	}

	option = { #Thank you!
		name = lover.1007.a
		if = {
			limit = {
				exists = scope:taxes
			}
			vassal_contract_decrease_obligation_level = feudal_government_taxes
		}
		else = {
			vassal_contract_decrease_obligation_level = feudal_government_levies
		}
		stress_impact = {
			base = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.25
				ai_honor = 0.75
			}
		}
	}

	option = { #Sweeten the deal pls?
		name = lover.1007.b
		trigger = { #I have something more that can be improved
			OR = {
				AND = {
					vassal_contract_obligation_level_can_be_increased = coinage_rights
					scope:lover.culture = {
						has_innovation = innovation_currency_02
					}
				}
				vassal_contract_obligation_level_can_be_increased = war_declaration_rights
				vassal_contract_obligation_level_can_be_increased = council_rights
				vassal_contract_obligation_level_can_be_increased = title_revocation_rights
				AND = {
					vassal_contract_obligation_level_can_be_increased = fortification_rights
					scope:lover.culture = {
						has_innovation = innovation_battlements
					}
				}
				AND = {
					vassal_contract_obligation_level_can_be_increased = religious_rights
					NOT = {
						faith = scope:lover.faith
					}
				}
			}
		}
		if = {
			limit = {
				exists = scope:taxes
			}
			vassal_contract_decrease_obligation_level = feudal_government_taxes
		}
		else = {
			vassal_contract_decrease_obligation_level = feudal_government_levies
		}
		duel = {
			skill = diplomacy
			target = scope:lover
			10 = {		
				desc = lover.1007.b_1
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
					min = -4
				}
				random_list = {
					10 = {
						trigger = {
							vassal_contract_obligation_level_can_be_increased = coinage_rights
							scope:lover.culture = {
								has_innovation = innovation_currency_02
							}
						}
						set_local_variable = {
							name = coinage_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = coinage_rights
								level = 1
							}
						}
					}
					10 = {
						trigger = { vassal_contract_obligation_level_can_be_increased = war_declaration_rights }
						set_local_variable = {
							name = war_declaration_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = war_declaration_rights
								level = 1
							}
						}
					}
					10 = {
						trigger = { vassal_contract_obligation_level_can_be_increased = council_rights }
						set_local_variable = {
							name = council_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = council_rights
								level = 1
							}
						}
					}
					10 = {
						trigger = { vassal_contract_obligation_level_can_be_increased = title_revocation_rights }
						set_local_variable = {
							name = title_revocation_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = title_revocation_rights
								level = 1
							}
						}
					}
					10 = {
						trigger = {
							vassal_contract_obligation_level_can_be_increased = fortification_rights
							scope:lover.culture = {
								has_innovation = innovation_battlements
							}
						}
						set_local_variable = {
							name = fortification_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = fortification_rights
								level = 1
							}
						}
					}
					10 = {
						trigger = {
							vassal_contract_obligation_level_can_be_increased = religious_rights
							NOT = {
								faith = scope:lover.faith
							}
						}
						set_local_variable = {
							name = religious_rights
							value = 1
						}
						show_as_tooltip = {
							vassal_contract_set_obligation_level = {
								type = religious_rights
								level = 1
							}
						}
					}
				}
				hidden_effect = {
					send_interface_toast = {
						title = lover.1007.b_1
						right_icon = scope:lover
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = religious_rights }
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = fortification_rights }
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = coinage_rights }
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = war_declaration_rights }
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = council_rights }
						set_obligation_if_changed_effect = { OBLIGATION_TYPE = title_revocation_rights }
					}
				}
			}
			10 = {	
				desc = lover.1007.b_2	
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -14
				}
				send_interface_toast = {
					title = lover.1007.b_2
					if = {
						limit = {
							vassal_contract_obligation_level_can_be_increased = succession_rights
						}
						vassal_contract_set_obligation_level = {
							type = succession_rights
							level = 1
						}
					}
					else = {
						scope:lover = {
							add_opinion = {
								target = root
								modifier = respect_opinion
								opinion = -20
							}
						}
					}
				}
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
			humble = medium_stress_impact_gain
			content = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				diplomacy > scope:lover.diplomacy
			}
			ai_value_modifier = {
				ai_greed = 0.75
				ai_boldness = 0.5
			}
		}
	}
}


#####################
# Liege lover granting county modifier
# by Linnéa Thimrén
#####################
lover.1008 = {
	type = character_event
	title = lover.1008.t
	desc = lover.1008.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_1008 }
		any_relation = {
			type = lover
			is_available_ai = yes
			any_vassal = { this = root }
		}
		court_owner = { this = root }
		capital_county = {
			NOT = { has_county_modifier = encouraged_improvement_modifier }
		}
	}

	weight_multiplier = {
		base = 1
		
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_1008
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available_ai = yes
				any_vassal = { this = root }
			}
			save_scope_as = lover
		}
		capital_county = {
			save_scope_as = capital
		}
	}

	option = { #Spend time with me instead!
		name = lover.1008.a
		stress_impact = {
			base = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.75
			}
		}
	}

	option = { #Do what you can.
		name = lover.1008.b
		stress_impact = {
			base = minor_stress_impact_loss
			lustful = medium_stress_impact_gain
			fickle = medium_stress_impact_gain
		}
		scope:capital = {
			add_county_modifier = {
				modifier = encouraged_improvement_modifier
				days = 730
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				scope:capital = {
					development_level <= medium_development_level
				}
			}
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 0.25
			}
		}
	}
}



#####################################
# NEGATIVE EFFECTS
# 2000-2999
#####################################

#####################
# Having a secret lover is stressful
# by Petter Vilberg
#####################
scripted_trigger lover_2001_secret_lover_trigger = {
	#Check that they're not married to root
	NOT = {
		any_spouse = {
			this = root
		}
	}
	has_secret_relation_lover = root
	NOT = {
		has_relation_flag = {
			target = root
			relation = lover
			flag = secret_relationship_caused_stress
		}
	}
}

lover.2001 = {
	type = character_event
	title = lover.2001.t
	desc = lover.2001.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = love
	}

	trigger = {
		NOT = { has_character_flag = had_event_lover_2001 }
		any_relation = {
			type = lover
			lover_2001_secret_lover_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		#More likely to be stressful if you have a spouse
		modifier = {
			add = 1
			any_spouse = {
				always = yes
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_2001
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				lover_2001_secret_lover_trigger = yes
			}
			if = {
				limit = {
					has_relation_soulmate = root
				}
				add_relation_flag = {
					target = root
					relation = soulmate
					flag = secret_relationship_caused_stress
				}
			}
			else = {
				add_relation_flag = {
					target = root
					relation = lover
					flag = secret_relationship_caused_stress
				}
			}
			save_scope_as = lover
		}
	}

	option = {
		name = lover.2001.a
		stress_impact = {
			base = medium_stress_gain
		}
	}
}


#####################
# High stress deteriorates your relationship to a lover
# 2002-2003
# by Petter Vilberg
#####################
lover.2002 = {
	type = character_event
	title = lover.2002.t
	desc = {
		desc = lover.2002.desc
		triggered_desc = {
			trigger = {
				any_secret = {
					secret_type = secret_lover
					secret_target = scope:lover
				}
			}
			desc = lover.2002.secret
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = sadness
	}

	trigger = {
		NOT = { has_character_flag = had_event_lover_2002 }
		any_relation = {
			type = lover
			NOT = {
				has_opinion_modifier = {
					modifier = lover_being_mean_opinion
					target = root
				}
			}
		}
		stress >= 75
	}

	weight_multiplier = {
		base = 0.4
		#Start chance low, increase it as Stress grows
		#This should result in a weight of 1 at 60 Stress, and increases it from there up to 1.4 at 100
		compare_modifier = {
			target = root
			value = stress
			multiplier = 0.01
		}
	}

	immediate = {
		save_scope_as = first_lover
		add_character_flag = {
			flag = had_event_lover_2002
			days = 1825
		}
		random_relation = {
			type = lover
			 limit = {
			 	NOT = {
			 		has_opinion_modifier = {
			 			modifier = lover_being_mean_opinion
			 			target = root
			 		}
			 	}
			 }
			 save_scope_as = lover
			 hidden_effect = {
			 	trigger_event = lover.2003
			 }
		}
	}

	option = {
		name = lover.2002.a
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
				 	modifier = lover_being_mean_opinion
				 	target = root
				 }
			}
		}
	}
}


#Your Lover is acting terribly because of Stress
lover.2003 = {
	type = character_event
	title = lover.2003.t
	desc = lover.2003.desc
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = stress
	}

	option = {
		name = lover.2003.a
		add_stress = medium_stress_gain
		hidden_effect = {
			add_opinion = {
			 	modifier = lover_being_mean_opinion
			 	target = scope:first_lover
			}
		}
	}
}


#####################
# Question soulmate about spouse
# 2004-2005
# by Linnéa Thimrén
#####################

lover.2004 = {
	type = character_event
	title = lover.2004.t
	desc = lover.2004.desc
	theme = love
	left_portrait = {
		character = scope:lover
		animation = flirtation_left
	}
	lower_left_portrait = scope:lovers_lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_2004 }
		any_relation = {
			type = soulmate
			has_character_flag = can_be_confronted_about_lover_exclusivity
			any_consort = {
				NOT = { this = root }
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { # Do I trust them?
			OR = {
				has_trait = lunatic
				has_trait = paranoid
			}
			add = 0.5
		}
		modifier = {
			has_trait = trusting
			add = -0.5
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_2004
			days = 1825
		}
		random_relation = {
			type = soulmate
			limit = {
			 	has_character_flag = can_be_confronted_about_lover_exclusivity
				any_consort = {
					NOT = { this = root }
				}
			}
			save_scope_as = lover
			random_spouse = {
			 	limit = {
			 		NOT = { this = root }
			 	}
			 	save_scope_as = lovers_lover
			}
		}
	}

	option = { #Confront them!
		name = lover.2004.a
		custom_tooltip = lover.2004.a.tt
		scope:lover = {
			trigger_event = {
				id = lover.2005
				days = 3
			}
		}
	}

	option = { #Live and let love
		name = lover.2004.b
		flavor = lover.2004.b.tt
	}
}

# I'm being questioned
lover.2005 = {
	type = character_event
	title = lover.2004.t
	desc = lover.2005.desc
	theme = love
	left_portrait = {
		character = scope:original_lover
		animation = worry
	}
	right_portrait = scope:lovers_lover

	option = { #Don't worry my love!
		name = lover.2005.a
		
		scope:original_lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 10
			}
		}
		scope:lovers_lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 10
			}
		}
		
		scope:original_lover = {
			trigger_event = {
				id = lover.3103
			}
		}

		ai_chance = {
			base = 100

			opinion_modifier = {
				opinion_target = scope:original_lover
			}
		}
	}

	option = { #Don't meddle!!
		name = lover.2005.b
		
		scope:original_lover = {
			add_opinion = {
				target = root
				modifier = hurt_opinion
				opinion = -20
			}
		}
		
		scope:original_lover = {
			trigger_event = {
				id = lover.3104
			}
		}

		ai_chance = {
			base = 100

			opinion_modifier = {
				opinion_target = scope:lovers_lover
			}
		}
	}
}

#They say don't worry about spouse
lover.3103 = {
	type = character_event
	title = lover.2004.t
	desc = lover.3103.desc_married
	theme = love
	left_portrait = {
		character = scope:lover
		animation = love
	}

	immediate = {
		reverse_add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 10
		}
	}

	option = { #Thank you my dear
		name = lover.3103.a
	}
}


#They tell me to mind my own business
lover.3104 = {
	type = character_event
	title = lover.2004.t
	desc = {
		desc = lover.3104.desc_married
		desc = lover.3104.desc_ending
	}
	theme = love
	left_portrait = {
		character = scope:lover
		animation = disapproval
	}
	lower_left_portrait = scope:lovers_lover

	immediate = {
		reverse_add_opinion = {
			target = scope:original_lover
			modifier = annoyed_opinion
			opinion = -10
		}
	}

	option = { #Oh well
		name = lover.3104.a
		custom_tooltip = lover.3104.a.tt
	}

	option = { #Then I will end it!
		name = lover.3104.b

		show_as_tooltip = {
			remove_relation_soulmate = scope:lover
		}
		reverse_add_opinion = {
			target = scope:lover
			modifier = break_up_opinion
		}
		scope:lover = {
			trigger_event = lover.3105
		}
	}
}

#Response for soulmate: they broke up with me!
lover.3105 = {
	type = character_event
	title = lover.3105.t
	desc = lover.3105.desc
	theme = love
	left_portrait = {
		character = scope:discoverer
		animation = disapproval
	}
	lower_left_portrait = scope:lovers_lover

	immediate = {
		remove_relation_soulmate = scope:lover
	}

	option = { #Bummer!
		name = lover.3105.a
	}
}



#####################################
# OTHER ONGOING EVENTS
# 3000-3999
#####################################

#########################
# Love letter complex
# 3002-3010
# by Petter Vilberg
##########################
scripted_trigger lover_3002_love_letter_target_trigger = {
	NOR = {
		has_opinion_modifier = {
			modifier = terrible_love_letter_opinion
			target = root
		}
		has_opinion_modifier = {
			modifier = love_letter_opinion
			target = root
		}
		has_opinion_modifier = {
			modifier = good_love_letter_opinion
			target = root
		}
		has_opinion_modifier = {
			modifier = great_love_letter_opinion
			target = root
		}
	}
	opinion = {
		target = root
		value >= high_positive_opinion
	}
}

#Send a love letter
lover.3002 = {
	type = character_event
	title = lover.3002.t
	desc = lover.3002.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = love
	}

	trigger = {
		NOT = { has_character_flag = had_lover_letter_event }
		any_relation = {
			type = lover
			lover_3002_love_letter_target_trigger = yes
		}
	}

	immediate = {
		save_scope_as = first_lover
		add_character_flag = {
			flag = had_lover_letter_event
			years = 5
		}
		random_relation = {
			type = lover
			limit = {
				lover_3002_love_letter_target_trigger = yes
			}
			save_scope_as = lover
		}
	}

	option = {
		name = lover.3002.a
		duel = {
			skill = learning
			value = 8
			15 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
					min = -14
				}
				custom_tooltip = lover.3002.a_beautiful
				hidden_effect = {
					set_variable = {
						name = love_letter_quality
						value = 4
						days = 20
					}
					scope:lover = {
						trigger_event = {
							id = lover.3009
							days = { 3 10 }
						}
					}
				}
			}
			15 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
					min = -13
				}
				custom_tooltip = lover.3002.a_good
				hidden_effect = {
					set_variable = {
						name = love_letter_quality
						value = 3
						days = 20
					}
					scope:lover = {
						trigger_event = {
							id = lover.3007
							days = { 3 10 }
						}
					}
				}
			}
			15 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
					min = -13
				}
				custom_tooltip = lover.3002.a_competent
				hidden_effect = {
					set_variable = {
						name = love_letter_quality
						value = 2
						days = 20
					}
					scope:lover = {
						trigger_event = {
							id = lover.3005
							days = { 3 10 }
						}
					}
				}
			}
			15 = {		
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
					min = -14
				}
				custom_tooltip = lover.3002.a_bad
				hidden_effect = {
					set_variable = {
						name = love_letter_quality
						value = 1
						days = 20
					}
					scope:lover = {
						trigger_event = {
							id = lover.3003
							days = { 3 10 }
						}
					}
				}
			}
		}
	}

	option = {
		name = lover.3002.b
		stress_impact = {
			lustful = minor_stress_impact_gain
		}
	}
}


#You receive a terrible love letter
lover.3003 = {
	type = character_event
	title = lover.3002.t
	desc = {
		desc = lover.3003.desc
		desc = lover.3003.desc_conclusion
	}
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = love
	}

	immediate = {
		scope:first_lover = {
			trigger_event = {
				id = lover.3004
				days = { 3 5 }
			}
		}
	}

	option = {
		name = lover.3003.a
		add_opinion = {
			modifier = terrible_love_letter_opinion
			target = scope:first_lover
		}
	}
}


#Your love letter was terrible
lover.3004 = {
	type = character_event
	title = lover.3002.t
	desc = lover.3004.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = shock
	}

	option = {
		name = lover.3004.a
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					modifier = terrible_love_letter_opinion
					target = scope:first_lover
				}
			}
		}
	}
}


#You receive a love letter
lover.3005 = {
	type = character_event
	title = lover.3002.t
	desc = {
		desc = lover.3003.desc
		desc = lover.3005.desc_conclusion
	}
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = love
	}

	immediate = {
		scope:first_lover = {
			trigger_event = {
				id = lover.3006
				days = { 3 5 }
			}
		}
	}

	option = {
		name = lover.3005.a
		add_opinion = {
			modifier = love_letter_opinion
			target = scope:first_lover
		}
	}
}


#Your love letter was nice
lover.3006 = {
	type = character_event
	title = lover.3002.t
	desc = lover.3006.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = happiness
	}

	option = {
		name = lover.3006.a
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					modifier = love_letter_opinion
					target = scope:first_lover
				}
			}
		}
	}
}


#You receive a good love letter
lover.3007 = {
	type = character_event
	title = lover.3002.t
	desc = {
		desc = lover.3003.desc
		desc = lover.3007.desc_conclusion
	}
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = love
	}

	immediate = {
		scope:first_lover = {
			trigger_event = {
				id = lover.3008
				days = { 3 5 }
			}
		}
	}

	option = {
		name = lover.3007.a
		add_opinion = {
			modifier = good_love_letter_opinion
			target = scope:first_lover
		}
	}
}


#Your love letter was good
lover.3008 = {
	type = character_event
	title = lover.3002.t
	desc = lover.3008.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = flirtation
	}

	option = {
		name = lover.3008.a
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					modifier = good_love_letter_opinion
					target = scope:first_lover
				}
			}
		}
	}
}


#You receive a beautiful love letter
lover.3009 = {
	type = character_event
	title = lover.3002.t
	desc = {
		desc = lover.3003.desc
		desc = lover.3009.desc_conclusion
	}
	theme = lover_relation
	left_portrait = {
		character = scope:first_lover
		animation = love
	}

	immediate = {
		scope:first_lover = {
			trigger_event = {
				id = lover.3010
				days = { 3 5 }
			}
		}
	}

	option = {
		name = lover.3009.a
		add_opinion = {
			modifier = great_love_letter_opinion
			target = scope:first_lover
		}
	}
}


#Your love letter was great
lover.3010 = {
	type = character_event
	title = lover.3002.t
	desc = lover.3010.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = love
	}

	option = {
		name = lover.3010.a
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					modifier = great_love_letter_opinion
					target = scope:first_lover
				}
			}
		}
	}
}






#########################
# Leave lover_object_of_importance for lover to find
# 3201-3202
# by Linnéa Thimrén
##########################

lover.3201 = {
	type = character_event
	title = lover.3201.t
	desc = lover.3201.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3201 }
		any_relation = {
			type = lover
			is_available = yes
			object_of_importance_exist_trigger = {
				LOVER = root
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			any_relation = {
				type = lover
				is_available = yes
				object_of_importance_exist_trigger = {
					LOVER = root
				}
				reverse_has_opinion_modifier = {
					target = root
					modifier = love_opinion
					value >= 30
				}
			}
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_3201
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available = yes
				object_of_importance_exist_trigger = {
					LOVER = root
				}
			}
			save_scope_as = lover
		}
	}

	option = { #This will make a great gift!
		name = lover.3201.a
		remove_short_term_gold = minor_gold_value
		scope:lover = {
			show_as_tooltip = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
			trigger_event = lover.3202
		}
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
		stress_impact = {
			greedy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 30
				has_opinion_modifier = {
					target = scope:lover
					modifier = love_opinion
					value >= 20
				}
			}
			ai_value_modifier = {
				ai_compassion = 0.25
			}
		}
	}

	option = { #I will buy them a hundred lover_object_of_importance!
		name = lover.3201.b
		remove_short_term_gold = medium_gold_value
		save_scope_value_as = {
			name = exquisite_gift
			value = yes
		}
		scope:lover = {
			show_as_tooltip = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 40
				}
			}
			trigger_event = lover.3202
		}
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 80
				has_trait = generous
			}
			modifier = {
				add = 50
				has_opinion_modifier = {
					target = scope:lover
					modifier = love_opinion
					value >= 20
				}
			}
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #Nah, not worth it.
		name = lover.3201.c
		custom_tooltip = lover.3201.c.tt
		stress_impact = {
			generous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				has_trait = greedy
			}
			ai_value_modifier = {
				ai_greed = 0.75
				ai_rationality = 0.5
			}
		}
	}
}

#Response event for lover: they left a lover_object_of_importance for me!
lover.3202 = {
	type = character_event
	title = lover.3201.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:exquisite_gift
				}
				desc = lover.3202.desc_exquisite_gift
			}
			desc = lover.3202.desc_ordinary_gift
		}
		desc = lover.3202.desc_ending
	}
	theme = lover_relation
	left_portrait = {
		character = scope:original_lover
		animation = love
	}

	option = {
		name = lover.3202.a
		custom_tooltip = lover.3202.a.tt
		if = {
			limit = {
				exists = scope:exquisite_gift
			}
			add_opinion = {
				target = scope:original_lover
				modifier = love_opinion
				opinion = 40
			}
			scope:original_lover = {
				show_as_tooltip = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
			}
		}
		else = {
			add_opinion = {
				target = scope:original_lover
				modifier = love_opinion
				opinion = 20
			}
			scope:original_lover = {
				show_as_tooltip = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
			}
		}
	}
}


#########################
# Go to your spouse or your lover
# by Linnéa Thimrén
##########################
lover.3203 = {
	type = character_event
	title = lover.3203.t
	desc = lover.3203.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = flirtation
	}
	right_portrait = scope:spouse
	
	trigger = {
		NOT = { has_trait = chaste }
		NOT = { has_character_flag = had_event_lover_3203 }
		any_relation = {
			type = lover
			scope_is_close_to_root_trigger = yes
			is_available = yes
			NOT = { is_spouse_of = root }
			has_secret_relation_lover = root
		}
		any_spouse = {
			is_available = yes
			scope_is_close_to_root_trigger = yes
			NOT = { has_relation_lover = root }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			any_relation = {
				type = lover
				scope_is_close_to_root_trigger = yes
				is_available = yes
				NOT = { is_spouse_of = root }
				has_secret_relation_lover = root
				reverse_has_opinion_modifier = {
					target = root
					modifier = love_opinion
					value >= 20
				}
			}
			any_spouse = {
				is_available = yes
				scope_is_close_to_root_trigger = yes
				NOT = { has_relation_lover = root }
				reverse_has_opinion_modifier = {
					target = root
					modifier = love_opinion
					value >= 20
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_3203
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				scope_is_close_to_root_trigger = yes
				has_secret_relation_lover = root
				is_available = yes
				NOT = { is_spouse_of = root }
			}
			save_scope_as = lover
		}
		random_spouse = {
			limit = {
				scope_is_close_to_root_trigger = yes
				is_available = yes
				NOT = { has_relation_lover = root }
			}
			save_scope_as = spouse
		}
		whom_do_i_love_the_most_effect = { #Most love_opinion towards whom?
			CHARACTER1 = scope:spouse
			CHARACTER2 = scope:lover
		}
	}

	option = { #I will go to my spouse
		name = {
			trigger = { scope:most_beloved = scope:spouse }
			text = lover.3203.a_beloved
		}
		name = {
			trigger = { always = yes }
			text = lover.3203.a_not_beloved
		}
		scope:spouse = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 20
			}
		}
		stress_impact = {
			base = minor_stress_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 100
				scope:most_beloved = scope:spouse
			}
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}

	option = { #I will go to my lover!
		name = lover.3203.b
		duel = {
			skill = intrigue
			target = scope:spouse
			20 = {		
				desc = lover.3203.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
					min = -19
				}
				send_interface_toast = {
					title = lover.3203.b.success
					custom_tooltip = lover.3203.b.tt_safe
				}
			}
			5 = {		
				desc = lover.3203.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.25
					min = -4
				}
				send_interface_toast = {
					title = lover.3203.b.failure
					random_secret = {
						limit = {
							exists = secret_target
							secret_target = scope:lover
							secret_type = secret_lover
						}
						reveal_to = scope:spouse
					}
				}
			}
		}
		if = {
			limit = {
				scope:most_beloved = scope:spouse
			}
			stress_impact = {
				base = minor_stress_loss
			}
		}
		else = {
			stress_impact = {
				base = medium_stress_loss
				lustful = minor_stress_impact_loss
			}
		}
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 20
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				scope:most_beloved = scope:lover
			}
			ai_value_modifier = {
				ai_greed = 0.25
				ai_boldness = 0.5
			}
		}
	}
	
	option = { #I'd rather not
		name = lover.3203.c
		add_piety = minor_piety_gain
		stress_impact = {
			base = medium_stress_gain
			lustful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
		}
	}
}


#########################
# Your lover is far far away
# 3204-3205
# by Linnéa Thimrén
##########################
lover.3204 = {
	type = character_event
	title = lover.3204.t
	desc = lover.3204.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3204 }
		any_relation = {
			type = lover
			NOT = { scope_is_close_to_root_trigger = yes }
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = { #more likely if they don't have the same top_liege
			add = 0.5
			any_relation = {
				type = lover
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
		}
		modifier = { #more likely if you/they don't have a lot of love op.
			add = 0.5
			any_relation = {
				type = lover
				NOT = { scope_is_close_to_root_trigger = yes }
				OR = {
					reverse_has_opinion_modifier = {
						target = root
						modifier = love_opinion
						value <= 15
					}
					has_opinion_modifier = {
						target = root
						modifier = love_opinion
						value <= 15
					}
				}
			}
		}
		modifier = { #more likely if you/they don't like the other all that much
			add = 0.5
			any_relation = {
				type = lover
				NOT = { scope_is_close_to_root_trigger = yes }
				OR = {
					AND = {
						reverse_opinion = {
							target = root
							value <= 40
						}
						reverse_has_opinion_modifier = {
							target = root
							modifier = love_opinion
							value <= 10
						}
					}
					AND = {
						opinion = {
							target = root
							value <= 40
						}
						has_opinion_modifier = {
							target = root
							modifier = love_opinion
							value <= 10
						}
					}
				}
			}
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_3204
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
			alternative_limit = {
				NOT = { scope_is_close_to_root_trigger = yes }
			}
			save_scope_as = lover
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = { #Things will happen as they happen
		name = lover.3204.a
		custom_tooltip = lover.3204.a.tt
	}
	
	option = { #I will break up with them
		name = lover.3204.b
		show_as_tooltip = {
			remove_relation_lover = scope:lover
		}
		scope:lover = {
			trigger_event = lover.3205
		}
	}
}


#Response event for lover far far away if you break up with them
lover.3205 = {
	type = letter_event
	opening = {
		desc = lover.3205.opening
	}
	desc = lover.3205.desc
	sender = {
		character = scope:original_lover
		animation = dismissal
	}

	immediate = {
		scope:original_lover = {
			remove_relation_lover = root
		}
	}

	option = {
		name = lover.3205.a
		custom_tooltip = lover.3205.a.tt
	}
}



#########################
# You're forced to wage war against your lover
# by Linnéa Thimrén
##########################
lover.3206 = {
	type = character_event
	title = lover.3206.t
	desc = lover.3206.desc
	theme = lover_relation
	left_portrait = {
		character = scope:lover
		animation = anger
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3206 }
		liege = {
			any_character_war = {
				war_contribution = {
					target = root
					value > 0
				}
				casus_belli = {
					primary_attacker = {
						any_vassal = { this = root }
					}
					primary_defender = {
						any_vassal = { has_relation_lover = root }
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = {
			flag = had_event_lover_3206
			days = 1825
		}
		liege = {
			random_character_war = {
				limit = {
					war_contribution = {
						target = root
						value > 0
					}
					casus_belli = {
						primary_attacker = {
							any_vassal = { this = root }
						}
						primary_defender = {
							any_vassal = { has_relation_lover = root }
						}
					}
				}
				casus_belli = {
					primary_attacker = {
						save_scope_as = attacker
					}
					primary_defender = {
						save_scope_as = defender
						random_vassal = {
							limit = {
								has_relation_lover = root
							}
							save_scope_as = lover
						}
					}
				}
			}
		}
	}

	option = { #There's nothing I can do about it
		name = lover.3206.a
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = -20
			}
		}
		stress_impact = {
			deceitful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_honor = 0.5
				ai_rationality = 0.25
				ai_boldness = 0.25
			}
		}
	}

	option = { #I will hinder my liege!
		name = lover.3206.b
		custom_tooltip = lover.3206.b.tt
		scope:lover = {
			add_opinion = {
				target = root
				modifier = love_opinion
				opinion = 40
			}
		}
		add_character_modifier = {
			modifier = decreased_levies_modifier
			days = 1825
		}
		random = {
			chance = 10
			compare_modifier = {
				target = scope:attacker
				value = intrigue
				step = 4
				multiplier = 0.5
			}
			scope:attacker = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -20
				}
			}
		}
		stress_impact = {
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}
}


#########################
# Write letter to beloved!
# 3207-3210
# by Linnéa Thimrén
##########################
lover.3207 = {
	type = character_event
	title = lover.3207.t
	desc = lover.3207.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3207 }
		any_relation = {
			type = lover
			is_available = yes
			NOT = { scope_is_close_to_root_trigger = yes }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely if they don't have the same top_liege
			add = 0.5
			any_relation = {
				type = lover
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
		}
	}

	immediate = {
		save_scope_as = writing_lover
		add_character_flag = {
			flag = had_event_lover_3207
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
			alternative_limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
			}
			save_scope_as = lover
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = { #Write the lover a poem
		name = { #Do we have an object_of_importance?
			trigger = {
				scope:lover = {
					object_of_importance_exist_trigger = {
						LOVER = root
					}
				}
			}
			text = lover.3207.a_object
		}
		name = {
			trigger = { always = yes }
			text = lover.3207.a
		}
		custom_tooltip = lover.3207.a.tt
		if = {
			limit = {
				scope:lover = {
					object_of_importance_exist_trigger = {
						LOVER = root
					}
				}
			}
			show_as_tooltip = {
				scope:lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
				add_opinion = {
					target = scope:lover
					modifier = love_opinion
					opinion = 20
				}
			}
			add_character_flag = {
				flag = sent_object_of_importance
				days = 40
			}
		}
		else = {
			show_as_tooltip = {
				scope:lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 10
					}
				}
				add_opinion = {
					target = scope:lover
					modifier = love_opinion
					opinion = 10
				}
			}
		}
		scope:lover = {
			trigger_event = {
				id = lover.3208
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 100
		}
	}
	
	option = { #Nah.
		name = lover.3207.c
		custom_tooltip = lover.3207.c.tt
		stress_impact = {
			base = minor_stress_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}
}

#Response event for lover: I got a letter!
lover.3208 = {
	type = letter_event
	opening = {
		desc = lover.3208.opening
	}
	desc = {
		triggered_desc = {
			trigger = {
				scope:writing_lover = {
					has_character_flag = sent_object_of_importance
				}
			}
			desc = lover.3208.desc_object
		}
		desc = love_letter_test
	}
	sender = {
		character = scope:writing_lover
		animation = love
	}

	immediate = {
		scope:writing_lover = {
			love_letter_calculation_effect = yes
		}
		save_scope_as = love_letter_target
	}

	option = { #Aw, how sweet!
		name = lover.3208.a
		if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 1 }
			}
			custom_tooltip = lover.3208.a_terrible
		}
		else_if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 2 }
			}
			custom_tooltip = lover.3208.a_okay
		}
		else_if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 3 }
			}
			custom_tooltip = lover.3208.a_great
		}
		else_if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 4 }
			}
			custom_tooltip = lover.3208.a_amazing
		}
		if = {
			limit = {
				scope:writing_lover = {
					has_character_flag = sent_object_of_importance
				}
			}
			show_as_tooltip = {
				scope:writing_lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
			}
			add_opinion = {
				target = scope:writing_lover
				modifier = love_opinion
				opinion = 20
			}
		}
		else = {
			show_as_tooltip = {
				scope:writing_lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 10
					}
				}
			}
			add_opinion = {
				target = scope:writing_lover
				modifier = love_opinion
				opinion = 10
			}
		}
		scope:writing_lover = {
			trigger_event = {
				id = lover.3209
				days = { 7 14 }
			}
		}
		if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 2 }
			}
			stress_impact = {
				honest = medium_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				scope:writing_lover = { var:love_letter_quality = 1 }
			}
			stress_impact = {
				honest = major_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				callous = medium_stress_impact_gain
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #It's horrible!
		name = lover.3208.b
		show_as_tooltip = {
			scope:writing_lover = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -10
				}
			}
		}
		add_opinion = {
			target = scope:writing_lover
			modifier = respect_opinion
			opinion = -10
		}
		scope:writing_lover = {
			trigger_event = {
				id = lover.3210
				days = { 7 14 }
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				scope:writing_lover = { var:love_letter_quality = 2 }
			}
			modifier = {
				add = 100
				scope:writing_lover = { var:love_letter_quality = 1 }
			}
			ai_value_modifier = {
				ai_rationality = 0.75
			}
		}
	}

	after = {
		if = {
			limit = {
				scope:writing_lover = {
					has_character_flag = sent_object_of_importance
				}
			}
			scope:writing_lover = {
				remove_character_flag = sent_object_of_importance
			}
		}
	}
}

#They loved it!
lover.3209 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = lover.3209.desc
	sender = {
		character = scope:lover
		animation = love
	}

	immediate = {
		if = {
			limit = {
				has_character_flag = sent_object_of_importance
			}
			show_as_tooltip = {
				scope:lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		else = {
			show_as_tooltip = {
				scope:lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 10
					}
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 10
			}
		}
	}

	option = {
		name = lover.3209.a
	}
}


#They thought it was horrible
lover.3210 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = lover.3210.desc
	sender = {
		character = scope:lover
		animation = dismissal
	}

	immediate = {
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -10
				}
			}
		}
		add_opinion = {
			target = scope:lover
			modifier = respect_opinion
			opinion = -10
		}
	}

	option = {
		name = lover.3210.a
	}
}


#########################
# Send lover a painting
# 3211-3214
# by Linnéa Thimrén
##########################
lover.3211 = {
	type = character_event
	title = lover.3211.t
	desc = lover.3211.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3211 }
		any_relation = {
			type = lover
			is_available = yes
			NOT = { scope_is_close_to_root_trigger = yes }
			has_any_lifestyle_trait_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely if they don't have the same top_liege
			add = 0.5
			any_relation = {
				type = lover
				is_available = yes
				NOT = { top_liege = root.top_liege }
				NOT = { scope_is_close_to_root_trigger = yes }
				has_any_lifestyle_trait_trigger = yes
			}
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_3211
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
				has_any_lifestyle_trait_trigger = yes
			}
			alternative_limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				has_any_lifestyle_trait_trigger = yes
			}
			save_scope_as = lover
		}

		capital_barony = {
			save_scope_as = capital
		}

		#To make an informed choice about what options to show
		if = {
			limit = {
				OR = {
					has_diplomacy_lifestyle_trait_trigger = yes
					scope:lover = { has_diplomacy_lifestyle_trait_trigger = yes }
				}
			}
			add_to_variable_list = {
				name = option_to_show
				target = flag:lifestyle_diplomat
			}
		}
		if = {
			limit = {
				OR = {
					has_martial_lifestyle_trait_trigger = yes
					scope:lover = { has_martial_lifestyle_trait_trigger = yes }
				}
			}
			add_to_variable_list = {
				name = option_to_show
				target = flag:lifestyle_general
			}
		}
		if = {
			limit = {
				OR = {
					has_stewardship_lifestyle_trait_trigger = yes
					scope:lover = { has_stewardship_lifestyle_trait_trigger = yes }
				}
			}
			add_to_variable_list = {
				name = option_to_show
				target = flag:lifestyle_administrator
			}
		}
		if = {
			limit = {
				OR = {
					has_intrigue_lifestyle_trait_trigger = yes
					scope:lover = { has_intrigue_lifestyle_trait_trigger = yes }
				}
			}
			add_to_variable_list = {
				name = option_to_show
				target = flag:lifestyle_schemer
			}
		}
		if = {
			limit = {
				OR = {
					has_learning_lifestyle_trait_trigger = yes
					scope:lover = { has_learning_lifestyle_trait_trigger = yes }
				}
			}
			add_to_variable_list = {
				name = option_to_show
				target = flag:lifestyle_scholar
			}
		}
		while = {
			limit = {
				variable_list_size = {
					name = option_to_show
					value < 3
				}
			}
			hidden_effect = {
				random_list = {
					10 = {
						trigger = {
							NOT = {
								is_target_in_variable_list = {
									name = option_to_show
									target = flag:lifestyle_diplomat
								}
							}
						}
						add_to_variable_list = {
							name = option_to_show
							target = flag:lifestyle_diplomat
						}
					}
					10 = {
						trigger = {
							NOT = {
								is_target_in_variable_list = {
									name = option_to_show
									target = flag:lifestyle_general
								}
							}
						}
						add_to_variable_list = {
							name = option_to_show
							target = flag:lifestyle_general
						}
					}
					10 = {
						trigger = {
							NOT = {
								is_target_in_variable_list = {
									name = option_to_show
									target = flag:lifestyle_administrator
								}
							}
						}
						add_to_variable_list = {
							name = option_to_show
							target = flag:lifestyle_administrator
						}
					}
					10 = {
						trigger = {
							NOT = {
								is_target_in_variable_list = {
									name = option_to_show
									target = flag:lifestyle_schemer
								}
							}
						}
						add_to_variable_list = {
							name = option_to_show
							target = flag:lifestyle_schemer
						}
					}
					10 = {
						trigger = {
							NOT = {
								is_target_in_variable_list = {
									name = option_to_show
									target = flag:lifestyle_scholar
								}
							}
						}
						add_to_variable_list = {
							name = option_to_show
							target = flag:lifestyle_scholar
						}
					}
				}
			}
		}
	}

	option = { #Of an alley
		name = lover.3211.a
		trigger = {
			is_target_in_variable_list = {
				name = option_to_show
				target = flag:lifestyle_schemer
			}
		}
		save_scope_value_as = {
			name = painting_sent
			value = flag:lifestyle_schemer
		}
		if = {
			limit = {
				scope:lover = { has_intrigue_lifestyle_trait_trigger = yes }
			}
			save_scope_value_as = {
				name = perfect_choice
				value = yes
			}
		}
		custom_tooltip = lover.3211.a.tt
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3211.appreciate
		scope:lover = {
			show_as_tooltip = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
				reverse_add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3212
				days = { 7 14 }
			}
		}
	}

	option = { #Religious motive
		name = lover.3211.b
		trigger = {
			is_target_in_variable_list = {
				name = option_to_show
				target = flag:lifestyle_scholar
			}
		}
		save_scope_value_as = {
			name = painting_sent
			value = flag:lifestyle_scholar
		}
		if = {
			limit = {
				scope:lover = { has_learning_lifestyle_trait_trigger = yes }
			}
			save_scope_value_as = {
				name = perfect_choice
				value = yes
			}
		}
		custom_tooltip = lover.3211.b.tt
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3211.appreciate
		scope:lover = {
			show_as_tooltip = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
				reverse_add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3212
				days = { 7 14 }
			}
		}
	}
	
	option = { #Cool battle
		name = lover.3211.c
		trigger = {
			is_target_in_variable_list = {
				name = option_to_show
				target = flag:lifestyle_general
			}
		}
		save_scope_value_as = {
			name = painting_sent
			value = flag:lifestyle_general
		}
		if = {
			limit = {
				scope:lover = { has_martial_lifestyle_trait_trigger = yes }
			}
			save_scope_value_as = {
				name = perfect_choice
				value = yes
			}
		}
		custom_tooltip = lover.3211.c.tt
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3211.appreciate
		scope:lover = {
			show_as_tooltip = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
				reverse_add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3212
				days = { 7 14 }
			}
		}
	}

	option = { #Busy marketplace
		name = lover.3211.d
		trigger = {
			is_target_in_variable_list = {
				name = option_to_show
				target = flag:lifestyle_administrator
			}
		}
		save_scope_value_as = {
			name = painting_sent
			value = flag:lifestyle_administrator
		}
		if = {
			limit = {
				scope:lover = { has_stewardship_lifestyle_trait_trigger = yes }
			}
			save_scope_value_as = {
				name = perfect_choice
				value = yes
			}
		}
		custom_tooltip = lover.3211.d.tt
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3211.appreciate
		scope:lover = {
			show_as_tooltip = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
				reverse_add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3212
				days = { 7 14 }
			}
		}
	}

	option = { #Esteemed debate
		name = lover.3211.e
		trigger = {
			is_target_in_variable_list = {
				name = option_to_show
				target = flag:lifestyle_diplomat
			}
		}
		save_scope_value_as = {
			name = painting_sent
			value = flag:lifestyle_diplomat
		}
		if = {
			limit = {
				scope:lover = { has_diplomacy_lifestyle_trait_trigger = yes }
			}
			save_scope_value_as = {
				name = perfect_choice
				value = yes
			}
		}
		custom_tooltip = lover.3211.e.tt
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3211.appreciate
		scope:lover = {
			show_as_tooltip = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
				reverse_add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3212
				days = { 7 14 }
			}
		}
	}

	option = { #Nah.
		name = lover.3211.f
		stress_impact = {
			base = medium_stress_gain
		}
	}

	after = {
		clear_variable_list = option_to_show
	}
}

#For lover: I got a painting!
lover.3212 = {
	type = letter_event
	opening = {
		desc = lover.3212.desc_opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_schemer
				}
				desc = lover.3212.desc_lifestyle_schemer
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_scholar
				}
				desc = lover.3212.desc_lifestyle_scholar
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_general
				}
				desc = lover.3212.desc_lifestyle_general
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_administrator
				}
				desc = lover.3212.desc_lifestyle_administrator
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_diplomat
				}
				desc = lover.3212.desc_lifestyle_diplomat
			}
		}
	}	
	sender = {
		character = scope:original_lover
		animation = love
	}

	option = { #Thank you my love!
		name = lover.3212.a
		if = {
			limit = {
				exists = scope:perfect_choice
			}
			custom_tooltip = lover.3212.a.perfect
		}
		add_character_modifier = {
			modifier = romance_great_painting_gift_modifier
			days = 730
		}
		add_opinion = {
			target = scope:original_lover
			modifier = love_opinion
			opinion = 15
		}
		scope:original_lover = {
			show_as_tooltip = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
			trigger_event = {
				id = lover.3213
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				add = 500
				exists = scope:perfect_choice
			}
		}
	}

	option = { #Ugh, it's ugly.
		name = lover.3212.b
		add_opinion = {
			target = scope:original_lover
			modifier = respect_opinion
			opinion = -10
		}
		scope:original_lover = {
			show_as_tooltip = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -10
				}
			}
			trigger_event = {
				id = lover.3214
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}
}


#They thought it was beautiful!
lover.3213 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:perfect_choice
				}
				desc = lover.3213.desc_perfect
			}
			desc = lover.3213.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_schemer
				}
				desc = lover.3213.desc_lifestyle_schemer
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_scholar
				}
				desc = lover.3213.desc_lifestyle_scholar
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_general
				}
				desc = lover.3213.desc_lifestyle_general
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_administrator
				}
				desc = lover.3213.desc_lifestyle_administrator
			}
			triggered_desc = {
				trigger = {
					scope:painting_sent = flag:lifestyle_diplomat
				}
				desc = lover.3213.desc_lifestyle_diplomat
			}
		}
	}
	sender = {
		character = scope:lover
		animation = love
	}

	immediate = {
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 15
		}
		show_as_tooltip = {
			scope:lover = {
				add_character_modifier = {
					modifier = romance_great_painting_gift_modifier
					days = 730
				}
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 15
				}
			}
		}
	}

	option = {
		name = lover.3213.a
	}
}


#They threw it out...
lover.3214 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = lover.3214.desc
	sender = {
		character = scope:lover
		animation = dismissal
	}

	immediate = {
		add_opinion = {
			target = scope:lover
			modifier = respect_opinion
			opinion = -10
		}
		show_as_tooltip = {
			reverse_add_opinion = {
				target = scope:lover
				modifier = respect_opinion
				opinion = -10
			}
		}
	}

	option = {
		name = lover.3214.a
	}
}


#########################
# Send a troubadour to lover's court
# 3215-3218
# by Linnéa Thimrén
##########################
lover.3215 = {
	type = character_event
	title = lover.3215.t
	desc = lover.3215.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3215 }
		any_relation = {
			type = lover
			is_available = yes
			NOT = { scope_is_close_to_root_trigger = yes }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely if they don't have the same top_liege
			add = 0.5
			any_relation = {
				type = lover
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_3215
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
			alternative_limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
			}
			save_scope_as = lover
			court_owner = {
				capital_province = {
					barony = { save_scope_as = court_location }
				}
			}
		}
	}

	option = { #Send the best troubadour you can find!
		name = lover.3215.a
		remove_short_term_gold = medium_gold_value
		custom_tooltip = lover.3215.a.tt
		custom_tooltip = lover.3211.appreciate
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		save_scope_value_as = {
			name =	fancy_troubadour
			value = yes
		}
		scope:lover = {
			trigger_event = {
				id = lover.3216
				days = { 7 14 }
			}
		}
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Send any troubadour.
		name = lover.3215.b
		remove_short_term_gold = minor_gold_value
		custom_tooltip = lover.3215.a.tt
		custom_tooltip = lover.3211.appreciate
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 5
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 5
			}
		}
		scope:lover = {
			trigger_event = {
				id = lover.3216
				days = { 7 14 }
			}
		}
		stress_impact = {
			ambitious = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_greed = 0.75
			}
		}
	}

	option = { #Nah.
		name = lover.3215.c
		custom_tooltip = lover.3215.c.tt
		ai_chance = {
			base = 0
		}
	}
}


#Response for lover: a troubadour showed up!
lover.3216 = {
	type = character_event
	title = lover.3215.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:fancy_troubadour
				}
				desc = lover.3216.desc_fancy_troubadour
			}
			desc = lover.3216.desc
		}
		desc = lover.3216.desc_ending
	}
	theme = lover_relation
	left_portrait = {
		character = scope:original_lover
		animation = flirtation
	}

	option = { #Loved it!
		name = lover.3216.a
		if = {
			limit = {
				exists = scope:fancy_troubadour
			}
			add_character_modifier = {
				modifier = romance_talented_troubadour_modifier
				days = 730
			}
			add_opinion = {
				target = scope:original_lover
				modifier = love_opinion
				opinion = 20
			}
			show_as_tooltip = {
				scope:original_lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}
				}
			}
		}
		else = {
			add_character_modifier = {
				modifier = romance_less_talented_troubadour_modifier
				days = 730
			}
			add_opinion = {
				target = scope:original_lover
				modifier = love_opinion
				opinion = 5
			}
			show_as_tooltip = {
				scope:original_lover = {
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 5
					}
				}
			}
		}
		scope:original_lover = {
			trigger_event = {
				id = lover.3217
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 200
				exists = scope:fancy_troubadour
			}
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	option = { #Ugh, what is this?
		name = lover.3216.b
		add_opinion = {
			target = scope:original_lover
			modifier = respect_opinion
			opinion = -10
		}
		scope:original_lover = {
			trigger_event = {
				id = lover.3218
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.25
				ai_rationality = 0.25
			}
		}
	}
}


#They thought it was delightful!
lover.3217 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = lover.3217.desc
	sender = {
		character = scope:lover
		animation = flirtation
	}

	immediate = {
		if = {
			limit = {
				exists = scope:fancy_troubadour
			}
			show_as_tooltip = {
				scope:lover = {
					add_character_modifier = {
						modifier = romance_talented_troubadour_modifier
						days = 730
					}
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 20
					}	
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		else = {
			show_as_tooltip = {
				scope:lover = {
					add_character_modifier = {
						modifier = romance_less_talented_troubadour_modifier
						days = 730
					}
					add_opinion = {
						target = root
						modifier = love_opinion
						opinion = 5
					}	
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 5
			}
		}
	}

	option = {
		name = lover.3217.a
	}
}


#They thought it was horrible
lover.3218 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = lover.3218.desc
	sender = {
		character = scope:lover
		animation = disgust
	}

	immediate = {
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -10
				}
			}
		}
	}

	option = {
		name = lover.3218.a
	}
}



#########################
# Send a personal object to lover
# 3219-3222
# by Linnéa Thimrén
##########################
lover.3219 = {
	type = character_event
	title = lover.3219.t
	desc = lover.3219.desc
	theme = lover_relation
	left_portrait = scope:lover
	
	trigger = {
		NOT = { has_character_flag = had_event_lover_3219 }
		any_relation = {
			type = lover
			is_available = yes
			NOT = { scope_is_close_to_root_trigger = yes }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely if they don't have the same top_liege
			add = 0.5
			any_relation = {
				type = lover
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
		}
	}

	immediate = {
		save_scope_as = original_lover
		add_character_flag = {
			flag = had_event_lover_3219
			days = 1825
		}
		random_relation = {
			type = lover
			limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
				NOT = { top_liege = root.top_liege }
			}
			alternative_limit = {
				is_available = yes
				NOT = { scope_is_close_to_root_trigger = yes }
			}
			save_scope_as = lover
		}
	}

	option = { #Send a lock of your hair
		name = lover.3219.a
		custom_tooltip = lover.3219.a.tt
		custom_tooltip = lover.3211.appreciate
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		save_scope_value_as = {
			name =	gift_sent
			value = flag:hair
		}
		scope:lover = {
			trigger_event = {
				id = lover.3220
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Send something intimate
		name = lover.3219.b
		custom_tooltip = lover.3219.b.tt
		custom_tooltip = lover.3211.appreciate
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		save_scope_value_as = {
			name =	gift_sent
			value = flag:smallclothes
		}
		scope:lover = {
			trigger_event = {
				id = lover.3220
				days = { 7 14 }
			}
		}
		stress_impact = {
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 100
				has_trait = lustful
			}
			ai_value_modifier = {
				ai_boldness = 0.5
			}
		}
	}

	option = { #Send object_of_importance
		name = lover.3219.c
		trigger = {
			scope:lover = {
				object_of_importance_exist_trigger = {
					LOVER = root
				}
			}
		}
		custom_tooltip = lover.3219.c.tt
		custom_tooltip = lover.3211.appreciate
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
			add_opinion = {
				target = scope:lover
				modifier = love_opinion
				opinion = 20
			}
		}
		save_scope_value_as = {
			name =	gift_sent
			value = flag:object
		}
		scope:lover = {
			trigger_event = {
				id = lover.3220
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.25
			}
		}
	}

	option = { #Nah.
		name = lover.3219.d
		custom_tooltip = lover.3219.d.tt
	}
}


#Response event for lover: I got a personal gift!
lover.3220 = {
	type = letter_event
	opening = {
		desc = lover.3205.opening
	}
	desc = {
		desc = lover.3220.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:hair
				}
				desc = lover.3220.desc_hair
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:smallclothes
				}
				desc = lover.3220.desc_smallclothes
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:object
				}
				desc = lover.3220.desc_object
			}
		}
	}
	sender = {
		character = scope:original_lover
		animation = love
	}

	option = { #What a lovely gift!
		name = lover.3220.a
		add_opinion = {
			target = scope:original_lover
			modifier = love_opinion
			opinion = 20
		}
		show_as_tooltip = {
			scope:original_lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
		}
		scope:original_lover = {
			trigger_event = {
				id = lover.3221
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.25
				ai_compassion = 0.25
			}
		}
	}

	option = { #ew
		name = lover.3220.b
		if = {
			limit = {
				scope:gift_sent = flag:smallclothes
			}
			custom_tooltip = lover.3220.b.tt_smallclothes
		}
		add_opinion = {
			target = scope:original_lover
			modifier = respect_opinion
			opinion = -10
		}
		scope:original_lover = {
			trigger_event = {
				id = lover.3222
				days = { 7 14 }
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 100
				scope:gift_sent = flag:smallclothes
				OR = {
					NOT = { has_trait = lustful }
					ai_boldness < low_positive_boldness
				}
			}
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
}


#They liked the gift!
lover.3221 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = {
		desc = lover.3221.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:hair
				}
				desc = lover.3221.desc_hair
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:smallclothes
				}
				desc = lover.3221.desc_smallclothes
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:object
				}
				desc = lover.3221.desc_object
			}
		}
	}
	sender = {
		character = scope:lover
		animation = love
	}

	immediate = {
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = love_opinion
					opinion = 20
				}
			}
		}
		add_opinion = {
			target = scope:lover
			modifier = love_opinion
			opinion = 20
		}
	}

	option = {
		name = lover.3221.a
	}
}


#They hated the gift!
lover.3222 = {
	type = letter_event
	opening = {
		desc = lover.3209.opening
	}
	desc = {
		desc = lover.3222.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:hair
				}
				desc = lover.3222.desc_hair
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:smallclothes
				}
				desc = lover.3222.desc_smallclothes
			}
			triggered_desc = {
				trigger = {
					scope:gift_sent = flag:object
				}
				desc = lover.3222.desc_object
			}
		}
	}
	sender = {
		character = scope:lover
		animation = dismissal
	}

	immediate = {
		show_as_tooltip = {
			scope:lover = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = -10
				}
			}
		}
		add_opinion = {
			target = scope:lover
			modifier = respect_opinion
			opinion = -10
		}
	}

	option = {
		name = lover.3222.a
	}
}


#####################################
# Gain potential lover relation
# 7000 - 7999
#####################################

#########################
# Gain potential lover relation with a friend
# 7001-7002
# by Linnéa Thimrén
##########################
scripted_trigger lover_7001_friend_to_potential_lover = {
	is_adult = yes
	NOR = {
		has_relation_lover = root
		is_close_or_extended_family_of = root
	}
	reverse_opinion = {
		target = root
		value >= 30
	}
	OR = {
		AND = {
			is_female = yes
			root = { is_attracted_to_women = yes }
		}
		AND = {
			is_male = yes
			root = { is_attracted_to_men = yes }
		}
	}
}

lover.7001 = {
	type = character_event
	title = lover.7001.t
	desc = lover.7001.desc
	theme = lover_relation
	left_portrait = {
		character = scope:potential_lover
		animation = happiness
	}
	
	trigger = {
		mgr_can_seduce = yes
		any_relation = {
			type = friend
			lover_7001_friend_to_potential_lover = yes
		}
	}

	weight_multiplier = {
		base = 0.1
		modifier = {
			add = 0.5
			num_of_relation_lover = 0
			has_trait = lustful
		}
		modifier = {
			add = 0.5
			any_relation = {
				type = friend
				lover_7001_friend_to_potential_lover = yes
				number_of_personality_traits_in_common = {
					target = root
					value >= 2
				}
			}
		}
		modifier = {
			add = 0.25
			any_relation = {
				type = friend
				lover_7001_friend_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= 40
				}
			}
		}
		modifier = {
			add = 0.25
			any_relation = {
				type = friend
				lover_7001_friend_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= 50
				}
			}
		}
		modifier = {
			add = 2
			any_relation = {
				type = friend
				lover_7001_friend_to_potential_lover = yes
				OR = {
					reverse_has_opinion_modifier = {
						target = root
						modifier = love_opinion
					}
					reverse_has_opinion_modifier = {
						target = root
						modifier = romance_opinion
					}
				}
			}
		}
	}

	immediate = {
		random_relation = {
			type = friend
			limit = {
				lover_7001_friend_to_potential_lover = yes
			}
			save_scope_as = potential_lover
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = { #I might want something more from this relationship
		name = lover.7001.a
		custom_tooltip = lover.7001.a.tt
		save_scope_as = proposing_friend
		scope:potential_lover = {
			trigger_event = lover.7002
		}
		stress_impact = {
			chaste = medium_stress_impact_gain
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				has_trait = lustful
			}
			modifier = {
				add = 100
				OR = {
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = love_opinion
					}
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = romance_opinion
					}
				}
			}
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.25
			}
		}
	}

	option = { #Nah, they're just my friend!
		name = lover.7001.b
		scope:potential_lover = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 10
			}
		}
		stress_impact = {
			lustful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 20
			modifier = {
				add = 100
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 0.5
			}
		}
	}
}

#Response event for friend
lover.7002 = {
	type = character_event
	title = lover.7002.t
	desc = lover.7002.desc
	theme = lover_relation
	left_portrait = {
		character = scope:proposing_friend
		animation = flirtation
	}

	option = { #Aw, I like you too!
		name = lover.7001.a
		custom_tooltip = lover.7001.a.tt
		hidden_effect = {
			if = {
				limit = {
					can_set_relation_potential_lover_trigger = { CHARACTER = scope:proposing_friend }
				}
				set_relation_potential_lover = scope:proposing_friend
			}
		}
	}

	option = { #No.
		name = lover.7001.b
		trigger = { #Only players will be able to say no
			is_ai = no
		}
		scope:proposing_friend = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 10
			}
		}
		custom_tooltip = lover.7001.b.tt
	}
}


#########################
# Gain potential lover relation with rival
# 7003-7004
# by Linnéa Thimrén
##########################
scripted_trigger lover_7003_rival_to_potential_lover = {
	is_adult = yes
	NOR = {
		has_relation_lover = root
		is_close_or_extended_family_of = root
	}
	OR = {
		AND = {
			is_female = yes
			root = { is_attracted_to_women = yes }
		}
		AND = {
			is_male = yes
			root = { is_attracted_to_men = yes }
		}
	}
}

lover.7003 = {
	type = character_event
	title = lover.7003.t
	desc = lover.7003.desc
	theme = lover_relation
	left_portrait = scope:potential_lover
	
	trigger = {
		mgr_can_seduce = yes
		any_relation = {
			type = rival
			lover_7003_rival_to_potential_lover = yes
		}
	}

	weight_multiplier = {
		base = 0.1
		modifier = {
			add = 0.5
			num_of_relation_lover = 0
			has_trait = lustful
		}
		modifier = {
			add = 0.5
			any_relation = {
				type = rival
				lover_7003_rival_to_potential_lover = yes
				number_of_personality_traits_in_common = {
					target = root
					value >= 2
				}
			}
		}
		modifier = {
			add = 0.25
			any_relation = {
				type = rival
				lover_7003_rival_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= -20
				}
			}
		}
		modifier = {
			add = 0.25
			any_relation = {
				type = rival
				lover_7003_rival_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= 0
				}
			}
		}
		modifier = {
			add = 2
			any_relation = {
				type = rival
				lover_7003_rival_to_potential_lover = yes
				OR = {
					reverse_has_opinion_modifier = {
						target = root
						modifier = love_opinion
					}
					reverse_has_opinion_modifier = {
						target = root
						modifier = romance_opinion
					}
				}
			}
		}
	}

	immediate = {
		save_scope_as = proposing_rival
		random_relation = {
			type = rival
			limit = {
				lover_7003_rival_to_potential_lover = yes
			}
			save_scope_as = potential_lover
		}
	}

	option = { #I wonder where this might lead?
		name = lover.7003.a
		custom_tooltip = lover.7003.a.tt
		stress_impact = {
			chaste = medium_stress_impact_gain
		}
		add_character_flag = {
			flag = going_for_potential_lover
			days = 10
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				has_trait = lustful
			}
			modifier = {
				add = 100
				OR = {
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = love_opinion
					}
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = romance_opinion
					}
				}
			}
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.25
			}
		}
	}

	option = { #Nah, they're horrible
		name = lover.7003.b
		add_opinion = {
			target = scope:potential_lover
			modifier = hate_opinion
			opinion = -20
		}
		show_as_tooltip = {
			reverse_add_opinion = {
				target = scope:potential_lover
				modifier = hate_opinion
				opinion = -20
			}
		}
		stress_impact = {
			lustful = minor_stress_impact_gain
		}
		ai_chance = {
			base = 20
			modifier = {
				add = 100
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 0.5
			}
		}
	}
	after = {
		scope:potential_lover = {
			trigger_event = lover.7004
		}
	}
}

#Response event for rival
lover.7004 = {
	type = character_event
	title = lover.7004.t
	desc = {
		desc = lover.7004.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:proposing_rival = {
						has_character_flag = going_for_potential_lover
					}
				}
				desc = lover.7004.desc_potential_lover_is_go
			}
			desc = lover.7004.desc_not
		}
	}
	theme = lover_relation
	left_portrait = {
		character = scope:proposing_rival
		animation = flirtation
	}

	immediate = {
		scope:proposing_rival = {
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
		if = {
			limit = {
				scope:proposing_rival = {
					NOT = { has_character_flag = going_for_potential_lover }
				}
			}
			add_opinion = {
				target = scope:proposing_rival
				modifier = hate_opinion
				opinion = -20
			}
			show_as_tooltip = {
				reverse_add_opinion = {
					target = scope:proposing_rival
					modifier = hate_opinion
					opinion = -20
				}
			}
		}
	}

	option = { #Aw, I like you too!
		name = lover.7004.a
		trigger = {
			scope:proposing_rival = {
				has_character_flag = going_for_potential_lover
			}
		}
		if = {
			limit = {
				can_set_relation_potential_lover_trigger = { CHARACTER = scope:proposing_rival }
			}
			custom_tooltip = lover.7004.a.tt
			hidden_effect = { set_relation_potential_lover = scope:proposing_rival }
		}
		else_if = {
			limit = {
				can_set_relation_lover_trigger = { CHARACTER = scope:proposing_rival }
			}
			set_relation_lover = scope:proposing_rival
		}
		else_if = {
			limit = { has_relation_rival = scope:proposing_rival }
			remove_relation_rival = scope:proposing_rival
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #No.
		name = lover.7004.b
		add_opinion = {
			target = scope:proposing_rival
			modifier = respect_opinion
			opinion = -10
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 100
				scope:proposing_rival = {
					NOT = { has_character_flag = going_for_potential_lover }
				}
			}
		}
	}
}


#########################
# Gain potential lover relation with close family
# 7005-7006
# by Linnéa Thimrén
##########################
scripted_trigger lover_7005_family_to_potential_lover = {
	is_adult = yes
	NOT = { has_relation_lover = root }
	reverse_opinion = {
		target = root
		value >= 30
	}
	opinion = {
		target = root
		value >= 10
	}
	OR = {
		AND = {
			is_female = yes
			root = { is_attracted_to_women = yes }
		}
		AND = {
			is_male = yes
			root = { is_attracted_to_men = yes }
		}
	}
}

lover.7005 = {
	type = character_event
	title = lover.7005.t
	desc = lover.7005.desc
	theme = lover_relation
	left_portrait = scope:potential_lover
	
	trigger = {
		mgr_can_seduce = yes
		any_close_or_extended_family_member = {
			lover_7005_family_to_potential_lover = yes
		}
	}

	weight_multiplier = {
		base = 0.1
		modifier = {
			add = 0.5
			num_of_relation_lover = 0
			has_trait = lustful
		}
		modifier = {
			add = 0.15
			has_trait = arbitrary
		}
		modifier = { #more likely if they're not the same court, but have the same top liege
			add = 0.25
			any_close_or_extended_family_member = {
				lover_7005_family_to_potential_lover = yes
				NOT = { court_owner = root.court_owner }
				top_liege = root.top_liege
			}
		}
		modifier = {
			add = 0.25
			any_close_or_extended_family_member = {
				lover_7005_family_to_potential_lover = yes
				number_of_personality_traits_in_common = {
					target = root
					value >= 2
				}
			}
		}
		modifier = {
			add = 0.2
			any_close_or_extended_family_member = {
				lover_7005_family_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= 40
				}
			}
		}
		modifier = {
			add = 0.2
			any_close_or_extended_family_member = {
				lover_7005_family_to_potential_lover = yes
				reverse_opinion = {
					target = root
					value >= 50
				}
			}
		}
		modifier = {
			add = 0.75
			any_close_or_extended_family_member = {
				lover_7005_family_to_potential_lover = yes
				OR = {
					reverse_has_opinion_modifier = {
						target = root
						modifier = love_opinion
					}
					reverse_has_opinion_modifier = {
						target = root
						modifier = romance_opinion
					}
				}
			}
		}
	}

	immediate = {
		save_scope_as = proposing_family
		random_close_or_extended_family_member = {
			limit = {
				lover_7005_family_to_potential_lover = yes
			}
			save_scope_as = potential_lover
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
		}
	}

	option = { #I wonder where this might lead?
		name = lover.7005.a
		custom_tooltip = lover.7005.a.tt
		stress_impact = {
			chaste = medium_stress_impact_gain
		}
		scope:potential_lover = {
			trigger_event = lover.7006
		}
		ai_chance = {
			base = 0
			modifier = {
				add = 50
				has_trait = lustful
			}
			modifier = {
				add = 100
				OR = {
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = love_opinion
					}
					has_opinion_modifier = {
						target = scope:potential_lover
						modifier = romance_opinion
					}
				}
			}
			ai_value_modifier = {
				ai_greed = 0.5
				ai_boldness = 0.25
			}
		}
	}

	option = { #Nah, they're horrible
		name = lover.7005.b
		stress_impact = {
			base = minor_stress_impact_gain
		}
		ai_chance = {
			base = 20
			modifier = {
				add = 100
				OR = {
					has_trait = chaste
					has_trait = celibate
				}
			}
			ai_value_modifier = {
				ai_rationality = 0.5
				ai_honor = 0.5
			}
		}
	}
}

#Response event for family member
lover.7006 = {
	type = character_event
	title = lover.7006.t
	desc = lover.7006.desc
	theme = lover_relation
	left_portrait = {
		character = scope:proposing_family
		animation = flirtation
	}

	option = { #Aw, I like you too!
		name = lover.7006.a
		custom_tooltip = lover.7006.a.tt
		progress_towards_lover_effect = {
			CHARACTER = scope:proposing_family
			OPINION = no
		}
	}

	option = { #No.
		name = lover.7006.b
		trigger = {
			is_ai = no #only players can say no
		}
	}
}