namespace = fp3_yearly

########EVENT INDEX############
#fp3_yearly.8019 - Refuge of Light, by Ola Jentzsch 
#fp3_yearly.8020 - The Lady of the Land, by Ola Jentzsch 
#fp3_yearly.8021 - An Acidic Accident (The Road to Disfigurement series), by Ola Jentzsch and Lucas Ribiero
	#fp3_yearly.8022 - Vitriolic Visions (follow-up event)
	#fp3_yearly.8023 - Corrosive Conundrums (follow-up event)
#fp3_yearly.8024 - The Return to the Sky, by Ola Jentzsch
	#fp3_yearly.8025 - The Fourth Morning (follow-up event)
	#fp3_yearly.8026 - The Secret Dakhma (follow-up event)
#fp3_yearly.8027 - Nine Hundred Ninety Chapters of Gold 
	#fp3_yearly.8028 - The Book of Kings (follow-up event)
	#fp3_yearly.8029 - A Tale of Old Glory (follow-up event)
	#fp3_yearly.8030 - Insulting Letter (letter event, follow-up)
	#fp3_yearly.8031 - Grateful Letter (letter event, follow-up)
#fp3_yearly.8032 - The Ten Days of Death, by Ola Jentzsch
#fp3_yearly.8033 - Frozen Delights, by Ola Jentzsch
#fp3_yearly.8034 - The Hephthalite Hoard, by Ola Jentzsch 
#fp3_yearly.8035 - The Heart and the Creator, by Ola Jentzsch 
#fp3_yearly.8036 - The City of the Mouthless, by Ola Jentzsch 

###################################
# Refuge of Light 
# by Ola Jentzsch
###################################
scripted_trigger fp3_hateful_ruler_trigger = {
	is_ai = yes 
	NOR = {
		target_is_liege_or_above = root 
		faith = { has_doctrine = special_doctrine_is_gnostic_faith }
		faith = { has_doctrine = doctrine_pluralism_pluralistic }
		has_trait = compassionate
		has_trait = forgiving
	}
	OR = {
		has_trait = callous
		has_trait = wrathful
		has_trait = vengeful
		has_trait = zealous
		has_trait = sadistic
		has_trait = paranoid 
		faith = { has_doctrine = doctrine_pluralism_fundamentalist }
	}
}

