﻿namespace = trait_specific


# ai_specific events
# 0001 - 0499

# management events for inactive genetic traits
# 0500 - 0999

#LUNATIC
# 1001 - 1999

#POSSESSED
# 2001 - 2999

#DEPRESSED
# 3001 - 3999

#WITCH
# 4001 - 4999

#CANNIBAL
# 5001 - 5999

#DEVIANT
# 6001 - 6999

#DRUNKARD
# 7001 - 7999

#HERBALIST
# 8001 - 8500

#LISP
# 8501

#################
#################
#	AI EVENTS	#
#################
#################


#AI event to assign traits
trait_specific.0001 = {
	hidden = yes
	orphan = yes

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

	immediate = {
		random_list = {
			#HEALTH
			#Lunatic
			4 = {
				trigger = { NOT = { has_trait = lunatic } }
				add_trait = lunatic_1
			}
			#Possessed
			4 = {
				trigger = { NOT = { has_trait = possessed } }
				add_trait = possessed_1
			}
			#Depressed
			6 = {
				trigger = { NOT = { has_trait = depressed } }
				add_trait = depressed_1
			}
			#Drunkard
			10 = {
				trigger = { NOT = { has_trait = drunkard } }
				modifier = {
					add = 2
					has_trait = lifestyle_reveler
				}
				add_trait = drunkard
			}

			#LIFESTYLE
			#Reveler
			10 = {
				trigger = { NOT = { has_trait = lifestyle_reveler } }
				modifier = {
					add = 2
					has_trait = drunkard
				}
				add_trait = lifestyle_reveler
				add_trait_xp = { trait = lifestyle_reveler track = lifestyle_reveler value = 25 }
			}
			#Blademaster
			8 = {
				trigger = { NOT = { has_trait = lifestyle_blademaster } }
				modifier = {
					add = {
						value = root.martial
						multiply = 0.2
					}
				}
				add_trait = lifestyle_blademaster
				add_random_tiered_trait_xp_effect = {
					TRAIT = lifestyle_blademaster
					LEVEL_1 = yes
					LEVEL_3 = yes
				}
			}
			#Hunter
			10 = {
				trigger = {
					NOT = { has_trait = lifestyle_hunter }
				}
				modifier = {
					add = {
						value = root.martial
						multiply = 0.2
					}
				}
				add_trait = lifestyle_hunter
				random_list = {
					1 = {
						add_random_tiered_trait_track_xp_effect = {
							TRAIT = lifestyle_hunter
							TRACK = hunter
							LEVEL_1 = yes
							LEVEL_3 = yes
						}
					}
					1 = {
						add_random_tiered_trait_track_xp_effect = {
							TRAIT = lifestyle_hunter
							TRACK = falconer
							LEVEL_1 = yes
							LEVEL_3 = yes
						}
					}
				}
			}
			#Mystic
			8 = {
				trigger = { NOT = { has_trait = lifestyle_mystic } }
				modifier = {
					add = {
						value = root.learning
						multiply = 0.2
					}
				}
				add_random_tiered_trait_xp_effect = {
					TRAIT = lifestyle_mystic
					LEVEL_1 = yes
					LEVEL_3 = yes
				}
			}
			#Herbalist
			8 = {
				trigger = { NOT = { has_trait = lifestyle_herbalist } }
				modifier = {
					add = {
						value = root.learning
						multiply = 0.2
					}
				}
				add_trait = lifestyle_herbalist
			}
			#Poet
			4 = {
				trigger = { NOT = { has_trait = lifestyle_poet } }
				modifier = {
					add = {
						value = root.diplomacy
						multiply = 0.2
					}
				}
				add_trait = lifestyle_poet
			}
		}
	}
}


############
############
# INACTIVE #
############
############

