#Events for scholarship lifestyle rank up

namespace = yearly


#1001	- Someone else's spouse makes a move at you, by Mathilda Bjarnehed
#1010	- Person you care about is abducted by rival, by Mathilda Bjarnehed
#1020	- High-up ruler wants you to deal with pesky enemy, by Mathilda Bjarnehed
#1030	- Someone you have hooked offers up other character's secret, by Mathilda Bjarnehed
#1040	- Courtier is hiding a letter - surprise or secret?, by Mathilda Bjarnehed
#1050	- Heir fancies themselves a duelist, by Mathilda Bjarnehed
#1060	- The oldest joke in the book, by Mathilda Bjarnehed
#1070	- Someone is your potential soulmate, by Mathilda Bjarnehed
#1080	- You are being paranoid, by Mathilda bJarnehed
#1090	- Foreign traveler wishes to stay at your court, by Mathilda Bjarnehed

#Spouse of vassal/rival/liege makes a move at you, how do you respond?
scripted_trigger yearly_1001_married_seducer_trigger = {
	NOR = {
		has_trait = celibate
		has_trait = chaste
	}
	mgr_can_seduce = yes
	is_available_ai_adult = yes
	OR = {
		age <= 65
		has_trait = seducer
		has_trait = lustful
		has_trait = deviant
		has_trait = beauty_good
	}
	OR = {
		NOT = { is_close_or_extended_family_of = root }
		accepts_incest_with_trigger = { CHARACTER = root }
	}
	top_liege = root.top_liege
	NOT = { any_relation = { type = lover this = root } }
	save_temporary_scope_as = married_seducer
	matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:married_seducer }
	might_cheat_on_every_partner_trigger = yes
}


yearly.1001 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1001.t
	desc = {
		desc = yearly.1001.start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						any_relation = { type = rival this = scope:seducer_spouse }
						opinion = {
							target = scope:seducer_spouse
							value < 0
						}
					}
				}
				desc = yearly.1001.end_spiteful.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						opinion = {
							target = scope:seducer_spouse
							value >= high_positive_opinion
						}
						ai_boldness <= 0
						has_trait = chaste
					}
				}
				desc = yearly.1001.end_intimidated.desc
			}
			desc = yearly.1001.end_hesitation.desc
		}
	}
	theme = seduction
	left_portrait = {
		character = scope:married_seducer
		animation = flirtation
	}
	right_portrait = scope:seducer_spouse
	
	trigger = {
		is_adult = yes
		NOT = { has_character_flag = had_event_yearly_1001 }
		OR = {
			AND = {
				exists = liege
				is_independent_ruler = no
				liege = { any_spouse = { yearly_1001_married_seducer_trigger = yes } }
			}
			any_relation = {
				type = rival
				any_spouse = { yearly_1001_married_seducer_trigger = yes }
			}
			any_vassal = {
				is_powerful_vassal = yes
				any_spouse = { yearly_1001_married_seducer_trigger = yes }
			}
			any_close_or_extended_family_member = {
				OR = {
					is_landed = yes
					is_player_heir_of_trigger = { CHARACTER = root }
				}
				any_spouse = { yearly_1001_married_seducer_trigger = yes }
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			OR = {
				has_trait = lustful
				has_trait = chaste
			}
			factor = 1.5
		}
		modifier = {
			has_trait = sadistic
			factor = 0.5
		}
		modifier = {
			attraction >= low_positive_attraction
			factor = 1.2
		}
		modifier = {
			attraction >= medium_positive_attraction
			factor = 1.2
		}
		modifier = {
			attraction >= high_positive_attraction
			factor = 1.2
		}
		modifier = {
			attraction <= low_negative_attraction
			factor = 0.8
		}
		modifier = {
			attraction <= medium_negative_attraction
			factor = 0.7
		}
		modifier = {
			attraction <= high_negative_attraction
			factor = 0.4
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1001
			days = 3650
		}
		if = {
			limit = {
				exists = liege
				is_independent_ruler = no
				liege = { any_spouse = { yearly_1001_married_seducer_trigger = yes } }
			}
			liege = {
				every_spouse = {
					limit = { yearly_1001_married_seducer_trigger = yes }
					add_to_temporary_list = married_seducers
				}
			}
		}
		every_relation = {
			type = rival
			every_spouse = {
				limit = { yearly_1001_married_seducer_trigger = yes }
				add_to_temporary_list = married_seducers
			}
		}
		every_vassal = {
			limit = { is_powerful_vassal = yes }
			every_spouse = {
				limit = { yearly_1001_married_seducer_trigger = yes }
				add_to_temporary_list = married_seducers
			}
		}
		every_close_or_extended_family_member = {
			limit = {
				OR = {
					is_landed = yes
					is_player_heir_of_trigger = { CHARACTER = root }
				}
			}
			every_spouse = {
				limit = { yearly_1001_married_seducer_trigger = yes }
				add_to_temporary_list = married_seducers
			}
		}

		random_in_list = {
			list = married_seducers
			weight = {
				base = 100
				modifier = {
				 	sexually_liberal_trigger = yes
				 	factor = 3
				}
				modifier = {
					any_spouse = { any_relation = { type = rival this = root } }
					factor = 2
				}
				modifier = {
					opinion = {
						target = root
						value <= 0
					}
					NOT = { any_spouse = { any_relation = { type = rival this = root } } }
					factor = 0.1
				}
				modifier = {
					opinion = {
						target = root
						value >= 30
					}
					factor = 2
				}
			}
			save_scope_as = married_seducer
		}

		scope:married_seducer = { random_spouse = { save_scope_as = seducer_spouse } }
	}


	#Give in
	option = {
		name = yearly.1001.a
		custom_tooltip = yearly.1001.a.tt

		hidden_effect = {
			random_list = {
				1 = {
					trigger_event = {
						id = yearly.1002 #It goes well
						days = 1
					}
					had_sex_with_effect = {
						CHARACTER = scope:married_seducer
						PREGNANCY_CHANCE = 80
					}
				}
				2 = {
					trigger = {
				 		scope:seducer_spouse = { 
				 			any_relation = { type = rival this = root } 
				 			basic_is_valid_for_yearly_events_trigger = yes
				 		}
					 	scope:married_seducer = {
					 		opinion = {
					 			target = root
					 			value < 50
					 		}
					 	}
					}
					trigger_event = {
						id = yearly.1003 #It's a trap!
						days = 1
					}
				}
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			chaste = minor_stress_impact_gain
			content = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				add = 300
				OR = {
					has_trait = seducer
					has_trait = lustful
				}
			}
			ai_honor_target_modifier = { VALUE = -100 }
			ai_greed_target_modifier = { VALUE = 50 }
			ai_boldness_target_modifier = { VALUE = 50 }
		}
	}

	#Out them
	option = {
		name = yearly.1001.b
		
		reverse_add_opinion = {
			target = scope:married_seducer
			modifier = hate_opinion
			opinion = -20
		}

		#their spouse is grateful or envious
		if = {
			limit = {
				scope:seducer_spouse = {
					NOR = {
						has_trait = paranoid
						has_trait = arrogant
						has_trait = wrathful
						has_relation_rival = scope:seducer_spouse
					}
				}
			}
			reverse_add_opinion = {
				target = scope:seducer_spouse
				modifier = grateful_opinion
				opinion = 15
			}
		}
		else = {
			reverse_add_opinion = {
				target = scope:seducer_spouse
				modifier = envy_opinion
				opinion = -15
			}
		}

		#Your spouse is happy
		if = {
			limit = {
				exists = primary_spouse
				primary_spouse = {
					is_imprisoned = no
					is_alive = yes
				}
			}
			reverse_add_opinion = {
				target = root.primary_spouse
				modifier = trust_opinion
				opinion = 10
			}
		}

		scope:married_seducer = {
			if = {
				limit = { is_male = yes }
				add_character_modifier = {
					modifier = lecher_modifier
					years = 15
				}
			}
			else = {
				add_character_modifier = {
					modifier = strumpet_modifier
					years = 15
				}
			}
		}

		hidden_effect = {
			scope:seducer_spouse = {
				add_opinion = {
					target = scope:married_seducer
					modifier = suspicion_opinion
					opinion = -20
				}
			}
		}

		stress_impact = {
			lustful = minor_stress_impact_gain
			deviant = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			modifier = {
				add = 300
				has_trait = chaste
			}
			ai_boldness_target_modifier = { VALUE = -50 }
			ai_zeal_target_modifier = { VALUE = 200 }
			ai_honor_target_modifier = { VALUE = 100 }
		}
	}
	
	#Resist
	option = {
		name = yearly.1001.c

		add_piety = minor_piety_gain

		reverse_add_opinion = {
			target = scope:married_seducer
			modifier = disappointed_opinion
			opinion = -10
		}
		
		if = {
			limit = { any_relation = { type = rival this = scope:seducer_spouse } }
			stress_impact = {
				lustful = minor_stress_impact_gain
				deviant = minor_stress_impact_gain
				vengeful = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				lustful = minor_stress_impact_gain
				deviant = minor_stress_impact_gain
			}
		}

		ai_chance = {
			base = 100
			ai_vengefulness_target_modifier = { VALUE = -50 }
			ai_boldness_target_modifier = { VALUE = -50 }
			ai_compassion_target_modifier = { VALUE = 100 }
		}
	}
}

#I gave them a good tumble!
#Note! Also used in casual_sex_or_lover_event_effect, make sure it stays this general so the effect can still be used
yearly.1002 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1001.t
	desc = yearly.1002.desc
	theme = seduction
	left_portrait = {
		character = scope:married_seducer
		animation = flirtation
	}

	trigger = {
		scope:married_seducer = {
			is_alive = yes
		}
	}	

	#Let's do this again...
	option = {
		name = yearly.1002.a

		random_list = {
			50 = { #Success lovers
				modifier = {
					scope:married_seducer.highest_held_title_tier > root.highest_held_title_tier
					add = -30
				}
				opinion_modifier = {
					who = scope:married_seducer
					opinion_target = root
					min = -15
				}
				desc = yearly.1002.a.success
				show_chance = no
				send_interface_toast = {
					left_icon = scope:married_seducer
					title = yearly.1002.a.success
					set_relation_lover = scope:married_seducer
				}
			}
			50 = { #Failure rejected
				opinion_modifier = {
					who = scope:married_seducer
					opinion_target = root
					multiplier = -1
					min = -40
				}
				desc = yearly.1002.a.failure
				show_chance = no
				send_interface_toast = {
					left_icon = scope:married_seducer
					title = yearly.1002.a.failure
					reverse_add_opinion = {
						target = scope:married_seducer
						modifier = disappointed_opinion
						opinion = -10
					}
				}
			}
		}

		ai_chance = {
			base = 50
			ai_compassion_target_modifier = { VALUE = 200 }
		}
	}

	#Thank you for the tumble!
	option = {
		name = yearly.1002.b

		random_list = {
			50 = { #Success casual
				opinion_modifier = {
					who = scope:married_seducer
					opinion_target = root
					multiplier = -1
					min = -40
				}
				modifier = {
					add = {
						value = scope:married_seducer.ai_compassion
						multiply = -0.3
						min = -20
					}
				}
				desc = yearly.1002.b.success
				show_chance = no
				send_interface_toast = {
					left_icon = scope:married_seducer
					title = yearly.1002.b.success
					reverse_add_opinion = {
						target = scope:married_seducer
						modifier = pleased_opinion
						opinion = 15
					}
				}
			}
			50 = { #Success disappointed
				opinion_modifier = {
					who = scope:married_seducer
					opinion_target = root
					min = -40
				}
				desc = yearly.1002.b.failure
				show_chance = no
				send_interface_toast = {
					left_icon = scope:married_seducer
					title = yearly.1002.b.failure
					reverse_add_opinion = {
						target = scope:married_seducer
						modifier = disappointed_opinion
						opinion = -10
					}
				}
			}
		}

		ai_chance = {
			base = 150
		}
	}
}

#It was a trap!
yearly.1003 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1003.t
	desc = {
		desc = yearly.1003.start.desc
		desc = yearly.1003.end.desc
	}
	theme = unfriendly
	left_portrait = {
		character = scope:married_seducer
		animation = flirtation
	}
	right_portrait = {
		character = scope:seducer_spouse
		animation = rage
	}
	
	trigger = {
		scope:seducer_spouse = { 
			basic_is_valid_for_yearly_events_trigger = yes
		}
	}

	option = {
		name = yearly.1003.a

		if = {
			limit = { is_male = yes }
			add_character_modifier = {
				modifier = lecher_modifier
				years = 10
			}
		}
		else = {
			add_character_modifier = {
				modifier = strumpet_modifier
				years = 10
			}
		}

		if = {
			limit = { NOT = { has_trait = arbitrary } }
			add_stress = minor_stress_gain
		}

		hidden_effect = {
			add_opinion = {
				modifier = hate_opinion
				target = scope:married_seducer
				opinion = 30
			}
			add_opinion = {
				modifier = hate_opinion
				target = scope:seducer_spouse
				opinion = 30
			}	
		}
	}
}	

##################################################
# Someone you care about was abducted by rival
# by Mathilda Bjarnehed
##################################################

scripted_trigger yearly_1010_abductee_trigger = {
	basic_is_available_ai = yes
	is_adult = yes
	NOT = { has_trait = wounded_3 }
	OR = {
		is_spouse_of = root
		is_concubine_of = root
		is_child_of = root
		is_sibling_of = root
		is_parent_of = root
		any_relation = { type = lover this = root }
	}
	NOT = { has_relation_rival = root }
}

scripted_trigger yearly_1010_abductor_trigger = {
	save_temporary_scope_as = potential_abductor
	basic_is_available_ai = yes
	is_adult = yes
	NOT = { has_trait = wounded_3 }
	OR = {
		is_landed = yes
		AND = {
			exists = liege
			is_player_heir_of_trigger = { CHARACTER = scope:potential_abductor.liege }
		}
	}
	exists = liege
	NOT = { liege = root }
}

scripted_effect yearly_1010_imprison_target_effect = {
	save_temporary_scope_as = target_prisoner
	
	root = {
		imprison_character_effect = {
			TARGET = scope:target_prisoner
			IMPRISONER = root
		}
	}
}

scripted_effect yearly_1010_kill_target_effect = {
	root = {
		add_character_flag = {
			flag = sent_relevant_death_event #This blocks further death events triggered by death_management.0001
			days = 1
		}
	}
	save_temporary_scope_as = victim
	unknown_murder_effect = { VICTIM = scope:victim MURDERER = root REASON = death_murder }

	if = {
		limit = {
			exists = scope:hunter
			scope:hunter = { is_alive = yes }
		}
		root = {
			custom_tooltip = yearly_1010_kill_target_effect.tt
			random_secret = {
				limit = {
					secret_type = secret_murder
					secret_target = scope:victim
				}
				reveal_to = scope:hunter
			}
		}	
	}	
}

scripted_effect yearly_1010_wound_target_effect = {
	increase_wounds_no_death_effect = {
		REASON = no
	}
}



scripted_effect yearly_1010_kill_hunter_effect = {
	root = {
		add_character_flag = {
			flag = sent_relevant_death_event #This blocks further death events triggered by death_management.0001
			days = 1
		}
	}
	scope:hunter = {
		death = {
			death_reason = death_duel
			killer = scope:abductor
		}
	}
}

scripted_effect yearly_1010_abductee_taken_effect = {
	hidden_effect = {
		scope:abductee = {
			if = {
			  	limit = {
			  		OR = {
			  			AND = {
			  				#Both can marry
			  				can_marry_character_trigger = { CHARACTER = scope:abductor }
			  				scope:abductor = { can_marry_character_trigger = { CHARACTER = scope:abductee } }
			  			}
			  			AND = {
			  				#Abductor could marry if they were single
			  				is_married = no
			  				is_betrothed = no
			  				scope:abductor = { could_marry_character_trigger = { CHARACTER = scope:abductee } }
			  				has_relation_lover = scope:abductor
			  				scope:abductor = { any_spouse = { is_ai = yes } }
			  			}
			  		}
			  	}

			  	if = { #Abductor has a spouse they need to get rid off
			  		limit = { NOT = { scope:abductor = { can_marry_character_trigger = { CHARACTER = scope:abductee } } } }
			  		scope:abductor = {
			  			random_spouse = {
			  				limit = { is_ai = yes }
			  				save_scope_as = dead_spouse
			  			}
			  		}
			  		unknown_murder_effect = { VICTIM = scope:dead_spouse MURDERER = scope:abductor REASON = death_murder }
			  	}

			  	marry = scope:abductor
			}
			else = {
				add_character_flag = {
					flag = block_imprisonment_event
					days = 30
				}
				scope:abductee_imprisoner = {
					imprison = {
						target = scope:abductee
						type = house_arrest
					}
				}
			}
			#Will they escape?
			if = {
				limit = {
					is_imprisoned = yes
				}
				random = {
					chance = 40
					modifier = {
						has_relation_lover = scope:abductor
						add = 40
					}
					root = {
						trigger_event = {
							id = yearly.1015
							days = { 60 150 }
						}
					}
				}
			}
		}
	}
}

