﻿namespace = trait_specific_ongoing

#lunatic
#1001 - 1999

#possessed
#2001 - 2999

#depressed
#3001 - 3999

#cannibal
#5001 - 5999

#deviant
#6001 - 6999


###############
###############
#	LUNATIC	#
###############
###############

#You're developing 'glass delusion'
#by Linnéa Thimrén
trait_specific_ongoing.1001 = {
	type = character_event
	title = trait_specific_ongoing.1001.t
	desc = trait_specific_ongoing.1001.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = fear
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1001 }
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1002 }
		has_trait = lunatic
	}

	weight_multiplier = {
		base = 0.70
		modifier = { #more likely if you have bad health
			add = 0.5
			health < fine_health
		}
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1001
			years = 10
		}
	}

	option = { #I'm made out of glass!
		name = trait_specific_ongoing.1001.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_character_modifier = {
			modifier = lunatic_made_of_glass_modifier
			years = 10
		}
	}
}


#You believe you're a horse
#by Linnéa Thimrén
trait_specific_ongoing.1002 = {
	type = character_event
	title = trait_specific_ongoing.1002.t
	desc = trait_specific_ongoing.1002.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1002 }
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1001 }
		has_trait = lunatic
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1002
			years = 10
		}
		play_music_cue = "mx_cue_stress"
	}

	option = { #I'm a horse.
		name = trait_specific_ongoing.1002.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_character_modifier = {
			modifier = is_a_horse_modifier
			years = 10
		}
		#To add unique quirk
		if = {
			limit = {
				exists = var:my_quirk
			}
			remove_variable = my_quirk
		}
		set_variable = {
			name = my_quirk
			value = flag:horse
		}
	}

	option = { #No! I'm a human!!
		name = trait_specific_ongoing.1002.b
		add_stress = medium_stress_gain
	}
}


#Collecting animals
#by Linnéa Thimrén
trait_specific_ongoing.1003 = {
	type = character_event
	title = trait_specific_ongoing.1003.t
	desc = trait_specific_ongoing.1003.desc
	theme = mental_health
	override_background = {
		event_background = throne_room
	}
	left_portrait = {
		character = root
		animation = happiness
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1003 }
		has_trait = lunatic
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1003
			years = 10
		}
	}

	option = { #I'll collect them all!
		name = trait_specific_ongoing.1003.a
		flavor = trait_specific_ongoing.1003.a.flavor #Exit stage
		trait = lunatic_1
		trait = lunatic_genetic

		hidden_effect = {
			if = {
				limit = {
					OR = { #at least a cat or dog missing
						NOT = {
							any_owned_story = {
								story_type = story_cycle_pet_cat
							}
						}
						NOT = {
							any_owned_story = {
								story_type = story_cycle_pet_dog
							}
						}
					}
				}
				random = { #chance that you'll get the follow up that let's you get a cat or dog
					chance = 25
					trigger_event = {
						id = trait_specific_ongoing.1004
						days = { 7 14 }
					}
				}
			}
		}
		add_character_modifier = {
			modifier = exotic_animals_modifier
			years = 5
		}
	}

	option = { #I'll sell them off
		name = trait_specific_ongoing.1003.b
		add_stress = medium_stress_gain
		add_gold = medium_gold_value
	}
}


#You get an opportunity to keep a cat or a dog
trait_specific_ongoing.1004 = {
	type = character_event
	title = trait_specific_ongoing.1004.t
	desc = {
		desc = trait_specific_ongoing.1004.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:cat_story
				}
				desc = trait_specific_ongoing.1004.desc_cat
			}
			desc = trait_specific_ongoing.1004.desc_dog
		}
	}
	theme = mental_health
	left_portrait = root

	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		capital_province = {
			barony = {
				save_scope_as = court_location
			}
		}
		hidden_effect = {
			random_list = {
				50 = {
					trigger = {
						NOT = {
							any_owned_story = {
								story_type = story_cycle_pet_cat
							}
						}
					}
					assign_cat_eye_color_effect = { COLOR = random }
					save_scope_value_as = {
						name = cat_story
						value = yes
					}
				}
				50 = {
					trigger = {
						NOT = {
							any_owned_story = {
								story_type = story_cycle_pet_dog
							}
						}
					}
				}
			}
		}
	}

	option = { #Keep it! Cat
		name = trait_specific_ongoing.1004.a
		trigger = {
			exists = scope:cat_story
		}
		start_cat_story_cycle_effect = yes
	}

	option = { #Keep it! Dog
		name = trait_specific_ongoing.1004.b
		trigger = {
			NOT = { exists = scope:cat_story }
		}
		start_dog_story_cycle_effect = yes
	}

	option = { #sell it!
		name = {
			trigger = { exists = scope:cat_story }
			text = trait_specific_ongoing.1004.c_cat
		}
		name = {
			trigger = { NOT = { exists = scope:cat_story } }
			text = trait_specific_ongoing.1004.c_dog
		}
		add_gold = minor_gold_value
	}

	after = {
		remove_variable = cat_eye_color
	}
}


#Talk to dead people
#by Linnéa Thimrén
trait_specific_ongoing.1005 = {
	type = character_event
	title = trait_specific_ongoing.1005.t
	desc = trait_specific_ongoing.1005.desc
	theme = mental_health
	override_background = {
		event_background = alley_night
	}
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = scope:dead_person
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1005 }
		has_trait = lunatic
		OR = {
			any_parent = {
				even_if_dead = yes
				is_alive = no
			}
			any_spouse = {
				even_if_dead = yes
				is_alive = no
			}
			any_child = {
				even_if_dead = yes
				is_alive = no
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1005
			years = 10
		}
		hidden_effect = {
			random_list = {
				50 = {
					trigger = {
						any_parent = {
							even_if_dead = yes
							is_alive = no
						}
					}
					random_parent = {
						even_if_dead = yes
						limit = {
							is_alive = no
						}
						save_scope_as = dead_person
					}
				}
				50 = {
					trigger = {
						any_spouse = {
							even_if_dead = yes
							is_alive = no
						}
					}
					random_spouse = {
						even_if_dead = yes
						limit = {
							is_alive = no
						}
						save_scope_as = dead_person
					}
				}
				50 = {
					trigger = {
						any_child = {
							even_if_dead = yes
							is_alive = no
						}
					}
					random_child = {
						even_if_dead = yes
						limit = {
							is_alive = no
						}
						save_scope_as = dead_person
					}
				}
			}
		}
	}

	option = { #I'm so glad you're ok!
		name = trait_specific_ongoing.1005.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_stress = medium_stress_loss
		hidden_effect = {
			random = {
				chance = 25
				trigger_event = {
					id = trait_specific_ongoing.1006
					days = { 365 400 }
				}
			}
		}
	}
}


#Dead people won't leave you alone
#by Linnéa Thimrén
trait_specific_ongoing.1006 = {
	type = character_event
	title = trait_specific_ongoing.1005.t
	desc = trait_specific_ongoing.1006.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = scope:dead_person

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = {
		name = trait_specific_ongoing.1006.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_character_modifier = {
			modifier = seeing_dead_people_modifier
			years = 5
		}
	}
}


#A lunatic dreams of glass (enables the decision_lunatic_building decision)
#by Linnéa Thimrén
trait_specific_ongoing.1007 = {
	type = character_event
	title = trait_specific_ongoing.1007.t
	desc = trait_specific_ongoing.1007.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = ecstasy
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1007 }
		has_trait = lunatic
	}

	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1007
			years = 20
		}
		add_character_flag = glass_dream
	}

	option = {
		name = trait_specific_ongoing.1007.a
		trait = lunatic_1
		trait = lunatic_genetic
		custom_tooltip = trait_specific_ongoing.1007.a.tt
	}
}


#You kill a friend :(
#by Linnéa Thimrén
trait_specific_ongoing.1008 = {
	type = character_event
	title = trait_specific_ongoing.1008.t
	desc = trait_specific_ongoing.1008.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:friend
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1008 }
		has_trait = lunatic
		any_relation = {
			type = friend
			is_ai = yes
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #more likely if you are angry
			add = 0.5
			has_trait = wrathful
		}
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1008
			years = 20
		}
		random_relation = {
			type = friend
			limit = {
				is_ai = yes
			}
			save_scope_as = friend
		}
		unknown_murder_effect = {
			VICTIM = scope:friend
			MURDERER = root
			REASON = death_murder
		}
		random_secret = {
			limit = {
				secret_type = secret_murder
				secret_target = scope:friend
			}
			save_scope_as = secret
		}
	}

	option = { #Ahhhh! What have I done?!
		name = trait_specific_ongoing.1008.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_stress = major_stress_gain
	}

	option = { #I must confess!
		name = trait_specific_ongoing.1008.b
		trait = lunatic_1
		trait = lunatic_genetic
		scope:secret = {
			expose_secret = root
		}
	}
}

#Grandiose delusions
#by Linnéa Thimrén
trait_specific_ongoing.1009 = {
	type = character_event
	title = trait_specific_ongoing.1009.t
	desc = trait_specific_ongoing.1009.desc
	theme = mental_health
	override_background = {
		event_background = alley_day
	}
	left_portrait = {
		character = root
		animation = ecstasy
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1009 }
		has_trait = lunatic
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1009
			years = 20
		}
	}

	option = { #Ahhhh!
		name = trait_specific_ongoing.1009.a
		trait = lunatic_1
		trait = lunatic_genetic
		random_list = {
			80 = {
				desc = trait_specific_ongoing.1009.a.success
				add_prestige = medium_prestige_gain
			}
			20 = {
				desc = trait_specific_ongoing.1009.a.failure
				increase_wounds_effect = { REASON = fall }
			}
		}
	}
}