fp3_yearly.8019 = {
	type = character_event  
	title = fp3_yearly.8019.t
	desc = fp3_yearly.8019.desc	
	theme = faith 

	left_portrait = {
		character = root
		animation = boredom
	}

	right_portrait = {
		character = scope:manichean_leader
		animation = beg
	}

	lower_left_portrait = {
		character = scope:hateful_ruler 
	}

	trigger = { 
		is_ai = no
		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available_healthy_adult = yes


		#checking that the premise makes sense
		root.capital_province = { 
			OR = {
				geographical_region = world_persian_empire 
				geographical_region = world_steppe
			}
		}
		NOR = { 
			has_title = title:k_mesopotamia 
			has_title = title:k_jazira 
		}

		#checking for a ruler that would persecute the Manicheans in Mesopotamia. Ideally the caliph, but any ruler would do. 
		any_independent_ruler = {
			in_diplomatic_range = root 
			any_realm_province = { 
				OR = {
					geographical_region = world_mesopotamia #this is where the Manichean communities were originally concentrated
					geographical_region = world_jazira
				}
			}
			fp3_hateful_ruler_trigger = yes	
		}

		any_held_county = { }
	}

	cooldown = { years = 100 }

	immediate = {

		random_independent_ruler = { 
			limit = {
				in_diplomatic_range = root 
				any_realm_province = {
					OR = {
						geographical_region = world_mesopotamia 
						geographical_region = world_jazira
					}
				}
				fp3_hateful_ruler_trigger = yes
			}
			weight = { #weighting for the most suitable candidate 
				modifier = {
					factor = 40
					any_held_title = { is_head_of_faith = yes }
				}
				modifier = {
					factor = 20
					has_title = title:k_mesopotamia 
				}
				modifier = {
					factor = 20
					has_title = title:c_baghdad 
				}
				modifier = {
					factor = 20
					has_trait = zealous 
				}
				modifier = {
					factor = 40
					has_relation_rival = root
				}
			}
			save_scope_as = hateful_ruler 	
		}

		random_held_county = {
			weight = {
				modifier = {
					factor = 70
					any_county_province = { 
						barony = { 
							is_holy_site_of = faith:manichean #This will typically be Samarkand 
						}
					}
				}
				modifier = {
					factor = 50
					faith = faith:manichean
				}
				modifier = {
					factor = 50
					any_county_province = { 
						geographical_region = dlc_fp3_greater_persian_frontier_regions
					}
				}
				modifier = {
					factor = -40
					any_county_province = {
						this = root.capital_province 
					}
				}
			}
			save_scope_as = refuge_of_light 
		}

		create_character = { #this is the Manichean leader
			template = fp3_gnostic_paragon
			location = root.capital_province
			culture = scope:hateful_ruler.culture
			gender_female_chance = {
				if = {
					limit = { 
						faith:manichean = { has_doctrine = doctrine_gender_male_dominated }
					}
					add = 0	
				}
				else_if = {
					limit = { 
						faith:manichean = { has_doctrine = doctrine_gender_female_dominated } 
					}
					add = 100
				}
				else = {
					add = 50
				}
			}
			save_scope_as = manichean_leader	
		}	
	}	
		

	option = { #By all means, stay 
		name = fp3_yearly.8019.a

   		scope:manichean_leader = {
			add_opinion = {
				target = root
				opinion = 20
				modifier = grateful_opinion
			}
		}

		scope:hateful_ruler = {
   			add_opinion = {
   				target = root
   				opinion = -30
   				modifier = harbored_a_fugitive_opinion
   			}
   		}

   		add_courtier = scope:manichean_leader 

		scope:refuge_of_light = {
			add_county_modifier = {
				modifier = fp3_gnostic_fervor_county_modifier
				years = 50 
			}
		}

		add_character_modifier = {
			modifier = fp3_rare_books_modifier
			years = 25
		}

		ai_chance = { #ambitious and sociable AI goes for this option
        	base = 10
        	ai_value_modifier = {
            	ai_boldness = 0.8
            	ai_greed = 0.5
            	ai_honor = 0.6
            	ai_sociability = 0.6
        	}
   		}

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

	option = { #stay and pay tax
		name = fp3_yearly.8019.b

		trigger = {
			faith = { 
				AND = {
					OR = {
						has_doctrine = tenet_tax_nonbelievers
						has_doctrine = special_doctrine_jizya
					}
					NOT = { has_doctrine = special_doctrine_is_gnostic_faith }
				}
			}
		}

		scope:hateful_ruler = {
   			add_opinion = {
   				target = root
   				opinion = -20
   				modifier = fp3_harbors_heretics_opinion
   			}
   		}

		scope:refuge_of_light = {
			add_county_modifier = {
				modifier = fp3_gnostic_fervor_county_modifier
				years = 50 
			}
			add_county_modifier = {
				modifier = hold_court_8120_tax_modifier
				years = 50
			}
		}

   		#Flag that scope:manichean_leader should leave. 
		save_scope_as = disappear_manichean	

   		ai_chance = { #compassionate-greedy AI goes for this option
         base = 10
        	ai_value_modifier = {
            	ai_rationality = 0.5 
            	ai_compassion = 0.8
            	ai_greed = 0.5
        	}
   		}

   		stress_impact = { 
   			generous = medium_stress_impact_gain
   			callous = medium_stress_impact_gain
   			sadistic = medium_stress_impact_gain
   		}
   	}

   	option = { #Go where you may
		name = fp3_yearly.8019.c
		custom_tooltip = manicheans_sent_away.tt

		add_piety = minor_piety_gain

		scope:hateful_ruler = {
   			add_opinion = {
   				target = root
   				opinion = 20
   				modifier = pleased_opinion
   			}
   		}

   		ai_chance = { #zealous-cruel AI goes for this option
			base = 10
        	ai_value_modifier = {
            	ai_zeal = 0.8 
            	ai_vengefulness = 0.8
        	}
   		}

   		stress_impact = { 
   			ambitious = minor_stress_impact_gain
   			compassionate = minor_stress_impact_gain 
   			generous = major_stress_impact_gain 
   		}
   	}

   	after = {
   		if = {
   			limit = { exists = scope:disappear_manichean }
   			scope:manichean_leader = { silent_disappearance_effect = yes }
   		}	
 	} 			
}


###################################
# The Lady of the Land
# by Ola Jentzsch
###################################

scripted_trigger fp3_zealous_caliph_trigger = {
	is_ai = yes 
	NOR = {
		is_vassal_of = root 
		faith = { has_doctrine = doctrine_pluralism_pluralistic }
		has_trait = compassionate
		has_trait = forgiving
	}
	OR = {
		has_trait = callous
		has_trait = wrathful
		has_trait = vengeful
		has_trait = impatient 
		has_trait = zealous
		has_trait = sadistic
		has_trait = paranoid 
		faith = { has_doctrine = doctrine_pluralism_fundamentalist }
	}
}

scripted_trigger fp3_bibi_shahrbanu_devotee_trigger = {
	is_female = yes
	top_liege != this
	is_available_ai_adult = yes
	has_religion = ROOT.religion
	NOT = {
		has_trait = cynical
	}
}

scripted_trigger fp3_assertive_female_believer_trigger = {
	OR = {
		has_trait = zealous
		has_trait = wrathful
		has_trait = vengeful
		has_trait = stubborn
		has_trait = brave
		has_trait = ambitious 
	}
}

scripted_trigger fp3_zoroastrian_holy_sites_province_trigger = {
	OR = {
		is_holy_site_of = faith:mazdayasna
		is_holy_site_of = faith:zurvanism 
		is_holy_site_of = faith:gayomarthianism 
		is_holy_site_of = faith:khurmazta 
		is_holy_site_of = faith:khurramism
		is_holy_site_of = faith:mazdakism
		is_holy_site_of = faith:urartuism
	}
}

fp3_yearly.8020 = {
	type = character_event  
	title = fp3_yearly.8020.t
	desc = fp3_yearly.8020.desc	
	theme = faith 

	left_portrait = {
		character = root
		animation = personality_rational
	}

	right_portrait = {
		character = scope:pious_woman
		animation = paranoia
	}

	lower_left_portrait = {
		character = scope:righteous_caliph
	}



	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available_healthy_adult = yes

		#premise checks - we need ROOT's faith to not have been reformed into a matriarchal faith for this historical context 
		OR = {
			has_religion = religion:islam_religion
			OR = { has_religion = religion:eastern_orthodox_religion has_religion = religion:catholic_religion has_religion = religion:protestant_religion }
		}

		has_game_rule = default_gender_equality #this triggers an error. Suspected code issue.

		NOT = {
			faith = { has_doctrine = doctrine_gender_female_dominated } 
		}

		#checking for approppriate county 
		any_held_county = {
			OR = {
				this = title:c_rayy
				any_county_province = { 
					barony = { fp3_zoroastrian_holy_sites_province_trigger = yes }	
				}
			}
		}

		#checking that we have a HoF with the appropriate interests 
		faith.religious_head != root

		exists = root.faith.religious_head

		root.faith.religious_head = { 
			fp3_zealous_caliph_trigger = yes
			#checking that his Islam hasn't been reformed into something that'd make the event's premise weird
			faith = { 
				NOT = {
					has_doctrine = doctrine_gender_female_dominated 
				}	
			}	
		}	

		#checking that we have a spouse or daughter that would fit the scope
		OR = { 
			any_spouse = { 
				fp3_bibi_shahrbanu_devotee_trigger = yes
			}
			any_concubine = { 
				fp3_bibi_shahrbanu_devotee_trigger = yes
			}
			any_child = {
				fp3_bibi_shahrbanu_devotee_trigger = yes
			}
			any_courtier_or_guest = {
				fp3_bibi_shahrbanu_devotee_trigger = yes
				has_relation_friend = root
			}
		}	
	}

	immediate = {

		
		#Saving relevant historical characters and faiths as scopes
		character:180638 = { save_scope_as = bibi_shahrbanu }

		character:33912 = { save_scope_as = imam_husayn }

		religion:zoroastrianism_religion = { save_scope_as = anahita_faith }

		#saving the caliph as a scope
		root.faith.religious_head = { 
			if = {
				limit = {
					fp3_zealous_caliph_trigger = yes
					faith = { 
						NOT = {
							has_doctrine = doctrine_gender_female_dominated 
						}
					}	
				}	
			}
			save_scope_as = righteous_caliph
		}

		random_held_county = {
			limit = { this = title:c_rayy }
			save_scope_as = temple_county
		}

		if = { 
			limit = {
				NOT = {	exists = scope:temple_county }
			}
			random_held_county = {
				limit = { 
					any_county_province = {
						barony = { fp3_zoroastrian_holy_sites_province_trigger = yes }
					}
				}
				save_scope_as = temple_county
			}
		}

		#getting the best pious woman for our purposes
		if = {
			limit = { 
				any_spouse = { fp3_bibi_shahrbanu_devotee_trigger = yes	}
			}
			random_spouse = {
				limit = { 
					fp3_bibi_shahrbanu_devotee_trigger = yes
				}
				save_scope_as = pious_woman	
			}
		}
		else_if = {
			limit = { 
				any_concubine = { fp3_bibi_shahrbanu_devotee_trigger = yes	}
			}
			random_concubine = {
				limit = { 
					any_concubine = { fp3_bibi_shahrbanu_devotee_trigger = yes	}
				}
				save_scope_as = pious_woman	
			}
		}
		else_if = {
			limit = { 
				any_child = { fp3_bibi_shahrbanu_devotee_trigger = yes	}
			}
			random_child = {
				limit = { 
					any_child = { fp3_bibi_shahrbanu_devotee_trigger = yes	}
				}
				save_scope_as = pious_woman	
			}
		}
		else_if = {
			limit = { 
				any_courtier_or_guest = { 
					fp3_bibi_shahrbanu_devotee_trigger = yes
					has_relation_friend = root	
				}
			}
			random_courtier_or_guest = {
				limit = { 
					any_courtier_or_guest = { 
						fp3_bibi_shahrbanu_devotee_trigger = yes
						has_relation_friend = root	
					}
				}
				save_scope_as = pious_woman	
			}
		}
	}

	cooldown = { years = 100 }

	option = {
		name = fp3_yearly.8020.a #triggered option if you like them very very much

		trigger = {
			
			reverse_opinion = {
				target = scope:pious_woman
				value >= 30
			}
		}

		remove_short_term_gold = minor_gold_value

		scope:pious_woman = { 
			if = {
				limit = { 
					OR = { 
						has_relation_lover = root
						has_relation_soulmate = root 
					}
				}
				add_opinion = {
					target = root
					modifier = happy_opinion
					opinion = 20 
				}
			}	
			else = {
				root = {
					progress_towards_lover_effect = {
						CHARACTER = scope:pious_woman
						REASON = lover_sided_with_me_against_hof
						OPINION = 20 
					}
				}
			}	
		}

		scope:righteous_caliph = {
			add_opinion = { 
				target = root
				opinion = -30
				modifier = angry_opinion
			}
		}

		stress_impact = {
   			callous = major_stress_impact_gain
   			shy = medium_stress_impact_gain
   			zealous = major_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_sociability = 0.5
            	ai_boldness = 1
            	ai_rationality = 1
            	ai_compassion = 1
        	}
   		}
	}

	option = {
		name = fp3_yearly.8020.b
		flavor = supporting_womens_faith_flavor

		remove_short_term_gold = medium_gold_value

		scope:temple_county = { 
			add_county_modifier = {
				modifier = fp3_persian_resurgence_county_modifier 
				years = 50
			}
		}

		scope:righteous_caliph = {
			add_opinion = { 
				target = root
				opinion = -30
				modifier = angry_opinion
			}
		}

		scope:pious_woman = {
			add_opinion = { 
				target = root
				opinion = 20
				modifier = happy_opinion
			}
		}

		stress_impact = {
   			compassionate = minor_stress_impact_loss
   			cynical = medium_stress_impact_gain 
   			zealous = major_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_energy = 0.5
            	ai_boldness = 1
            	ai_vengefulness = 0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8020.c

		add_piety = major_piety_gain

		scope:righteous_caliph = {
			add_opinion = { 
				target = root
				opinion = 20
				modifier = pleased_opinion
			}
		}

		scope:pious_woman = {
			if = {
				limit = { #if she has a forceful personality, she'll be galvanized in her faith by this
					fp3_assertive_female_believer_trigger = yes
				}
				add_character_modifier = {
					modifier = fp3_womens_faith_galvanized_modifier
					years = 25
				}
			}
			else = { #otherwise, she'll just be sad or angry 
				add_opinion = { 
					target = root
					opinion = -20
					modifier = fp3_persecuted_my_faith_opinion
				}
			}
		}

		hidden_effect = {
			custom_tooltip = fp3_sharhabanu_devotees_angry.tt
			random_courtier = { #female courtiers might get galvanized too, depending on their personality 
				if = { 
					limit = {
						fp3_bibi_shahrbanu_devotee_trigger = yes
						fp3_assertive_female_believer_trigger = yes  
						this != scope:pious_woman
					}
					add_character_modifier = {
						modifier = fp3_womens_faith_galvanized_modifier
						years = 25
					}
				}
			}
		}

		stress_impact = {
   			zealous = minor_stress_impact_loss
   			compassionate = medium_stress_impact_gain 
   			content = medium_stress_impact_gain
   			lazy = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_energy = 0.5
            	ai_boldness = 1
            	ai_vengefulness = 0.5
        	}
   		}
	}
}

###################################
# An Acidic Accident (The Path to Disfigurement, part 1)
# by Ola Jentzsch
###################################
scripted_trigger fp3_not_super_relevant_yet_suitable_person_trigger = {
	is_ai = yes
	is_adult = yes 
	OR = {
		has_lifestyle = learning_lifestyle 
		learning > 4
	}
	NOT = {
		is_spouse_of = root
		has_relation_friend = root
		has_relation_lover = root
		is_close_or_extended_family_of = root
		has_trait = disfigured
	}
	NAND = {
		is_female = yes
		root.faith = { #this is basically checking for Islam, but in a more emergent way. In medieval Islam, it wouldn't generally make sense for a noble woman to work together with a man in the way this event presupposes. 
			AND = {
				has_doctrine = doctrine_gender_male_dominated 
				has_doctrine = doctrine_polygamy
			}
		} 					 
	}
}


