

namespace = court_ongoing


# ONGOING MANAGEMENT
# court_ongoing.0001 - Generic "player target opted out"-event

# START EVENTS
# court_ongoing.0500 -

# ONGOING EVENTS
# court_ongoing.1000 - Someone farted!
# court_ongoing.1010 - Defend their honor through duel or diplomacy
# court_ongoing.1020 - Fetch gift
# court_ongoing.1022 - Gift: Wolf pelt
# court_ongoing.1030 - Gift: cat or dog or eagle
# court_ongoing.1040 - Gift: necklace
# court_ongoing.1050 - Gift: flower
# court_ongoing.1100 - Compliment poem
# court_ongoing.1110 - Dealing with competition
# court_ongoing.1120 - Boring party guest
# court_ongoing.1200 - Extreme request



######################
# ONGOING MANAGEMENT #
######################

#Generic "player target opted out"-event
court_ongoing.0001 = { #by Linnéa Thimrén
	type = character_event
	title = court_ongoing.0001.t
	desc = court_ongoing.0001.desc
	
	theme = romance_scheme
	left_portrait = scope:target

	option = {
		name = court_ongoing.0001.a
		
		scope:scheme = { end_scheme = yes }
	}
}


################
# START EVENTS #
################

#Pick a method
scripted_effect court_ongoing_0501_option_randomizer_effect = {
	random_list = {
		10 = { #Song
			trigger = {
				NOR = {
					has_character_flag = court_start_song
					#Nothing shunned/criminal, as song text is public and explicitly about love
					court_love_is_shunned_or_criminal_trigger = yes
				}
			}
			modifier = {
				add = {
					value = diplomacy
					multiply = 10
				}
			}
			add_character_flag = court_start_song
		}
		10 = { #Sneaky love letter
			trigger = { NOT = { has_character_flag = court_start_sneaky_love_letter } }
			modifier = {
				add = {
					value = intrigue
					multiply = 10
				}
			}
			add_character_flag = court_start_sneaky_love_letter
		}
		10 = { #Poem love letter
			trigger = { NOT = { has_character_flag = court_start_poem_love_letter } }
			modifier = {
				add = {
					value = learning
					multiply = 10
				}
			}
			add_character_flag = court_start_poem_love_letter
		}
		10 = { #Sparring
			trigger = {
				NOT = { has_character_flag = court_start_sparring }
				can_be_warrior_trigger = { ARMY_OWNER = root }
			}
			modifier = {
				add = {
					value = prowess
					multiply = 10
				}
			}
			add_character_flag = court_start_sparring
		}
	}
}

court_ongoing.0501 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.0501.t
	desc = court_ongoing.0501.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:target
		animation = personality_compassionate
		camera = camera_event_right_forward
	}

	cooldown = { years = 1 }

	trigger = {
		OR = {
			scope:owner = { is_ai = no }
			scope:target = { is_ai = no }
		}
	}
	
	immediate = {
		#Randomize options
		court_ongoing_0501_option_randomizer_effect = yes
		court_ongoing_0501_option_randomizer_effect = yes
		court_ongoing_0501_option_randomizer_effect = yes
	}

	#Song
	option = {
		trigger = { has_character_flag = court_start_song }
		name = court_ongoing.0501.a
		custom_tooltip = court_ongoing.0501.tt
		save_scope_value_as = {
			name = starting_event_flavor
			value = flag:court_start_song
		}

		ai_chance = {
			base = 1
			modifier = {
				add = { value = diplomacy }
			}
		}
	}

	#sneaky love letter
	option = {
		trigger = { has_character_flag = court_start_sneaky_love_letter }
		name = court_ongoing.0501.b
		custom_tooltip = court_ongoing.0501.tt
		save_scope_value_as = {
			name = starting_event_flavor
			value = flag:court_start_sneaky_love_letter
		}

		ai_chance = {
			base = 1
			modifier = {
				add = { value = intrigue }
			}
		}
	}
	
	#poem love letter
	option = {
		trigger = { has_character_flag = court_start_poem_love_letter }
		name = court_ongoing.0501.c
		custom_tooltip = court_ongoing.0501.tt
		save_scope_value_as = {
			name = starting_event_flavor
			value = flag:court_start_poem_love_letter
		}
		ai_chance = {
			base = 1
			modifier = {
				add = { value = learning }
			}
		}
	}

	#drill
	option = {
		trigger = { has_character_flag = court_start_sparring }
		name = court_ongoing.0501.d
		custom_tooltip = court_ongoing.0501.tt
		save_scope_value_as = {
			name = starting_event_flavor
			value = flag:court_start_sparring
		}
		ai_chance = {
			base = 1
			modifier = {
				add = { value = prowess }
			}
		}
	}

	#go with the flow
	option = {
		name = court_ongoing.0501.x
		custom_tooltip = court_ongoing.0501.tt

		hidden_effect = {
			random_list = {
				1 = {
					trigger = { #Nothing shunned/criminal, as song text is public and explicitly about love
						court_love_is_shunned_or_criminal_trigger = no
					}
					save_scope_value_as = {
						name = starting_event_flavor
						value = flag:court_start_song
					}
				}
				1 = {
					save_scope_value_as = {
						name = starting_event_flavor
						value = flag:court_start_sneaky_love_letter
					}
				}
				1 = {
					save_scope_value_as = {
						name = starting_event_flavor
						value = flag:court_start_poem_love_letter
					}
				}
				1 = {
					save_scope_value_as = {
						name = starting_event_flavor
						value = flag:court_start_sparring
					}
				}
			}
		}
	}

	after = {
		remove_character_flag = court_start_song
		remove_character_flag = court_start_sneaky_love_letter
		remove_character_flag = court_start_poem_love_letter
		remove_character_flag = court_start_sparring
		if = {
			limit = {
				exists = scope:starting_event_flavor
				scope:starting_event_flavor = flag:court_start_poem_love_letter
			}
			scope:target = { trigger_event = court_ongoing.0512 }
		}
		else = {
			scope:target = { trigger_event = court_ongoing.0502 }
		}
	}
}



#Start narrative event for target (for everything but love poem)
court_ongoing.0502 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.0502.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_song }
				desc = {
					desc = court_ongoing.court_start_song.start.0502.desc
					first_valid = {
						triggered_desc = {
							trigger = { scope:owner.diplomacy < mediocre_skill_rating }
							desc = court_ongoing.court_start_song.bad.0502.desc
						}
						desc = court_ongoing.court_start_song.good.0502.desc
					}
				}
			}
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_sneaky_love_letter }
				desc = {
					desc = court_ongoing.court_start_sneaky_love_letter.start.0502.desc
					first_valid = {
						triggered_desc = {
							trigger = { is_close_or_extended_family_of = scope:owner }
							desc = court_ongoing.court_start_sneaky_love_letter.relative.0502.desc
						}
						desc = court_ongoing.court_start_sneaky_love_letter.compliment.0502.desc
					}
					desc = court_ongoing.court_start_sneaky_love_letter.end.0502.desc
				}
			}
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_sparring }
				desc = {
					desc = court_ongoing.court_start_sparring.start.0502.desc
					first_valid = {
						triggered_desc = {
							trigger = { scope:owner.prowess < mediocre_skill_rating }
							desc = court_ongoing.court_start_sparring.bad.0502.desc
						}
						triggered_desc = {
							trigger = { scope:owner.prowess < high_skill_rating }
							desc = court_ongoing.court_start_sparring.good.0502.desc
						}
						desc = court_ongoing.court_start_sparring.great.0502.desc
					}
					desc = court_ongoing.court_start_sparring.end.0502.desc
				}
			}
		}
	}
	
	theme = romance_scheme
	override_background = {
		trigger = { is_travelling = yes }
		reference = terrain_travel
	}
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_sparring }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_sneaky_love_letter }
		reference = sitting_room
	}
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_song }
		reference = garden
	}
	left_portrait = {
		character = scope:owner
		triggered_animation = {
			trigger = {
				OR = {
					scope:starting_event_flavor = flag:court_start_song
					scope:starting_event_flavor = flag:court_start_sparring
				}
			}
			animation = flirtation
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = idle
		}
	}

	trigger = {
		exists = scope:scheme
		scope:scheme = {
			scheme_type = courting 
		}
	}

	immediate = {
		#Stuff for the desc
		if = {
			limit = { scope:starting_event_flavor = flag:court_start_sparring }
			scope:owner = { set_signature_weapon_effect = yes }
		}
	}

	#How delightful! Yes please
	option = {
		name = court_ongoing.0502.a
		custom_tooltip = court_ongoing.0502.a.tt

		# If you already have a soulmate, they get very mad
		every_relation = {
			type = soulmate
			limit = { soulmate_relation_is_exclusive_trigger = yes }
			add_opinion = {
				modifier = betrayed_our_promise
				target = root
			}
		}

		ai_chance = {
			base = 100

			incest_acceptance_modifier = { #Factor between 1 and 0
				SEDUCER = scope:owner
				TARGET = scope:target
			}
			modifier = {
				num_of_relation_soulmate = 1
				factor = {
					value = 0
					add = {
						value = ai_honor
						multiply = -0.005 # 0.5 at -100
					}
					add = {
						value = ai_compassion
						multiply = -0.005 # 0.5 at -100
					}
					if = {
						limit = {
							has_trait = lustful
						}
						add = 0.2
					}
					min = 0
					max = 1
				}
			}
			
			modifier = {
				has_relation_lover = scope:owner
				add = 1000
			}	
		}	
	}

	#Ew, no!
	option = {
		name = {
			trigger = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
			text = court_ongoing.0502.b.incest
		}
		name = {
			trigger = { NOT = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } } }
			text = court_ongoing.0502.b
		}

		save_scope_value_as = {
			name = hard_court_reject
			value = yes
		}

		show_as_tooltip = {
			scope:scheme = { end_scheme = yes }
		}

		ai_chance = {
			base = 0

			modifier = {
				is_close_or_extended_family_of = scope:owner
				add = 50
			}
			modifier = {
				relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner }
				add = 200
			}
			modifier = {
				relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner }
				add = 200
			}
			modifier = {
				has_relation_rival = scope:owner
				add = 200
			}
			modifier = {
				has_relation_lover = scope:owner
				factor = 0.01
			}
		}
	}

	after = {
		scope:owner = { trigger_event = court_ongoing.0503 }
	}
}		


#Start narrative event for target (love poem)
court_ongoing.0512 = {
	type = letter_event
	opening = court_ongoing.1101.t
	desc = court_ongoing.court_start_poem_love_letter.0502.desc
	sender = {
		character = scope:owner
		animation = flirtation
	}

	immediate = {
		scope:owner = { love_letter_calculation_effect = yes }
	}
	

	#How delightful! Yes please
	option = {
		name = court_ongoing.0502.a
		custom_tooltip = court_ongoing.0502.a.tt

		ai_chance = {
			base = 100

			incest_acceptance_modifier = { #Factor between 1 and 0
				SEDUCER = scope:owner
				TARGET = scope:target
			}
			modifier = {
				num_of_relation_soulmate = 1
				factor = {
					value = 0
					add = {
						value = ai_honor
						multiply = -0.005 # 0.5 at -100
					}
					add = {
						value = ai_compassion
						multiply = -0.005 # 0.5 at -100
					}
					if = {
						limit = {
							has_trait = lustful
						}
						add = 0.2
					}
					min = 0
					max = 1
				}
			}
			
			modifier = {
				has_relation_lover = scope:owner
				add = 1000
			}				
		}
	}

	#Ew, no!
	option = {
		name = {
			trigger = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
			text = court_ongoing.0502.b.incest
		}
		name = {
			trigger = { NOT = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } } }
			text = court_ongoing.0502.b
		}

		save_scope_value_as = {
			name = hard_court_reject
			value = yes
		}

		show_as_tooltip = {
			scope:scheme = { end_scheme = yes }
		}

		ai_chance = {
			base = 0

			modifier = {
				relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner }
				add = {
					if = {
						limit = { sexually_liberal_trigger = yes }
						value = 200
					}
					else = {
						value = 500
					}
				}
			}
			modifier = {
				relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner }
				add = 200
			}
			modifier = {
				has_relation_rival = scope:owner
				add = 200
			}
			modifier = {
				has_relation_lover = scope:owner
				factor = 0.01
			}
		}
	}

	after = {
		scope:owner = { trigger_event = court_ongoing.0503 }
	}
}