#You love your warhorse
#by Linnéa Thimrén
trait_specific_ongoing.1010 = {
	type = character_event
	title = trait_specific_ongoing.1010.t
	desc = trait_specific_ongoing.1010.desc
	theme = mental_health
	override_background = {
		event_background = throne_room
	}
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1010 }
		has_trait = lunatic
		any_owned_story = {
			story_type = story_cycle_martial_lifestyle_warhorse
			exists = var:story_cycle_horse_name
		}
	}

	immediate = {
		play_music_cue = "mx_cue_general_crusade_event_1"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1010
			years = 20
		}
	}

	option = { #
		name = trait_specific_ongoing.1010.a
		trait = lunatic_1
		trait = lunatic_genetic

		hidden_effect = {
			random_list = {
				10 = {
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:strength
					}
				}
				10 = {
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:agility
					}
				}
				10 = {
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:endurance
					}
				}
				10 = {
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:fierceness
					}
				}
			}
		}	
		level_horse_modifier_effect = yes
	}
}

#Force your court to be naked
#by Linnéa Thimrén
trait_specific_ongoing.1011 = {
	type = character_event
	title = trait_specific_ongoing.1011.t
	desc = trait_specific_ongoing.1011.desc
	theme = mental_health
	override_background = {
		event_background = throne_room
	}
	left_portrait = {
		character = root
		animation = personality_cynical
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1011 }
		has_trait = lunatic
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1011
			years = 20
		}
	}

	option = { #Everyone should go naked!
		name = trait_specific_ongoing.1011.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_character_modifier = diplomacy_majesty_4090_no_raiment_modifier
		every_courtier = {
			custom = all_adult_courtiers
			limit = {
				is_adult = yes
			}
			add_character_modifier = diplomacy_majesty_4090_no_raiment_modifier
		}
	}
}

#Ravings
#by Petter Vilberg
trait_specific_ongoing.1012 = {
	type = character_event
	title = trait_specific_ongoing.1012.t
	desc = trait_specific_ongoing.1012.desc
	theme = mental_health
	override_background = {
		event_background = courtyard
	}
	left_portrait = {
		character = root
		animation = worried
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_1012 }
		has_trait = lunatic
		NOT = { has_character_modifier = lunatic_bat_ravings_modifier }
		is_available_adult = yes
		is_landed = yes
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_1012
			years = 20
		}
		capital_barony = {
			save_scope_as = capital
		}
	}

	option = { #What is happening?
		name = trait_specific_ongoing.1012.a
		trait = lunatic_1
		trait = lunatic_genetic
		add_prestige = medium_prestige_loss
		ai_chance = {
			base = 50
		}
	}

	option = { #I will be prepared!
		name = trait_specific_ongoing.1012.b
		trait = lunatic_1
		trait = lunatic_genetic
		add_character_modifier = {
			modifier = lunatic_bat_ravings_modifier
			years = 20
		}
		ai_chance = {
			base = 50
		}
	}
}

### Paranoid delusions ###

#Triggers the yearly suspicion event even when no one suspicious is around
trait_specific_ongoing.1015 = {
	hidden = yes

	trigger = {
		NOT = { has_character_flag = had_event_yearly_1080 }
		has_trait = lunatic
	}

	immediate = {
		trigger_event = yearly.1080
	}
}





#################
#################
#	POSSESSED	#
#################
#################

### DIVINE OR WITCHY VISIONS? ###
trait_specific_ongoing.2001 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2001.t
	desc = {
		desc = trait_specific_ongoing.2001.start.desc
		random_valid = {
			desc = trait_specific_ongoing.2001.dread.desc
			desc = trait_specific_ongoing.2001.anxiety.desc
			desc = trait_specific_ongoing.2001.euphoria.desc
			desc = trait_specific_ongoing.2001.joy.desc
			desc = trait_specific_ongoing.2001.nausea.desc
		}
		desc = trait_specific_ongoing.2001.walls.desc
		random_valid = {
			desc = trait_specific_ongoing.2001.sulfur.desc
			desc = trait_specific_ongoing.2001.smoke.desc
			desc = trait_specific_ongoing.2001.citrus.desc
			desc = trait_specific_ongoing.2001.lavender.desc
			desc = trait_specific_ongoing.2001.bile.desc
			desc = trait_specific_ongoing.2001.incense.desc
			desc = trait_specific_ongoing.2001.blood.desc
		}
		desc = trait_specific_ongoing.2001.stand_before_me.desc
		random_valid = {
			desc = trait_specific_ongoing.2001.glowing.desc
			desc = trait_specific_ongoing.2001.hazy.desc
			desc = trait_specific_ongoing.2001.dark.desc
			desc = trait_specific_ongoing.2001.shaking.desc
			desc = trait_specific_ongoing.2001.shimmering.desc
		}
		desc = trait_specific_ongoing.2001.speaking.desc
		random_valid = {
			desc = trait_specific_ongoing.2001.whispers.desc
			desc = trait_specific_ongoing.2001.screeches.desc
			desc = trait_specific_ongoing.2001.chimes.desc
			desc = trait_specific_ongoing.2001.raindrops.desc
			desc = trait_specific_ongoing.2001.thunder.desc
		}
		desc = trait_specific_ongoing.2001.end.desc
	}

	theme = mental_health
	left_portrait = root
	
	trigger = {
		has_trait = possessed
		NOR = {
			has_character_flag = had_event_trait_specific_ongoing_2001
			is_witch_trigger = yes
			has_character_modifier = possessed_prophetic_visions
		}
		exists = cp:councillor_court_chaplain
		cp:councillor_court_chaplain = {
			basic_is_available_ai = yes
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_2001
		}
		cp:councillor_court_chaplain = { save_scope_as = clergy }
	}

	# Visions from God!
	option = {
		name = trait_specific_ongoing.2001.a
	
		duel = {
			target = scope:clergy
			skill = learning
			60 = { # They believe you
				modifier = {
					add = {
						value = root.ai_honor #You are trustworthy
						divide = 2
					}
				}
				opinion_modifier = {
					who = scope:clergy
					opinion_target = root
					multiplier = 0.75
				}
				modifier = {
					scope:clergy = { has_trait = trusting }
					add = 20
				}
				desc = trait_specific_ongoing.2001.a.success
				send_interface_toast = {
					title = trait_specific_ongoing.2001.a.success
					left_icon = scope:clergy
					add_character_modifier = {
						modifier = possessed_prophetic_visions
					}
					add_piety = medium_piety_gain
				}
			}
			40 = { # They don't believe you
				opinion_modifier = {
					who = scope:clergy
					opinion_target = root
					multiplier = -0.5
				}
				desc = trait_specific_ongoing.2001.a.failure
				send_interface_toast = {
					title = trait_specific_ongoing.2001.a.failure
					left_icon = scope:clergy
					add_piety = minor_piety_loss
					reverse_add_opinion = {
						target = scope:clergy
						modifier = impious_opinion
						opinion = -10
					}
				}
			}
		}

		stress_impact = {
			cynical = major_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_zeal = 5
				ai_boldness = 2
			}
		}
	}

	# Secret knowledge?
	option = {
		name = trait_specific_ongoing.2001.b
		
		random_list = {
			desc = outcome_in_a_few_weeks
			50 = {
				desc = trait_specific_ongoing.2001.b.success
				custom_tooltip = trait_specific_ongoing.2001.b.success.tt
				modifier = {
					any_courtier_or_guest = {
						is_witch_trigger = yes
					}
					add = 50
				}
				show_as_tooltip = {
					add_character_modifier = {
						modifier = seeker_of_knowledge
						years = 10
					}
				}
				trigger_event = {
					id = trait_specific_ongoing.2002
					days = { 7 21 }
				}
			}
			50 = {
				desc = trait_specific_ongoing.2001.b.failure
				show_as_tooltip = {
					add_character_modifier = {
						modifier = seeker_of_knowledge
						years = 10
					}
				}
				trigger_event = {
					id = trait_specific_ongoing.2003
					days = { 7 21 }
				}
			}
		}

		stress_impact = {
			zealous = major_stress_impact_gain
			craven = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_zeal = -5
				ai_boldness = 1
			}
		}	
	}
	
	# I need to relax
	option = {
		name = trait_specific_ongoing.2001.c

		add_stress = medium_stress_loss

		ai_chance = {
			base = 200

			ai_value_modifier = {
				ai_energy = -2
			}
		}
	}
}

# I can become a witch
trait_specific_ongoing.2002 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2001.t
	desc = trait_specific_ongoing.2002.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	immediate = {
		add_character_modifier = {
			modifier = seeker_of_knowledge
			years = 10
		}
	}

	option = {
		name = trait_specific_ongoing.2002.a

		give_witch_secret_or_trait_effect = yes

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = trait_specific_ongoing.2002.b

		if = {
			limit = { NOT = { faith = { has_doctrine_parameter = witchcraft_accepted } } }
			add_piety = miniscule_piety_gain
		}

		ai_chance = {
			base = 0
		}
	}
}


