################
# WITCH EVENTS #
################

namespace = everpreg_witch

#everpreg_witch.1001-1999 - Guardian coverts ward
#everpreg_witch.2001-2899 - Convert to everpreg_witchcraft scheme
#everpreg_witch.2900-2999 - Reveal as everpreg_witch interaction
#everpreg_witch.3001-3999 - Witch ritual activity events
#everpreg_witch.4001-4999 - Witch ongoing events
#

##########################
# GUARDIAN CONVERTS WARD #
##########################

everpreg_witch.1001 = { #by Mathilda Bjarnehed
	hidden = yes
	
	trigger = {
		is_everpreg_witch_trigger = no
		is_male = no
		any_relation = {
			type = guardian
			faith = { has_doctrine_parameter = tenet_everpreg_holywomb }
			#is_everpreg_witch_trigger = yes
		}
	}

	immediate = {
		#If coven and child is AI, immediately convert them
		if = {
			limit = {
				is_ai = yes
				exists = house
				house = {
					has_house_modifier = everpreg_witch_coven
				}
			}
			house = {
				house_head = {
					add_to_list = everpreg_witch_message
				}
			}
			every_parent = {
				limit = {
					is_ruler = yes
					is_everpreg_witch_trigger = yes
				}
				add_to_list = everpreg_witch_message
			}
			every_in_list = {
				list = everpreg_witch_message
				send_interface_message = {
					type = event_generic_good
					title = everpreg_witch.1001.message
					left_icon = root
					root = {
						give_everpreg_witch_secret_or_trait_effect = yes
						add_trait = everpreg_1
						random_secret = {
							limit = { secret_type = secret_everpreg_witch }
							reveal_to = house.house_head
						}
					}
				}
			}
		}
		#For non-covens children and player children, send guardian choice event (AI guardians must chose convert for everpreg_witch coven player children)
		else = {
			save_scope_as = child
			random_relation = { type = guardian trigger_event = everpreg_witch.1002 }
		}
	}
}	

scripted_trigger everpreg_witch_1002_allow_reveal_outcome_trigger = {
	exists = scope:child.liege
	scope:guardian = {
		NOT = { this = scope:child.liege }
		any_secret = {
			secret_type = secret_everpreg_witch
			OR = {
				NOT = { is_known_by = scope:child }
				NOT = { is_known_by = scope:child.liege }
			}
		}
	}
}

#Guardian: convert this child?
everpreg_witch.1002 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.1002.t
	desc = everpreg_witch.1002.desc
	theme = witchcraft
	override_background = {
		event_background = study
	}
	left_portrait = scope:child

	immediate = { save_scope_as = guardian }
	
	#Convert them
	option = {
		name = everpreg_witch.1002.a


		#Duel if child is AI
		if = {
			limit = { scope:child = { is_ai = yes } }
			duel = {
				skill = learning
				target = scope:child
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 2.5
					}
					opinion_modifier = {
						who = scope:child
						opinion_target = scope:guardian
						multiplier = 0.25
						step = 5
					}
					modifier = {
						scope:child = { has_trait = ambitious }
						add = 20
					}
					modifier = {
						scope:child = { has_trait = curious }
						add = 20
					}
					desc = child_everpreg_witch_conversion_success_effect.desc
					child_everpreg_witch_conversion_success_effect = yes
				}
				35 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					opinion_modifier = {
						who = scope:child
						opinion_target = scope:guardian
						multiplier = -0.25
						step = 5
					}
					modifier = {
						scope:child = { has_trait = craven }
						add = 30
					}
					desc = child_everpreg_witch_conversion_failure_effect.desc
					child_everpreg_witch_conversion_failure_effect = yes
				}
				15 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -2.5
					}
					opinion_modifier = {
						who = scope:child
						opinion_target = scope:guardian
						multiplier = -0.25
						step = 5
					}
					modifier = {
						scope:child = {
							AND = {
								has_trait = zealous 
								NOT = {
									faith = { has_doctrine_parameter = tenet_everpreg_holywomb }
								}
							}
						}
						add = 150
					}
					trigger = {
						everpreg_witch_1002_allow_reveal_outcome_trigger = yes
					}
					desc = child_everpreg_witch_conversion_critical_failure_effect.desc
					child_everpreg_witch_conversion_critical_failure_effect = yes
				}
			}
		}
		else = {
			show_as_tooltip = {
				random_list = {
					1 = {
						show_chance = no
						desc = child_everpreg_witch_conversion_success_effect.desc
						child_everpreg_witch_conversion_success_effect = yes
					}
					1 = {
						show_chance = no
						desc = child_everpreg_witch_conversion_failure_effect.desc
						child_everpreg_witch_conversion_failure_effect = yes
					}
					1 = {
						show_chance = no
						trigger = {
							everpreg_witch_1002_allow_reveal_outcome_trigger = yes
						}
						desc = child_everpreg_witch_conversion_critical_failure_effect.desc
						child_everpreg_witch_conversion_critical_failure_effect = yes
					}
				}
			}

			scope:child = {
				trigger_event = everpreg_witch.1003
			}
		}
		
		ai_chance = {
			base = 100

			ai_boldness_target_modifier = { VALUE = 50 }
			#Player children of everpreg_witch covens should always be asked
			modifier = {
				scope:child = {
					exists = house
					house = { has_house_modifier = everpreg_witch_coven }
					is_ai = no
				}
				add = 1000
			}
		}
	}

	#Don't risk it
	option = {
		name = everpreg_witch.1002.b



		ai_chance = {
			base = 0

			ai_boldness_target_modifier = { VALUE = -100 }

			modifier = {
				exists = liege
				OR = {
					trait_is_criminal_in_faith_trigger = { TRAIT = everpreg_witch FAITH = liege.faith GENDER_CHARACTER = root }
				}
				add = 100
			}
			#Player children of everpreg_witch covens should always be asked
			modifier = {
				scope:child = {
					exists = house
					house = { has_house_modifier = everpreg_witch_coven }
					is_ai = no
				}
				add = -1000
			}
		}
	}
}


#Do I want to become an everpreg_witch?
everpreg_witch.1003 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.1003.t
	desc = everpreg_witch.1003.desc
	theme = witchcraft
	override_background = {
		event_background = study
	}
	left_portrait = {
		character = scope:guardian
		animation = personality_dishonorable
	}



	#Yes
	option = {
		name = everpreg_witch.1003.a
		
		child_everpreg_witch_conversion_success_effect = yes
	}

	#No...
	option = {
		name = everpreg_witch.1003.b

		child_everpreg_witch_conversion_failure_effect = yes
	}
	
	#I will tell someone!
	option = {
		trigger = {
			everpreg_witch_1002_allow_reveal_outcome_trigger = yes
		}
		name = everpreg_witch.1003.c

		child_everpreg_witch_conversion_critical_failure_effect = yes
	}
}



##############################################
######COVERT TO WITCHCRAFT SCHEME EVENTS######
##############################################

#Do I want to go ahead with this?
everpreg_witch.2001 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2001.t
	desc = {
		desc = everpreg_witch.2001.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { trait_is_shunned_or_criminal_in_my_or_lieges_faith_trigger = { TRAIT = everpreg_witch GENDER_CHARACTER = root } }
				desc = everpreg_witch.2001.secrecy.desc
			}
			desc = everpreg_witch.2001.no_secrecy.desc
		}
		desc = everpreg_witch.2001.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = scope:target
	
	#Yes
		option = {
		name = everpreg_witch.2001.a
		custom_tooltip = everpreg_witch.2001.a.tt

		if = {
			limit = { scope:target = { is_ai = no } }
			scope:target = {
				trigger_event = {
					id = everpreg_witch.2002
					days = 3
				}
			}
		}
		else_if = {
			limit = { exists = scope:scheme_successful }
			trigger_event = {
				id = everpreg_witch.2003
				days = 3
			}
		}
		else = {
			trigger_event = {
				#on_action = convert_to_everpreg_witchcraft_failure_outcome
				id = everpreg_witch.2004
				days = 3
			}
		}

		ai_chance = {
			base = 100
		}
	}

	#No
	option = {
		name = {
			trigger = { use_convert_to_everpreg_witchcraft_secrecy_trigger = yes }
			text = everpreg_witch.2001.b1
		}
		name = {
			trigger = { use_convert_to_everpreg_witchcraft_secrecy_trigger = yes }
			text = everpreg_witch.2001.b2
		}
		scope:scheme = {
			end_scheme = yes
		}

		ai_chance = {
			base = 0
		}
	}
}