#Start narrative event for owner
court_ongoing.0503 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.0501.t
	desc = {
		first_valid = {
			#SONG
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_song }
				desc = {
					desc = court_ongoing.court_start_song.intro.0503.desc
					first_valid = {
						triggered_desc = {
							trigger = { #Sodomy reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.public_sodomy_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Incest reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.public_incest_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Regular reject
								exists = scope:hard_court_reject
							}
							desc = court_ongoing.public_regular_rejection.0503.desc
						}
						desc = court_ongoing.court_start_song.success.0503.desc
					}
				}
			}
			#SNEAKY LOVE LETTER
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_sneaky_love_letter }
				desc = {
					desc = court_ongoing.court_start_sneaky_love_letter.intro.0503.desc
					first_valid = {
						triggered_desc = {
							trigger = { #Sodomy reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.written_sodomy_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Incest reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.written_incest_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Regular reject
								exists = scope:hard_court_reject
							}
							desc = court_ongoing.written_regular_rejection.0503.desc
						}
						desc = court_ongoing.court_start_sneaky_love_letter.success.0503.desc
					}
				}
			}
			#LOVE POEM
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_poem_love_letter }
				desc = {
					desc = court_ongoing.court_start_poem_love_letter.intro.0503.desc
					first_valid = {
						triggered_desc = {
							trigger = { #Sodomy reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.written_sodomy_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Incest reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.written_incest_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Regular reject
								exists = scope:hard_court_reject
							}
							desc = court_ongoing.written_regular_rejection.0503.desc
						}
						desc = court_ongoing.court_start_sneaky_love_letter.success.0503.desc
					}
				}
			}
			#DRILL
			triggered_desc = {
				trigger = { scope:starting_event_flavor = flag:court_start_sparring }
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = { location = scope:target.location }
							desc = court_ongoing.court_start_sparring.same_locaton_intro.0503.desc
						}
						desc = court_ongoing.court_start_sparring.other_locaton_intro.0503.desc
					}
					first_valid = {
						triggered_desc = {
							trigger = { #Sodomy reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_sodomy_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.public_sodomy_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Incest reject
								exists = scope:hard_court_reject
								scope:target = { relation_with_character_is_incestuous_in_my_or_lieges_faith_trigger = { CHARACTER = scope:owner } }
								NOT = { scope:owner = { has_relation_lover = scope:target } }
								NOT = { scope:owner = { is_spouse_of = scope:target } }
							}
							desc = court_ongoing.public_incest_rejection.0503.desc
						}
						triggered_desc = {
							trigger = { #Regular reject
								exists = scope:hard_court_reject
							}
							desc = court_ongoing.public_regular_rejection.0503.desc
						}
						desc = court_ongoing.court_start_sparring.success.0503.desc
					}
				}
			}
		}
	}
	
	theme = romance_scheme
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_sparring }
		reference = courtyard
	}
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_sneaky_love_letter }
		reference = sitting_room
	}
	override_background = {
		trigger = { scope:starting_event_flavor = flag:court_start_song }
		reference = garden
	}
	left_portrait = {
		character = root
		animation = storyteller
	}
	right_portrait = {
		character = scope:target
		animation = admiration
	}

	immediate = {
		scope:target.location = { save_scope_as = target_location }
		#Stuff for the desc
		if = {
			limit = { scope:starting_event_flavor = flag:court_start_sparring }
			random_dummy_gender_soldier_effect = { SCOPE_NAME = sparring_soldier }
		}
	}

	option = {
		trigger = { NOT = { exists = scope:hard_court_reject } }
		name = court_ongoing.0503.a
		custom_tooltip = court_ongoing.0503.a.tt

	}

	option = {
		trigger = { exists = scope:hard_court_reject }
		name = court_ongoing.0503.b

		end_court_scheme_effect = { OUTCOME = failure_hard REASON = saved_from_wolf }
	}

	after = {
		if = {
			limit = {
				scope:starting_event_flavor = flag:court_start_poem_love_letter
			}
			remove_variable = love_letter_quality
		}
	}
}


##################
# ONGOING EVENTS #
##################

####################################
###SAVE TARGET FROM FART SHAME <3###
####################################
#court_ongoing.1000 = { #by Mathilda Bjarnehed
#	type = character_event
#	title = court_ongoing.1000.t
#	desc = court_ongoing.1000.desc
#	
#	theme = romance_scheme
#	left_portrait = scope:target
#	right_portrait = scope:scapegoat
#	widget = {
#		gui = "event_window_widget_scheme"
#		container = "custom_widgets_container"
#	}
#	
#	trigger = {
#		exists = scope:target.court_owner
#		# Account for landless court owners.
#		scope:target.court_owner = { is_landed = yes }
#		NOT = {
#			scope:scheme = {
#				has_scheme_modifier = courting_kindness_modifier
#			}
#		}
#	}
#
#	weight_multiplier = {
#		base = 1
#		modifier = {
#			exists = scope:scheme.var:court_milestone_event
#			add = { #0 at milestone 1, -0.45 at milestone 2, -0.9 at milestone 3
#				value = scope:scheme.var:court_milestone_event
#				multiply = -0.45
#				add = 0.45
#			}
#		}
#	}
#
#	immediate = {
#		#Savin' some scopes
#		scope:target = {
#			if = {
#				limit = { is_ruler = no }
#				court_owner = { save_scope_as = scapegoat }
#			}
#			else_if = {
#				limit = { exists = primary_spouse }
#				primary_spouse = { save_scope_as = scapegoat }
#			}
#
#			court_owner.capital_province = { save_scope_as = location }
#		}
#	}
#
#	#It was me!
#	option = {
#		name = court_ongoing.1000.a
#
#		add_prestige = medium_prestige_loss
#
#		random_list = {
#			67 = {
#				desc = court_ongoing.1000.a.success
#				send_interface_toast = {
#					left_icon = scope:target
#					title = court_ongoing.1000.a.success
#					reverse_add_opinion = {
#						target = scope:target
#						modifier = grateful_opinion
#						opinion = 15
#					}
#					scope:scheme = {
#						add_scheme_modifier = {
#							type = courting_kindness_modifier
#						}
#					}
#				}
#			}
#			33 = {
#				desc = court_ongoing.1000.a.failure
#				send_interface_toast = {
#					left_icon = scope:target
#					title = court_ongoing.1000.a.failure
#					reverse_add_opinion = {
#						target = scope:target
#						modifier = disgusted_opinion
#						opinion = -10
#					}
#				}
#			}
#		}
#
#		stress_impact = {
#			craven = minor_stress_impact_gain
#			gregarious = minor_stress_impact_gain
#			arrogant = minor_stress_impact_gain
#			shy = minor_stress_impact_gain
#		}
#	}
#
#	#It was this other dude!
#	option = {
#		trigger = {
#			exists = scope:scapegoat
#			this != scope:scapegoat
#		}
#		name = court_ongoing.1000.b
#
#		reverse_add_opinion = {
#			target = scope:target
#			modifier = amused_opinion
#			opinion = 15
#		}
#		reverse_add_opinion = {
#			target = scope:scapegoat
#			modifier = insulted_opinion
#			opinion = -15
#		}
#
#		stress_impact = {
#			compassionate = minor_stress_impact_gain
#			honest = minor_stress_impact_gain
#		}
#	}
#	
#	#Don't do anything
#	option = {
#		name = court_ongoing.1000.c
#
#		stress_impact = {
#			brave = minor_stress_impact_gain
#			compassionate = minor_stress_impact_gain
#			deceitful = minor_stress_impact_gain
#		}
#	}
#}


###DEFEND THEIR HONOR###
scripted_trigger court_ongoing_1010_insulter_trigger = {
	save_temporary_scope_as = potential_insulter
	basic_is_available_ai = yes
	is_adult = yes
	exists = liege
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:potential_insulter.liege }
	this != scope:target
	OR = {
		opinion = {
			target = scope:target
			value <= neutral_opinion
		}
		AND = {
			opinion = {
				target = scope:target
				value <= low_positive_opinion
			}
			number_of_opposing_traits = {
				target = scope:target
				value >= 1
			}
		}
	}
}

court_ongoing.1010 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1010.t
	desc = court_ongoing.1010.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:insulter
		animation = manic
	}
	lower_right_portrait = scope:target
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	cooldown = { years = 1 }
	
	trigger = {
		NOR = {
			has_trait_rank = {
				trait = wounded
				rank >= 2
			}
			scope:scheme = {
				has_scheme_modifier = courting_act_of_heroism_modifier
			}
		}
		scope:target = {
			OR = {
				AND = {
					court_owner ?= {
						OR = {
							any_courtier = { court_ongoing_1010_insulter_trigger = yes }
							any_vassal = { court_ongoing_1010_insulter_trigger = yes }
						}
					}
				}
				any_relation = { type = rival court_ongoing_1010_insulter_trigger = yes }
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {	
			scope:scheme.var:court_milestone_event = 1
			add = -0.75
		}
	}

	immediate = {
		scope:target = {
			if = {
				limit = { root = { is_ai = no }	}
				assign_quirk_effect = yes
			}
			court_owner = {
				every_vassal = {
					limit = { court_ongoing_1010_insulter_trigger = yes }
					add_to_list = insulter_list
				}
				every_courtier = {
					limit = { court_ongoing_1010_insulter_trigger = yes }
					add_to_list = insulter_list
				}
			}
			every_relation = { type = rival
				limit = { court_ongoing_1010_insulter_trigger = yes }
				add_to_list = insulter_list
			}

			random_in_list = {
				list = insulter_list
				weight = {
					base = 1
					modifier = {
						is_ruler = yes
						add = 10
					}
					ai_value_modifier = {
						ai_compassion = { #20 for high negative compassion, -20 for high positive compassion
							value = high_negative_ai_value_inverse
							multiply = 20
						}
					}
					opinion_modifier = {
						opinion_target = scope:target
						multiplier = -0.3
					}
				}
				save_scope_as = insulter
			}
		}
	}


	#Duel them!
	option = {
		name = court_ongoing.1010.a

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

		duel = {
			skill = prowess
			target = scope:insulter
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.1
				}
				desc = court_ongoing.1010.a.success
				show_as_tooltip = { court_ongoing_1010_good_duel_outcome_effect = yes }
				trigger_event = {
					days = 1
					id = court_ongoing.1011
				}
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.1
				}
				desc = court_ongoing.1010.a.failure
				send_interface_toast = {
					title = court_ongoing.1010.a.failure
					left_icon = scope:insulter
					right_icon = scope:target

					add_prestige = medium_prestige_loss
					increase_wounds_no_death_effect = { REASON = duel }
					reverse_add_opinion = {
						target = scope:target
						modifier = pity_opinion
						opinion = 15
					}
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
			calm = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50

			ai_boldness_target_modifier = { VALUE = 40 }
			ai_energy_target_modifier = { VALUE = 20 }
			ai_vengefulness_target_modifier = { VALUE = 20 }
		}
	}

	#Convince them to apologize
	option = {
		name = court_ongoing.1010.b

		duel = {
			skill = diplomacy
			target = scope:insulter
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.1
				}
				desc = court_ongoing.1010.b.success
				send_interface_toast = {
					title = court_ongoing.1010.b.success
					left_icon = scope:insulter
					right_icon = scope:target

					reverse_add_opinion = {
						target = scope:target
						modifier = grateful_opinion
						opinion = 15
					}
					reverse_add_opinion = {
						target = scope:insulter
						modifier = respect_opinion
						opinion = 15
					}
				}
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.1
				}
				desc = court_ongoing.1010.b.failure
				send_interface_toast = {
					title = court_ongoing.1010.b.failure
					left_icon = scope:insulter
					right_icon = scope:target

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

		stress_impact = {
			wrathful = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_compassion_target_modifier = { VALUE = 30 }
			ai_vengefulness_target_modifier = { VALUE = -30 }
			ai_boldness_target_modifier = { VALUE = -30 }
		}
	}
	
	#Say a kind word
	option = {
		name = court_ongoing.1010.c

		reverse_add_opinion = {
			target = scope:target
			modifier = kindness_opinion
			opinion = 15
		}

		stress_impact = {
			wrathful = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50

			ai_compassion_target_modifier = { VALUE = 50 }
			ai_vengefulness_target_modifier = { VALUE = -30 }
			ai_boldness_target_modifier = { VALUE = -50 }
		}
	}
}

#You won the duel! Go you!
court_ongoing.1011 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1010.t
	desc = court_ongoing.1011.desc
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:target
		animation = flirtation_left
	}
	lower_right_portrait = scope:insulter
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	option = {
		name = court_ongoing.1011.a
		court_ongoing_1010_good_duel_outcome_effect = yes
	}
}



###FETCH GIFT###
scripted_trigger court_ongoing_1020_necklace_owner_trigger = {
	sex_same_as = scope:target
	basic_is_available_ai = yes
	NOR = {
		is_spouse_of = scope:target
		this = scope:target
		this = scope:owner
	}
}

scripted_effect court_ongoing_1020_save_necklace_owner_effect = {
	scope:target = {
		if = {
			limit = { exists = liege }
			liege = {
				every_spouse = {
					limit = { court_ongoing_1020_necklace_owner_trigger = yes }
					add_to_temporary_list = necklace_owner_list
				}
				every_powerful_vassal = {
					if = {
						limit = { court_ongoing_1020_necklace_owner_trigger = yes }
						add_to_temporary_list = necklace_owner_list
					}
					every_spouse = {
						limit = { court_ongoing_1020_necklace_owner_trigger = yes }
						add_to_temporary_list = necklace_owner_list
					}
				}
			}
			random_in_list = {
				list = necklace_owner_list
				save_scope_as = necklace_owner
			}
		}
	}
}