#To handle genetic traits not expressed until later in life
#by Mathilda Bjarnehed
trait_specific.0500 = {
	hidden = yes

	trigger = {
		OR = {
			has_trait = depressed_genetic
			has_trait = lunatic_genetic
			has_trait = possessed_genetic
		}
	}

	immediate = {
		#Inactivate the trait and queue event for activating:

		#Depressed
		if = {
			limit = { has_trait = depressed_genetic }
			make_trait_inactive = depressed_genetic
			trigger_event = {
				id = trait_specific.3999
				days = { 3650 5000 }
			}
		}

		#Lunatic
		if = {
			limit = { has_trait = lunatic_genetic }
			make_trait_inactive = lunatic_genetic

			random_list = {
				1 = {
					trigger_event = {
						id = trait_specific.1001
						days = { 5840 10950 }
					}
				}
				1 = {
					trigger_event = {
						id = trait_specific.1002
						days = { 5840 10950 }
					}
				}
			}
		}

		#Possessed
		if = {
			limit = { has_trait = possessed_genetic }
			make_trait_inactive = possessed_genetic
			trigger_event = {
				id = trait_specific.2001
				days = { 3650 7300 }
			}
		}

		play_music_cue = "mx_cue_illness"
	}
}


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

#You start experiencing symptoms (hallucinations)
#by Linnéa Thimrén
trait_specific.1001 = {
	type = character_event
	title = trait_specific.1010.t
	desc = trait_specific.1001.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}
	
	trigger = {
		NOT = { has_trait = lunatic }
		NOT = { has_character_flag = had_recent_event_trait_specific_lunatic }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

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

	option = {
		name = trait_specific.1001.a
		trigger_event = {
			id = trait_specific.1010
			days = { 5 10 }
		}
	}
}

#You start experiencing symptoms (disorganized thoughts)
#by Linnéa Thimrén
trait_specific.1002 = {
	type = character_event
	title = trait_specific.1010.t
	desc = trait_specific.1002.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = boredom
	}
	
	trigger = {
		NOT = { has_trait = lunatic }
		NOT = { has_character_flag = had_recent_event_trait_specific_lunatic }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

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

	option = {
		name = trait_specific.1002.a
		trigger_event = {
			id = trait_specific.1010
			days = { 14 30 }
		}
	}
}

#Gain lunatic trait
#by Linnéa Thimrén
trait_specific.1010 = {
	type = character_event
	title = trait_specific.1010.t
	desc = trait_specific.1010.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = paranoia
	}
	
	trigger = {
		NOT = { has_trait = lunatic }
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = {
		name = trait_specific.1010.a
		#Unop Moved from immediate
		if = {
			limit = { has_inactive_trait = lunatic_genetic }
			make_trait_active = lunatic_genetic
		}
		else = {
			add_trait = lunatic_1
		}
	}
}



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