fp3_yearly.8021 = {
	type = character_event  
	title = fp3_yearly.8021.t
	desc = fp3_yearly.8021.desc	
	theme = learning_medicine_focus 

	left_portrait = {
		character = scope:upset_vassal
		animation = war_attacker 
	}

	right_portrait = {
		character = scope:enthusiastic_alchemist
		animation = beg
	}

	lower_left_portrait = {
		character = scope:alchemy_enthusiast
	}


	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available_healthy_adult = yes
		root.capital_province = { geographical_region = world_persian_empire }

		#checking for a vassal with an appropriate relation 
		any_powerful_vassal = {
			is_ai = yes
			NOT = { has_trait = forgiving }
			any_close_family_member = {
				fp3_not_super_relevant_yet_suitable_person_trigger = yes 	
			}
		}

		is_ai = no #in order to not spam disfigured characters and upset vassals, we reserve this event for players only.
 	}

 	cooldown = { years = 100 }

 	weight_multiplier = {
		base = 0.4
	 	modifier = {
		 	OR = {
			 	AND = { #for Rhazes
					current_year >= 895
				 	current_year < 935
			 	}
			 	AND = { #for Avicenna 
				 	current_year >= 1000
				 	current_year < 1040
			 	}
		 	}
		 	add = 1.6
	 	}
 	}

 	immediate = {

 		random_powerful_vassal = {
 			limit = {
 				is_ai = yes
 				NOT = { has_trait = forgiving }
 				any_close_family_member = {
					fp3_not_super_relevant_yet_suitable_person_trigger = yes 
				}	
			}
			random_close_family_member  = {
				limit = {
					fp3_not_super_relevant_yet_suitable_person_trigger = yes 	
				}
				save_scope_as = alchemy_enthusiast
			}
			save_scope_as = upset_vassal
 		}

 		if = { #This looks to see if one of two historical alchemists will be used in the event 
		 	limit = { #their rough period of activity
			 	AND = {
				 	current_year >= 895
				 	current_year < 935
			 	}
			 	NOT = { exists = global_var:rhazes_created } #makes sure that he wasn't already spawned by any event elsewhere
		 	}
		 	create_character = { 
				location = root.capital_province
				template = fp3_rhazes_template
				save_scope_as = enthusiastic_alchemist 	#this saves him as a scope so we can get nice effects to bounce off him! 
				after_creation = { add_character_flag = fp3_historical_person_flag }
			}
			set_global_variable = rhazes_created 
		}
		else_if = {
		 	limit = { #their rough period of activity
			 	AND = {
				 	current_year >= 1000
				 	current_year < 1040
			 	}
			 	NOT = { exists = global_var:avicenna_created } #makes sure that he wasn't already spawned by any event elsewhere
		 	}
		 	create_character = { 
				location = root.capital_province
				template = fp3_avicenna_template
				save_scope_as = enthusiastic_alchemist 	#this saves him as a scope so we can get nice effects to bounce off him! 
				after_creation = { add_character_flag = fp3_historical_person_flag }
			}
			set_global_variable = avicenna_created 
		}
		else = {
			create_character = {
				age = { 32 50 }
			 	location = root.capital_province
			 	template = scholar_character
			 	trait = education_learning_3
			 	trait = lifestyle_herbalist 
			 	trait = lifestyle_physician
			 	random_traits_list = {
				 	count = 3
				 	ambitious = {}
				 	impatient = {}
				 	cynical = {}
				 	humble = {}
			 	}
			 	random_traits_list = { #for flavor
				 	count = 1
				 	lunatic_1 = {}
				 	deviant = {}
				 	lifestyle_mystic = {}
				 	hashishiyah = {}
				 	witch = {}
			 	}
			 	culture = scope:alchemy_enthusiast.culture 
			 	faith = root.faith
			 	save_scope_as = enthusiastic_alchemist
				
				after_creation = {
					add_random_tiered_trait_xp_effect = {
						TRAIT = lifestyle_physician
						LEVEL_1 = yes
						LEVEL_3 = no
					}
					add_random_tiered_trait_xp_effect = {
						TRAIT = lifestyle_mystic
						LEVEL_1 = yes
						LEVEL_3 = no
					}
				}
			}
		}

		scope:alchemy_enthusiast = {
 			add_trait = disfigured 
 			add_learning_lifestyle_xp = major_lifestyle_experience
 			
 			hidden_effect = {
 				set_relation_rival = {
					target = scope:enthusiastic_alchemist
					reason = rival_disfigured_me_in_lab
				}
			}
 		}
 	}

 	option = { #Please stay and tell me more about this substance
		name = fp3_yearly.8021.a
		custom_tooltip = fp3_acid_delving_deeper_tooltip 

		trigger = {
			OR = {
				has_lifestyle = learning_lifestyle
				has_trait = lifestyle_herbalist
				has_trait = lifestyle_gardener
				has_trait = lifestyle_physician
				has_character_modifier = inspired_medicine_modifier 
				has_character_modifier = medical_insights_modifier  
				has_character_modifier = inspiration_alchemy_condoned_by_church_modifier
			}
		}

		add_courtier = scope:enthusiastic_alchemist

		scope:upset_vassal = {
			if = {
				limit = { 
					NOT = { has_relation_rival = root }
				}
				root = {
					progress_towards_rival_effect = {
	 					CHARACTER = scope:upset_vassal
						REASON = rival_disfigured_relative
	 					OPINION = -25
	 				}
				}
			}
			else = { 
				add_opinion = { 
					target = root
					opinion = -40
					modifier = hate_opinion
				}
			}
		}

		trigger_event = fp3_yearly.8022

		stress_impact = { 
   			fickle = minor_stress_impact_loss
   			vengeful = medium_stress_impact_gain
   			paranoid = medium_stress_impact_gain		
   		}
	}

	option = { #the alchemist is executed 
		name = fp3_yearly.8021.b

		trigger = {
			OR = {
				tyranny >= medium_tyranny
 				dread >= high_dread
   				has_trait = sadistic
   			}
		}

		add_dread = major_dread_gain

		add_tyranny = minor_tyranny_value
		
		scope:enthusiastic_alchemist = {
			death = {
				death_reason = death_execution
				killer = root
			}
		}

		scope:upset_vassal = {
			if = {
				limit = {
					OR = {
						has_trait = vengeful
						has_trait = callous
						has_trait = sadistic
					}
				}
				add_opinion = { 
					target = root
					opinion = 30 
					modifier = fp3_admires_resolve_opinion
				}
			}
			else_if = {
				limit = {
					OR = {
						has_trait = compassionate
						has_trait = just
					}
				}
				add_opinion = { 
					target = root
					modifier = fp3_went_too_far_opinion
				}
			}	
			else = {
				add_opinion = { 
					target = root
					opinion = 20
					modifier = avenged_relative_opinion
				}
			}
		}

		scope:alchemy_enthusiast = {
			add_opinion = { 
				target = root
				opinion = 20
				modifier = pleased_opinion
			}
		}

		stress_impact = { 
   			vengeful = medium_stress_impact_loss
   			sadistic = medium_stress_impact_loss 
   			just = major_stress_impact_gain 
   			forgiving = major_stress_impact_gain
   			compassionate = major_stress_impact_gain 				
   		}
	}

	option = { #the alchemist is merely imprisoned 
		name = fp3_yearly.8021.c

		trigger = {
			NOR = {
				tyranny >= medium_tyranny
 				dread >= high_dread
   				has_trait = sadistic
			}
		}

		add_dread = minor_dread_gain

		scope:enthusiastic_alchemist = { #the alchemist gets to languish in a dungeon
			hard_imprison_character_effect = {
				TARGET = this
				IMPRISONER = root
			}
		}

		scope:upset_vassal = {
			add_opinion = { 
				target = root
				opinion = 20
				modifier = avenged_relative_opinion
			}
		}

		scope:alchemy_enthusiast = {
			add_opinion = { 
				target = root
				opinion = 20
				modifier = pleased_opinion
			}
		}

		stress_impact = { 
   			vengeful = medium_stress_impact_loss
   			compassionate = medium_stress_impact_gain 
   			just = medium_stress_impact_gain 
   			forgiving = medium_stress_impact_gain				
   		}
	}

	option = {
		name = fp3_yearly.8021.d

		#Flag that scope:enthusiastic_alchemist should leave. 
		save_scope_as = disappear_alchemist

		add_prestige = minor_prestige_value 

		scope:upset_vassal = {
			if = {
				limit = { 
					NOT = { has_relation_rival = root }
				}
				root = {
					progress_towards_rival_effect = {
	 					CHARACTER = scope:upset_vassal
						REASON = rival_disfigured_relative
	 					OPINION = -25
	 				}
				}
			}
			else = { #otherwise, she'll just be sad or angry 
				add_opinion = { 
					target = root
					opinion = -30
					modifier = vengeful_opinion
				}
			}
		}

		stress_impact = { 
   			vengeful = medium_stress_impact_gain
   			craven = minor_stress_impact_gain 
   			forgiving = medium_stress_impact_loss
   			just = medium_stress_impact_loss 				
   		}		
	}

	after = { 
		if = {
			limit = {
				OR = {
					AND = {
						exists = scope:disappear_alchemist
						exists = global_var:avicenna_created
						scope:enthusiastic_alchemist = { has_character_flag = fp3_historical_person_flag }
					}
					AND = {
						exists = scope:disappear_alchemist
						exists = global_var:rhazes_created
						scope:enthusiastic_alchemist = { has_character_flag = fp3_historical_person_flag }
					}
				}
			}
			scope:enthusiastic_alchemist = { #Let's keep the historical characters around, if they were created
				move_to_pool = yes 
			}
		}
		else_if = {
			limit = { exists = scope:disappear_alchemist	}
			scope:enthusiastic_alchemist = { #otherwise, let's just have him disappear 
				move_to_pool = yes
				silent_disappearance_effect = yes
			}
		}
	}
}