#Someone is trying to convert me to become a everpreg_witch (player only)
everpreg_witch.2002 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2002.t
	desc = {
		desc = everpreg_witch.2002.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:scheme_discovered }
				desc = everpreg_witch.2002.discovery.desc
			}
			desc = everpreg_witch.2002.no_discovery.desc
		}
		desc = everpreg_witch.2002.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:left_portrait
		triggered_animation = {
			trigger = { scope:left_portrait = root }
			animation = disbelief
		}
		animation = personality_dishonorable
	}
	
	immediate = {
		if = {
			limit = { exists = scope:scheme_discovered }
			scope:owner = {
				save_scope_as = left_portrait
				show_as_tooltip = {
					random_secret = {
						limit = {
							secret_type = secret_everpreg_witch
							NOT = { is_known_by = root }
						}
						reveal_to = root
					}
				}
			}
		}
		else = {
			save_scope_as = left_portrait
		}
	}

	#Yes I want to be a everpreg_witch
	option = {
		name = everpreg_witch.2002.a

		show_as_tooltip = {
			give_everpreg_witch_secret_or_trait_effect = yes
		}

		if = {
			limit = {
				faith = {
					# NOT = { has_doctrine = doctrine_everpreg_witchcraft_accepted }
					NOT = { has_doctrine = doctrine_witchcraft_accepted }
				}
			}
			add_piety = medium_piety_loss
		}
		
		scope:owner = {
			trigger_event = everpreg_witch.2003
		}

		stress_impact = {
			zealous = massive_stress_impact_gain
			craven = medium_stress_impact_gain
		}
	}

	#No I don't want to be a everpreg_witch
	option = {
		name = everpreg_witch.2002.b

		add_piety = medium_piety_gain

		scope:owner = {
			trigger_event = everpreg_witch.2004
		}

		if = {
			limit = { exists = scope:scheme_discovered }
			reverse_add_opinion = {
				target = scope:owner
				modifier = disappointed_opinion
				opinion = -15
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_gain
		}
	}
	
	#Reveal them to the world!
	option = {
		trigger = { exists = scope:scheme_discovered }
		name = everpreg_witch.2002.c

		add_piety = medium_piety_gain

		reverse_add_opinion = {
			target = scope:owner
			modifier = hate_opinion
			opinion = -30
		}

		scope:owner = {
			trigger_event = everpreg_witch.2005
		}

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

#SUCCESS EVENTS
scripted_trigger everpreg_witch_2003_can_learn_owner_secret = {
	save_temporary_scope_as = secret_learner
	scope:owner = {
		any_secret = {
			secret_type = secret_everpreg_witch
			NOT = { is_known_by = scope:secret_learner }
		}
	}
}

scripted_trigger everpreg_witch_2003_unlock_reveal_trigger = {
	NOT = { exists = scope:scheme_discovered }
	scope:target = { everpreg_witch_2003_can_learn_owner_secret = yes }
}


everpreg_witch.2003 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2003.t
	desc = everpreg_witch.2003.desc
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:target
		animation = personality_rational
	}
	immediate = {
		add_character_modifier = {
			modifier = recently_used_everpreg_siren_song_modifier
			years = 15
		}
		scope:target = {
			#set_character_faith = scope:owner.faith
			if = { # Safeguard because so much stuff can happen
				limit = {
					NOT = { has_relation_lover = root }
				}
				set_relation_lover = root
			}			
			give_everpreg_witch_secret_or_trait_effect = yes
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = root
			}
		}
		if = {
			limit = { exists = scope:scheme_discovered }
			random_secret = {
				limit = {
					secret_type = secret_everpreg_witch
					NOT = { is_known_by = scope:target }
				}
				reveal_to = scope:target
			}

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

	#Great!
	option = {
		trigger = { everpreg_witch_2003_unlock_reveal_trigger = no }
		name = everpreg_witch.2003.a

		scope:scheme = {
			end_scheme = yes
		}
	}
	
	#Let them know who I am
	option = {
		trigger = { everpreg_witch_2003_unlock_reveal_trigger = yes }
		name = everpreg_witch.2003.b

		if = {
			limit = {
				exists = house
				house = { has_house_modifier = everpreg_witch_coven }
			}
			custom_tooltip = everpreg_witch.2003.b.tt
		}

		scope:target = {
			send_interface_message = {
				type = event_generic_good
				title = everpreg_witch.2003.message
				left_icon = scope:owner
				scope:owner = {
					random_secret = {
						limit = {
							secret_type = secret_everpreg_witch
							NOT = { is_known_by = scope:target }
						}
						reveal_to = scope:target
					}
				}
			}
		}

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

		scope:scheme = {
			end_scheme = yes
		}

		ai_chance = {
			base = 100

			modifier = {
				has_trait = honest
				add = 50
			}
			modifier = {
				has_trait = trusting
				add = 100
			}
		}
	}

	#Keep my secret
	option = {
		trigger = { everpreg_witch_2003_unlock_reveal_trigger = yes }
		name = everpreg_witch.2003.c

		scope:scheme = {
			end_scheme = yes
		}

		ai_chance = {
			base = 50
			modifier = {
				has_trait = paranoid
				add = 100
			}
			modifier = {
				has_trait = craven
				add = 50
			}
			modifier = {
				has_trait = deceitful
				add = 50
			}
		}
	}

	after = {
		#Handle discover
		if = {
			limit = {
				exists = scope:scheme_discovered
				scope:target = {
					is_ai = yes
					OR = {
						AND = {
							is_ruler = no
							exists = liege
							liege = {
								everpreg_witch_2003_can_learn_owner_secret = yes
								NOT = { this = scope:owner }
							}
						}
						any_relation = { type = lover everpreg_witch_2003_can_learn_owner_secret = yes }
						any_consort = { everpreg_witch_2003_can_learn_owner_secret = yes }
						any_child = {
							age >= 7
							everpreg_witch_2003_can_learn_owner_secret = yes
						}
					}
				}
			}
			scope:target = { liege = { trigger_event = everpreg_witch.2010 } }
		}
	}
}

#Success, but discovered
everpreg_witch.2010 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2010.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					any_secret = {
						secret_type = secret_everpreg_witch
						is_known_by = scope:target
					}
				}
				desc = everpreg_witch.talk.2010
			}
			desc = everpreg_witch.leave.2010
		}
		desc = everpreg_witch.end.2010
	}
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:target
		animation = personality_rational
	}
	
	immediate = {
		hidden_effect = {
			scope:target = {
				random_list = {
					3 = {
						trigger = {
							is_ruler = no
							exists = liege
							liege = {
								everpreg_witch_2003_can_learn_owner_secret = yes
								NOT = { this = scope:owner }
							}
						}
						liege = { save_scope_as = listener }
					}
					5 = {
						trigger = {
							any_relation = { type = lover everpreg_witch_2003_can_learn_owner_secret = yes }
						}
						random_relation = {
							type = lover
							limit = { everpreg_witch_2003_can_learn_owner_secret = yes }
							save_scope_as = listener
						}
					}
					5 = {
						trigger = {
							any_consort = { everpreg_witch_2003_can_learn_owner_secret = yes }
						}
						random_consort = {
							limit = { everpreg_witch_2003_can_learn_owner_secret = yes }
							save_scope_as = listener
						}
					}
					1 = {
						trigger = {
							any_child = {
								age >= 7
								everpreg_witch_2003_can_learn_owner_secret = yes
							}
						}
						random_child = {
							limit = {
								age >= 7
								everpreg_witch_2003_can_learn_owner_secret = yes
							}
							save_scope_as = listener
						}
					}
				}
			}
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = scope:listener
			}
		}
	}

	option = {
		name = everpreg_witch.2010.a
		custom_tooltip = everpreg_witch.2010.a.tt
	}
}


#FAILURE EVENTS

#They refuse
everpreg_witch.2004 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2004.t
	desc = {
		desc = everpreg_witch.2004.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:scheme_discovered }
				desc = everpreg_witch.2004.discovered.desc
			}
			desc = everpreg_witch.2004.not_discovered.desc
		}
	}
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:target
		animation = angry
	}

	immediate = {
		if = {
			limit = { exists = scope:scheme_discovered }
			random_secret = {
				limit = {
					secret_type = secret_everpreg_witch
					NOT = { is_known_by = scope:target }
				}
				reveal_to = scope:target
			}
			reverse_add_opinion = {
				target = scope:target
				modifier = impious_opinion
				opinion = -20
			}
		}
		scope:target = {
			add_character_flag = {	
				flag = block_convert_to_everpreg_witchcraft
				days = 7300
			}
		}
	}
	
	option = {
		name = everpreg_witch.2004.a

		scope:scheme = {
			end_scheme = yes
		}
	}
}

#They tell their liege
everpreg_witch.2005 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.2004.t
	desc = {
		desc = everpreg_witch.2004.start.desc
		desc = everpreg_witch.2005.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:target
		animation = angry
	}
	trigger = {
		scope:target = {
			exists = liege
			is_ruler = no
			liege = { NOT = { this = scope:owner } }
		}
		exists = scope:scheme_discovered
	}

	weight_multiplier = {
		base = 1

		ai_value_modifier = {
			who = scope:target
			ai_zeal = 0.05
			max = 2
			min = -0.5
		}
		opinion_modifier = {
			who = scope:target
			opinion_target = root
			multiplier = -0.05
			max = 2
			min = -0.5
		}
	}


	immediate = {
		random_secret = {
			limit = {
				secret_type = secret_everpreg_witch
			}
			if = {
				limit = { NOT = { is_known_by = scope:target } }
				reveal_to = scope:target
			}
			if = {
				limit = { NOT = { is_known_by = scope:target.liege } }
				reveal_to = scope:target.liege
			}
		}
		scope:target = {
			add_character_flag = {	
				flag = block_convert_to_everpreg_witchcraft
				days = 7300
			}
		}
		reverse_add_opinion = {
			target = scope:target
			modifier = impious_opinion
			opinion = -20
		}
	}
	
	option = {
		name = everpreg_witch.2005.a
		flavor = everpreg_witch.2005.a.tt

		scope:scheme = {
			end_scheme = yes
		}
	}
}


#Target was already a everpreg_witch! Expose your secrets to each other - for owner
everpreg_witch.2006 = { #by Linnéa Thimrén
	type = character_event
	title = everpreg_witch.2006.t
	desc = everpreg_witch.2006.desc
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:target
		animation = shock
	}

	trigger = { #Make sure the secrets are still unknown and that target is alive and kicking
		any_scheme = {
			scheme_type = convert_to_everpreg_witchcraft
			scheme_target = scope:target
		}
		scope:target = {
			is_alive = yes
			any_secret = {
				secret_type = secret_everpreg_witch
				NOT = {  any_secret_knower = { this = root } }
			}
		}
	}

	immediate = {
		scope:target = {
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = root
			}
			trigger_event = everpreg_witch.2007
		}
		random_secret = {
			limit = { secret_type = secret_everpreg_witch }
			reveal_to = scope:target
		}
		reverse_add_opinion = {
			target = scope:target
			modifier = respect_opinion
			opinion = 20
		}
	}

	#Great!
	option = {
		name = everpreg_witch.2006.a
	}

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


#Target was already a everpreg_witch! Expose your secrets to each other - for target
everpreg_witch.2007 = { #by Linnéa Thimrén
	type = character_event
	title = everpreg_witch.2007.t
	desc = everpreg_witch.2007.desc
	theme = witchcraft
	override_background = {
		event_background = sitting_room
	}
	left_portrait = {
		character = scope:owner
		animation = shock
	}

	trigger = { #Make sure the secrets are still unknown and that target is alive and kicking
		scope:owner = {
			is_alive = yes
			is_everpreg_witch_trigger = yes
		}
	}

	immediate = {
		show_as_tooltip = {
			scope:owner = {
				random_secret = {
					limit = { secret_type = secret_everpreg_witch }
					reveal_to = root
				}
			}
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = scope:owner
			}
		}
		reverse_add_opinion = {
			target = scope:owner
			modifier = respect_opinion
			opinion = 20
		}
	}

	#Great!
	option = {
		name = everpreg_witch.2007.a
	}
}

###############################
# REVEAL AS WITCH INTERACTION #
###############################

everpreg_witch.2900 = {
	type = letter_event
	opening = everpreg_witch.2900.t
	desc = everpreg_witch.2900.desc
	sender = scope:actor

	immediate = {
		scope:everpreg_witch_secret = { reveal_to = root }
		hidden_effect = {
			if = {
				limit = { can_set_relation_potential_friend_trigger = { CHARACTER = scope:actor } }
				set_relation_potential_friend = scope:actor
			}
		}
	}

	option = {
		name = everpreg_witch.2900.a
		scope:actor = {
			trigger_event = {
				id = everpreg_witch.2901
				days = 3
			}
		}
	}
}

everpreg_witch.2901 = {
	type = letter_event
	opening = everpreg_witch.2901.t
	desc = everpreg_witch.2901.desc
	sender = scope:recipient

	option = {
		name = everpreg_witch.2901.a
	}
}


#########################
# WITCH RITUAL ACTIVITY #
#########################

everpreg_witch.3001 = {
	type = letter_event
	opening = everpreg_witch.3001.t
	desc = everpreg_witch.3001.desc
	sender = scope:host

	immediate = {
		scope:activity.activity_owner = { save_scope_as = host }
		debug_log = invitation_received
	}

  	#Yes!
	option = {
		name = everpreg_witch.3001.a

		play_music_cue = "mx_cue_sacredrite"
		scope:activity = {
			accept_invitation_for_character = prev
		}
		reverse_add_opinion = {
			target = scope:host
			modifier = pleased_opinion
			opinion = 10
		}
		ai_chance = {
			base = 100
			opinion_modifier = {
				opinion_target = scope:host
			}
		}
	}

	#No...
	option = {
		name = everpreg_witch.3001.b

		scope:activity = {
			decline_invitation_for_character = prev
		}
		reverse_add_opinion = {
			target = scope:host
			modifier = disappointed_opinion
			opinion = -10
		}
		ai_chance = {
			base = 10
			modifier = {
				add = 15
				target_is_liege_or_above = scope:host
			}
			ai_value_modifier = {
				ai_boldness = 0.2
			}
		}
	}
}