scripted_effect yearly_1010_outcome_effect = {
	scope:abductor = {
		if = {
			limit = {
				has_character_flag = yearly_1010_wound
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_wound_target_effect = yes
		}
		else_if = {
			limit = {
				has_character_flag = yearly_1010_kill
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_kill_target_effect = yes
		}
		else_if = {
			limit = {
				has_character_flag = yearly_1010_imprison
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_imprison_target_effect = yes
		}
		else = {
			custom_tooltip = yearly_1010_outcome_effect_escape.tt
		}
		if = {
			limit = {
				is_alive = yes
			}
			remove_character_flag = yearly_1010_abductor
		}
	}
	scope:abductee = {
		if = {
			limit = {
				NOR = {
					has_character_flag = yearly_1010_save	
					has_character_flag = yearly_1010_imprison
					has_character_flag = yearly_1010_kill
				}
			}
			yearly_1010_abductee_taken_effect = yes
		}

		if = {
			limit = {
				has_character_flag = yearly_1010_wound
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_wound_target_effect = yes
		}
		else_if = {
			limit = {
				has_character_flag = yearly_1010_kill
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_kill_target_effect = yes
		}
		else_if = {
			limit = {
				has_character_flag = yearly_1010_imprison
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			yearly_1010_imprison_target_effect = yes
		}
		else_if = {
			limit = {
				has_character_flag = yearly_1010_save
				NOT = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			}
			custom_tooltip = yearly_1010_outcome_effect_abductee_save.tt
		}
		else_if = {
			limit = { has_character_flag = yearly_1010_lose }
			custom_tooltip = yearly_1010_outcome_effect_abductee_lost.tt
		}
		else = {
			custom_tooltip = yearly_1010_outcome_effect_escape.tt
		}
		if = {
			limit = {
				is_alive = yes
			}
			remove_character_flag = yearly_1010_abducted
		}
	}
}

scripted_effect yearly_1010_imprison_random_list_effect = {
	
	random_list = {
		20 = { #Success: target imprisoned
			desc = yearly_1010.target_imprison.desc
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = 3
				}
			}
			modifier = {
				scope:hunter = { has_trait = hunter_1 }
				add = 10
			}
			modifier = {
				scope:hunter = { has_trait = hunter_2 }
				add = 15
			}
			modifier = {
				scope:hunter = { has_trait = hunter_3 }
				add = 30
			}
			show_as_tooltip = {
				yearly_1010_imprison_target_effect = yes
			}
			add_character_flag = {
				flag = yearly_1010_imprison
				days = 100
			}
		}
		65 = { #Failure: target wounded
			desc = yearly_1010.target_wounded.desc
			show_as_tooltip = {
				yearly_1010_wound_target_effect = yes
			}
			if = { #Abductee can't escape on their own
				limit = {
					scope:abductor = {
						OR = {
							has_character_flag = yearly_1010_kill
							has_character_flag = yearly_1010_imprison
						}
					}
				}
				add_character_flag = {
					flag = yearly_1010_imprison
					days = 100
				}
			}
			else = {
				add_character_flag = {
					flag = yearly_1010_wound
					days = 100
				}
			}
		}
		15 = { #Failure: hunter killed
			desc = yearly_1010.hunter_killed.desc
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = -1.5
					min = -10
				}
			}
			show_as_tooltip = {
				yearly_1010_kill_hunter_effect = yes
			}
			scope:hunter = {
				add_character_flag = {
					flag = yearly_1010_kill
					days = 100
				}
			}
		}
	}
}


scripted_effect yearly_1010_kill_random_list_effect = {
	random_list = {
		40 = { #Success: target killed
			desc = yearly_1010.target_killed.desc
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = 6
				}
			}
			modifier = {
				scope:hunter = { has_trait = hunter_1 }
				add = 10
			}
			modifier = {
				scope:hunter = { has_trait = hunter_2 }
				add = 20
			}
			modifier = {
				scope:hunter = { has_trait = hunter_3 }
				add = 40
			}
			show_as_tooltip = {
				yearly_1010_kill_target_effect = yes
			}
			add_character_flag = {
				flag = yearly_1010_kill
				days = 100
			}	
		}
		30 = { #Failure: target wounded
			desc = yearly_1010.target_wounded.desc
			modifier = {
				scope:hunter = {
					NOT = { has_trait = lifestyle_hunter }
					martial >= decent_skill_rating
				}
				factor = 1.15
			}
			modifier = {
				scope:hunter = {
					NOT = { has_trait = lifestyle_hunter }
					martial >= high_skill_rating
				}
				factor = 1.15 #Stacks to ~1.3
			}
			modifier = {
				scope:hunter = { has_trait = lifestyle_hunter }
				factor = 1.5
			}
			show_as_tooltip = {
				yearly_1010_wound_target_effect = yes
			}
			if = { #Abductee can't escape on their own
				limit = {
					scope:abductor = {
						OR = {
							has_character_flag = yearly_1010_kill
							has_character_flag = yearly_1010_imprison
						}
					}
				}
				add_character_flag = {
					flag = yearly_1010_kill
					days = 100
				}
				
			}
			else = {
				add_character_flag = {
					flag = yearly_1010_wound
					days = 100
				}
			}
		}
		10 = { #Failure: hunter killed
			desc = yearly_1010.hunter_killed.desc
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = -1
					min = -5
				}
			}
			show_as_tooltip = {
				yearly_1010_kill_hunter_effect = yes
			}
			scope:hunter = {
				add_character_flag = {
					flag = yearly_1010_kill
					days = 100
				}
			}
		}
	}
}

scripted_effect yearly_1010_save_abductee_random_list_effect = {
	random_list = {
		60 = { #Success: Abductee saved
			desc = yearly_1010.abductee_saved.desc
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = 3
				}
			}
			modifier = {
				scope:hunter = { has_trait = hunter_1 }
				add = 10
			}
			modifier = {
				scope:hunter = { has_trait = hunter_2 }
				add = 20
			}
			modifier = {
				scope:hunter = { has_trait = hunter_3 }
				add = 40
			}
			custom_tooltip = yearly_1010_save_abductee_random_list_effect.success.tt
			scope:abductee = {
				add_character_flag = {
					flag = yearly_1010_save
					days = 100
				}
			}
		}
		40 = {
			modifier = {
				add = {
					value = scope:hunter.martial
					subtract = average_skill_rating
					multiply = -2
					min = 10
				}
			}
			desc = yearly_1010.abductee_lost.desc
			custom_tooltip = yearly_1010_save_abductee_random_list_effect.failure.tt
			scope:abductee = {
				add_character_flag = {
					flag = yearly_1010_lose
					days = 365
				}
			}
		}
	}
}

scripted_effect yearly_1010_flag_clearing_effect = {
	if = {
		limit = { is_alive = yes }
		remove_character_flag = yearly_1010_imprison
		remove_character_flag = yearly_1010_kill
		remove_character_flag = yearly_1010_save
		#remove_character_flag = yearly_1010_lose This one should be kept for the sake of yearly_1015
		remove_character_flag = yearly_1010_wound
	}
}


#First event
yearly.1010 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1010.t
	desc = {
		desc = yearly.1010.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { any_relation = { type = friend this = scope:hunter } }
				desc = yearly.1010.friend.desc
			}
			desc = yearly.1010.marshal.desc
		}
		desc = yearly.1010.end.desc
	}
	theme = intrigue
	left_portrait = scope:hunter
	right_portrait = scope:abductor
	lower_left_portrait = scope:abductee
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1010 }
		any_relation = {
			type = rival
			yearly_1010_abductor_trigger = yes
		}
		any_courtier = { yearly_1010_abductee_trigger = yes }
		exists = cp:councillor_marshal
		cp:councillor_marshal = {
			is_available_ai = yes
			NOT = { has_trait = wounded_3 }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			any_courtier = {
				yearly_1010_abductee_trigger = yes
				any_relation = { type = lover any_relation = { type = rival this = root } }
			}
			factor = 1.3
		}
		modifier = {
			NOT = { any_relation = { type = nemesis yearly_1010_abductee_trigger = yes } }
			factor = 0.3
		}
		nemesis_event_weight_modifier = yes
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1010
			days = 3650
		}
		save_scope_as = 1010_root

		#Save abductor
		random_relation = {
			type = rival
			limit = {
				yearly_1010_abductor_trigger = yes
			}
			weight = {
				modifier = {
					has_relation_nemesis = root
					factor = 100
				}
			}
			save_scope_as = abductor
		}

		#Save abductor liege
		scope:abductor = {
			add_character_flag = {
				flag = yearly_1010_abductor
				days = 30
			}
			if = {
				limit = { is_landed = yes }
				save_scope_as = abductee_imprisoner
			}
			else = {
				liege = { save_scope_as = abductee_imprisoner }
			}
		}

		#Save abductee
		random_courtier = {
			limit = {
				yearly_1010_abductee_trigger = yes
			}
			weight = {
				modifier = {
					can_marry_character_trigger = { CHARACTER = scope:abductor }
					factor = 3
				}
				modifier = {
					is_attracted_to_gender_of = scope:abductor
					factor = 2
				}
				modifier = {
					any_relation = { type = lover this = scope:abductor }
					factor = 10
				}
				modifier = {
					is_player_heir_of_trigger = { CHARACTER = root }
					factor = 0.1
				}
			}
			save_scope_as = abductee
			add_character_flag = {
				flag = yearly_1010_abducted
				days = 30
			}
		}

		#Did abductee leave willingly or abducted?
		hidden_effect = {
			scope:abductee = {
				random_list = {
					1 = { #Willingly
						trigger = {
							NOT = { has_trait = honest }
							opinion = {
								target = scope:abductor
								value >= -30
							}
						}
						modifier = {
							is_attracted_to_gender_of = scope:abductor
							scope:abductor = { attraction >= low_positive_attraction }
							factor = 1.5
						}
						modifier = {
							is_attracted_to_gender_of = scope:abductor
							scope:abductor = { attraction >= medium_positive_attraction }
							factor = 1.5
						}
						modifier = {
							has_trait = trusting
							factor = 2
						}
						modifier = {
							opinion = {
								target = scope:abductor
								value >= 30
							}
							factor = 1.5
						}

						#Set lover or friendship, if it doesn't already exist
						if = {
							limit = {
								scope:abductor = {
									can_set_relation_lover_trigger = { CHARACTER = scope:abductee }
								}
							}
							set_relation_lover = scope:abductor

							add_opinion = {
								target = scope:abductor
								modifier = romance_opinion
								opinion = 60
							}
						}
						else_if = {
							limit = {
								scope:abductor = {
									can_set_relation_friend_trigger = { CHARACTER = scope:abductee }
								}
							}

							add_opinion = {
								target = scope:abductor
								modifier = friendliness_opinion
								opinion = 60
							}
						}

						if = {
							limit = { has_relation_lover = scope:abductor }
							had_sex_with_effect = { CHARACTER = scope:abductor PREGNANCY_CHANCE = pregnancy_chance }
						}
					}
					5 = { #Abducted
						trigger = { NOT = { any_relation = { type = lover this = scope:abductor } } }
						modifier = {
							is_attracted_to_gender_of = scope:abductor
							is_married = yes
							factor = 1.5
						}

						add_opinion = {
							target = scope:abductor
							modifier = hate_opinion
							opinion = -40
						}
						if = {
							limit = { NOT = { has_relation_rival = scope:abductor } }
							random = {
								chance = 25
								set_relation_rival = scope:abductor
							}
						}
					}
				}
			}
			play_music_cue = "mx_cue_negative"
		}

		custom_tooltip = yearly.1010.abduction.tt

		#Save hunter
		cp:councillor_marshal = { save_scope_as = hunter }
		random_relation = { type = friend #Is the friend a better hunter?
			limit = {
				is_available_ai = yes
				NOT = { has_trait = wounded_3 }
				OR = {
					AND = {
						NOR = {
							has_trait = lifestyle_hunter
							scope:hunter = { has_trait = lifestyle_hunter }
						}
						martial >= scope:hunter.martial
					}
					has_trait_rank = {
						trait = lifestyle_hunter
						character >= scope:hunter
					}
				}
			}
			weight = {
				modifier = {
					has_relation_best_friend = root
					factor = 100
				}
			}
			save_scope_as = hunter
			custom_tooltip = yearly.1010.friend.tt
		}

		add_opinion = {
			target = scope:abductor
			modifier = abductor_opinion
		}

		#Save soldier (only for loc)
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender }
	}

	#Imprison
	option = {
		name = yearly.1010.a
		custom_tooltip = yearly.1010.a.tt

		scope:abductor = { yearly_1010_imprison_random_list_effect = yes }

		trigger_event = yearly.1011

		stress_impact = {
			vengeful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_negative_ai_value #max -50
				ai_vengefulness = low_chance_impact_positive_ai_value #max 100
				ai_boldness = tiny_chance_impact_positive_ai_value #nax 50
			}
		}
	}

	#Kill
	option = {
		name = yearly.1010.b
		custom_tooltip = yearly.1010.a.tt

		scope:abductor = { yearly_1010_kill_random_list_effect = yes }

		trigger_event = yearly.1011

		stress_impact = {
			compassionate = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			just = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = medium_chance_impact_negative_ai_value #max -200
				ai_vengefulness = low_chance_impact_positive_ai_value #max 100
				ai_boldness = tiny_chance_impact_positive_ai_value #nax 50
			}
		}
	}
	
	#Just save abductee
	option = {
		name = yearly.1010.c

		yearly_1010_save_abductee_random_list_effect = yes

		trigger_event = {
			id = yearly.1012
			days = { 7 14 }
		}

		stress_impact = {
			just = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			sadistic = minor_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}

		ai_chance = {
			base = 75
			ai_value_modifier = {
				ai_compassion = tiny_chance_impact_positive_ai_value #max 50
			}
		}
	}

	#Let them go
	option = {
		name = yearly.1010.d
		add_prestige = medium_prestige_loss

		custom_tooltip = yearly_1010_outcome_effect_abductee_lost.tt
		hidden_effect = {
			yearly_1010_abductee_taken_effect = yes
		}

		stress_impact = {
			just = medium_stress_impact_gain
			vengeful = major_stress_impact_gain
			sadistic = minor_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}


		ai_chance = {
			base = 10
			modifier = {
				has_trait = arbitrary
				add = 50
			}
		}
	}
}

#What about the abductee?
yearly.1011 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1010.t
	desc = yearly.1011.desc
	theme = intrigue
	left_portrait = scope:hunter
	right_portrait = scope:abductor
	lower_left_portrait = scope:abductee
	
	#Save them!
	option = {
		name = yearly.1011.a

		yearly_1010_save_abductee_random_list_effect = yes

		trigger_event = {
			id = yearly.1012
			days = { 7 14 }
		}

		stress_impact = {
			paranoid = medium_stress_impact_gain
		}

		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_compassion = medium_chance_impact_positive_ai_value #max 200
			}
		}
	}

	#Imprison them
	option = {
		name = yearly.1011.b

		scope:abductee = { yearly_1010_imprison_random_list_effect = yes }

		trigger_event = {
			id = yearly.1012
			days = { 7 14 }
		}

		stress_impact = {
			compassionate = major_stress_impact_gain
			just = major_stress_impact_gain
			trusting = major_stress_impact_gain
			forgiving = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}

		ai_chance = {
			base = 30
			ai_value_modifier = {
				ai_compassion = low_chance_impact_negative_ai_value #max -100
				ai_vengefulness = tiny_chance_impact_positive_ai_value #max 50
			}
			modifier = {
				add = 100
				has_trait = paranoid
			}
		}
	}
	
	#Kill them
	option = {
		name = yearly.1011.c

		scope:abductee = { yearly_1010_kill_random_list_effect = yes }

		trigger_event = {
			id = yearly.1012
			days = { 7 14 }
		}

		stress_impact = {
			compassionate = massive_stress_impact_gain
			just = massive_stress_impact_gain
			trusting = massive_stress_impact_gain
			forgiving = medium_stress_impact_gain
			content = medium_stress_impact_gain
		}

		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_compassion = medium_chance_impact_negative_ai_value #max -200
				ai_vengefulness = tiny_chance_impact_positive_ai_value #max 50
			}
			modifier = {
				add = 100
				has_trait = paranoid
			}
		}
	}
}

#Logic, what happened (good or bad)
yearly.1012 = {
	hidden = yes

	trigger = {
		scope:hunter = { is_alive = yes }
		scope:abductor = { is_alive = yes }
		scope:abductee = { is_alive = yes }
	}

	on_trigger_fail = {
		scope:abductor = { yearly_1010_flag_clearing_effect = yes }
		scope:abductee = { yearly_1010_flag_clearing_effect = yes }
		scope:hunter = { yearly_1010_flag_clearing_effect = yes }
	}	

	immediate = {
		#If the hunter is killed by abductor, nothing happens to abductee and they are lost: bad
		if = {
			limit = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			trigger_event = yearly.1013 #Bad
		}
		#If the abductor is killed/imprisoned, lost is turned into save: good
		else_if = {
			limit = {
				scope:abductor = {
					OR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
				scope:abductee = {
					OR = {
						has_character_flag = yearly_1010_save
						has_character_flag = yearly_1010_lose
					}
				}
			}
			trigger_event = yearly.1014 #Good
		}
		#If the abductor gets away and person is saved: good
		else_if = {
			limit = {
				scope:abductor = {
					NOR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
				scope:abductee = {
					has_character_flag = yearly_1010_save
				}
			}
			trigger_event = yearly.1014 #Good
		}
		#Both abductee and abductor is imprisoned/killed: good
		else_if = {
			limit = {
				scope:abductee = {
					OR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
				scope:abductor = {
					OR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
			}
			trigger_event = yearly.1014 #Good	
		}
		#If the abductor gets away and person is lost: bad
		else_if = {
			limit = {
				scope:abductor = {
					NOR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
				scope:abductee = {
					has_character_flag = yearly_1010_lose
				}
			}
			trigger_event = yearly.1013 #bad
		}
		#If the abductee is killed/imprisoned but the abductor get away: bad
		else_if = {
			limit = {
				scope:abductee = {
					OR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
				scope:abductor = {
					NOR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
			}
			trigger_event = yearly.1013 #Bad	
		}
		else = { }
	}
}

#The outcome was bad...
yearly.1013 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1010.t
	desc = {
		desc = yearly.1013.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:hunter = { is_alive = yes } }
				desc = yearly.1013.hunter_alive_start.desc
			}
			desc = yearly.1013.hunter_dead_start.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:hunter = { is_alive = no }
					scope:abductee = {
						OR = {
							has_character_flag = yearly_1010_save
							has_character_flag = yearly_1010_lose
						}
					}
				}
				desc = yearly.1013.hunter_dead_abductee_lost.desc
			}
			triggered_desc = {
				trigger = {
					scope:hunter = { is_alive = no }
				}
				desc = yearly.1013.hunter_dead_both_escaped.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { has_character_flag = yearly_1010_lose }
				}
				desc = yearly.1013.abductee_lost.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { is_alive = no }
				}
				desc = yearly.1013.abductor_escaped_abductee_killed.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { has_character_flag = yearly_1010_imprison }
				}
				desc = yearly.1013.abductor_escaped_abductee_imprisoned.desc
			}
		}
	}
	theme = intrigue
	left_portrait = {
		character = scope:hunter
		triggered_animation = {
			trigger = { is_alive = yes }
			animation = sadness
		}
	}
	right_portrait = scope:abductor
	lower_left_portrait = scope:abductee

	immediate = {
		#If hunter died
		if = {
			limit = { scope:hunter = { has_character_flag = yearly_1010_kill } }
			yearly_1010_kill_hunter_effect = yes

			scope:abductor = {
				remove_character_flag = yearly_1010_kill
				remove_character_flag = yearly_1010_imprison
			}
			scope:abductee = {
				remove_character_flag = yearly_1010_kill
				remove_character_flag = yearly_1010_imprison

				if = {
					limit = { has_character_flag = yearly_1010_save }
					remove_character_flag = yearly_1010_save
					add_character_flag = {
						flag = yearly_1010_lose
						days = 100
					}
				}
			}
		}

		yearly_1010_outcome_effect = yes
	}

	#If the hunter is killed by abductor, nothing happens to abductee and they are lost: bad
	#If the abductor gets away and person is lost: bad
	#If the abductee is killed/imprisoned but the abductor get away: bad
	option = {
		name = {	
			trigger = { scope:abductee = { has_character_flag = yearly_1010_imprison } }
			text = yearly.1013.a1
		}
		name = {	
			trigger = {
				scope:abductee = { has_character_flag = yearly_1010_save }
				scope:abductor = { is_alive = yes }
			}
			text = yearly.1013.a2
		}
		name = {
			trigger = {
				NOR = {
					scope:abductee = { has_character_flag = yearly_1010_imprison }
					AND = {
						scope:abductee = { has_character_flag = yearly_1010_save }
						scope:abductor = { is_alive = yes }
					}
				}
			}
			text = yearly.1013.a3
		}
	}

	after = {
		scope:abductor = { yearly_1010_flag_clearing_effect = yes }
		scope:abductee = { yearly_1010_flag_clearing_effect = yes }
		scope:hunter = { yearly_1010_flag_clearing_effect = yes }
	}
}	