###################################
# Vitriolic Visions (The Path to Disfigurement, part 2)
# by Ola Jentzsch
###################################

fp3_yearly.8022 = {
	type = character_event  
	title = fp3_yearly.8022.t
	desc = fp3_yearly.8022.desc	
	theme = learning_medicine_focus

	left_portrait = {
		character = root
		animation = chancellor 
	}

	right_portrait = {
		character = scope:enthusiastic_alchemist
		animation = personality_cynical
	}

	trigger = { exists = scope:enthusiastic_alchemist } #safety check

	immediate = {}

	option = { #fascinating, let's delve deeper
		name = fp3_yearly.8022.a
		custom_tooltip = fp3_studying_acid_ominously_tooltip

		trigger_event = fp3_yearly.8023

	}

	option = { #might it have military uses?
		name = fp3_yearly.8022.b
		flavor = fp3_yearly.8022.b.flavor

		remove_treasury_or_gold = major_treasury_or_gold_value 

		if = {
			limit = {
				faith = {
					OR = {
						has_doctrine = tenet_dharmic_pacifism
						has_doctrine = tenet_pacifism
					}
				}
			}
			add_piety = minor_piety_loss 
		}

		add_character_modifier = {
			modifier = fp3_oil_of_vitriol_modifier
			years = 25
		}

		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
	}

	option = { #leave now
		name = fp3_yearly.8022.c
		flavor = fp3_yearly.8022.c.flavor


		if = {
			limit = {
				AND = {
					OR = {
						exists = global_var:avicenna_created
						exists = global_var:rhazes_created
					}
					scope:enthusiastic_alchemist = { has_character_flag = fp3_historical_person_flag }
				}
			}
			scope:enthusiastic_alchemist = { #Let's keep the historical characters around, if they were created
				move_to_pool = yes 
			}
		}
		else = {
			scope:enthusiastic_alchemist = { #otherwise, let's just have him disappear 
				move_to_pool = yes
				silent_disappearance_effect = yes
			}
		}

		stress_impact = {
   			base = minor_stress_impact_loss
   			ambitious = medium_stress_impact_gain					
		}
	}
}

###################################
# Corrosive Conundrums (The Path to Disfigurement, part 3)
# by Ola Jentzsch
###################################

fp3_yearly.8023 = {
	type = character_event  
	title = fp3_yearly.8023.t
	desc = fp3_yearly.8023.desc	
	theme = learning_medicine_focus

	left_portrait = {
		character = root
		animation = personality_greedy
	}

	right_portrait = {
		character = scope:enthusiastic_alchemist
		animation = worry
	}

	trigger = { exists = scope:enthusiastic_alchemist } #safety check

	immediate = {}

	option = { #I have come this far
		name = fp3_yearly.8023.a

		
		flavor = fp3_horrible_accident.flavor
		if = {
			limit = { 
				NOT = { has_trait = disfigured }
			}
			random = {
				chance = 10
				add_trait = disfigured	
			}
		}

		duel = {
			skill = learning
			value = high_skill_rating

			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				root = {
					send_interface_toast = {
						title = experimenting_with_acid_toast.success
						left_icon = root
				
						add_character_modifier = {
							modifier = fp3_alchemical_insights_modifier
						}
					}
				}	
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				root = {
					send_interface_toast = {
						title = experimenting_with_acid_toast.failure
						left_icon = root
						add_character_modifier = {
							modifier = fp3_dabbling_in_alchemy_modifier
							years = 25
						}
					}
				}
			}
		}
	}

	option = { #At least I learned something
		name = fp3_yearly.8023.b

		add_learning_lifestyle_xp = major_lifestyle_experience

		add_character_modifier = {
			modifier = fp3_dabbling_in_alchemy_modifier
			years = 25
		}

		stress_impact = {
   			#no stress for this event
		}
	}

	option = { #Go, and take your acid with you
		name = fp3_yearly.8023.c

		add_learning_lifestyle_xp = major_lifestyle_experience

		if = {
			limit = {
				AND = {
					OR = {
						exists = global_var:avicenna_created
						exists = global_var:rhazes_created
					}
					scope:enthusiastic_alchemist = { has_character_flag = fp3_historical_person_flag }
				}
			}
			scope:enthusiastic_alchemist = { #Let's keep the historical characters around, if they were created
				move_to_pool = yes 
			}
		}
		else = {
			scope:enthusiastic_alchemist = { #otherwise, let's just have him disappear 
				move_to_pool = yes
				silent_disappearance_effect = yes
			}
		}
			
		stress_impact = {
   			#no stress for this event
		}
	}
}

###################################
# The Return to the Sky 
# by Ola Jentzsch
###################################

scripted_trigger non_zoroastrian_faith_trigger = {
	NOT = {
		faith = { has_doctrine_parameter = sky_burials_active }
	}
}

scripted_trigger dakhma_nostalgic_trigger = {
	culture = { has_cultural_pillar = heritage_iranian }
	OR = {
		faith = { has_doctrine_parameter = sky_burials_active }
		has_trait = stubborn
		learning > 14
		has_character_modifier = hallucinogenic_visions_uplifting_modifier
		has_character_modifier = hallucinogenic_visions_terrifying_modifier
	}
	NAND = {
		non_zoroastrian_faith_trigger = yes 
		has_trait = zealous 	
	}		
}

scripted_trigger loyal_discreet_courtier_trigger = {
	OR = {
		faith = { has_doctrine_parameter = sky_burials_active }
		has_trait = trusting
		has_trait = compassionate 
		reverse_opinion = {
			target = root
			value >= 50
		}
	}
	NOR = {
		has_trait = paranoid
		has_trait = arrogant
		has_trait = callous 
		has_trait = craven
	}	
}

fp3_yearly.8024 = {
	type = character_event  
	title = fp3_yearly.8024.t
	desc = fp3_yearly.8024.desc	
	theme = death

	left_portrait = {
		character = scope:dying_consort
		animation = worry
	}	

	right_portrait = {
		character = root
		animation = sadness
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = callous
					reverse_opinion = {
						target = scope:dying_consort
						value < 0
					}
				}
			}
			animation = schadenfreude 
		}
	}

	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available_adult = yes
		root.capital_province = { geographical_region = world_persian_empire }

		NOT = {
			faith = { has_doctrine_parameter = sky_burials_active }
		}

		any_consort = { #we need a dying consort
			is_ai = yes
			dakhma_nostalgic_trigger = yes
			OR = {
				health <= death_chance_dying_health
				has_trait = infirm
			}
		}
	}

	cooldown = { years = 100 }

	immediate = {
		
		random_consort = { #we need a dying consort
			limit = {
				is_ai = yes
				dakhma_nostalgic_trigger = yes
				OR = {
					health <= death_chance_dying_health
					has_trait = infirm
				}
			}
			save_scope_as = dying_consort
		}

		if = {
			limit = {
				any_courtier = {
					is_ai = yes
					NOR = { 
						is_close_or_extended_family_of = root 
						is_consort_of = root
					}
					loyal_discreet_courtier_trigger = yes
				}
			}
			random_courtier = {
				limit = {
					is_ai = yes
					NOR = { 
						is_close_or_extended_family_of = root 
						is_consort_of = root
					}
					loyal_discreet_courtier_trigger = yes
				}
				save_scope_as = helpful_courtier
			}
		}

		hidden_effect = {
			if = {
				limit = {
					opinion = {
						target = scope:dying_consort
						value >= 50
					}
				}
				add_character_flag = fp3_love_for_consort_flag 
			}
		}
	}

	option = {
		name = fp3_yearly.8024.a

		scope:dying_consort = {
			death = natural
		}

		add_piety = medium_piety_loss 

		trigger_event = {
			id = fp3_yearly.8025 
			days = 3
		}

		custom_tooltip = fp3_relations_care_about_sky_burial.tt
		hidden_effect = {
			every_vassal_or_below = { 
				if = {
					limit = { is_ai = yes }
					opinion_based_on_sky_burial_viewpoint_scripted_effect = yes 
				}
			}
			every_courtier = { opinion_based_on_sky_burial_viewpoint_scripted_effect = yes 	}
			every_close_family_member = { 
				if = {
					limit = { is_ai = yes }
					opinion_based_on_sky_burial_viewpoint_for_relatives_scripted_effect = yes 
				}
			}
		}

		stress_impact = {
   			base = minor_stress_impact_loss 
   			honest = medium_stress_impact_loss
   			callous = medium_stress_impact_gain 	
   			zealous = medium_stress_impact_gain 
   			paranoid = medium_stress_impact_gain 
		}

		ai_chance = { #loving, non-zealous AI will do this
        	base = 100
        	ai_value_modifier = {
           		ai_compassion = 1
            	ai_boldness = 0.5
            	ai_zeal = -1
        	}
   		}	
	}


	option = {
		name = fp3_yearly.8024.b

		trigger = {
			exists = scope:helpful_courtier
		}

		scope:dying_consort = {
			death = natural
		}

		custom_tooltip = fp3_helpful_courtier.tt

		duel = {
			skill = intrigue
			value = medium_skill_rating

			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				root = {
					send_interface_toast = {
						title = hiding_sky_burial_toast.success
						left_icon = root

						custom_tooltip = fp3_hidden_sky_burial.tt	
						trigger_event = fp3_yearly.8026 
					}
				}	
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				root = {
					send_interface_toast = {
						title = hiding_sky_burial_toast.failure
						left_icon = root
						
						custom_tooltip = fp3_unhidden_sky_burial.tt
						trigger_event = fp3_yearly.8026 

						hidden_effect = {
							every_vassal_or_below = { 
								if = {
									limit = { is_ai = yes }
									opinion_based_on_sky_burial_viewpoint_scripted_effect = yes 
								}
							}
							every_courtier = { opinion_based_on_sky_burial_viewpoint_scripted_effect = yes 	}
							every_close_family_member = { 
								if = {
									limit = { is_ai = yes }
									opinion_based_on_sky_burial_viewpoint_for_relatives_scripted_effect = yes 
								}
							}
						}
					}
				}
			}
		}

		stress_impact = {
   			brave = medium_stress_impact_gain
   			honest = medium_stress_impact_gain		
		}

		ai_chance = { #loving, non-zealous but craven AI will do this
        	base = 100
        	ai_value_modifier = {
           		ai_compassion = 1
           		ai_energy = 0.5
            	ai_boldness = -0.5
            	ai_zeal = -1
        	}
   		}	
	}

	option = {
		name = fp3_yearly.8024.c

		add_piety = medium_piety_gain 

		scope:dying_consort = {
			death = natural
		}

		stress_impact = {
   			zealous = medium_stress_impact_loss
   			compassionate = medium_stress_impact_gain
   			loyal = medium_stress_impact_gain 
   			cynical = minor_stress_impact_gain	
   			arbitrary = minor_stress_impact_gain
		}

		ai_chance = { #callous/zealous  AI will do this
        	base = 100
        	ai_value_modifier = {
           		ai_compassion = -1
            	ai_zeal = 1
        	}
   		}	
	}
}	