# I found nothing special
trait_specific_ongoing.2003 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2001.t
	desc = trait_specific_ongoing.2003.desc
	theme = mental_health
	left_portrait = root

	immediate = {
		add_character_modifier = {
			modifier = seeker_of_knowledge
			years = 10
		}
	}

	option = {
		name = trait_specific_ongoing.2003.a
	}	
}


### WHICH GOD/SAINT IS SPEAKING TO ME? ###
scripted_trigger trait_specific_ongoing_2010_has_god_option_trigger = {
	OR = {
		trigger_if = {
			limit = { exists = scope:god_1 }
			scope:god_1 = flag:$GOD$
		}
		trigger_if = {
			limit = { exists = scope:god_2 }
			scope:god_2 = flag:$GOD$
		}
		trigger_if = {
			limit = { exists = scope:god_3 }
			scope:god_3 = flag:$GOD$
		}
	}
}

scripted_effect trait_specific_ongoing_2010_god_option_effect = {
	random_list = {
		#health
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = health } } }
			modifier = {
				health <= fine_health
				add = 3
			}
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:health
			}
		}
		#fertility
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = fertility } } }
			modifier = {
				OR = {
					NOT = { exists = player_heir }
					NOT = { any_child = { always = yes } }
				}
				add = 3
			}
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:fertility
			}
		}
		#wealth
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = wealth } } }
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:wealth
			}
		}
		#household
		1 = {
			trigger = {
				NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = household } }
				OR = {
					any_close_family_member = { always = yes }
					any_spouse = { always = yes }
				}
			}
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:household
			}
		}
		#knowledge
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = knowledge } } }
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:knowledge
			}
		}
		#war
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = war } } }
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:war
			}
		}
		#trickster
		1 = {
			trigger = { NOT = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = trickster } } }
			save_scope_value_as = {
				name = $SCOPE_NAME$
				value = flag:trickster
			}
		}
	}
}

scripted_trigger trait_specific_ongoing_2010_block_trigger = {
	NOR = {
		has_character_flag = event_cooldown_trait_specific_ongoing_2010
		faith.religion = religion:islam_religion
		faith = faith:cathar
		faith = faith:waldensian
		faith = faith:lollard
		faith = faith:iconoclast
		faith = faith:bogomilist
		faith = faith:paulician
		faith = faith:nestorian
		faith = faith:messalian
		faith = faith:paulician
		faith = faith:bosnian_church
		faith = faith:zun_pagan
	}
}

scripted_trigger trait_specific_ongoing_2010_zeal_condition_trigger = {
	ai_zeal >= high_positive_ai_value
}

scripted_trigger trait_specific_ongoing_2010_possessed_condition_trigger = {
	has_trait = possessed
	has_character_modifier = possessed_prophetic_visions
}

trait_specific_ongoing.2009 = { #This event is a small pre-event to ensure possessed if this event comes via the trait-specific on-action
	hidden = yes

	trigger = {
		trait_specific_ongoing_2010_possessed_condition_trigger = yes
		### Note: Specific faith limitations ###
		# Because certain faiths don't have enough loc keys to support this event or specific options, any future bugs should be fixed by blocking the faith in this scripted trigger or blocking specific options in the scripted effect
		trait_specific_ongoing_2010_block_trigger = yes
	}

	immediate = {
		trigger_event = trait_specific_ongoing.2010
	}
}

trait_specific_ongoing.2010 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_trait = possessed }
				desc = trait_specific_ongoing.2010.possessed_start.desc
			}
			desc = trait_specific_ongoing.2010.zeal_start.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:god_1 = flag:health }
				desc = trait_specific_ongoing.2010.health.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:fertility }
				desc = trait_specific_ongoing.2010.fertility.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:wealth }
				desc = trait_specific_ongoing.2010.wealth.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:household }
				desc = trait_specific_ongoing.2010.household.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:knowledge }
				desc = trait_specific_ongoing.2010.knowledge.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:war }
				desc = trait_specific_ongoing.2010.war.desc
			}
			triggered_desc = {
				trigger = { scope:god_1 = flag:trickster }
				desc = trait_specific_ongoing.2010.trickster.desc
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:god_2 = flag:health }
				desc = trait_specific_ongoing.2010.health.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:fertility }
				desc = trait_specific_ongoing.2010.fertility.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:wealth }
				desc = trait_specific_ongoing.2010.wealth.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:household }
				desc = trait_specific_ongoing.2010.household.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:knowledge }
				desc = trait_specific_ongoing.2010.knowledge.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:war }
				desc = trait_specific_ongoing.2010.war.desc
			}
			triggered_desc = {
				trigger = { scope:god_2 = flag:trickster }
				desc = trait_specific_ongoing.2010.trickster.desc
			}
		}
		first_valid = {
			triggered_desc = {
				trigger = { scope:god_3 = flag:health }
				desc = trait_specific_ongoing.2010.and_health.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:fertility }
				desc = trait_specific_ongoing.2010.and_fertility.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:wealth }
				desc = trait_specific_ongoing.2010.and_wealth.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:household }
				desc = trait_specific_ongoing.2010.and_household.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:knowledge }
				desc = trait_specific_ongoing.2010.and_knowledge.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:war }
				desc = trait_specific_ongoing.2010.and_war.desc
			}
			triggered_desc = {
				trigger = { scope:god_3 = flag:trickster }
				desc = trait_specific_ongoing.2010.and_trickster.desc
			}
		}
		desc = trait_specific_ongoing.2010.end.desc
	}
	theme = mental_health
	override_icon = {
		trigger = { NOT = { has_trait = possessed } }
		reference = "gfx/interface/event_window/type_faith.dds"
	}
	left_portrait = root

	trigger = {
		OR = {
			trait_specific_ongoing_2010_zeal_condition_trigger = yes
			trait_specific_ongoing_2010_possessed_condition_trigger = yes
		}
		### Note: Specific faith limitations ###
		# Because certain faiths don't have enough loc keys to support this event or specific options, any future bugs should be fixed by blocking the faith in this scripted trigger or blocking specific options in the scripted effect
		trait_specific_ongoing_2010_block_trigger = yes
	}

	immediate = {
		play_music_cue = "mx_cue_succession_instrumental"
		add_character_flag = {
			flag = event_cooldown_trait_specific_ongoing_2010
			years = 15
		}
		trait_specific_ongoing_2010_god_option_effect = { SCOPE_NAME = god_1 }
		trait_specific_ongoing_2010_god_option_effect = { SCOPE_NAME = god_2 }
		trait_specific_ongoing_2010_god_option_effect = { SCOPE_NAME = god_3 }
	}

	#health
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = health } }
		name = trait_specific_ongoing.2010.health

		add_character_modifier = {
			modifier = invigorated_modifier
			years = 10
		}

		add_stress = medium_stress_loss
	}	

	#fertility
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = fertility } }
		name = trait_specific_ongoing.2010.fertility

		add_character_modifier = {
			modifier = confident_lover
			years = 10
		}
	}

	#wealth
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = wealth } }
		name = trait_specific_ongoing.2010.wealth

		add_character_modifier = {
			modifier = confident_organizer
			years = 10
		}
	}

	#household
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = household } }
		name = trait_specific_ongoing.2010.household

		every_close_family_member = {
			add_to_list = household
		}
		every_spouse = {
			add_to_list = household
		}
		every_in_list = {
			list = household
			custom = trait_specific_ongoing.2010.household.tt
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 15
			}
		}
	}

	#knowledge
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = knowledge } }
		name = trait_specific_ongoing.2010.knowledge

		add_character_modifier = {
			modifier = confident_scholar
			years = 10
		}
	}

	#war
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = war } }
		name = trait_specific_ongoing.2010.war

		add_character_modifier = {
			modifier = confident_strategist
			years = 10
		}
	}

	#trickster
	option = {
		trigger = { trait_specific_ongoing_2010_has_god_option_trigger = { GOD = trickster } }
		name = trait_specific_ongoing.2010.trickster

		add_character_modifier = {
			modifier = confident_schemer
			years = 10
		}
	}

	#Fallback
	option = {
		name = trait_specific_ongoing.2010.fallback

		add_piety = minor_piety_gain
	}
}

### COURT CHAPLAIN WANTS TO TREAT YOU ###