#The outcome was good!
yearly.1014 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1014.t
	desc = {
		desc = yearly.1013.start.desc
		desc = yearly.1014.safe_hunter_start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:abductor = { is_alive = no }
					scope:abductee = { has_character_flag = yearly_1010_save }
				}
				desc = yearly.1014.abductee_saved_abductor_killed.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductor = { has_character_flag = yearly_1010_imprison }
					scope:abductee = { has_character_flag = yearly_1010_save }
				}
				desc = yearly.1014.abductee_saved_abductor_imprisoned.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { has_character_flag = yearly_1010_save }
				}
				desc = yearly.1014.abductee_saved_abductor_escaped.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductor = { is_alive = no }
					scope:abductee = { is_alive = no }
				}
				desc = yearly.1014.both_killed.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductor = { has_character_flag = yearly_1010_imprison }
					scope:abductee = { has_character_flag = yearly_1010_imprison }
				}			
				desc = yearly.1014.both_imprisoned.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { is_alive = no }
					scope:abductor = { has_character_flag = yearly_1010_imprison }
				}
				desc = yearly.1014.abductee_killed_abductor_imprison.desc
			}
			triggered_desc = {
				trigger = {
					scope:abductee = { has_character_flag = yearly_1010_imprison }
					scope:abductor = { is_alive = no }
				}
				desc = yearly.1014.abductee_imprisoneid_abductor_killed.desc
			}
		}
	}
	theme = intrigue
	left_portrait = {
		character = scope:hunter
		animation = happiness
	}
	right_portrait = {
		character = scope:abductor
		triggered_animation = {
			trigger = { scope:abductor = { has_character_flag = yearly_1010_imprison } }
			animation = shame
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = idle
		}
	}
	lower_left_portrait = {
		character = scope:abductee
		triggered_animation = {
			trigger = { scope:abductee = { has_character_flag = yearly_1010_imprison } }
			animation = shame
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = idle
		}
	}
	
	immediate = {
		if = {
			limit = {
				scope:abductor = {
					OR = {
						has_character_flag = yearly_1010_kill
						has_character_flag = yearly_1010_imprison
					}
				}
			}
			scope:abductee = {
				if = {
					limit = { has_character_flag = yearly_1010_lose }
					remove_character_flag = yearly_1010_lose
					add_character_flag = {
						flag = yearly_1010_save
						days = 100
					}
				}
			}	
		}
		yearly_1010_outcome_effect = yes
	}

	#If the abductor is killed/imprisoned, lost is turned into save: good
	#If the abductor gets away and person is saved: good
	#Both abductee and abductor is imprisoned/killed: good
	option = {
		name = yearly.1014.a
		
	}

	after = {
		scope:abductor = { yearly_1010_flag_clearing_effect = yes }
		scope:abductee = { yearly_1010_flag_clearing_effect = yes }
		scope:hunter = { yearly_1010_flag_clearing_effect = yes }
	}
}


#They came back
yearly.1015 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1015.t
	desc = {
		desc = yearly.1015.start.desc
		random_valid = {
			first_valid = {
				triggered_desc = {
					trigger = { scope:abductee_desc = flag:escaped }
					desc = yearly.1015.escaped.desc
				}
				triggered_desc = {
					trigger = { scope:abductee_desc = flag:released }
					desc = yearly.1015.released.desc
				}
			}
		}
	}
	theme = intrigue
	left_portrait = scope:abductee
	right_portrait = scope:abductor
	
	trigger = {
		scope:abductor = {
			is_alive = yes
		}
		scope:abductee = {
			is_alive = yes
			has_character_flag = yearly_1010_lose
			is_imprisoned = yes
			imprisoner = {
				OR = {
					this = scope:abductor
					this = scope:abductor.liege
				}
			}
		}
	}

	immediate = {
		scope:abductee = {
			custom_tooltip = yearly.1015.immediate.tt
			
			hidden_effect = {
				add_character_flag = {
					flag = block_release_from_prison_event
					days = 30
				}
				release_from_prison = yes
				remove_character_flag = yearly_1010_lose

				#Did they really escape / was released, or are they in alliance with / made a deal with abductor?
				random_list = {
					100 = { #Escape/release
						modifier = {
							has_relation_lover = scope:abductor #Always alliance/made deal
							add = -500
						}
						opinion_modifier = {
							opinion_target = root
							multiplier = 1
						}
						opinion_modifier = {
							opinion_target = scope:abductor
							multiplier = -1
						}
					}
					100 = { #Alliance/made deal
						opinion_modifier = {
							opinion_target = root
							multiplier = -1
						}
						opinion_modifier = {
							opinion_target = scope:abductor
							multiplier = 1
						}
						if = {
							limit = {
								scope:abductor = {
									can_add_hook = {
										target = scope:abductee
										type = manipulation_hook
									}
								}
							}
							scope:abductor = {
								add_hook = {
									target = scope:abductee
									type = manipulation_hook
								}
							}
						}
					}
				}

				#sets desc
				random_list = {
					100 = { #Escaped desc						
						ai_value_modifier = {
							ai_boldness = medium_chance_impact_positive_ai_value #Up to 200 for high boldness, -200 for high negative boldness
						}
						modifier = {
							OR = {
								has_trait = craven
								has_trait = incapable
								intrigue <= low_skill_rating
							}
							add = -100
						}
						modifier = {
							scope:abductor = { has_hook = scope:abductee }
							add = 100
						}
						save_scope_value_as = {
							name = abductee_desc
							value = flag:escaped
						}
					}
					100 = { #Release desc
						modifier = {
							intrigue >= high_skill_rating
							add = -75
						}
						save_scope_value_as = {
							name = abductee_desc
							value = flag:released
						}
					}
				}
			}
		}
	}

	option = {
		name = {
			trigger = {
				OR = {
					has_trait = trusting
					has_trait = compassionate
				}
			}
			text = yearly.1015.a.trusting
		}
		name = {
			trigger = { has_trait = paranoid }
			text = yearly.1015.a.paranoid
		}	
		name = {
			trigger = {
				NOR = {
					has_trait = trusting
					has_trait = paranoid
					has_trait = compassionate
				}
			}
			text = yearly.1015.a
		}

		stress_impact = {
			paranoid = minor_stress_impact_gain
		}
	}
}

########################################################
# High-up ruler wants you to deal with pesky enemy
# by Mathilda Bjarnehed
########################################################

scripted_trigger yearly_1020_vip_enemy_trigger = {
	basic_is_available_ai = yes
	is_adult = yes
	NOR = {
		is_at_war_with = root
		this = root
	}
}

scripted_trigger yearly_1020_vip_trigger = {
	basic_is_available_ai = yes
	is_adult = yes
	NOR = {
		this = root
		is_at_war_with = root
		has_relation_rival = root
	}
	highest_held_title_tier >= root.highest_held_title_tier
	OR = {
		short_term_gold >= major_gold_value
		root = { is_ai = no } #For a player the AI can be stupid
	}
	OR = {
		any_relation = { type = rival
			yearly_1020_vip_enemy_trigger = yes
		}
		any_vassal = {
			yearly_1020_vip_enemy_trigger = yes
		}
	}
}

yearly.1020 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = {
		desc = yearly.1020.opening
	}
	desc = yearly.1020.desc
	sender = scope:vip
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1020 }
		OR = { # Expensive, so we restrict the AI use of this
			is_ai = no
			highest_held_title_tier >= tier_duchy
		}
		OR = {
			top_liege = { yearly_1020_vip_trigger = yes }
			top_liege = { any_vassal = { yearly_1020_vip_trigger = yes } }
			any_neighboring_top_liege_realm_owner = { yearly_1020_vip_trigger = yes }
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			highest_held_title_tier = tier_county
			factor = 1.8
		}
		modifier = {
			highest_held_title_tier = tier_duchy
			factor = 1.4
		}
		modifier = {
			highest_held_title_tier = tier_kingdom
			factor = 1
		}
		modifier = {
			highest_held_title_tier = tier_empire
			factor = 0.5
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1020
			days = 3650
		}
		#Add all vip (the high-up requesting your help) options to a list
		top_liege = {
			if = {
				limit = { yearly_1020_vip_trigger = yes }
				add_to_list = vip_options
			}
			every_vassal = {
				limit = { yearly_1020_vip_trigger = yes }
				add_to_list = vip_options
			}
		}
		every_neighboring_top_liege_realm_owner = {
			limit = { yearly_1020_vip_trigger = yes }
			add_to_list = vip_options
		}

		#Randomize a vip
		random_in_list = {
			list = vip_options
			weight = {
				modifier = {
					OR = {
						is_independent_ruler = yes
						any_vassal = { this = root }
					}
					factor = 10
				}
				modifier = {
					highest_held_title_tier = tier_kingdom
					factor = 3
				}
				modifier = {
					highest_held_title_tier = tier_empire
					factor = 5
				}
				modifier = {
					ai_compassion < 0
					factor = 1.3
				}
				modifier = {
					ai_vengefulness > 0
					factor = 1.3
				}
			}
			save_scope_as = vip
		}

		#Add all possible enemies of vip to a list
		scope:vip = {
			every_relation = {
				type = rival
				limit = {
					yearly_1020_vip_enemy_trigger = yes
				}
				add_to_list = enemy_options
			}
			every_vassal = {
				limit = {
					yearly_1020_vip_enemy_trigger = yes
					is_powerful_vassal = yes
					OR = {
						has_trait = ambitious
						has_trait = deceitful
						AND = {
							has_trait = craven
							scope:vip = { has_trait = brave }
						}
						opinion = {
							target = scope:vip
							value < 0
						}
					}
				}
				alternative_limit = {
					yearly_1020_vip_enemy_trigger = yes
				}
				add_to_list = enemy_options
			}
			every_parent = {
				limit = {
					is_landed = yes
					exists = player_heir
					player_heir = {
						yearly_1020_vip_enemy_trigger = yes
						is_available_ai = yes
						NOT = { this = scope:vip }
						reverse_opinion = {
							target = scope:vip
							value < 30
						}
					}
				}
				player_heir = {
					add_to_list = enemy_options
				}
			}
		}

		#Randomize an enemy
		random_in_list = {
			list = enemy_options
			limit = {
				exists = this
			}

			weight = {
				base = 1
				modifier = {
					OR = {
						is_landed = yes
						AND = {
							exists = liege.player_heir
							save_temporary_scope_as = enemy_option
							liege.player_heir = scope:enemy_option
						}
					}
					factor = 10
				}
				modifier = {
					is_close_or_extended_family_of = root
					factor = 0.2
				}
			}
			save_scope_as = enemy
		}

		#Enemy back up
		if = {
			limit = { NOT = { exists = scope:enemy } }
			scope:vip = {
				random_vassal = {
					limit = { is_available_ai = yes }
					save_scope_as = enemy
				}
			}
		}

		#Place names
		random_held_title = {
			limit = { tier = tier_county }
			save_scope_as = my_county
		}
	}

	#Yes, I will catch them for VIP
	option = {
		name = yearly.1020.a

		scope:vip = {
			pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
		}

		random_list = {
			desc = yearly.1020.a.rl.t
			55 = { #You capture them
				desc = yearly.1020.a.capture.desc
				send_interface_toast = {
					title = yearly.1020.a.capture.desc
					left_icon = scope:enemy
					right_icon = scope:vip
					imprison = {
						target = scope:enemy
						type = dungeon
					}
					reverse_add_opinion = {
						target = scope:enemy
						modifier = angry_opinion
						opinion = -35
					}
					show_as_tooltip = {
						scope:vip = {
							pay_short_term_gold = {
								target = root
								gold = major_gold_value
							}
						}
					}
				}
				hidden_effect = {
					trigger_event = {
						id = yearly.1021
						days = 14
					}
				}
			}
			30 = { #They get away
				desc = yearly.1020.a.escape.desc
				send_interface_toast = {
					title = yearly.1020.a.escape.desc
					left_icon = scope:enemy
					reverse_add_opinion = {
						target = scope:enemy
						modifier = angry_opinion
						opinion = -25
					}
				}
			}
			15 = { #You kill them
				desc = yearly.1020.a.kill.desc
				send_interface_toast = {
					title = yearly.1020.a.kill.desc
					left_icon = scope:enemy
					unknown_murder_effect = { VICTIM = scope:enemy MURDERER = root REASON = death_murder }
				}
			}
		}


		stress_impact = {
			just = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			craven = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = low_chance_impact_positive_ai_value #Max +100
				ai_greed = medium_chance_impact_positive_ai_value #Max +200
			}
		}
	}

	#Agree, but warn the enemy in secret
	option = {
		name = yearly.1020.b

		scope:vip = {
			pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
		}

		show_as_tooltip = {
			reverse_add_opinion = {
				target = scope:enemy
				modifier = grateful_opinion
				opinion = 15
			}
			if = {
				limit = {
					can_add_hook = {
						type = indebted_hook
						target = scope:enemy
					}
				}
				add_hook = {
					type = indebted_hook
					target = scope:enemy
				}
			}
		}
		hidden_effect = {
			trigger_event = {
				id = yearly.1022
				days = 7
			}
		}

		duel = {
			desc = yearly.1020.a.rl.t
			skill = intrigue
			target = scope:vip
			60 = {
				desc = yearly.1020.b.success.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = high_positive_duel_skill_multiplier #+75 when extremely skilled meets avarage
				}
				custom_tooltip = yearly.1020.b.success.tt
				add_character_flag = {
					flag = yearly_1020_b_success_flag
					days = 30
				}
			}
			40 = {
				desc = yearly.1020.b.failure.desc
				compare_modifier = {
					value = scope:duel_value
					multiplier = low_negative_duel_skill_multiplier #-25 when extremely skilled meets avarage
				}
				show_as_tooltip = {
					reverse_add_opinion = {
						target = scope:vip
						modifier = angry_opinion
						opinion = -30
					}
				}
				hidden_effect = {
					trigger_event = {
						id = yearly.1023
						days = 14
					}
				}
			}
		}

		hidden_effect = {
			scope:enemy = {
				add_opinion = {
					target = scope:vip
					modifier = hate_opinion
					opinion = -35
				}
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			craven = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = low_chance_impact_positive_ai_value #Max +100
				ai_greed = low_chance_impact_positive_ai_value #Max +100
				ai_honor = medium_chance_impact_negative_ai_value #Max +200 (negative honor)
				ai_compassion = medium_chance_impact_positive_ai_value #Max +200
			}
		}
	}
	
	#I want nothing to do with this
	option = {
		name = yearly.1020.c

		reverse_add_opinion = {
			target = scope:vip
			modifier = refusal_opinion
			opinion = -10
		}

		stress_impact = {
			ambitious = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = low_chance_impact_positive_ai_value #max +100
				ai_honor = tiny_chance_impact_positive_ai_value #max +50
			}
		}
	}
}

#Time to hand over the capture
yearly.1021 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = {
		desc = yearly.1020.opening
	}
	desc = yearly.1021.desc
	sender = {
		character = scope:vip
		animation = schadenfreude
	}
	
	trigger = {
		any_prisoner = { this = scope:enemy }
		scope:vip = { is_alive = yes }
	}

	#Hand over
	option = {
		name = yearly.1021.a

		hidden_effect = {
			scope:enemy = { release_from_prison = yes }
		}

		scope:vip = {
			pay_short_term_gold = {
				target = root
				gold = major_gold_value
			}
			imprison = {
				target = scope:enemy
				type = dungeon
			}
		}

		ai_chance = {
			base = 200
			ai_value_modifier = {
				ai_honor = medium_chance_impact_negative_ai_value #max -200
				ai_greed = low_chance_impact_positive_ai_value #max +100
			}
		}
	}

	#No, keep
	option = {
		name = yearly.1021.b
		custom_tooltip = yearly.1021.b.tt

		reverse_add_opinion = {
			target = scope:vip
			modifier = refusal_opinion
			opinion = -15
		}

		ai_chance = {
			base = 30
		}
	}
}					


#VIP's enemy is grateful for the warning
yearly.1022 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = {
		desc = yearly.1022.opening
	}
	desc = yearly.1022.desc
	sender = scope:enemy
	
	trigger = {
		scope:enemy = { is_alive = yes }
	}

	immediate = {
		reverse_add_opinion = {
			target = scope:enemy
			modifier = grateful_opinion
			opinion = 15
		}
		if = {
			limit = {
				can_add_hook = {
					type = favor_hook
					target = scope:enemy
				}
			}
			add_hook = {
				type = favor_hook
				target = scope:enemy
			}
		}
	}

	option = {
		name = yearly.1022.a
		if = {
			limit = { has_character_flag = yearly_1020_b_success_flag }
			remove_character_flag = yearly_1020_b_success_flag
			custom_tooltip = yearly.1020.b.success.tt
		}
	}
}

#VIP is furious about your betrayal
yearly.1023 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = {
		desc = yearly.1023.opening
	}
	desc = yearly.1023.desc
	sender = {
		character = scope:vip
		animation = rage
	}
	
	trigger = {
		scope:vip = { is_alive = yes }
	}

	immediate = {
		reverse_add_opinion = {
			target = scope:vip
			modifier = angry_opinion
			opinion = -30
		}
		if = {
			limit = {
				reverse_opinion = {
					target = scope:vip
					value < 0
				}
				can_set_relation_rival_trigger = { CHARACTER = scope:vip }
			}
			set_relation_rival = scope:vip
		}
		else_if = {
			limit = {
				can_set_relation_potential_rival_trigger = { CHARACTER = scope:vip }
			}
			set_relation_potential_rival = scope:vip
		}
	}

	option = {
		name = yearly.1023.a
	}
}


###Hooked characters offers secret###

scripted_trigger yearly_1030_could_get_deviant_secret_trigger = {
	NOR = {
		has_trait = deviant
		any_secret = { secret_type = secret_deviant }
		has_trait = chaste
		has_trait = celibate
	}
	is_adult = yes
	save_temporary_scope_as = shunned_or_criminal_check
	trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = deviant GENDER_CHARACTER = scope:shunned_or_criminal_check }
}


scripted_trigger yearly_1030_could_get_homosexual_secret_trigger = {
	NOR = {
		has_trait = sodomite
		any_secret = { secret_type = secret_homosexual }
		has_trait = chaste
		has_trait = celibate
	}
	is_adult = yes
	OR = {
		has_sexuality = homosexual
		has_sexuality = bisexual
	}
	save_temporary_scope_as = shunned_or_criminal_check
	trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = sodomite GENDER_CHARACTER = scope:shunned_or_criminal_check }
}

scripted_trigger yearly_1030_could_get_cannibal_secret_trigger = {
	NOR = {
		has_trait = cannibal
		any_secret = { secret_type = secret_cannibal }
		has_trait = compassionate
	}
	is_adult = yes
	save_temporary_scope_as = shunned_or_criminal_check
	trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = cannibal GENDER_CHARACTER = scope:shunned_or_criminal_check }
}

scripted_trigger yearly_1030_could_get_non_believer_secret_trigger = {
	NOR = {
		has_character_modifier = known_non_believer
		any_secret = { secret_type = secret_non_believer }
		has_trait = zealous
	}
	is_adult = yes
}

scripted_trigger yearly_1030_could_get_witch_secret_trigger = {
	NOR = {
		has_trait = witch
		any_secret = { secret_type = secret_witch }
		has_trait = zealous
	}
	is_adult = yes
	save_temporary_scope_as = shunned_or_criminal_check
	trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = witch GENDER_CHARACTER = scope:shunned_or_criminal_check }
}

scripted_trigger yearly_1030_suitable_target_trigger = {
	is_ai = yes
	save_temporary_scope_as = potential_target
	OR = {
		any_secret = {
			yearly_1030_secret_trigger = yes
		}
		yearly_1030_could_get_deviant_secret_trigger = yes
		yearly_1030_could_get_homosexual_secret_trigger = yes
		yearly_1030_could_get_cannibal_secret_trigger = yes
		yearly_1030_could_get_non_believer_secret_trigger = yes
		yearly_1030_could_get_witch_secret_trigger = yes
	}
	NOT = {
		root = {
			has_hook = scope:potential_target
		}
	}
}

scripted_trigger yearly_1030_hooked_character_trigger = {
		is_available_ai_adult = yes
}

scripted_trigger yearly_1030_secret_trigger = {
	NOT = { is_known_by = root }
	trigger_if = {
		limit = {
			exists = secret_target
		}
		secret_target = {
			save_temporary_scope_as = secret_target_check
		}
		NOT = {
			root = {
				has_hook = scope:secret_target_check
			}
		}
	}
}