fp3_yearly.8025 = {
	type = character_event  
	title = fp3_yearly.8025.t
	desc = fp3_yearly.8025.desc	
	theme = faith

	left_portrait = {
		character = root
		animation = sadness
		triggered_animation = {
			trigger = {
				has_character_flag = fp3_love_for_consort_flag 
			}
			animation = grief
		}
	}

	override_background = {
		reference = bp1_bonfire
	}

	option = {
		
		trigger = {	has_character_flag = fp3_love_for_consort_flag }

		name = fp3_yearly.8025.a 
	}

	option = {

		name = fp3_yearly.8025.b 
	}
}

fp3_yearly.8026 = {
	type = character_event  
	title = fp3_yearly.8026.t
	desc = fp3_yearly.8026.desc	
	theme = faith

	left_portrait = {
		character = root
		animation = paranoia 
	}

	right_portrait = {
		character = scope:helpful_courtier
		animation = sadness
	}

	override_background = {
		reference = wilderness
	}

	option = {
		name = fp3_yearly.8026.a 
	}

	option = {
		name = fp3_yearly.8026.b

		trigger = {
			OR = {
				has_trait = callous
				has_trait = paranoid
				has_trait = sadistic
				has_trait = lunatic 
				tyranny >= medium_tyranny
			}
		}

		scope:helpful_courtier = {
			death = {
				death_reason = death_murder
				killer = root 
			}
		}
		
		add_secret = { 
			type = secret_murder
			target = scope:helpful_courtier 
		}

		stress_impact = {
   			base = minor_stress_impact_loss
   			paranoid = medium_stress_impact_loss
   			compassionate = massive_stress_impact_gain
   			just = massive_stress_impact_gain
		}
	}
}


###############################################################
# Nine Hundred Ninety Chapters of Gold # by Ola Jentzsch
###############################################################

scripted_trigger fp3_rich_foreign_ruler_trigger = {
	is_ai = yes	
	gold >= major_gold_value 
	NOT = { 
		reverse_opinion = {
			target = root
			value >= 50
		}
	}
	OR = {
		culture = { has_cultural_pillar = heritage_iranian }
		knows_language_of_culture = culture:persian
		dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_2 }
	}
}

fp3_yearly.8027 = {
	type = character_event  
	title = fp3_yearly.8027.t
	desc = fp3_yearly.8027.desc	
	theme = crown 

	left_portrait = {
		character = root
		animation = personality_bold
	}

	right_portrait = {
		character = scope:snubbed_poet
		animation = chancellor
	}

	lower_left_portrait = {
		character = scope:former_employer 
	}

	trigger = { 
		
		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available_healthy_adult = yes
		root.capital_province = { geographical_region = world_persian_empire }

		#Must know Persian for this event to make sense 
		knows_language_of_culture = culture:persian

		#Must have lots of gold to pay the poet
		gold >= major_gold_value 

		has_ep1_dlc_trigger = yes
		has_royal_court = yes

		is_ai = no #since this event potentially spawns both artifacts and courtiers, let's keep it player-only in order to avoid spamming the game world with books and poets 

		any_neighboring_top_liege_realm_owner = { fp3_rich_foreign_ruler_trigger = yes }
	}

	weight_multiplier = {
		base = 0.4
	 	modifier = {
			AND = { #for Ferdowsi
				current_year >= 980
				current_year < 1025 	
		 	}
		 	add = 1.6
	 	}
 	}

	cooldown = { years = 20 }

	immediate = {

		random_neighboring_top_liege_realm_owner = { 
			limit = { fp3_rich_foreign_ruler_trigger = yes }
			save_scope_as = former_employer
		}

		if = { #This looks to see if Ferdowsi will be used in the event 
		 	limit = { #his rough period of activity
			 	AND = {
				 	current_year >= 980
				 	current_year < 1025
			 	}
			 	NOT = { exists = global_var:ferdowsi_created } #makes sure that he wasn't already spawned by any event elsewhere
		 	}
		 	create_character = { 
				location = root.capital_province
				template = fp3_ferdowsi_template
				save_scope_as = snubbed_poet 	#this saves him as a scope so we can get nice effects to bounce off him! 
			}
			set_global_variable = ferdowsi_created 
		}
		else = {
			create_character = { 
				location = root.capital_province
				template = writer_character
				gender_female_chance = root_faith_dominant_gender_female_chance
				faith = faith:maturidi
				culture = culture:persian
				trait = lifestyle_poet 
				trait = shrewd 
				save_scope_as = snubbed_poet 	
			}
		}
	}

	option = {
		name = fp3_yearly.8027.a
		
		custom_tooltip = fp3_promise_to_pay_for_book.tt

		add_courtier = scope:snubbed_poet 

		scope:former_employer = {
			add_opinion = { 
				target = root
				opinion = -30
				modifier = fp3_stole_my_court_poet_opinion
			}
		}

		if = {
			limit = { exists = global_var:ferdowsi_created }
			trigger_event = {
				id = fp3_yearly.8028 
				days = { 250 390 } 
			}
		}
		else = {
			trigger_event = {
				id = fp3_yearly.8029 
				days = { 250 390 } 
			}
		}

		stress_impact = {
   			generous = medium_stress_impact_loss
   			content = medium_stress_impact_gain
   			greedy = medium_stress_impact_gain
   			paranoid = medium_stress_impact_gain
		} 
	}

		
	option = {
		name = fp3_yearly.8027.b
		flavor = fp3_mediate_between_them.flavor

		trigger = {
			NOT = {	has_relation_rival = scope:former_employer }
		}

		duel = { #this duel is root trying to mediate
			skill = diplomacy
			value = medium_skill_rating

			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				modifier = {
					add = 40
					scope:former_employer = {
						has_trait = forgiving
					}
				}
				modifier = {
					add = 20
					scope:former_employer = {
						OR = {
							has_trait = trusting
							has_trait = generous
						}
					}
				}
				custom_tooltip = fp3_mediation_succeeds.tt
				custom_tooltip = fp3_poet_leaves.tt
				hidden_effect = { 
					trigger_event = fp3_yearly.8031 
					
				}
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				modifier = {
					add = 40
					scope:former_employer = {
						OR = {
							has_trait = vengeful
							has_trait = paranoid
						}
					}
				}
				modifier = {
					add = 20
					scope:former_employer = {
						OR = {
							has_trait = wrathful 
							has_trait = arrogant
						}
					}
				}
				custom_tooltip = fp3_mediation_fails.tt
				show_as_tooltip = {
					if = {
						limit = { exists = global_var:ferdowsi_created }
						scope:snubbed_poet = { #Let's keep the historical characters around, if they were created
							move_to_pool = yes 
						}
					}
					else = {
						scope:snubbed_poet = { #otherwise, let's just have him disappear 
							move_to_pool = yes
							silent_disappearance_effect = yes
						}
					}
				}
				hidden_effect = { 
					trigger_event = fp3_yearly.8030 
					
				}
			}
		}

		stress_impact = {
   			just = medium_stress_impact_loss
   			arrogant = medium_stress_impact_gain
   			cynical = medium_stress_impact_gain
   			paranoid = medium_stress_impact_gain
		} 
	}

	option = {
		name = fp3_yearly.8027.c

		if = {
			limit = { exists = global_var:ferdowsi_created }
			scope:snubbed_poet = { #Let's keep the historical characters around, if they were created
				move_to_pool = yes 
			}
		}
		else = {
			scope:snubbed_poet = { #otherwise, let's just have him disappear 
				move_to_pool = yes
				silent_disappearance_effect = yes
			}
		}

		stress_impact = {
   			greedy = medium_stress_impact_loss
   			ambitious = medium_stress_impact_gain
   			generous = medium_stress_impact_gain
		}
	}
}