#Start experiencing symptoms (fear, visual distortions, seizure)
#by Linnéa Thimrén
trait_specific.2001 = {
	type = character_event
	title = trait_specific.2001.t
	desc = trait_specific.2001.desc
	theme = mental_health
	override_background = {
		trigger = { has_government = landless_adventurer_government }
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = fear
	}
	
	trigger = {
		NOT = { has_trait = possessed }
		NOT = { has_character_flag = had_recent_event_trait_specific_possessed }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

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

	option = {
		name = trait_specific.2001.a
		trigger_event = {
			id = trait_specific.2002
			days = { 14 30 }
		}
		debug_log = "Epilepsy gained"
	}
}

#Get the trait
#by Linnéa Thimrén
trait_specific.2002 = {
	type = character_event
	title = trait_specific.2001.t
	desc = trait_specific.2002.desc
	theme = mental_health
	left_portrait = {
		character = root
		animation = delirium
	}
	
	trigger = {
		NOT = { has_trait = possessed }
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = {
		name = trait_specific.2002.a
		#Unop Moved from immediate
		if = {
			limit = { has_inactive_trait = possessed_genetic }
			make_trait_active = possessed_genetic
		}
		else = {
			add_trait = possessed_1
		}
	}
}


##################
##################
#	DEPRESSEED	#
##################
##################

#You start to experience symptoms (tiredness, feeling "empty")
#by Linnéa Thimrén
trait_specific.3001 = {
	type = character_event
	title = trait_specific.3999.t
	desc = trait_specific.3001.desc
	theme = mental_health
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = sadness
	}
	
	trigger = {
		NOT = { has_trait = depressed }
		NOT = { has_character_flag = had_recent_event_trait_specific_depressed }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

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

	option = {
		name = trait_specific.3001.a
		trigger_event = {
			id = trait_specific.3002
			days = { 14 30 }
		}
	}
}

#You get the trait
#by Linnéa Thimrén
trait_specific.3002 = {
	type = character_event
	title = trait_specific.3999.t
	desc = {
		desc = trait_specific.3002.desc_opening
		random_valid = {
			desc = trait_specific.3999.desc_end
		}
	}
	theme = mental_health
	left_portrait = {
		character = root
		animation = sadness
		outfit_tags = { nightgown }
	}
	
	trigger = {
		NOT = { has_trait = depressed }
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = trait_specific.3999.a
		if = { #Unop Add depressed_genetic
			limit = { has_inactive_trait = depressed_genetic }
			make_trait_active = depressed_genetic
		}
		else = {
			add_trait = depressed_1
		}
	}
}



#This child inherited genetic depression (this is when it shows up)
#by Linnéa Thimrén
trait_specific.3999 = {
	type = character_event
	title = trait_specific.3999.t
	desc = {
		desc = trait_specific.3999.desc
		desc = trait_specific.3999.desc_end
	}
	theme = mental_health
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = sadness
	}
	
	trigger = {
		NOT = { has_trait = depressed }
		has_inactive_trait = depressed_genetic
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
		make_trait_active = depressed_genetic
	}

	option = {
		name = trait_specific.3999.a
	}
}


#############
#############
#	WITCH	#
#############
#############

#You find an old tome
#by Linnéa Thimrén
trait_specific.4001 = {
	type = character_event
	title = trait_specific.4001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_government = landless_adventurer_government }
				desc = trait_specific.4001.adventurer
			}
			desc = trait_specific.4001.landed
		}
		desc = trait_specific.4001.desc
	}
	theme = witchcraft
	left_portrait = {
		character = root
		animation = page_flipping
	}
	trigger = {
		is_witch_trigger = no
		trigger_if = {
			limit = {
				NOT = { government_has_flag = government_is_landless_adventurer }
			}
			is_travelling = no
		}
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an "extreme" trait
			add = -0.5
			has_special_content_trait = yes
		}
		modifier = {
			add = 0.5
			any_courtier_or_guest = { is_witch_trigger = yes }
		}
		modifier = {
			add = {
				value = root.learning
				multiply = 0.2
			}
		}
		modifier = {
			add = -0.5
			has_trait = zealous
		}
	}

	immediate = {
		hidden_effect = {
			if = { #Any witch already at court?
				limit = {
					any_courtier_or_guest = { is_witch_trigger = yes }
				}
				save_scope_value_as = {
					name = old_courtier
					value = yes
				}
				random_courtier_or_guest = {
					limit = {
						is_witch_trigger = yes
					}
					save_scope_as = witch
					if = {
						limit = {
							NOT = { is_courtier_of = root }
						}
						root = {
							add_courtier = scope:witch
						}
					}
				}
			}
			else_if = { #Any pool character around?
				limit = {
					any_pool_character = {
						province = root.capital_province
						is_witch_trigger = yes
					}
				}
				random_pool_character = {
					province = root.capital_province
					limit = { is_witch_trigger = yes }
					save_scope_as = witch
					root = {
						add_courtier = scope:witch
					}
				}
			}
			else = { #All else has failed, let's create that witch
				create_witch_effect = { WHO = root }
				scope:created_witch = { save_scope_as = witch }
				root = {
					add_courtier = scope:witch
				}
			}
		}
	}

	option = { #go for it
		name = trait_specific.4001.a
		flavor = trait_specific.4001.a_tt
		trigger = { #This should always be possible, but let's check it just to be safe
			exists = scope:witch
			scope:witch = {
				can_start_scheme = {
					type = convert_to_witchcraft
					target_character = root
				}
			}
		}

		add_character_modifier = {
			modifier = focused_reading_modifier
			years = 5
		}

		scope:witch = {
			hidden_effect = {
				start_scheme = {
					type = convert_to_witchcraft
					target_character = root
				}
			}
		}
	}

	option = { #heresy!
		name = trait_specific.4001.b
		add_piety = medium_piety_gain
	}
}


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