yearly.1030 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1030.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:hooked = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value < low_positive_ai_value
						}
					}
				}
				desc = yearly.1030.nervous.desc
			}
			desc = yearly.1030.confident.desc
		}
		desc = yearly.1030.end.desc
	}	
	theme = intrigue
	left_portrait = scope:hooked
	right_portrait = scope:secret_character
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1030 }
		OR = { # Expensive, so we restrict the AI use of this
			is_ai = no
			highest_held_title_tier > tier_county
		}
		any_hooked_character = { yearly_1030_hooked_character_trigger = yes }
		OR = {
			any_relation = { type = rival yearly_1030_suitable_target_trigger = yes }
			any_spouse = { yearly_1030_suitable_target_trigger = yes }
			any_vassal = {
				is_powerful_vassal = yes
				yearly_1030_suitable_target_trigger = yes
			}
			any_normal_councillor = { yearly_1030_suitable_target_trigger = yes }
			AND = {
				is_independent_ruler = no
				liege = { yearly_1030_suitable_target_trigger = yes }
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1030
			days = 2000
		}
		hidden_effect = {
			#Assemble list of people opinion_targetse secrets you are interested in
			every_relation = {
				type = rival
				limit = { yearly_1030_suitable_target_trigger = yes }
				add_to_list = secret_character_options
			}
			every_spouse = {
				limit = { yearly_1030_suitable_target_trigger = yes }
				add_to_list = secret_character_options
			}
			every_vassal = {
				limit = {
					is_powerful_vassal = yes
					yearly_1030_suitable_target_trigger = yes
				}
				add_to_list = secret_character_options
			}
			every_normal_councillor = {
				limit = { yearly_1030_suitable_target_trigger = yes }
				add_to_list = secret_character_options
			}
			if = {
				limit = {
					is_independent_ruler = no
					liege = { yearly_1030_suitable_target_trigger = yes }
				}
				liege = { add_to_list = secret_character_options }
			}

			#Randomly select one + their secret
			random_in_list = {
				list = secret_character_options
				limit = { any_secret = { yearly_1030_secret_trigger = yes } }
				alternative_limit = { always = yes }
				save_scope_as = secret_character
			}

			scope:secret_character = {
				if = {
					limit = {  #They don't have a secret? Well, they do now!
						NOT = { any_secret = { yearly_1030_secret_trigger = yes } }
					}
					random_list = {
						2 = {
							trigger = { yearly_1030_could_get_deviant_secret_trigger = yes }
							give_deviant_secret_or_trait_effect = yes #Should always give secret based on scripted trigger
						}
						5 = {
							trigger = { yearly_1030_could_get_homosexual_secret_trigger = yes }
							give_homosexual_secret_or_nothing_effect = yes #Should always give secret based on scripted trigger
						}
						1 = {
							trigger = { yearly_1030_could_get_cannibal_secret_trigger = yes }
							give_cannibal_secret_or_trait_effect = yes #Should always give secret based on scripted trigger
						}
						3 = {
							trigger = { yearly_1030_could_get_non_believer_secret_trigger = yes }
							give_non_believer_secret_effect = yes
						}
						1 = {
							trigger = { yearly_1030_could_get_witch_secret_trigger = yes }
							give_witch_secret_or_trait_effect = yes #Should always give secret based on scripted trigger
						}
					}
				}

				#Fallback in case something goes wrong:
				if = {
					limit = {
						NOT = {
							any_secret = {
								always = yes
							}
						}
					}
					give_cannibal_secret_or_trait_effect = yes
					give_witch_secret_or_trait_effect = yes
					give_homosexual_secret_or_nothing_effect = yes
					give_deviant_secret_or_trait_effect = yes
					give_non_believer_secret_effect = yes
					#Now this is someone I'd like to meet
				}
				
				random_secret = {
					limit = { yearly_1030_secret_trigger = yes }
					save_scope_as = secret

					if = {
						limit = { exists = secret_target }
						secret_target = {
							save_scope_as = secret_target
						}
					}
				}
			}

			#Select the character opinion_target reveals the secret
			random_hooked_character = {
				limit = { yearly_1030_hooked_character_trigger = yes }
				weight = {
					base = 30
					opinion_modifier = {
						opinion_target = scope:secret_character
						multiplier = -0.5
						min = -25
					}
					modifier = {
						court_owner = scope:secret_character.court_owner
						add = 15
					}
					modifier = {
						intrigue > scope:secret_character.intrigue
						add = 15
					}
				}
				save_scope_as = hooked
			}
		}
	}

	#Yes, I promise
	option = {
		name = yearly.1030.a
		custom_tooltip = yearly.1030.a.tt

		remove_hook = {
			target = scope:hooked
		}

		reverse_add_opinion = {
			target = scope:hooked
			modifier = grateful_opinion
			opinion = 10
		}

		hidden_effect = {
			send_interface_toast = {
				title = yearly.1030.a.start.desc
				left_icon = scope:hooked
				right_icon = scope:secret_character
				
				scope:secret = { reveal_to = root }
			}
		}

		stress_impact = {
			arrogant = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
			greedy = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:hooked
				multiplier = 1
			}
			opinion_modifier = {
				opinion_target = scope:secret_character
				multiplier = -1
			}
			modifier = {
				OR = {
					has_trait = arrogant
					has_trait = ambitious
					has_trait = greedy
					has_trait = deceitful
					has_trait = paranoid
					has_trait = callous
					has_trait = sadistic
					has_trait = vengeful
				}
				add = -85
			}
		}
	}

	#You will tell me, or else!
	option = {
		name = yearly.1030.b
		custom_tooltip = yearly.1030.b.tt

		reverse_add_opinion = {
			target = scope:hooked
			modifier = cruelty_opinion
			opinion = -30
		}

		random = {
			chance = 33
			add_character_flag = {
				flag = wounded_hooked
				days = 30
			}
			show_as_tooltip = {
				scope:hooked = { increase_wounds_effect = { REASON = fight } }
			}
		}

		hidden_effect = {
			send_interface_toast = {
				left_icon = scope:hooked
				right_icon = scope:secret_character
				title = yearly.1030.a.start.desc
				
				scope:secret = { reveal_to = root }

				if = {
					limit = { has_character_flag = wounded_hooked }
					remove_character_flag = wounded_hooked
					scope:hooked = { increase_wounds_effect = { REASON = fight } }
				}		
			}
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			just = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			content = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:hooked
				multiplier = 1
			}
			opinion_modifier = {
				opinion_target = scope:secret_character
				multiplier = -1
			}
			modifier = {
				OR = {
					has_trait = just
					has_trait = craven
					has_trait = generous
					has_trait = content
					has_trait = trusting
				}
				add = -85
			}
			modifier = {
				ai_compassion > 0
				add = -300
			}
		}
	}
	
	#I am not interested
	option = {
		name = yearly.1030.c

		reverse_add_opinion = {
			target = scope:hooked
			modifier = disappointed_opinion
			opinion = -10
		}

		stress_impact = {
			ambitious = minor_stress_impact_gain
			vengeful = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:hooked
				multiplier = -1
			}
			opinion_modifier = {
				opinion_target = scope:secret_character
				multiplier = 1
			}
			modifier = {
				OR = {
					has_trait = ambitious
					has_trait = vengeful
					has_trait = paranoid
				}
				add = -85
			}
		}
	}
}	


###Courtier is hiding a letter - surprise or secret?###

scripted_trigger yearly_1040_suspicious_good_trigger = {
	OR = {
		ai_compassion >= high_positive_ai_value
		has_trait = ambitious
		has_trait = generous
		is_spouse_of = root
		is_child_of = root
		has_relation_lover = root
		has_relation_friend = root
		is_parent_of = root
	}
	opinion = {
		target = root
		value >= medium_positive_opinion
	}
}


scripted_trigger yearly_1040_hostile_scheme_agent_trigger = {
	save_temporary_scope_as = scheme_agent
	root = {
		OR = {
			any_targeting_scheme = {
				hostile_scheme_trigger = yes
				scheme_defender = root
				save_temporary_scope_as = hostile_scheme
				any_scheme_agent = {
					this = scope:scheme_agent
					NOT = { is_agent_exposed_in_scheme = scope:hostile_scheme }
				}
			}
			any_spouse = {
				any_targeting_scheme = {
					hostile_scheme_trigger = yes
					scheme_defender = root
					save_temporary_scope_as = hostile_scheme
					any_scheme_agent = {
						this = scope:scheme_agent
						NOT = { is_agent_exposed_in_scheme = scope:hostile_scheme }
					}
				}
			}
			any_child = {
				any_targeting_scheme = {
					hostile_scheme_trigger = yes
					save_temporary_scope_as = hostile_scheme
					scheme_defender = root
					any_scheme_agent = {
						this = scope:scheme_agent
						NOT = { is_agent_exposed_in_scheme = scope:hostile_scheme }
					}
				}
			}
		}
	}
}

scripted_trigger yearly_1040_suspicious_bad_trigger = {
	OR = {
		any_secret = { NOT = { is_known_by = root } }
		ai_zeal < 0
		ai_honor < 0
		yearly_1040_hostile_scheme_agent_trigger = yes
	}
}

scripted_trigger yearly_1040_interesting_character_trigger = {
	OR = {
		yearly_1040_suspicious_good_trigger = yes
		yearly_1040_suspicious_bad_trigger = yes
	}
	OR = {
		is_spouse_of = root
		is_close_or_extended_family_of = root
		has_relation_lover = root
		has_relation_friend = root
		is_powerful_vassal = yes
		is_normal_councillor = yes
	}
	is_available_ai_adult = yes
}


yearly.1040 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1040.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:suspicious = { has_relation_lover = root } }
				desc = yearly.1040.tumble.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious = {
						OR = {
							is_spouse_of = root
							is_close_or_extended_family_of = root
							has_relation_friend = root
						}
					}
				}
				desc = yearly.1040.dinner.desc
			}
			triggered_desc = {
				trigger = { scope:suspicious = { is_normal_councillor = yes } }
				desc = yearly.1040.council_meeting.desc
			}
			triggered_desc = {
				trigger = { scope:suspicious = { is_powerful_vassal = yes } }
				desc = yearly.1040.vassal_talk.desc
			}
		}
		desc = yearly.1040.end.desc
	}
	theme = intrigue
	override_background = {
		event_background = study
	}
	left_portrait = {
		character = scope:suspicious
		animation = paranoid
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1040 }
		OR = { # Expensive, so we restrict the AI use of this
			is_ai = no
			highest_held_title_tier > tier_county
		}
		OR = {
			any_courtier = {
				yearly_1040_interesting_character_trigger = yes
				OR = {
					yearly_1040_suspicious_good_trigger = yes
					yearly_1040_suspicious_bad_trigger = yes
				}
			}
			any_vassal = {
				yearly_1040_interesting_character_trigger = yes
				OR = {
					yearly_1040_suspicious_good_trigger = yes
					yearly_1040_suspicious_bad_trigger = yes
				}
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1040
			days = 3650
		}
		hidden_effect = {
			#Good suspicious or bad suspicious? + save a target
			random_list = {
				1 = { #Good
					trigger = {
						OR = {
							any_courtier = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_suspicious_good_trigger = yes
							}
							any_vassal = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_suspicious_good_trigger = yes
							}
						}
					}

					every_courtier = {
						limit = {
							yearly_1040_interesting_character_trigger = yes
							yearly_1040_suspicious_good_trigger = yes
						}
						add_to_list = suspicious_option
					}
					every_vassal = {
						limit = {
							yearly_1040_interesting_character_trigger = yes
							yearly_1040_suspicious_good_trigger = yes
						}
						add_to_list = suspicious_option
					}

					random_in_list = {
						list = suspicious_option
						save_scope_as = suspicious
					}
					save_scope_value_as = {
						name = suspicious_type
						value = flag:good
					}
				}
				1 = {
					trigger = { #Bad
						OR = {
							any_courtier = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_suspicious_bad_trigger = yes
							}
							any_vassal = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_suspicious_bad_trigger = yes
							}
						}
					}
					modifier = { #More likely to pick bad when there's a scheme involved!
						OR = {
							any_courtier = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_hostile_scheme_agent_trigger = yes
							}
							any_vassal = {
								yearly_1040_interesting_character_trigger = yes
								yearly_1040_hostile_scheme_agent_trigger = yes
							}
						}
						factor = 2
					}
					every_courtier = {
						limit = {
							yearly_1040_interesting_character_trigger = yes
							yearly_1040_suspicious_bad_trigger = yes
						}
						add_to_list = suspicious_option
					}
					every_vassal = {
						limit = {
							yearly_1040_interesting_character_trigger = yes
							yearly_1040_suspicious_bad_trigger = yes
						}
						add_to_list = suspicious_option
					}
					random_in_list = {
						limit = {
							yearly_1040_hostile_scheme_agent_trigger = yes
						}
						alternative_limit = { always = yes }
						list = suspicious_option
						save_scope_as = suspicious
					}
					save_scope_value_as = {
						name = suspicious_type
						value = flag:bad
					}
				}
			}

			
			#If bad suspicious: what are they hiding?
			if = {
				limit = { scope:suspicious_type = flag:bad }
			
				#Hostile scheme
				if = {
					limit = {
						scope:suspicious = {
							yearly_1040_hostile_scheme_agent_trigger = yes
						}
					}

					save_scope_value_as = {
						name = secret_type
						value = flag:hostile_scheme_agent
					}
					
					random_targeting_scheme = {
						limit = {
							scheme_defender = root
							hostile_scheme_trigger = yes
							any_scheme_agent = {
								this = scope:suspicious
								NOT = { is_agent_exposed_in_scheme = prev }
							}
						}
						save_scope_as = scheme
					}
					
					if = {
						limit = { NOT = { exists = scope:scheme } }
						every_spouse = {
							random_targeting_scheme = {
								limit = {
									hostile_scheme_trigger = yes
									any_scheme_agent = {
										this = scope:suspicious
										NOT = { is_agent_exposed_in_scheme = prev }
									}
								}
								save_scope_as = scheme
							}
						}
					}

					if = {
						limit = { NOT = { exists = scope:scheme } }
						every_child = {
							random_targeting_scheme = {
								limit = {
									hostile_scheme_trigger = yes
									any_scheme_agent = {
										this = scope:suspicious
										NOT = { is_agent_exposed_in_scheme = prev }
									}
								}
								save_scope_as = scheme
							}
						}
					}

					scope:scheme = {
						scheme_target = { save_scope_as = scheme_target }
					}
				}
				#Secret
				else = {
					scope:suspicious = {
						#Doesn't have a secret?
						set_while_counter_variable_effect = yes
						while = { #While because there is a small chance that the likely secret includes root
							limit = {
								NOT = { any_secret = { NOT = { is_known_by = root } } }
								var:while_counter < 3
							}
							give_random_likely_secret_effect = yes
							increase_while_counter_variable_effect = yes
						}
						remove_while_counter_variable_effect = yes

						random_secret = {
							limit = { NOT = { is_known_by = root } }
							save_scope_as = secret
						}
					}

					#Just in case there is still not a good secret...
					if = {
						limit = { NOT = { exists = scope:secret} }

						save_scope_value_as = {
							name = suspicious_type
							value = flag:good #They will surprise you!
						}
					}
					else = {
						save_scope_value_as = {
							name = secret_type
							value = flag:secret
						}
					}
				}
			}

			#If good suspicious: what are they prepping?
			if = {
				limit = { scope:suspicious_type = flag:good }
				random_list = {
					1 = { #Visit from a friend
						trigger = { any_relation = { type = friend is_available = yes } }
						random_relation = {
							type = friend
							limit = {
								has_relation_best_friend = root
								is_available = yes
							}
							alternative_limit = { is_available = yes }
							save_scope_as = secret_friend
						}
						save_scope_value_as = {
							name = surprise_type
							value = flag:friend
						}
					}
					1 = { #Gift
						save_scope_value_as = {
							name = surprise_type
							value = flag:gift
						}
					}
					1 = { #Feast in my honor
						save_scope_value_as = {
							name = surprise_type
							value = flag:feast
						}
					}
				}
			}

		}
	}

	#Show me
	option = {
		name = yearly.1040.a
		custom_tooltip = yearly.1040.a.tt

		reverse_add_opinion = {
			target = scope:suspicious
			modifier = angry_opinion
			opinion = -15
		}

		trigger_event = yearly.1041
	}

	#Sneaky discovery
	option = {
		name = yearly.1040.b

		duel = {
			skill = intrigue
			target = scope:suspicious
			60 = { #You discover the secret
				compare_modifier = {
					value = scope:duel_value
					multiplier = medium_positive_duel_skill_multiplier #+50 when extremely skilled meets avarage
				}
				desc = yearly.1040.b.success.desc

				custom_tooltip = yearly.1040.a.tt

				hidden_effect = {
					trigger_event = yearly.1042
				}
			}
			40 = { #You find out nothing
				compare_modifier = {
					value = scope:duel_value
					multiplier = medium_negative_duel_skill_multiplier #-50 when extremely skilled meets avarage
				}
				desc = yearly.1040.b.failure.desc

				show_as_tooltip = {
					reverse_add_opinion = {
						target = scope:suspicious
						modifier = angry_opinion
						opinion = -25
					}
				}

				hidden_effect = {
					trigger_event = yearly.1043
				}
			}
		}
	}
	
	#Let it go
	option = {
		name = yearly.1040.c

		reverse_add_opinion = {
			target = scope:suspicious
			modifier = grateful_opinion
			opinion = 10
		}

		hidden_effect = {
			if = {
				limit = { scope:suspicious_type = flag:good }
				trigger_event = {
					id = yearly.1044
					days = { 14 21 }
				}
			}
		}
	}
}

#You force them to tell you
yearly.1041 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1040.t
	desc = {
		desc = yearly.1041.start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						AND = {
							scope:suspicious_type = flag:good
							NOT = { has_trait = craven }
						}
						scope:suspicious = {
							dread_modified_ai_boldness = {
								dreaded_character = root
								value >= medium_positive_ai_value
							}
						}
					}
				}
				desc = yearly.1041.cross_arm.desc
			}
			desc = yearly.1041.shivering_hand.desc
		}
		desc = yearly.1041.middle.desc
		#The content of the secret letter
		first_valid = {
			#Good secrets
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:friend
				}
				desc = yearly.1041.friend.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:gift
				}
				desc = yearly.1041.gift.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:feast
				}
				desc = yearly.1041.feast.desc
			}
			#Bad secrets
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:hostile_scheme_agent
					NOT = { scope:scheme_target = root }
				}
				desc = yearly.1041.hostile_scheme_agent_other.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:hostile_scheme_agent
					scope:scheme_target = root
				}
				desc = yearly.1041.hostile_scheme_agent_me.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:secret
					OR = {
						ai_compassion < 0
						ai_honor < 0
						ai_zeal < 0
					}
				}
				desc = yearly.1041.secret_wicked.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:secret
				}
				desc = yearly.1041.secret_angry.desc
			}
		}

	}
	theme = unfriendly
	left_portrait = {
		character = scope:suspicious
		animation = shame
	}
	
	option = {
		name = {
			trigger = { scope:suspicious_type = flag:good }
			text = yearly.1041.a.good
		}
		name = {
			trigger = { scope:suspicious_type = flag:bad }
			text = yearly.1041.a.bad
		}

		#Good secret tooltips
		if = {
			limit = { exists = scope:surprise_type }

			if = {
				limit = { scope:surprise_type = flag:friend }
				custom_tooltip = yearly.1041.friend.tt
			}
			else_if = {
				limit = { scope:surprise_type = flag:gift }
				custom_tooltip = yearly.1041.gift.tt
			}
			else_if = {
				limit = { scope:surprise_type = flag:feast }
				custom_tooltip = yearly.1041.feast.tt
			}
		}

		#Bad secret effects
		if = {
			limit = { exists = scope:secret_type }

			if = {
				limit = { scope:secret_type = flag:hostile_scheme_agent }
				scope:scheme = {
					expose_scheme = yes
					expose_scheme_agent = scope:suspicious
				}
			}
			else_if = {
				limit = { scope:secret_type = flag:secret }
				scope:secret = { reveal_to = root }
			}
		}
	}
}	