fp3_yearly.8028 = {
	type = character_event  
	title = fp3_yearly.8028.t
	desc = fp3_yearly.8028.desc	
	theme = crown 

	left_portrait = {
		character = root
		animation = admiration
	}

	right_portrait = {
		character = scope:snubbed_poet
		animation = chancellor
	}

	artifact = { # To display the artifact in the event-window
	    target = scope:shahnameh
	    position = lower_left_portrait
	}

	trigger = { 
		scope:snubbed_poet = {
			is_available_healthy_ai_adult = yes
		}
	}

	immediate = {

		save_scope_as = owner 
		set_artifact_rarity_illustrious = yes 

		create_artifact = {	
			name = shahnameh_name 
			creator = scope:snubbed_poet
			description = shahnameh_desc 
			visuals = book
			type = book
			modifier = fp3_artifact_shahnameh_modifier
			wealth = scope:wealth  # This comes from the scripted effect above
			quality = scope:quality # This comes from the scripted effect above
			save_scope_as = shahnameh # Allows the BOOK to be accessed via scope after its creation
		}		
	}

	option = {
		name = fp3_yearly.8028.a

		pay_short_term_gold = {
  			gold = 495
  	 		target = scope:snubbed_poet
  	 	}
	}

	option = {
		name = fp3_yearly.8028.b

		pay_short_term_gold = {
  			gold = 495
  	 		target = scope:snubbed_poet
  	 	}

		scope:snubbed_poet = { 
			move_to_pool = yes
		}	
	}

	option = {
		name = fp3_yearly.8029.c

		add_character_modifier = {
			modifier = fp3_reneged_on_promise_modifier
			years = 10
		}

		scope:snubbed_poet = {
			add_opinion = {
				target = root
				modifier = contempt_opinion
				opinion = -30 
			}	
		}

		scope:snubbed_poet = { 
			move_to_pool = yes
		}	
	}
}

fp3_yearly.8029 = {
	type = character_event  
	title = fp3_yearly.8029.t
	desc = fp3_yearly.8029.desc	
	theme = crown 

	left_portrait = {
		character = root
		animation = happiness
	}

	right_portrait = {
		character = scope:snubbed_poet
		animation = chancellor
	}

	artifact = { # To display the artifact in the event-window
	    target = scope:persian_epic
	    position = lower_left_portrait
	}

	immediate = {

		save_scope_as = owner 
		set_artifact_rarity_masterwork = yes 

		create_artifact = {	
			name = persian_epic_name 
			creator = scope:snubbed_poet
			description = persian_epic_desc 
			visuals = book
			type = book
			modifier = fp3_artifact_persian_epic_modifier
			wealth = scope:wealth  # This comes from the scripted effect above
			quality = scope:quality # This comes from the scripted effect above
			save_scope_as = persian_epic # Allows the sword to be accessed via scope after its creation
		}		
	}

	option = {
		name = fp3_yearly.8029.a

		pay_short_term_gold = {
  			gold = 495
  	 		target = scope:snubbed_poet
  	 	}
	}

	option = {
		name = fp3_yearly.8029.b

		pay_short_term_gold = {
  			gold = 495
  	 		target = scope:snubbed_poet
  	 	}

		scope:snubbed_poet = { 
			move_to_pool = yes
			silent_disappearance_effect = yes
		}	
	}

	option = {
		name = fp3_yearly.8029.c

		add_character_modifier = {
			modifier = fp3_reneged_on_promise_modifier
			years = 10
		}

		scope:snubbed_poet = { 
			move_to_pool = yes
			silent_disappearance_effect = yes
		}	
	}
}

fp3_yearly.8030 = {
	type = letter_event
	opening = fp3_yearly.8030.opening
	desc = fp3_yearly.8030.desc
	sender = scope:former_employer 

	immediate = {
		
		scope:former_employer = {
			add_opinion = { 
				target = root
				opinion = -20
				modifier = angry_opinion
			}
		}	
	}

	option = {
		name = fp3_yearly.8030.a
	}
}

fp3_yearly.8031 = {
	type = letter_event
	opening = fp3_yearly.8031.opening
	desc = fp3_yearly.8031.desc
	sender = scope:former_employer 

	immediate = {

		scope:former_employer = {
			add_opinion = {
				target = root 
				modifier = respect_opinion
				opinion = 20 
			}
			add_courtier = scope:snubbed_poet
		}
		scope:snubbed_poet = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 30 
			}	
		}

		add_prestige = medium_prestige_value
	}

	option = {
		name = fp3_yearly.8031.a
	}
}


###############################################################
# The Ten Days of the Dead # by Ola Jentzsch
###############################################################

fp3_yearly.8032 = {
	type = character_event  
	title = fp3_yearly.8032.t
	desc = fp3_yearly.8032.desc	
	theme = death

	left_portrait = {
		character = root
		animation = personality_cynical
	}

	right_portrait = {
		character = scope:death_enthusiast
		animation = sadness 
	}

	trigger = { #this event triggers from yearly_persian.1001, and in order to not mess that up, I decided to not demand a fp3_dlc_trigger for this one. 

		is_available_adult = yes
		OR = {
			culture = { has_cultural_pillar = heritage_iranian }
			AND = {
				any_consort = {
					culture = { has_cultural_pillar = heritage_iranian }
				}
				root.capital_province = { geographical_region = world_persian_empire }
			}
		}

		any_consort = {
			is_ai = yes 
			culture = { has_cultural_pillar = heritage_iranian }
			NOR = {
				has_trait = arrogant
				has_trait = cynical
				has_trait = callous
			}
		}

		any_ancestor = {
			even_if_dead = yes 
			house = root.house
		}
	}

	immediate = {

		add_character_flag = {
			flag = had_event_yearly_persian_1002 #though counter-intuitively named, this will now block both this and yearly_persian_1002 for five years 
			years = 5
		}

		random_consort = {
			limit = {
				is_ai = yes 
				culture = { has_cultural_pillar = heritage_iranian }
				NOR = {
					has_trait = arrogant
					has_trait = cynical
					has_trait = callous
				}
			}
			save_scope_as = death_enthusiast 
		}


		random_ancestor = {
			even_if_dead = yes 
			limit = {  
				house = root.house 
			}
			save_scope_as = ancestor_1
		}	

		scope:death_enthusiast = {
			add_character_modifier = {
				modifier = fp3_thinking_about_the_afterlife_modifier
				years = 5
			}	
		}
	}
		
	option = { #Say no to paganism 
		name = fp3_yearly.8032.a

		trigger = {
			OR = {
				has_religion = religion:islam_religion
				OR = { has_religion = religion:eastern_orthodox_religion has_religion = religion:catholic_religion has_religion = religion:protestant_religion }
			}
		}

		add_piety = medium_piety_gain 

		scope:death_enthusiast = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion 
				opinion = -20 
			}	
		}

		stress_impact = {
   			zealous = minor_stress_impact_loss
   			compassionate = medium_stress_impact_gain
   			humble = minor_stress_impact_gain
		}
	}

	option = { #of course my love 
		name = fp3_yearly.8032.b

		trigger = {
			reverse_opinion = {
				target = scope:death_enthusiast
				value >= 30
			}
			NOR = {
				AND = {
					has_religion = religion:islam_religion
					has_trait = zealous 
				}
				AND = {
					OR = { has_religion = religion:eastern_orthodox_religion has_religion = religion:catholic_religion has_religion = religion:protestant_religion }
					has_trait = zealous
				}
			}
		}

		scope:death_enthusiast = { 
			if = {
				limit = { 
					OR = { 
						has_relation_lover = root
						has_relation_soulmate = root 
					}
				}
				add_opinion = {
					target = root
					modifier = happy_opinion
					opinion = 20 
				}
			}	
			else = {
				root = {
					progress_towards_lover_effect = {
						CHARACTER = scope:death_enthusiast
						REASON = lover_loves_death 
						OPINION = 20 
					}
				}
			}	
		}

		stress_impact = {
   			base = medium_stress_impact_loss
   			shy = major_stress_impact_gain
		}
	}

	option = { #think of my dynasty
		name = fp3_yearly.8032.c

		dynasty = { add_dynasty_prestige = minor_dynasty_prestige_value }

		stress_impact = {
   			arrogant = minor_stress_impact_loss
   			humble = medium_stress_impact_gain
		}
	}

	option = { #you're right, death awaits us all
		name = fp3_yearly.8032.d

		trigger = {
			NOT = { has_character_modifier = fp3_thinking_about_the_afterlife_modifier }
		}

		add_character_modifier = {
			modifier = fp3_thinking_about_the_afterlife_modifier
			years = 15
		}

		stress_impact = {
   			base = medium_stress_impact_gain
   			craven = miniscule_stress_impact_gain
		}
	}
}

###############################################################
# Frozen Treats - by Ola Jentzsch
###############################################################
scripted_trigger fp3_loves_faloodeh_trigger = {
	is_available_ai = yes
	is_healthy = yes 
	OR = {
		has_trait = gluttonous
		has_trait = gregarious 
		has_trait = comfort_eater
		has_character_modifier = feast_life_reaffirmed_modifier
	}
	NOR = {
		has_trait = temperate
		has_trait = inappetetic
		AND = {
			faith = { has_doctrine = tenet_asceticism	}
			ai_zeal >= medium_positive_ai_value
		}
	}
}