#You crave rare and exotic meat
#by Linnéa Thimrén
trait_specific.5001 = {
	type = character_event
	title = trait_specific.5001.t
	desc = trait_specific.5001.desc
	theme = secret
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	
	trigger = {
		is_cannibal_trigger = no
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
		modifier = {
			add = 0.2
			has_trait = gluttonous
		}
		modifier = {
			add = -0.75
			has_trait = temperate
		}
	}

	option = { #Where can this lead?
		name = trait_specific.5001.a
		flavor = trait_specific.5001.a.tt
		trigger_event = {
			id = trait_specific.5002
			days = { 7 14 }
		}
	}

	option = { #Hm, nah, I'll just go with what I have
		name = trait_specific.5001.b
		add_character_modifier = {
			modifier = feast_good_food_modifier
			years = 5
		}
		hidden_effect = {
			target_weight_modifier_effect = {
				VALUE = 2
			}
		}
	}
}

#Gain the trait/secret
#by Linnéa Thimrén
trait_specific.5002 = {
	type = character_event
	title = trait_specific.5001.t
	desc = trait_specific.5002.desc
	theme = secret
	left_portrait = {
		character = root
		animation = shame
	}
	
	trigger = {
		is_cannibal_trigger = no
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = { #Mmm, the most dangerous animal of them all...
		name = trait_specific.5002.a
		give_cannibal_secret_or_trait_effect = yes
	}

	option = { #I will resist this!
		name = trait_specific.5002.b
		add_piety = minor_piety_gain
		add_stress = medium_stress_gain
	}
}


#You are put in an extreme situation
#by Linnéa Thimrén
trait_specific.5003 = {
	orphan = yes
	type = character_event
	title = trait_specific.5003.t
	desc = trait_specific.5003.desc
	theme = secret
	left_portrait = {
		character = root
		animation = severelywounded
	}

	override_background = { reference = wilderness_mountains }
	
	trigger = {
		is_cannibal_trigger = no
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = { #I guess I'll do it
		name = trait_specific.5003.a
		give_cannibal_secret_or_trait_effect = yes
	}

	option = { #I will not!
		name = trait_specific.5003.b
		add_character_modifier = {
			modifier = stress_starvation
			days = 1825
		}
	}
}


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

#You discover some books that in turn makes you discover something about yourself
#by Linnéa Thimrén
trait_specific.6001 = {
	type = character_event
	title = trait_specific.6001.t
	desc = trait_specific.6001.desc
	theme = seduction
	left_portrait = {
		character = root
		animation = page_flipping
	}
	override_background = { reference = market }
	
	trigger = {
		is_deviant_trigger = no
		age >= 16
		NOT = { has_trait = chaste }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
		modifier = {
			add = 0.2
			has_trait = lustful
		}
	}

	option = {
		name = trait_specific.6001.a
		give_deviant_secret_or_trait_effect = yes
	}

	option = { #I will resist this!
		name = trait_specific.6001.b
		add_stress = medium_stress_gain
	}
}


#Your deviant lover introduces you to some freaky stuff
#by Linnéa Thimrén
trait_specific.6002 = {
	type = character_event
	title = trait_specific.6002.t
	desc = trait_specific.6002.desc
	theme = seduction
	left_portrait = {
		character = root
		animation = shame
	}
	right_portrait = {
		character = scope:lover
		animation = flirtation_left
	}
	
	trigger = {
		is_deviant_trigger = no
		age >= 16
		NOT = { has_trait = chaste }
		OR = {
			any_relation = {
				type = lover
				is_deviant_trigger = yes
			}
			any_spouse = {
				is_deviant_trigger = yes
				NOT = { has_relation_rival = root }
			}
		}
	}

	immediate = {
		if = {
			limit = {
				any_relation = {
					type = lover
					is_deviant_trigger = yes
				}
			}
			random_relation = {
				type = lover
				limit = {
					is_deviant_trigger = yes
				}
				save_scope_as = lover
				if = {
					limit = {
						any_secret = {
							type = secret_deviant
							is_known_by = root
						}
					}
					save_scope_value_as = { #For desc purposes
						name = secret_known
						value = yes
					}
				}
				if = { #To save the secret so it can be revealed
					limit = {
						any_secret = {
							type = secret_deviant
							NOT = { is_known_by = root }
						}
					}
					random_secret = {
						type = secret_deviant
						limit = {
							NOT = { is_known_by = root }
						}
						save_scope_as = secret
						reveal_to = root
					}
				}
			}
		}
		else = {
			random_spouse = {
				limit = {
					is_deviant_trigger = yes
					NOT = { has_relation_rival = root }
				}
				save_scope_as = lover
				if = {
					limit = {
						any_secret = {
							type = secret_deviant
							is_known_by = root
						}
					}
					save_scope_value_as = { #For desc purposes
						name = secret_known
						value = yes
					}
				}
				if = { #To save the secret so it can be revealed
					limit = {
						any_secret = {
							type = secret_deviant
							NOT = { is_known_by = root }
						}
					}
					random_secret = {
						type = secret_deviant
						limit = {
							NOT = { is_known_by = root }
						}
						save_scope_as = secret
						reveal_to = root
					}
				}
			}
		}
		add_character_flag = is_naked
	}

	option = { #I'm into it
		name = trait_specific.6002.a
		give_deviant_secret_or_trait_effect = yes
		scope:lover = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20
			}
		}
		add_character_modifier = {
			modifier = feast_blew_off_steam_modifier
			years = 5
		}
	}

	option = { #What the hell?!
		name = {
			trigger = {
				exists = scope:secret_known
			}
			text = trait_specific.6002.b_known
		}
		name = trait_specific.6002.b
		scope:lover = {
			add_opinion = {
				target = root
				modifier = refusal_opinion
				opinion = -10
			}
		}
		stress_impact = {
			base = medium_stress_impact_gain
		}
	}
	after = {
		remove_character_flag = is_naked
	}
}