scripted_trigger court_ongoing_1020_necklace_option_trigger = {
	exists = scope:target.liege
	scope:target.liege = {
		OR = {
			any_spouse = {
				court_ongoing_1020_necklace_owner_trigger = yes
			}
			any_powerful_vassal = {
				OR = {
					court_ongoing_1020_necklace_owner_trigger = yes
					any_spouse = { court_ongoing_1020_necklace_owner_trigger = yes }
				}
			}
		}
	}
}

court_ongoing.1020 = {
	hidden = yes

	trigger = {
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_gift_modifier
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			scope:scheme.var:court_milestone_event >= 3
			add = -0.75
		}
	}

	immediate = {
		#Lets a player target chose gift or randomizes one for ai targets
		if = {
			limit = { scope:target = { is_ai = no } }
			scope:target = { trigger_event = court_ongoing.1021 }
		}
		else = {
			random_list = {
				#Wolf pelt
				2 = {
					trigger = {
						scope:target = { NOT = { has_character_flag = court_ongoing_wolf_pelt_flag } }
						#Target will not request a pregnant woman to go hunting unless they allow women to be combatants
						OR = {
							NOT = { has_trait = pregnant }
							AND = {
								has_trait = pregnant
								can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target }
							}
						}
					}
					trigger_event = court_ongoing.1022
					scope:target = { add_character_flag = court_ongoing_wolf_pelt_flag }
				}
				#Cat or dog or eagle
				1 = {
					trigger = {
						scope:target = {
							NOR = {
								has_character_modifier = cat_story_modifier
								has_character_modifier = dog_story_modifier
								AND = {
									has_character_modifier = eagle_story_modifier 
									location = { geographical_region = world_steppe }
								}
							}
						}
					}
					trigger_event = court_ongoing.1030
				}
				#Necklace
				3 = { #Higher to compensate for trigger
					trigger = {
						court_ongoing_1020_necklace_option_trigger = yes
						scope:target = { NOT = { has_character_flag = court_ongoing_necklace_flag } }
					}
					trigger_event = court_ongoing.1040
					scope:target = { add_character_flag = court_ongoing_necklace_flag }
				}
				#Orchid
				2 = {
					trigger = { scope:target = { NOT = { has_character_flag = court_ongoing_orchid_flag } } }
					trigger_event = court_ongoing.1050
					scope:target = { add_character_flag = court_ongoing_orchid_flag }	
				}
			}
		}
	}
}



#Player target picks gift
scripted_effect court_ongoing_1021_save_gift_option_effect = {
	random_list = {
		10 = { #Wolf pelt
			trigger = {
				NOR = {
					has_character_flag = court_ongoing_wolf_pelt_flag
					exists = scope:court_ongoing_1021_wolf_pelt_option
				}
				#Cannot request a pregnant woman to go hunting unless the target's faith allow women to be combatants
				OR = {
					scope:owner = { NOT = { has_trait = pregnant } }

					scope:owner = {
						AND = {
							has_trait = pregnant
							can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:target }
						}
					}
				}
			}
			save_scope_value_as = {
				name = court_ongoing_1021_wolf_pelt_option
				value = yes
			}
		}
		2 = { #Cat/dog/eagle
			trigger = {
				NOR = {
					any_owned_story = {
						type = story_cycle_pet_cat
					}
					any_owned_story = {
						type = story_cycle_pet_dog
					}
					AND = {
						any_owned_story = {
							story_type = story_cycle_pet_eagle
						}	
						location = { geographical_region = world_steppe }
					}
					exists = scope:court_ongoing_1021_cat_dog_option
				}
			}
			save_scope_value_as = {
				name = court_ongoing_1021_cat_dog_option
				value = yes
			}
		}
		10 = { #Necklace
			trigger = {
				NOR = {
					has_character_flag = court_ongoing_necklace_flag
					exists = scope:court_ongoing_1021_necklace_gift_option
				}
				court_ongoing_1020_necklace_option_trigger = yes
			}
			save_scope_value_as = {
				name = court_ongoing_1021_necklace_gift_option
				value = yes
			}
			court_ongoing_1020_save_necklace_owner_effect = yes
		}
		10 = { #Orchid
			trigger = {
				NOR = {
					has_character_flag = court_ongoing_orchid_flag
					exists = scope:court_ongoing_1021_orchid_option
				}
			}
			save_scope_value_as = {
				name = court_ongoing_1021_orchid_option
				value = yes
			}
		}
	}
}

court_ongoing.1021 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1021.t
	desc = court_ongoing.1021.desc
	theme = romance_scheme
	left_portrait = {
		character = scope:target
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:owner
		animation = beg
	}
	cooldown = { years = 1 }
	
	immediate = {
		#What gift can you ask for (set 3 options)
		court_ongoing_1021_save_gift_option_effect = yes
		court_ongoing_1021_save_gift_option_effect = yes
		court_ongoing_1021_save_gift_option_effect = yes
	}

	#Wolf pelt
	option = {
		name = court_ongoing.1021.a
		trigger = { exists = scope:court_ongoing_1021_wolf_pelt_option }
		
		show_as_tooltip = {
			random_list = {
				1 = {
					show_chance = no
					desc = court_ongoing.1021.wolf_pelt.success
					court_ongoing_fetch_gift_modifier_effect = { GIFT = wolf_pelt }
				}
				1 = {
					show_chance = no
					desc = court_ongoing.1021.wolf_pelt.failure
				}
			}
		}

		hidden_effect = {
			scope:owner = { trigger_event = court_ongoing.1022 }
		}
	}

	#Cat/dog/eagle
	option = {
		trigger = { exists = scope:court_ongoing_1021_cat_dog_option }
		name = court_ongoing.1021.b

		show_as_tooltip = {
			random_list = {
				1 = {
					show_chance = no
					desc = court_ongoing.1021.cat_pet.success
					show_as_tooltip = { court_ongoing_1030_cat_modifier_effect = yes }
				}
				1 = {
					show_chance = no
					desc = court_ongoing.1021.dog_pet.success
					show_as_tooltip = { court_ongoing_1030_dog_modifier_effect = yes }
				}
				1 = {
					show_chance = no
					trigger = {
						location = { geographical_region = world_steppe }
					}
					desc = court_ongoing.1021.eagle_pet.success
					show_as_tooltip = { court_ongoing_1030_eagle_modifier_effect = yes }
				}
				1 = {
					show_chance = no
					desc = court_ongoing.1021.pet.failure
				}
			}
		}

		hidden_effect = {
			scope:owner = { trigger_event = court_ongoing.1030 }
		}
	}

	#Necklace
	option = {
		trigger = { exists = scope:court_ongoing_1021_necklace_gift_option }
		name = court_ongoing.1021.c
		show_as_tooltip = {
			random_list = {
				1 = {
					show_chance = no
					desc = court_ongoing.1021.necklace.success

					court_ongoing_fetch_gift_modifier_effect = { GIFT = necklace }
				}
				1 = {
					show_chance = no
					desc = court_ongoing.1021.necklace.failure
				}
			}
		}
		hidden_effect = {
			scope:owner = { trigger_event = court_ongoing.1040 }
		}
	}

	#Orchid
	option = {
		trigger = { exists = scope:court_ongoing_1021_orchid_option }
		name = court_ongoing.1021.d
		show_as_tooltip = {
			random_list = {
				1 = {
					show_chance = no
					desc = court_ongoing.1021.orchid.success

					court_ongoing_fetch_gift_modifier_effect = { GIFT = orchid }
				}
				1 = {
					show_chance = no
					desc = court_ongoing.1021.orchid.failure
				}
			}
		}
		hidden_effect = {
			scope:owner = { trigger_event = court_ongoing.1050 }
		}
	}

	#Stop pestering me!
	option = {
		name = court_ongoing.1021.x
		
		show_as_tooltip = { scope:scheme = { end_scheme = yes } }
		scope:owner = { trigger_event = court_ongoing.0001 }
	}
}

###GIFT: WOLF PELT###
court_ongoing.1022 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1022.t
	desc = {
		desc = court_ongoing.1022.start.desc
		desc = court_ongoing.1022.end.desc
	}
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = personality_callous
	}
	lower_left_portrait = {
		trigger = {
			exists = scope:master_of_hunt
		}
		character = scope:master_of_hunt
	}
	
	trigger = {
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_gift_modifier
			}
		}
	}

	immediate = {
		#Save Master of the Hunt 
		if = {
			limit = {
				employs_court_position = master_of_hunt_court_position
				any_court_position_holder = {
					type = master_of_hunt_court_position
					is_physically_able = yes
				}
			}
			random_court_position_holder = {
				type = master_of_hunt_court_position
				limit = { is_physically_able = yes }
				save_scope_as = master_of_hunt
			}
		}
		
	}

	#Hunt down a wolf
	option = {
		name = court_ongoing.1022.a

		duel = {
			skill = prowess
			value = medium_skill_rating
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.1
				}
				modifier = {
					has_trait = lifestyle_hunter
					add = 2
				}
				desc = court_ongoing.1022.a.success
				send_interface_toast = {
					title = court_ongoing.1022.a.success
					left_icon = scope:target

					scope:scheme = {
						add_scheme_modifier = {
							type = courting_gift_modifier
						}
					}
				}
				court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = success }
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.1
				}
				desc = court_ongoing.1022.a.failure
				send_interface_toast = {
					title = court_ongoing.1022.a.failure
					left_icon = scope:target
					
					add_prestige = minor_prestige_loss
				}
				court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = failure }
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_honor_target_modifier = { VALUE = 40 }
			ai_boldness_target_modifier = { VALUE = 40 }
			ai_energy_target_modifier = { VALUE = 20 }
			ai_vengefulness_target_modifier = { VALUE = 20 }
		}
	}

	#Kill a dog in the kennels
	option = {
		trigger = {
			OR = {
				intrigue >= decent_skill_rating
				has_trait = deceitful
			}
		}
		skill = intrigue
		trait = deceitful
		name = court_ongoing.1022.b

		duel = {
			skill = intrigue
			target = scope:target
			30 = { #You trick them
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.1
				}
				desc = court_ongoing.1022.b.success
				send_interface_toast = {
					title = court_ongoing.1022.b.success
					left_icon = scope:target

					scope:scheme = {
						add_scheme_modifier = {
							type = courting_gift_modifier
						}
					}
				}
				court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = success }
			}
			20 = { #They know what you did
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.1
				}
				desc = court_ongoing.1022.b.failure

				show_as_tooltip = {
					reverse_add_opinion = {
						modifier = suspicion_opinion
						target = scope:target
						opinion = -10
					}
				}

				hidden_effect = {
					random_list = {
						85 = {
							send_interface_toast = {
								title = court_ongoing.1022.b.failure
								left_icon = scope:target

								reverse_add_opinion = {
									modifier = suspicion_opinion
									target = scope:target
									opinion = -10
								}
							}
							court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = failure }
						}
						15 = {
							modifier = {
								scope:target = { ai_compassion >= 0 }
								add = {
									value = scope:target.ai_compassion
									multiply = 2
								}
							}
							scope:target = {
								trigger_event = {
									id = court_ongoing.1023
									days = 3
								}
							}
						}
					}
				}
				
			}
		}

		stress_impact = {
			honest = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_honor_target_modifier = { VALUE = -100 }
			ai_energy_target_modifier = { VALUE = -20 }
			ai_compassion_target_modifier = { VALUE = -50 }
		}
	}


	#Buy a pelt
	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
			NOT = { exists = scope:master_of_hunt }
		}
		name = court_ongoing.1022.c

		remove_short_term_gold = minor_gold_value

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = success }

		ai_chance = {
			base = 100

			ai_greed_target_modifier = { VALUE = -80 }
			ai_energy_target_modifier = { VALUE = -20 }
			ai_honor_target_modifier = { VALUE = -20 }
		}
	} 

	#Buy a pelt; Master of the Hunt version
	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
			exists = scope:master_of_hunt
		}
		name = court_ongoing.1022.c.master_of_hunt

		scope:master_of_hunt = {
			duel = {
				skill = martial
				value = average_skill_rating
				30 = {
					desc = court_ongoing.1022.c.master_of_hunt.success
					compare_modifier = {
						value = scope:duel_value
						multiplier = 0.5
					}
					root = {
						send_interface_toast = {
							title = court_ongoing.1022.c.master_of_hunt.success
							left_icon = scope:target
							right_icon = scope:master_of_hunt

							custom_tooltip = court_ongoing.1022.c.master_of_hunt.success.tt
						}
					}
				}
				20 = {	
					desc = court_ongoing.1022.c.master_of_hunt.failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = -0.5
					}
					root = {
						send_interface_toast = {
							title = court_ongoing.1022.c.master_of_hunt.failure
							left_icon = scope:target
							right_icon = scope:master_of_hunt

							remove_short_term_gold = minor_gold_value 
						}
					}
				}
			}
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = success }

		ai_chance = {
			base = 100

			ai_greed_target_modifier = { VALUE = -80 }
			ai_energy_target_modifier = { VALUE = -20 }
			ai_honor_target_modifier = { VALUE = -20 }
		}
	}

	#Asking too much
	option = {
		name = court_ongoing.1022.d

		stress_impact = {
			brave = minor_stress_impact_gain
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = wolf_pelt OUTCOME = failure }

		ai_chance = {
			base = 50
		}
	}
}