#Intrigue discovery
yearly.1042 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1040.t
	desc = {
		desc = yearly.1042.start.desc
		#The content of the secret letter
		first_valid = {
			#Good secrets
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:friend
				}
				desc = yearly.1042.friend.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:gift
				}
				desc = yearly.1042.gift.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:good
					scope:surprise_type = flag:feast
				}
				desc = yearly.1042.feast.desc
			}
			#Bad secrets
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:hostile_scheme_agent
					NOT = { scope:scheme_target = root }
				}
				desc = yearly.1041.hostile_scheme_agent_other.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:hostile_scheme_agent
					scope:scheme_target = root
				}
				desc = yearly.1041.hostile_scheme_agent_me.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:secret
					OR = {
						ai_compassion < 0
						ai_honor < 0
						ai_zeal < 0
					}
				}
				desc = yearly.1041.secret_wicked.desc
			}
			triggered_desc = {
				trigger = {
					scope:suspicious_type = flag:bad
					scope:secret_type = flag:secret
				}
				desc = yearly.1041.secret_angry.desc
			}
		}
	}
	theme = intrigue
	left_portrait = scope:suspicious
	
	option = {
		name = {
			trigger = { scope:suspicious_type = flag:good }
			text = yearly.1042.a.good
		}
		name = {
			trigger = { scope:suspicious_type = flag:bad }
			text = yearly.1041.a.bad
		}

		#Good secret tooltips
		if = {
			limit = { exists = scope:surprise_type }

			custom_tooltip = yearly.1042.good.tt

			trigger_event = {
				id = yearly.1044
				days = { 14 21 }
			}
		}

		#Bad secret effects
		if = {
			limit = { exists = scope:secret_type }

			if = {
				limit = { scope:secret_type = flag:hostile_scheme_agent }
				scope:scheme = {
					expose_scheme = yes
					expose_scheme_agent = scope:suspicious
				}
			}
			else_if = {
				limit = { scope:secret_type = flag:secret }
				scope:secret = { reveal_to = root }
			}
		}
	}
}

#Intrigue caught red-handed
yearly.1043 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1043.t
	desc = yearly.1043.desc
	theme = unfriendly
	left_portrait = {
		character = scope:suspicious
		animation = anger
	}
	
	option = {
		name = yearly.1043.a
		custom_tooltip = yearly.1043.a.tt

		reverse_add_opinion = {
			target = scope:suspicious
			modifier = angry_opinion
			opinion = -25
		}
	}
}

#Receiving the surprise
yearly.1044 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1044.t
	desc = {
		desc = yearly.1044.start.desc
		first_valid = {
			#Good secrets
			triggered_desc = {
				trigger = {
					scope:surprise_type = flag:friend
				}
				desc = yearly.1044.friend.desc
			}
			triggered_desc = {
				trigger = {
					scope:surprise_type = flag:gift
				}
				desc = yearly.1044.gift.desc
			}
			triggered_desc = {
				trigger = {
					scope:surprise_type = flag:feast
				}
				desc = yearly.1044.feast.desc
			}
		}
	}
	theme = friendly
	left_portrait = {
		character = scope:suspicious
		animation = happiness
	}

	trigger = {
		scope:suspicious = {
			is_alive = yes
			is_imprisoned = no
		}
	}

	option = {
		name = yearly.1044.a

		if = {
			limit = { scope:surprise_type = flag:friend }

			reverse_add_opinion = {
				target = scope:secret_friend
				opinion = 20
				modifier = friendliness_opinion
			}
			hidden_effect = {
				add_opinion = {
					target = scope:secret_friend
					opinion = 20
					modifier = friendliness_opinion
				}
			}
			add_stress = medium_stress_loss
		}
		else_if = {
			limit = { scope:surprise_type = flag:gift }
		
			add_gold = medium_gold_value
		}
		else_if = {
			limit = { scope:surprise_type = flag:feast }

			add_prestige = medium_prestige_gain
		}

		hidden_effect = {
			add_opinion = {
				target = scope:suspicious
				opinion = 15
				modifier = grateful_opinion
			}
		}
	}
}


###Heir/child fancies themselves a duelist###
scripted_trigger yearly_1050_vassal_trigger = {
	is_available_ai_adult = yes
	NOR = {
		has_trait = wounded_3
		health < fine_health
		this = $DUELIST$
		has_relation_friend = $DUELIST$
		has_relation_lover = $DUELIST$
		is_spouse_of = $DUELIST$
	}
}

scripted_trigger yearly_1050_duelist_trigger = {
	is_available_ai_adult = yes
	NOT = { has_character_flag = block_event_yearly_1050 }
	is_child_of = root
	exists = liege
	liege = root
	ai_boldness > 0
	OR = {
		has_trait = arrogant
		has_trait = ambitious
		has_trait = vengeful
		ai_boldness >= medium_positive_ai_value
		ai_energy >= medium_positive_ai_value
		ai_rationality <= medium_negative_ai_value
		has_trait = lifestyle_blademaster
		prowess >= high_skill_rating
	}
	NOR = {
		has_trait = wounded_3
		health < fine_health
	}
	save_temporary_scope_as = potential_heir
	root = {
		any_vassal = {
			yearly_1050_vassal_trigger = { DUELIST = scope:potential_heir }
		}
	}
}


yearly.1050 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1050.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:angry_vassal = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value >= low_positive_ai_value
						}
					}
				}
				desc = yearly.1050.angry.desc
			}
			desc = yearly.1050.scared.desc
		}
	}
	theme = war
	left_portrait = {
		character = scope:angry_vassal
		triggered_animation = {
			trigger = {
				scope:angry_vassal = {
					dread_modified_ai_boldness = {
						dreaded_character = root
						value >= low_positive_ai_value
					}
				}
			}
			animation = rage
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = stress
		}
	}
	right_portrait = scope:heir
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1050 }
		any_close_or_extended_family_member = {
			yearly_1050_duelist_trigger = yes
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			exists = player_heir
			player_heir = {
				yearly_1050_duelist_trigger = yes
				OR = {
					ai_boldness >= high_negative_ai_value
					has_trait = arrogant
					has_trait = ambitious
				}
			}
			add = 0.5
		}
		modifier = {
			exists = player_heir
			player_heir = {
				yearly_1050_duelist_trigger = yes
				ai_rationality <= high_negative_ai_value
			}
			add = 0.5
		}
		modifier = {
			exists = player_heir
			player_heir = {
				yearly_1050_duelist_trigger = yes
				OR = {
					has_trait = lifestyle_blademaster
					prowess >= high_skill_rating
				}
			}
			add = 0.5
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1050
			days = 3650
		}
		random_close_or_extended_family_member = {
			limit = {
				is_player_heir_of_trigger = { CHARACTER = root }
				yearly_1050_duelist_trigger = yes
			}
			alternative_limit = {
				yearly_1050_duelist_trigger = yes
			}
			save_scope_as = heir
		}

		hidden_effect = {
			random_vassal = {
				alternative_limit = {
					is_powerful_vassal = yes
					yearly_1050_vassal_trigger = { DUELIST = scope:heir }
				}
				limit = {
					yearly_1050_vassal_trigger = { DUELIST = scope:heir }
				}
				weight = {
					base = 30
					opinion_modifier = {
						opinion_target = scope:heir
						multiplier = -0.5
						min = -25
					}
					opinion_modifier = {
						who = scope:heir
						opinion_target = this
						multiplier = -0.5
						min = -25
					}
				}
				save_scope_as = angry_vassal
				if = {
					limit = {
						NOR = {
							has_relation_rival = scope:heir
							has_relation_nemesis = scope:heir
						}
					}
					set_relation_rival = scope:heir
				}
				primary_title = { save_scope_as = title }

				if = {
					limit = { NOT = { has_trait = wounded } }
					increase_wounds_no_death_effect = { REASON = fight }
				}
			}
		}
	}

	#Forbid
	option = {
		name = yearly.1050.a
	
		reverse_add_opinion = {
			target = scope:angry_vassal
			modifier = grateful_opinion
			opinion = 20
		}

		reverse_add_opinion = {
			target = scope:heir
			modifier = angry_opinion
			opinion = -20
		}

		scope:heir = {
			add_prestige = minor_prestige_loss
			custom_tooltip = yearly.1050.c.success.tt
			hidden_effect = { scope:heir = { add_character_flag = block_event_yearly_1050 } }
		}

		ai_chance = {
			base = 100
			modifier = {
				OR = {
					ai_compassion >= medium_positive_ai_value
					has_trait = just
				}
				add = 50
			}
		}
	}

	#Give them training
	option = {
		trigger = { scope:heir = { NOT = { has_trait = blademaster_3 } } }
		name = yearly.1050.b

		reverse_add_opinion = {
			target = scope:angry_vassal
			modifier = angry_opinion
			opinion = -20
		}

		remove_short_term_gold = medium_gold_value

		scope:heir = {
			change_trait_rank = {
				trait = lifestyle_blademaster
				rank = 1
				max = 3
			}
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 10
			}
			custom_tooltip = yearly.1050.c.failure.tt
		}

		hidden_effect = {
			trigger_event = {
				id = yearly.1051
				days = { 365 500 }
			}
		}

		ai_chance = {
			base = 75
			modifier = {
				OR = {
					has_trait = ambitious
					has_trait = arrogant
				}
				add = 50
			}
			modifier = {
				short_term_gold < medium_gold_value
				add = -100
			}
		}
	}
	
	#Duel them yourselves
	option = {
		name = yearly.1050.c

		reverse_add_opinion = {
			target = scope:angry_vassal
			modifier = grateful_opinion
			opinion = 20
		}

		duel = {
			target = scope:heir
			skill = prowess

			60 = { #I win
				compare_modifier = {
					value = scope:duel_value
					multiplier = medium_positive_duel_skill_multiplier #+50 when extremely skilled meets avarage
				}
				desc = yearly.1050.critical_success.desc

				show_as_tooltip = { #Same effects as toasts but wounded warning instead of increase_wounds_no_death_effect
					add_prestige = medium_prestige_gain
					custom_tooltip = yearly.1050.c.success.wounded.tt
					custom_tooltip = yearly.1050.c.success.tt
				}

				hidden_effect = {
					scope:heir = { add_character_flag = block_event_yearly_1050 }

					random = {
						chance = 50
						scope:heir = { save_scope_as = wounded_heir }
					}
					send_interface_toast = {
						title = yearly.1050.critical_success.desc
						left_icon = scope:heir

						add_prestige = medium_prestige_gain
						custom_tooltip = yearly.1050.c.success.tt
						if = {
							limit = { exists = scope:wounded_heir }
							scope:wounded_heir = { increase_wounds_no_death_effect = { REASON = fight } }
						}
					}
				}
			}
			40 = { #They win
				compare_modifier = {
					value = scope:duel_value
					multiplier = low_negative_duel_skill_multiplier #-25 when extremely skilled meets avarage
				}
				desc = yearly.1050.failure.desc

				show_as_tooltip = { #Same effects as toasts but wounded warning instead of increase_wounds_no_death_effect
					add_prestige = medium_prestige_loss
					custom_tooltip = yearly.1050.c.failure.wounded.tt
					custom_tooltip = yearly.1050.c.failure.tt
				}

				hidden_effect = {
					random = {
						chance = 30
						save_scope_as = wounded_root
					}

					send_interface_toast = {
						title = yearly.1050.failure.desc
						left_icon = scope:heir

						add_prestige = medium_prestige_loss
						custom_tooltip = yearly.1050.c.failure.tt
						if = {
							limit = { exists = scope:wounded_root }
							scope:wounded_root = { increase_wounds_no_death_effect = { REASON = fight } }
						}
					}
					
					#Follow-up about the dueling - how did it go?
					trigger_event = {
						id = yearly.1051
						days = { 365 500 }
					}
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = {
				OR = {
					has_trait = wounded_3
					health < fine_health
				}
				add = -75
			}
			modifier = {
				OR = {
					has_trait = brave
					has_trait = wrathful
					has_trait = callous
				}
				add = 50
			}
		}
	}
}

#They kept dueling. What happened?
yearly.1051 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1051.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						scope:duels_outcome = flag:great_victory
						scope:duels_outcome = flag:victory
					}
				}
				desc = yearly.1051.victory.desc
			}
			triggered_desc = {
				trigger = { scope:duels_outcome = flag:murder }
				desc = yearly.1051.murder.desc
			}
			triggered_desc = {
				trigger = { scope:duels_outcome = flag:decent }
				desc = yearly.1051.decent.desc
			}
			triggered_desc = {
				trigger = { scope:duels_outcome = flag:defeat }
				desc = yearly.1051.defeat.desc
			}
		}
		triggered_desc = {
			trigger = { scope:duels_outcome = flag:great_victory }
			desc = yearly.1051.great_victory_end.desc
		}
		triggered_desc = {
			trigger = { scope:duels_outcome = flag:victory }
			desc = yearly.1051.regular_victory_end.desc
		}
	}
	theme = war
	left_portrait = {
		character = scope:heir
		triggered_animation = {
			trigger = { scope:duels_outcome = flag:murder }
			animation = beg
		}
		triggered_animation = {
			trigger = { scope:duels_outcome = flag:defeat }
			animation = sadness
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = personality_honorable
		}
	}
	right_portrait = scope:angry_vassal_2
	
	trigger = {
		scope:heir = {
			basic_is_available_ai = yes
		}
		any_vassal = {
			yearly_1050_vassal_trigger = { DUELIST = scope:heir }
			NOT = { this = scope:angry_vassal }
		}
	}

	immediate = {
		#Find vassal
		random_vassal = {
			limit = {
				yearly_1050_vassal_trigger = { DUELIST = scope:heir }
				NOT = { this = scope:angry_vassal }
				is_powerful_vassal = yes
			}
			alternative_limit = {	
				yearly_1050_vassal_trigger = { DUELIST = scope:heir }
				NOT = { this = scope:angry_vassal }
			}
			save_scope_as = angry_vassal_2
		}

		scope:heir = {
			hidden_effect = {
				#How did the duels go? Set flag which is later used for applying effects bc duels look wonky in immediate
				duel = {
					target = scope:angry_vassal_2
					skill = prowess
					25 = { #Win
						desc = "Win"
						compare_modifier = {
							value = scope:duel_value
							multiplier = medium_positive_duel_skill_multiplier #+50 when extremely skilled meets avarage
							min = -20
						}
						
						if = {
							limit = {
								scope:angry_vassal_2 = {
									OR = {
										has_trait = blademaster_3
										prowess >= very_high_skill_rating	
									}
								}
							}
							save_scope_value_as = {
								name = duels_outcome
								value = flag:great_victory
							}
						}
						else = {
							save_scope_value_as = {
								name = duels_outcome
								value = flag:victory
							}
						}
					}
					35 = { #Went decent
						desc = "Decent"
						compare_modifier = {
							value = scope:duel_value
							multiplier = low_positive_duel_skill_multiplier #+25 when extremely skilled meets avarage
						}
						save_scope_value_as = {
							name = duels_outcome
							value = flag:decent
						}
					}
					20 = { #Killed the vassal by mistake!
						desc = "Murder"
						modifier = {
							root = { is_ai = yes }
							add = -15
						}
						compare_modifier = {
							value = scope:duel_value
							multiplier = low_negative_duel_skill_multiplier  #+-25 when extremely skilled meets avarage
						}
						modifier = {
							OR = {
								has_trait = impatient
								has_trait = wrathful
								has_trait = lunatic
								has_trait = sadistic
								has_trait = callous
								ai_rationality < 0
							}
							add = 15
						}
						save_scope_value_as = {
							name = duels_outcome
							value = flag:murder
						}
					}
					20 = { #Defeat
						desc = "Defeat"
						compare_modifier = {
							value = scope:duel_value
							multiplier = low_negative_duel_skill_multiplier  #+-25 when extremely skilled meets avarage
						}

						save_scope_value_as = {
							name = duels_outcome
							value = flag:defeat
						}
					}
				}
			}

			#Apply the effects:

			#Great victory
			if = {
				limit = { scope:duels_outcome = flag:great_victory }
				change_trait_rank = {
					trait = lifestyle_blademaster
					rank = 1
					max = 3
				}
				add_prestige = massive_prestige_gain
			}
			#Victory
			else_if = {
				limit = { scope:duels_outcome = flag:victory }
				change_trait_rank = {
					trait = lifestyle_blademaster
					rank = 1
					max = 3
				}
				add_prestige = major_prestige_gain
				scope:angry_vassal_2 = { increase_wounds_no_death_effect = { REASON = fight } }
			}
			#Decent
			else_if = {
				limit = { scope:duels_outcome = flag:decent }
				increase_wounds_no_death_effect = { REASON = fight }
				random = {
					chance = 33
					change_trait_rank = {
						trait = lifestyle_blademaster
						rank = 1
						max = 3
					}
				}
				add_prestige = medium_prestige_value
			}
			#Murder
			else_if = {
				limit = { scope:duels_outcome = flag:murder }
				known_murder_effect = { VICTIM = scope:angry_vassal_2 MURDERER = scope:heir EXPOSER = scope:heir }
			}
			#Defeat
			else_if = {
				limit = { scope:duels_outcome = flag:defeat }
				increase_wounds_no_death_effect = { REASON = fight }
				random_list = {
					5 = { } #Nothing
					1 = {
						add_trait = one_eyed
					}
					1 = {
						add_trait = one_legged
					}
					1 = {
						add_trait = disfigured
					}
					1 = {
						add_trait = maimed
					}
				}
				add_prestige = medium_prestige_loss
			}
		}

		#Apply opinion & effects
		if = {
			limit = {
				NOR = {
					scope:duels_outcome = flag:great_victory
					scope:duels_outcome = flag:murder
				}
			}
			scope:angry_vassal_2 = {
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -15
				}
				if = {
					limit = { can_set_relation_rival_trigger = { CHARACTER = scope:heir } }
					set_relation_rival = scope:heir
				}
			}
		}
		else_if = {
			limit = { scope:duels_outcome = flag:great_victory }
			scope:angry_vassal_2 = {
				add_opinion = {
					target = scope:heir
					modifier = respect_opinion
					opinion = 15
				}
			}
		}
	}

	option = {
		name = {
			trigger = { scope:duels_outcome = flag:victory }
			text = yearly.1051.victorious.a
		}
		name = {
			trigger = { scope:duels_outcome = flag:murder }
			text = yearly.1051.murder.a
		}
		name = {
			trigger = { scope:duels_outcome = flag:decent }
			text = yearly.1051.decent.a
		}
		name = {
			trigger = { scope:duels_outcome = flag:defeat }
			text = yearly.1051.defeat.a
		}
	}
}