################
################
#	DRUNKARD	#
################
################

#Find solace in drink
#by Linnéa Thimrén
trait_specific.7001 = {
	type = character_event
	title = trait_specific.7001.t
	desc = trait_specific.7001.desc
	theme = mental_health
	override_background = {
		reference = tavern
	}
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					location.culture ?= { has_graphical_india_culture_group_trigger = yes }
					location.culture ?= { has_graphical_mena_culture_group_trigger = yes }
					location.culture ?= { has_building_gfx = iranian_building_gfx }
					location.culture ?= { has_graphical_african_culture_group_trigger = yes }
					location.culture ?= { has_graphical_steppe_culture_group_trigger = yes }
				}
			}
			animation = drink_goblet
		}
		animation = drink
	}
	
	trigger = {
		NOT = { has_trait = drunkard }
		age >= 12
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
		modifier = {
			add = -0.2
			age <= 13
		}
		modifier = {
			add = -0.4
			age <= 15
		}
		modifier = {
			add = -0.25
			has_trait = temperate
		}
	}

	immediate = {
		play_music_cue = "mx_cue_meadandwine"
	}

	option = {
		name = trait_specific.7001.a
		add_trait = drunkard
	}

	option = { #I will resist this!
		name = trait_specific.7002.b
		add_stress = medium_stress_gain
	}
}



#################
#################
#	HERBALIST	#
#################
#################

#A merchant sends you some seeds
#by Linnéa Thimrén
trait_specific.8001 = {
	type = character_event
	title = trait_specific.8001.t
	desc = trait_specific.8001.desc
	theme = learning_medicine_focus
	override_background = { reference = garden }
	left_portrait = {
		character = root
		animation = thinking
	}
	
	trigger = {
		is_landless_adventurer = no # Adventurers have nowhere to sow
		NOT = { has_trait = lifestyle_herbalist }
	}

	weight_multiplier = {
		base = 1
		modifier = { #Less likely if you already have an extreme trait
			add = -0.75
			has_special_content_trait = yes
		}
		modifier = {
			add = {
				value = root.learning
				multiply = 0.2
			}
		}
	}

	option = {
		name = trait_specific.8001.a

		duel = {
			skill = learning
			value = average_skill_rating
			15 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				desc = trait_specific.8001.a.success
				send_interface_toast = {
					title = trait_specific.8001.a.success
					add_trait = lifestyle_herbalist
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				desc = trait_specific.8001.a.small_success
				send_interface_toast = {
					title = trait_specific.8001.a.small_success
					add_character_modifier = {
						modifier = seeker_of_knowledge
						years = 10
					}
				}
			}
			25 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				desc = trait_specific.8001.a.failure
				send_interface_toast = {
					title = trait_specific.8001.a.failure
				}
			}
		}
	}

	option = { #I am not interested
		name = trait_specific.8002.b
		add_gold = minor_gold_value
	}
}



#################
#################
#	   POET		#
#################
#################