#Owner killed target's favorite dog (target perspective)
court_ongoing.1023 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1021.t
	desc = court_ongoing.1023.desc
	
	theme = romance_scheme
	override_background = { reference = ep2_dog_kennels }
	left_portrait = {
		character = scope:target
		animation = shock
	}
	right_portrait = {
		character = scope:owner
		animation = happiness
	}

	immediate = {
		random_dummy_gender_effect = yes
		scope:dummy_gender = { save_scope_as = dog_gender }
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender }
	}
	
	#Forgive
	option = {
		name = court_ongoing.1023.a
	}

	#End scheme
	option = {
		trigger = { is_ai = no }
		name = court_ongoing.1023.b

		show_as_tooltip = {
			scope:scheme = { end_scheme = yes }
		}
		save_temporary_scope_as = scheme_ended
	}

	after = {
		scope:owner = { trigger_event = court_ongoing.1024 }
	}
}

#Owner killed target's favorite dog (owner perspective)
court_ongoing.1024 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1022.t
	desc = court_ongoing.1024.desc
	
	theme = romance_scheme
	left_portrait = {
		character = scope:target
		animation = grief
	}
	right_portrait = {
		character = scope:owner
		animation = shame
	}

	
	#Forgive
	option = {
		name = court_ongoing.1024.a

		if = {
			limit = { exists = scope:scheme_ended }
			scope:scheme = { end_scheme = yes }
		}

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

###GIFT: PET###
scripted_trigger court_ongoing_1030_cat_lover = {
	OR = {
		ai_compassion >= high_positive_ai_value
		ai_rationality >= high_positive_ai_value
		ai_zeal <= high_negative_ai_value
		has_trait = intellect_good
		has_trait = shrewd
		has_trait_introverted_trigger = yes
		has_trait_submissive_trigger = yes
	}
}

scripted_trigger court_ongoing_1030_dog_lover = {
	OR = {
		ai_compassion >= high_positive_ai_value
		ai_energy >= high_positive_ai_value
		ai_boldness >= high_positive_ai_value
		ai_honor >= high_positive_ai_value
		has_trait = intellect_bad
		has_trait = dull
		has_trait_extroverted_trigger = yes
		has_trait_dominant_trigger = yes
	}
}


court_ongoing.1030 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1030.t
	desc = {
		desc = court_ongoing.1030.desc
		triggered_desc = {
			trigger = {
				location = {
					geographical_region = world_steppe
				}
			}
			desc = court_ongoing.1030.desc.eagle
		}
	}
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = personality_callous
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_gift_modifier
			}
		}
	}

	immediate = {
		scope:target.location = { save_scope_as = location }
	}

	#Cat
	option = {
		name = court_ongoing.1030.a
	
		show_as_tooltip = {
			random_list = {
				1 = {
					desc = court_ongoing.1030.a.success
					show_chance = no

					show_as_tooltip = {
						scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
						scope:target = {
							court_ongoing_1030_cat_modifier_effect = yes
						}
					}
				}
				1 = {
					desc = court_ongoing.1030.a.failure
					show_chance = no
					show_as_tooltip = {
						court_ongoing_1030_failure_effect = yes
					}
				}
			}
		}

		hidden_effect = {
			scope:target = {
				trigger_event = {
					id = court_ongoing.1032
					days = 2
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				scope:target = { court_ongoing_1030_cat_lover = yes }
				add = 50
			}
		}
	}

	#Dog
	option = {
		name = court_ongoing.1030.b

		show_as_tooltip = {
			random_list = {
				1 = {
					desc = court_ongoing.1030.b.success
					show_chance = no

					show_as_tooltip = {
						scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
						scope:target = {
							court_ongoing_1030_dog_modifier_effect = yes
						}
					}
				}
				1 = {
					desc = court_ongoing.1030.b.failure
					show_chance = no
					show_as_tooltip = {
						court_ongoing_1030_failure_effect = yes
					}
				}
			}
		}

		hidden_effect = {
			scope:target = {
				trigger_event = {
					id = court_ongoing.1031
					days = 2
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				scope:target = { court_ongoing_1030_dog_lover = yes }
				add = 50
			}
		}
	}

	#Eagle
	option = {
		name = court_ongoing.1030.d
		trigger = {
			location = {
				geographical_region = world_steppe
			}
		}
		show_as_tooltip = {
			random_list = {
				1 = {
					desc = court_ongoing.1030.d.success
					show_chance = no

					show_as_tooltip = {
						scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
						scope:target = {
							court_ongoing_1030_eagle_modifier_effect = yes
						}
					}
				}
				1 = {
					desc = court_ongoing.1030.d.failure
					show_chance = no
					show_as_tooltip = {
						court_ongoing_1030_failure_effect = yes
					}
				}
			}
		}

		hidden_effect = {
			scope:target = {
				trigger_event = {
					id = court_ongoing.1033
					days = 2
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	#Me!
	option = {
		name = court_ongoing.1030.c

		reverse_add_opinion = {
			target = scope:target
			modifier = pleased_opinion
			opinion = 10
		}
		
		hidden_effect = {
			scope:target = {
				send_interface_toast = {
					title = court_ongoing.1021.pet.failure
					left_icon = scope:owner
				}
			}
		}

		ai_chance = {
			base = 0
		}
	}
}	

#Target gets offered a dog
court_ongoing.1031 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1021.t
	desc = court_ongoing.1031.start.desc
	
	theme = romance_scheme
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = happiness
	}

	#yes dog!
	option = {
		name = court_ongoing.1031.a

		court_ongoing_1030_dog_modifier_effect = yes

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.b.success
					left_icon = scope:target
					scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
					show_as_tooltip = { scope:target = { court_ongoing_1030_dog_modifier_effect = yes } }
				}
			}
		}
		
		ai_chance = {
			base = 50

			ai_compassion_target_modifier = { VALUE = 50 }
			ai_energy_target_modifier = { VALUE = 50 }
			ai_boldness_target_modifier = { VALUE = 50 }
			ai_honor_target_modifier = { VALUE = 20 }
			
		}
	}

	#Yeah, that's gonna be a no for me, dawg
	option = {
		name = court_ongoing.1031.b

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.b.failure
					left_icon = scope:target
					court_ongoing_1030_failure_effect = yes
				}
			}
		}
		
		ai_chance = {
			base = 50

			modifier = {
				court_ongoing_1030_dog_lover = yes
				add = -1000
			}
		}
	}
}

#Target gets offered a cat
court_ongoing.1032 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1021.t
	desc = court_ongoing.1032.desc
	
	theme = romance_scheme
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = happiness
	}

	immediate = {
		assign_cat_eye_color_effect = { COLOR = random }
	}

	#yes cat!
	option = {
		name = court_ongoing.1031.a

		court_ongoing_1030_cat_modifier_effect = yes

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.a.success
					left_icon = scope:target
					scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
					show_as_tooltip = { scope:target = { court_ongoing_1030_cat_modifier_effect = yes } }
				}
			}
		}
		
		ai_chance = {
			base = 50

			ai_compassion_target_modifier = { VALUE = 50 }
			ai_zeal_target_modifier = { VALUE = -50 }
			ai_rationality_target_modifier = { VALUE = 50 }
			ai_honor_target_modifier = { VALUE = -20 }
			
		}
	}

	#no cat, because I'm an awful human being
	option = {
		name = court_ongoing.1031.b

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.a.failure
					left_icon = scope:target
					court_ongoing_1030_failure_effect = yes
				}
			}
		}
		
		ai_chance = {
			base = 50

			modifier = {
				court_ongoing_1030_cat_lover = yes
				add = -1000
			}
		}
	}
	after = {
		remove_variable = cat_eye_color
	}
}


#Target gets offered an eagle
court_ongoing.1033 = { #by Ariana Tranumn
	type = character_event
	title = court_ongoing.1021.t
	desc = court_ongoing.1033.desc
	
	theme = romance_scheme

	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = happiness
	}

	option = {
		name = court_ongoing.1031.a

		court_ongoing_1030_eagle_modifier_effect = yes

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.d.success
					left_icon = scope:target
					scope:scheme = { add_scheme_modifier = { type = courting_gift_modifier } }
					show_as_tooltip = { scope:target = { court_ongoing_1030_eagle_modifier_effect = yes } }
				}
			}
		}
		
		ai_chance = {
			base = 50

			ai_compassion_target_modifier = { VALUE = 50 }
			ai_zeal_target_modifier = { VALUE = -50 }
			ai_rationality_target_modifier = { VALUE = 50 }
			ai_honor_target_modifier = { VALUE = -20 }
			modifier = {
				has_trait = lifestyle_hunter
				add = 50
			}
		}
	}

	option = {
		name = court_ongoing.1031.b

		hidden_effect = {
			scope:owner = {
				send_interface_toast = {
					title = court_ongoing.1030.d.failure
					left_icon = scope:target
					court_ongoing_1030_failure_effect = yes
				}
			}
		}
		
		ai_chance = {
			base = 50
		}
	}
}

###GIFT:NECKLACE##
court_ongoing.1040 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1040.t
	desc = {
		desc = court_ongoing.1022.start.desc
		desc = court_ongoing.1040.end.desc
	}
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = personality_callous
	}
	lower_right_portrait = scope:necklace_owner
	cooldown = { years = 1 }

	trigger = {
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_gift_modifier
			}
		}
	}
	
	immediate = {
		if = {
			limit = { NOT = { exists = scope:necklace_owner } }
			court_ongoing_1020_save_necklace_owner_effect = yes
		}
	}

	#Buy
	option = {
		name = court_ongoing.1040.a
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= minor_gold_value
			}
		}

		remove_short_term_gold = minor_gold_value
		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}
		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = necklace OUTCOME = success }

		stress_impact = {
			greedy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_greed_target_modifier = { VALUE = -90 }
		}
	}

	#Offer favor
	option = {
		trigger = {
			NOT = { scope:necklace_owner = { has_hook = root } }
		}
		name = court_ongoing.1040.b

		scope:necklace_owner = {
			add_hook = {
				target = root
				type = favor_hook
			}
		}
		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}
		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = necklace OUTCOME = success }

		stress_impact = {
			paranoid = minor_stress_impact_gain
			deceitful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 70
			ai_honor_target_modifier = { VALUE = 40 }
		}
	}
	
	#Steal
	option = {
		name = court_ongoing.1040.c

		duel = {
			target = scope:necklace_owner
			skill = intrigue
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 4
					min = -40
				}
				desc = court_ongoing.1040.c.success
				send_interface_toast = {
					title = court_ongoing.1040.c.success
					left_icon = scope:target
					right_icon = scope:necklace_owner
					scope:scheme = {
						add_scheme_modifier = {
							type = courting_gift_modifier
						}
					}
					court_ongoing_fetch_gift_target_outcome_effect = { GIFT = necklace OUTCOME = success }
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -4
					min = -40
				}
				desc = court_ongoing.1040.c.failure
				send_interface_toast = {
					title = court_ongoing.1040.c.failure
					left_icon = scope:target
					right_icon = scope:necklace_owner
					reverse_add_opinion = {
						target = scope:necklace_owner
						modifier = angry_opinion
						opinion = -20
					}
					if = {
						limit = {
							exists = scope:necklace_owner.primary_spouse
							this != scope:necklace_owner.primary_spouse
							scope:necklace_owner.primary_spouse = { is_ruler = yes }
						}
						reverse_add_opinion = {
							target = scope:necklace_owner.primary_spouse
							modifier = angry_opinion
							opinion = -20
						}
					}
					court_ongoing_fetch_gift_target_outcome_effect = { GIFT = necklace OUTCOME = failure }
				}
			}
		}

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

		ai_chance = {
			base = 100
			ai_honor_target_modifier = { VALUE = -80 }
			ai_compassion_target_modifier = { VALUE = -80 }
		}
	}

	#Never mind...
	option = {
		name = court_ongoing.1040.d

		reverse_add_opinion = {
			target = scope:target
			modifier = pleased_opinion
			opinion = 5
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = necklace OUTCOME = failure }
		ai_chance = {
			base = 50
		}
	}
}	