###The oldest joke in the book###
scripted_trigger yearly_1060_possible_flirt_trigger = {
	save_temporary_scope_as = joker_check
	mgr_can_seduce = yes
	OR = {
		has_relation_lover = root
		has_relation_friend = root
		has_relation_potential_lover = root
		is_spouse_of = root
		AND = { #A new possible romantic interest
			root = { is_attracted_to_gender_of = scope:joker_check }
			OR = {
				NOT = { relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = root } }
				sexually_liberal_trigger = yes
			}
		}
	}
}

scripted_trigger yearly_1060_joker_trigger = {
	is_available_healthy_adult = yes
	yearly_1060_possible_flirt_trigger = yes
	NOR = {
		has_trait = chaste
		has_trait = celibate
		has_trait = shy
	}
	NAND = { #Or option c won't make sense, and this probably isn't how a woman would flirt with another woman...
		is_female = yes
		root = { is_female = yes }
	}
	OR = { #They like you or you're pretty
		AND = {
			is_attracted_to_gender_of = root
			root = { attraction >= medium_positive_attraction }
		}
		opinion = {
			target = root
			value >= low_positive_opinion
		}
	}
}

yearly.1060 = {
	type = character_event
	title = yearly.1060.t
	desc = {
		random_valid = { #Setting
			triggered_desc = {
				trigger = {
					OR = {
						has_relation_lover = scope:joker
						is_spouse_of = scope:joker
					}
				}
				desc = yearly.1060.bed.desc
			}
			desc = yearly.1060.dinner.desc
			triggered_desc = {
				trigger = {
					OR = {
						scope:joker = { liege = root }
						has_relation_friend = scope:joker
					}
				}
				desc = yearly.1060.dance.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						scope:joker = { liege = root }
						has_relation_friend = scope:joker
					}
				}
				desc = yearly.1060.garden.desc
			}
			triggered_desc = {
				trigger = {
					is_attracted_to_gender_of = scope:joker
					OR = {
						scope:joker = { liege = root }
						has_relation_friend = scope:joker
					}
				}
				desc = yearly.1060.ride.desc
			}
		}
		desc = yearly.1060.joke.desc
	}
	theme = friendly
	left_portrait = {
		character = scope:joker
		animation = happiness
	}
	
	trigger = {
		OR = {
			is_ai = no
			AND = {
				exists = liege
				liege = { is_ai = no }
			}
			any_close_family_member = {
				is_ai = no
			}
		}
		any_relation = {
			type = lover
			yearly_1060_joker_trigger = yes
		}
		any_relation = {
			type = friend
			yearly_1060_joker_trigger = yes
		}
		any_relation = {
			type = potential_lover
			yearly_1060_joker_trigger = yes
		}
		any_spouse = {
			yearly_1060_joker_trigger = yes
		}
		any_courtier_or_guest = {
			yearly_1060_joker_trigger = yes
		}
		any_vassal = {
			is_powerful_vassal = yes
			yearly_1060_joker_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			any_relation = { type = potential_lover always = yes }
			add = 0.5
		}
		modifier = {
			OR = {
				has_trait = lustful
				any_relation = { type = lover has_trait = lustful }
				attraction >= medium_positive_attraction
			}
			add = 0.25
		}
		modifier = {
			OR = {
				has_trait = chaste
				has_trait = celibate
				has_sexuality = asexual
			}
			add = -0.5
		}
	}

	immediate = {
		hidden_effect = {
			#Who is it?
			every_relation = {
				type = lover
				limit = { yearly_1060_joker_trigger = yes }
				add_to_list = joker_options
			}
			every_relation = {
				type = friend
				limit = { yearly_1060_joker_trigger = yes }
				add_to_list = joker_options
			}
			every_relation = {
				type = potential_lover
				limit = { yearly_1060_joker_trigger = yes }
				add_to_list = joker_options
			}
			every_spouse = {
				limit = { yearly_1060_joker_trigger = yes }
				add_to_list = joker_options
			}
			every_courtier_or_guest = {
				limit = { yearly_1060_joker_trigger = yes }
				add_to_list = joker_options
			}
			every_vassal = {
				limit = {
					yearly_1060_joker_trigger = yes
					is_powerful_vassal = yes
				}
				add_to_list = joker_options
			}

			random_in_list = {
				list = joker_options
				limit = {
					OR = {
						has_trait = lustful
						has_trait = gregarious
						has_trait = beauty_good
						has_trait = seducer
						has_relation_potential_lover = root
					}
				}
				alternative_limit = { always = yes }
				weight = {
					base = 1
					modifier = {
						has_trait = lustful
						factor = 1.5
					}
					modifier = {
						is_attracted_to_gender_of = root
						factor = 2
					}
				}
				save_scope_as = joker
			}

			#Are they really flirting or just making a joke?
			random_list = {
				2 = { #Flirting
					trigger = {
						scope:joker = {
							is_attracted_to_gender_of = root
							yearly_1060_possible_flirt_trigger = yes
						}
					}
					modifier = {
						scope:joker = {
							OR = {
								has_trait = lustful
								has_trait = seducer
							}
						}
						factor = 2
					}
					modifier = {
						attraction >= medium_positive_attraction
						factor = 2
					}
					modifier = {
						has_relation_potential_lover = scope:joker
						factor = 5
					}
					save_scope_value_as = {
						name = intention
						value = flag:flirt
					}
				}
				1 = { #Joking
					save_scope_value_as = {
						name = intention
						value = flag:joke
					}
				}
			}

			#To stop complaining...
			if = {
				limit = { scope:intention = flag:joke }
			}
		}
	}

	#A key...?
	option = {
		name = yearly.1060.a
		flavor = yearly.1060.a.tt

		#Key: amused is twice as likely compared to "sword". No failure against clever, non-aggressive characters.
		random_list = {
			#Joker is charmed
			1 = {
				desc = yearly.1060.charmed.message
				modifier = {
					factor = 0 #Only available if they're into your gender
					scope:joker = { NOT = { is_attracted_to_gender_of = root } }
				}
				modifier = {
					has_trait = seducer
					factor = 1.5
				}
				modifier = {
					scope:intention = flag:flirt
					factor = 1.5
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.charmed.message
					left_icon = scope:joker
					
					#Progress lover if applicable
					progress_towards_lover_effect = {
						CHARACTER = scope:joker
						OPINION = 20
					}
				}
			}
			#Joker is amused
			2 = {
				desc = yearly.1060.amused.message
				modifier = {
					OR = {
						has_trait = gregarious
						diplomacy >= high_skill_rating
					}
					factor = 2
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.amused.message
					left_icon = scope:joker
					reverse_add_opinion = {
						target = scope:joker
						modifier = friendliness_opinion
						opinion = 15
					}
				}
			}
			#Joker is disappointed
			2 = {
				desc = yearly.1060.disappointed.message
				modifier = { #No failure against clever, non-aggressive characters.
					factor = 0
					scope:joker = {
						OR = {
							learning >= high_skill_rating
							ai_rationality >= high_positive_ai_value
						}
						NOR = {
							has_trait = sadistic
							has_trait = wrathful
							has_trait = callous
						}
					}
				}
				modifier = {
					factor = 0.5
					scope:joker = { ai_rationality >= medium_positive_ai_value }
				}
				show_chance = no

				send_interface_toast = {
					title = yearly.1060.disappointed.message
					left_icon = scope:joker
					reverse_add_opinion = {
						target = scope:joker
						modifier = disappointed_opinion
						opinion = -10
					}
				}
			}
		}

		if = {
			limit = { is_attracted_to_gender_of = scope:joker }
			stress_impact = {
				lustful = minor_stress_impact_gain
				shy = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				shy = minor_stress_impact_gain
			}
		}

		ai_chance = {
			factor = 100
			modifier = {
				OR = {
					has_trait = lustful
					has_trait = shy
				}
				add = -80
			}
		}
	}

	#A sword...?
	option = {
		name = yearly.1060.b
		flavor = yearly.1060.a.tt

		#Key: amused is half as likely compared to "key". No failure against aggressive/martial-focused, non-clever characters.
		random_list = {
			#Joker is charmed
			1 = {
				desc = yearly.1060.charmed.message
				modifier = {
					factor = 0 #Only available if they're into your gender
					scope:joker = { NOT = { is_attracted_to_gender_of = root } }
				}
				modifier = {
					has_trait = seducer
					factor = 1.5
				}
				modifier = {
					scope:intention = flag:flirt
					factor = 1.5
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.charmed.message
					left_icon = scope:joker
					
					#Progress lover if applicable
					progress_towards_lover_effect = {
						CHARACTER = scope:joker
						OPINION = 20
					}
				}
			}
			#Joker is amused
			1 = {
				desc = yearly.1060.amused.message
				modifier = {
					OR = {
						has_trait = gregarious
						diplomacy >= high_skill_rating
					}
					factor = 2
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.amused.message
					left_icon = scope:joker
					reverse_add_opinion = {
						target = scope:joker
						modifier = friendliness_opinion
						opinion = 15
					}
				}
			}
			#Joker is disappointed
			2 = {
				desc = yearly.1060.disappointed.message
				modifier = { #No failure against aggressive/martial-focused, non-clever characters.
					factor = 0
					scope:joker = {
						NOR = {
							learning >= high_skill_rating
							ai_rationality >= high_positive_ai_value
						}
						OR = {
							has_trait = sadistic
							has_trait = wrathful
							has_trait = callous
							martial >= high_skill_rating
							prowess >= high_skill_rating
							has_trait = lifestyle_blademaster
						}
					}
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.disappointed.message
					left_icon = scope:joker
					reverse_add_opinion = {
						target = scope:joker
						modifier = disappointed_opinion
						opinion = -10
					}
				}
			}
		}

		if = {
			limit = { is_attracted_to_gender_of = scope:joker }
			stress_impact = {
				lustful = minor_stress_impact_gain
				shy = minor_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				shy = minor_stress_impact_gain
			}
		}

		ai_chance = {
			factor = 100
			modifier = {
				OR = {
					has_trait = lustful
					has_trait = shy
				}
				add = -80
			}
		}
	}

	#My/your joystick.
	option = {
		name = {
			trigger = { is_male = yes }
			text = yearly.1060.c.male
		}
		name = {
			trigger = { is_female = yes }
			text = yearly.1060.c.female
		}
		flavor = yearly.1060.a.tt

		#Create/reveal homosexual secret
		if = {
			limit = {
				relation_with_character_is_sodomy_in_faith_trigger = { CHARACTER = scope:joker FAITH = root.faith }
			}
			if = {
				limit = { NOT = { any_secret = { secret_type = secret_homosexual } } }
				give_homosexual_secret_or_nothing_effect = yes
				custom_tooltip = yearly.1060.reveal_secret.tt
			}
			random_secret = {
				limit = { secret_type = secret_homosexual }
				reveal_to = scope:joker
			}
		}

		#Can't amuse, but can seduce. Failure is worse than "key" and "sword" and guaranteed if they're not into you!
		random_list = {
			#Joker is very charmed
			1 = {
				desc = yearly.1060.very_charmed.message
				trigger = { #Only visible if you might want a relationship with them
					NOR = {
						has_trait = celibate
						has_sexuality = asexual
						NOT = { is_attracted_to_gender_of = scope:joker }
					}
				}
				modifier = {
					factor = 0 #Only possible if they were flirting or if you're a seducer + they're into your gender
					NOR = {
						scope:intention = flag:flirt
						AND = {
							scope:joker = { is_attracted_to_gender_of = root }
							has_trait = seducer
						}
					}
				}
				modifier = {
					has_trait = seducer
					factor = 3
				}
				modifier = {
					scope:intention = flag:flirt
					factor = 2
				}
				modifier = {
					attraction >= medium_positive_attraction
					factor = 1.5
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.very_charmed.message
					left_icon = scope:joker

					if = {
						limit = { NOT = { has_relation_lover = scope:joker } }
						custom_tooltip = yearly.1060.sex_and_maybe_lover.tt
						casual_sex_or_lover_event_effect = { DAYS = 1 CHARACTER_1 = root CHARACTER_2 = scope:joker }
					}
					else = {
						custom_tooltip = yearly.1060.sex.tt
						add_stress = medium_stress_loss
					}

					hidden_effect = {
						had_sex_with_effect = { CHARACTER = scope:joker PREGNANCY_CHANCE = pregnancy_chance }
					}
					
					reverse_add_opinion = {
						target = scope:joker
						modifier = romance_opinion
						opinion = 25
					}
				}
			}
			#Joker is charmed
			1 = {
				desc = yearly.1060.charmed.message
				modifier = {
					factor = 0 #Only available if they're into your gender
					scope:joker = { NOT = { is_attracted_to_gender_of = root } }
				}
				modifier = {
					has_trait = seducer
					factor = 1.5
				}
				modifier = {
					scope:intention = flag:flirt
					factor = 1.5
				}
				modifier = {
					attraction >= medium_positive_attraction
					factor = 1.5
				}
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.charmed.message
					left_icon = scope:joker

					#Progress lover if applicable
					progress_towards_lover_effect = {
						CHARACTER = scope:joker
						OPINION = 20
					}
				}
			}
			#Joker thinks me crude
			2 = {
				desc = yearly.1060.crude.message
				show_chance = no
				send_interface_toast = {
					title = yearly.1060.crude.message
					left_icon = scope:joker
					reverse_add_opinion = {
						target = scope:joker
						modifier = insult_opinion
						opinion = -15
					}
				}
			}
		}

		if = {
			limit = { has_sexuality = asexual }
			
			stress_impact = {	
				celibate = major_stress_impact_gain
				shy = medium_stress_impact_gain
				chaste = medium_stress_impact_gain
				base = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {	
				celibate = major_stress_impact_gain
				shy = medium_stress_impact_gain
				chaste = medium_stress_impact_gain
			}
		}

		ai_chance = {
			factor = 100
			modifier = {
				OR = {
					has_trait = celibate
					has_trait = shy
					has_trait = chaste
					has_sexuality = asexual
				}
				add = -80
			}
			modifier = {
				has_trait = lustful
				add = 200
			}
		}
	}

	#I have no idea...
	option = {
		trigger = {
			NOR = {
				has_trait = celibate
				has_trait = chaste
			}
		}
		name = yearly.1060.d

		reverse_add_opinion = {
			target = scope:joker
			opinion = -10
			modifier = disappointed_opinion
		}

		if = {
			limit = {
				is_attracted_to_gender_of = scope:joker
			}
			stress_impact = {
				lustful = medium_stress_impact_gain
				gregarious = medium_stress_impact_gain
			}
		}
		else = {
			stress_impact = {
				gregarious = medium_stress_impact_gain
			}	
		}

		ai_chance = {
			factor = 100
			modifier = {
				OR = {
					has_trait = gregarious
					has_trait = lustful
				}
				add = -80
			}
		}
	}

	#How dare you!
	option = {
		trigger = {
			OR = {
				has_trait = celibate
				has_trait = chaste
			}
		}
		trait = celibate
		trait = chaste

		name = yearly.1060.e

		add_piety = minor_piety_value

		reverse_add_opinion = {
			target = root
			opinion = -15
			modifier = insult_opinion
		}

		ai_chance = {
			base = 150
		}
	}
}


#This person could be your soulmate
scripted_trigger yearly_1070_potential_soulmate_basic_trigger = {
	save_temporary_scope_as = potential_soulmate_option
	faith = root.faith
	NOT = { this = root }
	is_available_adult = yes
	basic_is_valid_for_yearly_events_trigger = yes
	matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:potential_soulmate_option }
	NOT = { has_trait = celibate }
	NOT = { any_relation = { type = soulmate always = yes } }
	NOT = {
		any_in_list = {
			list = potential_soulmate_list
			this = scope:potential_soulmate_option
		}
	}
}

scripted_trigger yearly_1070_potential_soulmate_good_trigger = {
	yearly_1070_potential_soulmate_basic_trigger = yes
	trait_compatibility = {
		target = root
		value >= medium_positive_trait_compatibility
	}
	opinion = {
		target = root
		value >= 0
	}
}

scripted_trigger yearly_1070_potential_soulmate_great_trigger = {
	yearly_1070_potential_soulmate_basic_trigger = yes
	trait_compatibility = {
		target = root
		value >= high_positive_trait_compatibility
	}
	opinion = {
		target = root
		value >= low_positive_opinion
	}
}