trait_specific_ongoing.2015 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2015.t
	desc = {
		desc = trait_specific_ongoing.2015.desc
		triggered_desc = {
			trigger = { exists = scope:physician }
			desc = trait_specific_ongoing.2015.physician.desc
		}
	}
	theme = mental_health
	left_portrait = scope:chaplain
	right_portrait = scope:physician
	
	trigger = {
		has_trait = possessed
		NOR = {
			has_character_modifier = possessed_prophetic_visions
			has_character_flag = had_event_trait_specific_ongoing_2015
		}
		exists = cp:councillor_court_chaplain
		cp:councillor_court_chaplain = {
			basic_is_available_ai = yes
		}
	}

	immediate = {
		cp:councillor_court_chaplain = { save_scope_as = chaplain }
		add_character_flag = had_event_trait_specific_ongoing_2015

		if = {
			limit = {
				court_physician_available_trigger = yes
				any_relation = {
					type = court_physician
					OR = {
						learning >= high_skill_rating
						has_trait = lifestyle_physician
					}
					NOT = { this = scope:chaplain }
				}
			}
			save_court_physician_as_effect = { SCOPE_NAME = physician }
		}
	}

	# Prayer
	option = {
		name = trait_specific_ongoing.2015.a
		save_scope_value_as = {
			name = possessed_treatment
			value = flag:prayer
		}

		add_piety = minor_piety_gain

		# Not likely to have effects, but pretty risk-free
		random_list = {
			desc = outcome_in_a_few_weeks
			1 = { # Success
				desc = trait_specific_ongoing.2015.a.success
				show_as_tooltip = {
					remove_trait = possessed_genetic
					remove_trait = possessed_1
				}
				trigger_event = {
					id = trait_specific_ongoing.2016
					days = { 7 14 }
				}
			}
			4 = { # Failure
				desc = trait_specific_ongoing.2015.a.failure
				trigger_event = {
					id = trait_specific_ongoing.2017
					days = { 7 14 }
				}
			}
		}

		stress_impact = {
			cynical = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {	
				ai_zeal = 3
			}
		}
	}

	# Fasting
	option = {
		name = trait_specific_ongoing.2015.b
		save_scope_value_as = {
			name = possessed_treatment
			value = flag:fasting
		}

		add_piety = medium_piety_gain

		#More extreme, with higher risks but greater potential for rewards
		random_list = {
			desc = outcome_in_a_few_weeks
			45 = { # Success
				desc = trait_specific_ongoing.2015.b.success
				show_as_tooltip = {
					remove_trait = possessed_genetic
					remove_trait = possessed_1
				}
				trigger_event = {
					id = trait_specific_ongoing.2016
					days = { 7 14 }
				}
			}
			45 = { # Failure (small health penalty)
				desc = trait_specific_ongoing.2015.b.failure_health
				show_as_tooltip = {
					add_character_modifier = {
						modifier = fasting_bad_modifier
						years = 3
					}
				}
				trigger_event = {
					id = trait_specific_ongoing.2018
					days = { 7 14 }
				}
			}
			100 = { #Failure (eating issues)
				trigger = {
					NOR = {
						has_trait = comfort_eater
						has_trait = inappetetic
					}
				}
				desc = trait_specific_ongoing.2015.b.failure_eating
				custom_tooltip = trait_specific_ongoing.2015.b.failure_eating.tt
				trigger_event = {
					id = trait_specific_ongoing.2019
					days = { 7 14 }
				}
			}
		}

		stress_impact = {
			cynical = medium_stress_impact_gain
			comfort_eater = major_stress_impact_gain
			inappetetic = minor_stress_impact_loss
			gluttonous = medium_stress_impact_gain
		}

		ai_chance = {
			base = 50
			ai_value_modifier = {	
				ai_zeal = 3
				ai_boldness = 2
			}
		}
	}

	#Court physician: get rest and avoid shiny objects
	option = {
		trigger = {
			exists = scope:physician
		}
		name = trait_specific_ongoing.2015.c
		save_scope_value_as = {
			name = possessed_treatment
			value = flag:physician
		}

		add_stress = minor_stress_loss

		# More likely to work and risk-free
		random_list = {
			desc = outcome_in_a_few_weeks
			5 = { # Success
				desc = trait_specific_ongoing.2015.c.success
				show_as_tooltip = {
					remove_trait = possessed_genetic
					remove_trait = possessed_1
				}
				trigger_event = {
					id = trait_specific_ongoing.2016
					days = { 7 14 }
				}
			}
			5 = { # Failure
				desc = trait_specific_ongoing.2015.a.failure
				trigger_event = {
					id = trait_specific_ongoing.2017
					days = { 7 14 }
				}
			}
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {	
				ai_zeal = -2
				ai_rationality = 2
			}
		}
	}
	
	# No!
	option = {
		name = trait_specific_ongoing.2015.e
		
		reverse_add_opinion = {
			target = scope:chaplain
			modifier = refusal_opinion
			opinion = -10
		}
		if = {
			limit = { exists = scope:physician }
			reverse_add_opinion = {
				target = scope:physician
				modifier = refusal_opinion
				opinion = -10
			}
		}

		ai_chance = {
			base = 50
		}
	}
}	


# It went well! I am cured!
trait_specific_ongoing.2016 = {
	type = character_event
	title = trait_specific_ongoing.2015.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:possessed_treatment = flag:prayer }
				desc = {
					desc = trait_specific_ongoing.2016.prayer1.desc
					desc = trait_specific_ongoing.2016.prayer2.desc
				}
			}
			triggered_desc = {
				trigger = { scope:possessed_treatment = flag:fasting }
				desc = {
					desc = trait_specific_ongoing.2016.fasting1.desc
					desc = trait_specific_ongoing.2016.fasting2.desc
				}
			}
			triggered_desc = {
				trigger = { scope:possessed_treatment = flag:physician }
				desc = {
					desc = trait_specific_ongoing.2016.physician1.desc
					desc = trait_specific_ongoing.2016.physician2.desc
				}
			}
		}
	}
	theme = mental_health
	left_portrait = {
		character = root
		animation = happiness
	}

	immediate = {
		play_music_cue = "mx_cue_peace_ensues"
		if = {
			limit = { has_trait = possessed_1 }
			remove_trait = possessed_1
		}
		else_if = {
			limit = { has_trait = possessed_genetic }
			make_trait_inactive = possessed_genetic
		}
		trigger_event = {
			id = trait_specific_ongoing.2020 #Relapse
			days = { 365 2000 }
		}
	}

	#Yay!
	option = {
		name = {
			text = {
				desc = {
					first_valid = {
						triggered_desc = {
							trigger = { scope:possessed_treatment = flag:physician }
							desc = trait_specific_ongoing.2016.a.physician
						}
						desc = trait_specific_ongoing.2016.a.chaplain
					}
				}
			}
		}
		
	}
}

# Nothing happened
trait_specific_ongoing.2017 = {
	type = character_event
	title = trait_specific_ongoing.2015.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:possessed_treatment = flag:prayer }
				desc = {
					desc = trait_specific_ongoing.2016.prayer1.desc
					desc = trait_specific_ongoing.2017.prayer2.desc
				}
			}
			triggered_desc = {
				trigger = { scope:possessed_treatment = flag:physician }
				desc = {
					desc = trait_specific_ongoing.2016.physician1.desc
					desc = trait_specific_ongoing.2017.physician2.desc
				}
			}
		}
	}
	theme = mental_health
	left_portrait = root

	option = {
		name = trait_specific_ongoing.2017.a
	}
}


# Fasting was bad for my health...
trait_specific_ongoing.2018 = {
	type = character_event
	title = trait_specific_ongoing.2015.t
	desc = {
		desc = trait_specific_ongoing.2016.fasting1.desc
		desc = trait_specific_ongoing.2018.fasting2.desc
	}
	theme = mental_health
	left_portrait = root

	immediate = {
		add_character_modifier = {
			modifier = fasting_bad_modifier
			years = 3
		}
	}

	#Nay...
	option = {
		name = trait_specific_ongoing.2018.a
	}
}

# Fasting was bad for my relationship with food
trait_specific_ongoing.2019 = {
	type = character_event
	title = trait_specific_ongoing.2015.t
	desc = {
		desc = trait_specific_ongoing.2016.fasting1.desc
		desc = trait_specific_ongoing.2019.fasting2.desc
	}
	theme = mental_health
	left_portrait = root

	trigger = {	
		NOR = {
			has_trait = comfort_eater
			has_trait = inappetetic
		}
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = trait_specific_ongoing.2019.a

		add_trait = comfort_eater

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 2
			}
		}
	}

	option = {
		name = trait_specific_ongoing.2019.b

		add_trait = inappetetic

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = -2
			}
		}
	}
}


### POSSESSED REOCCURANCE EVENT ###

# I am experiencing symptoms again
trait_specific_ongoing.2020 = {
	type = character_event
	title = trait_specific_ongoing.2020.t
	desc = {
		desc = trait_specific_ongoing.2020.start.desc
		random_valid = {
			desc = trait_specific_ongoing.2020.dread.desc
			desc = trait_specific_ongoing.2020.fear.desc
			desc = trait_specific_ongoing.2020.anxiety.desc
			desc = trait_specific_ongoing.2020.nausea.desc
			desc = trait_specific_ongoing.2020.anger.desc
		}
		desc = trait_specific_ongoing.2020.end.desc

	}
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	#Nay!
	option = {
		name = trait_specific_ongoing.2020.a

		if = {
			limit = { has_inactive_trait = possessed_genetic }
			make_trait_active = possessed_genetic
		}
		else_if = {
			add_trait = possessed_1
		}
	}
}		

### SEIZURE SURROUNDED BY PEOPLE ###

scripted_effect trait_specific_ongoing_2025_d_success_effect = {
	add_piety = medium_piety_gain
	every_courtier = {
		custom = trait_specific_ongoing.2025.every_courtier
		add_opinion = {
			target = root
			modifier = pious_opinion
			opinion = 20
		}
	}
}

scripted_effect trait_specific_ongoing_2025_d_failure_effect = {
	add_piety = medium_piety_loss
	every_courtier = {
		custom = trait_specific_ongoing.2025.every_courtier
		add_opinion = {
			target = root
			modifier = impious_opinion
			opinion = -10
		}
	}
}