#	You decide to commit your wit to paper.
#		by Ewan Cowhig Croft
trait_specific.9001 = {
	type = character_event
	title = trait_specific.9001.t
	desc = trait_specific.9001.desc
	theme = diplomacy
	left_portrait = {
		character = root
		animation = chancellor
	}
	override_background = { reference = study }

	trigger = {
		# Standard checks.
		is_available_at_peace_adult = yes
		NOT = { has_character_flag = had_event_trait_specific_9001 }
		# Can't already be a poet.
		NOT = { has_trait = lifestyle_poet }
	}

	weight_multiplier = {
		base = 1
		
		# Weight up for the arrogant & people with extremes of diplomacy.
		modifier = {
			add = 0.2
			has_trait = arrogant
		}
		modifier = {
			add = 0.25
			diplomacy >= very_high_skill_rating
		}
		modifier = {
			add = 0.25
			diplomacy <= low_skill_rating
		}
		# Weight up for people with either diplomatic or learning educations.
		modifier = {
			add = 0.1
			has_trait = education_diplomacy
		}
		modifier = {
			add = 0.1
			has_trait = education_learning
		}
		# Weight up for people who follow gods of poetry.
		modifier = {
			add = 1
			has_character_modifier = bhakti_germanic_generic_odin
		}
		modifier = {
			factor = 6
			domicile ?= { has_domicile_parameter = camp_more_likely_to_become_poet }
		}
	}

	immediate = {
		add_character_flag = { flag = had_event_trait_specific_9001 }
		# Roll for theme.
		select_poem_theme_random_effect = yes
		# Set up a subject gender.
		select_poem_subject_gender_effect = {
			SUBJECT = flag:no
			SUBJECT_TARGET = root
		}
	}

	# A fine verse! What shall I muse on next?
	option = {
		name = trait_specific.9001.a

		# Gain poet.
		add_trait = lifestyle_poet

		stress_impact = { arrogant = medium_stress_impact_loss }
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 0.5
				ai_compassion = 0.25
				ai_sociability = 0.25
			}
			modifier = {	# Weight up for stress.
				add = 20
				has_trait = arrogant
			}
			modifier = {
				add = 100
				culture = {
					OR = {
						has_cultural_pillar = heritage_north_germanic
						has_cultural_parameter = poet_trait_more_common
					}
				}
			}
		}
	}
	
	# Writing sounds fun, but I don't know about *rhyming*...
	option = {
		name = trait_specific.9001.b
		trigger = {
			NOT = { has_trait = journaller }
		}

		# Gain journaller.
		add_trait = journaller

		stress_impact = {
			content = minor_stress_impact_loss
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = -0.25
				ai_sociability = -0.25
			}
			modifier = {	# Weight up for stress.
				add = 10
				has_trait = content
			}
			modifier = {	# Weight down for stress.
				add = -10
				has_trait = ambitious
			}
		}
	}
	
	# Nah, I'll have a bath instead.
	option = {
		name = trait_specific.9001.c

		# Opt-out stress.
		add_stress = minor_stress_loss

		stress_impact = {
			lazy = medium_stress_impact_loss
			fickle = minor_stress_impact_loss
			diligent = minor_stress_impact_gain
		}
		ai_chance = {
			base = 25
			ai_value_modifier = {
				ai_boldness = -0.25
				ai_energy = -0.5
			}
			modifier = {	# Weight up for stress.
				add = 50
				has_trait = lazy
			}
			modifier = {	# Weight up for stress.
				add = 30
				has_trait = fickle
			}
			modifier = {	# Weight down for stress.
				add = -30
				has_trait = diligent
			}
		}
	}

	# Clean up assorted after-effects.
	after = { cleanup_poem_effect = yes }
}

#	Poet generation error suppression.
trait_specific.9002 = {
	hidden = yes
	orphan = yes

	immediate = {
		save_scope_value_as = {
			name = subject
			value = flag:woman
		}
		save_scope_value_as = {
			name = subject
			value = flag:man
		}
		if = {
			limit = { has_variable = poem_subject }
			# Then nothing.
		}
	}
}