yearly.1070 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1070.t
	desc = {
		desc = yearly.1070.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:potential_soulmate = { is_female = yes } }
				desc = yearly.1070.peal.desc
			}
			desc = yearly.1070.rumble.desc
		}
		desc = yearly.1070.middle.desc
		random_valid = {
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_benevolent_trigger = yes } }
				desc = yearly.1070.benevolent.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_dominant_trigger = yes } }
				desc = yearly.1070.dominant.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_submissive_trigger = yes } }
				desc = yearly.1070.submissive.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_extroverted_trigger = yes } }
				desc = yearly.1070.extroverted.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_introverted_trigger = yes } }
				desc = yearly.1070.introverted.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_emotional_trigger = yes } }
				desc = yearly.1070.emotional.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_personality_levelheaded_trigger = yes } }
				desc = yearly.1070.levelheaded.desc
			}
			triggered_desc = {
				trigger = {
					scope:potential_soulmate = {
						OR = {
							has_trait = intellect_good
							has_trait = shrewd
						}
					}
				}
				desc = yearly.1070.intelligent.desc
			}
			triggered_desc = {
				trigger = {
					scope:potential_soulmate = {
						has_trait = beauty_good
						is_female = yes
					}
				}
				desc = yearly.1070.fair.desc
			}
			triggered_desc = {
				trigger = { scope:potential_soulmate = { has_trait = beauty_good } }
				desc = yearly.1070.handsome.desc #For men and women
			}
			triggered_desc = {
				trigger = {
					scope:potential_soulmate = { has_trait = zealous }
					scope:potential_soulmate.faith = root.faith
				}
				desc = yearly.1070.zealous.desc
			}
			triggered_desc = {
				trigger = {
					scope:potential_soulmate = {
						NOR = {
							has_personality_benevolent_trigger = yes
							has_personality_dominant_trigger = yes
							has_personality_submissive_trigger = yes
							has_personality_extroverted_trigger = yes
							has_personality_introverted_trigger = yes
							has_personality_emotional_trigger = yes
							has_personality_levelheaded_trigger = yes
							has_personality_benevolent_trigger = yes
							has_trait = intellect_good
							has_trait = shrewd
							has_trait = beauty_good
							AND = {
								has_trait = zealous
								scope:potential_soulmate.faith = root.faith
							}
						}
					}
				}
				desc = yearly.1070.fallback.desc
			}
		}
		desc = yearly.1070.end.desc
	}
	theme = love
	left_portrait = scope:potential_soulmate
	
	trigger = {
		is_ai = no
		OR = {
			any_vassal = {
				OR = {
					yearly_1070_potential_soulmate_good_trigger = yes
					any_spouse = { yearly_1070_potential_soulmate_good_trigger = yes }
					any_child = {
						liege = prev
						yearly_1070_potential_soulmate_good_trigger = yes
					}
				}
			}
			any_liege_or_above = {
				OR = {
					yearly_1070_potential_soulmate_good_trigger = yes
					any_spouse = { yearly_1070_potential_soulmate_good_trigger = yes }
					any_child = {
						liege = prev
						yearly_1070_potential_soulmate_good_trigger = yes
					}
					any_sibling = {
						liege = prev
						yearly_1070_potential_soulmate_good_trigger = yes
					}
				}
			}
			any_neighboring_top_liege_realm_owner = {
				OR = {
					yearly_1070_potential_soulmate_good_trigger = yes
					any_spouse = { yearly_1070_potential_soulmate_good_trigger = yes }
					any_child = {
						liege = prev
						yearly_1070_potential_soulmate_good_trigger = yes
					}
				}
			}
			any_neighboring_realm_same_rank_owner = {
				OR = {
					yearly_1070_potential_soulmate_good_trigger = yes
					any_spouse = { yearly_1070_potential_soulmate_good_trigger = yes }
					any_child = {
						liege = prev
						yearly_1070_potential_soulmate_good_trigger = yes
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 0.5
		modifier = {
			add = 0.5
			OR = {
				any_liege_or_above = {
					OR = {
						yearly_1070_potential_soulmate_great_trigger = yes
						any_spouse = { yearly_1070_potential_soulmate_great_trigger = yes }
						any_child = {
							liege = prev
							yearly_1070_potential_soulmate_great_trigger = yes
						}
						any_sibling = {
							liege = prev
							yearly_1070_potential_soulmate_great_trigger = yes
						}
					}
				}
				any_neighboring_top_liege_realm_owner = {
					OR = {
						yearly_1070_potential_soulmate_great_trigger = yes
						any_spouse = { yearly_1070_potential_soulmate_great_trigger = yes }
						any_child = {
							liege = prev
							yearly_1070_potential_soulmate_great_trigger = yes
						}
					}
				}
			}
		}
	}

	immediate = {
		every_vassal = {
			if = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_spouse = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_child = {
				limit = {
					liege = prev
					yearly_1070_potential_soulmate_good_trigger = yes
				}
				add_to_temporary_list = potential_soulmate_list
			}
		}

		every_liege_or_above = {
			if = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_spouse = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_child = {
				limit = {
					liege = prev
					yearly_1070_potential_soulmate_good_trigger = yes
				}
				add_to_temporary_list = potential_soulmate_list
			}
			every_sibling = {
				limit = {
					liege = prev
					yearly_1070_potential_soulmate_good_trigger = yes
				}
				add_to_temporary_list = potential_soulmate_list
			}
		}

		every_neighboring_top_liege_realm_owner = {
			if = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_spouse = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_child = {
				limit = {
					liege = prev
					yearly_1070_potential_soulmate_good_trigger = yes
				}
				add_to_temporary_list = potential_soulmate_list
			}
		}

		every_neighboring_realm_same_rank_owner = {
			if = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_spouse = {
				limit = { yearly_1070_potential_soulmate_good_trigger = yes }
				add_to_temporary_list = potential_soulmate_list
			}
			every_child = {
				limit = {
					liege = prev
					yearly_1070_potential_soulmate_good_trigger = yes
				}
				add_to_temporary_list = potential_soulmate_list
			}
		}

		random_in_list = {
			list = potential_soulmate_list
			limit = { #Don't let this great catch slip through your fingers!
				OR = {
					AND = {
						is_ruler = yes
						tier_difference = {
							target = root
							value >= 2
						}
					}
					AND = {
						is_ruler = no
						liege = {
							tier_difference = {
								target = root
								value >= 2
							}
						}
					}
				}
				attraction >= medium_positive_attraction
			}
			alternative_limit = {
				OR = {
					AND = {
						is_ruler = yes
						tier_difference = {
							target = root
							value >= 1
						}
					}
					AND = {
						is_ruler = no
						liege = {
							tier_difference = {
								target = root
								value >= 1
							}
						}
					}
				}
				attraction >= low_positive_attraction
			}
			alternative_limit = { always = yes }
			weight = {
				base = 1
				modifier = {
					yearly_1070_potential_soulmate_great_trigger = yes
					factor = 100
				}
				modifier = {
					OR = {
						AND = {
							is_ruler = yes
							tier_difference = {
								target = root
								value >= 1
							}
						}
						AND = {
							is_ruler = no
							liege = {
								tier_difference = {
									target = root
									value >= 1
								}
							}
						}
					}
					factor = 20
				}
				modifier = {
					OR = {
						AND = {
							is_ruler = yes
							tier_difference = {
								target = root
								value >= 2
							}
						}
						AND = {
							is_ruler = no
							liege = {
								tier_difference = {
									target = root
									value >= 2
								}
							}
						}
					}
					factor = 2 #Stacks with the ones above
				}
				modifier = {
					attraction >= low_positive_attraction
					factor = 15
				}
				modifier = {
					attraction >= medium_positive_attraction
					factor = 2 #Stacks with the ones above
				}
				modifier = {
					attraction >= high_positive_attraction
					factor = 2 #Stacks with the ones above
				}
			}
			save_scope_as = potential_soulmate
		}
	}

	#Court them!
	option = {
		trigger = {
			can_start_scheme = {
				type = courting
				target = scope:potential_soulmate
			}
		}
		name = yearly.1070.a

		start_scheme = {
			type = courting
			target = scope:potential_soulmate
		}
		custom_tooltip = yearly.1070.scheme.tt
		random_scheme = {
			limit = {
				scheme_type = courting
				scheme_target = scope:potential_soulmate
			}
			add_scheme_modifier = {
				type = seduce_and_courting_personal_chemistry_modifier
			}
		}
	}

	#Seduce them...
	option = {
		trigger = {
			can_start_scheme = {
				type = seduce
				target = scope:potential_soulmate
			}
		}
		name = yearly.1070.b
		
		start_scheme = {
			type = seduce
			target = scope:potential_soulmate
		}
		custom_tooltip = yearly.1070.scheme.tt
		random_scheme = {
			limit = {
				scheme_type = seduce
				scheme_target = scope:potential_soulmate
			}
			add_scheme_modifier = {
				type = seduce_and_courting_personal_chemistry_modifier
			}
		}
	}

	#Maybe another time
	option = {
		trigger = {
			NOR = {
				can_start_scheme = {
					type = courting
					target = scope:potential_soulmate
				}
				can_start_scheme = {
					type = seduce
					target = scope:potential_soulmate
				}
			}
		}
		name = yearly.1070.c
		
		progress_towards_lover_effect = {
			CHARACTER = scope:potential_soulmate
			OPINION = 20
		}
	}

	#I will not be tempted
	option = {
		name = yearly.1070.d
		add_piety = minor_piety_value
	}
}


### YOU ARE BEING PARANOID ###
scripted_trigger yearly_1080_available_target_trigger = {
	basic_is_available_ai = yes
	is_adult = yes
}

scripted_trigger yearly_1080_guilty_trigger = {
	yearly_1080_available_target_trigger = yes
	save_temporary_scope_as = guilty_scope
	OR = {
		any_secret = { yearly_1080_secret_trigger = yes }
		any_scheme = { yearly_1080_scheme_trigger = yes }
		yearly_1080_agent_trigger = { CHARACTER = scope:guilty_scope }
	}
}

scripted_trigger yearly_1080_secret_trigger = {
	secret_owner = { save_temporary_scope_as = owner }
	NOT = { is_known_by = root }
	OR = {
		is_blackmailable_secret_trigger = {
			PARTICIPANT = scope:owner
			BLACKMAILER = root
		}
		AND = {
			secret_is_always_interesting_trigger = yes
			exists = secret_target
			secret_target = {
				OR = {
					this = root
					is_close_family_of = root
					is_consort_of = root
				}
			}
		}
	}
}

scripted_trigger yearly_1080_scheme_trigger = {
	OR = {
		AND = {
			is_hostile = yes
			scheme_target = {
				OR = {
					this = root
					is_child_of = root
					is_consort_of = root
				}
			}
		}
		AND = {
			OR = {
				scheme_type = seduce
				scheme_type = elope
			}
			scheme_target = {
				OR = {
					is_close_family_of = root
					is_consort_of = root
				}
			}
		}
	}
}

scripted_trigger yearly_1080_agent_support_trigger = {
	yearly_1080_scheme_trigger = yes
	scheme_is_character_agent = $CHARACTER$
	NOT = { is_scheme_agent_exposed = $CHARACTER$ }
}

scripted_trigger yearly_1080_agent_trigger = {
		root = {
			OR = {
				any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = $CHARACTER$ } }
				any_child = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = $CHARACTER$ } } }
				any_consort = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = $CHARACTER$ } } }
			}
		}
}

scripted_trigger yearly_1080_paranoid_trigger = {
	OR = {
		has_trait = paranoid
		has_trait = lunatic
	}	
}

scripted_effect yearly_1080_confront_denial_effect = {
	reverse_add_opinion = {
		target = scope:suspicious
		modifier = insulted_opinion
		opinion = -15
	}
}

scripted_effect yearly_1080_confront_soothe_effect = {
	reverse_add_opinion = {
		target = scope:suspicious
		modifier = pity_opinion
		opinion = 10
	}
	add_stress = medium_stress_loss
	hidden_effect = {
		if = {
			limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:suspicious } }
			set_relation_potential_friend = scope:suspicious
		}
	}
}


yearly.1080 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		 	first_valid = {
		 		triggered_desc = {
		 			trigger = { yearly_1080_paranoid_trigger = yes }
	 			desc = yearly.1080.paranoid.desc
	 		}
	 		desc = yearly.1080.normal.desc
	 	}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = scope:suspicious
	right_portrait = scope:investigator
	
	trigger = {
		NOT = { has_character_flag = had_event_yearly_1080 }
		OR = {
			any_courtier_or_guest = { yearly_1080_available_target_trigger = yes }
			any_vassal = { yearly_1080_available_target_trigger = yes }
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_yearly_1080
			years = 15
		}

		# Who is acting suspicious?
		every_courtier_or_guest = {
			limit = { yearly_1080_available_target_trigger = yes }
			add_to_list = suspicious_list
		}
		every_vassal = {
			limit = { yearly_1080_available_target_trigger = yes }
			add_to_list = suspicious_list
		}
		every_relation = { #Included in the list, but not enough to trigger the event
			type = lover
			limit = {
				yearly_1080_available_target_trigger = yes
				NOT = { is_in_list = suspicious_list }
			}
			add_to_list = suspicious_list
		}
		every_relation = { #Included in the list, but not enough to trigger the event
			type = friend
			limit = {
				yearly_1080_available_target_trigger = yes
				NOT = { is_in_list = suspicious_list }
			}
			add_to_list = suspicious_list
		}

		random_in_list = {
			list = suspicious_list
			weight = {
				base = 20
				modifier = { # Ai values (max: 125)
					add = {
						add = {
							value = ai_honor
							multiply = -0.5
						}
						add = {
							value = ai_greed
							multiply = 0.25
						}
						add = {
							value = ai_compassion
							multiply = -0.25
						}
						add = {
							value = ai_boldness
							multiply = 0.25
						}
						min = -15
					}
				}
				opinion_modifier = { # Opinion (max: 50)
					opinion_target = root
					multiplier = -0.5
					min = -15
				}
				modifier = { # They are actually guilty (300 at and below average intrigue, 780 at 20 intrigue)
					yearly_1080_guilty_trigger = yes
					add = {
						value = 300
						add = {
							value = root.intrigue
							subtract = average_skill_rating
							multiply = 40
						}
					}
				}
				modifier = { # Paranoid root is suspicious of everyone who is close! (500)
					root = { yearly_1080_paranoid_trigger = yes }
					OR = {
						is_consort_of = root
						is_close_family_of = root
						is_councillor_of = root
						has_relation_friend = root
						has_relation_lover = root
					}
					add = 500
				}
			}
			save_scope_as = suspicious
		}

		# A friend can help?
		ordered_relation = {
			type = friend
			order_by = intrigue
			limit = {
				NOR = {
					this = scope:suspicious
					has_secret_relation_lover = scope:suspicious
				}
				intrigue > root.intrigue
				trigger_if = {
					limit = { exists = root.cp:councillor_spymaster }
					intrigue > root.cp:councillor_spymaster.intrigue
				}
			}
			save_scope_as = investigator
		}

		#Spymaster can help?
		if = {
			limit = {
				NOT = { exists = scope:investigator }
				exists = cp:councillor_spymaster
				cp:councillor_spymaster = {
					intrigue > root.intrigue
					NOR = {
						this = scope:suspicious
						has_secret_relation_lover = scope:suspicious
					}
				}
			}
			cp:councillor_spymaster = { save_scope_as = investigator }
		}
	}

	weight_multiplier = {
		base = 0.1 # Reduce chance...

		modifier = { # ...Unless someone is actually guilty and you have good intrigue...
			add = 0.9
			intrigue >= decent_skill_rating
			OR = {
				any_courtier_or_guest = { yearly_1080_guilty_trigger = yes }
				any_vassal = { yearly_1080_guilty_trigger = yes }
			}
		}
		modifier = { # ...Or you're paranoid
			add = 0.9
			has_trait = paranoid #No extra weights for being lunatic, as they have this event triggered through ongoing_trait_events on_action
		}
		modifier = {
			has_trait = trusting
			add = -0.45
		}
	}

	# Ask investigator (spymaster/friend) to investigate
	option = {
		trigger = {
			exists = scope:investigator
		}
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { has_relation_friend = scope:investigator }
						desc = yearly.1080.a.friend
					}
					desc = yearly.1080.a.spymaster
				}
			}
		}
		trait = paranoid # These traits are not needed but makes this event more common
		trait = lunatic_1
		trait = lunatic_genetic
		
		scope:investigator = {
			duel = {
				desc = outcome_in_a_few_days
				target = scope:suspicious
				skill = intrigue

				60 = {
					desc = yearly.1080.a.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3
					}
					root = {
						custom_tooltip = yearly.1080.a.success.tt
						if = {
							limit = { scope:suspicious = { yearly_1080_guilty_trigger = yes } }
							trigger_event = {
								id = yearly.1081 # Discovery event
								days = { 5 10 }
							}
						}
						else = {
							trigger_event = {
								id = yearly.1082 # Innocent
								days = { 5 10 }
							}
						}
					}
				}
				40 = {
					desc = yearly.1080.a.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2
					}
					root = {
						trigger_event = {
							id = yearly.1083 # Nothing found event
							days = { 5 10 }
						}
					}
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				yearly_1080_paranoid_trigger = yes
				add = 100
			}
			modifier = {
				has_trait = trusting
				add = -80
			}
		}
	}

	# Investigate yourself
	option = {
		trigger = {
			NOT = { exists = scope:investigator }
		}
		name = yearly.1080.b

		trait = paranoid # These traits are not needed but makes this event more common
		trait = lunatic_1
		trait = lunatic_genetic

		duel = {
			desc = outcome_in_a_few_days
			target = scope:suspicious
			skill = intrigue

			60 = {
				desc = yearly.1080.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
				}
				custom_tooltip = yearly.1080.a.success.tt
				if = {
					limit = { scope:suspicious = { yearly_1080_guilty_trigger = yes } }
					trigger_event = {
						id = yearly.1081 # Discovery event
						days = { 5 10 }
					}
				}
				else = {
					trigger_event = {
						id = yearly.1082 # Innocent
						days = { 5 10 }
					}
				}
			}
			40 = {
				desc = yearly.1080.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				trigger_event = {
					id = yearly.1083 # Nothing found event
					days = { 5 10 }
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				yearly_1080_paranoid_trigger = yes
				add = 100
			}
			modifier = {
				has_trait = trusting
				add = -80
			}
		}
	}

	# Confront
	option = {
		name = yearly.1080.c

		trait = paranoid # These traits are not needed but makes this event more common
		trait = lunatic_1
		trait = lunatic_genetic

		random_list = {
			45 = { # Confession
				modifier = {
					add = {
						add = scope:suspicious.ai_compassion
						add = scope:suspicious.ai_honor
						multiply = 0.5
						min = -35
					}
				}
				modifier = {
					add = 40
					scope:suspicious = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value <= medium_negative_ai_value
						}
					}
				}
				modifier = {
					add = 100
					scope:suspicious = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value <= very_high_negative_ai_value
						}
					}
				}
				desc = yearly.1080.c.success
				custom_tooltip = yearly.1080.a.success.tt
				if = {
					limit = { scope:suspicious = { yearly_1080_guilty_trigger = yes } }
					trigger_event = yearly.1084 # Confession
				}
				else = {
					trigger_event = yearly.1085 # Denial
				}
			}
			45 = { # Denial
				desc = yearly.1080.c.failure
				trigger_event = yearly.1085 # Denial
				show_as_tooltip = {
					yearly_1080_confront_denial_effect = yes
				}
			}
			10 = { # Soothe
				trigger = {
					has_trait = lunatic
				}
				opinion_modifier = {
					who = scope:suspicious	
					opinion_target = root
					multiplier = 1
				}
				modifier = {
					add = {
						add = scope:suspicious.ai_compassion
						add = scope:suspicious.ai_honor
						multiply = 0.5
					}
				}
				modifier = { #Even though they won't soothe if guilty, we still want the outcome to appear in the random list, so the player is uncertain whether they're guilty or not when picking the option. Still reduced chance though.
					yearly_1080_guilty_trigger = yes
					factor = 0.3
				}
				desc = yearly.1080.c.lunatic
				show_as_tooltip = { yearly_1080_confront_soothe_effect = yes }
				if = {
					limit = { scope:suspicious = { yearly_1080_guilty_trigger = yes } }
					trigger_event = yearly.1084 # Confession
				}
				else = {
					trigger_event = yearly.1086 # Soothe
				}
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			calm = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				yearly_1080_paranoid_trigger = yes
				add = 100
			}
			modifier = {
				has_trait = trusting
				add = -80
			}
			ai_value_modifier = {
				ai_boldness = 1
			}
		}
	}
	
	# It's nothing...
	option = {
		name = yearly.1080.d

		stress_impact = {
			base = minor_stress_impact_gain
			lunatic_1 = major_stress_impact_gain
			lunatic_genetic = major_stress_impact_gain
			paranoid = major_stress_impact_gain
			trusting = minor_stress_impact_loss
		}
		
			ai_chance = {
				base = 100
			}
	}
}

# Paranoid investigation: discovery
scripted_effect yearly_1081_save_guilt_effect = {
	scope:suspicious = {
		# Owns a scheme
		if = {
			limit = {
				any_scheme = { yearly_1080_scheme_trigger = yes }
			}
			random_scheme = {
				limit = {
					yearly_1080_scheme_trigger = yes
					scheme_target = root
				}
				alternative_limit = {
					yearly_1080_scheme_trigger = yes
				}
				save_scope_as = guilty_owned_scheme
				scheme_target = { save_scope_as = target }
			}
		}
		# Is an agent
		if = {
			limit = { yearly_1080_agent_trigger = { CHARACTER = scope:suspicious } }

			#Scheme against root
			if = {
				limit = { root = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } } } }
				root = {
					random_targeting_scheme = {
						limit = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } }
						save_scope_as = guilty_agent_scheme
						scheme_target = { save_scope_as = target }
					}
				}
			}
			#Scheme against root's child
			else_if = {
				limit = { root = { any_child = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } } } } }
				root = {
					random_child = {
						limit = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } } }

						random_targeting_scheme = {
							limit = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } }
							save_scope_as = guilty_agent_scheme
							scheme_target = { save_scope_as = target }
						}
					}
				}
			}
			#Scheme against root's consort
			else = {
				root = {
					random_consort = {
						limit = { any_targeting_scheme = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } } }

						random_targeting_scheme = {
							limit = { yearly_1080_agent_support_trigger = { CHARACTER = scope:suspicious } }
							save_scope_as = guilty_agent_scheme
							scheme_target = { save_scope_as = target }
						}
					}
				}
			}
		}
		# Has a secret
		else = {
			random_secret = {
				limit = {
					yearly_1080_secret_trigger = yes
					exists = secret_target
					secret_target = root
				}
				alternative_limit = {
					yearly_1080_secret_trigger = yes
					exists = secret_target
					secret_target = {
						OR = {
							is_consort_of = root
							is_close_family_of = root
						}
					}
				}
				alternative_limit = { yearly_1080_secret_trigger = yes }
				save_scope_as = guilty_owned_secret
				if = {
					limit = { exists = secret_target }
					secret_target = { save_scope_as = target }
				}
			}
		}
	}
}