#No guests came
everpreg_witch.3002 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3002.t
	desc = everpreg_witch.3002.desc
	theme = witchcraft
	left_portrait = {
		character = scope:target
		animation = sadness
	}

	option = {
		name = everpreg_witch.3002.a
		
		scope:activity = {
			complete_activity = yes
		}
	}
}


#Uninvited guest
scripted_trigger everpreg_witch_3003_potential_guest_trigger = {
	NOR = {
		has_RelationToMe_relation = { CHARACTER = root }
		any_secret = {
			secret_type = secret_everpreg_witch
			is_known_by = root
		}
	}
	faith = scope:inviter.faith
	culture = { has_same_culture_heritage = scope:inviter.culture }
	is_everpreg_witch_trigger = yes
	is_female = yes
	has_trait = everpreg_1
}


everpreg_witch.3003 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3003.t
	desc = everpreg_witch.3003.desc
	theme = witchcraft
	override_background = {
		event_background = courtyard
	}
	left_portrait = scope:inviter
	right_portrait = scope:new_guest
	
	immediate = {
		hidden_effect = {
			capital_province = { save_scope_as = capital }

			#Find inviter
			scope:activity = {
				random_participant = {
					limit = {
						is_ai = yes
						NOT = { is_courtier_of = root }
					}
					alternative_limit = {
					 	is_ai = yes
					}
					alternative_limit = {
						always = yes
					}
					save_scope_as = inviter
				}
			}

			#50% chance of pool character guest, 50% chance of new guest
			random = {
				chance = 50
				random_pool_character = {
					province = capital_province
					limit = {
						everpreg_witch_3003_potential_guest_trigger = yes
						save_temporary_scope_as = potential_guest
						OR = {
							AND = {
								OR = {
									has_trait = everpreg_1
									has_trait = everpreg_2
									has_trait = everpreg_3
								}
								matching_gender_and_sexuality_trigger = { CHARACTER_1 = scope:potential_guest CHARACTER_2 = root }
							}
							has_trait = lifestyle_herbalist
						}
					}
					alternative_limit = {
						everpreg_witch_3003_potential_guest_trigger = yes
					}
					save_scope_as = new_guest
				}
			}

			if = {
				limit = { NOT = { exists = scope:new_guest } }
				create_everpreg_witch_effect = { WHO = root }
				scope:created_everpreg_witch = { save_scope_as = new_guest }
			}
			
			#Discover secret
			scope:new_guest = {
				random_secret = {
					limit = {
						secret_type = secret_everpreg_witch
						NOT = { is_known_by = root }
					}
					reveal_to = root
				}
				add_character_flag = {
					flag = grand_rite_new_guest
					days = 30
				}
			}
		}
	}

	#You are very welcome!
	option = {
		name = everpreg_witch.3003.a
		
		scope:activity = {
			hidden_effect = { invite_character_to_activity = scope:new_guest }
			accept_invitation_for_character = scope:new_guest
		}
		reverse_add_opinion = {
			target = scope:new_guest
			modifier = grateful_opinion
			opinion = 15
		}
		reverse_add_opinion = {
			target = scope:inviter
			modifier = grateful_opinion
			opinion = 15
		}
	}

	#Guest of honor!
	option = {
		name = everpreg_witch.3003.b
		
		scope:activity = {
			hidden_effect = { invite_character_to_activity = scope:new_guest }
			accept_invitation_for_character = scope:new_guest
		}
		reverse_add_opinion = {
			target = scope:new_guest
			modifier = grateful_opinion
			opinion = 30
		}
		reverse_add_opinion = {
			target = scope:inviter
			modifier = envy_opinion
			opinion = -10
		}
	}

	#Invitations only, sorry
	option = {
		name = everpreg_witch.3003.c
		
		reverse_add_opinion = {
			target = scope:new_guest
			modifier = disappointed_opinion
			opinion = -15
		}
		reverse_add_opinion = {
			target = scope:inviter
			modifier = disappointed_opinion
			opinion = -15
		}
	}
}


#Grand rite choice

scripted_effect everpreg_grand_rite_good_outcome = {
	scope:inviter ={
		add_character_modifier = {
			modifier = everpreg_witch_good_modifier
			years = 5
		}
	}
	scope:activity = {
		every_participant = {
			limit = { NOT = { this = root } }
			custom = every_grand_rite_participant
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = 20
			}
		}
	}
}

scripted_effect everpreg_grand_rite_poor_outcome = {
	scope:inviter ={
		add_character_modifier = {
			modifier = everpreg_witch_bad_modifier
			years = 5
		}
	}
	scope:activity = {
		every_participant = {
			limit = { NOT = { this = root } }
			custom = every_grand_rite_participant
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -15
			}
		}
	}
	add_stress = minor_stress_gain
}

everpreg_witch.3010 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3010.t
	desc = everpreg_witch.3010.desc
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = root

	immediate = {
		save_scope_as = host
		capital_province = { save_scope_as = background_wilderness_scope }
	}

	#Read old scroll
	option = {
		name = everpreg_witch.3010.a

		duel = {
			skill = learning
			value = average_skill_rating
			75 = {
				desc = everpreg_witch.3010.a.great
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:great_translation
				}
				show_as_tooltip = { everpreg_grand_rite_good_outcome = yes }
			}
			25 = {	
				desc = everpreg_witch.3010.a.poor
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				min = 10
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:poor_translation
				}
				show_as_tooltip = { everpreg_grand_rite_poor_outcome = yes }
			}
		}
	}

	#Use some tricks
	option = {
		name = everpreg_witch.3010.b
		
		duel = {
			skill = intrigue
			value = average_skill_rating
			75 = {
				desc = everpreg_witch.3010.b.great
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:great_tricks
				}
				show_as_tooltip = { everpreg_grand_rite_good_outcome = yes }
			}
			25 = {	
				desc = everpreg_witch.3010.b.poor
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				min = 10
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:poor_tricks
				}
				show_as_tooltip = { everpreg_grand_rite_poor_outcome = yes }
			}
		}

		stress_impact = {
			honest = minor_stress_impact_gain
		}
	}

	#Improvise
	option = {
		name = everpreg_witch.3010.c

		duel = {
			skill = diplomacy
			value = average_skill_rating
			75 = {
				desc = everpreg_witch.3010.c.great
				compare_modifier = {
					value = scope:duel_value
					multiplier = 5
				}
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:great_improvisation
				}
				show_as_tooltip = { everpreg_grand_rite_good_outcome = yes }
			}
			25 = {	
				desc = everpreg_witch.3010.c.poor
				compare_modifier = {
					value = scope:duel_value
					multiplier = -5
				}
				min = 10
				save_scope_value_as = {
					name = everpreg_grand_rite_ceremony_outcome
					value = flag:poor_improvisation
				}
				show_as_tooltip = { everpreg_grand_rite_poor_outcome = yes }
			}
		}

		stress_impact = {
			shy = minor_stress_impact_gain
		}
	}

	#Have a really nice offering
	option = {
		trigger = {
			is_ai = no
			short_term_gold >= medium_gold_value
		}
		name = everpreg_witch.3010.d
		
		remove_short_term_gold = medium_gold_value

		save_scope_value_as = {
			name = everpreg_grand_rite_ceremony_outcome
			value = flag:offering
		}

		everpreg_grand_rite_good_outcome = yes

		stress_impact = {
			greedy = minor_stress_impact_gain
		}
	}

	option = {
		trigger = {
			short_term_gold < medium_gold_value
		}
		name = everpreg_witch.3010.e
		custom_tooltip = everpreg_witch.3010.e.tt

	}

	after = {
		scope:activity = {
			every_participant = {
				trigger_event = {
					id = everpreg_witch.3014
				}
			}
		}
	}
}

#Everyone reacts to the grand rite (host and guests)
scripted_trigger everpreg_witch_3014_can_have_sex_trigger = {
	is_adult = yes
	NOR = {
		has_sexuality = asexual
		has_trait = celibate
	}
}

scripted_trigger everpreg_witch_3014_sex_partner_trigger = {
	everpreg_witch_3014_can_have_sex_trigger = yes
	NOT = { this = root }
	is_ai = yes
	save_temporary_scope_as = seduction_target
	matching_gender_and_sexuality_trigger = { CHARACTER_1 = scope:seduction_target CHARACTER_2 = root }
}

scripted_trigger everpreg_witch_3014_loved_sex_partner_trigger = {
	everpreg_witch_3014_sex_partner_trigger = yes
	OR = {
		has_relation_lover = root
		is_consort_of = root
		has_relation_soulmate = root
	}
}

scripted_trigger everpreg_witch_3014_regular_sex_partner_trigger = {
	everpreg_witch_3014_sex_partner_trigger = yes
	NOR = {
		has_relation_lover = root
		has_relation_soulmate = root
		is_consort_of = root
	}
}

scripted_effect everpreg_witch_3017_soulmate_sex_effect = {
	reverse_add_opinion = {
		target = scope:sex_partner
		modifier = love_opinion
		opinion = 20
	}
	add_stress = major_stress_loss
	had_sex_with_effect = { CHARACTER = scope:sex_partner PREGNANCY_CHANCE = 70 }
}