fp3_yearly.8033 = {
	type = character_event  
	title = fp3_yearly.8033.t
	desc = fp3_yearly.8033.desc	
	theme = realm 

	left_portrait = {
		character = root
		animation = personality_compassionate
	}

	right_portrait = {
		character = scope:sorbet_enthusiast
		animation = worry
	}

	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available = yes 
		is_healthy = yes 
		root.capital_province = { geographical_region = world_persian_empire }

		#checking that we have an interesting character that would fit the scope
		OR = { 
			any_consort = { 
				fp3_loves_faloodeh_trigger = yes
			}
			any_powerful_vassal = { 
				fp3_loves_faloodeh_trigger = yes
			}
			any_councillor = {
				fp3_loves_faloodeh_trigger = yes
			}
			any_child = {
				fp3_loves_faloodeh_trigger = yes
				age >= 10
			}
		}

		#checking that we have fitting country for ice houses 

		any_held_county = {
			any_county_province = {
				geographical_region = world_persian_empire
				OR = {
					terrain = desert
					terrain = drylands
					terrain = desert_mountains
					terrain = oasis 
				}
			}
		}	
	}

	cooldown = { years = 100 }

	immediate = {

		#getting the best faloodeh lover for our purposes
		if = {
			limit = { 
				any_consort = { fp3_loves_faloodeh_trigger = yes }
			}
			random_consort = {
				limit = { 
					fp3_loves_faloodeh_trigger = yes
				}
				save_scope_as = sorbet_enthusiast
			}
		}
		else_if = {
			limit = { 
				any_powerful_vassal = { fp3_loves_faloodeh_trigger = yes }
			}
			random_powerful_vassal = {
				limit = { 
					fp3_loves_faloodeh_trigger = yes
				}
				save_scope_as = sorbet_enthusiast
			}
		}
		else_if = {
			limit = { 
				any_councillor = { fp3_loves_faloodeh_trigger = yes }
			}
			random_councillor = {
				limit = { 
					fp3_loves_faloodeh_trigger = yes
				}
				save_scope_as = sorbet_enthusiast
			}
		}
		else_if = {
			limit = { 
				any_child = { 
					fp3_loves_faloodeh_trigger = yes
					age >= 10	
				}
			}
			random_child = {
				limit = { 
					fp3_loves_faloodeh_trigger = yes
					age >= 10		
				}
				save_scope_as = sorbet_enthusiast
			}
		}

		random_held_county = {
			limit = {
				any_county_province = {
					geographical_region = world_persian_empire
					OR = {
						terrain = desert
						terrain = drylands
						terrain = desert_mountains
						terrain = oasis 
					}
				}
			}
			save_scope_as = yakhchal_county 
		}

		scope:yakhchal_county = {
			add_county_modifier = {
				modifier = fp3_broken_icehouses_county_modifier
				years = 25
			}
		}
	}

	option = {
		name = fp3_yearly.8033.a

		trigger = {
			OR = {
				has_trait = gluttonous
				has_trait = gregarious 
				has_trait = comfort_eater
			}
		}

		add_character_modifier = {
			modifier = fp3_securing_sorbet_supply_modifier
			years = 25
		}

		scope:sorbet_enthusiast = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20 
			}	
		}

		stress_impact = {
   			arbitrary = minor_stress_impact_loss
   			just = medium_stress_impact_gain
   			temperate = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = 0.5
           		ai_greed = 0.5
            	ai_sociability = 0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8033.b

		trigger = {
			NOR = {
				has_trait = gluttonous
				has_trait = gregarious 
				has_trait = comfort_eater
			}
		}

		scope:sorbet_enthusiast = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -20 
			}	
		}

		add_character_modifier = {
			modifier = fp3_court_austerity_modifier
			years = 25
		}

		stress_impact = {
   			temperate = minor_stress_impact_loss
   			gluttonous = major_stress_impact_gain
   			gregarious = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
           		ai_greed = -0.5
            	ai_sociability = -0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8033.c

		remove_treasury_or_gold = medium_treasury_or_gold_value 

		scope:yakhchal_county = {
			remove_county_modifier = fp3_broken_icehouses_county_modifier
		}

		scope:sorbet_enthusiast = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 20 
			}	
		}

		stress_impact = {
   			generous = minor_stress_impact_loss
   			greedy = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
           		ai_rationality = 0.7
            	ai_greed = -0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8033.d

		scope:sorbet_enthusiast = {
			add_opinion = {
				target = root
				modifier = insulted_opinion 
			}	
		}

		stress_impact = {
   			lazy = medium_stress_impact_loss
   			diligent = medium_stress_impact_gain
   			gregarious = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
           		ai_energy = -0.7
            	ai_compassion = -0.5
        	}
   		}
	}
}


		

###############################################################
# The Hephthalite Hoard - by Ola Jentzsch
###############################################################
scripted_trigger hypothetical_hephthalite_heritage_trigger = {
	OR = {
		has_culture = culture:saka
		has_culture = culture:tajik
		has_culture = culture:sogdian
		has_culture = culture:turkish
		has_culture = culture:khwarezmian
		has_culture = culture:afghan 
		has_culture = culture:tocharian
	}
}

scripted_trigger hephthalite_hoard_province_trigger = {
	OR = {
		geographical_region = dlc_fp3_eastern_persian_frontier_regions
		geographical_region = custom_bactria
		geographical_region = world_steppe_tarim
	}
}
	
fp3_yearly.8034 = {
	type = character_event  
	title = fp3_yearly.8034.t
	desc = fp3_yearly.8034.desc	
	theme = vassal 

	left_portrait = {
		character = root
		animation = personality_rational
	}

	right_portrait = {
		character = scope:wronged_vassal
		animation = beg
	}

	lower_left_portrait = {
		character = scope:greedy_vassal
	}

	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_ruler = yes
		is_available = yes 
		is_healthy = yes 

		any_vassal = {
			is_ai = yes
			OR = {
				has_trait = greedy
				has_trait = arrogant
				has_trait = deceitful
			}
			any_vassal_or_below = {
				is_ai = yes
				hypothetical_hephthalite_heritage_trigger = yes
				any_held_county = { 
					any_county_province = { hephthalite_hoard_province_trigger = yes }
				}
			}
		}	
	}

	cooldown = { years = 100 }

	immediate = {

		random_vassal = {
			limit = {
				is_ai = yes
				OR = {
					has_trait = greedy
					has_trait = arrogant
					has_trait = deceitful
				}
				any_vassal_or_below = {
					is_ai = yes
					hypothetical_hephthalite_heritage_trigger = yes
					any_held_county = { 
						any_county_province = { hephthalite_hoard_province_trigger = yes }
					}
				}
			}
			save_scope_as = greedy_vassal 
		}	

		random_vassal_or_below = {
			limit = {
				is_vassal_of = scope:greedy_vassal 
				is_ai = yes
				hypothetical_hephthalite_heritage_trigger = yes
				any_held_county = { 
					any_county_province = { hephthalite_hoard_province_trigger = yes }
				}
			}
			random_held_county = {
				limit = {
					any_county_province = {  hephthalite_hoard_province_trigger = yes }	
				}
				save_scope_as = hephthalite_hoard_province
			}
			save_scope_as = wronged_vassal 
		}

		scope:wronged_vassal = {
			add_gold = massive_gold_value 
		}

		scope:greedy_vassal = {
			add_opinion = {
				target = scope:wronged_vassal
				modifier = fp3_resentful_opinion 
				opinion = -20
			}	
		}	

		scope:wronged_vassal = {
			add_opinion = {
				target = scope:greedy_vassal
				modifier = bitter_rivalry_opinion 
				years = 10
			}	
		}	
	}

	option = {
		name = fp3_yearly.8034.a

		scope:wronged_vassal = {
			pay_short_term_gold = {
   				target = root
  				gold = massive_gold_value
			}
		}

		add_tyranny = medium_tyranny_value

		stress_impact = {
   			greedy = minor_stress_impact_loss
   			just = massive_stress_impact_gain
   			craven = medium_stress_impact_gain
   			content = medium_stress_impact_gain 
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
           		ai_boldness = 0.7
            	ai_greed = 1
            	ai_compassion = -1
        	}
   		}
	}

	option = {
		name = fp3_yearly.8034.b

		scope:wronged_vassal = {
			pay_short_term_gold = {
   				target = scope:greedy_vassal
  				gold = massive_gold_value
			}
		}

		scope:wronged_vassal = {
			add_opinion = {
				target = root
				modifier = fp3_dismayed_opinion 
			}	
		}

		scope:greedy_vassal = {
			add_opinion = {
				target = root
				modifier = grateful_opinion 
				opinion = 20
			}	
		}

		stress_impact = {
   			arbitrary = minor_stress_impact_loss
   			just = medium_stress_impact_gain	
		}

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

	option = {
		name = fp3_yearly.8034.c

		scope:wronged_vassal = {
			remove_short_term_gold = massive_gold_value
		}

		if = {
			limit = {
				faith = { 
					OR = {
						trait_is_virtue = compassionate 
						trait_is_virtue = generous
						trait_is_virtue = peasant_leader
					}
				}
			}
			add_piety = medium_piety_value
		}
		else = {
			add_prestige = minor_prestige_value 
		}

		scope:wronged_vassal = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion 
				opinion = -20 
			}	
		}

		scope:greedy_vassal = {
			add_opinion = {
				target = root
				modifier = intrusive_liege_opinion 
			}	
		}

		stress_impact = {
   			just = minor_stress_impact_loss
   			arrogant = medium_stress_impact_gain	
   			greedy = medium_stress_impact_gain 
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_compassion = 0.5
            	ai_rationality = 0.5
            	ai_greed = -0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8034.d

		scope:wronged_vassal = {
			add_opinion = {
				target = root
				modifier = grateful_opinion 
				opinion = 10 
			}	
		}

		add_hook = {
  			type = indebted_hook
  			target = scope:wronged_vassal 
 		}

 		scope:greedy_vassal = {
			add_opinion = {
				target = root
				modifier = angry_opinion 
				opinion = -30 
			}	
		}

		stress_impact = {
   			generous = minor_stress_impact_loss
   			craven = medium_stress_impact_gain	
   			paranoid = medium_stress_impact_gain 
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_compassion = 0.3
            	ai_boldness = 0.5
            	ai_rationality = 0.5
            	ai_greed = -0.5
        	}
   		}
	}
}