### GIFT: FLOWER ###
court_ongoing.1050 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1050.t
	desc = {
		desc = court_ongoing.1050.start.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:target_host.faith = {
						OR = {
							OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
							religion = religion:buddhism_religion
							religion = religion:hinduism_religion
							religion = religion:jainism_religion
						}
					}
				}
				desc = court_ongoing.1050.monastery.desc
			}
			desc = court_ongoing.1050.temple.desc
		}
	}
	theme = romance_scheme
	override_background = {
		reference = garden
	}
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = flirtation
	}
	lower_right_portrait = scope:helpful_friend
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}
	cooldown = { years = 1 }

	trigger = {
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_gift_modifier
			}
		}
		exists = scope:target.location
	}

	
	immediate = {
		# Location & host
		scope:target.location = { save_scope_as = target_location }
		if = {
			limit = { exists = scope:target.host }
			scope:target.host = { save_scope_as = target_host }
		}
		else = {
			scope:target.location.province_owner = { save_scope_as = target_host }
		}

		# Where is the bloom from?
		if = {
			limit = { root = { is_ai = no } } #Only needed for text and a bit costly so only players
			random_independent_ruler = {
				limit = {
	 				highest_held_title_tier >= tier_kingdom
					NOT = { in_diplomatic_range = scope:target }
				}
				alternative_limit = {
	 				highest_held_title_tier >= tier_kingdom
				}
				primary_title = { save_scope_as = orchid_origin }
			}
		}

		# Where does it grow?
		scope:target_host = {
			random_sub_realm_barony = {
				limit = {
					title_province = {
						faith = scope:target_host.faith
						has_holding_type = church_holding
					}
				}
				alternative_limit = {
					title_province = { faith = scope:target_host.faith }
				}
				title_province = { save_scope_as = orchid_location }
			}
		}

		# Do you have a better friend?
		random_relation = {
			type = friend
			limit = {
				has_trait = lifestyle_herbalist
				basic_is_available_ai = yes
				this != scope:target
			}
			alternative_limit = {
				basic_is_available_ai = yes
				prowess > root.prowess
				this != scope:target
			}
			save_scope_as = helpful_friend
		}
	}

	# Buy
	option = {
		name = court_ongoing.1050.a

		remove_short_term_gold = minor_gold_value
		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}
		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = success }

		stress_impact = {
			greedy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_greed_target_modifier = { VALUE = -90 }
			modifier = {
				is_ai = yes
				short_term_gold <= minor_gold_value
				add = -200
			}
		}
	}

	# Adventure
	option = {
		name = court_ongoing.1050.b

		stress_impact = {
			craven = major_stress_impact_gain
			lazy = medium_stress_impact_gain
		}

		duel = {
			skill = prowess
			value = average_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 4
					min = -55
				}
				desc = court_ongoing.1050.b.success
				send_interface_toast = {
					title = court_ongoing.1050.b.success
					left_icon = scope:target
					court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = success }
					scope:scheme = {
						add_scheme_modifier = {
							type = courting_gift_modifier
						}
					}
					add_prestige = medium_prestige_gain
				}
			}
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
					min = -25
				}
				desc = court_ongoing.1050.b.soft_failure
				send_interface_toast = {
					title = court_ongoing.1050.b.soft_failure
					left_icon = scope:target
					add_stress = minor_stress_gain
					court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }
				}
			}
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
					min = -9
				}
				desc = court_ongoing.1050.b.hard_failure
				send_interface_toast = {
					title = court_ongoing.1050.b.hard_failure
					left_icon = scope:target
					increase_wounds_effect = { REASON = fall }
					court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }
				}
			}
		}
	}

	# Friend adventure
	option = {
		trigger = {
			exists = scope:helpful_friend
			scope:helpful_friend = { NOT = { has_trait = lifestyle_herbalist } }
		}
		name = court_ongoing.1050.b.friend
		custom_tooltip = court_ongoing.1050.b.friend.f
		add_internal_flag = special

		scope:helpful_friend = {
			duel = {
				skill = prowess
				value = average_skill_rating
				60 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 4
						min = -50
					}
					desc = court_ongoing.1050.b.friend.success
					root = {
						send_interface_toast = {
							title = court_ongoing.1050.b.friend.success
							left_icon = scope:helpful_friend
							right_icon = scope:target
							scope:scheme = {
								add_scheme_modifier = {
									type = courting_gift_modifier
								}
							}
							court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = success }
						}
					}
				}
				30 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2
						min = -20
					}
					desc = court_ongoing.1050.b.friend.soft_failure
					root = {
						send_interface_toast = {
							title = court_ongoing.1050.b.friend.soft_failure
							left_icon = scope:helpful_friend
							right_icon = scope:target
							court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }
						}
					}
				}
				10 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -1
						min = -1
					}
					desc = court_ongoing.1050.b.friend.hard_failure
					root = {
						send_interface_toast = {
							title = court_ongoing.1050.b.friend.hard_failure
							left_icon = scope:helpful_friend
							right_icon = scope:target
							scope:helpful_friend = { increase_wounds_effect = { REASON = fall } }
							court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	# Grow it yourself
	option = {
		name = court_ongoing.1050.c
		trigger = {
			OR = {
				has_trait = lifestyle_herbalist
				has_trait = lifestyle_gardener
			}
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}
		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = success }
	}

	# Friend can grow it
	option = {
		name = court_ongoing.1050.b.friend
		trigger = {
			exists = scope:helpful_friend
			scope:helpful_friend = { 
				OR = {
					has_trait = lifestyle_herbalist
					has_trait = lifestyle_gardener
				}
			}
		}
		custom_tooltip = court_ongoing.1050.c.friend.f

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_gift_modifier
			}
		}
		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = success }
	}


	# No thanks (coward)
	option = {
		name = court_ongoing.1050.d
		trigger = {
			has_trait = craven
			diplomacy < decent_skill_rating
		}
		trait = craven

		reverse_add_opinion = {
			target = scope:target
			modifier = weak_opinion
			opinion = -5
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }

		ai_chance = {
			base = 100
		}
	}

	# No thanks (compliment)
	option = {
		name = court_ongoing.1050.e
		trigger = { diplomacy >= decent_skill_rating }
		skill = diplomacy

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

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }

		ai_chance = {
			base = 100
		}
	}

	# No thanks (regular)
	option = {
		name = court_ongoing.1050.f
		trigger = {
			NOR = {
				has_trait = craven
				diplomacy >= decent_skill_rating
			}
		}

		court_ongoing_fetch_gift_target_outcome_effect = { GIFT = orchid OUTCOME = failure }

		ai_chance = {
			base = 50
		}
	}
}


### COMPLIMENT POEM ###