everpreg_witch.3014 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3010.t
	desc = {
		#host
		first_valid = {
			triggered_desc = {
				trigger = { root = scope:host }
				desc = {
 					first_valid = {
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:great_translation }
 							desc = everpreg_witch.3014.host.great_translation.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:poor_translation }
 							desc = everpreg_witch.3014.host.poor_translation.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:great_tricks }
 							desc = everpreg_witch.3014.host.great_tricks.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:poor_tricks }
 							desc = everpreg_witch.3014.host.poor_tricks.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:great_improvisation }
 							desc = everpreg_witch.3014.host.great_improvisation.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:poor_improvisation }
 							desc = everpreg_witch.3014.host.poor_improvisation.desc
 						}
 						triggered_desc = {
 							trigger = { scope:everpreg_grand_rite_ceremony_outcome = flag:offering }
 							desc = everpreg_witch.3014.host.offering.desc
 						}
 						desc = everpreg_witch.3014.host.fallback.desc
 					}
					desc = everpreg_witch.3014.host.end.desc
				}
			}
			#everyone else
			desc = {
				desc = everpreg_witch.3014.guest.start.desc
				first_valid = {
					triggered_desc = {
						trigger = {
							OR = {
								scope:everpreg_grand_rite_ceremony_outcome = flag:great_translation
								scope:everpreg_grand_rite_ceremony_outcome = flag:great_tricks
								scope:everpreg_grand_rite_ceremony_outcome = flag:great_improvisation
								scope:everpreg_grand_rite_ceremony_outcome = flag:offering
								NOT = { exists = scope:everpreg_grand_rite_ceremony_outcome }
							}
						}
						desc = everpreg_witch.3014.guest.good.desc
					}
					triggered_desc = {
						trigger = {
							OR = {
								scope:everpreg_grand_rite_ceremony_outcome = flag:poor_translation
								scope:everpreg_grand_rite_ceremony_outcome = flag:poor_tricks
								scope:everpreg_grand_rite_ceremony_outcome = flag:poor_improvisation
							}
						}
						desc = everpreg_witch.3014.guest.bad.desc
					}
					desc = everpreg_witch.3014.guest.fallback.desc
				}
				desc = everpreg_witch.3014.guest.end.desc
			}
		}
	}	
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = scope:left_portrait
	right_portrait = scope:right_portrait
	lower_left_portrait = scope:lower_left_portrait
	lower_center_portrait = scope:lower_center_portrait
	lower_right_portrait = scope:lower_right_portrait



	immediate = {
		#Tell everyone secret about everyone else
		hidden_effect = {
			scope:activity = {
				every_participant = {
					save_temporary_scope_as = learning_secret
					scope:activity = {
						every_participant = {
							random_secret = {
								limit = {
									secret_type = secret_everpreg_witch
									NOT = { is_known_by = scope:learning_secret }
								}
								reveal_to = scope:learning_secret
							}
						}
					}
				}
			}
		}

		#Give outcome to host
		if = {
			limit = { this = scope:host }

			if = {
				limit = {
					OR = {
						scope:everpreg_grand_rite_ceremony_outcome = flag:great_translation
						scope:everpreg_grand_rite_ceremony_outcome = flag:great_tricks
						scope:everpreg_grand_rite_ceremony_outcome = flag:great_improvisation
						scope:everpreg_grand_rite_ceremony_outcome = flag:offering
					}
				}
				everpreg_grand_rite_good_outcome = yes
			}
			else = {
				everpreg_grand_rite_poor_outcome = yes
			}
		}


		###What is available to do?###
		scope:activity = {
			#Talk to new guest
			if = {
				limit = { root = scope:host }
				scope:activity = {
					random_participant = {
						limit = { has_character_flag = grand_rite_new_guest }
						save_scope_as = new_guest
					}
				}
			}

			#Herbalism
			random_participant = {
				limit = {
					has_trait = lifestyle_herbalist
					NOR = {
						trigger_if = {
							limit = { exists = scope:new_guest }
							this = scope:new_guest
						}
						this = root
					}
				}
				save_scope_as = herbalist
			}

			#Teacher (experience )
			random_participant = {
				limit = {
					NOR = {
						trigger_if = {
							limit = { exists = scope:new_guest }
							this = scope:new_guest
						}
						trigger_if = {
							limit = { exists = scope:herbalist }
							this = scope:herbalist
						}
						this = root
					}
					trigger_if = {
						limit = { highest_skill = diplomacy }
						root = { diplomacy_lifestyle_perk_points < max_perk_amount_per_lifestyle }
					}
					trigger_else_if = {
						limit = { highest_skill = martial }
						root = { martial_lifestyle_perk_points < max_perk_amount_per_lifestyle }
					}
					trigger_else_if = {
						limit = { highest_skill = stewardship }
						root = { stewardship_lifestyle_perk_points < max_perk_amount_per_lifestyle }
					}
					trigger_else_if = {
						limit = { highest_skill = intrigue }
						root = { intrigue_lifestyle_perk_points < max_perk_amount_per_lifestyle }
					}
					trigger_else_if = {
						limit = { highest_skill = learning }
						root = { learning_lifestyle_perk_points < max_perk_amount_per_lifestyle }
					}
					trigger_else = {
						always = no
					}
				}
				weight = {
					base = 0
					modifier = {
						add = {
							if = {
								limit = { highest_skill = diplomacy }
								add = diplomacy
							}
							else_if = {
								limit = { highest_skill = martial }
								add = martial
							}
							else_if = {
								limit = { highest_skill = stewardship }
								add = stewardship
							}
							else_if = {
								limit = { highest_skill = intrigue }
								add = intrigue
							}
							else_if = {
								limit = { highest_skill = learning }
								add = learning
							}
						}
					}
				}
				save_scope_as = teacher
			}

			#Someone to seduce
			if = {
				limit = {
					root = {
						everpreg_witch_3014_can_have_sex_trigger = yes
					}
				}
				#If you have a soulmate here, only sleep with them (not available if they can't sleep with you for some reason)
				if = {
					limit = { any_participant = { has_relation_soulmate = root } }
					random_participant = {
						limit = {
							everpreg_witch_3014_loved_sex_partner_trigger = yes
							has_relation_soulmate = root
						}
						save_scope_as = sex_partner
					}
				}
				else = {
					random_list = {
						#Just someone regular
						1 = {
							trigger = {
								any_participant = {
									everpreg_witch_3014_regular_sex_partner_trigger = yes
									accepts_incest_with_trigger = { CHARACTER = root } #Skip this one if there's only non-accepting incest options available
								}
							}
							random_participant = {
								limit = {
									everpreg_witch_3014_regular_sex_partner_trigger = yes
									save_temporary_scope_as = sex_partner_check #Saved for weight modifier
								}
								weight = {
									base = 10
									modifier = {
										has_trait = seducer
										add = 10
									}
									modifier = {
										has_trait = lustful
										add = 10
									}
									modifier = {
										has_trait = beauty_good
										add = 10
									}
									modifier = {
										has_relation_potential_lover = root
										add = 10
									}
									incest_acceptance_modifier = {
										TARGET = scope:sex_partner_check
										SEDUCER = root
									}
								}
								save_scope_as = sex_partner
							}
						}
						1 = {
							trigger = {
								any_participant = {
									everpreg_witch_3014_loved_sex_partner_trigger = yes
								}
							}
							random_participant = {
								limit = {
									everpreg_witch_3014_loved_sex_partner_trigger = yes
								}
								weight = {
									base = 1
									modifier = {
										is_spouse_of = root
										add = 2
									}
								}
								save_scope_as = sex_partner
							}
						}
					}
				}		
			}

			#Set portraits
			if = {
				limit = {
					exists = scope:herbalist
					exists = scope:teacher
					exists = scope:new_guest
				}
				scope:herbalist = { save_scope_as = lower_left_portrait }
				scope:teacher = { save_scope_as = lower_center_portrait }
				scope:new_guest = { save_scope_as = lower_right_portrait }
			}
			else_if = {
				limit = {
					exists = scope:herbalist
					exists = scope:teacher
				}
				scope:herbalist = { save_scope_as = left_portrait }
				scope:teacher = { save_scope_as = right_portrait }
			}
			else_if = {
				limit = {
					exists = scope:herbalist
					exists = scope:new_guest
				}
				scope:herbalist = { save_scope_as = left_portrait }
				scope:new_guest = { save_scope_as = right_portrait }
			}
			else_if = {
				limit = {
					exists = scope:teacher
					exists = scope:new_guest
				}
				scope:teacher = { save_scope_as = left_portrait }
				scope:new_guest = { save_scope_as = right_portrait }
			}
			else_if = {
				limit = { exists = scope:herbalist }
				scope:herbalist = { save_scope_as = left_portrait }
			}
			else_if = {
				limit = { exists = scope:teacher }
				scope:teacher = { save_scope_as = left_portrait }
			}
			else_if = {
				limit = { exists = scope:new_guest }
				scope:new_guest = { save_scope_as = left_portrait }
			}
			else = {
				save_scope_as = left_portrait
			}
		}
	}

	###WHAT DO I WANT TO DO?###

	#Herbalism
	option = {
		trigger = {
			exists = scope:herbalist
		}
		name = everpreg_witch.3014.a
		highlight_portrait = scope:herbalist
		
		if = {
			limit = { NOT = { has_trait = lifestyle_herbalist } }
			random_list = {
				40 = {
					desc = everpreg_witch.3014.a.knowledge
					send_interface_toast = {
						title = everpreg_witch.3014.a.knowledge
						left_icon = scope:herbalist
					if = {
						limit = {
							faith = {
								has_doctrine_parameter = tenet_everpreg_holywomb
							}
							NOR = { 
								has_trait = everpreg_1
								has_trait = everpreg_2
								has_trait = everpreg_3			
								is_female = no
							}				
							
						}
						random = {
							chance = 35
							modifier = {
								add = 25
								has_trait_rank = {
									trait = education_diplomacy
									rank > 1
								}
							}
							modifier = {
								add = 50
								has_council_position = councillor_court_chaplain
							}							
							modifier = {
								add = 35
								has_trait_rank = {
									trait = education_diplomacy
									rank > 2
								}
							}
							modifier = {
								add = 50
								has_trait_rank = {
									trait = education_diplomacy
									rank > 3
								}
							}
							modifier = {
								add = 50
								has_trait = everpreg_saoshyant_descendant	
							}							
							
							add_trait = everpreg_1
						}
					}

					else_if = {
						limit = {
							faith = {
								has_doctrine_parameter = tenet_everpreg_holywomb
							}
								has_trait = everpreg_1						
						}
						random = {
							chance = 35
							modifier = {
								add = 10
								has_trait_rank = {
									trait = education_diplomacy
									rank > 1
								}
							}
							modifier = {
								add = 20
								has_trait_rank = {
									trait = education_diplomacy
									rank > 2
								}
							}
							modifier = {
								add = 30
								has_trait_rank = {
									trait = education_diplomacy
									rank > 3
								}
							}
							modifier = {
								add = 40
								has_trait = everpreg_saoshyant_descendant	
							}								

							remove_trait = everpreg_1
							add_trait = everpreg_2
						}
					}

					else_if = {
							limit = {
								faith = {
									has_doctrine_parameter = tenet_everpreg_holywomb
								}
									has_trait = everpreg_2						
							}
							random = {
								chance = 20
								modifier = {
									add = 5
									has_trait_rank = {
										trait = education_diplomacy
										rank > 1
									}
								}
								modifier = {
									add = 10
									has_trait_rank = {
										trait = education_diplomacy
										rank > 2
									}
								}
								modifier = {
									add = 15
									has_trait_rank = {
										trait = education_diplomacy
										rank > 3
									}
								}
								modifier = {
									add = 30
									has_trait = everpreg_saoshyant_descendant	
								}									

								remove_trait = everpreg_2								
								add_trait = everpreg_3
							}			
					}
					}
				}
				60 = {
					desc = everpreg_witch.3014.a.inspiration
					send_interface_toast = {
						title = everpreg_witch.3014.a.inspiration
						left_icon = scope:herbalist
						add_character_modifier = {
							modifier = seeker_of_knowledge
							years = 5
						}
					}
				}
			}
		}
		else = {
			add_character_modifier = {
				modifier = seeker_of_knowledge
				years = 5
			}
		}

		stress_impact = {
			lazy = minor_stress_impact_gain
		}
	}

	#Teacher gives you lifestyle perk point
	option = {
		trigger = { exists = scope:teacher }
		name = {
			text = {
				desc = everpreg_witch.3014.b.start
				first_valid = {
					triggered_desc = {
						trigger = { scope:teacher = { highest_skill = diplomacy } }
						desc = everpreg_witch.3014.b.diplomacy
					}
					triggered_desc = {
						trigger = { scope:teacher = { highest_skill = martial } }
						desc = everpreg_witch.3014.b.martial
					}
					triggered_desc = {
						trigger = { scope:teacher = { highest_skill = stewardship } }
						desc = everpreg_witch.3014.b.stewardship
					}
					triggered_desc = {
						trigger = { scope:teacher = { highest_skill = intrigue } }
						desc = everpreg_witch.3014.b.intrigue
					}
					triggered_desc = {
						trigger = { scope:teacher = { highest_skill = learning } }
						desc = everpreg_witch.3014.b.learning
					}
				}
			}
		}
		highlight_portrait = scope:teacher

		if = {
			limit = { scope:teacher = { highest_skill = diplomacy } }
			add_diplomacy_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { scope:teacher = { highest_skill = martial } }
			add_martial_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { scope:teacher = { highest_skill = stewardship } }
			add_stewardship_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { scope:teacher = { highest_skill = intrigue } }
			add_intrigue_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { scope:teacher = { highest_skill = learning } }
			add_learning_lifestyle_perk_points = 1
		}

		stress_impact = {
			lazy = minor_stress_impact_gain
		}
	}
	
	#Seducer (sneak away)
	option = {
		trigger = {
			exists = scope:sex_partner
			NOT = { has_relation_soulmate = scope:sex_partner }
		}
		name = everpreg_witch.3014.c
		custom_tooltip = everpreg_witch.3014.c.tt

		if = {
			limit = { scope:sex_partner = { everpreg_witch_3014_loved_sex_partner_trigger = yes } }
			trigger_event = {
				id = everpreg_witch.3016
				days = 1
			}
		}
		else = {
			trigger_event = {
				id = everpreg_witch.3015
				days = 1
			}
		}

		stress_impact = {
			chaste = medium_stress_impact_gain
			shy = minor_stress_impact_gain
			rakish = minor_stress_impact_loss
		}
	}

	#Seducer (soulmate)
	option = {
		trigger = {
			exists = scope:sex_partner
			has_relation_soulmate = scope:sex_partner
		}
		name = everpreg_witch.3014.e
		highlight_portrait = scope:sex_partner
		
		trigger_event = {
			id = everpreg_witch.3017
			days = 1
		}
		show_as_tooltip = { everpreg_witch_3017_soulmate_sex_effect = yes }
	}

	#Talk with new guest
	option = {
		trigger = { exists = scope:new_guest }
		name = everpreg_witch.3014.d
		highlight_portrait = scope:new_guest

		random_list = {
			35 = { #Becomes friend and joins court
				desc = everpreg_witch.3014.d.move_in
				compatibility_modifier = {
					who = root
					compatibility_target = scope:new_guest
					multiplier = 3
					max = 50
					min = -30
				}
				send_interface_toast = {
					title = everpreg_witch.3014.d.move_in
					left_icon = scope:new_guest
					set_relation_friend = scope:new_guest
					add_courtier = scope:new_guest
				}
			}
			50 = { #Becomes friend
				desc = everpreg_witch.3014.d.friend
				compatibility_modifier = {
					who = root
					compatibility_target = scope:new_guest
					multiplier = 2
					max = 35
					min = -35
				}
				send_interface_toast = {
					title = everpreg_witch.3014.d.friend
					left_icon = scope:new_guest
					set_relation_friend = scope:new_guest
				}
			}
			15 = {
				desc = everpreg_witch.3014.d.enemy
				compatibility_modifier = {
					who = root
					compatibility_target = scope:new_guest
					multiplier = -3
					max = 60
					min = -9
				}
				modifier = {
					OR = {
						has_trait = vengeful
						has_trait = callous
						has_trait = sadistic
						has_trait = wrathful
					}
					add = 15
				}
				send_interface_toast = {
					title = everpreg_witch.3014.d.enemy
					left_icon = scope:new_guest
					set_relation_rival = scope:new_guest
				}
			}
		}

		stress_impact = {
			shy = minor_stress_impact_gain
		}
	}

	#Relax and indulge
	option = {
		trigger = {
			calc_true_if = {
				amount <= 3
				exists = scope:herbalist
				exists = scope:teacher
				exists = scope:sex_partner
				exists = scope:new_guest
			}
		}
		name = everpreg_witch.3014.f

		stress_impact = {
			base = major_stress_loss
			gregarious = minor_stress_impact_loss
			drunkard = minor_stress_impact_loss
			hashishiyah = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
		}
	}
}	