scripted_trigger trait_specific_ongoing_2025_d_honest_trigger = {
	OR = {
		ai_zeal >= medium_positive_ai_value
		has_character_modifier = possessed_prophetic_visions
		AND = {
			ai_honor >= medium_positive_ai_value
			ai_zeal > 0
		}
	}
}

trait_specific_ongoing.2025 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.2025.t
	desc = {
		desc = trait_specific_ongoing.2025.start.desc
		random_valid = {
			desc = trait_specific_ongoing.2001.sulfur.desc
			desc = trait_specific_ongoing.2001.smoke.desc
			desc = trait_specific_ongoing.2001.lavender.desc
			desc = trait_specific_ongoing.2001.bile.desc
			desc = trait_specific_ongoing.2001.incense.desc
			desc = trait_specific_ongoing.2001.blood.desc
		}
		desc = trait_specific_ongoing.2025.end.desc
	}
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}
	right_portrait = scope:helper
	lower_left_portrait = scope:courtier_1
	lower_center_portrait = scope:courtier_2
	lower_right_portrait = scope:courtier_3
	
	trigger = {
		has_trait = possessed
		NOT = { has_character_flag = had_event_trait_specific_ongoing_2025 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
		add_character_flag = had_event_trait_specific_ongoing_2025

		random_courtier = {
			limit = {
				age >= 10
				basic_is_available_ai = yes
				OR = {
					has_relation_friend = root
					has_relation_lover = root
					is_spouse_of = root
					is_child_of = root
				}
				opinion = {
					target = root
					value >= low_positive_opinion
				}
			}
			save_scope_as = helper
		}

		#For portraits and desc
		if = {
			limit = { is_ai = no }
			random_dummy_gender_effect = yes
			random_courtier = {
				limit = {
					basic_is_available_ai = yes
					is_adult = yes
					trigger_if = {
						limit = { exists = scope:helper }
						NOT = { this = scope:helper }
					}
				}
				weight = {
					base = 1
					modifier = {
						OR = {
							is_heir_of = root
							is_councillor_of = root
							is_consort_of = root
						}
						add = 5
					}
				}
				save_scope_as = courtier_1
			}
			if = {
				limit = { exists = scope:courtier_1 }
				random_courtier = {
					limit = {
						basic_is_available_ai = yes
						is_adult = yes
						NOR = {
							trigger_if = {
								limit = { exists = scope:helper }
								NOT = { this = scope:helper }
							}
							this = scope:courtier_1
						}
					}
					weight = {
						base = 1
						modifier = {
							OR = {
								is_heir_of = root
								is_councillor_of = root
								is_consort_of = root
							}
							add = 5
						}
					}
					save_scope_as = courtier_2
				}
			}
			if = {
				limit = { exists = scope:courtier_2 }
				random_courtier = {
					limit = {
						basic_is_available_ai = yes
						is_adult = yes
						NOR = {
							trigger_if = {
								limit = { exists = scope:helper }
								NOT = { this = scope:helper }
							}
							this = scope:courtier_1
							this = scope:courtier_2
						}
					}
					weight = {
						base = 1
						modifier = {
							OR = {
								is_heir_of = root
								is_councillor_of = root
								is_consort_of = root
							}
							add = 5
						}
					}
					save_scope_as = courtier_3
				}
			}
		}
	}

	# Run away
	option = {
		name = trait_specific_ongoing.2025.a
		
		add_prestige = miniscule_prestige_loss

		stress_impact = {
			brave = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -2
			}
		}
	}

	# Stay
	option = {
		name = trait_specific_ongoing.2025.b

		random_list = {
			60 = {
				desc = trait_specific_ongoing.2025.b.success
				send_interface_toast = {
					title = trait_specific_ongoing.2025.b.failure
					add_prestige = medium_prestige_gain
					every_courtier = {
						custom = trait_specific_ongoing.2025.every_courtier
						add_opinion = {
							target = root
							modifier = respect_opinion
							opinion = 10
						}
					}
				}
			}
			40 = {
				desc = trait_specific_ongoing.2025.b.failure
				send_interface_toast = {
					title = trait_specific_ongoing.2025.b.failure
					add_prestige = minor_prestige_loss
					add_stress = medium_stress_gain
				}
			}
		}

		stress_impact = {
			craven = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_boldness = 2
			}
		}
	}

	# Ask for help
	option = {
		trigger = { exists = scope:helper }
		name = trait_specific_ongoing.2025.c

		progress_towards_friend_effect = { CHARACTER = scope:helper OPINION = yes }
		
		scope:helper = {
			add_hook = {
				type = favor_hook
				target = root
			}
		}

		stress_impact = {
			callous = minor_stress_impact_gain
			sadistic = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
			shy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 1
				ai_sociability = 2
			}
		}
	}

	# You think it's a message from God
	option = {
		trigger = { trait_specific_ongoing_2025_d_honest_trigger = yes }
		name = trait_specific_ongoing.2025.d
	
		duel = {
			skill = learning
			value = average_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
				}
				modifier = {
					has_character_modifier = possessed_prophetic_visions
					add = 80
				}
				desc = trait_specific_ongoing.2025.d.success
				send_interface_toast = {
					title = trait_specific_ongoing.2025.d.success
					trait_specific_ongoing_2025_d_success_effect = yes
					if = {
						limit = { NOT = { has_character_modifier = possessed_prophetic_visions } }
						add_character_modifier = {
							modifier = possessed_prophetic_visions
						}
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				desc = trait_specific_ongoing.2025.d.failure
				send_interface_toast = {
					title = trait_specific_ongoing.2025.d.failure
					trait_specific_ongoing_2025_d_failure_effect = yes
				}
			}
		}

		stress_impact = {
			craven = minor_stress_impact_gain
			shy = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 3
			}
		}
	}

	# You fake a message from God
	option = {
		trigger = { trait_specific_ongoing_2025_d_honest_trigger = no }
		name = trait_specific_ongoing.2025.e
		
		duel = {
			skill = intrigue
			value = average_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
				}
				desc = trait_specific_ongoing.2025.d.success
				send_interface_toast = {
					title = trait_specific_ongoing.2025.d.success
					trait_specific_ongoing_2025_d_success_effect = yes
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				desc = trait_specific_ongoing.2025.e.failure
				send_interface_toast = {
					title = trait_specific_ongoing.2025.e.failure
					trait_specific_ongoing_2025_d_failure_effect = yes
				}
			}
		}

		stress_impact = {
			craven = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			honest = major_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = -2
			}
		}
	}
}


#################
#################
#	DEPRESSED	#
#################
#################


#You bond with a fellow depressed character
#by Linnéa Thimrén
scripted_trigger trait_specific_ongoing_3001_basic_check = {
	is_alive = yes
	age >= 12
	has_trait = depressed
	NOR = {
		has_relation_rival = root
		has_relation_potential_rival = root
	}
}

trait_specific_ongoing.3001 = {
	type = character_event
	title = trait_specific_ongoing.3001.t
	desc = trait_specific_ongoing.3001.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:sympathetic_character
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_3001 }
		has_trait = depressed
		OR = {
			any_vassal = {
				trait_specific_ongoing_3001_basic_check = yes
			}
			any_courtier_or_guest = {
				trait_specific_ongoing_3001_basic_check = yes
			}
		}
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_3001
			years = 10
		}
		if = {
			limit = {
				any_vassal = {
					trait_specific_ongoing_3001_basic_check = yes
				}
			}
			random_vassal = {
				limit = {
					trait_specific_ongoing_3001_basic_check = yes
					OR = {
						has_relation_potential_friend = root
						has_relation_potential_lover = root
						reverse_opinion = {
							target = root
							value >= 30
						}
					}
				}
				alternative_limit = {
					trait_specific_ongoing_3001_basic_check = yes
				}
				save_scope_as = sympathetic_character
			}
		}
		else = {
			random_courtier_or_guest = {
				limit = {
					trait_specific_ongoing_3001_basic_check = yes
					OR = {
						has_relation_potential_friend = root
						has_relation_potential_lover = root
						reverse_opinion = {
							target = root
							value >= 30
						}
					}
				}
				alternative_limit = {
					trait_specific_ongoing_3001_basic_check = yes
				}
				save_scope_as = sympathetic_character
			}
		}
	}

	option = { #Bond
		name = trait_specific_ongoing.3001.a
		progress_towards_friend_effect = {
			CHARACTER = scope:sympathetic_character
			OPINION = 20
		}
		stress_impact = {
			base = minor_stress_impact_loss
		}
	}

	option = { #Throw them under the bus
		name = trait_specific_ongoing.3001.b
		flavor = trait_specific_ongoing.3001.b.tt
		add_prestige = minor_prestige_gain
		scope:sympathetic_character = {
			add_opinion = {
				modifier = respect_opinion
				target = root
				opinion = -15
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}
}

#Your court physician tries to treat you
#by Linnéa Thimrén
trait_specific_ongoing.3002 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = trait_specific_ongoing.3002.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_3002 }
		has_trait = depressed
		any_relation = {
			type = court_physician
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_3002
			years = 10
		}
		random_relation = {
			type = court_physician
			save_scope_as = court_physician
		}
	}

	option = { #Go for treatment
		name = trait_specific_ongoing.3002.a
		trigger_event = {
			id = trait_specific_ongoing.3003
			days = { 7 14 }
		}
		stress_impact = {
			base = minor_stress_impact_loss
		}
	}

	option = { #Nah, I'll go back to bed
		name = trait_specific_ongoing.3002.b
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}