scripted_effect yearly_1081_reveal_guilt_effect = {
	scope:suspicious = {
		#Owned scheme
		if = {
			limit = { exists = scope:guilty_owned_scheme }

			#Consequences as if discovered
			if = {
				limit = { scope:guilty_owned_scheme = { scheme_type = murder } }

				attempted_murder_opinion_effect = {
					VICTIM = scope:guilty_owned_scheme.scheme_target
					MURDERER = scope:suspicious
				}
			}
			else_if = {
				limit = { scope:guilty_owned_scheme = { scheme_type = seduce } }

				seduce_outcome_failure_discovered_apply_secrets_effect = yes
				seduce_outcome_discovered_expose_secrets_and_adultery_effect = { CHARACTER = scope:target EXPOSER = root }
			}
			else_if = {
				limit = { scope:guilty_owned_scheme = { scheme_type = elope } }

				elope_failure_discovered_effect = {
					TARGET = scope:target
					OWNER = scope:suspicious
					DISCOVERER = root
				}
			}

			#End it
			scope:guilty_owned_scheme = { end_scheme = yes }
		}
		#Agent in scheme
		else_if = {
			limit = { exists = scope:guilty_agent_scheme }
			scope:guilty_agent_scheme = {
				if = {
					limit = { is_scheme_exposed = no }
					expose_scheme = yes
				}
				expose_scheme_agent = scope:suspicious
			}
		}
		#Secret
		else_if = {
			limit = { exists = scope:guilty_owned_secret }
			scope:guilty_owned_secret = { reveal_to = root }
		}
	}
}

yearly.1081 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:investigator }
				desc = yearly.1081.investigator_start.desc
			}
			desc = yearly.1081.you_start.desc
		}
		first_valid = {
			# OWNED SCHEME
			triggered_desc = {
				trigger = { exists = scope:guilty_owned_scheme }
				desc = {
					# Scheme type
					first_valid = {
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = murder } }
							desc = yearly.1081.murder.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = seduce } }
							desc = yearly.1081.seduce.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = abduct } }
							desc = yearly.1081.abduct.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = elope } }
							desc = yearly.1081.elope.desc
						}
						desc = yearly.1081.scheme_type_fallback.desc
					}
					# Scheme target
					first_valid = {
						triggered_desc = {
							trigger = { scope:target = root }
							desc = yearly.1081.me.desc
						}
						desc = yearly.1081.my_introduction.desc
					}
				}
			}
			# AGENT SCHEME
			triggered_desc = {
				trigger = { exists = scope:guilty_agent_scheme }
				desc = {
					# Scheme type
					first_valid = {
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = murder } }
							desc = yearly.1081.agent_murder.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = seduce } }
							desc = yearly.1081.agent_seduce.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = abduct } }
							desc = yearly.1081.agent_abduct.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = elope } }
							desc = yearly.1081.agent_elope.desc
						}
						desc = yearly.1081.agent_scheme_type_fallback.desc
					}
					# Scheme target
					first_valid = {
						triggered_desc = {
							trigger = { scope:target = root }
							desc = yearly.1081.me.desc
						}
						desc = yearly.1081.my_introduction.desc
					}
				}
			}

			# SECRET
			triggered_desc = {
				trigger = { exists = scope:guilty_owned_secret }
				desc = yearly.1081.secret.desc
			}
		}
		#What do you think?
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						exists = scope:guilty_owned_scheme
						exists = scope:guilty_agent_scheme
						trigger_if = {
							limit = { exists = scope:target }
							scope:target = {
								OR = {
									this = root
									is_consort_of = root
									is_close_family_of = root
								}
							}
						}
						trigger_if = {
							limit = { exists = scope:guilty_owned_secret }
							scope:suspicious = {
								OR = {
									has_relation_lover = root
									is_consort_of = root
								}
							}
							scope:guilty_owned_secret = { secret_type = secret_lover }
						}
					}
				}
				desc = yearly.1081.traitor_end.desc
			}
			desc = yearly.1081.useful_end.desc
		}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = scope:suspicious
	right_portrait = scope:investigator
	
	trigger = {
		exists = scope:suspicious
		scope:suspicious = { yearly_1080_guilty_trigger = yes }
	}

	immediate = {
		yearly_1081_save_guilt_effect = yes
	}

	#Ok
	option = {
		name = yearly.1081.a

		yearly_1081_reveal_guilt_effect = yes
	}
}

# Paranoid investigation: innocent
yearly.1082 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:investigator }
				desc = yearly.1082.investigator_start.desc
			}
			desc = yearly.1082.you_start.desc
		}
		first_valid = {
		 		triggered_desc = {
		 			trigger = { yearly_1080_paranoid_trigger = yes }
	 			desc = yearly.1082.paranoid.desc
	 		}
	 		desc = yearly.1082.normal.desc
	 	}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = scope:suspicious
	right_portrait = scope:investigator
	
	trigger = {
		exists = scope:suspicious
	}

	#Ok
	option = {
		name = yearly.1082.a
		custom_tooltip = yearly.1082.a.tt
	}
}

# Paranoid investigation: failure
yearly.1083 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:investigator }
				desc = yearly.1083.investigator_start.desc
			}
			desc = yearly.1083.you_start.desc
		}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = scope:suspicious
	right_portrait = scope:investigator
	
	trigger = {
		exists = scope:suspicious
	}

	#Ok
	option = {
		name = yearly.1083.a
		custom_tooltip = yearly.1083.a.tt
	}
}

# Paranoid confrontation: confession
yearly.1084 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		desc = yearly.1084.start.desc
		first_valid = {
			# OWNED SCHEME
			triggered_desc = {
				trigger = { exists = scope:guilty_owned_scheme }
				desc = {
					# Scheme type
					first_valid = {
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = murder } }
							desc = yearly.1081.murder.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = seduce } }
							desc = yearly.1081.seduce.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = abduct } }
							desc = yearly.1081.abduct.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_owned_scheme = { scheme_type = elope } }
							desc = yearly.1081.elope.desc
						}
						desc = yearly.1081.scheme_type_fallback.desc
					}
					# Scheme target
					first_valid = {
						triggered_desc = {
							trigger = { scope:target = root }
							desc = yearly.1081.me.desc
						}
						desc = yearly.1081.my_introduction.desc
					}
				}
			}
			# AGENT SCHEME
			triggered_desc = {
				trigger = { exists = scope:guilty_agent_scheme }
				desc = {
					# Scheme type
					first_valid = {
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = murder } }
							desc = yearly.1081.agent_murder.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = seduce } }
							desc = yearly.1081.agent_seduce.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = abduct } }
							desc = yearly.1081.agent_abduct.desc
						}
						triggered_desc = {
							trigger = { scope:guilty_agent_scheme = { scheme_type = elope } }
							desc = yearly.1081.agent_elope.desc
						}
						desc = yearly.1081.agent_scheme_type_fallback.desc
					}
					# Scheme target
					first_valid = {
						triggered_desc = {
							trigger = { scope:target = root }
							desc = yearly.1081.me.desc
						}
						desc = yearly.1081.my_introduction.desc
					}
				}
			}

			# SECRET
			triggered_desc = {
				trigger = { exists = scope:guilty_owned_secret }
				desc = yearly.1081.secret.desc
			}
		}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = {
		character = scope:suspicious
		animation = worry
	}
	
	trigger = {
		exists = scope:suspicious
	}

	immediate = {
		yearly_1081_save_guilt_effect = yes
	}

	# Guards!
	option = {
		name = yearly.1084.a

		yearly_1081_reveal_guilt_effect = yes

		imprison_character_effect = {
			TARGET = scope:suspicious
			IMPRISONER = root
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_vengefulness = 5
				ai_compassion = -1
				ai_boldness = 2
			}
		}
	}

	# Get out of my sight!
	option = {
		name = yearly.1084.b

		yearly_1081_reveal_guilt_effect = yes
		
		ai_chance = {
			base = 50
		}
	}
}


# Paranoid confrontation: denial
yearly.1085 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = {
		desc = yearly.1085.start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:suspicious = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value <= low_positive_ai_value
						}
					}
				}
				desc = yearly.1085.sad.desc
			}
			desc = yearly.1085.angry.desc
		}
	}
	theme = intrigue
	override_icon = {
		trigger = { has_trait = lunatic }
		reference = "gfx/interface/icons/event_types/type_stress.dds" # from mind_ouchie theme
	}
	left_portrait = {
		character = scope:suspicious
		triggered_animation = {
			trigger = {
				scope:suspicious = {
					dread_modified_ai_boldness = {
						dreaded_character = root
						value <= low_positive_ai_value
					}
				}
			}
			animation = sadness
		}
		animation = anger
	}

	trigger = {
		exists = scope:suspicious
	}

	immediate = {
		yearly_1080_confront_denial_effect = yes
	}

	#Ok
	option = {
		name = yearly.1085.a

		ai_chance = {
			base = 100
		}
	}

	# Apologize
	option = {
		name = yearly.1085.b

		reverse_add_opinion = {
			target = scope:suspicious
			modifier = pleased_opinion
			opinion = 10
		}

		add_prestige = minor_prestige_loss

		ai_chance = {
			base = 50

			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}

	#Imprison
	option = {
		name = yearly.1085.c

		imprison_character_effect = {
			TARGET = scope:suspicious
			IMPRISONER = root
		}

		ai_chance = {
			base = 0
			modifier = {
				yearly_1080_paranoid_trigger = yes
				add = 100
			}
		}
	}
}



# Paranoid confrontation: soothe
yearly.1086 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1080.t
	desc = yearly.1086.desc
	theme = mental_health
	left_portrait = {
		character = scope:suspicious
		animation = personality_compassionate
	}
	
	trigger = {
		exists = scope:suspicious
	}

	immediate = {
		yearly_1080_confront_soothe_effect = yes
	}

	#Ok
	option = {
		name = yearly.1086.a
		custom_tooltip = yearly.1082.a.tt
	}
}

### FOREIGN TRAVELER WISHES TO STAY AT YOUR COURT ###
scripted_trigger yearly_1090_foreign_traveler_trigger = {
	is_adult = yes
	NOR = {
		faith.religion = root.faith.religion
		has_same_culture_group_as = root
		has_trait = zealous
		has_trait = arrogant
	}
}

scripted_trigger yearly_1090_foreign_ruler_for_creation_trigger = {
	in_diplomatic_range = root
	NOR = {
		faith.religion = root.faith.religion
		has_same_culture_group_as = root
	}
}

scripted_effect yearly_1090_add_courtier_effect = {
	save_scope_as = new_courtier
	hidden_effect = { root = { add_courtier = scope:new_courtier } }
	custom_tooltip = yearly_1090_add_courtier_effect.tt
	add_opinion = {
		target = root
		modifier = grateful_opinion
		opinion = $OPINION$
	}
}

yearly.1090 = { #by Mathilda Bjarnehed
	type = character_event
	title = yearly.1090.t
	desc = {
		desc = yearly.1090.start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:traveler_family_1
					NOT = { exists = scope:traveler_family_2 }
				}
				desc = yearly.1090.family_member.desc
			}
			triggered_desc = {
				trigger = {
					exists = scope:traveler_family_1
					exists = scope:traveler_family_2
				}
				desc = yearly.1090.family.desc
			}
			desc = yearly.1090.alone.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:traveler_family_1 }
				desc = yearly.1090.family_stay.desc
			}
			desc = yearly.1090.alone_stay.desc	
		}
	}
	theme = crown
	override_background = {
		event_background = throne_room_west
	}
	left_portrait = {
		character = scope:traveler
		animation = beg
	}
	right_portrait = scope:traveler_family_1
	lower_center_portrait = scope:traveler_family_2
	lower_left_portrait = scope:traveler_family_3
	lower_right_portrait = scope:traveler_family_4

	trigger = {
		OR = {
			any_pool_character = {
				province = root.capital_province
				yearly_1090_foreign_traveler_trigger = yes
			}
			AND = {
				is_ai = no #Expensive so only for players
				any_independent_ruler = {
					yearly_1090_foreign_ruler_for_creation_trigger = yes
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			number_of_knights < max_number_of_knights
			add = 1
		}
	}

	immediate = {
		hidden_effect = {
			random_pool_character = {
				province = root.capital_province
				limit = { yearly_1090_foreign_traveler_trigger = yes }
				weight = {
					base = 10

					# Likes root
					compatibility_modifier = {
						compatibility_target = root
					}
					opinion_modifier = {
						opinion_target = root
					}
					ai_value_modifier = {
						ai_compassion = 0.5
						ai_zeal = -1
					}

					# Would be good candidate
					modifier = {
						guest_knight_candidate_trigger = { HOST = root }
						add = {
							value = prowess
							if = {
								limit = { number_of_knights < max_number_of_knights }
								multiply = 20
							}
							else = {
								multiply = 10
							}
						}
					}
					modifier = {
						guest_commander_candidate_trigger = { HOST = root }
						add = {
							value = martial
							multiply = 10
						}
					}
					modifier = {
						guest_vassal_candidate_good_traits_trigger = yes
						add = 50
					}
					modifier = {
						guest_physician_candidate_trigger = yes
						add = {
							value = learning
							multiply = 10
						}
					}
				}
				save_scope_as = traveler
			}

			#No such character? Let's make one
			if = {
				limit = { NOT = { exists = scope:traveler } }

				random_independent_ruler = {
					limit = { yearly_1090_foreign_ruler_for_creation_trigger = yes }
					save_scope_as = creation_template_ruler
				}

				random_list = {
					3 = {
						modifier = {
							number_of_knights < max_number_of_knights
							add = 10
						}
						create_character = {
							location = root.capital_province
							template = pool_repopulate_prowess
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
					}
					1 = {
						create_character = {
							location = root.capital_province
							template = pool_repopulate_diplomacy
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
					}
					1 = {
						create_character = {
							location = root.capital_province
							template = pool_repopulate_stewardship
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
					}
					1 = {
						create_character = {
							location = root.capital_province
							template = pool_repopulate_intrigue
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
					}
					1 = {
						create_character = {
							location = root.capital_province
							template = pool_repopulate_learning
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
					}
					1 = {
						create_character = {
							location = root.capital_province
							template = pool_repopulate_spouse
							culture = scope:creation_template_ruler.culture
							faith = scope:creation_template_ruler.faith
							save_scope_as = traveler
						}
						save_scope_value_as = {
							name = create_family_blocker
							value = yes
						}
					}
				}

				if = {
					limit = {
						NOT = { exists = scope:create_family_blocker }
						exists = scope:traveler # They will exist, but we do this to suppress errors for newly created characters not existing while trigger tooltips are generating
					}
					game_rule_create_spouse_and_children = { CHARACTER = scope:traveler }
				}
			}

			if = {
				limit = { exists = scope:traveler } # They will exist, but we do this to suppress errors for newly created characters not existing while trigger tooltips are generating
				
				# Do they have a traveling family?
				scope:traveler = {
					random_traveling_family_member = {
						limit = { is_spouse_of = prev }
						alternative_limit = { NOT = { this = scope:traveler } }
						save_scope_as = traveler_family_1
					}
					if = {
						limit = { exists = scope:traveler_family_1 }
						random_traveling_family_member = {
							limit = {
								NOR = {
									this = scope:traveler_family_1
									this = scope:traveler
								}
							}
							save_scope_as = traveler_family_2
						}
					}
					if = {
						limit = { exists = scope:traveler_family_2 }
						random_traveling_family_member = {
							limit = {
								NOR = {
									this = scope:traveler_family_1
									this = scope:traveler_family_2
									this = scope:traveler
								}
							}
							save_scope_as = traveler_family_3
						}
					}
					if = {
						limit = { exists = scope:traveler_family_3 }
						random_traveling_family_member = {
							limit = {
								NOR = {
									this = scope:traveler_family_1
									this = scope:traveler_family_2
									this = scope:traveler_family_3
									this = scope:traveler
								}
							}
							save_scope_as = traveler_family_4
						}
					}
				}
			}
		}
	}

	# You may stay, if you convert
	option = {
		name = yearly.1090.a
		
		if = {
			limit = {
				can_add_hook = {
					target = scope:traveler
					type = favor_hook
				}
			}
			add_hook = {
				target = scope:traveler
				type = favor_hook
			}
		}

		scope:traveler = {
			if = {
				limit = { exists = scope:traveler_family_1 }
					every_traveling_family_member = {
						custom = yearly.1090.travelers_family
						yearly_1090_add_courtier_effect = { OPINION = 20 }
						set_character_faith = root.faith
					}
			}
			else = {
				yearly_1090_add_courtier_effect = { OPINION = 20 }
				set_character_faith = root.faith
			}
		}

			stress_impact = {
				paranoid = medium_stress_impact_gain
				callous = minor_stress_impact_gain
				sadistic = medium_stress_impact_gain
			}

			hidden_effect = {
				if = {
					limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:traveler } }
					set_relation_potential_friend = scope:traveler
				}
			}

			ai_chance = {
				base = 100

				ai_value_modifier = {
					ai_compassion = 1
					ai_honor = 1
					min = -90
				}
			}
	}

	# All is welcome here!
	option = {
		name = yearly.1090.b
			
		if = {
			limit = {
				can_add_hook = {
					target = scope:traveler
					type = loyalty_hook
				}
			}
			add_hook = {
				target = scope:traveler
				type = loyalty_hook
			}
		}
			
		scope:traveler = {
			if = {
				limit = { exists = scope:traveler_family_1 }
					every_traveling_family_member = {
						custom = yearly.1090.travelers_family
						yearly_1090_add_courtier_effect = { OPINION = 50 }
					}
			}
			else = {
				yearly_1090_add_courtier_effect = { OPINION = 50 }
			}
		}

			if = {
				limit = {
					exists = cp:councillor_court_chaplain
					cp:councillor_court_chaplain = { ai_zeal >= 0 }
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value >= faith_astray_level
					}
				}
				}
				reverse_add_opinion = {
					target = cp:councillor_court_chaplain
					modifier = impious_opinion
					opinion = -10
				}
			}

			stress_impact = {
				paranoid = medium_stress_impact_gain
				callous = minor_stress_impact_gain
				sadistic = medium_stress_impact_gain
				zealous = major_stress_impact_gain
			}


			hidden_effect = {
				if = {
					limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:traveler } }
					set_relation_potential_friend = scope:traveler
				}
			}

			ai_chance = {
				base = 50

				ai_value_modifier = {
					ai_compassion = 1
					ai_honor = 1
					ai_zeal = -2
					min = -45
				}
				modifier = {
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value = faith_hostile_level
					}
				}
				add = -50
				}
				modifier = {
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value = faith_evil_level
					}
				}
				add = -100
				}
			}
	}
	
	# I have no room for you
	option = {
		name = yearly.1090.c

		stress_impact = {
				compassionate = medium_stress_impact_gain
				generous = medium_stress_impact_gain
				gregarious = minor_stress_impact_gain
			}

			ai_chance = {
				base = 50
				ai_value_modifier = {
					ai_compassion = -1
					ai_honor = -1
				}
				modifier = {
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value = faith_astray_level
					}
				}
				add = 50
				}
				modifier = {
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value = faith_hostile_level
					}
				}
				add = 100
				}
				modifier = {
					faith = {
					faith_hostility_level = {
						target = scope:traveler.faith
						value = faith_evil_level
					}
				}
				add = 200
				}
			}
	}
}