#Sleep with someone (regular)
everpreg_witch.3015 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3015.t
	desc = {
		desc = everpreg_witch.3015.start.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:sex_partner = scope:new_guest }
				desc = everpreg_witch.3015.new_guest.desc
			}
			desc = everpreg_witch.3015.regular.desc
		}
		desc = everpreg_witch.3015.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = {
		character = scope:sex_partner
		animation = flirtation
	}

	#Yes
	option = {
		name = everpreg_witch.3015.a

		progress_towards_lover_effect = {
			CHARACTER = scope:sex_partner
			OPINION = 15
		}
		had_sex_with_effect = { CHARACTER = scope:sex_partner PREGNANCY_CHANCE = 50 }
	}

	#No
	option = {
		name = everpreg_witch.3015.b
		custom_tooltip = everpreg_witch.3015.b.tt

		reverse_add_opinion = {
			target = scope:sex_partner
			modifier = disappointed_opinion
			opinion = -15
		}
	}
}

#Sleep with someone (spouse/lover -> soulmate)
everpreg_witch.3016 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3016.t
	desc = {
		desc = everpreg_witch.3015.start.desc
		desc = everpreg_witch.3016.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = {
		character = scope:sex_partner
		animation = love
	}
	
	#Yes
	option = {
		name = everpreg_witch.3016.a

		set_relation_soulmate = scope:sex_partner
		had_sex_with_effect = { CHARACTER = scope:sex_partner PREGNANCY_CHANCE = 50 }
	}

	#No
	option = {
		name = everpreg_witch.3016.b
		custom_tooltip = everpreg_witch.3015.b.tt

		reverse_add_opinion = {
			target = scope:sex_partner
			modifier = disappointed_opinion
			opinion = -15
		}
	}
}


#Sleep with someone (soulmate)
everpreg_witch.3017 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3016.t
	desc = {
		desc = everpreg_witch.3015.start.desc
		desc = everpreg_witch.3017.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = {
		character = scope:sex_partner
		animation = love
	}
	
	#Yes
	option = {
		name = everpreg_witch.3017.a
		everpreg_witch_3017_soulmate_sex_effect = yes
	}

	#No
	option = {
		name = everpreg_witch.3017.b
		custom_tooltip = everpreg_witch.3015.b.tt

		reverse_add_opinion = {
			target = scope:sex_partner
			modifier = disappointed_opinion
			opinion = -15
		}
	}
}


###Grand rite end events##

#End for host
everpreg_witch.3098 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3098.t
	desc = {
		desc = everpreg_witch.3098.start.desc
		desc = everpreg_witch.3098.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = root

	trigger = { exists = scope:activity }

	immediate = {
		capital_province = { save_scope_as = background_wilderness_scope }
	}
	
	option = {
		name = everpreg_witch.3098.a

		scope:activity = {
			every_participant = {
				limit = { NOT = { this = root } }
				trigger_event = everpreg_witch.3099
			}
			complete_activity = yes
		}
	}
}

#End for guest
everpreg_witch.3099 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.3098.t
	desc = {
		desc = everpreg_witch.3099.start.desc
		desc = everpreg_witch.3098.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness_scope
	}
	left_portrait = root
	
	option = {
		name = everpreg_witch.3098.a
		custom_tooltip = everpreg_witch.3099.tt
	}
}



########################
# WITCH ONGOING EVENTS #
########################

### Court chaplain / other clergy is an idiot ###

scripted_trigger everpreg_witch_4001_annoying_clergy_trigger = {
	OR = {
		has_council_position = councillor_court_chaplain
		is_clergy = yes
	}
	NOT = {
		faith = { has_doctrine_parameter = tenet_everpreg_holywomb }
	}
	ai_zeal >= medium_negative_ai_value
	NOR = {
		is_close_family_of = root
		has_relation_friend = root
		has_relation_lover = root
		opinion = {
			target = root
			value >= medium_positive_opinion
		}
		any_secret = {
			secret_type = secret_non_believer
		}
	}
	is_ai = yes
	faith = root.faith
}

scripted_effect everpreg_witch_4001_prank_success_effect = {
	add_character_modifier = {
		modifier = trickster_modifier
		years = 10
	}
	stress_impact = {
		base = medium_stress_impact_loss
		compassionate = minor_stress_impact_gain
		honest = minor_stress_impact_gain
		forgiving = minor_stress_impact_gain
		vengeful = minor_stress_impact_loss
		sadistic = medium_stress_impact_loss
		deceitful = minor_stress_impact_loss
	}
	scope:annoying_clergy = {
		add_prestige = medium_prestige_loss
	}
}

scripted_effect everpreg_witch_4001_corruption_success_effect = {
	scope:annoying_clergy = {
		add_secret = {
			type = secret_non_believer
		}
		random_secret = {
			limit = { secret_type = secret_non_believer }
			reveal_to = root
		}
		custom_tooltip = everpreg_witch_4001_corruption_success_effect.tt
	}
}

scripted_trigger everpreg_witch_4001_desc_valid_sin_trigger = {
	faith = { trait_is_sin = $TRAIT$ }
	NOT = { scope:annoying_clergy = { has_trait = $TRAIT$ } }
}

scripted_trigger everpreg_witch_4001_desc_prefered_sin_trigger = {
	everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = $TRAIT$ }
	has_trait = $TRAIT$
}

scripted_trigger everpreg_witch_4001_zeal_condition_trigger = {
	OR = {
		ai_zeal <= high_negative_zeal
		AND = {
			num_sinful_traits >= 1		
			ai_zeal < 0
		}
	}
}

scripted_trigger everpreg_witch_4001_event_available_trigger = {
	NOT = { has_character_flag = event_cooldown_everpreg_witch_4001 }
	OR = {
		trigger_if = {
			limit = { exists = cp:councillor_court_chaplain }
			cp:councillor_court_chaplain = { everpreg_witch_4001_annoying_clergy_trigger = yes }
		}
		any_vassal = {
			everpreg_witch_4001_annoying_clergy_trigger = yes
		}	
	}
}

everpreg_witch.4000 = { #Pre-event to ensure everpreg_witch if sent through trait-specific on-action
	hidden = yes

	trigger = {
		is_everpreg_witch_trigger = yes
		everpreg_witch_4001_event_available_trigger = yes
	}

	immediate = {
		trigger_event = everpreg_witch.4001
	}
}