###############################################################
# The Heart and the Creator - by Ola Jentzsch
###############################################################

fp3_yearly.8035 = {
	type = character_event  
	title = fp3_yearly.8035.t
	desc = fp3_yearly.8035.desc	
	theme = learning_theology_focus

	left_portrait = {
		character = scope:sufi_mystic
		animation = personality_zealous
	}

	right_portrait = {
		character = root
		animation = personality_rational
	}

	override_background = {
		reference = corridor_night
	}

	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_available_healthy_adult = yes 
		learning >= average_skill_level

		NOT = {	has_character_modifier = fp3_sufi_initiate_modifier }

		#checking that we have a suitable sufism mentor
		OR = { 
			any_relation = { 
				type = friend
				fp3_sufism_enthusiast_trigger = yes
			}
			any_relation = { 
				type = lover 
				fp3_sufism_enthusiast_trigger = yes
			}
			any_courtier_or_guest = {
				fp3_sufism_enthusiast_trigger = yes
				reverse_opinion = {
					target = root
					value >= 50
				}
			}
		}
	}

	weight_multiplier = {
		base = 0.4
	 	modifier = {
		 	OR = {
			 	fp3_sufism_enthusiast_trigger = yes
			 	has_trait = lifestyle_mystic
		 	}
		 	add = 1.6
	 	}
	 	modifier = { #Sufis don't get along with legalists, so legalist faiths are less likely to have sufi events 
	 		faith = { has_doctrine = tenet_legalism }
	 		add = -0.2
	 	}
 	}

 	cooldown = { years = 100 }

 	immediate = {

 		if = {
			limit = { 
				any_relation = { 
					type = friend
					fp3_sufism_enthusiast_trigger = yes 
				}
			}
			random_relation = {
				type = friend
				limit = { fp3_sufism_enthusiast_trigger = yes	}
				save_scope_as = sufi_mystic
			}
		}
		else_if = {
			limit = { 
				any_relation = { 
					type = lover
					fp3_sufism_enthusiast_trigger = yes 
				}
			}
			random_relation = {
				type = lover
				limit = { fp3_sufism_enthusiast_trigger = yes	}
				save_scope_as = sufi_mystic
			}
		}
		else_if = {
			limit = { 
				any_courtier_or_guest = { fp3_sufism_enthusiast_trigger = yes }
			}
			random_courtier_or_guest = {
				limit = { 
					fp3_sufism_enthusiast_trigger = yes
				}
				save_scope_as = sufi_mystic
			}
		}

		scope:sufi_mystic = {
			add_character_modifier = {
 				modifier = fp3_sufi_initiate_modifier #Unlocks the "Meditate in Seclusion" decision if you are a ruler
 			}
 		}
 	}

 	option = {
 		name = fp3_yearly.8035.a

 		duel = {
			skill = learning
			value = medium_skill_rating

			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 2
				}
				root = {
					send_interface_toast = {
						title = learning_muraqaba_toast.success
						left_icon = root
				
						custom_tooltip = fp3_unlock_meditation.tt
						add_character_modifier = {
 							modifier = fp3_sufi_initiate_modifier #Unlocks the "Meditate in Seclusion" decision if you are a ruler
 						}
					}
				}	
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				root = {
					send_interface_toast = {
						title = learning_muraqaba_toast.failure
						left_icon = root
						add_learning_lifestyle_xp = minor_lifestyle_experience
					}
				}
			}
		}

		scope:sufi_mystic = {
			add_opinion = {
				target = root
				modifier = trusted_friend_opinion 
			}	
		}

 		stress_impact = { #while the stress mods here are low, note that they stack with the base modifier
   			base = medium_stress_impact_gain
   			zealous = minor_stress_impact_loss
   			patient = minor_stress_impact_loss
   			arrogant = medium_stress_impact_gain
   			paranoid = minor_stress_impact_gain
   			callous = medium_stress_impact_gain	
   			lazy = minor_stress_impact_gain
   			content = minor_stress_impact_gain
   			cynical = minor_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_compassion = 0.5
            	ai_boldness = 0.5
            	ai_energy = 0.5
            	ai_zeal = 1
        	}
   		}
 	}

 	option = {
 		name = fp3_yearly.8035.b

 		add_piety = medium_piety_value 

 		scope:sufi_mystic = {
			add_opinion = {
				target = root
				modifier = angry_opinion 
				opinion = -30 
			}	
		}

 		stress_impact = {
   			stubborn = minor_stress_impact_loss
   			zealous = minor_stress_impact_loss
   			ambitious = medium_stress_impact_gain
   			trusting = major_stress_impact_gain	
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_rationality = 0.5
            	ai_vengefulness = 0.5
            	ai_zeal = 1
        	}
   		}
 	}

 	option = {
 		name = fp3_yearly.8035.c

 		scope:sufi_mystic = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion 
				opinion = -15 
			}	
		}

 		stress_impact = {
   			base = minor_stress_impact_loss 
   			zealous = medium_stress_impact_gain
   			ambitious = medium_stress_impact_gain	
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_energy = -0.5
            	ai_boldness = -0.5
            	ai_zeal = -0.5
        	}
   		}
 	}
}

###############################################################
# The City of the Mouthless - by Ola Jentzsch
###############################################################
scripted_trigger superstitious_coward_trigger = {
	is_available_healthy_ai_adult = yes
	NOT = { 
		has_trait = brave
		has_trait = cynical
		has_trait = stubborn
		learning >= good_skill_level
	}
}


fp3_yearly.8036 = {
	type = character_event  
	title = fp3_yearly.8036.t
	desc = fp3_yearly.8036.desc	
	theme = skull

	left_portrait = {
		character = root
		animation = personality_content
	}

	right_portrait = {
		character = scope:superstitious_councillor
		animation = paranoia
	}

	override_background = {
		reference = bp1_bonfire
	}

	trigger = {

		#standard sanity checks
		has_fp3_dlc_trigger = yes
		is_available_healthy_adult = yes 
		is_ruler = yes 
		root.capital_province = { geographical_region = world_persian_empire }

		any_councillor = {	superstitious_coward_trigger = yes	}

		any_held_county = {
			OR = {
				this = title:c_ardabil
				development_level <= medium_development_level
			}
		}
	}

	cooldown = { years = 10 }

	immediate = {

		random_councillor = {
			limit = { superstitious_coward_trigger = yes }
			save_scope_as = superstitious_councillor
		}

		random_held_county = {
			if = {
				limit = { this = title:c_ardabil }
				save_scope_as = spooky_county
			}
			else_if = {
				limit = { 
					development_level < medium_development_level
				}
				save_scope_as = spooky_county
			}
		}
	}

	option = {
		name = fp3_yearly.8036.a

		trigger = { has_lifestyle = learning_lifestyle }

		add_learning_lifestyle_xp = minor_lifestyle_experience

		scope:superstitious_councillor = {
			add_opinion = {
				target = root
				modifier = perplexed_opinion 
				opinion = -15 
			}	
		}

		stress_impact = {
   			craven = medium_stress_impact_gain
   			impatient = medium_stress_impact_gain
   			paranoid = medium_stress_impact_gain	
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_energy = 0.5
            	ai_boldness = 1
            	ai_rationality = 0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8036.b

		scope:superstitious_councillor = {
			add_opinion = {
				target = root
				modifier = took_my_advice_opinion 
				opinion = 15 
			}	
		}

		add_character_modifier = {
			modifier = fp3_avoiding_dark_places_modifier
			years = 5
		}

		stress_impact = {
   			brave = medium_stress_impact_gain
   			cynical = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_energy = 0.5
            	ai_boldness = -1
            	ai_zeal = 0.5
        	}
   		}
	}

	option = {
		name = fp3_yearly.8036.c

		add_character_modifier = {
			modifier = fp3_relentless_skeptic_modifier
			years = 5
		}

		scope:superstitious_councillor = {
			add_opinion = {
				target = root
				modifier = stress_upset_councillor
			}	
		}

		stress_impact = {
   			craven = medium_stress_impact_gain	
   			callous = medium_stress_impact_gain
   			paranoid = medium_stress_impact_gain
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_sociability = 0.5
            	ai_boldness = 0.5
            	ai_rationality = 1
        	}
   		}
	}

	option = {
		name = fp3_yearly.8036.d

		add_piety = minor_piety_value

		stress_impact = {
   			cynical = medium_stress_impact_gain
   			brave = medium_stress_impact_gain	
		}

		ai_chance = { 
        	base = 100
        	ai_value_modifier = {
            	ai_zeal = 1
            	ai_boldness = -0.5
            	ai_rationality = -0.5
        	}
   		}
	}
}