#Your court physician tries to treat you - talking
#by Linnéa Thimrén
trait_specific_ongoing.3003 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = trait_specific_ongoing.3003.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician
	
	trigger = {
		has_trait = depressed
		scope:court_physician = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = trait_specific_ongoing.3008
	}

	option = { #Go for treatment
		name = trait_specific_ongoing.3003.a
		trigger_event = {
			id = trait_specific_ongoing.3004
			days = { 7 14 }
		}
		add_character_modifier = {
			modifier = low_social_energy_modifier
			years = 5
		}
	}

	option = { #Nah, I'll go back to bed
		name = trait_specific_ongoing.3003.b
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}

#Your court physician tries to treat you - cbt
#by Linnéa Thimrén
trait_specific_ongoing.3004 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = trait_specific_ongoing.3004.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician
	
	trigger = {
		has_trait = depressed
		scope:court_physician = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = trait_specific_ongoing.3008
	}

	option = { #Go for treatment
		name = trait_specific_ongoing.3004.a
		trigger_event = {
			id = trait_specific_ongoing.3005
			days = { 7 14 }
		}
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}

	option = { #Nah, I'll go back to bed
		name = trait_specific_ongoing.3003.b
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}


#Your court physician tries to treat you - exercising
#by Linnéa Thimrén
trait_specific_ongoing.3005 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = trait_specific_ongoing.3005.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician
	
	trigger = {
		has_trait = depressed
		scope:court_physician = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = trait_specific_ongoing.3008
	}

	option = { #Go for treatment
		name = trait_specific_ongoing.3005.a
		add_character_modifier = {
			modifier = exhausted_modifier
			years = 5
		}
		if = { #In Christianity it was a widespread belief that depression was caused by evil spirits, demons, or other evils, and they therefor (among many harsher remedies) thought that prayer helped
			limit = {
				faith = { religion_tag = christianity_religion }
			}
			trigger_event = {
				id = trait_specific_ongoing.3006
				days = { 7 14 }
			}
		}
		else = {
			trigger_event = {
				id = trait_specific_ongoing.3007
				days = { 7 14 }
			}
		}
	}

	option = { #Nah, I'll go back to bed
		name = trait_specific_ongoing.3003.b
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}


#Your court physician tries to treat you - praying
#by Linnéa Thimrén
trait_specific_ongoing.3006 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = trait_specific_ongoing.3006.desc
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician
	
	trigger = {
		has_trait = depressed
		scope:court_physician = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = trait_specific_ongoing.3008
	}

	option = { #Go for treatment
		name = trait_specific_ongoing.3006.a
		trigger_event = {
			id = trait_specific_ongoing.3007
			days = { 7 14 }
		}
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}

	option = { #Nah, I'll go back to bed
		name = trait_specific_ongoing.3003.b
		add_character_modifier = {
			modifier = seduce_rested_modifier
			years = 5
		}
	}
}


#Deactivate the trait!
#by Linnéa Thimrén
scripted_effect trait_specific_ongoing_3007_lose_depressed_effect = {
	if = {
		limit = {
			has_trait = depressed_1
		}
		remove_trait = depressed_1
	}
	else = {
		make_trait_inactive = depressed_genetic
	}
	stress_impact = {
		base = medium_stress_impact_loss
	}
	if = {
		limit = {
			has_character_modifier = low_social_energy_modifier
		}
		remove_character_modifier = low_social_energy_modifier
	}
	if = {
		limit = {
			has_character_modifier = exhausted_modifier
		}
		remove_character_modifier = exhausted_modifier
	}
}

trait_specific_ongoing.3007 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = {
		desc = trait_specific_ongoing.3007.desc
		desc = trait_specific_ongoing.3007.desc_ending
	}
	theme = mental_health
	left_portrait = {
		character = root
		animation = happiness
	}
	right_portrait = scope:court_physician
	
	trigger = {
		has_trait = depressed
		scope:court_physician = { is_alive = yes }
	}

	on_trigger_fail = {
		trigger_event = trait_specific_ongoing.3007
	}

	option = { #Yey!
		name = trait_specific_ongoing.3007.a
		trait_specific_ongoing_3007_lose_depressed_effect = yes
	}
}

#Your court physician tries to treat you - event failed to trigger fallback
#by Linnéa Thimrén
trait_specific_ongoing.3008 = {
	type = character_event
	title = trait_specific_ongoing.3002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:court_physician = { is_alive = no }
				}
				desc = trait_specific_ongoing.3008.desc_physician_died
			}
			triggered_desc = {
				trigger = {
					NOT = { has_trait = depressed }
				}
				desc = trait_specific_ongoing.3008.desc_no_depression
			}
			desc = trait_specific_ongoing.3008.desc_fallback
		}
		desc = trait_specific_ongoing.3007.desc_ending
	}
	theme = mental_health
	left_portrait = root
	right_portrait = scope:court_physician

	option = { #Yey!
		name = trait_specific_ongoing.3007.a
		trait_specific_ongoing_3007_lose_depressed_effect = yes
	}
}


#You're exhausted
#by Linnéa Thimrén
trait_specific_ongoing.3009 = {
	type = character_event
	title = trait_specific_ongoing.3009.t
	desc = trait_specific_ongoing.3009.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = sadness
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_3009 }
		has_trait = depressed
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_3009
			years = 10
		}
		add_character_modifier = {
			modifier = exhausted_modifier
			years = 5
		}
	}

	option = { #So tired!
		name = trait_specific_ongoing.3009.a
	}
}


### Someone thinks you're slothful ###
scripted_trigger trait_specific_ongoing_3015_unsympathetic_trigger = {
	basic_is_available_ai = yes
	is_adult = yes
	OR = {
		ai_compassion <= low_negative_ai_value
		opinion = {
			target = root
			value < 0
		}
	}
	ai_energy >= 0
	NOT = { has_trait = depressed }
}

trait_specific_ongoing.3015 = { #by Mathilda Bjarnehed
	type = character_event
	title = trait_specific_ongoing.3015.t
	desc = {
		desc = trait_specific_ongoing.3015.start.desc
		random_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						scope:unsympathetic = { is_councillor_of = root }
						is_councillor_of = scope:unsympathetic
					}
				}
				desc = trait_specific_ongoing.3015.council.desc
			}
			desc = trait_specific_ongoing.3015.book.desc
			triggered_desc = {
				trigger = { scope:unsympathetic = { is_courtier_of = root } }
				desc = trait_specific_ongoing.3015.withdraw.desc
			}
		}
		desc = trait_specific_ongoing.3015.end.desc
	}
	theme = mental_health
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:unsympathetic
		animation = disapproval
	}
	
	trigger = {
		has_trait = depressed
		NOT = { has_character_flag = had_event_trait_specific_ongoing_3015 }
		OR = {
			any_councillor = { trait_specific_ongoing_3015_unsympathetic_trigger = yes }
			any_powerful_vassal = { trait_specific_ongoing_3015_unsympathetic_trigger = yes }
			trigger_if = {
				limit = { exists = liege }
				liege = { trait_specific_ongoing_3015_unsympathetic_trigger = yes }
			}
			any_spouse = { trait_specific_ongoing_3015_unsympathetic_trigger = yes }
			any_close_family_member = {
				trait_specific_ongoing_3015_unsympathetic_trigger = yes
				is_courtier_of = root
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_3015
			years = 10
		}

		#Build a list
		every_councillor = {
			limit = { trait_specific_ongoing_3015_unsympathetic_trigger = yes }
			add_to_list = unsympathetic_list
		}
		every_powerful_vassal = {
			limit = {
				trait_specific_ongoing_3015_unsympathetic_trigger = yes
				NOT = { is_in_list = unsympathetic_list }
			}
			add_to_list = unsympathetic_list
		}
		if = {
			limit = {
				exists = liege
				liege = {
					trait_specific_ongoing_3015_unsympathetic_trigger = yes
					NOT = { is_in_list = unsympathetic_list }
				}
			}
			liege = { add_to_list = unsympathetic_list }
		}
		every_spouse = {
			limit = {
				trait_specific_ongoing_3015_unsympathetic_trigger = yes
				NOT = { is_in_list = unsympathetic_list }
			}
			add_to_list = unsympathetic_list
		}
		every_close_family_member = {
			limit = {
				trait_specific_ongoing_3015_unsympathetic_trigger = yes
				is_courtier_of = root
				NOT = { is_in_list = unsympathetic_list }
			}
			add_to_list = unsympathetic_list
		}

		#Randomize
		random_in_list = {
			list = unsympathetic_list
			weight = {
				base = 20
				modifier = {
					add = {
						value = ai_compassion
						multiply = -1
						add = ai_energy
						min = -10
					}
				}
				modifier = {
					is_landed = yes
					add = 20
				}
				opinion_modifier = {
					opinion_target = root
					multiplier = -1
				}
			}
			save_scope_as = unsympathetic

			add_opinion = {
				modifier = weak_opinion
				opinion = -10
				target = root
			}
		}
	}

	# Prove them wrong
	option = {
		name = trait_specific_ongoing.3015.a

		stress_impact = {
			depressed_1 = medium_stress_impact_gain
			depressed_genetic = medium_stress_impact_gain
			lazy = minor_stress_impact_gain
		}
		
		random_list = {
			60 = {
				desc = trait_specific_ongoing.3015.a.success
				send_interface_toast = {
					title = trait_specific_ongoing.3015.a.success
					add_character_modifier = {
						modifier = extra_efforts_depressed_modifier
						years = 5
					}
					reverse_add_opinion = {
						target = scope:unsympathetic
						modifier = respect_opinion
						opinion = 20
					}
				}
			}
			25 = {
				desc = trait_specific_ongoing.3015.a.neutral
				send_interface_toast = {
					title = trait_specific_ongoing.3015.a.neutral
				}
			}
			15 = {
				desc = trait_specific_ongoing.3015.a.failure
				send_interface_toast = {
					title = trait_specific_ongoing.3015.a.failure
					add_character_modifier = {
						modifier = exhausted_modifier
						years = 5
					}
				}
			}
		}

		ai_chance = {
			base = 80
			ai_value_modifier = {
				ai_energy = 1
				ai_boldness = 2
			}
		}
	}

	# Insult them back
	option = {
		name = trait_specific_ongoing.3015.b
		
		reverse_add_opinion = {
			target = scope:unsympathetic
			modifier = angry_opinion
			opinion = -15
		}

		ai_chance = {
			base = 100

			ai_value_modifier = {
				ai_compassion = -2
				ai_boldness = 1
			}
		}
	}
	
	# Accept it
	option = {
		name = trait_specific_ongoing.3015.c

		add_prestige = miniscule_prestige_loss

		stress_impact = {
			arrogant = minor_stress_impact_gain
			brave = minor_stress_impact_gain
			wrathful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = -1
			}
			modifier = {
				has_trait = humble
				add = 100
			}
		}
	}
}