everpreg_witch.4001 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4001.t
	desc = {
		desc = everpreg_witch.4001.start.desc
		#Pick a sin
		first_valid = {
			#A sin that root has
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = forgiving } }
				desc = everpreg_witch.4001.forgiving.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = deceitful } }
				desc = everpreg_witch.4001.deceitful.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = gluttonous } }
				desc = everpreg_witch.4001.gluttonous.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = wrathful } }
				desc = everpreg_witch.4001.wrathful.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = greedy } }
				desc = everpreg_witch.4001.greedy.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = arbitrary } }
				desc = everpreg_witch.4001.arbitrary.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = sadistic }
						everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = callous }
					}
				}
				desc = everpreg_witch.4001.sadistic.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = craven } }
				desc = everpreg_witch.4001.craven.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = lustful } }
				desc = everpreg_witch.4001.lustful.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = vengeful } }
				desc = everpreg_witch.4001.vengeful.desc
			}
			triggered_desc = {
				trigger = { everpreg_witch_4001_desc_prefered_sin_trigger = { TRAIT = arrogant } }
				desc = everpreg_witch.4001.arrogant.desc
			}
			#A sin that root doesn't have
			random_valid = {
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = forgiving } }
					desc = everpreg_witch.4001.forgiving.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = deceitful } }
					desc = everpreg_witch.4001.deceitful.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = gluttonous } }
					desc = everpreg_witch.4001.gluttonous.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = wrathful } }
					desc = everpreg_witch.4001.wrathful.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = greedy } }
					desc = everpreg_witch.4001.greedy.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = arbitrary } }
					desc = everpreg_witch.4001.arbitrary.desc
				}
				triggered_desc = {
					trigger = {
						OR = {
							everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = sadistic }
							everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = callous }
						}
					}
					desc = everpreg_witch.4001.sadistic.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = craven } }
					desc = everpreg_witch.4001.craven.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = lustful } }
					desc = everpreg_witch.4001.lustful.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = vengeful } }
					desc = everpreg_witch.4001.vengeful.desc
				}
				triggered_desc = {
					trigger = { everpreg_witch_4001_desc_valid_sin_trigger = { TRAIT = arrogant } }
					desc = everpreg_witch.4001.arrogant.desc
				}
			}
			desc = everpreg_witch.4001.fallback.desc
		}
		first_valid = {
			triggered_desc = {
				trigger = { is_everpreg_witch_trigger = yes }
				desc = everpreg_witch.4001.everpreg_witch.desc
			}
			desc = everpreg_witch.4001.impious.desc
		}
	}
	theme = faith
	override_icon = {
		trigger = { is_everpreg_witch_trigger = yes }
		reference = "gfx/interface/icons/event_types/type_medicine.dds"
	}
	left_portrait = scope:annoying_clergy
	
	trigger = {
		OR = {
			everpreg_witch_4001_zeal_condition_trigger = yes
			is_everpreg_witch_trigger = yes
		}
		everpreg_witch_4001_event_available_trigger = yes
	}

	weight_multiplier = {
		base = 0.2
		modifier = {
			is_everpreg_witch_trigger = yes
			add = 0.8
		}
		modifier = {
			num_sinful_traits >= 1	
			add = 0.4
		}
	}

	immediate = {
		add_character_flag = event_cooldown_everpreg_witch_4001
		if = {
			limit = {
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = { everpreg_witch_4001_annoying_clergy_trigger = yes }
			}
			cp:councillor_court_chaplain = { add_to_list = annoying_clergy_list }
		}
		every_vassal = {
			limit = {
				NOT = { is_in_list = annoying_clergy_list }
				everpreg_witch_4001_annoying_clergy_trigger = yes
			}
			add_to_list = annoying_clergy_list
		}

		random_in_list = {
			list = annoying_clergy_list
			weight = {
				base = 30
				modifier = {
					OR = {
						is_councillor = yes
						is_powerful_vassal = yes
					}
					add = 150
				}
				opinion_modifier = {
					opinion_target = root
					multiplier = -1
					min = -25
				}
				modifier = {
					add = {
						value = ai_zeal
						divide = 2
					}
				}
			}
			save_scope_as = annoying_clergy
		}

		capital_province = { save_scope_as = capital }
	}

	#Make a fool of them
	option = {
		name = everpreg_witch.4001.a
		flavor = everpreg_witch.4001.a.tt
		
		duel = {
			skill = intrigue
			target = scope:annoying_clergy
			desc = outcome_in_a_few_days

			60 = {
				desc = everpreg_witch.4001.a.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				show_as_tooltip = { everpreg_witch_4001_prank_success_effect = yes }
				trigger_event = {
					id = everpreg_witch.4002
					days = 3
				}
			}
			40 = {
				desc = everpreg_witch.4001.a.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
				}
				send_interface_toast = {
					title = everpreg_witch.4001.a.failure
					left_icon = scope:annoying_clergy
					reverse_add_opinion = {
						target = scope:annoying_clergy
						modifier = angry_opinion
						opinion = -10
					}
				}
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
			craven = minor_stress_impact_gain
		}

	}

	#Impress them
	option = {
		name = everpreg_witch.4001.c

		reverse_add_opinion = {
			target = scope:annoying_clergy
			modifier = pious_opinion
			opinion = 20
		}
		add_piety = minor_piety_gain

		stress_impact = {
			honest = minor_stress_impact_gain
			cynical = minor_stress_impact_gain
		}
	}

	#Turn them around
	option = {
		name = everpreg_witch.4001.b

		duel = {
			desc = outcome_in_a_few_weeks
			skill = learning
			target = scope:annoying_clergy

			30 = {
				desc = everpreg_witch.4001.b.success
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3
				}
				show_as_tooltip = { everpreg_witch_4001_corruption_success_effect = yes }

				trigger_event = {
					id = everpreg_witch.4003
					days = { 7 14 }
				}
			}
			20 = {
				desc = everpreg_witch.4001.b.neutral
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				custom_tooltip = everpreg_witch.4001.b.neutral.tt
				trigger_event = {
					id = everpreg_witch.4004
					days = { 7 14 }
				}
			}
			50 = {
				desc = everpreg_witch.4001.b.failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3
				}
				trigger_event = {
					id = everpreg_witch.4005
					days = { 7 14 }
				}
				modifier = {
					add = {
						value = scope:annoying_clergy.ai_zeal
						divide = 2
					}
				}
			}
		}
	}
}


#You made a fool out of them!
everpreg_witch.4002 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { is_everpreg_witch_trigger = yes }
				desc = everpreg_witch.4002.everpreg_witch.desc
			}
			desc = everpreg_witch.4002.impious.desc
		}
		first_valid = {
			#A sin
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = gluttonous }
					NOT = { scope:annoying_clergy = { has_trait = temperate } }
				}
				desc = everpreg_witch.4002.gluttonous.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						faith = { trait_is_sin = wrathful }
						faith = { trait_is_sin = drunkard }
					}
				}
				desc = everpreg_witch.4002.wrathful.desc
			}
			triggered_desc = {
				trigger = {
					OR = {
						faith = { trait_is_sin = sadistic }
						faith = { trait_is_sin = callous }
						faith = { trait_is_sin = vengeful }
					}
					NOR = {
						NOT = { scope:annoying_clergy = { has_trait = compassionate } }
						NOT = { scope:annoying_clergy = { has_trait = forgiving } }
					}
					exists = scope:vengeful_desc
				}
				desc = everpreg_witch.4002.vengeful.desc
			}
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = craven }
					NOT = { scope:annoying_clergy = { has_trait = brave } }
				}
				desc = everpreg_witch.4002.craven.desc
			}
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = lustful }
					exists = scope:lustful_desc
				}
				desc = everpreg_witch.4002.lustful.desc
			}
			triggered_desc = {
				trigger = {
					faith = { trait_is_sin = arrogant }
					NOT = { scope:annoying_clergy = { has_trait = humble } }
				}
				desc = everpreg_witch.4002.arrogant.desc
			}
			#Not sins but it still looks bad
			random_valid = {	
				triggered_desc = {
					trigger = { NOT = { scope:annoying_clergy = { has_trait = temperate } } }
					desc = everpreg_witch.4002.gluttonous.desc
				}
				triggered_desc = {
					trigger = { exists = scope:lustful_desc }
					desc = everpreg_witch.4002.lustful.desc
				}
				triggered_desc = {
					trigger = {
						NOR = {
							NOT = { scope:annoying_clergy = { has_trait = compassionate } }
							NOT = { scope:annoying_clergy = { has_trait = forgiving } }
						}
						exists = scope:vengeful_desc
					}
				}
				triggered_desc = {
					trigger = { NOT = { scope:annoying_clergy = { has_trait = humble } } }
					desc = everpreg_witch.4002.arrogant.desc
				}
				desc = everpreg_witch.4002.wrathful.desc
			}

		}
		desc = everpreg_witch.4002.end.desc
	}
	theme = faith
	override_icon = {
		trigger = { is_everpreg_witch_trigger = yes }
		reference = "gfx/interface/icons/event_types/type_medicine.dds"
	}
	left_portrait = scope:annoying_clergy
	
	trigger = {
		exists = scope:annoying_clergy
	}

	immediate = {
		everpreg_witch_4001_prank_success_effect = yes
		if = {
			limit = { is_ai = no } #This is just for text
			random_courtier = {
				limit = {
					is_adult = yes
					NOR = {
						this = root
						this = scope:annoying_clergy
						is_consort_of = scope:annoying_clergy
						has_relation_lover = scope:annoying_clergy
					}
					scope:annoying_clergy = { is_attracted_to_gender_of = prev }
				}
				save_scope_as = lustful_desc
			}
			random_courtier = {
				limit = {
					is_adult = yes
					NOR = {
						this = root
						this = scope:annoying_clergy
					}
				}
				save_scope_as = vengeful_desc
			}
			scope:annoying_clergy = {
				romance_target_gender_effect = { SCOPE_NAME = wrathful_desc }
			}
		}
	}

	option = {
		name = everpreg_witch.4002.a

	}
}


#You corrupted them!
everpreg_witch.4003 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4001.t
	desc = everpreg_witch.4003.desc
	theme = faith
	override_icon = {
		trigger = { is_everpreg_witch_trigger = yes }
		reference = "gfx/interface/icons/event_types/type_medicine.dds"
	}
	left_portrait = scope:annoying_clergy
	
	trigger = {
		exists = scope:annoying_clergy
	}

	immediate = {
		everpreg_witch_4001_corruption_success_effect = yes

		if = {
			limit = {
				is_everpreg_witch_trigger = yes
				NOT = { scope:annoying_clergy = { is_everpreg_witch_trigger = yes } }
			}
			random = {
				chance = 30
				save_scope_value_as = {
					name = everpreg_witch_options
					value = yes
				}
			}
		}
	}

	#Great!
	option = {
		name = everpreg_witch.4003.a

	}

	#Yes, make them a everpreg_witch!
	option = {
		trigger = { exists = scope:everpreg_witch_options }
		name = everpreg_witch.4003.b
		trait = everpreg_witch

		scope:annoying_clergy = {
			give_everpreg_witch_secret_or_trait_effect = yes
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = root
			}
		}
	}


	#Yes, make them a everpreg_witch and tell them about me!
	option = {
		trigger = {
			exists = scope:everpreg_witch_options
			any_secret = {
				secret_type = secret_everpreg_witch
				NOT = { is_known_by = scope:annoying_clergy }
			}
		}
		name = everpreg_witch.4003.c
		trait = everpreg_witch

		scope:annoying_clergy = {
			give_everpreg_witch_secret_or_trait_effect = yes
			random_secret = {
				limit = { secret_type = secret_everpreg_witch }
				reveal_to = root
			}
		}

		random_secret = {
			limit = { secret_type = secret_everpreg_witch }
			reveal_to = scope:annoying_clergy
		}

		reverse_add_opinion = {
			modifier = respect_opinion
			opinion = 20
			target = scope:annoying_clergy
		}
	}
}

#You're nearly there...
everpreg_witch.4004 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4001.t
	desc = everpreg_witch.4004.desc
	theme = faith
	override_icon = {
		trigger = { is_everpreg_witch_trigger = yes }
		reference = "gfx/interface/icons/event_types/type_medicine.dds"
	}
	left_portrait = scope:annoying_clergy
	
	trigger = {
		exists = scope:annoying_clergy
	}

	#Keep trying!
	option = {
		name = everpreg_witch.4004.a

		stress_impact = {
			base = major_stress_impact_gain
			diligent = medium_stress_impact_loss
			lazy = minor_stress_impact_gain
		}

		random_list = {
			desc = outcome_in_a_few_days
			85 = {
				desc = everpreg_witch.4001.b.success
				show_as_tooltip = {
					everpreg_witch_4001_corruption_success_effect = yes
				}
				trigger_event = {
					id = everpreg_witch.4003
					days = 3
				}
			}
			15 = {
				desc = everpreg_witch.4001.b.failure
				trigger_event = {
					id = everpreg_witch.4005
					days = 3
				}
			}
		}


		ai_chance = {
			base = 50
		}
	}

	#Give up
	option = {
		name = everpreg_witch.4004.b

		ai_chance = {
			base = 50
		}
	}
}