scripted_effect lisp_mocking_reaction_effect = {
	random_list = {
		10 = {
			trigger = {
				OR = {
					has_trait = torturer
					has_trait = lifestyle_physician
				}
				scope:mean_courtier = {
					NOT = {
						has_trait_rank = {
							trait = wounded
							rank = 2
						}
					}
				}
			}
			add_character_flag = lisp_mocking_reaction_torturer
		}

		10 = {
			trigger = {
				has_trait = lustful
			}
			add_character_flag = lisp_mocking_reaction_lustful
		}

		10 = {
			trigger = {
				can_start_single_combat_trigger = yes
			}
			add_character_flag = lisp_mocking_reaction_blademaster
		}

		10 = {
			trigger = {
				has_trait = cannibal
			}
			add_character_flag = lisp_mocking_reaction_cannibal
		}

		10 = {
			trigger = {
				has_trait = theologian
				NOT = {
					faith = {
						religion_tag = islam_religion
					}
				}
			}	
			add_character_flag = lisp_mocking_reaction_theologian
		}
	}
}


#Having a Lisp

#Get made fun of for having a lisp

trait_specific.8501 = {
	type = character_event
	title = trait_specific.8501.t
	desc = trait_specific.8501.desc
	theme = lisp
	left_portrait = {
		character = root
		animation = anger
	}
	right_portrait = {
		character = scope:mean_courtier
		animation = laugh
	}

	trigger = {
		has_trait = lisping

		any_courtier_or_guest = {
			is_available_ai_adult = yes
			NOT = {
				has_trait = lisping
				has_trait = compassionate
				has_trait = shy
			}
		}
	}

	immediate = {
		#Unop: Reorder & remove the duplicate effect (reorder since the effect is using the mean_courtier scope)

		random_courtier_or_guest = {
			limit = {
				is_available_ai_adult = yes
				NOT = {
					has_trait = lisping
					has_trait = compassionate
					has_trait = shy
				}
			}
			save_scope_as = mean_courtier
		}

		lisp_mocking_reaction_effect = yes #Unop moved from above
	}



	option = {
		name = trait_specific.8501.a
		stress_impact = {
			wrathful = minor_stress_impact_gain
		}
		add_prestige = -100

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

	option = {
		name = trait_specific.8501.b

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

		stress_impact = {
			wrathful = minor_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
	}	

	option = { #Give them a lisp :)
		name = trait_specific.8501.c
		trigger = {
			has_character_flag = lisp_mocking_reaction_torturer
		}
		trait = torturer
		trait = lifestyle_physician

		stress_impact = {
			wrathful = minor_stress_impact_loss
			compassionate = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			sadistic = minor_stress_impact_loss
		}

		add_dread = medium_dread_gain

		scope:mean_courtier = {
			add_trait = lisping
			increase_wounds_effect = { REASON = fight }
			add_opinion = {
				target = root
				modifier = surgically_maimed
			}
		}
	}
	option = { #Duel Them
		name = trait_specific.8501.d
		custom_tooltip = trait_specific.8501.d.tt
		trigger = {
			has_character_flag = lisp_mocking_reaction_blademaster
		}

		configure_start_single_combat_effect = {
			SC_INITIATOR = root
			SC_ATTACKER = root
			SC_DEFENDER = scope:mean_courtier
			FATALITY = possible
			FIXED = no
			LOCALE = terrain_scope
			OUTPUT_EVENT = single_combat.1006
			INVALIDATION_EVENT = fp1_tbc.0102
		}
	}

	option = { #Eat Them
		name = trait_specific.8501.e
		trigger = {
			has_character_flag = lisp_mocking_reaction_cannibal
		}
		trait = cannibal

		stress_impact = {
			cannibal = major_stress_impact_loss
			compassionate = major_stress_impact_gain
		}

		unknown_cannibal_murder_effect = {
			VICTIM = scope:mean_courtier
			MURDERER = root
		}
	}

	option = { #Religious shame them
		name = trait_specific.8501.f
		trigger = {
			has_character_flag = lisp_mocking_reaction_theologian
		}
		trait = theologian
		add_piety = 150
	}

	option = { #Seduce them
		name = trait_specific.8501.g
		trigger = {
			has_character_flag = lisp_mocking_reaction_lustful
			any_close_or_extended_family_member = {
					this != scope:mean_courtier
				}
				can_start_scheme = {
					target_character = scope:mean_courtier
					type = seduce
				}
		}
		trait = lustful

	
		start_scheme = {
			target_character = scope:mean_courtier
			type = seduce
		}
				
	}
}