################
################
#	CANNIBAL	#
################
################

#Private conversation with a vassal or courtier
#by Linnéa Thimrén
trait_specific_ongoing.5001 = {
	type = character_event
	title = trait_specific_ongoing.5001.t
	desc = {
		desc = trait_specific_ongoing.5001.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:victim = {
						current_weight < underweight_threshold
					}
				}
				desc = trait_specific_ongoing.5001.desc_small
			}
			triggered_desc = {
				trigger = {
					scope:victim = {
						current_weight > overweight_threshold
					}
				}
				desc = trait_specific_ongoing.5001.desc_big
			}
			desc = trait_specific_ongoing.5001.desc
		}
	}
	theme = skull
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = scope:victim
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_5001 }
		is_cannibal_trigger = yes
		OR = {
			any_vassal = {
				is_alive = yes
				age >= 12
				is_ai = yes
			}
			any_courtier_or_guest = {
				is_alive = yes
				age >= 12
				is_ai = yes
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_5001
			years = 10
		}
		save_scope_as = murderer
		if = {
			limit = {
				any_vassal = {
					is_alive = yes
					age >= 12
					is_ai = yes
				}
			}
			random_vassal = {
				limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
					NOR = { #Would like to pick someone you don't like as much
						has_relation_friend = root
						has_relation_potential_friend = root
						has_relation_lover = root
						reverse_opinion = {
							target = root
							value >= 30
						}
					}
				}
				alternative_limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
					has_important_relationship_with_root_trigger = no
					is_close_family_or_spouse_of_root_trigger = no
					is_councillor = no
				}
				alternative_limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
				}
				save_scope_as = victim
			}
		}
		else_if = {
			limit = {
				any_courtier_or_guest = {
					is_alive = yes
					age >= 12
					is_ai = yes
				}
			}
			random_courtier_or_guest = {
				limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
					NOR = { #Would like to pick someone you don't like as much
						has_relation_friend = root
						has_relation_potential_friend = root
						has_relation_lover = root
						reverse_opinion = {
							target = root
							value >= 30
						}
					}
				}
				alternative_limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
					has_important_relationship_with_root_trigger = no
					is_close_family_or_spouse_of_root_trigger = no
					is_councillor = no
				}
				alternative_limit = {
					is_alive = yes
					age >= 12
					is_ai = yes
				}
				save_scope_as = victim
			}
		}

		if = { #To save the secret so it can be revealed in the follow-up event for the victim
			limit = {
				any_secret = {
					secret_type = secret_cannibal
					NOT = { is_known_by = scope:victim }
				}
			}
			random_secret = {
				limit = {
					secret_type = secret_cannibal
					NOT = { is_known_by = scope:victim }
				}
				save_scope_as = secret
			}
		}
	}

	option = { #I'll eat them
		name = trait_specific_ongoing.5001.a
		scope:victim = {
			trigger_event = {
				id = trait_specific_ongoing.5002
				days = 2
			}
		}
		show_as_tooltip = {
			unknown_murder_effect = {
				VICTIM = scope:victim
				MURDERER = root
				REASON = death_mysterious
			}
		}
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 5
		}
	}

	option = { #Let's just talk
		name = trait_specific_ongoing.5001.b
		scope:victim = {
			add_opinion = {
				modifier = friendliness_opinion
				target = root
				opinion = 20
			}
		}
		stress_impact = {
			base = minor_stress_impact_gain
		}
	}
}

#For the victim - you get eaten by your liege
#by Linnéa Thimrén
trait_specific_ongoing.5002 = {
	type = character_event
	title = trait_specific_ongoing.5001.t
	desc = trait_specific_ongoing.5002.desc
	theme = skull
	override_background = {
		event_background = sitting_room
	}
	right_portrait = {
		character = scope:murderer
		animation = admiration
	}

	immediate = {
		play_music_cue = "mx_cue_combat_2"
		scope:secret = { reveal_to = scope:victim }
		unknown_cannibal_murder_effect = {
			VICTIM = scope:victim
			MURDERER = scope:murderer
		}
	}

	option = { #AHHH!
		name = trait_specific_ongoing.5002.a
	}
}


#Eat someone from the staff
#by Linnéa Thimrén
trait_specific_ongoing.5003 = {
	type = character_event
	title = trait_specific_ongoing.5003.t
	desc = {
		desc = trait_specific_ongoing.5003.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:servant = {
						current_weight > overweight_threshold
					}
				}
				desc = trait_specific_ongoing.5003.desc_big
			}
			desc = trait_specific_ongoing.5003.desc
		}
	}
	theme = skull
	override_background = {
		event_background = corridor_night
	}
	right_portrait = {
		character = scope:servant
		animation = flirtation
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_5003 }
		is_cannibal_trigger = yes
		NOT = { has_trait = chaste }
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_5003
			years = 5
		}
		create_character = {
			save_scope_as = servant
			employer = root
			template = servant_character
			gender_female_chance = root_attraction_based_female_chance
		}
		scope:servant = {
			set_sexuality = bisexual
		}
	}

	option = { #I'll eat them
		name = trait_specific_ongoing.5003.a
		trait = cannibal
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 10
		}
		unknown_cannibal_murder_effect = {
			VICTIM = scope:servant
			MURDERER = root
		}
	}

	option = { #Let's have sex
		name = trait_specific_ongoing.5003.b
		trigger = { mgr_can_seduce = yes }
		had_sex_with_effect = {
			CHARACTER = scope:servant
			PREGNANCY_CHANCE = pregnancy_chance
		}
		stress_impact = {
			base = minor_stress_impact_gain
			lustful = medium_stress_impact_loss
		}
	}
}


#Eat an old lady
#by Linnéa Thimrén
trait_specific_ongoing.5004 = {
	type = character_event
	title = trait_specific_ongoing.5004.t
	desc = trait_specific_ongoing.5004.desc
	theme = skull
	override_background = {
		event_background = wilderness
	}
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_5004 }
		is_cannibal_trigger = yes
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_5004
			years = 10
		}
		capital_county = { save_scope_as = county }
	}

	option = { #Eat them
		name = trait_specific_ongoing.5004.a
		trait = cannibal
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 10
		}
	}

	option = { #So, what's up with the area?
		name = trait_specific_ongoing.5004.b
 		scope:county = {
			add_county_modifier = {
				modifier = county_listened_to_locals_modifier
				years = 10
			}
		}
	}
}


#Eat a courtier
#by Linnéa Thimrén
trait_specific_ongoing.5005 = {
	type = character_event
	title = trait_specific_ongoing.5005.t
	desc = trait_specific_ongoing.5005.desc
	theme = skull
	override_background = {
		event_background = corridor_night
	}
	right_portrait = scope:courtier
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_5005 }
		is_cannibal_trigger = yes
		any_courtier = {
			is_ai = yes
			age >= 12
			has_important_relationship_with_root_trigger = no
			is_close_family_or_spouse_of_root_trigger = no
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_5005
			years = 10
		}
		random_courtier = {
			limit = {
				is_ai = yes
				age >= 12
				has_important_relationship_with_root_trigger = no
				is_close_family_or_spouse_of_root_trigger = no
				is_councillor = no
			}
			alternative_limit = {
				is_ai = yes
				age >= 12
				has_important_relationship_with_root_trigger = no
				is_close_family_or_spouse_of_root_trigger = no
			}
			save_scope_as = courtier
		}
	}

	option = { #Eat them
		name = trait_specific_ongoing.5005.a		
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 10
		}
		unknown_cannibal_murder_effect = {
			VICTIM = scope:courtier
			MURDERER = root
		}
	}

	option = { #Wake them up
		name = trait_specific_ongoing.5005.b
		scope:courtier = {
			add_opinion = {
				modifier = kindness_opinion
				target = root
				opinion = 15
			}
		}
 		hidden_effect = {
			progress_towards_friend_effect = {
				CHARACTER = scope:courtier
				OPINION = no
			}
		}
	}
}