#Corruption failed
everpreg_witch.4005 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4001.t
	desc = everpreg_witch.4005.desc
	theme = faith
	override_icon = {
		trigger = { is_everpreg_witch_trigger = yes }
		reference = "gfx/interface/icons/event_types/type_medicine.dds"
	}
	left_portrait = scope:annoying_clergy
	
	trigger = {
		exists = scope:annoying_clergy
	}

	option = {
		name = everpreg_witch.4005.a
	}
}


### PERSONAL WITCH RITUAL ###

scripted_effect everpreg_witch_4010_option_effect = {
	random_list = {
		#DIPLOMACY
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_diplomat
					has_character_modifier = confident_diplomat
				}
			}
			modifier = {
				has_lifestyle = diplomacy_lifestyle
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = diplomacy
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_diplomat
				value = yes
			}
		}

		#MARTIAL
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_strategist
					has_character_modifier = confident_strategist
				}
			}
			modifier = {
				has_lifestyle = martial_lifestyle
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = martial
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_strategist
				value = yes
			}
		}

		#STEWARDSHIP
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_organizer
					has_character_modifier = confident_organizer
				}
			}
			modifier = {
				has_lifestyle = stewardship_lifestyle
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = stewardship
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_organizer
				value = yes
			}
		}

		#INTRIGUE
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_schemer
					has_character_modifier = confident_schemer
				}
			}
			modifier = {
				has_lifestyle = intrigue_lifestyle
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = intrigue
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_schemer
				value = yes
			}
		}

		#LEARNING
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_scholar
					has_character_modifier = confident_scholar
				}
			}
			modifier = {
				has_lifestyle = learning_lifestyle
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = learning
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_scholar
				value = yes
			}
		}

		#PROWESS
		10 = {
			trigger = {
				NOR = {
					exists = scope:confident_duelist
					has_character_modifier = confident_duelist
				}
			}
			modifier = {
				has_focus = martial_chivalry_focus
				add = 30
			}
			modifier = {
				add = {	
					value = extremely_high_skill_rating
					subtract = prowess
					multiply = 2
				}
			}
			save_scope_value_as = {
				name = confident_duelist
				value = yes
			}
		}

		#ATTRACTION
		20 = {
			trigger = {
				NOR = {
					exists = scope:alluring_confidence
					has_character_modifier = alluring_confidence
				}
			}
			modifier = {
				OR = {
					has_trait = lustful
					ai_sociability >= low_positive_ai_value
					has_focus = intrigue_temptation_focus
				}
				add = 50
			}
			save_scope_value_as = {
				name = alluring_confidence
				value = yes
			}
		}

		#RELAXATION
		20 = {
			trigger = {
				stress >= low_stress
				NOT = { exists = scope:stress }
			}
			modifier = {
				add = {
					value = stress
					divide = extremely_high_stress
					multiply = 80
				}
			}
			save_scope_value_as = {
				name = stress
				value = yes
			}
		}
	}
}


everpreg_witch.4010 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4010.t
	desc = everpreg_witch.4010.desc
	theme = witchcraft
	override_background = {
		event_background = wilderness
	}
	left_portrait = root
	
	trigger = {
		NOT = { has_character_flag = event_cooldown_everpreg_witch_4010 }
		is_everpreg_witch_trigger = yes
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = {
			flag = event_cooldown_everpreg_witch_4010
			days = 1825
		}

		#3 options
		everpreg_witch_4010_option_effect = yes
		everpreg_witch_4010_option_effect = yes
		everpreg_witch_4010_option_effect = yes	
	}

	#Ask for love
	option = {
		trigger = { exists = scope:alluring_confidence }
		name = everpreg_witch.4010.a

		add_character_modifier = {
			modifier = alluring_confidence
			years = 10
		}
	}

	#Ask for diplomacy
	option = {
		trigger = { exists = scope:confident_diplomat }
		name = everpreg_witch.4010.b

		add_character_modifier = {
			modifier = confident_diplomat
			years = 10
		}
	}

	#Ask for martial
	option = {
		trigger = { exists = scope:confident_strategist }
		name = everpreg_witch.4010.c

		add_character_modifier = {
			modifier = confident_strategist
			years = 10
		}
	}

	#Ask for stewardship
	option = {
		trigger = { exists = scope:confident_organizer }
		name = everpreg_witch.4010.d

		add_character_modifier = {
			modifier = confident_organizer
			years = 10
		}
	}

	#Ask for intrigue
	option = {
		trigger = { exists = scope:confident_schemer }
		name = everpreg_witch.4010.e

		add_character_modifier = {
			modifier = confident_schemer
			years = 10
		}
	}

	#Ask for learning
	option = {
		trigger = { exists = scope:confident_scholar }
		name = everpreg_witch.4010.f

		add_character_modifier = {
			modifier = confident_scholar
			years = 10
		}
	}

	#Ask for prowess
	option = {
		trigger = { exists = scope:confident_duelist }
		name = everpreg_witch.4010.g

		add_character_modifier = {
			modifier = confident_duelist
			years = 10
		}
	}
	
	#Ask for relaxation
	option = {
		trigger = { exists = scope:stress }
		name = everpreg_witch.4010.h
		
		add_stress = monumental_stress_loss
	}
}


########################
# WITCH FRIEND: PRAYER #
########################

scripted_trigger everpreg_witch_4020_prayer_friend_trigger = {
	potential_everpreg_witch_friend_trigger = { CHARACTER = root }
	NOT = { is_in_list = prayer_everpreg_witches }
	basic_is_available_ai = yes
	OR = {
		has_relation_potential_friend = root
		opinion = {
			target = root
			value >= low_positive_opinion
		}
	}
}

everpreg_witch.4020 = { #by HPREGANON
	type = character_event
	title = everpreg_witch.4020.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:prayer_everpreg_witch_2 }
				desc = everpreg_witch.4020.two_everpreg_witches.desc
			}
			desc = everpreg_witch.4020.one_everpreg_witch.desc
		}
		random_valid = {
			desc = everpreg_witch.4020.full_moon.desc
			desc = everpreg_witch.4020.new_moon.desc
			desc = everpreg_witch.4020.equinox.desc
			desc = everpreg_witch.4020.solstice.desc
		}
		desc = everpreg_witch.4020.end.desc
	}
	theme = witchcraft
	override_background = {
		event_background = wilderness
	}
	left_portrait = scope:prayer_everpreg_witch_1
	right_portrait = scope:prayer_everpreg_witch_2
	
	trigger = {
		OR = {
			any_known_secret = {
				secret_owner = {
					NOT = { this = root } # Don't include our own secrets!
					everpreg_witch_4020_prayer_friend_trigger = yes
				}
			}
			any_relation = {
				type = potential_friend
				everpreg_witch_4020_prayer_friend_trigger = yes
			}
			any_close_or_extended_family_member = { everpreg_witch_4020_prayer_friend_trigger = yes }
			any_vassal = { everpreg_witch_4020_prayer_friend_trigger = yes }
			any_courtier_or_guest = { everpreg_witch_4020_prayer_friend_trigger = yes }
			any_consort = { everpreg_witch_4020_prayer_friend_trigger = yes }
		}
		NOR = {
			has_character_modifier = clear_mind_modifier
			has_character_flag = event_cooldown_everpreg_witch_4020
		}
	}


	immediate = {
		add_character_flag = {
			flag = event_cooldown_everpreg_witch_4020
			years = 15
		}
		every_known_secret = {
			limit = {
				secret_owner = {
					everpreg_witch_4020_prayer_friend_trigger = yes
				}
			}
			secret_owner = { add_to_list = prayer_everpreg_witches }
		}
		every_relation = {
			type = potential_friend
			limit = { everpreg_witch_4020_prayer_friend_trigger = yes }
			add_to_list = prayer_everpreg_witches
		}
		every_close_or_extended_family_member = {
			limit = { everpreg_witch_4020_prayer_friend_trigger = yes }
			add_to_list = prayer_everpreg_witches
		}
		every_vassal = {
			limit = { everpreg_witch_4020_prayer_friend_trigger = yes }
			add_to_list = prayer_everpreg_witches
		}
		every_courtier_or_guest = {
			limit = { everpreg_witch_4020_prayer_friend_trigger = yes }
			add_to_list = prayer_everpreg_witches
		}
		every_consort = {
			limit = { everpreg_witch_4020_prayer_friend_trigger = yes }
			add_to_list = prayer_everpreg_witches
		}

		# Pick two
		random_in_list = {
			list = prayer_everpreg_witches

			weight = {
			 	base = 1

			 	compatibility_modifier = {
			 		compatibility_target = root
			 	}
			 	opinion_modifier = {
			 		opinion_target = root
			 	}
			 	ai_value_modifier = {
			 		ai_sociability = 0.5
			 		ai_compassion = 0.2
			 		ai_boldness = 0.2
			 	}
			 	modifier = {
			 		has_relation_potential_friend = root
			 		add = 100
			 	}
			}
			save_scope_as = prayer_everpreg_witch_1
		}

		if = {
			limit = { exists = scope:prayer_everpreg_witch_2 }
			random_in_list = {
				list = prayer_everpreg_witches
				limit = { NOT = { this = scope:prayer_everpreg_witch_1 } }
				weight = {
				 	base = 1

				 	compatibility_modifier = {
				 		compatibility_target = root
				 	}
				 	opinion_modifier = {
				 		opinion_target = root
				 	}
				 	ai_value_modifier = {
				 		ai_sociability = 0.5
				 		ai_compassion = 0.2
				 		ai_boldness = 0.2
				 	}
				 	modifier = {
				 		has_relation_potential_friend = root
				 		add = 100
				 	}
				}
				save_scope_as = prayer_everpreg_witch_2
			}
		}
	}

	# Pray for prayer_everpreg_witch_1
	option = {
		name = everpreg_witch.4020.a
		
###		progress_towards_friend_effect = { CHARACTER = scope:prayer_everpreg_witch_1 OPINION = yes }
###		scope:prayer_everpreg_witch_1 = {
###			add_character_modifier = {
###				modifier = clear_mind_modifier
###				years = 10
###			}
###		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = -1
				ai_compassion = -0.5
				ai_honor = -0.5
			}
			opinion_modifier = {
				opinion_target = scope:prayer_everpreg_witch_1
			}
		}
	}

	# Pray for prayer_everpreg_witch_2
	option = {
		name = everpreg_witch.4020.b
		trigger = { exists = scope:prayer_everpreg_witch_2 }

###		progress_towards_friend_effect = { CHARACTER = scope:prayer_everpreg_witch_2 OPINION = yes }
###		scope:prayer_everpreg_witch_2 = {
###			add_character_modifier = {
###				modifier = clear_mind_modifier
###				years = 10
###			}
###		}

		stress_impact = {
			greedy = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = -1
				ai_compassion = -0.5
				ai_honor = -0.5
			}
			opinion_modifier = {
				opinion_target = scope:prayer_everpreg_witch_2
			}
		}
	}
	
	# Pray for me!
	option = {
		name = everpreg_witch.4020.c

		add_character_modifier = {
			modifier = clear_mind_modifier
			years = 10
		}

		stress_impact = {
			base = minor_stress_impact_loss # It's not be be prayed for
			generous = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = minor_stress_impact_gain
			content = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 2
				ai_compassion = -1
				ai_honor = -1
			}
		}
	}
}


#############
# RARE BOOK #
#############

scripted_trigger everpreg_witch_4030_friend_trigger = {
	potential_everpreg_witch_friend_trigger = { CHARACTER = root }
	basic_is_available_ai = yes
	is_adult = yes
	learning >= decent_skill_rating
}