#What compliment should I use...
court_ongoing.1100 = {
	type = character_event
	title = court_ongoing.1100.t
	desc = court_ongoing.1100.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = writing
	}
	right_portrait = {
		character = scope:target
		animation = flirtation
	}
	cooldown = { years = 1 }
	
	trigger = {
		scope:target = {
			can_receieve_good_available_compliment_trigger = yes
		}
		NOT = {
			scope:scheme = {
				has_scheme_modifier = courting_charm_modifier
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			scope:scheme.var:court_milestone_event >= 3
			add = -0.75
		}
	}

	immediate = {
		hidden_effect = {
			#Randomize 3 compliment types
			randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:target }
			randomize_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:target }
			randomize_good_available_compliment_effect = { COMPLIMENT_RECEIVER = scope:target }
		}
	}

	#Compassionate
	option = {
		trigger = { has_character_flag = available_compliment_compassionate }
		name = court_ongoing.1100.compassionate
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = compassionate COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#bold
	option = {
		trigger = { has_character_flag = available_compliment_bold }
		name = court_ongoing.1100.bold
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = bold COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#honorable
	option = {
		trigger = { has_character_flag = available_compliment_honorable }
		name = court_ongoing.1100.honorable
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = honorable COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#greed
	option = {
		trigger = { has_character_flag = available_compliment_greedy }
		name = court_ongoing.1100.greed
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = greed COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#rational
	option = {
		trigger = { has_character_flag = available_compliment_rational }
		name = court_ongoing.1100.rational
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = rational COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#zealous
	option = {
		trigger = { has_character_flag = available_compliment_zealous }
		name = court_ongoing.1100.zealous
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = zealous COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#energetic
	option = {
		trigger = { has_character_flag = available_compliment_energetic }
		name = court_ongoing.1100.energetic
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = energetic COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#forgiving
	option = {
		trigger = { has_character_flag = available_compliment_forgiving }
		name = court_ongoing.1100.forgiving
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = forgiving COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#beautiful
	option = {
		trigger = { has_character_flag = available_compliment_beautiful }
		name = court_ongoing.1100.beautiful
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = beautiful COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#strong
	option = {
		trigger = { has_character_flag = available_compliment_strong }
		name = court_ongoing.1100.strong
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = strong COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#extroverted
	option = {
		trigger = { has_character_flag = available_compliment_extroverted }
		name = court_ongoing.1100.extroverted
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = extroverted COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#dominant
	option = {
		trigger = { has_character_flag = available_compliment_dominant }
		name = court_ongoing.1100.dominant
		flavor = court_ongoing.1100.compliment.tt #Explanation of what outcome is based on

		hidden_effect = {
			scope:target = { evaluate_compliment_effect = { COMPLIMENT_TYPE = dominant COMPLIMENT_GIVER = root } }
		}
		court_ongoing_1100_outcome_effect = yes #Mus be in every options but fallback for tooltip reasons
	}

	#No thanks
	option = {
		name = court_ongoing.1100.fallback			
	}

	after = {
		clear_available_compliments_effect = yes
		compliment_to_love_letter_effect = yes
	}
}	

#Target responds to poem
court_ongoing.1101 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = court_ongoing.1101.t
	desc = court_ongoing.1101.desc
	sender = scope:owner
	
	trigger = {
		exists = scope:scheme
	}

	#I like
	option = {
		name = {
			trigger = { scope:compliment_outcome = flag:good }
			text = court_ongoing.1101.a.good
		}
		name = {
			trigger = { NOT = { scope:compliment_outcome = flag:good } }
			text = court_ongoing.1101.a.bad
		}

		set_variable = {
			name = love_letter_quality
			value = 4
			days = 150
		}

		scope:owner = {
			add_opinion = {
				target = scope:target
				modifier = romance_opinion
				opinion = 15
			}
			trigger_event = court_ongoing.1102
		}

		ai_chance = {
			base = 0
			modifier = {
				scope:compliment_outcome = flag:good
				add = 100
			}
		}
	}

	#Neutral (ai only)
	option = {
		trigger = { is_ai = yes }
		
		scope:owner = {
			send_interface_toast = {
				left_icon = scope:target
				title = court_ongoing.1100.neutral.tt
			}
		}

		ai_chance = {
			base = 0
			modifier = {
				scope:compliment_outcome = flag:neutral
				add = 100
			}
		}
	}
	
	#I dislike
	option = {
		name = {
			trigger = { scope:compliment_outcome = flag:good }
			text = court_ongoing.1101.c.good
		}
		name = {
			trigger = { NOT = { scope:compliment_outcome = flag:good } }
			text = court_ongoing.1101.c.bad
		}

		set_variable = {
			name = love_letter_quality
			value = 1
			days = 150
		}

		scope:owner = {
			add_opinion = {
				target = scope:target
				modifier = disappointed_opinion
				opinion = -10
			}
			trigger_event = court_ongoing.1103
		}

		ai_chance = {
			base = 0
			modifier = {
				scope:compliment_outcome = flag:bad
				add = 100
			}
		}
	}

	after = {
		scope:owner = {
			compliment_to_love_letter_cleanup_effect = yes
		}
	}
}

#I get a response, target liked the poem!
court_ongoing.1102 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = court_ongoing.1102.t
	desc = court_ongoing.1102.desc
	sender = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	option = {
		name = court_ongoing.1102.a
		scope:scheme = {
			add_scheme_modifier = {
				type = courting_charm_modifier
			}
		}
	}

	after = {
		scope:target = {
			compliment_to_love_letter_cleanup_effect = yes
		}
	}
}


#I get a response, disliked the poem... :(
court_ongoing.1103 = { #by Mathilda Bjarnehed
	type = letter_event
	opening = court_ongoing.1103.t
	desc = court_ongoing.1102.desc
	sender = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	option = {
		name = court_ongoing.1103.a
		reverse_add_opinion = {
			target = scope:target
			modifier = insult_opinion
			opinion = -10
		}
	}

	after = {
		scope:target = {
			compliment_to_love_letter_cleanup_effect = yes
		}
	}
}



###################################
# Dealing with competition
# by Mathilda Bjarnehed
###################################

scripted_trigger court_ongoing_1110_can_court_target_trigger = {
	is_adult = yes
	this != scope:owner
	this != scope:target
	basic_is_available_ai = yes
	save_temporary_scope_as = can_court
	matching_gender_and_sexuality_trigger = {
		CHARACTER_1 = scope:can_court
		CHARACTER_2 = scope:target
	}
	opinion = {
		target = scope:target
		value >= 0
	}
	reverse_opinion = {
		target = scope:target
		value >= 0
	}
	NOR = {
		is_close_or_extended_family_of = scope:target
		is_consort_of = scope:target
		has_relation_lover = scope:target
	}
}

#Outcome effects
scripted_effect court_ongoing_1110_remove_competitor_effect = {
	scope:scheme = {
		remove_scheme_modifier = court_competitor_modifier
	}
	scope:target = {
		hidden_effect = {
			if = {
				limit = { has_relation_potential_lover = scope:competitor }
				remove_relation_potential_lover = scope:competitor
			}
		}
	}
}

scripted_effect court_ongoing_1110_duel_success_effect = {
	court_ongoing_1110_remove_competitor_effect = yes
	add_prestige = medium_prestige_gain
}

scripted_effect court_ongoing_1110_duel_failure_effect = {
	add_prestige = minor_prestige_loss
	custom_tooltip = court_ongoing_1110.competitor_remains.tt
}

scripted_effect court_ongoing_1110_poison_success_effect = {
	court_ongoing_1110_remove_competitor_effect = yes
	add_intrigue_lifestyle_perk_points = 1
	scope:competitor = {
		contract_disease_effect = { DISEASE = ill TREATMENT_EVENT = yes }
	}
}

scripted_effect court_ongoing_1110_poison_failure_effect = {
	custom_tooltip = court_ongoing_1110.competitor_remains.tt
	reverse_add_opinion = {
		target = scope:target
		modifier = disappointed_opinion
		opinion = -10
	}
	reverse_add_opinion = {
		target = scope:competitor
		modifier = suspicion_opinion
		opinion = -20
	}
}

scripted_effect court_ongoing_1110_poison_murder_effect = {
	court_ongoing_1110_remove_competitor_effect = yes
	unknown_murder_effect = {
		MURDERER = scope:owner
		VICTIM = scope:competitor
		REASON = death_murder
	}
}

# What to do about competitor?
court_ongoing.1110 = {
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1110.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:competitor
		animation = disapproval
	}
	lower_right_portrait = scope:target

	cooldown = { years = 1 }

	trigger = {
		OR = {
			any_relation = {
				type = rival
				court_ongoing_1110_can_court_target_trigger = yes
			}
			AND = {
				exists = scope:target.court_owner #The recipient or their liege if unlanded
				scope:target.court_owner = {
					OR = {
						any_knight = { court_ongoing_1110_can_court_target_trigger = yes }
						any_vassal = { court_ongoing_1110_can_court_target_trigger = yes }
					}
				}
			}
			scope:target = {
				any_relation = {
					type = potential_lover
					court_ongoing_1110_can_court_target_trigger = yes
				}
			}
		}
	}

	immediate = {
		#If I have a rival(s), add them to list
		if = {
			limit = {
				any_relation = {
					type = rival
					court_ongoing_1110_can_court_target_trigger = yes
				}
			}
			every_relation = {
				type = rival
				limit = { court_ongoing_1110_can_court_target_trigger = yes }
				add_to_list = competitors_list
			}
		}
		#Else, add knights/vassals of recipient/host + potential lovers
		else = {
			if = {
				limit = {
					exists = scope:target.court_owner #The recipient or their liege if unlanded
				}
				scope:target.court_owner = {
					every_knight = {
						limit = { court_ongoing_1110_can_court_target_trigger = yes }
						add_to_list = competitors_list
					}
					every_vassal = {
						limit = { court_ongoing_1110_can_court_target_trigger = yes }
						add_to_list = competitors_list
					}
				}
			}
			scope:target = {
				every_relation = {
					type = potential_lover
					limit = { court_ongoing_1110_can_court_target_trigger = yes }
					add_to_list = competitors_list
				}
			}
		}

		#Randomize from list
		random_in_list = {
			list = competitors_list
			weight = {
				base = 5
				modifier = {
					add = {
						value = attraction
						divide = medium_positive_attraction
						multiply = 20
					}
				}
				modifier = {
					add = {
						value = ai_sociability
						multiply = 0.2
					}
				}
				modifier = {
					has_trait = lustful
					add = 20
				}
				modifier = {
					OR = {
						has_focus_or_focus_trait_trigger = { FOCUS = intrigue_temptation_focus }
						has_focus_or_focus_trait_trigger = { FOCUS = martial_chivalry_focus }
					}
					add = 20
				}
				opinion_modifier = {
					opinion_target = scope:owner
					multiplier = -0.3
				}
				opinion_modifier = {
					opinion_target = scope:target
					multiplier = 0.5
				}
			}
			save_scope_as = competitor
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = court_competitor_modifier
			}
		}
		hidden_effect = {
			if = {
				limit = {
					scope:target = { might_cheat_on_every_partner_trigger = yes }
					scope:competitor = { might_cheat_on_every_partner_trigger = yes }
				}
				scope:target = {		
					progress_towards_lover_effect = {
						CHARACTER = scope:competitor
						REASON = lover_followed_around
						OPINION = 0
					}
				}
			}
		}
	}

	#Duel
	option = {
		name = court_ongoing.1110.a
		trigger = {
			OR = {
				AND = {
					exists = liege
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege }
				}
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
			}
		}

		duel = {
			skill = prowess
			target = scope:competitor
			60 = {
				desc = court_ongoing.1110.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				modifier = {
					add = {
						value = ai_boldness
						divide = high_positive_ai_value
						multiply = 20
					}
				}
				show_as_tooltip = { court_ongoing_1110_duel_success_effect = yes }
				save_scope_value_as = {
					name = competitor_outcome
					value = flag:duel_success
				}
			}
			40 = {
				desc = court_ongoing.1110.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
				}
				modifier = {
					add = {
						value = scope:competitor.ai_boldness
						divide = high_positive_ai_value
						multiply = 20
					}
				}
				show_as_tooltip = { court_ongoing_1110_duel_failure_effect = yes }
				save_scope_value_as = {
					name = competitor_outcome
					value = flag:duel_failure
				}
			}
		}

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

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 2
				ai_energy = 1
				ai_honor = 2
			}
		}
	}


	#Poision
	option = {
		name = court_ongoing.1110.b

		duel = {
			skill = intrigue
			target = scope:competitor
			60 = {
				desc = court_ongoing.1110.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				show_as_tooltip = { court_ongoing_1110_poison_success_effect = yes }
				save_scope_value_as = {
					name = competitor_outcome
					value = flag:poison_success
				}
			}
			35 = {
				desc = court_ongoing.1110.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
				}
				modifier = {
					scope:competitor = { has_trait = paranoid }
				}
				show_as_tooltip = { court_ongoing_1110_poison_failure_effect = yes }
				save_scope_value_as = {
					name = competitor_outcome
					value = flag:poison_failure
				}
			}
			5 = {
				desc = court_ongoing.1110.b.murder
				trigger = { root = { is_ai = no } } # Only available for players
				show_as_tooltip = { court_ongoing_1110_poison_murder_effect = yes }
				trigger_event = court_ongoing.1116
			}
		}

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

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -2
				ai_honor = -2
			}
		}
	}

	#Pay off
	option = {
		trigger = {
			OR = {
				is_ai = no
				short_term_gold >= tiny_gold_value
			}
		}
		name = court_ongoing.1110.c

		pay_short_term_gold = {
			target = scope:competitor
			gold = tiny_gold_value
		}

		random_list = {
			90 = { #Success
				desc = court_ongoing.1110.c.success
				modifier = {
					scope:competitor.ai_greed > 0
					add = {
						value = scope:competitor.ai_greed
						divide = high_positive_ai_value
						multiply = 20
					}
				}
				modifier = {
					scope:competitor.ai_honor < 0
					add = {
						value = scope:competitor.ai_honor
						divide = high_negative_ai_value
						multiply = 20
					}
				}
				send_interface_toast = {
					title = court_ongoing.1110.c.success
					left_icon = scope:competitor
					right_icon = scope:target
					court_ongoing_1110_remove_competitor_effect = yes
				}
			}
			10 = { #Failure
				min = 5
				desc = court_ongoing.1110.c.failure
				modifier = {
					scope:competitor.ai_honor > 0
					add = {
						value = scope:competitor.ai_honor
						divide = high_positive_ai_value
						multiply = 5
					}
				}
				modifier = {
					scope:competitor.ai_greed < 0
					add = {
						value = scope:competitor.ai_greed
						divide = high_negative_ai_value
						multiply = 5
					}
				}
				send_interface_toast = {
					title = court_ongoing.1110.c.failure
					left_icon = scope:competitor
					right_icon = scope:target
					reverse_add_opinion = {
						target = scope:target
						modifier = disappointed_opinion
						opinion = -10
					}
				}
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
				ai_honor = -1
				ai_energy = -1
			}
		}
	}

	after = {
		if = {
			limit = { exists = scope:competitor_outcome }
			scope:target = {
				trigger_event = court_ongoing.1111
			}
		}
	}
}


#Recipient perspective on outcome
court_ongoing.1111 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1111.t
	desc = {
		desc = court_ongoing.1111.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:competitor_outcome = flag:duel_success }
				desc = court_ongoing.1111.duel_success.desc
			}
			triggered_desc = {
				trigger = { scope:competitor_outcome = flag:duel_failure }
				desc = court_ongoing.1111.duel_failure.desc
			}
			triggered_desc = {
				trigger = { scope:competitor_outcome = flag:poison_success }
				desc = court_ongoing.1111.poison_success.desc
			}
			triggered_desc = {
				trigger = { scope:competitor_outcome = flag:poison_failure }
				desc = court_ongoing.1111.poison_failure.desc
			}
		}
	}
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		triggered_animation = {
			trigger = {
				OR = {
					scope:competitor_outcome = flag:duel_success
					scope:competitor_outcome = flag:poison_success
				}
			}
			animation = personality_bold
		}
		triggered_animation = {
			trigger = { scope:competitor_outcome = flag:duel_failure }
			animation = pain
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = idle
		}
	}
	right_portrait = {
		character = scope:competitor
		triggered_animation = {
			trigger = { scope:competitor_outcome = flag:duel_success }
			animation = pain
		}
		triggered_animation = {
			trigger = { scope:competitor_outcome = flag:duel_failure }
			animation = personality_bold
		}
		triggered_animation = {
			trigger = { scope:competitor_outcome = flag:poison_success }
			animation = shame
		}
		triggered_animation = {
			trigger = { always = yes }
			animation = idle
		}
	}
	
	trigger = {
		exists = scope:scheme
	}

	#Target did well/should keep trying
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								scope:competitor_outcome = flag:duel_success
								scope:competitor_outcome = flag:poison_success
							}
						}
						desc = court_ongoing.1111.a.success
					}
					triggered_desc = {
						trigger = { scope:competitor_outcome = flag:duel_failure }
						desc = court_ongoing.1111.a.duel_failure
					}
					triggered_desc = {
						trigger = { scope:competitor_outcome = flag:poison_failure }
						desc = court_ongoing.1111.a.poison_failure
					}
				}
			}
		}

		reverse_add_opinion = {
			target = scope:owner
			modifier = romance_opinion
			opinion = 20
		}

		scope:owner = {
			if = {
				limit = {
					OR = {
						scope:competitor_outcome = flag:duel_success
						scope:competitor_outcome = flag:duel_failure
					}
				}
				trigger_event = court_ongoing.1112 #Duel success
			}
			else = {
				trigger_event = court_ongoing.1114 #Poison success
			}
		}

		ai_chance = {
			base = 0
			modifier = {
				OR = {
					scope:competitor_outcome = flag:duel_success
					scope:competitor_outcome = flag:poison_success
				}
				add = 100
			}
		}
	}

	#I'm not impressed
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { scope:competitor_outcome = flag:poison_success }
						desc = court_ongoing.1111.b.poison_success
					}
					triggered_desc = {
						trigger = { scope:competitor_outcome = flag:poison_failure }
						desc = court_ongoing.1111.b.poison_failure
					}
					desc = court_ongoing.1111.b
				}
			}
		}

		scope:owner = {
			if = {
				limit = {
					OR = {
						scope:competitor_outcome = flag:duel_success
						scope:competitor_outcome = flag:duel_failure
					}
				}
				trigger_event = court_ongoing.1113 #Duel failure
			}
			else = {
				trigger_event = court_ongoing.1115 #Poison failure
			}
		}

		ai_chance = {
			base = 0
			modifier = {
				OR = {
					scope:competitor_outcome = flag:duel_failure
					scope:competitor_outcome = flag:poison_failure
				}
				add = 100
			}
		}
	}

	#I prefer competitor! (ends scheme, player only)
	option = {
		trigger = { is_ai = no }
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { scope:competitor_outcome = flag:duel_failure }
						desc = court_ongoing.1111.c.duel_failure
					}
					desc = court_ongoing.1111.c
				}
			}
		}

		reverse_add_opinion = {
			target = scope:competitor
			modifier = romance_opinion
			opinion = 20
		}
		
		show_as_tooltip = { scope:scheme = { end_scheme = yes } }
		scope:owner = { trigger_event = court_ongoing.0001 }
	}
	
	#be gone, both of you! (ends scheme, player only)
	option = {
		trigger = { is_ai = no }
		name = court_ongoing.1111.d
		
		show_as_tooltip = { scope:scheme = { end_scheme = yes } }
		scope:owner = { trigger_event = court_ongoing.0001 }
	}
}


#Duel success for owner
court_ongoing.1112 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1112.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:competitor
		animation = pain
	}
	lower_right_portrait = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	option = {
		name = court_ongoing.1112.a
		court_ongoing_1110_duel_success_effect = yes
	}
}