###############
###############
#	DEVIANT	#
###############
###############

#Convert a lover to the freaky side of things
#by Linnéa Thimrén
trait_specific_ongoing.6001 = {
	type = character_event
	title = trait_specific_ongoing.6001.t
	desc = trait_specific_ongoing.6001.desc
	theme = intrigue_temptation_focus
	right_portrait = {
		character = scope:lover
		animation = shock
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_6001 }
		is_deviant_trigger = yes
		any_relation = {
			type = lover
			is_deviant_trigger = no
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_6001
			years = 10
		}
		random_relation = {
			type = lover
			limit = {
				is_deviant_trigger = no
			}
			save_scope_as = lover
		}
	}

	option = { #...you wanna join?
		name = trait_specific_ongoing.6001.a
		random_list = {
			80 = {
				show_chance = no
				desc = trait_specific_ongoing.6001.a.success
				modifier = {
					add = 20
					scope:lover = { has_trait = lustful }
				}
				opinion_modifier = {
					who = scope:lover
					opinion_target = root
				}
				send_interface_toast = {
					title = trait_specific_ongoing.6001.a.success
					left_icon = scope:lover
					scope:lover = {
						give_deviant_secret_or_trait_effect = yes
					}
					add_character_modifier = {
						modifier = feast_blew_off_steam_modifier
						years = 5
					}
				}
			}
			40 = {
				show_chance = no
				desc = trait_specific_ongoing.6001.a.failure
				ai_value_modifier = {
					who = scope:lover
					ai_zeal = 0.75
					ai_rationality = 0.25
				}
				send_interface_toast = {
					title = trait_specific_ongoing.6001.a.failure
					left_icon = scope:lover
					scope:lover = {
						add_opinion = {
							target = root
							modifier = disgusted_opinion
							opinion = -20
						}
					}
				}
			}
		}
	}

	option = { #It's not what you think!
		name = {
			trigger = { is_female = yes }
			text = trait_specific_ongoing.6001.b_woman
		}
		name = {
			trigger = { is_female = no }
			text = trait_specific_ongoing.6001.b_man
		}
		scope:lover = {
			add_opinion = {
				target = root
				modifier = suspicion_opinion
				opinion = -5
			}
		}
		stress_impact = {
			honest = medium_stress_impact_loss
		}
	}
}


#You walk in on your deviant liege
#by Linnéa Thimrén
trait_specific_ongoing.6002 = {
	type = character_event
	title = trait_specific_ongoing.6002.t
	desc = trait_specific_ongoing.6002.desc
	theme = intrigue_temptation_focus
	right_portrait = {
		character = scope:liege
		animation = ecstasy
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_trait_specific_ongoing_6002 }
		liege = {
			any_secret = {
				secret_type = secret_deviant
				NOT = { is_known_by = root }
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_event_trait_specific_ongoing_6002
			years = 10
		}
		save_scope_as = vassal
		liege = {
			save_scope_as = liege
			random_secret = {
				limit = {
					secret_type = secret_deviant
					NOT = { is_known_by = root }
				}
				save_scope_as = secret
				show_as_tooltip = { reveal_to = root } #Actually reveal it in the liege's response event
			}
		}
	}

	option = { #Cool!
		name = trait_specific_ongoing.6002.a
		trigger = {
			is_deviant_trigger = yes
			mgr_can_seduce = yes
		}
		trait = deviant
		add_character_modifier = {
			modifier = feast_blew_off_steam_modifier
			years = 5
		}
		if = {
			limit = {
				any_secret = {
					secret_type = secret_deviant
					NOT = { is_known_by = root }
				}
			}
			random_secret = {
				limit = {
					secret_type = secret_deviant
					NOT = { is_known_by = scope:liege }
				}
				save_scope_as = vassal_secret
				show_as_tooltip = { reveal_to = scope:liege }
			}
		}
		scope:liege = {
			show_as_tooltip = { #Actually applied in the response event for the liege
				if = {
					limit = {
						matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:liege }
					}
					progress_towards_lover_effect = {
						CHARACTER = root
						OPINION = yes
					}
				}
				else = {
					progress_towards_friend_effect = {
						CHARACTER = root
						OPINION = yes
					}
				}
			}
		}
		save_scope_value_as = {
			name = deviant
			value = yes
		}
		ai_chance = {
			base = 100
		}
	}

	option = { #Let me join?
		name = trait_specific_ongoing.6002.b
		trigger = {
			matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:liege }
			is_deviant_trigger = no
			mgr_can_seduce = yes
		}
		give_deviant_secret_or_trait_effect = yes
		random_secret = {
			limit = {
				secret_type = secret_deviant
				NOT = { is_known_by = scope:liege }
			}
			save_scope_as = vassal_secret
			show_as_tooltip = { reveal_to = scope:liege }
		}
		scope:liege = {
			show_as_tooltip = { #Actually applied in the response event for the liege
				progress_towards_lover_effect = {
					CHARACTER = root
					OPINION = no
				}
			}
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 15
			}
		}
		save_scope_value_as = {
			name = joined
			value = yes
		}
		stress_impact = {
			chaste = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			modifier = {
				add = 25
				has_trait = lustful
			}
			modifier = {
				add = -50
				has_trait = chaste
			}
		}
	}

	option = { #Ew - expose
		name = trait_specific_ongoing.6002.c
		trigger = {
			exists = scope:secret
		}
		show_as_tooltip = {
			scope:secret = {
				expose_secret = root
			}
		}
		scope:liege = {
				show_as_tooltip = { #Actually applied in the response event for the liege
					progress_towards_rival_effect = {
					CHARACTER = root
					OPINION = yes
				}
				}
		}
		save_scope_value_as = {
			name = exposed
			value = yes
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_zeal = 0.75
				ai_rationality = 0.5
			}
			modifier = { #A scared vassal won't expose the secret
				add = -50
				trigger = {
					scope:liege = {
						dread_modified_ai_boldness = {
							dreaded_character = root
							value <= -75
						}
					}
				}
			}
		}
	}

	option = { #Ew, I'm leaving
		name = trait_specific_ongoing.6002.d
		scope:liege = {
			add_opinion = {
				target = root
				modifier = kindness_opinion
				opinion = 20
			}
		}
		save_scope_value_as = {
			name = ew
			value = yes
		}
		ai_chance = {
			base = 0
		}
	}

	after = {
		scope:liege = {
			trigger_event = trait_specific_ongoing.6003
		}
	}
}


#A vassal walked in on you!
#by Linnéa Thimrén
trait_specific_ongoing.6003 = {
	type = character_event
	title = trait_specific_ongoing.6003.t
	desc = {
		desc = trait_specific_ongoing.6003.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:deviant
				}
				desc = trait_specific_ongoing.6003.desc_deviant
			}
			triggered_desc = {
				trigger = {
					exists = scope:joined
				}
				desc = trait_specific_ongoing.6003.desc_joined
			}
			triggered_desc = {
				trigger = {
					exists = scope:exposed
				}
				desc = trait_specific_ongoing.6003.desc_exposed
			}
			triggered_desc = {
				trigger = {
					exists = scope:ew
				}
				desc = trait_specific_ongoing.6003.desc_ew
			}
		}
	}
	theme = intrigue_temptation_focus
	right_portrait = {
		character = scope:vassal
		animation = shock
	}

	immediate = {
		if = {
			limit = {
				exists = scope:exposed
			}
			hidden_effect = {
				scope:secret = {
					reveal_to = scope:vassal
				}
			}
			scope:secret = {
				expose_secret = scope:vassal
			}
		}
		else = {
			scope:secret = {
				reveal_to = scope:vassal
			}
		}
		if = {
			limit = {
				exists = scope:vassal_secret
			}
			scope:vassal_secret = {
				reveal_to = root
			}
		}

		#Actually apply the relationship changes advertised in the vassal's event
		if = {
			limit = {
				exists = scope:deviant
			}
			if = {
				limit = {
					matching_gender_and_sexuality_trigger = { CHARACTER_1 = root CHARACTER_2 = scope:vassal }
				}
				progress_towards_lover_effect = {
					CHARACTER = scope:vassal
					OPINION = no
				}
			}
			else = {
				progress_towards_friend_effect = {
					CHARACTER = scope:vassal
					OPINION = yes
				}
			}
		}
		else_if = {
			limit = {
				exists = scope:joined
			}
			progress_towards_lover_effect = {
				CHARACTER = scope:vassal
				OPINION = no
			}
			scope:vassal = {
				add_opinion = {
					target = root
					modifier = pleased_opinion
					opinion = 15
				}
			}
		}
		else_if = {
			limit = {
				exists = scope:exposed
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:vassal
				OPINION = yes
			}
		}
		else_if = {
			limit = {
				exists = scope:ew
			}
			scope:vassal = {
				add_opinion = {
					target = root
					modifier = kindness_opinion
					opinion = 20
				}
			}
		}
	}

	option = { #
		name = trait_specific_ongoing.6003.a
		
	}
}