scripted_trigger everpreg_witch_4030_convince_trigger = {
	is_everpreg_witch_trigger = no
	is_adult = yes
	basic_is_available_ai = yes
}

scripted_effect everpreg_witch_4030_convince_success_effect = {
	give_everpreg_witch_secret_or_trait_effect = yes
	random_secret = {
		limit = { secret_type = secret_everpreg_witch }
		reveal_to = root
	}
}

scripted_effect everpreg_witch_4030_convince_failure_effect = {
	add_character_modifier = {
		modifier = on_edge_modifier
		years = 10
	}
}

everpreg_witch.4030 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4030.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { exists = scope:everpreg_witch_friend }
				desc = everpreg_witch.4030.friend.desc
			}
			desc = everpreg_witch.4030.no_friend.desc
		}
	}
	theme = witchcraft
	override_background = {
		event_background = study
	}
	left_portrait = scope:left_portrait
	right_portrait = scope:right_portrait
	lower_left_portrait = scope:lower_left_portrait
	lower_right_portrait = scope:lower_right_portrait

	trigger = {
		OR = {
			has_lifestyle = diplomacy_lifestyle
			has_lifestyle = martial_lifestyle
			has_lifestyle = stewardship_lifestyle
			has_lifestyle = intrigue_lifestyle
			has_lifestyle = learning_lifestyle
		}
	}

	weight_multiplier = {
		base = 1

		# Friend helping
		modifier = {
			any_relation = {
				type = friend
				everpreg_witch_4030_friend_trigger = yes
			}
			add = 1
		}
		modifier = {
			any_relation = {
				type = friend
				everpreg_witch_4030_friend_trigger = yes
				learning >= high_skill_rating
			}
			add = 1
		}

		#Your learning
		modifier = {
			add = {
				value = learning
				subtract = average_skill_rating
				multiply = 0.1
				min = -0.7
				max = 1
			}
		}
	}

	immediate = {
		
		#Did a friend help out? Show them :)
		random_relation = {
			type = friend
			limit = { everpreg_witch_4030_friend_trigger = yes }
			weight = {
				base = 1
				opinion_modifier = {
					opinion_target = root
				}
				modifier = {
					add = {
						value = learning
						multiply = 5
					}
				}
			}
			save_scope_as = everpreg_witch_friend
		}

		# Who can we convert? Pick two
		every_scheme = {
			limit = {
				scheme_type = convert_to_everpreg_witchcraft
				scheme_target = { everpreg_witch_4030_convince_trigger = yes }
			}
			scheme_target = { add_to_list = convince }
		}
		every_vassal = {	
			limit = { everpreg_witch_4030_convince_trigger = yes }
			add_to_list = convince
		}
		every_councillor = {
			limit = { everpreg_witch_4030_convince_trigger = yes }
			add_to_list = convince
		}
		every_spouse = {
			limit = { everpreg_witch_4030_convince_trigger = yes }
			add_to_list = convince
		}
		every_close_or_extended_family_member = {
			limit = { everpreg_witch_4030_convince_trigger = yes }
			add_to_list = convince
		}

		random_in_list = {
			list = convince
			limit = {
				save_temporary_scope_as = convert_target
				root = {
					any_scheme = {
						scheme_type = convert_to_everpreg_witchcraft
						scheme_target = scope:convert_target
					}
				}
			}
			alternative_limit = { always = yes }

			weight = {
				base = 1
				ai_value_modifier = {
					ai_greed = 1
					ai_rationality = 1
				}
				modifier = {
					add = {
						value = learning
						multiply = 5
					}
				}
				modifier = {
					OR = {
						is_powerful_vassal_of = root
						is_councillor_of = root
						AND = {
							exists = root.house
							root.house = { NOT = { has_house_modifier = everpreg_witch_coven } }
							exists = house
							house = root.house
						}	
					}
					add = 50
				}
			}
			save_scope_as = convince_target_1
		}

		if = {
			limit = { exists = scope:convince_target_1 }
			random_in_list = {
				list = convince
				limit = {
					NOT = { this = scope:convince_target_1 }
				}

				weight = {
					base = 1
					ai_value_modifier = {
						ai_greed = 1
						ai_rationality = 1
					}
					modifier = {
						add = {
							value = learning
							multiply = 5
						}
					}
					modifier = {
						OR = {
							is_powerful_vassal_of = root
							is_councillor_of = root
							AND = {
								exists = root.house
								root.house = { NOT = { has_house_modifier = everpreg_witch_coven } }
								exists = house
								house = root.house
							}	
						}
						add = 50
					}
				}
				save_scope_as = convince_target_2
			}
		}

		#Save portraits
		if = {
			limit = {
				exists = scope:everpreg_witch_friend
				exists = scope:convince_target_2
			}
			scope:everpreg_witch_friend = { save_scope_as = left_portrait }
			scope:convince_target_1 = { save_scope_as = lower_left_portrait }
			scope:convince_target_2 = { save_scope_as = lower_right_portrait }
		}
		else_if = {
			limit = {
				exists = scope:everpreg_witch_friend
				exists = scope:convince_target_1
			}
			scope:everpreg_witch_friend = { save_scope_as = left_portrait }
			scope:convince_target_1 = { save_scope_as = right_portrait }
		}
		else_if = {
			limit = { exists = scope:everpreg_witch_friend }
			scope:everpreg_witch_friend = { save_scope_as = left_portrait }
		}
		else_if = {
			limit = {
				exists = scope:convince_target_1
				exists = scope:convince_target_2
			}
			scope:convince_target_1 = { save_scope_as = left_portrait }
			scope:convince_target_2 = { save_scope_as = right_portrait }
		}
		else_if = {
			limit = { exists = scope:convince_target_1 }
			scope:convince_target_1 = { save_scope_as = left_portrait }
		}
	}

	# Study the book for perk together
	option = {
		name = {
			text = {
				first_valid = {
					triggered_desc = {
						trigger = { exists = scope:everpreg_witch_friend }
						desc = everpreg_witch.4030.friend.a
					}
					desc = everpreg_witch.4030.no_friend.a
				}
			}
		}
						

		if = {
			limit = { has_lifestyle = diplomacy_lifestyle }
			add_diplomacy_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { has_lifestyle = martial_lifestyle }
			add_martial_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { has_lifestyle = stewardship_lifestyle }
			add_stewardship_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { has_lifestyle = intrigue_lifestyle }
			add_intrigue_lifestyle_perk_points = 1
		}
		else_if = {
			limit = { has_lifestyle = learning_lifestyle }
			add_learning_lifestyle_perk_points = 1
		}
		
		if = {
			limit = { exists = scope:everpreg_witch_friend }
			scope:everpreg_witch_friend = {
				if = {
					limit = { root = { has_lifestyle = diplomacy_lifestyle } }
					add_diplomacy_lifestyle_perk_points = 1
				}
				else_if = {
					limit = { root = { has_lifestyle = martial_lifestyle } }
					add_martial_lifestyle_perk_points = 1
				}
				else_if = {
					limit = { root = { has_lifestyle = stewardship_lifestyle } }
					add_stewardship_lifestyle_perk_points = 1
				}
				else_if = {
					limit = { root = { has_lifestyle = intrigue_lifestyle } }
					add_intrigue_lifestyle_perk_points = 1
				}
				else_if = {
					limit = { root = { has_lifestyle = learning_lifestyle } }
					add_learning_lifestyle_perk_points = 1
				}
			}
		}
		else = {
			add_stress = medium_stress_gain # No friend means working harder
		}
	}

	# Sell it to other everpreg_witches and share profit
	option = {
		name = everpreg_witch.4030.b

		add_gold = medium_gold_value

		if = {
			limit = { exists = scope:everpreg_witch_friend }
			scope:everpreg_witch_friend = { add_gold = root.medium_gold_value }
		}

	}

	# use it to convince someone (option 1)
	option = {
		trigger = { exists = scope:convince_target_1 }
		name = everpreg_witch.4030.c

		scope:convince_target_1 = { save_scope_as = convince_target }

		random_list = {
			desc = outcome_in_a_few_days
			55 = {
				desc = everpreg_witch.4030.c.success
				ai_value_modifier = {
					who = scope:convince_target_1
					ai_zeal = -0.5
					ai_greed = 0.5
					ai_rationality = 0.5
				}
				modifier = {
					add = {
						value = scope:convince_target_1.learning
						multiply = 2
					}
				}
				trigger_event = {
					id = everpreg_witch.4031
					days = 3
				}
				show_as_tooltip = { scope:convince_target_1 = { everpreg_witch_4030_convince_success_effect = yes } }
			}
			45 = {
				desc = everpreg_witch.4030.c.failure
				ai_value_modifier = {
					who = scope:convince_target_1
					ai_zeal = 0.25
					ai_greed = -0.25
					ai_rationality = -0.25
				}
				trigger_event = {
					id = everpreg_witch.4032
					days = 3
				}
				show_as_tooltip = { scope:convince_target_1 = { everpreg_witch_4030_convince_failure_effect = yes } }
			}
		}
	}
	
	#  use it to convince someone (option 2)
	option = {
		trigger = { exists = scope:convince_target_2 }
		name = everpreg_witch.4030.d

		scope:convince_target_2 = { save_scope_as = convince_target }

		random_list = {
			desc = outcome_in_a_few_days
			55 = {
				desc = everpreg_witch.4030.c.success
				ai_value_modifier = {
					who = scope:convince_target_2
					ai_zeal = -0.5
					ai_greed = 0.5
					ai_rationality = 0.5
				}
				modifier = {
					add = {
						value = scope:convince_target_2.learning
						multiply = 2
					}
				}
				trigger_event = {
					id = everpreg_witch.4031
					days = 3
				}
				show_as_tooltip = { scope:convince_target_2 = { everpreg_witch_4030_convince_success_effect = yes } }
			}
			45 = {
				desc = everpreg_witch.4030.c.failure
				ai_value_modifier = {
					who = scope:convince_target_2
					ai_zeal = 0.25
					ai_greed = -0.25
					ai_rationality = -0.25
				}
				trigger_event = {
					id = everpreg_witch.4032
					days = 3
				}
				show_as_tooltip = { scope:convince_target_2 = { everpreg_witch_4030_convince_failure_effect = yes } }
			}
		}
	}
}

# Convince success
everpreg_witch.4031 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4030.t
	desc = {
		desc = everpreg_witch.4031.start.desc
		desc = everpreg_witch.4031.end.desc
	}
	theme = witchcraft
	left_portrait = {
		character = scope:convince_target
		animation = personality_rational
	}
	
	trigger = {
		exists = scope:convince_target
		scope:convince_target = { is_alive = yes }
	}


	option = {
		name = everpreg_witch.4031.a
			scope:convince_target = { everpreg_witch_4030_convince_success_effect = yes }
	}
}

# Convince failure
everpreg_witch.4032 = { #by Mathilda Bjarnehed
	type = character_event
	title = everpreg_witch.4030.t
		desc = {
		desc = everpreg_witch.4031.start.desc
		desc = everpreg_witch.4032.end.desc
	}
	theme = witchcraft
	 left_portrait = {
		character = scope:convince_target
		animation = shock
	}
	
	trigger = {
		exists = scope:convince_target
		scope:convince_target = { is_alive = yes }
	}


	option = {
		name = everpreg_witch.4032.a
			scope:convince_target = { everpreg_witch_4030_convince_failure_effect = yes }
	}
}