#Duel failure for owner
court_ongoing.1113 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1113.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = pain
	}
	right_portrait = {
		character = scope:competitor
		animation = personality_bold
	}
	lower_right_portrait = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	#OK...
	option = {
		name = court_ongoing.1113.a

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	#Rivalry!
	option = {
		trigger = {
			NOT = { has_relation_rival = scope:competitor }
		}
		name = court_ongoing.1113.b
		set_relation_rival = {
			target = scope:competitor
			reason = rival_duel_vengeance
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 5
			}
		}
	}

	after = {
		court_ongoing_1110_duel_failure_effect = yes
	}
}

#Poison success for owner
court_ongoing.1114 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1114.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:competitor
		animation = sick
	}
	lower_right_portrait = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	option = {
		name = court_ongoing.1114.a
		court_ongoing_1110_poison_success_effect = yes
	}
}

#Poison failure for owner
court_ongoing.1115 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1115.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:competitor
		animation = dismissal
	}
	lower_right_portrait = scope:target
	
	trigger = {
		exists = scope:scheme
	}

	#OK...
	option = {
		name = court_ongoing.1115.a

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 0.5
			}
		}
	}

	#Rivalry!
	option = {
		trigger = {
			NOT = { has_relation_rival = scope:competitor }
		}
		name = court_ongoing.1113.b
		
		set_relation_rival = {
			target = scope:competitor
			reason = rival_poison_vengeance
		}
		

		ai_chance = {
			base = 50	
			ai_value_modifier = {
				ai_vengefulness = 5
			}
		}
	}

	after = {
		court_ongoing_1110_poison_failure_effect = yes
	}
}

#Poison murder for owner
court_ongoing.1116 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1110.t
	desc = court_ongoing.1116.desc
	
	theme = romance_scheme
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:competitor
		animation = dead
	}
	lower_right_portrait = scope:target
	
	trigger = {
		exists = scope:scheme
	}
		
	immediate = { court_ongoing_1110_poison_murder_effect = yes }

	option = {
		name = court_ongoing.1116.a
	}
}




##############################
# Boring party guest
# by Mathilda Bjarnehed
##############################

scripted_trigger court_ongoing_1120_unpleasant_guest_trigger = {
	basic_is_available_ai = yes
	NOR = {
		has_relation_friend = root
		has_relation_lover = root
		opinion = {
			target = root
			value > low_positive_opinion
		}
	}
	NOR = {
		this = scope:owner
		this = scope:target
	}
}

court_ongoing.1120 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1120.t
	desc = court_ongoing.1120.desc
	theme = romance_scheme
	override_background = {
		reference = throne_room_scope
	}
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:unpleasant_guest
		animation = wedding_drunk
	}
	lower_right_portrait = scope:target

	cooldown = { years = 1 }

	trigger = {
		trigger_if = {
			limit = { exists = scope:target.host }
			scope:target.host = { save_temporary_scope_as = target_host_temp }
		}
		trigger_else_if = {
			limit = {
				exists = scope:target.location.province_owner
			}
			scope:target.location.province_owner = { save_temporary_scope_as = target_host_temp }
		}
		trigger_else = { always = no }
		scope:target_host_temp.top_liege ?= {
			OR = {
				court_ongoing_1120_unpleasant_guest_trigger = yes
				any_vassal_or_below = { court_ongoing_1120_unpleasant_guest_trigger = yes }
			}
		}
	}

	immediate = {
		# Location & host
		scope:target.location = { save_scope_as = target_location }
		if = {
			limit = { exists = scope:target.host }
			scope:target.host = { save_scope_as = target_host }
		}
		else = {
			scope:target.location.province_owner = { save_scope_as = target_host }
		}

		# Save all potential guests
		scope:target_host = {
			save_scope_as = background_throne_room_scope
			
			# Host themselves
			if = {
				limit = { court_ongoing_1120_unpleasant_guest_trigger = yes }
				add_to_list = important_guests
			}

			# Host's liege
			if = {
				limit = {
					top_liege != this
					liege = { court_ongoing_1120_unpleasant_guest_trigger = yes }
				}
				liege = { add_to_list = important_guests }
			}

			# Host's powerful vassals
			every_powerful_vassal = {
				limit = { court_ongoing_1120_unpleasant_guest_trigger = yes }
				add_to_list = important_guests
			}
		}
		# Your powerful vassals, if same realm
		every_powerful_vassal = {
			limit = {
				top_liege = scope:target_host.top_liege
				court_ongoing_1120_unpleasant_guest_trigger = yes
			}
			add_to_list = important_guests
		}

		# Pick a guest
		random_in_list = {
			list = important_guests
			limit = {
				OR = {
					is_powerful_vassal_of = root
					AND = {
						exists = root.liege
						this = root.liege
					}
					highest_held_title_tier >= root.highest_held_title_tier
				}
			}
			alternative_limit = { always = yes }
			weight = {
				base = 10
				modifier = {
					add = {
						value = ai_compassion
						add = ai_rationality
						add = ai_honor
						multiply = -1
					}
				}
				compatibility_modifier = {
					who = scope:target
					compatibility_target = this
					multiplier = -2
				}
				compatibility_modifier = {
					who = root
					compatibility_target = this
					multiplier = -2
				}
				opinion_modifier = {
					who = root
					opinion_target = this
					multiplier = -1
				}
				modifier = {
					add = {
						value = diplomacy
						subtract = high_skill_rating
						multiply = -5
					}
				}
			}
			save_scope_as = unpleasant_guest
		}

		if = {
			limit = { NOT = { exists = scope:unpleasant_guest } }
			# Still no guest? Look further
			scope:target_host.top_liege = {
				random_vassal_or_below = {
					limit = { court_ongoing_1120_unpleasant_guest_trigger = yes }
					weight = {
						base = 10
						modifier = {
							add = {
								value = ai_compassion
								add = ai_rationality
								add = ai_honor
								multiply = -1
							}
						}
						modifier = {
							add = {
								value = diplomacy
								subtract = high_skill_rating
								multiply = -5
							}
						}
					}
					save_scope_as = unpleasant_guest
				}
			}
			# The top liege might be the only possible candidate
			if = {
				limit = { NOT = { exists = scope:unpleasant_guest } }
				if = {
					limit = { scope:target_host.top_liege = { court_ongoing_1120_unpleasant_guest_trigger = yes } }
					scope:target_host.top_liege = { save_scope_as = unpleasant_guest }
				}
			}
		}
	}

	# Subterfuge distraction
	option = {
		name = court_ongoing.1120.a
		skill = intrigue
		trigger = {
			intrigue >= high_skill_rating
			intrigue > scope:unpleasant_guest.intrigue
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_kindness_modifier
			}
		}

		scope:target = {
			save_scope_value_as = {
				name = unpleasant_guest_outcome
				value = flag:intrigue
			}
			trigger_event = court_ongoing.1121
		}

		stress_impact = {
			honest = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}

		ai_chance = {
			base = 200

			ai_value_modifier = {
				ai_boldness = 2
				ai_honor = -2
				ai_compassion = 1
			}
		}
	}

	# Strike up a really nice conversation
	option = {
		name = court_ongoing.1120.b
		skill = diplomacy
		trigger = {
			diplomacy >= high_skill_rating
			diplomacy > scope:unpleasant_guest.diplomacy
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_kindness_modifier
			}
		}

		scope:target = {
			save_scope_value_as = {
				name = unpleasant_guest_outcome
				value = flag:diplomacy
			}
			trigger_event = court_ongoing.1121
		}

		stress_impact = {
			shy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 200

			ai_value_modifier = {
				ai_sociability = 2
				ai_boldness = 2
				ai_honor = 1
				ai_compassion = 2
			}
		}
	}

	# Distract them (boring)
	option = {
		name = court_ongoing.1120.c
		
		add_stress = medium_stress_gain
		
		send_interface_toast = {
			title = court_ongoing.1120.a.failure
			add_character_modifier = {
				modifier = chronic_headaches_modifier
				years = 10
			}
		}

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_kindness_modifier
			}
		}

		scope:target = {
			save_scope_value_as = {
				name = unpleasant_guest_outcome
				value = flag:diplomacy
			}
			trigger_event = court_ongoing.1121
		}

		stress_impact = {
			shy = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_compassion = 2
				ai_honor = 1
				ai_energy = 1
				ai_sociability = 2
			}
		}
	}

	# Insult them
	option = {
		name = court_ongoing.1120.d
		
		add_prestige = miniscule_prestige_loss

		reverse_add_opinion = {
			target = scope:unpleasant_guest
			modifier = insulted_opinion
			opinion = -15
		}

		progress_towards_rival_effect = { CHARACTER = scope:unpleasant_guest OPINION = 0 REASON = rival_boring_party_guest }

		scope:scheme = {
			add_scheme_modifier = {
				type = courting_kindness_modifier
			}
		}

		scope:target = {
			save_scope_value_as = {
				name = unpleasant_guest_outcome
				value = flag:insult
			}
			trigger_event = court_ongoing.1121
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
			shy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			forgiving = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_compassion = -2
				ai_boldness = 2
				ai_honor = -1
			}
		}
	}

	# Nothing can be done
	option = {
		trigger = {
			NOR = {
				AND = {
					intrigue >= high_skill_rating
					intrigue > scope:unpleasant_guest.intrigue
				}
				AND = {
					diplomacy >= high_skill_rating
					diplomacy > scope:unpleasant_guest.diplomacy
				}
			}
		}
		name = court_ongoing.1120.e

		ai_chance = {
			base = 50
		}
	}
}

# Target outcome event (unpleasant guest)
court_ongoing.1121 = { #by Mathilda Bjarnehed
	type = character_event
	title = court_ongoing.1121.t
	desc = {
		desc = court_ongoing.1121.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:unpleasant_guest_outcome = flag:diplomacy }
				desc = court_ongoing.1121.diplomacy.desc
			}
			triggered_desc = {
				trigger = { scope:unpleasant_guest_outcome = flag:intrigue }
				desc = court_ongoing.1121.intrigue.desc
			}
			triggered_desc = {
				trigger = { scope:unpleasant_guest_outcome = flag:insult }
				desc = court_ongoing.1121.insult.desc
			}
		}
	}
	theme = romance_scheme
	override_background = {
		reference = throne_room
	}
	left_portrait = {
		character = scope:owner
		triggered_animation = {
			trigger = { scope:unpleasant_guest_outcome = flag:diplomacy }
			animation = personality_compassionate
		}
		triggered_animation = {
			trigger = { scope:unpleasant_guest_outcome = flag:intrigue }
			animation = personality_dishonorable
		}
		triggered_animation = {
			trigger = { scope:unpleasant_guest_outcome = flag:insult }
			animation = boredom
		}
	}
	right_portrait = {
		character = scope:unpleasant_guest
		triggered_animation = {
			trigger = { scope:unpleasant_guest_outcome = flag:intrigue }
			animation = worry
		}
		triggered_animation = {
			trigger = { scope:unpleasant_guest_outcome = flag:insult }
			animation = disapproval
		}
		animation = idle
	}
	

	# Study owner's diplomatic skills
	option = {
		name = court_ongoing.1121.a

		trigger = { scope:unpleasant_guest_outcome = flag:diplomacy }

		#Stress and opinion
		add_stress = minor_stress_gain


		#Diplomacy experience
		random_list = {
			10 = {
				modifier = {
					add = {
						value = scope:owner.diplomacy
						subtract = average_skill_rating
						multiply = 2
					}
				}
				desc = court_ongoing.1121.a.critical_success
				send_interface_toast = {
					left_icon = scope:owner
					title = court_ongoing.1121.a.critical_success
					add_diplomacy_lifestyle_perk_points = 1
				}
			}
			90 = {
				desc = court_ongoing.1121.a.success
				send_interface_toast = {
					left_icon = scope:owner
					title = court_ongoing.1121.a.success
					add_character_modifier = {
						modifier = diplomacy_student_modifier
						years = 5
					}
				}
			}
		}
	}

	# Study owner's intrigue skills
	option = {
		trigger = { scope:unpleasant_guest_outcome = flag:intrigue }
		name = court_ongoing.1121.b
	
		#Stress and opinion
		add_stress = minor_stress_gain


		#Diplomacy experience
		random_list = {
			10 = {
				modifier = {
					add = {
						value = scope:owner.intrigue
						subtract = average_skill_rating
						multiply = 2
					}
				}
				desc = court_ongoing.1121.b.critical_success
				send_interface_toast = {
					left_icon = scope:owner
					title = court_ongoing.1121.b.critical_success
					add_intrigue_lifestyle_perk_points = 1
				}
			}
			90 = {
				desc = court_ongoing.1121.b.success
				send_interface_toast = {
					left_icon = scope:owner
					title = court_ongoing.1121.b.success
					add_character_modifier = {
						modifier = intrigue_student_modifier
						years = 5
					}
				}
			}
		}
	}


	# Join in with owner's insults
	option = {
		trigger = { scope:unpleasant_guest_outcome = flag:insult }
		name = court_ongoing.1121.c

		#Owner opinion
		reverse_add_opinion = {
			target = scope:owner
			modifier = respect_opinion
			opinion = 10
		}

		#Unpleasant opinion
		random_list = {
			50 = {
				modifier = {
					scope:unpleasant_guest = { has_trait = honest }
					add = 50
				}
				modifier = {
					scope:unpleasant_guest = { has_trait = humble }
					add = 50
				}
				desc = court_ongoing.1121.c.success
				send_interface_toast = {
					left_icon = scope:unpleasant_guest
					title = court_ongoing.1121.c.success
					reverse_add_opinion = {
						target = scope:unpleasant_guest
						modifier = respect_opinion
						opinion = 10
					}
				}
			}
			50 = {
				desc = court_ongoing.1121.c.failure
				modifier = {
					scope:unpleasant_guest = { has_trait = arrogant }
					add = 50
				}
				send_interface_toast = {
					left_icon = scope:unpleasant_guest
					title = court_ongoing.1121.c.failure
					reverse_add_opinion = {
						target = scope:unpleasant_guest
						modifier = insulted_opinion
						opinion = -10
					}
				}
			}
		}

		stress_impact = {
			shy = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
	}

	# Stay with unpleasant guest
	option = {
		add_stress = minor_stress_gain
		name = court_ongoing.1121.d

		reverse_add_opinion = {
			target = scope:unpleasant_guest
			modifier = friendliness_opinion
			opinion = 15
		}
		reverse_add_opinion = {
			target = scope:owner
			modifier = disappointed_opinion
			opinion = -5
		}
	}
	
	# Get out while you can
	option = {
		name = court_ongoing.1121.e
		add_stress = minor_stress_loss
	}
}


### EXTREME REQUEST ###
# by Linnéa Thimrén
######################

scripted_trigger court_ongoing_1211_trigger = {
	NOT = {
		scope:scheme = {
			has_scheme_modifier = courting_devotion
		}
	}
}

scripted_trigger court_ongoing_1221_trigger = {
	NOT = {
		scope:scheme = {
			has_scheme_modifier = courting_devotion
		}
	}
}

court_ongoing.1200 = { #by Linnéa Thimrén
	hidden = yes
	
	trigger = {
		OR = {
			court_ongoing_1211_trigger = yes
			court_ongoing_1221_trigger = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely to fire later on in the scheme
			scope:scheme.var:court_milestone_event < 2
			add = -0.5
		}
	}

	immediate = {
		if = {
			limit = {
				scope:target = { is_ai = no }
			}
			scope:target = { trigger_event = court_ongoing.1201 }
		}
		else = {
			random_list = {
				10 = {
					trigger = { court_ongoing_1211_trigger = yes }
					trigger_event = {
						id = court_ongoing.1211
						days = { 7 9 }
					}
				}
				10 = {
					trigger = { court_ongoing_1221_trigger = yes }
					trigger_event = {
						id = court_ongoing.1221
						days = { 7 9 }
					}
				}
			}
		}
	}
}


### EXTREME REQUEST - TARGET PLAYER CHOOSE ###

scripted_effect court_ongoing_1211_a_success_target_effect = {
	scope:target = {
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}

scripted_effect court_ongoing_1211_a_success_effect = {
	court_ongoing_1211_a_success_target_effect = yes

	reverse_add_opinion = {
		target = scope:target
		modifier = grateful_opinion
		opinion = 20
	}
	scope:scheme = {
		add_scheme_modifier = {
			type = courting_devotion
		}
	}
}

scripted_effect court_ongoing_1211_failure_target_effect = {
	scope:target = {
		add_character_modifier = {
			modifier = sleep_deprived_modifier
			years = 5
		}
	}
}

scripted_effect court_ongoing_1211_a_failure_effect = {
	court_ongoing_1211_failure_target_effect = yes
	reverse_add_opinion = {
		target = scope:target
		modifier = disgusted_opinion
		opinion = -10
	}
}

scripted_effect court_ongoing_1211_b_failure_effect = {
	court_ongoing_1211_failure_target_effect = yes
	reverse_add_opinion = {
		target = scope:target
		modifier = insult_opinion
		opinion = -15
	}
}

scripted_effect court_ongoing_1221_a_success_target_effect = {
	scope:target = {
		add_prestige = medium_prestige_gain
	}
}

scripted_effect court_ongoing_1221_a_success_effect = {
	court_ongoing_1221_a_success_target_effect = yes
	reverse_add_opinion = {
		target = scope:target
		modifier = grateful_opinion
		opinion = 15
	}
	scope:scheme = {
		add_scheme_modifier = {
			type = courting_devotion
		}
	}
}

scripted_effect court_ongoing_1221_a_failure_target_effect = {
	scope:target = {
		add_prestige = minor_prestige_loss
	}
}

scripted_effect court_ongoing_1221_a_failure_effect = {
	court_ongoing_1221_a_failure_target_effect = yes
	reverse_add_opinion = {
		target = scope:target
		modifier = disgusted_opinion
		opinion = -10
	}
}

scripted_effect court_ongoing_1221_b_failure_effect = {
	court_ongoing_1221_a_failure_target_effect = yes
	reverse_add_opinion = {
		target = scope:target
		modifier = insult_opinion
		opinion = -15
	}
}

court_ongoing.1201 = { #by Linnéa Thimrén
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1201.desc
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = flirtation
	}

	cooldown = { years = 1 }

	#sleep
	option = {
		trigger = { court_ongoing_1211_trigger = yes }
		name = court_ongoing.1201.a

		show_as_tooltip = {
			random_list = {
				10 = {
					show_chance = no
					desc = court_ongoing.1201.a_success
					court_ongoing_1211_a_success_target_effect = yes
				}
				10 = {
					show_chance = no
					desc = court_ongoing.1201.a_failure
					court_ongoing_1211_failure_target_effect = yes
				}
			}
		}

		scope:owner = {
			trigger_event = {
				id = court_ongoing.1211
				days = { 7 9 }
			}
		}
	}

	#food
	option = {
		trigger = { court_ongoing_1221_trigger = yes }
		name = court_ongoing.1201.b
		
		show_as_tooltip = {
			random_list = {
				10 = {
					show_chance = no
					desc = court_ongoing.1201.b_success
					court_ongoing_1221_a_success_target_effect = yes
				}
				10 = {
					show_chance = no
					desc = court_ongoing.1201.a_failure
					court_ongoing_1221_a_failure_target_effect = yes
				}
			}
		}

		scope:owner = {
			trigger_event = {
				id = court_ongoing.1221
				days = { 7 9 }
			}
		}
	}
	
	#I don't want you to do anything
	option = {
		name = court_ongoing.1201.c
	}
}


### EXTREME REQUEST - SLEEP ###

court_ongoing.1211 = { #by Linnéa Thimrén
	type = character_event
	title = court_ongoing.1211.t
	desc = {
		desc = court_ongoing.1211.desc_opening
		desc = court_ongoing.1211.desc
	}
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = flirtation
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	#I'll do it!
	option = {
		name = court_ongoing.1211.a

		add_character_modifier = {
			modifier = sleep_deprived_modifier
			years = 2
		}

		random_list = {
			60 = {
				desc = court_ongoing.1211.a.success
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.a.success

					scope:target = {
						trigger_event = court_ongoing.1212
					}

					court_ongoing_1211_a_success_effect = yes
				}
			}
			10 = {
				desc = court_ongoing.1211.a.failure
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.a.failure

					scope:target = {
						trigger_event = court_ongoing.1213
					}
					court_ongoing_1211_a_failure_effect = yes
				}
			}
		}

		stress_impact = {
			lazy = medium_stress_impact_gain
		}
	}

	#Tell them you'll do it (liar!)
	option = {
		name = court_ongoing.1211.b
		flavor = court_ongoing.1211.b.tt

		duel = {
			skill = intrigue
			target = scope:target
			67 = {
				desc = court_ongoing.1211.b.success
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.b.success

					scope:target = {
						trigger_event = court_ongoing.1214
					}
					court_ongoing_1211_a_success_effect = yes
				}
			}
			33 = {
				desc = court_ongoing.1211.b.failure
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.b.failure

					scope:target = {
						trigger_event = court_ongoing.1215
					}
					court_ongoing_1211_b_failure_effect = yes
				}
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
		}
	}
	
	#I won't do it!
	option = {
		name = court_ongoing.1211.c

		reverse_add_opinion = {
			target = scope:target
			modifier = refusal_opinion
			opinion = -5
		}
	}
}

#success - for target
court_ongoing.1212 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1212.desc
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = personality_bold
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1212.a
		show_as_tooltip = {
			court_ongoing_1211_a_success_target_effect = yes
		}
	}
}

#failure - for target
court_ongoing.1213 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1213.desc
	left_portrait = {
		character = scope:target
		animation = eyeroll
	}
	right_portrait = {
		character = scope:owner
		animation = dead
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1213.a
		show_as_tooltip = {
			court_ongoing_1211_failure_target_effect = yes
		}
	}
}

#trickery success - for target
court_ongoing.1214 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = {
		desc = court_ongoing.1212.desc
		desc = court_ongoing.1214.desc
	}
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = personality_bold
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1212.a
		show_as_tooltip = {
			court_ongoing_1211_a_success_target_effect = yes
		}
	}
}

#trickery failure - for target
court_ongoing.1215 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1215.desc
	left_portrait = {
		character = scope:target
		animation = eyeroll
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1215.a
		show_as_tooltip = {
			court_ongoing_1211_failure_target_effect = yes
		}
	}
}



### EXTREME REQUEST - FOOD ###

court_ongoing.1221 = { #by Linnéa Thimrén
	type = character_event
	title = court_ongoing.1211.t
	desc = {
		desc = court_ongoing.1211.desc_opening
		desc = court_ongoing.1221.desc
	}
	
	theme = romance_scheme
	left_portrait = {
		character = scope:owner
		animation = beg
	}
	right_portrait = {
		character = scope:target
		animation = flirtation
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	cooldown = { years = 1 }

	#I'll do it!
	option = {
		name = court_ongoing.1221.a
		add_character_modifier = {
			modifier = court_starved_modifier
			years = 2
		}
		random_list = {
			67 = {
				desc = court_ongoing.1221.a.success
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1221.a.success
					scope:target = { trigger_event = court_ongoing.1222 }
					court_ongoing_1221_a_success_effect = yes
				}
			}
			33 = {
				desc = court_ongoing.1221.a.failure
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1221.a.failure
					scope:target = { trigger_event = court_ongoing.1223 }
					court_ongoing_1221_a_failure_effect = yes
				}
			}
		}

		stress_impact = {
			gluttonous = medium_stress_impact_gain
		}
	}

	#Tell them you'll do it (liar!)
	option = {
		name = court_ongoing.1221.b
		flavor = court_ongoing.1221.b.tt

		duel = {
			skill = intrigue
			target = scope:target
			67 = {
				desc = court_ongoing.1211.b.success
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.b.success
					scope:target = { trigger_event = court_ongoing.1224 }
					court_ongoing_1221_a_success_effect = yes
				}
			}
			33 = {
				desc = court_ongoing.1211.b.failure
				send_interface_toast = {
					left_icon = scope:target
					title = court_ongoing.1211.b.failure
					scope:target = { trigger_event = court_ongoing.1225 }
					court_ongoing_1221_b_failure_effect = yes
				}
			}
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = -0.5
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
		}
	}
	
	#I won't do it!
	option = {
		name = court_ongoing.1211.c

		reverse_add_opinion = {
			target = scope:target
			modifier = refusal_opinion
			opinion = -5
		}
	}
}

#success - for target
court_ongoing.1222 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1222.desc
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = sick
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1222.a
		show_as_tooltip = {
			court_ongoing_1221_a_success_target_effect = yes
		}
	}
}

#failure - for target
court_ongoing.1223 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = {
		desc = court_ongoing.1223.desc
		desc = court_ongoing.1223.desc_ending
	}
	left_portrait = {
		character = scope:target
		animation = eyeroll
	}
	right_portrait = {
		character = scope:owner
		animation = wedding_drunk
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1223.a
		show_as_tooltip = {
			court_ongoing_1221_a_failure_target_effect = yes
		}
	}
}

#trickery success - for target
court_ongoing.1224 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = court_ongoing.1222.desc
	left_portrait = {
		character = scope:target
		animation = love
	}
	right_portrait = {
		character = scope:owner
		animation = sick
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1222.a
		show_as_tooltip = {
			court_ongoing_1221_a_success_target_effect = yes
		}
	}
}

#trickery failure - for target
court_ongoing.1225 = {
	type = character_event
	title = court_ongoing.1201.t
	desc = {
		desc = court_ongoing.1225.desc
		desc = court_ongoing.1223.desc_ending
	}
	left_portrait = {
		character = scope:target
		animation = eyeroll
	}
	right_portrait = {
		character = scope:owner
		animation = wedding_drunk
	}
	theme = romance_scheme

	option = {
		name = court_ongoing.1215.a
		show_as_tooltip = {
			court_ongoing_1221_a_failure_target_effect = yes
		}
	}
}
