﻿namespace = fp2_yearly

### EVENT LIST ####################################################################
## XXXX	- XXXX	YYY by ZZZ
## 1001	- 1001	Chess Two by Daniel Moore
## 1002	- 1002	Compromising Position by Daniel Moore
## 1003	- 1003	Tilting at Giants by Daniel Moore
## 1004	- 1004	The Hawk of Quarysh by Daniel Moore
## 1005	- 1005	Lost Viking by Daniel Moore
## 1006	- 1007	Viking Cheese by Daniel Moore
## 1008	- 1008	Consuming the Cheese by Daniel Moore
## 2020	- 2020	Açò es or, xata! by Hugo Cortell
## 2025	- 2025	Suffering From Success by Hugo Cortell
## 3000 - 3000	Neighboring Muslims are growing rice by Alexander Oltner
## 3001	- 3001	You commission your epitaph by Veronica Pazos
## 3002	- 3002	Oh my god they were roommates by Veronica Pazos
## 3003	- 3003	Best friend throws a terrible party by Veronica Pazos
## 4001	- 4001	You fancy a little siesta by Nick Meredith
## 4002	- 4002	County is increasingly religiously intertwined by Nick Meredith
## 4003	- 4003	The road to Santiago is under threat from bandits by Nick Meredith
## 4004	- 4004	Talented Mozarab offers their services by Nick Meredith
## 4005	- 4005	Mozarabs in a city ask for their own quarter by Nick Meredith
## 4006	- 4006	Mozarabs ask for permission to build churches by Nick Meredith
## 4007	- 4007	Finding a shell on the road to Santiago by Nick Meredith
## 4008	- 4008	Folk stories around the fireside by Nick Meredith
## 4009	- 4009	Visiting the Malato Tree by Nick Meredith
## 4010	- 4010	Finding a Verraco by Nick Meredith
## 8000 - 8000	Destroying the Vineyards by Ola Jentzsch
## 8001	- 8001	Assembling the Cortes by Ola Jentzsch
## 8002	- 8002	Dietary Dilemma By Ola Jentzsch
## 8003	- 8003	Flight of Fancy By Ola Jentzsch
## 8004	- 8004	Trasnlation Schools By Ola Jentzsch
## 8005 - 8005	Under the Stone Pine by Ola Jentzsch
## 8006	- 8006	Saqaliba Settlers by Ola Jentzsch
## 9000 - 9002	Conversos and Jewish events By James Beaumont
## 9005 - 9005	Toledan Nights By James Beaumont
## 9006 - 9006	Local bishop mad his church faces the wrong way By James Beaumont
###################################################################################
# A lot of effort went into the readability of these lists and headers			  #
# In fact, now there have been two whole passes of file organization			  #
###################################################################################

###################################
# Chess Two
# By Daniel Moore
###################################
fp2_yearly.1001 = {
	type = character_event
	title = fp2_yearly.1001.t
	desc = fp2_yearly.1001.desc
	theme = crown
	left_portrait = {
		character = root
		animation = worry

	}

	trigger = {
		#Strategy Games Culture Tradition
		has_fp2_dlc_trigger = yes
		is_landed_or_landless_administrative = yes
		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		NOT = {
			has_character_flag = fp2_yearly.1001
		}
	}

	immediate = {
		add_character_flag = fp2_yearly.1001

	}

	option = { #Torture the pawns
		name = fp2_yearly.1001.c

		trigger = {
			OR = {
				has_trait = sadistic
				has_trait = torturer
				dread > medium_dread
			}
		}

		add_dread = minor_dread_gain

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
			}
		}
	}

	option = { #King should be stronger
		name = fp2_yearly.1001.a

		add_prestige = medium_prestige_value

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

	}

	option = { #Bishop should be stronger
		name = fp2_yearly.1001.b

		add_piety = medium_piety_value

		add_character_modifier = {
		  	modifier = fp2_respected_clergy_chess
		 	years = 10
		}

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

###################################
# Compromising Position
# By Daniel Moore
###################################
fp2_yearly.1002 = {
	type = character_event
	title = fp2_yearly.1002.t
	desc = fp2_yearly.1002.desc
	theme = seduction
	left_portrait = {
		character = root
		animation = shock

	}

	right_portrait = {
		character = scope:deviant_courtier
		animation = prisondungeon
	}

	trigger = {
		has_fp2_dlc_trigger = yes
		is_adult = yes
		is_landed_or_landless_administrative = yes
		any_courtier = { is_available_healthy_ai_adult = yes }

		NOT = {
			has_character_flag = fp2_yearly.1002
		}
	}

	immediate = {
		add_character_flag = fp2_yearly.1002

		random_courtier = {
			limit = {
				is_available_healthy_ai_adult = yes
				OR = {
					has_trait = deviant
					any_secret = {
						type = secret_deviant
					}
				}
			}

			save_scope_as = deviant_courtier
		}


		if = {
			limit = {
				NOT = { exists = scope:deviant_courtier}
			}
			hidden_effect = {
				random_courtier = {
					limit = {
						is_available_healthy_ai_adult = yes
					}

					give_deviant_secret_or_trait_effect = yes
					save_scope_as = deviant_courtier
				}
			}
		}

		scope:deviant_courtier = {

			add_character_flag = {
				flag = is_naked
				days = 1
			}

			add_character_flag = {
				flag = temporarily_blinded
				days = 1
			}
		}
	}


	option = {
		name = fp2_yearly.1002.b
		scope:deviant_courtier = {
			random_secret = {
				type = secret_deviant
				reveal_to = root
			}
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_vengefulness = 1
				ai_honor = -1
			}
		}

		stress_impact = {
			deviant = medium_stress_gain
		}

	}

	option = {
		name = fp2_yearly.1002.c
		stress_impact = {
			deviant = medium_stress_loss
		}

		if = {
			limit = {
				NOT = {
					any_secret = {
						type = secret_deviant
					}
				}
			}
			give_deviant_secret_or_trait_effect = yes
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_energy = 1
				ai_zeal = -1
			}
		}
	}

	option = {
		name = fp2_yearly.1002.a
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 1
			}
		}

		stress_impact = {
			deviant = medium_stress_gain

		}
	}

	after = {
		scope:deviant_courtier = {
			remove_character_flag = is_naked
		}
	}
}

###################################
# Tilting at Giants
# By Daniel Moore
###################################
fp2_yearly.1003 = {
	type = character_event
	title = fp2_yearly.1003.t
	desc = fp2_yearly.1003.desc
	theme = realm
	right_portrait = {
		character = scope:injured_knight
		animation = paranoia

	}

	override_background = { reference = farmland }

	trigger = {
		has_fp2_dlc_trigger = yes
		any_knight = {
			is_available_healthy_ai_adult = yes
		}

		capital_province = {
			geographical_region = world_europe_west_iberia
		}
		ROOT.culture = {
			has_innovation = innovation_windmills
		}

		NOT = {
			has_character_flag = fp2_yearly.1003
		}




	}

	immediate = {

		add_character_flag = fp2_yearly.1003
		random_knight = {
			limit = {
				is_available_healthy_ai_adult = yes
			}
			save_scope_as = injured_knight
		}

		scope:injured_knight = {
			increase_wounds_effect = { REASON = fight }
		}

	}

	option = { #
		name = fp2_yearly.1003.a
		remove_short_term_gold = medium_gold_value
		root.capital_county = {
			change_county_control = 5
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_honor = 1
			}
		}
	}

	option = { #
		name = fp2_yearly.1003.b
		root.capital_county = {
			change_county_control = -10
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -1
			}
		}
	}
}

###################################
# The Hawk of Quarysh
# By Daniel Moore
###################################
fp2_yearly.1004 = {
	type = character_event
	title = fp2_yearly.1004.t
	desc = fp2_yearly.1004.desc
	theme = learning
	left_portrait = {
		character = root
		animation = worry
	}


	trigger = {
		has_fp2_dlc_trigger = yes

		has_religion = religion:islam_religion

		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		NOT = {
			has_character_flag = fp2_yearly.1004
		}
	}

	cooldown = {
		years = 50
	}

	immediate = {
		add_character_flag = fp2_yearly.1004

		character:73679 = {
			save_scope_as = hawk_of_quraysh
		}

		dynasty:597 = {
			save_scope_as = hawk_dynasty
		}

		dynasty:100721 = {
			save_scope_as = abbasid_dynasty
		}
	}

	option = { #I'm related!
		name = fp2_yearly.1004.c
		trigger = {
			dynasty = {
				this = scope:hawk_dynasty
			}
		}

		ai_chance = {
			base = 1000
		}
		add_prestige = medium_prestige_value
	}

	option = { #How he inspired soldiers
		name = fp2_yearly.1004.a
			add_character_modifier = {
				modifier = fp2_hawk_of_quarysh_martial_modifier
				years = 10
			}

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

	option = { #How diplomatic he was
		name = fp2_yearly.1004.b
			add_character_modifier = {
				modifier = fp2_hawk_of_quarysh_diplomacy_modifier
				years = 10
			}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_compassion = 1
			}
		}
	}
}

###################################
# Lost Viking
# By Daniel Moore
###################################
fp2_yearly.1005 = {
	type = character_event
	title = fp2_yearly.1005.t
	desc = fp2_yearly.1005.desc
	theme = realm
	left_portrait = {
		character = root
		animation = worry

	}

	right_portrait = {
		character = scope:hidden_viking
		animation = anger
	}

	trigger = {
		has_fp2_dlc_trigger = yes
		any_held_county = {
			any_county_province = {
				geographical_region = world_europe_west_iberia
			}
		}

		NOT = {
			has_character_flag = fp2_yearly.1005
		}
	}

	cooldown = { years = 50 }

	immediate = {
		add_character_flag = fp2_yearly.1005

		random_held_county = {
			limit = { any_county_province = { geographical_region = world_europe_west_iberia } }
			save_scope_as = viking_county
		}


		create_character = {
			template = fp1_jomsviking_bigwig
			location = root.capital_province
			trait = compassionate
			trait = scarred
			save_scope_as = hidden_viking
		}
	}

	option = {
		name = fp2_yearly.1005.a
		add_courtier = scope:hidden_viking

		scope:viking_county = {
			change_county_control = -5
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = 1
				ai_compassion = 1
			}
		}
	}

	option = {
		name = fp2_yearly.1005.b

		scope:hidden_viking = {
			death = {
				death_reason = death_execution
				killer = root
			}
		}

		scope:viking_county = {
			change_county_control = -10
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_sociability = -1
				ai_compassion = -1
			}
		}
	}

	option = {
		name = fp2_yearly.1005.c
		scope:viking_county = {
			change_county_control = 5
		}

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

###################################
# Viking Cheese
# By Daniel Moore
###################################
fp2_yearly.1006 = {
	type = character_event
	title = fp2_yearly.1006.t
	desc = fp2_yearly.1006.desc
	theme = realm
	override_background = { reference = wilderness_mountains }
	left_portrait = {
		character = root
		animation = worry

	}

	right_portrait = {
		character = scope:cheese_trader
		animation = scheme
	}



	trigger = {
		has_fp2_dlc_trigger = yes
		any_held_county = {
			any_county_province = {
				geographical_region = world_europe_west_iberia
			}
		}

		NOT = {
			has_character_flag = fp2_yearly.1006
		}

	}

	immediate = {
		add_character_flag = fp2_yearly.1006

		random_held_county = {
			limit = {
				any_county_province = {
					geographical_region = world_europe_west_iberia
				}
			}
			save_scope_as = viking_county
		}


		create_character = {
			template = generic_peasant_character
			location = root.capital_province

			save_scope_as = cheese_trader
		}
	}

	option = { #Lose gold gain cheese
		name = fp2_yearly.1006.a
		remove_short_term_gold = minor_gold_value
		#Cheese based bonus
		stress_impact = {
			base = miniscule_stress_impact_loss
			gluttonous = minor_stress_impact_loss
			comfort_eater = minor_stress_impact_loss
			eccentric = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -1
			}
		}
	}

	option = { #You courageously chase the cheese
		name = fp2_yearly.1006.b

		hidden_effect = {
			random_list = {
				10 = {
					trigger_event = {
						id = fp2_yearly.1007
						days = { 10 20 }
					}
				}

				5 = {

				}
			}
		}


		custom_tooltip = fp2.1006.b.tt
	}

	option = { #Nothing happens you hate cheese and having fun
		name = fp2_yearly.1006.c
		stress_impact = {
			gluttonous = miniscule_stress_impact_gain
			comfort_eater = miniscule_stress_impact_gain
			eccentric = miniscule_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}
}

fp2_yearly.1007 = {
	type = character_event
	title = fp2_yearly.1007.t
	desc = fp2_yearly.1007.desc
	theme = realm
	left_portrait = {
		character = root
		animation = sadness
	}

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

	trigger = {
		has_fp2_dlc_trigger = yes
		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		NOT = {
			has_character_flag = fp2_yearly.1007
		}

	}

	immediate = {

		add_character_flag = fp2_yearly.1007

		root.capital_county = {
			save_scope_as = viking_county
		}

		create_character = {
			template = generic_peasant_character
			location = root.capital_province

			save_scope_as = fake_cheese_viking
		}
	}

	option = {
		name = fp2_yearly.1007.a

		add_prestige = miniscule_prestige_value

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 1
			}
		}
	}

	option = {
		name = fp2_yearly.1007.b
		stress_impact = {
			gluttonous = major_stress_loss
		}

		add_gold = minor_gold_value

		create_artifact = {
			name = fp2_cheese_artifact
			description = fp2_cheese_artifact_desc
			modifier = artifact_health_gain_1_modifier
			modifier = artifact_attraction_opinion_negative_1_modifier
			type = miscellaneous
			visuals = pouch

			save_scope_as = newly_created_artifact
		}

		scope:newly_created_artifact = {
			flag_as_trash_artifact = yes
			set_variable = has_cheese_artifact

			save_scope_as = cheese_artifact
		}
	}
}

###################################
# Consuming the Cheese
# By Daniel Moore
###################################
fp2_yearly.1008 = {
	type = character_event
	title = fp2_yearly.1008.t
	desc = fp2_yearly.1008.desc
	theme = realm
	override_background = { reference = bp1_wine_cellar }
	left_portrait = {
		character = root
		animation = ecstasy

	}

	trigger = {
		any_character_artifact = {
			has_variable = has_cheese_artifact
		}

	}

	immediate = {

		random_character_artifact = {
			limit = {
				has_variable = has_cheese_artifact
			}
			save_scope_as = cheese_artifact
		}

	}

	option = {
		name = fp2_yearly.1008.a
		add_stress = scope:cheese_artifact.cheese_artifact_strength

		destroy_artifact = scope:cheese_artifact

	}

	option = {
		name = fp2_yearly.1008.b
	}

}

###################################
# Açò es or, xata!
# By Hugo Cortell
###################################
# (hurray for UTF8)
###################################
fp2_yearly.2020 = {
	type = character_event
	title = fp2_struggle.2020.t # Removed variation for Jaime I, as he is not in the game
	desc = fp2_struggle.2020.desc # Breaks convention, usually events do not tell the player character how they feel. But it is fitting for this thematically tounge-and-cheek event.

	theme = recovery
	override_background = { reference = farmland }
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:fp2_2020_laxatador
		animation = beg
	}
	cooldown = { years = 100 }

	weight_multiplier = {
		base = 1
		modifier = {
			add = 5
			has_trait = gluttonous
		}
	}
	trigger = {
		has_fp2_dlc_trigger = yes
		is_landed = yes
		is_ai = no # The AI has no use for narrative-focused events
		OR = {
			has_title = title:c_valencia
			title:c_valencia = {
				holder = {
					OR = {
						liege = root
						top_liege = root
					}
				}
			}
		}
		title:c_valencia = {
			NOR = {
				has_county_modifier = fp2_horchata_colonialism_modifier
				has_county_modifier = governance_1054_satisfied_peasants_modifier
				has_county_modifier = fp2_funded_agriculture_modifier
			}
		}
	}

	immediate = {
		title:c_valencia.title_province = { save_scope_as = fp2_2020_valencia }

		create_character = {
			age = { 19 36 }
			location = scope:fp2_2020_valencia
			gender = female
			trait = beauty_good_2 # Chata, does not quite translate to beautiful, but english speakers might expect it to.
			trait = logistician
			trait = diligent
			trait = temperate
			trait = compassionate
			random_traits = no
			culture = scope:fp2_2020_valencia.culture
			faith = scope:fp2_2020_valencia.faith
			dynasty = none
			save_scope_as = fp2_2020_laxatador
		}
	}

	option = { # Engage in resource extraction
		name = fp2_struggle.2020.a
		flavor = fp2_struggle.2020.a.desc

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

		scope:fp2_2020_valencia.county = {
			add_county_modifier = {
				modifier = fp2_horchata_colonialism_modifier
				years = 10
			}
		}

		root.capital_county = { # The people love this
			add_county_modifier = {
				modifier = governance_1054_satisfied_peasants_modifier
				years = 15
			}
		}
	}

	option = { # Give them money to make more
		name = fp2_struggle.2020.d

		trigger = {
			NOT = {
				has_trait = gluttonous
				has_trait = comfort_eater
			}
		}

		remove_treasury_or_gold = medium_treasury_or_gold_value
		scope:fp2_2020_valencia.county = {
			add_county_modifier = {
				modifier = fp2_funded_agriculture_modifier
				years = 15
			}
		}
	}

	option = { # Take a few barrels for the family (wholesome outcome)
		name = fp2_struggle.2020.b

		every_close_family_member = {
			custom = all_close_family_members
			add_opinion = {
				target = root
				modifier = delicious_morsel_opinion
				opinion = 10
			}
		}
	}

	option = { # NO! THE DEVIL MUST BE TEMPTING ME (evil outcome)
		name = fp2_struggle.2020.c
		flavor = fp2_struggle.2020.c.desc

		stress_impact = { gluttonous = minor_stress_impact_gain } # As you need to be glut to trigger the event, the stress is reduced to compensate
		if = {
			limit = { has_trait = gluttonous }
			add_prestige = medium_prestige_gain # Resisting is very difficult
		}
		else = { add_prestige = minor_prestige_gain }

	}

	after = { scope:fp2_2020_laxatador = { silent_disappearance_effect = yes } }
}

###################################
# Suffering From Success
# By Hugo Cortell
###################################
fp2_yearly.2025 = {
	type = character_event
	title = fp2_struggle.2025.t
	desc = fp2_struggle.2025.desc
	theme = realm
	override_background = { reference = wilderness_mountains }
	cooldown = { years = 4 }
	left_portrait = {
		character = scope:fp2_2025_marshal
		animation = flirtation_left
	}
	right_portrait = {
		character = root
		triggered_animation = {
			trigger = { # Is sad
				OR ={
					has_trait = depressed_1
					has_trait = depressed_genetic
					has_trait = compassionate
					has_trait = gallant
					has_trait = peasant_leader
				}
			}
  			animation = sadness
  		}
		animation = war_defender
	}

	trigger = {
		gold > medium_gold_value

		any_held_county = {
			any_county_province = { geographical_region = world_europe_west_iberia }
			recent_history = {
				type = conquest
				years = 4
			}
		}

		OR = {
			exists = cp:councillor_steward
			exists = cp:councillor_marshal
		}
	}

	immediate = {
		random_held_county = {
			limit = {
				any_county_province = { geographical_region = world_europe_west_iberia }
				recent_history = {
					type = conquest
					years = 4
				}
			}
			save_scope_as = fp2_2025_razed_land
		}

		if = {
			limit = { exists = cp:councillor_marshal }
			cp:councillor_marshal = { save_scope_as = fp2_2025_marshal }
		}
		else = { cp:councillor_steward = { save_scope_as = fp2_2025_marshal } }
	}

	option = { # No more war from them. Let them rebuild in peace.
		name = fp2_struggle.2025.a

		trigger = {
			OR ={
				has_trait = depressed_1
				has_trait = depressed_genetic
				has_trait = compassionate
				has_trait = gallant
				has_trait = peasant_leader
			}
		}

		add_stress = minor_stress_impact_loss
		send_interface_toast = {
			type = event_toast_effect_good
			title = fp2_vow_against_conscription_modifier
			left_icon = ROOT

			scope:fp2_2025_razed_land = {
				add_county_modifier = {
					modifier = fp2_vow_against_conscription_modifier
					years = 40
				}
			}
		}
	}

	option = { # I will build a great monument
		name = fp2_struggle.2025.b

		remove_treasury_or_gold = minor_treasury_or_gold_value
		send_interface_toast = {
			type = event_toast_effect_good
			title = fp2_monument_to_war_modifier
			left_icon = ROOT

			add_prestige = medium_prestige_gain
			scope:fp2_2025_razed_land = {
				add_county_modifier = {
					modifier = fp2_monument_to_war_modifier
					years = 20
				}
			}
		}
	}

	option = { # We will restore this town back to what it was
		name = fp2_struggle.2025.c

		remove_treasury_or_gold = medium_treasury_or_gold_value
		send_interface_toast = {
			type = event_toast_effect_good
			title = fp2_village_rebuiling_efforts_modifier
			left_icon = ROOT

			scope:fp2_2025_razed_land = {
				add_county_modifier = {
					modifier = fp2_village_rebuiling_efforts_modifier
					years = 10
				}
			}
		}
	}

	option = { # I will establish a temporary outpost here
		name = fp2_struggle.2025.d

		send_interface_toast = {
			type = event_toast_effect_good
			title = fp2_border_encampments_modifier
			left_icon = ROOT

			scope:fp2_2025_razed_land = {
				add_county_modifier = {
					modifier = fp2_border_encampments_modifier
					years = 10
				}
			}
		}
	}
}

###################################
# Neighboring Muslims are growing rice
# By Alexander Oltner
###################################
scripted_trigger rice_field_potential = {
	is_available_ai_adult = yes
	faith.religion = religion:islam_religion
	capital_county.faith.religion = religion:islam_religion
	capital_province = {
		geographical_region = world_europe_west_iberia
	}
	capital_county = {
		county_control >= 100
		development_level >= root.capital_county.development_level
	}
}

fp2_yearly.3000 = {
	type = character_event
	title = fp2_flavor.0001.t
	desc = fp2_flavor.0001.desc
	theme = realm
	override_background = { reference = farmland }
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:rice_propagator
		animation = happiness
	}

	cooldown = { years = 30 }

	trigger = {
		# DLC checking
		has_fp2_dlc_trigger = yes
		is_landed = yes

		trigger_if = {
			limit = {
				fp2_character_any_involvement_iberian_struggle_trigger = yes
			}
			struggle:iberian_struggle = {
				OR = {
					is_struggle_phase = struggle_iberia_phase_compromise
					is_struggle_phase = struggle_iberia_phase_conciliation
					is_struggle_phase = struggle_iberia_phase_opportunity
				}
			}
		}

		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		NOR = { # Non-muslim with non-muslim capital
			capital_county.faith.religion = religion:islam_religion
			faith.religion = religion:islam_religion
			capital_county = {
				has_county_modifier = terraced_hills_modifier
			}
		}
		OR = { # Vassal, neighbor, or liege is muslim with muslim capital
			any_neighboring_and_across_water_top_liege_realm_owner = {
				rice_field_potential = yes
			}
			any_vassal = {
				rice_field_potential = yes
			}
			liege = {
				rice_field_potential = yes
			}
		}
	}

	immediate = {
		capital_county = { save_scope_as = capital_county_scope }

		every_neighboring_and_across_water_top_liege_realm_owner = {
			limit = {
				rice_field_potential = yes
			}
			add_to_list = rice_propagators
		}
		every_vassal = {
			limit = {
				rice_field_potential = yes
			}
			add_to_list = rice_propagators
		}
		if = {
			limit = {
				liege = {
					rice_field_potential = yes
				}
			}
			liege = {
				add_to_list = rice_propagators
			}
		}

		random_in_list = {
			list = rice_propagators
			weight = {
				base = 1
				modifier = {
					add = 10
					is_of_major_interest_to_root_trigger = yes
				}
				modifier = {
					add = 5
					is_of_minor_interest_to_root_trigger = yes
				}
				modifier = {
					add = stewardship
				}
			}
			save_scope_as = rice_propagator
			capital_county = {
				if = {
					limit = {
						NOT = {
							has_county_modifier = terraced_hills_modifier
						}
					}
					hidden_effect = {
						add_county_modifier = {
							modifier = terraced_hills_modifier
							years = 20
						}
					}
				}
				save_scope_as = rice_propagator_capital
			}
		}
	}

	option = {
		name = fp2_flavor.0001.a

		pay_treasury_or_gold = {
			target = scope:rice_propagator
			value = scope:rice_propagator.medium_treasury_or_gold_value # The costs/duels were updated to be higher for balance reasons
		}

		scope:capital_county_scope = {
			add_county_modifier = {
				modifier = terraced_hills_modifier
				years = 20
			}
		}

		stress_impact = {
			greedy = massive_stress_impact_gain
			zealous = major_stress_impact_gain
			deceitful = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			paranoid = medium_stress_impact_gain
			arbitrary = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = greedy
					has_trait = zealous
					has_trait = deceitful
					has_trait = arrogant
					has_trait = paranoid
				}
			}
		}
	}

	option = {
		name = fp2_flavor.0001.b

		duel = {
			skill = diplomacy
			value = scope:rice_propagator.diplomacy

			11 = { # Failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -2
					min = -5
				}

				desc = fp2_flavor.0001.b.failure
				send_interface_toast = {
					title = fp2_flavor.0001.b.failure
					left_icon = scope:rice_propagator

					scope:rice_propagator = {
						add_opinion = {
							target = root
							modifier = insult_opinion
							opinion = -15
						}

						hidden_effect = {
							random = {
								chance = 50
								if = {
									limit = { can_set_relation_potential_rival_trigger = { CHARACTER = root } }
									set_relation_potential_rival = root
								}
							}
						}
					}
				}
			}
			10 = { # Success
				compare_modifier = {
				value = scope:duel_value
					multiplier = 1.5
				}

				desc = fp2_flavor.0001.b.success
				send_interface_toast = {
					title = fp2_flavor.0001.b.success
					left_icon = scope:rice_propagator

					scope:capital_county_scope = {
						add_county_modifier = {
							modifier = terraced_hills_modifier
							years = 20
						}
					}
				}
			}
		}

		stress_impact = {
			paranoid = massive_stress_impact_gain
			impatient = major_stress_impact_gain
			shy = major_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = paranoid
					has_trait = impatient
					has_trait = shy
					has_trait = callous
					has_trait = sadistic
				}
			}
		}
	}

	option = {
		name = fp2_flavor.0001.c

		duel = {
			skill = intrigue
			value = scope:rice_propagator.intrigue

			11 = { # Failure
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1.5
					min = -5
				}

				desc = fp2_flavor.0001.c.failure
				send_interface_toast = {
					title = fp2_flavor.0001.c.failure
					left_icon = scope:rice_propagator

					scope:rice_propagator = {
						add_opinion = {
							target = root
							modifier = angry_opinion
							opinion = -35
						}

						progress_towards_rival_effect = {
							REASON = rival_rice_stolen
							CHARACTER = root
							OPINION = 0
						}
					}
				}
			}
			10 = { # Success
				compare_modifier = {
				value = scope:duel_value
					multiplier = 1.5
				}

				desc = fp2_flavor.0001.c.success
				send_interface_toast = {
					title = fp2_flavor.0001.c.success
					left_icon = scope:rice_propagator

					scope:capital_county_scope = {
						add_county_modifier = {
							modifier = terraced_hills_modifier
							years = 20
						}
					}
				}
			}
		}

		stress_impact = {
			honest = massive_stress_impact_gain
			generous = major_stress_impact_gain
			craven = medium_stress_impact_gain
			content = medium_stress_impact_gain
			patient = minor_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = honest
					has_trait = generous
					has_trait = craven
					has_trait = content
				}
			}
		}
	}

	option = {
		name = fp2_flavor.0001.d

		stress_impact = {
			diligent = major_stress_impact_gain
			ambitious = major_stress_impact_gain
			generous = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
			fickle = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = ambitious
					has_trait = generous
					has_trait = trusting
				}
			}
		}
	}
}

##################################################
# As I Lay Dying
# whether this title is a reference to Faulkner's novel or the metalcore band
# that I shall leave to the judgement of the reader
# by Veronica Pazos
# 3001 - 3001
##################################################
fp2_yearly.3001 = {
	type = character_event
	title = fp2_flavor.3001.t
	desc = fp2_flavor.3001.desc

	theme = death
	left_portrait = {
		character = ROOT
		animation = worry
	}
	override_background = { reference = throne_room }

	trigger = {
		has_fp2_dlc_trigger = yes
		is_landed = yes
		is_available_even_at_war_adult = yes
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
		OR = {
			AND = {
				age >= 45
				has_trait = wounded_2
			}
			AND = {
				age >= 45
				has_trait = ill
			}
			has_trait = wounded_3
			has_trait = cancer
			age >= 75
		}
		NOT = { has_character_flag = had_event_fp2_flavor_3001 }
		OR = {
			OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
			religion = religion:judaism_religion
			religion = religion:islam_religion
		}
	}

	immediate = {
		play_music_cue = "mx_cue_illness"
		add_character_flag = had_event_fp2_flavor_3001
		religion = {
			save_scope_as = fp2_flavor_3001_religion
		}
	}

	option = { #your own official language (Latin/Hebrew/Arabic)
		name = fp2_flavor.3001.a
		add_piety = minor_piety_gain
		add_prestige = minor_prestige_gain

		ai_chance = {
			base = 10
			modifier = {
				add = 10
				has_trait = zealous
			}
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}

	option = { #Vulgar (Romance) language
		name = fp2_flavor.3001.b
		add_piety = medium_piety_loss
		every_vassal = {
			limit = {
				religion = root.religion
			}
			custom = custom.every_vassal
			add_opinion = {
				target = ROOT
				modifier = reputation_opinion
				opinion = 20
			}
		}

		ai_chance = {
			base = 5
			modifier = {
				add = 10
				OR = {
					has_trait = compassionate
					has_trait = humble
				}
			}
			ai_value_modifier = {
				ai_compassion = 1
			}
		}
	}

	option = { #your language + vulgar (Latin + Castillian / Hebrew + Sephardí / Arabic + Mozarabic )
		name = fp2_flavor.3001.c
		stress_impact = {
			base = minor_stress_loss
			zealous = medium_stress_gain
		}

		ai_chance = {
			base = 20
			modifier = {
				add = -10
				has_trait = zealous
			}
			ai_value_modifier = {
				ai_zeal = -1
			}
		}
	}

	option = { #all of them! (vulgar + Latin + Hebrew + Arabic)
		name = fp2_flavor.3001.d
		add_character_modifier = {
			modifier = fp2_epitaph_modifier
			years = 5
		}
		add_piety = minor_piety_loss
		stress_impact = {
			base = minor_stress_impact_gain
			zealous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 5
			modifier = {
				add = -10
				has_trait = zealous
			}
			modifier = {
				add = 10
				has_trait = compassionate
			}
			ai_value_modifier = {
				ai_zeal = -1
				ai_compassion = 1
			}
		}
	}
}

##################################################
# And They Were Roommates
# (oh my god they were roommates)
# by Veronica Pazos
# (idea by Baudelaire Welch)
# 3002 - 3002
##################################################
fp2_yearly.3002 = {
	type = character_event
	title = fp2_flavor.3011.t
	desc = fp2_flavor.3011.desc

	theme = seduction
	left_portrait = {
		character = ROOT
		animation = ecstasy
	}
	right_portrait = {
		character = scope:fp2_flavor_3011_best_friend
		animation = flirtation
	}
	override_background = { reference = bedchamber }

	trigger = {
		has_fp2_dlc_trigger = yes
		is_playable_character = yes
		is_available_even_at_war_adult = yes
		any_relation = { #you have a best friend!
			type = best_friend
			is_available_healthy_ai_adult = yes
			can_set_relation_lover_trigger = { CHARACTER = ROOT } #you're attracted to each other's genre
			NOT = { has_trait = celibate }
			NOT = { is_consort_of = root }
			might_cheat_on_every_partner_trigger = yes
			trigger_if = {
				limit = { relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = root } }
				OR = {
					has_perk = subtle_desire_perk
					accepts_incest_with_trigger = { CHARACTER = root }
				}
			}
		}
	}

	weight_multiplier  = {
		modifier = {
			add = 0.5
			has_trait = lustful
		}
	}

	immediate = {
		random_relation = {
			type = best_friend
			limit = {
				is_available_healthy_ai_adult = yes
				can_set_relation_lover_trigger = { CHARACTER = ROOT }
				NOT = { has_trait = celibate }
				NOT = { is_consort_of = root }
				might_cheat_on_every_partner_trigger = yes
				trigger_if = {
					limit = { relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = root } }
					OR = {
						has_perk = subtle_desire_perk
						accepts_incest_with_trigger = { CHARACTER = root }
					}
				}
			}
			save_scope_as = fp2_flavor_3011_best_friend
		}
	}

	option = { #become their lover
		name = fp2_flavor.3011.a

		trigger = {
			NOT = { has_trait = celibate }
			OR = {
				has_perk = unshackled_lust_perk
				is_attracted_to_gender_of = root
			}
			trigger_if = {
				limit = { relation_with_character_is_incestuous_in_my_faith_trigger = { CHARACTER = scope:fp2_flavor_3011_best_friend } }
				OR = {
					has_perk = subtle_desire_perk
					accepts_incest_with_trigger = { CHARACTER = scope:fp2_flavor_3011_best_friend }
				}
			}
		}

		set_relation_lover = scope:fp2_flavor_3011_best_friend
		if = { #if you're in a homosexual relationship and your faith disapproves this stresses you
			limit = {
				OR = {
					AND = {
						is_female = yes
						scope:fp2_flavor_3011_best_friend = {
							is_female = yes
						}
						NOT = { faith = { has_doctrine = doctrine_homosexuality_accepted } }
					}
					AND = {
						is_male = yes
						scope:fp2_flavor_3011_best_friend = {
							is_male = yes
						}
						NOT = { faith = { has_doctrine = doctrine_homosexuality_accepted } }
					}
				}
			}
			stress_impact = {
				base = medium_stress_impact_gain
				zealous = medium_stress_impact_gain #some extra stress
			}
		}
		if = { #your spouse finds this weird
			limit = {
				exists = primary_spouse
			}
			primary_spouse = {
				add_opinion = {
					target = ROOT
					modifier = suspicion_opinion
					opinion = -25
				}
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 10
				has_trait = lustful
			}
			modifier = {
				add = -5
				has_trait = chaste
			}
			modifier = {
				add = -5
				exists = primary_spouse
			}
			ai_value_modifier = {
				ai_zeal = -1
			}
		}
	}

	option = { #allowe them to move in but stay as friends
		name = fp2_flavor.3011.b
		stress_impact = {
			base = medium_stress_loss
			lustful = medium_stress_impact_gain
		}
		if = {
			limit = {
				exists = primary_spouse
			}
			primary_spouse = {
				add_opinion = {
					target = ROOT
					modifier = suspicion_opinion
					opinion = -20
				}
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				add = -5
				has_trait = lustful
			}
			modifier = {
				add = -2
				has_trait = chaste
			}
			modifier = {
				add = 5
				has_trait = compassionate
			}
			modifier = {
				add = -5
				exists = primary_spouse
			}
			ai_value_modifier = {
				ai_compassion = 0.25
			}
		}
	}

	option = { #nah im good
		name = {
			trigger = {
				exists = primary_spouse
			}
			text = fp2_flavor.3011.c_spouse
		}
		name = {
			trigger = {
				NOT = { exists = primary_spouse }
			}
			text = fp2_flavor.3011.c
		}
		stress_impact = {
			base = medium_stress_impact_gain #you get stressed at losing your bff
			lustful = minor_stress_impact_gain
			callous = minor_stress_loss
			chaste = minor_stress_loss
		}
		scope:fp2_flavor_3011_best_friend = {
			add_opinion = {
				target = ROOT
				modifier = rejected_opinion
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				add = -5
				has_trait = lustful
			}
			modifier = {
				add = 10
				has_trait = chaste
			}
			modifier = {
				add = -5
				has_trait = compassionate
			}
			modifier = {
				add = 5
				exists = primary_spouse
			}
			ai_value_modifier = {
				ai_compassion = -0.5
			}
		}
	}
}

##################################################
# A Flavorful Evening
# by Veronica Pazos
# (idea by Ewan Cowhig Croft)
# 3003 - 3003
##################################################
fp2_yearly.3003 = {
	type = character_event
	title = fp2_flavor.3021.t
	desc = fp2_flavor.3021.desc

	theme = feast_activity
	left_portrait = {
		character = scope:fp2_flavor_3021_best_friend
		animation = ecstasy
	}
	right_portrait = {
		character = ROOT
		animation = stress
	}
	override_background = { reference = feast }

	trigger = {
		has_fp2_dlc_trigger = yes
		is_available_for_activity_trigger = yes
		any_relation = { #you have a best friend!
			type = best_friend
			is_available_healthy_ai_adult = yes
		}
	}

	weight_multiplier  = {
		modifier = {
			add = 0.5
			trigger_if = {
				limit = { exists = scope:fp2_flavor_3021_best_friend }
				scope:fp2_flavor_3021_best_friend = {
					OR = {
						has_trait = gregarious
						has_trait = gluttonous
					}
				}
			}
		}
	}

	immediate = {
		random_relation = {
			type = best_friend
			limit = {
				is_available_healthy_ai_adult = yes
			}
			save_scope_as = fp2_flavor_3021_best_friend
		}
	}

	option = { #pretend nothing's wrong
		name = fp2_flavor.3021.a
		stress_impact = {
			base = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			honest = minor_stress_impact_gain
			eccentric = minor_stress_impact_gain
			deceitful = minor_stress_loss
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 10
				has_trait = deceitful
			}
			modifier = {
				add = -10
				has_trait = honest
			}
			modifier = {
				add = -5
				has_trait = brave
			}
			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = -0.5
				ai_compassion = 0.5
			}
		}
	}

	option = { #try to gently tell them
		name = fp2_flavor.3021.b
		duel = {
			skill = diplomacy
			value = 5
			50 = {
				desc = fp2_flavor.3021.b.success_tt
				compare_modifier = {
					value = {
						value = scope:duel_value
						if = {
							limit = { has_trait = deceitful }
							add = 5
						}
						if = {
							limit = { intrigue >= medium_skill_rating }
							add = 5
						}
						if = {
							limit = { scope:fp2_flavor_3021_best_friend = { has_trait = forgiving } }
							add = 5
						}
						if = {
							limit = { scope:fp2_flavor_3021_best_friend = { has_trait = trusting } }
							add = 5
						}
						if = {
							limit = { scope:fp2_flavor_3021_best_friend = { opinion = { target = ROOT value >= high_positive_opinion } } }
							add = 5
						}
					}
				}
				send_interface_toast = {
					title = fp2_flavor.3021.b.success
					left_icon = ROOT
					stress_impact = {
						base = minor_stress_impact_gain
						compassionate = minor_stress_impact_gain
						honest = minor_stress_impact_gain
						deceitful = minor_stress_loss
					}
				}
			}
			50 = { #they don't
				send_interface_toast = {
					title = fp2_flavor.3021.b.fail
					left_icon = ROOT
					scope:fp2_flavor_3021_best_friend = {
						add_opinion = {
							target = ROOT
							modifier = insult_opinion
							opinion = -20
						}
					}
					stress_impact = {
						base = medium_stress_impact_gain
						compassionate = minor_stress_impact_gain
						honest = minor_stress_impact_gain
						deceitful = minor_stress_loss
					}
				}
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 10
				has_trait = compassionate
			}
			modifier = {
				add = -5
				has_trait = deceitful
			}
			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = 0.5
				ai_compassion = 1
			}
		}
	}

	option = { #directly tell them
		name = fp2_flavor.3021.c
		random_list = {
			25 = { #they take it well
				modifier = {
					add = 5
					has_trait = honest
				}
				modifier = {
					add = 5
					diplomacy >= medium_skill_rating
				}
				modifier = {
					add = 5
					scope:fp2_flavor_3021_best_friend = {
						has_trait = honest
					}
				}
			}
			75 = { #they dont (and they think you're being rude
				scope:fp2_flavor_3021_best_friend = {
					add_opinion = {
						target = ROOT
						modifier = insult_opinion
						opinion = -30
					}
				}
				stress_impact = {
					base = medium_stress_impact_gain
				}
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 10
				has_trait = brave
			}
			modifier = {
				add = -5
				has_trait = deceitful
			}
			ai_value_modifier = {
				ai_boldness = 1
				ai_rationality = 0.5
				ai_compassion = -1
			}
		}
	}

	option = { #ghost them
		name = fp2_flavor.3021.d
		scope:fp2_flavor_3021_best_friend = { #they REALLY dislike you
			add_opinion = {
				target = ROOT
				modifier = insult_opinion
				opinion = -50
			}
		}
		stress_impact = {
			base = minor_stress_loss
			brave = minor_stress_impact_gain
			honest = minor_stress_impact_gain
		}

		ai_chance = {
			base = 10
			modifier = {
				add = -10
				has_trait = brave
			}
			modifier = {
				add = -5
				has_trait = honest
			}
			ai_value_modifier = {
				ai_boldness = -1
				ai_rationality = -0.5
				ai_compassion = -1
			}
		}
	}
}

###################################
# You fancy a little siesta
# By Nick Meredith
###################################
# Look, this was inspired by our actual Spanish designer having a nap after lunch
# Don't look at me like that
###################################
fp2_yearly.4001 = {
	type = character_event
	title = fp2_yearly.4001.t
	desc = fp2_yearly.4001.desc
	theme = mental_health
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = boredom
	}

	trigger = {
		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_playable_character = yes
		is_available_at_peace_adult = yes

		#is Iberian
		culture = { has_cultural_pillar = heritage_iberian }

		#has more than 5 stress
		stress > 5

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	option = { #No, I have work to do!
		name = fp2_yearly.4001.a

		add_prestige = minor_prestige_gain

		stress_impact = {
			base = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			diligent = major_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = lazy
			}
		}
	}

	option = { #a little nap can't hurt anyone
		name = fp2_yearly.4001.b

		stress_impact = {
			base = minor_stress_impact_loss
			diligent = massive_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = diligent
			}
		}
	}
}

###################################
# County is increasingly religiously intertwined
# By Nick Meredith
###################################
fp2_yearly.4002 = {
	type = character_event
	title = fp2_yearly.4002.t
	desc = fp2_yearly.4002.desc
	theme = faith
	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:realm_priest
		animation = worry
	}

	cooldown = { years = 30 }

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#is Iberian
		culture = { has_cultural_pillar = heritage_iberian }

		#has a court chaplain
		exists = cp:councillor_court_chaplain

		#has a county that doesn't match your faith
		any_directly_owned_province = {
			faith != root.faith
		}

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		random_directly_owned_province = {
			limit = {
				faith != root.faith
			}
			save_scope_as = interfaith_province
		}
		cp:councillor_court_chaplain = {
				save_scope_as = realm_priest
		}
	}

	option = { #I welcome a multifaith community.
		name = fp2_yearly.4002.a

		add_character_modifier = {
			modifier = fp2_multifaith_county_modifier
			years = 10
		}

		scope:realm_priest = {
			add_opinion = {
				target = liege
				modifier = annoyed_opinion
				opinion = -30
			}
		}

		stress_impact = {
			zealous = major_stress_gain
			cynical = minor_stress_loss
			arrogant = medium_stress_gain
			impatient = medium_stress_gain
			arbitrary = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = impatient
					has_trait = arrogant
				}
			}
		}
	}

	option = { #This must be stopped!
		name = fp2_yearly.4002.b

		add_piety = minor_piety_gain

		scope:interfaith_province.county = {
			change_county_control = medium_county_control_loss
			set_county_faith = root.faith
			add_county_modifier = {
				modifier = fp2_religious_strife_modifier
				years = 10
			}
		}

		scope:realm_priest = {
			add_opinion = {
				target = liege
				modifier = respect_opinion
				opinion = 40
			}
		}

		stress_impact = {
			zealous = medium_stress_loss
			cynical = medium_stress_gain
			forgiving = major_stress_gain
			just = medium_stress_gain
			stubborn = minor_stress_gain
			content = minor_stress_gain
			patient = minor_stress_gain
			trusting = minor_stress_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = forgiving
					has_trait = just
				}
			}
		}
	}
}

###################################
# The road to Santiago is under threat from bandits
# By Nick Meredith
###################################
fp2_yearly.4003 = {
	type = character_event
	title = fp2_yearly.4003.t
	desc = fp2_yearly.4003.desc
	theme = martial
	override_background = { reference = terrain }
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:steward
		animation = worry
	}

	trigger = {
		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#is Iberian
		culture = { has_cultural_pillar = heritage_iberian }

		#has a steward
		exists = cp:councillor_steward

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		#and is Christian
		OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }

		#and owns at least one county on the road to Santiago
		OR = {
			has_title = title:c_santiago
			has_title = title:c_astorga
			has_title = title:c_leon
			has_title = title:c_burgos
			has_title = title:c_amaya
			has_title = title:c_najera
			has_title = title:c_navarra
		}
	}

	immediate = {
		every_county_in_region = {
			region = world_europe_west_iberia
				limit = { # all counties on the road to Santiago
					OR = {
						this = title:c_santiago
						this = title:c_astorga
						this = title:c_leon
						this = title:c_burgos
						this = title:c_amaya
						this = title:c_najera
						this = title:c_navarra
					}
					OR = {
						holder = root
						holder.top_liege = root
					}
				}
			add_to_list = camino_de_santiago
		}

		faith = {
			if = {
				limit = {
					any_faith_holy_order = {
						any_leased_title = {
							any_this_title_or_de_jure_above = {
								is_in_list = camino_de_santiago
							}
						}
					}
				}
				random_faith_holy_order = {
					limit = {
						any_leased_title = {
							any_this_title_or_de_jure_above = {
								is_in_list = camino_de_santiago
							}
						}
					}
					save_scope_as = santiago_defenders
				}
				scope:santiago_defenders = {
					random_leased_title = {
						limit = {
							any_this_title_or_de_jure_above = {
								is_in_list = camino_de_santiago
							}
						}
						county = { save_scope_as = ho_province }
					}
				}
			}
		}
		cp:councillor_steward = {
				save_scope_as = steward
		}
	}

	option = { #Call upon a local Holy Order
		name = fp2_yearly.4003.a

		trigger = {
			exists = scope:ho_province
		}

		scope:ho_province = {
			add_county_modifier = {
				modifier = fp2_camino_santiago_ho_protected_modifier
				years = 10
			}
		}

		custom_tooltip = fp2_yearly.4003.tt

		add_piety = minor_piety_gain

		remove_treasury_or_gold = minor_treasury_or_gold_value

		add_internal_flag = special

		ai_chance = {
			base = 100
		}
	}

	option = { #Pay for the protection of the road
		name = fp2_yearly.4003.b

		random_in_list = {
			list = camino_de_santiago
			add_county_modifier = {
				modifier = fp2_camino_santiago_protected_modifier
				years = 10
			}
		}

		add_piety = medium_piety_gain

		remove_treasury_or_gold = major_treasury_or_gold_value

		stress_impact = {
			greedy = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			cynical = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = greedy
					has_trait = arrogant
				}
			}
		}
	}

	option = { #Pilgrims will have to fend for themselves
		name = fp2_yearly.4003.c

		add_piety = medium_piety_loss

		stress_impact = {
			base = miniscule_stress_impact_gain
			zealous = major_stress_impact_gain
			humble = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = humble
					has_trait = compassionate
				}
			}
		}
	}
}

###################################
# Talented Mozarab offers their services
# By Nick Meredith
###################################
fp2_yearly.4004 = {
	type = character_event
	title = fp2_yearly.4004.t
	desc = fp2_yearly.4004.desc
	theme = vassal
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:mozarab_wanderer
		animation = marshal
	}

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_landed = yes
		is_available_at_peace_adult = yes

		#Mozarabic exists...
		exists = faith:mozarabic_church

		#...but you are not Mozarabic
		NOT = {
			faith = faith:mozarabic_church
		}

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		create_character = {
			age = { 20 40 }
			location = root.capital_province
			gender_female_chance = {
				if = {
					limit = { root.faith = { has_doctrine = doctrine_gender_male_dominated } }
					add = 0
				}
				else_if = {
					limit = { root.faith = { has_doctrine = doctrine_gender_female_dominated } }
					add = 100
				}
				else = {
					add = 50
				}
			}
			random_traits_list = {
				count = 1
				education_martial_3 = {}
				education_martial_4 = {}
			}
			random_traits_list = { #Something nice
				count = 2
				brave = {}
				honest = {}
				gregarious = {}
				trusting = {}
				compassionate = {}
				generous = {}
				humble = {}
				calm = {}
			}
			random_traits_list = {
				count = 1
				lustful = {}
				chaste = {}
				wrathful = {}
				arrogant = {}
				impatient = {}
				patient = {}
				impatient  = {}
				ambitious = {}
				cynical = {}
				zealous = {}
				stubborn = {}
			}

			trait = lifestyle_blademaster

			random_traits = no

			diplomacy = { min_template_low_skill max_template_average_skill }
			martial = { min_template_decent_skill max_template_high_skill }
			stewardship = { min_template_low_skill max_template_average_skill }
			intrigue = { min_template_low_skill max_template_average_skill }
			learning = { min_template_low_skill max_template_average_skill }
			prowess = { min_template_decent_skill max_template_high_skill }

			culture = root.culture
			faith = faith:mozarabic_church

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
				add_trait_xp = {
					trait = lifestyle_blademaster
					value = {
						integer_range = {
							min = medium_lifestyle_random_xp_low
							max = medium_lifestyle_random_xp_high
						}
					}
				}
			}

			save_scope_as = mozarab_wanderer
		}
	}

	option = { #Of course you may join my court!
		name = fp2_yearly.4004.a

		add_piety = minor_piety_loss

		stress_impact = {
			base = minor_stress_impact_gain
			zealous = major_stress_impact_gain
			stubborn = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain
		}

		add_courtier = scope:mozarab_wanderer

		scope:mozarab_wanderer = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}

	option = { #Yes; so long as you convert
		name = fp2_yearly.4004.b

		random_list = {

			40 = {

				add_courtier = scope:mozarab_wanderer

				modifier = {
					scope:mozarab_wanderer = {
						has_trait = stubborn
					}
					add = -10
				}

				modifier = {
					scope:mozarab_wanderer = {
						has_trait = zealous
					}
					add = -20
				}

				modifier = {
					scope:mozarab_wanderer = {
						has_trait = arrogant
					}
					add = -5
				}

				modifier = {
					scope:mozarab_wanderer = {
						has_trait = wrathful
					}
					add = -5
				}

				send_interface_toast = {
				type = event_toast_effect_good
				title = fp2_yearly.4004.b.succ

				left_icon = root
				right_icon = scope:mozarab_wanderer

					scope:mozarab_wanderer = {
						set_character_faith = root.faith
						add_opinion = {
							target = root
							modifier = impious_opinion
							opinion = -20
						}
					}
				}
			}

			60 = {

				custom_tooltip = fp2_yearly.4004.tt

				send_interface_toast = {
				type = event_toast_effect_bad
				title = fp2_yearly.4004.b.fail

				left_icon = root
				right_icon = scope:mozarab_wanderer

					scope:mozarab_wanderer = {
						add_opinion = {
							target = root
							modifier = annoyed_opinion
							opinion = -40
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
		}
	}

	option = { #Send them away
		name = fp2_yearly.4004.c

		custom_tooltip = fp2_yearly.4004.c.tt

		scope:mozarab_wanderer = {
			add_opinion = {
				target = root
				modifier = annoyed_opinion
				opinion = -40
			}
		}
		ai_chance = {
			base = 100
		}
	}
}

###################################
# Mozarabs in a city ask for their own quarter
# By Nick Meredith
###################################
fp2_yearly.4005 = {
	type = character_event
	title = fp2_yearly.4005.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { religion = religion:islam_religion }
				desc = fp2_yearly.4005.desc.muslim
			}
			triggered_desc = {
				trigger = { always = yes }
				desc = fp2_yearly.4005.desc.christian
			}
		}
		desc = fp2_yearly.4005.desc
	}
	theme = faith
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:mozarab_merchant
		animation = worry
	}

	cooldown = { years = 10 }

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#Mozarabic exists...
		exists = faith:mozarabic_church

		#...but you are not Mozarabic
		NOT = {
			faith = faith:mozarabic_church
		}

		#and you have a county that has a city holding
		any_held_county= {
			any_county_province = {
				has_holding_type = city_holding
			}
		}

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		random_held_county = {
			limit = {
				any_county_province = {
					has_holding_type = city_holding
				}
			}
			save_scope_as = mozarab_quarter
		}

		if = {
			limit = {
				any_pool_character = {
					province = scope:mozarab_quarter.title_province
					faith = faith:mozarabic_church
					is_available_healthy_ai_adult = yes
				}
			}
			random_pool_character = {
				province = scope:mozarab_quarter.title_province
				limit = {
					faith = faith:mozarabic_church
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = mozarab_merchant
			}
		}

		else = {
			create_character = {
				age = { 20 40 }
				location = root.capital_province
				gender_female_chance = root_faith_dominant_gender_female_chance
				random_traits_list = {
					count = 1
					education_stewardship_3 = {}
					education_stewardship_4 = {}
				}

				random_traits = yes

				culture = scope:mozarab_quarter.culture
				faith = faith:mozarabic_church

				dynasty = none

				save_scope_as = mozarab_merchant
			}
		}
	}

	option = { #You may have a little enclave, as a treat
		name = fp2_yearly.4005.a

		remove_treasury_or_gold = medium_treasury_or_gold_value

		scope:mozarab_quarter = {
			add_county_modifier = {
				modifier = fp2_mozarab_quarter_modifier
				years = 10
			}
		}

		scope:mozarab_merchant = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 40
			}
		}

		every_vassal = {
			limit = {
				has_trait = zealous
			}
			add_opinion = {
				target = liege
				modifier = impious_opinion
				opinion = -20
			}
		}

		stress_impact = {
			zealous = major_stress_impact_gain
			greedy = major_stress_impact_gain
			arrogant = medium_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = greedy
					has_trait = arrogant
				}
			}
		}
	}

	option = { #Begone, heathen!
		name = fp2_yearly.4005.b

		add_piety = medium_piety_gain

		scope:mozarab_merchant = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -40
			}
		}

		every_vassal = {
			limit = {
				has_trait = zealous
				NOT = {
					faith = faith:mozarabic_church
				}
			}
			add_opinion = {
				target = liege
				modifier = pious_opinion
				opinion = 20
			}
		}

		every_vassal = {
			limit = {
				faith = faith:mozarabic_church
			}
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -30
			}
		}

		stress_impact = {
			zealous = medium_stress_loss
			cynical = medium_stress_gain
			forgiving = major_stress_gain
			just = medium_stress_gain
			stubborn = minor_stress_gain
			content = minor_stress_gain
			patient = minor_stress_gain
			trusting = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = forgiving
					has_trait = just
				}
			}
		}
	}
}

###################################
# Mozarabs ask for permission to build churches
# By Nick Meredith
###################################
fp2_yearly.4006 = {
	type = character_event
	title = fp2_yearly.4006.t
	desc = fp2_yearly.4006.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_zealous
	}
	right_portrait = {
		character = scope:mozarab_priest
		animation = beg
	}

	cooldown = { years = 30 }

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#Mozarabic exists
		exists = faith:mozarabic_church

		#You are not Christian at all
		NOT = {
			faith = { religion_tag = christianity_religion }
		}

		#and you have a county that has a free holding slot
		any_held_county = {
			any_county_province = {
				has_holding = no
			}
		}

		#and your capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}

		exists = cp:councillor_court_chaplain
	}

	immediate = {
		random_sub_realm_county = {
			limit = {
				any_county_province = {
					has_holding = no
				}
			}
			save_scope_as = mozarab_church
		}

		if = {
			limit = {
				any_pool_character = {
					province = scope:mozarab_church.title_province
					faith = faith:mozarabic_church
					is_available_healthy_ai_adult = yes
					has_trait = devoted
				}
			}
			random_pool_character = {
				province = scope:mozarab_church.title_province
				limit = {
					faith = faith:mozarabic_church
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = mozarab_priest
			}
		}

		else = {
			create_character = {
				age = { 20 40 }
				location = root.capital_province
				gender_female_chance = root_faith_dominant_gender_female_chance
				random_traits_list = {
					count = 1
					education_learning_3 = {}
					education_learning_4 = {}
				}

				trait = devoted

				random_traits = yes

				culture = scope:mozarab_church.culture
				faith = faith:mozarabic_church

				dynasty = none

				save_scope_as = mozarab_priest
			}
		}
		cp:councillor_court_chaplain = {
			save_scope_as = realm_priest
		}
	}

	option = { #You can build a church
		name = fp2_yearly.4006.a

		remove_treasury_or_gold = medium_treasury_or_gold_value

		root = {
			add_character_modifier = {
				modifier = fp2_mozarab_church_modifier
				years = 30
			}
		}

		scope:mozarab_priest = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 40
			}
		}

		scope:realm_priest = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -10
			}
		}

		stress_impact = {
			zealous = major_stress_impact_gain
			greedy = major_stress_impact_gain
			arrogant = medium_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			ambitious = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			lazy = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = greedy
					has_trait = arrogant
				}
			}
		}
	}

	option = { #You are not allowed to build a church
		name = fp2_yearly.4006.b

		add_piety = minor_piety_gain

		root = {
			add_character_modifier = {
				modifier = fp2_mozarab_rejected_modifier
				years = 30
			}
		}

		scope:mozarab_priest = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -40
			}
		}

		every_vassal = {
			limit = {
				faith = faith:mozarabic_church
			}
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -30
			}
		}

		stress_impact = {
			zealous = medium_stress_loss
			compassionate = massive_stress_gain
			generous = major_stress_gain
			just = major_stress_gain
			forgiving = medium_stress_gain
			cynical = medium_stress_gain
			content = medium_stress_gain
			patient = minor_stress_gain
			trusting = minor_stress_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = generous
					has_trait = just
					has_trait = forgiving
					has_trait = cynical
					has_trait = content
				}
			}
		}
	}
}

###################################
# Finding a shell on the road to Santiago
# By Nick Meredith
###################################
fp2_yearly.4007 = {
	type = character_event
	title = fp2_yearly.4007.t
	desc = fp2_yearly.4007.desc
	theme = faith
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:realm_priest
		animation = disapproval
	}

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#You have a realm priest
		exists = cp:councillor_court_chaplain

		#You are Christian
		faith = { religion_tag = christianity_religion }

		#You can see sea shells on the sea shore
		NOT = {
			has_trait = blind
		}

		#You own a county on the road to Santiago
		OR = {
			has_title = title:c_santiago
			has_title = title:c_astorga
			has_title = title:c_leon
			has_title = title:c_burgos
			has_title = title:c_amaya
			has_title = title:c_najera
			has_title = title:c_navarra
		}

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		cp:councillor_court_chaplain = {
			save_scope_as = realm_priest
		}
	}

	option = { #I'm keeping it and you're keeping your mouth closed m8
		name = fp2_yearly.4007.a

		root = {
			create_artifact = {
				name = fp2_scallop_shell_artifact
				description = fp2_scallop_shell_artifact_desc
				type = miscellaneous
				visuals = pouch
				modifier = artifact_same_faith_opinion_1_modifier
				modifier = artifact_monthly_piety_1_modifier
				save_scope_as = newly_created_artifact
			}

			scope:newly_created_artifact = {
				flag_as_trash_artifact = yes
			}
		}

		add_piety = minor_piety_loss

		scope:realm_priest = {
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -10
			}
		}

		stress_impact = {
			zealous = massive_stress_impact_gain
			honest = massive_stress_impact_gain
			just = major_stress_impact_gain
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = zealous
					has_trait = honest
					has_trait = just
					has_trait = craven
				}
			}
		}
	}

	option = { #Ok fine I guess I won't keep the stolen valour shell
		name = fp2_yearly.4007.b

		add_piety = miniscule_piety_value

		stress_impact = {
			base = miniscule_stress_impact_loss
			cynical = massive_stress_impact_gain
			deceitful = massive_stress_impact_gain
			greedy = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			ambitious = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = deceitful
					has_trait = greedy
					has_trait = arbitrary
				}
			}
		}
	}

	option = { #Who do you think they'll believe fam?
		name = fp2_yearly.4007.c

		custom_tooltip = fp2_yearly.4007.c.tt.flavour

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

		stress_impact = {
			base = miniscule_stress_impact_gain
			zealous = massive_stress_impact_gain
			honest = massive_stress_impact_gain
			just = major_stress_impact_gain
			craven = medium_stress_impact_gain
			content = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			temperate = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
			cynical = minor_stress_impact_loss
			deceitful = minor_stress_impact_loss
			greedy = miniscule_stress_impact_loss
			arbitrary = miniscule_stress_impact_loss
		}

		duel = {
			skill = intrigue
			target = scope:realm_priest

			#You win the duel
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = fp2_yearly.4007.c.tt.success
				send_interface_toast = {
					title = fp2_yearly.4007.c.tt.success
					left_icon = root
					right_icon = scope:realm_priest
					root = {
						add_trait = pilgrim
						add_piety = 500

						create_artifact = {
							name = fp2_scallop_shell_artifact
							description = fp2_scallop_shell_artifact_desc
							type = miscellaneous
							visuals = pouch
							modifier = artifact_same_faith_opinion_1_modifier
							modifier = artifact_monthly_piety_1_modifier
							save_scope_as = newly_created_artifact
						}

						scope:newly_created_artifact = {
							flag_as_trash_artifact = yes
						}
					}
				}
			}

			#You lose the duel
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = fp2_yearly.4007.c.tt.fail
				send_interface_toast = {
					title = fp2_yearly.4007.c.tt.fail
					left_icon = root
					right_icon = scope:realm_priest
					root = {
						add_piety = major_piety_loss
						add_stress = medium_stress_gain

						create_artifact = {
							name = fp2_fake_scallop_shell_artifact
							description = fp2_fake_scallop_shell_artifact_desc
							type = miscellaneous
							visuals = pouch
							modifier = artifact_same_faith_opinion_negative_1_modifier
							modifier = artifact_monthly_piety_negative_1_modifier
							save_scope_as = newly_created_artifact
						}

						scope:newly_created_artifact = {
							flag_as_trash_artifact = yes
						}
					}
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = deceitful
					has_trait = greedy
					has_trait = arbitrary
				}
			}
		}
	}
}

###################################
# Folk stories around the fireside
# By Nick Meredith
###################################
fp2_yearly.4008 = {
	type = character_event
	title = fp2_yearly.4008.t

	override_background = { reference = bp1_bonfire }

	desc = {
		desc = fp2_yearly.4008.desc.intro
			random_valid = {
				triggered_desc = {
					trigger = { culture = culture:basque }
					desc = fp2_yearly.4008.desc.basque.a
				}
				triggered_desc = {
					trigger = { culture = culture:basque }
					desc = fp2_yearly.4008.desc.basque.b
				}
				triggered_desc = {
					trigger = { culture = culture:galician }
					desc = fp2_yearly.4008.desc.galician.a
				}
				triggered_desc = {
					trigger = { culture = culture:galician }
					desc = fp2_yearly.4008.desc.galician.b
				}
				triggered_desc = {
					trigger = { culture = culture:castilian }
					desc = fp2_yearly.4008.desc.castilian.a
				}
				triggered_desc = {
					trigger = { culture = culture:castilian }
					desc = fp2_yearly.4008.desc.castilian.b
				}
				triggered_desc = {
					trigger = { culture = culture:catalan }
					desc = fp2_yearly.4008.desc.catalan.a
				}
				triggered_desc = {
					trigger = { culture = culture:catalan }
					desc = fp2_yearly.4008.desc.catalan.b
				}
				triggered_desc = {
					trigger = { culture = culture:aragonese }
					desc = fp2_yearly.4008.desc.aragonese.a
				}
				triggered_desc = {
					trigger = { culture = culture:aragonese }
					desc = fp2_yearly.4008.desc.aragonese.b
				}
				desc = fp2_yearly.4008.desc.spain.a
				desc = fp2_yearly.4008.desc.spain.b
				desc = fp2_yearly.4008.desc.spain.c
			}
		desc = fp2_yearly.4008.desc.ending
	}

	theme = friendly

	left_portrait = {
		character = root
		animation = scheme
	}
	right_portrait = {
		character = scope:old_crone
		animation = throne_room_conversation_1
	}

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_landed_or_landless_administrative = yes
		is_available_at_peace_adult = yes

		#You are Iberian
		culture = { has_cultural_pillar = heritage_iberian }

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		if = {
			limit = {
				any_pool_character = {
					province = root.capital_province
					age = { 50 80 }
					culture = { has_cultural_pillar = heritage_iberian }
					is_available_healthy_ai_adult = yes
				}
			}
			random_pool_character = {
				province = root.capital_province
				limit = {
					age = { 50 80 }
					culture = { has_cultural_pillar = heritage_iberian }
					is_available_healthy_ai_adult = yes
				}
				save_scope_as = old_crone
			}
		}

		else = {
			create_character = {
				age = { 50 80 }
				location = root.capital_province
				gender = female

				trait = lifestyle_poet

				random_traits = yes

				culture = root.culture
				faith = root.faith

				dynasty = none

				save_scope_as = old_crone
			}
		}
	}

	option = { #What a fun old story!
		name = fp2_yearly.4008.a

		add_stress = minor_stress_loss

		ai_chance = {
			base = 100
		}
	}

	option = { #Gimme a lil prestige for not believe in ghosts
		name = fp2_yearly.4008.b

		add_prestige = minor_prestige_value

		stress_impact = {
			cynical = miniscule_stress_impact_loss
			arrogant = miniscule_stress_impact_loss
			stubborn = miniscule_stress_impact_loss
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = arrogant
					has_trait = stubborn
				}
			}
		}
	}

	option = { #Invite her to your court
		name = fp2_yearly.4008.c

		trigger = { #Make sure they have Royal Court but no poet
			has_ep1_dlc_trigger = yes
			can_appoint_char_to_court_position = {
				CHAR = scope:old_crone
				COURT_POS = court_poet_court_position
			}
		}

		hidden_effect = {
			add_courtier = scope:old_crone
			scope:old_crone = {
				add_trait = whole_of_body
			}
		}

		court_position_grant_effect = {
	 		EMPLOYER = root
	 		CANDIDATE = scope:old_crone
	 		POS = court_poet
	 	}

		reverse_add_opinion = {
			modifier = grateful_opinion
			target = scope:old_crone
			opinion = 50
		}

		ai_chance = {
			base = 100
		}
	}
}

###################################
# Visiting the Malato Tree
# By Nick Meredith
###################################
fp2_yearly.4009 = {
	type = character_event
	title = fp2_yearly.4009.t
	desc = fp2_yearly.4009.desc
	theme = crown
	override_background = { reference = wilderness_forest }
	left_portrait = {
		character = root
		animation = admiration
	}

	cooldown = { years = 30 }

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#You are Basque
		culture = culture:basque

		#You own the county where the tree is
		has_title = title:c_viscaya

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		title:c_viscaya = { save_scope_as = viscaya }
		culture = {save_scope_as = root_culture}
	}

	option = { #One day I too will shoot all their nobs!
		name = fp2_yearly.4009.a

		every_vassal = {
			custom = custom.every_same_culture_vassal
			limit = {
				culture = culture:basque
			}
			add_opinion = {
				target = liege
				modifier = respect_opinion
				opinion = 20
			}
		}

		every_vassal = {
			custom = custom.every_different_culture_vassal
			limit = {
				NOT = {
					culture = culture:basque
				}
			}
			add_opinion = {
				target = liege
				modifier = scared_opinion
				opinion = -20
			}
		}

		stress_impact = {
			calm = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			content = major_stress_impact_gain
			lazy = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = calm
					has_trait = craven
					has_trait = content
					has_trait = lazy
					has_trait = impatient
				}
			}
		}
	}

	option = { #Perhaps I need to dream bigger
		name = fp2_yearly.4009.b

		every_vassal = {
			limit = {
				culture = culture:basque
			}
			add_opinion = {
				target = liege
				modifier = disappointed_opinion
				opinion = -20
			}
		}

		every_vassal = {
			limit = {
				NOT = {
					culture = culture:basque
				}
			}
			add_opinion = {
				target = liege
				modifier = pleased_opinion
				opinion = 20
			}
		}

		stress_impact = {
			ambitious = minor_stress_impact_loss
			calm = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			content = major_stress_impact_gain
			lazy = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = calm
					has_trait = craven
					has_trait = content
					has_trait = lazy
					has_trait = impatient
				}
			}
		}
	}

	option = { #Take some bark from the tree
		name = fp2_yearly.4009.c

		root = {
			create_artifact = {
				name = fp2_malato_bark_artifact
				description = fp2_malato_bark_artifact_desc
				type = miscellaneous
				visuals = pouch
				modifier = artifact_vassal_limit_1_modifier
				modifier = artifact_monthly_martial_lifestyle_xp_1_modifier
				save_scope_as = newly_created_artifact
			}

			scope:newly_created_artifact = {
				flag_as_trash_artifact = yes
			}
		}

		ai_chance = {
			base = 100
		}
	}
}

###################################
# Finding a Verraco
# By Nick Meredith
###################################
fp2_yearly.4010 = {
	type = character_event
	title = fp2_yearly.4010.t
	desc = fp2_yearly.4010.desc
	override_background = { reference = farmland }
	theme = learning
	left_portrait = {
		character = root
		animation = personality_rational
	}

	cooldown = { years = 20 }

	trigger = {

		#DLC check
		has_fp2_dlc_trigger = yes

		#Standard check
		is_available_at_peace_adult = yes

		#owns land formerly inhabited by the Vettones
		OR = {
			has_title = title:c_plasencia
			has_title = title:c_caceres
			has_title = title:c_merida
			has_title = title:c_malagon
			has_title = title:c_almader
			has_title = title:c_medellin
			has_title = title:c_toledo
		}

		#and capital is located in Iberia
		capital_province = {
			geographical_region = world_europe_west_iberia
		}
	}

	immediate = {
		every_county_in_region = {
			region = world_europe_west_iberia
			limit = { # all relevant counties
				OR = {
					this = title:c_plasencia
					this = title:c_caceres
					this = title:c_merida
					this = title:c_malagon
					this = title:c_almader
					this = title:c_medellin
					this = title:c_toledo
				}
			}
			add_to_list = verracos_counties
		}
		random_in_list = {
			list = verracos_counties
			save_scope_as = verraco_county
		}
	}

	option = { # Maybe these were tombs for religious figures?
		name = fp2_yearly.4010.a

		trigger = {
			faith = { religion_tag = christianity_religion }
		}

		duel = {
			skill = learning
			value = decent_skill_rating

			#Sounds good to us!
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = fp2_yearly.4010.a.success
				send_interface_toast = {
					title = fp2_yearly.4010.a.success
					type = event_toast_effect_good
					left_icon = root
					add_prestige = medium_prestige_value
				}
				scope:verraco_county = {
					add_county_modifier = {
						modifier = fp2_saints_tombs_modifier
						years = 20
					}
				}
			}

			#What the hell are you talking about?
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = fp2_yearly.4010.a.fail
				send_interface_toast = {
					title = fp2_yearly.4010.a.fail
					type = event_toast_effect_bad
					left_icon = root
					stress_impact = {
						base = medium_stress_gain
						ambitious = major_stress_impact_gain
						zealous = medium_stress_impact_gain
					}
				}
			}
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = ambitious
					has_trait = zealous
				}
			}
		}
	}

	option = { # We can use these for buildings
		name = fp2_yearly.4010.b

		trigger = {
			NOT = {
				faith = { religion_tag = islam_religion }
			}
		}

		scope:verraco_county = {
			add_county_modifier = {
				modifier = fp2_dismantling_verracos_modifier
				years = 20
			}
		}

		stress_impact = {
			ambitious = miniscule_stress_impact_loss
			calm = medium_stress_impact_gain
			content = medium_stress_impact_gain
			humble = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
			impatient = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = calm
					has_trait = content
					has_trait = lazy
					has_trait = impatient
				}
			}
		}
	}

	option = { # Tear these blasphemous things down!
		name = fp2_yearly.4010.c

		trigger = {
			faith = { religion_tag = islam_religion }
		}

		add_piety = minor_piety_gain

		scope:verraco_county = {
			add_county_modifier = {
				modifier = fp2_dismantling_verracos_modifier
				years = 20
			}
		}

		stress_impact = {
			zealous = minor_stress_impact_loss
			cynical = medium_stress_impact_gain
			lazy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = cynical
					has_trait = lazy
				}
			}
		}
	}

	option = { # Kinda interesting, I guess
		name = fp2_yearly.4010.d

		ai_chance = {
			base = 100
		}
	}
}

###################################
# Destroying the Vineyards
# by Ola Jentzsch
###################################
fp2_yearly.8000 = {
	type = character_event
	title = fp2_yearly.8000.t

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_religion = religion:islam_religion
				}
				desc = fp2_yearly.8000.desc_muslim_opening
			}
			desc = fp2_yearly.8000.desc_jewish_opening
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					has_title = title:c_cadiz
				}
				desc = fp2_yearly.8000.desc_jerez
			}
			desc = fp2_yearly.8000.desc_not_jerez
		}
	}

	theme = realm
	override_background = { reference = garden }

	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:hof_emissary
		animation = chancellor
	}

	lower_left_portrait = {
		character = scope:vinoclast_caliph
	}



	trigger = {
		has_fp2_dlc_trigger = yes

		OR = {
			has_religion = religion:islam_religion
			has_religion = religion:judaism_religion
		}

		root.faith = {
			OR = {
				has_doctrine = tenet_religious_legal_pronouncements
				has_doctrine = tenet_literalism
				has_doctrine = tenet_adaptive
			}
		}

		faith.religious_head != root

		exists = root.faith.religious_head

		root.faith.religious_head = { is_ai = yes }

		fp2_character_involved_in_struggle_trigger = yes

		any_held_county = {
			county_has_province_with_terrain = {
				terrain = farmlands
				terrain = plains
				terrain = hills
				terrain = floodplains
			}
		}
	}

	cooldown = { years = 50 }

	immediate = {


		random_held_county = {
			limit = { this = title:c_cadiz }
			save_scope_as = vineyard_county
		}

		IF = {
			limit = {
				NOT = {
					exists = scope:vineyard_county
				}
			}
			random_held_county = {
				limit = {
					county_has_province_with_terrain = {
						terrain = farmlands
						terrain = plains
						terrain = hills
						terrain = floodplains
					}
				}
				save_scope_as = vineyard_county
			}
		}

		title:b_jerez = {
			if = {
				limit = {
					OR = {
						holder = root
						holder = {
							any_liege_or_above = {
								this = root
							}
						}
					}
				}
				save_scope_as = jerez_vineyards
			}
		}

		root.faith.religious_head = { save_scope_as = vinoclast_caliph }

		hidden_effect = {
			scope:vinoclast_caliph = {
				IF = {
					limit = {
						NOT = {
							has_character_modifier = crusading_against_iberian_wine_modifier
						}
					}
				}
				add_character_modifier = {
					modifier = crusading_against_iberian_wine_modifier
					years = 30
				}
			}
		}

		create_character = { #this is the head of faith's emissary
			age = { 25 75 }
			location = root.capital_province
			gender_female_chance = root_faith_dominant_gender_female_chance #could be female, if given the right context.
			trait = zealous
			template = priest_character_template
			save_scope_as = hof_emissary 	#this saves him as a scope so we can get nice effects to bounce off him!
		}
	}


	option = { #Destroying fine wine? Have the caliph gone insane?
		name = fp2_yearly.8000.a
		trigger = {
			NOT = { has_trait = zealous }
			OR = {
				has_trait = drunkard
				has_trait = gregarious
				has_trait = lifestyle_reveler
			}
		}

		ai_chance = { #hedonistic AI pick this option
        	base = 10
        	ai_value_modifier = {
           		ai_boldness = 0.2
           		ai_energy = 0.7
           		ai_greed = -0.5
            	ai_zeal = -0.5
        	}
   		}

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

   		add_piety_level = -1

   		scope:vinoclast_caliph = {
   			progress_towards_rival_effect = {
   				REASON = rival_vineyard_burned
   				CHARACTER = root
  			 	OPINION = -25
   			}
   		}

		add_character_modifier = {
			modifier = wine_supply_secure_modifier
			years = 30
		}
   	}


	option = { #Let's burn 'em
		name = fp2_yearly.8000.b

		ai_chance = { #radically zealous AIs pick this option
			base = 10
			ai_value_modifier = {
		   		ai_boldness = 0.5
				ai_zeal = 0.9
				ai_compassion = -0.5
				ai_greed = -0.5
			}
   		}

   		stress_impact = {
   			compassionate = minor_stress_impact_gain
   			cynical = minor_stress_impact_gain
   			gluttonous = medium_stress_impact_gain
   			gregarious = medium_stress_impact_gain
   			lifestyle_reveler = major_stress_impact_gain
   			drunkard = massive_stress_impact_gain
   		}

   		add_piety = major_piety_gain

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

   		scope:vineyard_county = {
			add_county_modifier = {
				modifier = vineyards_burnt_county_modifier
				years = 20
			}
		}

		if = {
			limit = { has_title = title:c_cadiz }
			add_hook = {
  				type = favor_hook
				target = scope:vinoclast_caliph
			}
		}
   	}


   	option = { #Never, I like wine
		name = fp2_yearly.8000.c

		ai_chance = { #administrative or stubborn AI pick this option
			base = 10
			ai_value_modifier = {
		   		ai_honor = 0.2
		   		ai_energy = 0.5
		   		ai_greed = 0.5
				ai_compassion = 0.3
				ai_zeal = -0.8
			}
   		}

   		stress_impact = {
   			craven = minor_stress_impact_gain
   			temperate = minor_stress_impact_gain
   			trusting = minor_stress_impact_gain
   			zealous = medium_stress_impact_gain
   		}

   		add_piety_level = -1

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

   		scope:vineyard_county = {
			add_county_modifier = {
				modifier = vineyards_protected_county_modifier
				years = 50
			}
		}
   	}
}

###################################
# Assembling the Cortes
# by Ola Jentzsch
###################################
scripted_trigger people_loving_councillor_trigger = {
	is_available_healthy_ai_adult = yes
	NOT = { is_vassal_of = root }
}

fp2_yearly.8001 = {
	type = character_event
	title = fp2_yearly.8001.t
	desc = fp2_yearly.8001.desc
	theme = realm

	left_portrait = {
		character = root
		animation = stress
	}
	right_portrait = {
		character = scope:commoner_enthusiast
		animation = chancellor
	}

	trigger = {
		has_fp2_dlc_trigger = yes
		any_held_county = { any_county_province = { geographical_region = world_europe_west_iberia } }

		culture = { has_cultural_pillar = heritage_iberian }

		government_has_flag = government_is_feudal

		highest_held_title_tier >= tier_kingdom

		gold < medium_gold_value

		any_councillor = {	people_loving_councillor_trigger = yes }
	}

 	cooldown = { years = 30 }

 	immediate = {
		random_councillor = {
			limit = { people_loving_councillor_trigger = yes }
			save_scope_as = commoner_enthusiast
		}
	}

	option = { #Invite the cities' representatives
		name = fp2_yearly.8001.a

		add_character_modifier = {
			modifier = cortes_modifier
			years = 20
		}

		add_prestige = medium_prestige_loss

		scope:commoner_enthusiast = {
			add_opinion = {
				target = root
				opinion = 10
				modifier = took_my_advice_opinion
			}
		}

		custom_tooltip = fp2_flavor.8001_vassal_opinion
		hidden_effect = {
			every_vassal = {
				IF = {
					limit = {
						OR = {
							has_trait = ambitious
							has_trait = arrogant
							has_trait = callous
							has_trait = cynical
							has_trait = wrathful
						}
					}
					add_opinion = {
						target = root
						opinion = -10
						modifier = privileges_to_people_opinion
					}
				}
			}
		}

		ai_chance = { #Administrative or visionary characters pick this option, but it's also the Christian thing to do
			base = 10
			ai_value_modifier = {
		   		ai_boldness = 0.5
				ai_compassion = 0.5
				ai_rationality = 0.6
				ai_zeal = 0.3
			}
   		}

   		stress_impact = {
			# Characters who are set in their ways or have no respect for common folk find this a very unappealing option.
			arrogant = medium_stress_impact_gain
			august = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}
	}

	option = { #Invite everyone! I mean everyone.
		name = fp2_yearly.8001.b

		trigger = {
			NOT = { has_character_modifier = associates_with_strange_peasants_modifier } #since this modifier is a re-use from one of the learning lifestyle events, this is a safety measure to prevent root from getting a double of the same modifier
		}

		add_character_modifier = {
			modifier = associates_with_strange_peasants_modifier
			years = 20
		}

		add_character_modifier = {
			modifier = extra_large_cortes_modifier
			years = 20
		}

		add_prestige = medium_prestige_loss

		scope:commoner_enthusiast = {
			add_opinion = {
				target = root
				opinion = 10
				modifier = took_my_advice_opinion
			}
		}

		ai_chance = { #this is picked by AI who are hypersocial to the point of madness, or visionary way beyond their time
			base = 10
			ai_value_modifier = {
		   		ai_boldness = 0.5
		   		ai_energy = 0.5
				ai_rationality = -0.5
				ai_greed = -0.5
				ai_vengefulness = -0.5
				ai_zeal = -0.3
			}
   		}

   		stress_impact = {
			# Characters who are careful or hate the masses find this a very unappealing option.
			eccentric = minor_stress_impact_loss
			craven = minor_stress_impact_gain
			arrogant = medium_stress_impact_gain
			august = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}
	}

	option = { #No, the nobles knows best, as we always have.
		name = fp2_yearly.8001.c

		add_prestige = medium_prestige_gain

		scope:commoner_enthusiast = {
			add_opinion = {
				target = root
				opinion = -10
				modifier = disappointed_opinion
			}
		}

		ai_chance = { #this is picked by AI who want to safeguard their privileges.
			base = 10
			ai_value_modifier = {
		   		ai_greed = 1
		   		ai_vengefulness = 0.5
		   		ai_rationality = 0.2
		   		ai_compassion = -0.5
		   		ai_energy = -0.5
			}
   		}

   		stress_impact = {
			# Characters who likes efficiency and democracy dislikes this option
			ambitious = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
			generous = minor_stress_impact_gain
		}
	}
}

###################################
# Dietary Dilemma
# By Ola Jentzsch
###################################
fp2_yearly.8002 = {
	type = character_event
	title = fp2_yearly.8002.t
	desc = fp2_yearly.8002.desc
	theme = faith
	override_background = { reference = council_chamber }

	left_portrait = {
		character = root
		animation = boredom
	}
	right_portrait = {
		character = scope:preoccupied_ulama
		animation = worry
	}

	trigger = {
		has_fp2_dlc_trigger = yes
		any_realm_province = { is_coastal = yes	}

		OR = {
			has_religion = religion:islam_religion
			has_religion = religion:judaism_religion
		}

		faith = {
			OR = {
				has_doctrine = tenet_religious_legal_pronouncements
				has_doctrine = tenet_literalism
				has_doctrine = tenet_adaptive
			}
		}

		any_held_title = { is_head_of_faith = no }

		exists = cp:councillor_court_chaplain
	}

	cooldown = { years = 50 }

	immediate = {

		cp:councillor_court_chaplain = { save_scope_as = preoccupied_ulama }

		random_realm_province = {
			limit = {
				is_coastal = yes
			}
			save_scope_as = beached_whale_province
		}
	}

	option = { #Make a ruling
		name = fp2_yearly.8002.a
		trigger = {
			OR = {
				has_trait = sayyid
				has_trait = crusader_king
				has_trait = order_member
				piety_level >= 4
				learning >= very_high_skill_rating
			}
		}

		add_character_modifier = {
			modifier = lay_ruler_issued_fatwa_modifier
			years = 10
		}

		scope:preoccupied_ulama = {
			add_opinion = {
				target = root
				opinion = -10
				modifier = dismissed_me_opinion
			}
		}

		ai_chance = { #rational AIs pick this option
			base = 10
			ai_value_modifier = {
		   		ai_boldness = 0.5
		   		ai_rationality = 0.9
				ai_zeal = -0.7
			}
   		}

		stress_impact = {
			# Craven character's don't wanna take the risk, and humble and trusting doesn't want to undermine the ulama
			craven = minor_stress_impact_gain
			humble = minor_stress_impact_gain
			trusting = minor_stress_impact_gain
		}
	}

	option = { #Just go to town on it
		name = fp2_yearly.8002.b

		scope:preoccupied_ulama = {
			add_opinion = {
				target = root
				opinion = -10
				modifier = dismissed_me_opinion
			}
		}

		random_list = {
			60 = {
				modifier = {
					add = 30
					has_trait = whole_of_body
				}
				send_interface_toast = {
					left_icon = root
					title = healthy_whale_toast
					add_character_modifier = {
						modifier = mystery_meat_health_benefits_modifier
						years = 10
					}
				}
			}
			40 = {
				send_interface_toast = {
					left_icon = root
					title = unhealthy_whale_toast
					add_character_modifier = {
						modifier = mystery_meat_unhealth_benefits_modifier
						years = 10
					}
				}
			}
		}

		ai_chance = { #hungry AI pick this option
        	base = 10
        	ai_value_modifier = {
           		ai_boldness = 0.5
            	ai_energy = -0.8
        	}
   		}

		stress_impact = { #temperate or cautious characters don't wanna eat strange blobs washed up from the Atlantic
			inappetetic = medium_stress_impact_gain
			temperate = minor_stress_impact_gain
			paranoid = minor_stress_impact_gain

			# but gluttons really wanna try it!
			comfort_eater = medium_stress_impact_loss
			gluttonous = medium_stress_impact_loss
			lifestyle_reveler = minor_stress_impact_loss
		}
	}

	option = { #Be cautious and wait for official ruling
		name = fp2_yearly.8002.c

		scope:preoccupied_ulama = {
			add_opinion = {
				target = root
				opinion = 20
				modifier = took_my_advice_opinion
			}
		}

		ai_chance = { #cautious but faithful AIs pick this option
        	base = 10
			ai_value_modifier = {
				ai_zeal = 0.7
				ai_boldness = -0.5
			}
   		}

		stress_impact = {
			# Ambitious or Impatient characters don't wanna wait for the ulama
			ambitious = minor_stress_impact_gain
			arbitrary = minor_stress_impact_gain
			arrogant = minor_stress_impact_gain
			impatient = medium_stress_impact_gain
		}
	}

	option = { #Burn the carcass, just to be safe
		name = fp2_yearly.8002.d

		add_dread = minor_dread_gain

		scope:preoccupied_ulama = {
			add_opinion = {
				target = root
				opinion = 10
				modifier = admires_resolve_opinion
			}
		}


		random = {
			chance = 10
			custom_tooltip = exploding_whale.tt
			send_interface_toast = {
				left_icon = root
				title = exploding_whale_toast
				root = {
   					increase_wounds_effect = { REASON = by_exploding_whale } #it can happen... :D
   				}
			}
		}

		ai_chance = { #overly zealous AIs pick this option
			base = 10
			ai_value_modifier = {
		   		ai_zeal = 1
				ai_energy = 0.5
			}
   		}

		stress_impact = {
			# Rational characters find this to be total overkill
			cynical = minor_stress_impact_gain

			#but zealous truly prefer to burn things
			zealous = medium_stress_impact_loss
		}
	}
}

###################################
# Flight of Fancy
# By Ola Jentzsch
###################################
# Inspired by an idea by Isabella welch
##########################################
fp2_yearly.8003 = {
	type = character_event
	title = fp2_yearly.8003.t
	desc = fp2_yearly.8003.desc
	theme = family
	left_portrait = {
		character = scope:enthusiastic_child
		animation = admiration
	}
	right_portrait = {
		character = scope:flying_polymath
		animation = beg
	}

	cooldown = { years = 125 } # Should be replaced with a playthrough cooldown (but global vars are too heavy atm)

	trigger = {
		has_fp2_dlc_trigger = yes
		is_landed = yes
		is_ai = no
		any_child = {
			is_available_child = yes
  			age >= 6
  			age <= 13
			NOT = { has_trait = blind }
		}
		has_trait = eccentric
		OR = {
			capital_province = { geographical_region = world_europe_west_iberia }
			culture = { has_cultural_pillar = heritage_iberian }
		}
	}

	weight_multiplier = {
		base = 0.4
		modifier = {
			AND = {
				current_year > 866
				current_year < 890
				NOT = { exists = global_var:ibnfirnas_created }
			}
			add = 0.6
		}
	}

	immediate = {

		random_child = {
			limit = {
				is_available_child = yes
  				age >= 6
  				age <= 13
				NOT = {	has_trait = blind}
			}
			save_scope_as = enthusiastic_child
		}

		root.capital_province = { save_scope_as = flight_capital }

		if = {
			limit = { #their rough period of activity
				AND = {
					current_year > 866
					current_year < 890
				}
				NOT = { exists = global_var:ibnfirnas_created } #makes sure that he wasn't already spawned by the event elsewhere (mostly relevant in multiplayer, since this is a player-only event)
			}
			create_character = {
				age = { 56 80 } #their rough age during the period of their flourishing
				location = root.capital_province
				name = "Abbas ibn Firnas" #Armen Firman
				gender = male
				template = scholar_character
				trait = intellect_good_1
				trait = lifestyle_poet
				trait = education_learning_4
				random_traits_list = { #his personality
					count = 3
					ambitious = {}
					brave = {}
					diligent = {}
					impatient = {}
				}
				culture = culture:baranis
				dynasty = none
				faith = faith:muwalladi
				save_scope_as = flying_polymath
			}
			set_global_variable = ibnfirnas_created
		}

		else = { #or it defaults to a random one
			create_character = {
				age = { 50 80 }
				location = root.capital_province
				template = scholar_character
				trait = intellect_good_2
				trait = education_learning_3
				trait = architect
				random_traits_list = {
					count = 3
					brave = {}
					calm = {}
					diligent = {}
					cynical = {}
					humble = {}
					patient = {}
				}
				culture = root.capital_province.culture
				faith = root.faith
				save_scope_as = flying_polymath
			}
		}
		hidden_effect = {
			add_random_tiered_trait_xp_effect = {
				TRAIT = lifestyle_physician
				LEVEL_1 = no
				LEVEL_3 = yes
			}
		}
	}

	option = { #Very well, I shall allow it
		name = fp2_yearly.8003.a
		flavor = fp2_yearly.8003_child_reaction


   		scope:enthusiastic_child = {
   			add_opinion = {
				target = root
				opinion = 30
				modifier = pleased_opinion
			}
   		}

   		random_list = {
	   		30 = {
	   			trigger = {
	   				scope:enthusiastic_child = {
	   					number_of_personality_traits <= 2
	   					NOT = { has_trait = brave }
	   				}
	   			}
				send_interface_toast = {
					title = polymath_flight_attempt_toast.success
					left_icon = scope:enthusiastic_child
					right_icon = scope:flying_polymath
					add_prestige = medium_prestige_gain
					add_courtier = scope:flying_polymath
					scope:enthusiastic_child = { add_trait_force_tooltip = brave }
				}
	   		}
	   		30 = {
				send_interface_toast = {
					title = polymath_flight_attempt_toast.success
					left_icon = scope:enthusiastic_child
					right_icon = scope:flying_polymath
					add_prestige = medium_prestige_gain
					add_courtier = scope:flying_polymath
				}
				modifier = {
					add = 30
	   				scope:enthusiastic_child = {
	   					OR = {
	   						number_of_personality_traits >= 3
	   						has_trait = brave
	   					}
	   				}
				}
	   		}
	   		20 = {
	   			trigger = {
	   				scope:enthusiastic_child = {
	   					number_of_personality_traits <= 2
	   					NOT = { has_trait = sadistic }
	   				}
	   			}
				send_interface_toast = {
					title = polymath_flight_attempt_toast.failure
					left_icon = scope:enthusiastic_child
					right_icon = scope:flying_polymath
					scope:flying_polymath = {
						death = { death_reason = death_flight_attempt }
					}
					scope:enthusiastic_child = { add_trait_force_tooltip = sadistic}
				}
			}
	   		20 = {
	   			trigger = {
	   				scope:enthusiastic_child = {
	   					NOT = { has_trait = depressed }
	   				}
	   			}
				send_interface_toast = {
					title = polymath_flight_attempt_toast.failure
					left_icon = scope:enthusiastic_child
					right_icon = scope:flying_polymath
					scope:flying_polymath = {
						death = { death_reason = death_flight_attempt }
					}
					scope:enthusiastic_child = { add_trait_force_tooltip = depressed_1 }
				}
				modifier = {
					add = 20
	   				scope:enthusiastic_child = {
	   					number_of_personality_traits >= 3
	   				}
				}
	   		}
	   		40 = {
	   			trigger = {
	   				scope:enthusiastic_child = {
						has_trait = depressed
			   			OR = {
			   				has_trait = brave
			   				has_trait = sadistic
			   			}
	   				}
	   			}
				send_interface_toast = {
					title = polymath_flight_attempt_toast.failure
					left_icon = scope:enthusiastic_child
					right_icon = scope:flying_polymath
					scope:flying_polymath = {
						death = { death_reason = death_flight_attempt }
					}
					scope:enthusiastic_child = { add_stress = minor_stress_gain }
				}
	   		}
	   	}

   		stress_impact = { #Compassionate people worry about bystanders getting hurt
   			compassionate = minor_stress_impact_gain
   			craven = minor_stress_impact_gain
   		}
	}



	option = { #I too, want to fly!
		name = fp2_yearly.8003.b

   		duel = { #time to fly!
			skill = learning
			value = high_skill_rating

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

					add_character_modifier = {
						modifier = saw_the_world_from_above_modifier
						years = 30
					}
					scope:enthusiastic_child = {
   						add_opinion = {
							target = root
							opinion = 30
							modifier = pleased_opinion
						}
   					}
   					random = {
   						chance = 50
   						root = { give_nickname = nick_the_flying }
   					}
				}
			}
			10 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = flight_attempt_toast.failure
					left_icon = root

					increase_wounds_effect = { REASON = flight_attempt }

					scope:enthusiastic_child = {
   						add_opinion = {
							target = root
							opinion = -20
							modifier = scared_opinion
						}
   					}
   					random = {
   						chance = 50
   						root = { give_nickname = nick_the_flightless }
   					}
				}
			}
		}

		stress_impact = { #cravens, contents and the bedridden don't wanna take the risk
   			craven = medium_stress_impact_gain
   			content = minor_stress_impact_gain
   			ill = minor_stress_impact_gain
   			infirm = medium_stress_impact_gain
   			brave = minor_stress_impact_loss
   		}
	}

	option = { #No, this is madness!
		name = fp2_yearly.8003.c

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

   		stress_impact = {
   			ambitious = minor_stress_impact_gain
   			brave = minor_stress_impact_gain
   			curious = minor_stress_impact_gain
   		}
	}
}

###################################
# Translation Schools
# By Ola Jentzsch
###################################
scripted_trigger fp2_yearly.8004_court_chaplain_traits = {
	has_council_position = councillor_court_chaplain
	learning >= excellent_skill_level
	is_available_ai_adult = yes
	NOT = {
		has_trait = dull
		has_trait = vengeful
		has_trait = zealous
	}
}

fp2_yearly.8004 = {
	type = character_event
	title = fp2_yearly.8004.t

	desc = {
		first_valid = {
			desc = fp2_yearly.8004.desc_opening
		}
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:translation_enthusiast = { fp2_yearly.8004_court_chaplain_traits = yes }
				}
				desc = fp2_yearly.8004.desc_chaplain
			}
			desc = fp2_yearly.8004.desc_wanderer
		}
	}


	theme = learning

	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:translation_enthusiast
		animation = chancellor
	}

	trigger = {
		has_fp2_dlc_trigger = yes
		OR = {
			AND = {
				exists = struggle:iberian_struggle
				struggle:iberian_struggle = { is_struggle_phase = struggle_iberia_phase_conciliation }
				fp2_character_involved_in_struggle_trigger = yes
			}
			AND = {
				has_global_variable = fp2_struggle_conciliation_ending
				root.capital_province = { geographical_region = world_europe_west_iberia }
			}
		}

		culture = { has_cultural_era_or_later = culture_era_high_medieval }
	}

	cooldown = { years = 100 }

	immediate = {

		if = { #This looks to see if Gerard of Cremona will be used in the event
			limit = { #his rough period of activity
				AND = {
					current_year > 1144
					current_year < 1190
				}
				NOT = { exists = global_var:gerard_of_cremona_created } #makes sure that he wasn't already spawned by the event elsewhere
				is_ai = no
			}
			create_character = {
				age = { 34 70 } #his rough age during the period of his flourishing
				location = root.capital_province
				name = "Gherardo da Cremona" #Gerard of Cremona
				gender = male
				template = scholar_character
				trait = scholar
				trait = education_learning_4
				random_traits_list = { #his personality
					count = 3
					diligent = {}
					impatient = {}
					calm = {}
					cynical = {}
				}
				culture = culture:italian
				dynasty = none
				faith = faith:catholic
				save_scope_as = translation_enthusiast #this is needed to get the loc right
			}
			set_global_variable = gerard_of_cremona_created
		}

		if = { #or a brilliant court chaplain, if you happen to have one
			limit = {
				NOT = { exists = scope:translation_enthusiast }
			}
			random_councillor = {
				limit = { fp2_yearly.8004_court_chaplain_traits = yes }
				save_scope_as = translation_enthusiast
			}
		}

		if = { #or it defaults to a random scholar
			limit = {
				NOT = { exists = scope:translation_enthusiast }
			}
			create_character = {
				age = { 32 50 }
				location = root.capital_province
				template = scholar_character
				trait = education_learning_3
				random_traits_list = {
					count = 3
					ambitious = {}
					calm = {}
					diligent = {}
					cynical = {}
					humble = {}
					patient = {}
				}
				culture = root.culture
				faith = root.faith
				save_scope_as = translation_enthusiast
			}
		}

		root.capital_county = { save_scope_as = translation_capital }
	}

	option = { #I shall spare #italic no#! expense to find the most capable people
		name = fp2_yearly.8004.a


		remove_treasury_or_gold = monumental_treasury_or_gold_value #this is expensive!

		if = {
			limit = {
				NOT = { cp:councillor_court_chaplain = scope:translation_enthusiast }
			}
			add_courtier = scope:translation_enthusiast #he's added to root's court
		}

		duel = { #you try to recruit a bunch of genius translators
			skill = learning
			value = very_high_skill_rating

			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 1
				}
				modifier = {
					add = 40
					has_trait = scholar
				}
				modifier = {
					add = 40
					has_trait = diligent
				}
				modifier = {
					add = 40
					has_trait = gregarious
				}
				modifier = {
					add = 40
					has_trait = diplomat
				}
				modifier = {
					add = 40
					has_trait = administrator
				}
				modifier = {
					add = 40
					culture = {	has_cultural_tradition = tradition_xenophilic }
				}
				modifier = {
					add = 60
					any_held_county = {
						any_county_province = {
							barony = title:b_toledo
						}
					}
				}
				modifier = {
					add = 60
					prestige_level >= high_prestige_level
				}
				send_interface_toast = { #you succeed!
					title = recruiting_brilliance_toast.success
					left_icon = root
					add_character_modifier = {
						modifier = great_translation_school_modifier
						years = 30
					}
					add_prestige = major_prestige_gain
					if = {
						limit = { is_ai = no }
						give_nickname = nick_the_wise
					}
				}
			}
			20 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -1
				}
				send_interface_toast = {
					title = recruiting_mediocrity_toast.failure
					left_icon = root
					add_character_modifier = {
						modifier = mediocre_translation_school_modifier
						years = 30
					}
					add_prestige = minor_prestige_gain
				}
			}
		}

		ai_chance = { #rational and ambitious AIs pick this option
			base = 10
			ai_value_modifier = {
		   		ai_rationality = 1
				ai_boldness = 0.7
				ai_zeal = -0.3
				ai_vengefulness = -0.5
			}
   		}

		stress_impact = {
			# Content or lazy characters don't want to make the effort
			content = minor_stress_impact_gain
			lazy = minor_stress_impact_gain

			# Nor do self-absorbed ones
			arrogant = minor_stress_impact_gain
			greedy = minor_stress_impact_gain

			#and impatient ones don't wanna wait
			impatient = minor_stress_impact_gain
		}
	}

	option = { #If you are so capable, #italic you#! can do all the translations
		name = fp2_yearly.8004.b

		remove_treasury_or_gold = medium_treasury_or_gold_value #this is expensive!


		if = {
			limit = {
				NOT = { cp:councillor_court_chaplain = scope:translation_enthusiast }
			}
			add_courtier = scope:translation_enthusiast #he's added to root's court
		}

		scope:translation_enthusiast = {
			add_opinion = {
   				target = root
   				opinion = -20
   				modifier = unfair_expectations_opinion
   			}
		}

		add_character_modifier = {
			modifier = translation_effort_modifier
			years = 30
		}

		ai_chance = { #rational and cautious AIs pick this option
			base = 10
			ai_value_modifier = {
		   		ai_rationality = 0.5
				ai_boldness = -0.4
			}
   		}

		stress_impact = {
			# self-absorbed cheapskates still don't want to pay for this
			arrogant = minor_stress_impact_gain
			greedy = minor_stress_impact_gain

			#and ambitious and diligent feel it's not enough
			ambitious = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
		}
	}

	option = { #I would rather have the books collecting dust..."
		name = fp2_yearly.8004.c

		add_character_modifier = {
			modifier = dusty_libraries_modifier
			years = 30
		}


		if = {
			limit = { cp:councillor_court_chaplain = scope:translation_enthusiast }
			scope:translation_enthusiast = {
				add_opinion = {
   					target = root
   					opinion = -20
   					modifier = disappointed_opinion
   				}
   			}
		}

		if = {
			limit = {
				NOT = { cp:councillor_court_chaplain = scope:translation_enthusiast }
			}
			scope:translation_enthusiast = { silent_disappearance_effect = yes }
		}

		ai_chance = { #zealous or ignorant AI pick this option
			base = 10
			ai_value_modifier = {
		   		ai_zeal = 0.5
				ai_vengefulness = 0.4
				ai_energy = -0.7
			}
   		}

		stress_impact = {
			# ambitious or learned characters cry from this
			ambitious = minor_stress_impact_gain
			diligent = minor_stress_impact_gain
			generous = minor_stress_impact_gain
			scholar = major_stress_impact_gain
		}
	}
}

###################################
# Under the Stone Pine
# by Ola Jentzsch
###################################
fp2_yearly.8005 = {
	type = character_event
	title = fp2_yearly.8005.t
	desc = {
		desc = fp2_yearly.8005.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					culture = { has_cultural_pillar = language_iberian }
				}
				desc = fp2_yearly.8005.desc_iberian
			}
			triggered_desc = {
				trigger = {
					culture = { has_cultural_pillar = language_arabic }
				}
				desc = fp2_yearly.8005.desc_arabic
			}
			desc = fp2_yearly.8005.desc_language_neutral
		}
		desc = fp2_yearly.8005.desc_middle_part
		first_valid = {
			triggered_desc = {
				trigger = { current_year >= 1120  }
				desc = fp2_yearly.8005.desc_post_troubadours
			}
			desc = fp2_yearly.8005.desc_pre_troubadours
		}
	}
	theme = love
	left_portrait = {
		character = root
		animation = sadness
	}

	cooldown = { years = 50 }

	trigger = {
		has_fp2_dlc_trigger = yes
		is_landed_or_landless_administrative = yes
		OR = {
			capital_province = { geographical_region = world_europe_west_iberia }
			culture = { has_cultural_pillar = heritage_iberian }
		}
	}

	immediate = {

		random_relation = {
			type = lover
			save_scope_as = courtly_lover
		}

		capital_county = { save_scope_as = tree_capital }
	}

	option = { #Embrace the love in your heart
	name = fp2_yearly.8005.a

		trigger = {
			any_relation = { type = lover }
			NOT = { has_trait = lifestyle_poet }
		}

   		add_trait = lifestyle_poet

   		scope:courtly_lover = {
   			add_opinion = {
   				target = root
   				opinion = 10
   				modifier = flattered_opinion
   			}
   		}

   		ai_chance = { #energetic, honorable and compassionate AI goes for this option
			base = 10
			ai_value_modifier = {
		   		ai_energy = 0.5
				ai_compassion = 0.6
				ai_honor = 0.5
				ai_rationality = -0.5
			}
   		}

   		stress_impact = {
   			chaste = major_stress_impact_gain
   			content = minor_stress_impact_gain
   			arrogant = major_stress_impact_gain
   			callous = major_stress_impact_gain
   		}
	}

	option = { #Feel something
	name = fp2_yearly.8005.b

		ai_chance = { #humble AI goes for this option
			base = 10
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_rationality = 0.5
				ai_honor = 0.5
			}
   		}

   		stress_impact = {
   			greedy = minor_stress_impact_gain
   			impatient = minor_stress_impact_gain
   			paranoid = minor_stress_impact_gain
   		}

   		add_character_modifier = {
   			modifier = felt_something_modifier
   			years = 10
   		}
	}



	option = { #Sponsor more musicians
	name = fp2_yearly.8005.c

   		remove_treasury_or_gold = medium_treasury_or_gold_value

   		add_character_modifier = {
   			modifier = investing_in_music_modifier
   			years = 25
   		}

   		ai_chance = { #energetic, constructive AI goes for this option
			base = 10
			ai_value_modifier = {
		   		ai_energy = 0.5
				ai_compassion = 0.5
				ai_rationality = 0.5
				ai_greed = -1
			}
   		}

   		stress_impact = {
   			content = minor_stress_impact_gain
   			greedy = minor_stress_impact_gain
   			lazy = minor_stress_impact_gain
   		}
	}

	option = { #Chop down the damned tree
	name = fp2_yearly.8005.d

   		add_character_modifier = {
   			modifier = aversion_to_joy_modifier
   			years = 20
   		}

   		scope:tree_capital = {
   			add_county_modifier = {
   				modifier = great_pine_chopped_down_county_modifier
   				years = 10
   			}
   		}

   		ai_chance = { #vengeful and uncompassionate AI goes for this option
			base = 10
			ai_value_modifier = {
				ai_vengefulness = 0.7
				ai_zeal = 0.3
				ai_compassion = -1
				ai_rationality = -0.5
			}
   		}

   		stress_impact = {
   			base = minor_stress_impact_gain
   			calm = medium_stress_impact_gain
   			compassionate = medium_stress_impact_gain
   			cynical = minor_stress_impact_gain
   			humble = minor_stress_impact_gain
   			arrogant = medium_stress_impact_loss
   			callous = medium_stress_impact_loss
   			vengeful = medium_stress_impact_loss
   		}
	}
}

###################################
# Saqaliba Settlers
# by Ola Jentzsch
###################################
scripted_trigger fp2_yearly.8006_province_trigger = {
	has_holding_type = city_holding
	barony = {
		is_under_holy_order_lease = no
		is_capital_barony = no
	}
}

scripted_trigger fp2_yearly.8006_ruler_trigger = {
	has_religion = religion:islam_religion
	is_ai = yes
}

fp2_yearly.8006 = {
	type = character_event
	title = fp2_yearly.8006.t
	desc = fp2_yearly.8006.desc
	theme = crown

	left_portrait = {
		character = root
		animation = personality_rational
	}

	right_portrait = {
		character = scope:saqaliba_leader
		animation = happiness
	}

	lower_left_portrait = {
		character = scope:former_master
	}

	trigger = {
		is_ai = no
		has_fp2_dlc_trigger = yes
		is_landed = yes
		any_neighboring_top_liege_realm_owner = { fp2_yearly.8006_ruler_trigger = yes }
		any_held_county = { any_county_province = {	fp2_yearly.8006_province_trigger = yes } }

		OR = { #implemented for FP3 to prevent triggering in Iran
			capital_province = { geographical_region = world_europe_west_iberia }
			culture = { has_cultural_pillar = heritage_iberian }
		}
	}

	cooldown = { years = 50 }

	immediate = {

		random_neighboring_top_liege_realm_owner = {
			limit = { fp2_yearly.8006_ruler_trigger = yes }
			save_scope_as = former_master
		}

		random_held_county = {
			limit = {
				any_county_province = {	fp2_yearly.8006_province_trigger = yes }
			}
			save_scope_as = saqaliba_county #for use in the claim the former_master might get
		}

		scope:saqaliba_county = {
			random_county_province = {
				limit = { fp2_yearly.8006_province_trigger = yes }
				barony = { save_scope_as = saqaliba_barony }
			}
		}

		create_character = { #this is the saqaliba refugee's leader
			age = { 20 50 }
			location = root.capital_province
			gender_female_chance = 50
			random_traits_list = {
				count = 3
				ambitious = {}
				brave = {}
				stubborn = {}
				honest = {}
				cynical = {}
			}
			random_traits_list = { #something fun to give them character!
				count = 2
				beauty_good_3 = {}
				overseer = {}
				shrewd = {}
				scarred = {}
			}
			culture = culture:russian
			faith = scope:former_master.faith
			dynasty = none
			save_scope_as = saqaliba_leader

			after_creation = {
				if = {
 					limit = { is_female = no }
 					add_trait = beardless_eunuch
 				}
			}
		}

		hidden_effect = {
			scope:saqaliba_leader = {
				add_character_modifier = former_slave_npc_modifier
			}
		}
	}

	option = { #Give them what they want
		name = fp2_yearly.8006.a

   		scope:saqaliba_leader = {
			add_opinion = {
				target = root
				opinion = 20
				modifier = received_title_barony
			}
		}

		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = yes
		}

		scope:saqaliba_barony = {
			change_title_holder = {
				holder = scope:saqaliba_leader
				change = scope:change
			}
		}

		resolve_title_and_vassal_change = scope:change


		scope:former_master = {
			if = {
				limit = { has_relation_rival = root	}
				custom_tooltip = {
					text = furious_rival_8006.desc
					hidden_effect = { add_unpressed_claim = scope:saqaliba_county }
				}
			}
			else = {
				progress_towards_rival_effect = {
					REASON = rival_saqalibas_refuge
					CHARACTER = root
					OPINION = 0
				}
			}
		}

		scope:saqaliba_county = {
			add_county_modifier = {
				modifier = saqaliba_settlers_county_modifier
				years = 30
			}
		}

		ai_chance = { #ambitious or compassionate AI goes for this option
			base = 10
			ai_value_modifier = {
				ai_boldness = 0.8
				ai_greed = 0.5
				ai_honor = 0.6
				ai_compassion = 0.6
			}
   		}

   		stress_impact = {
   			content = minor_stress_impact_gain
   			craven = minor_stress_impact_gain
   			paranoid = minor_stress_impact_gain
   			callous = minor_stress_impact_gain
   			sadistic = minor_stress_impact_gain
   		}
	}

	option = { #You can stay, but your friends must go elsewhere
		name = fp2_yearly.8006.b
		flavor = fp2_yearly.8006.flavor.b.tt


   		scope:former_master = {
   			add_opinion = {
   				target = root
   				opinion = -10
   				modifier = harbored_a_fugitive_opinion
   			}
   		}

   		add_courtier = scope:saqaliba_leader

   		ai_chance = { #cautious AI goes for this option
		 base = 10
			ai_value_modifier = {
		   		ai_boldness = -0.5
				ai_rationality = 0.5
				ai_compassion = -0.3
			}
   		}

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


	option = { #Send them back to their former master
		name = fp2_yearly.8006.c
		flavor = fp2_yearly.8006.flavor.c.tt


		if = {
  			limit = {
  				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:former_master }
   			}
			add_character_modifier = {
				modifier = obligations_fulfilled_modifier
				years = 10
			}
		}
		else = {
			add_hook = {
				type = favor_hook
				target = scope:former_master
			}
		}

		#Flag that scope:saqaliba_leader should leave.
		save_scope_as = disappear_saqaliba

		ai_chance = { #cruel AI go for this option
			base = 10
			ai_value_modifier = {
				ai_compassion = -1
				ai_rationality = 0.5
				ai_greed = 0.5
				ai_vengefulness = 0.5
			}
   		}

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

   	after = {
   		if = {
   			limit = { exists = scope:disappear_saqaliba }
   			scope:saqaliba_leader = { silent_disappearance_effect = yes }
   		}
 	}
}

###################################
# Conversos and Jewish events
# By James Beaumont
###################################
scripted_trigger valid_grantable_county_barony = {
	title_province = {
		geographical_region = world_europe_west_iberia
	}
	title_province = { has_building_or_higher = common_tradeport_01 }
	is_holy_site = no
	county.holder = {
		any_held_title = { # Make sure it isn't revoking their last title
			title_tier = county
			count >= 2
		}
	}
}

fp2_yearly.9000 = {
	type = character_event
	title = fp2_james.0001.t
	desc = fp2_james.0001.desc
	theme = secret
	override_background = {
		reference = docks
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:fp2_james_0001_jewish_trader
		animation = personality_bold
	}

	trigger = {
		NOT = { root.religion = religion:judaism_religion }
		highest_held_title_tier >= tier_county
		any_sub_realm_barony = {
			valid_grantable_county_barony = yes
		}
	}

	immediate = {
		random_sub_realm_barony = {
			limit = {
				valid_grantable_county_barony = yes
			}
			save_scope_as = fp2_james_0001_thriving_community
		}
		create_character = {
			template = spanish_jewish_merchant_character
			location = root.capital_province
			save_scope_as = fp2_james_0001_jewish_trader
		}
	}

	option = {
		name = fp2_james.0001.a
		scope:fp2_james_0001_thriving_community.county = {
			add_county_modifier = {
				modifier = fp2_jewish_community_denied_modifier
				years = 10
			}
		}
		scope:fp2_james_0001_jewish_trader.culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = low_negative_culture_acceptance
				desc = cultural_acceptance_gain_conversos_tolerance
			}
		}

		stress_impact = {
			callous = minor_stress_impact_loss
			greedy = minor_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = -0.5
				ai_greed = -0.5
				ai_zeal = 1.5
			}
		}
	}

	option = {
		name = fp2_james.0001.b
		trigger = {
			NOT = { # Prevent all of Iberia from converting
				any_county_in_region = {
					region = world_europe_west_iberia
					culture = culture:sephardi
				}
			}
		}
		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = no
		}
		scope:fp2_james_0001_thriving_community.county = {
			change_title_holder = {
				holder = scope:fp2_james_0001_jewish_trader
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		hidden_effect = {
			add_opinion = {
				target = scope:fp2_james_0001_jewish_trader
				modifier = received_title_county
			}
		}
		scope:fp2_james_0001_thriving_community.county = {
			add_county_modifier = {
				modifier = fp2_thriving_jewish_community_modifier
				years = 10
			}
			set_county_culture = scope:fp2_james_0001_jewish_trader.culture
			set_county_faith = scope:fp2_james_0001_jewish_trader.faith
		}
		scope:fp2_james_0001_jewish_trader.culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = medium_positive_culture_acceptance
				desc = cultural_acceptance_gain_conversos_tolerance
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = 1.5
				ai_greed = 1.5
				ai_zeal = -0.5
			}
		}
	}

	option = {
		name = fp2_james.0001.c
		scope:fp2_james_0001_thriving_community.county = {
			add_county_modifier = {
				modifier = fp2_thriving_jewish_community_modifier
				years = 10
			}
		}
		scope:fp2_james_0001_jewish_trader.culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = low_positive_culture_acceptance
				desc = cultural_acceptance_gain_conversos_tolerance
			}
		}

		stress_impact = {
			compassionate = minor_stress_impact_loss
			greedy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = 1.5
				ai_greed = 1.5
				ai_zeal = -0.5
			}
		}
	}
}

scripted_effect fp2_polish_should_heritage_israelite_get_upset_effect = {
	if = {
		limit = {
			scope:fp2_james_0002_conversos_character = { culture = { has_cultural_pillar = heritage_israelite } }
		}
		scope:fp2_james_0002_conversos_character.culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = low_negative_culture_acceptance
				desc = cultural_acceptance_loss_conversos_tolerance
			}
		}
	}
}

# Suspect Conversos of secretly praciticing Judaism
fp2_yearly.9001 = {
	type = character_event
	title = fp2_james.0002.t
	desc = fp2_james.0002.desc
	theme = secret
	override_background = {
		reference = temple
	}
	left_portrait = {
		character = root
		animation = paranoia
	}
	right_portrait = {
		character = scope:fp2_james_0002_conversos_character
		animation = personality_cynical
	}

	trigger = {
		OR = { root.religion = religion:eastern_orthodox_religion root.religion = religion:catholic_religion root.religion = religion:protestant_religion }
		is_landed = yes
		NOT = { faith = faith:conversos }
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			any_character_struggle = {
				is_struggle_type = iberian_struggle
				is_struggle_phase = struggle_iberia_phase_hostility
			}
		}
	}

	immediate = {
		every_sub_realm_county = {
			limit = {
				faith = faith:conversos
				holder = {
					liege = { # Don't convert player-Conversos territory
						OR = {
							is_ai = yes
							NOT = { faith = faith:conversos }
						}
					}
				}
			}
			add_to_list = fp2_james_0002_conversos_county
		}
		# Try to find a Conversos vassal if one exists
		if = {
			limit = {
				any_vassal = {
					faith = faith:conversos
					is_available_ai = yes
				}
			}
			random_vassal = {
				limit = {
					faith = faith:conversos
					is_available_ai = yes
				}
				save_scope_as = fp2_james_0002_conversos_character
			}
		}
		# Otherwise find a pool character
		else_if = {
			limit = {
				any_pool_character = {
					province = root.capital_province
					faith = faith:conversos
				}
			}
			random_pool_character = {
				province = root.capital_province
				limit = {
					faith = faith:conversos
				}
				save_scope_as = fp2_james_0002_conversos_character
			}
		}
		# Otherwise create one
		else = {
			create_character = {
				template = spanish_conversos_character
				location = root.capital_province
				save_scope_as = fp2_james_0002_conversos_character
			}
		}
		scope:fp2_james_0002_conversos_character = {
			random_list = {
				50 = {
					add_character_flag = is_secretly_jewish_flag
				}
				50 = {
				}
			}
		}
		# Get a religion for them to potentially be secretly praciticing
		religion:judaism_religion = {
			random_faith = {
				limit = { is_mainstream_jewish_faith = yes }
				save_scope_as = fp2_james_0002_jewish_faith
			}
		}
	}

	option = {
		name = fp2_james.0002.a
		custom_tooltip = fp2_james.0002.a.tt
		hidden_effect = {
			if = {
				limit = {
					scope:fp2_james_0002_conversos_character = { has_character_flag = is_secretly_jewish_flag }
				}
				send_interface_toast = {
					type = event_toast_effect_good
					title = fp2_james.0002.a.jewish_communities_thrive
					every_in_list = {
						list = fp2_james_0002_conversos_county
						set_county_faith = scope:fp2_james_0002_jewish_faith
					}
					scope:fp2_james_0002_conversos_character = {
						set_character_faith = scope:fp2_james_0002_jewish_faith
						every_vassal = {
							limit = {
								faith = faith:conversos
								is_available_ai = yes
							}
							set_character_faith = scope:fp2_james_0002_jewish_faith
						}
					}
				}
			}
			else = {
				send_interface_toast = {
					type = event_toast_effect_good
					title = fp2_james.0002.a.nothing_happened_toast
				}
			}
			fp2_polish_should_heritage_israelite_get_upset_effect = yes
		}

		stress_impact = {
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = -0.5
				ai_zeal = 1.5
			}
		}
	}

	option = {
		name = fp2_james.0002.b
		duel = {
			skill = intrigue
			target = scope:fp2_james_0002_conversos_character

			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				desc = fp2_james.0002.b.succesful_interrogation

				if = {
					limit = { scope:fp2_james_0002_conversos_character = { has_character_flag = is_secretly_jewish_flag } }

					send_interface_message = { # Begrudgingly added "unecessary" polish
						type = event_prison_good
						title = fp2_james.0002.t
						right_icon = scope:fp2_james_0002_conversos_character

						rightfully_imprison_character_effect = {
							TARGET = scope:fp2_james_0002_conversos_character
							IMPRISONER = root
						}
						fp2_polish_should_heritage_israelite_get_upset_effect = yes
					}
				}
				else = {
					send_interface_message = {
						type = event_intrigue_bad
						title = fp2_james.0002.a.offended_conversos
						right_icon = scope:fp2_james_0002_conversos_character

						reverse_add_opinion = {
							target = scope:fp2_james_0002_conversos_character
							modifier = hate_opinion
							opinion = -30
						}
						fp2_polish_should_heritage_israelite_get_upset_effect = yes
					}
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				desc = fp2_james.0002.b.failed_interrogation
				send_interface_message = {
					type = event_intrigue_bad
					title = fp2_james.0002.a.offended_conversos
					right_icon = scope:fp2_james_0002_conversos_character

					every_sub_realm_county = {
						custom = fp2_james_0002.b.failed_interrogation.tt
						limit = {
							faith = {
								religion = {
									OR = {
										this = religion:christianity_religion
										this = religion:judaism_religion
									}
								}
							}
						}
						add_county_modifier = {
							modifier = fp2_conversos_persecution_modifier
							years = 10
						}
					}
					reverse_add_opinion = {
						target = scope:fp2_james_0002_conversos_character
						modifier = hate_opinion
						opinion = -30
					}
					fp2_polish_should_heritage_israelite_get_upset_effect = yes
				}
			}
		}

		stress_impact = { compassionate = medium_stress_impact_gain }
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_zeal = 0.5
			}
		}
	}

	option = { # Imprison the suspect without trial
		name = fp2_james.0002.c

		send_interface_message = {
			type = event_prison_neutral
			title = fp2_james.0002.t
			right_icon = scope:fp2_james_0002_conversos_character

			imprison_character_effect = {
				TARGET = scope:fp2_james_0002_conversos_character
				IMPRISONER = root
			}
			fp2_polish_should_heritage_israelite_get_upset_effect = yes

			stress_impact = {
				compassionate = medium_stress_impact_gain
				diligent = medium_stress_impact_gain
				just = medium_stress_impact_gain
				callous = minor_stress_impact_loss
				sadistic = minor_stress_impact_loss
				zealous = minor_stress_impact_loss
			}
		}

		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				OR = {
					has_trait = compassionate
					has_trait = diligent
					has_trait = just
				}
			}
			modifier = {
				factor = 2
				OR = {
					has_trait = callous
					has_trait = sadistic
				}
				has_trait = zealous
			}
		}
	}
}

# Jewish people come fleeing persecution from a nearby realm
fp2_yearly.9002 = {
	type = character_event
	title = fp2_james.0003.t
	desc = fp2_james.0003.desc
	theme = secret
	override_background = {
		reference = throne_room
	}
	left_portrait = {
		character = root
		animation = paranoia
	}
	right_portrait = {
		character = scope:fp2_james_003_jewish_refugee_leader
		animation = beg
	}

	trigger = {
		NOT = { root.religion = religion:judaism_religion }
		NOT = { faith = faith:conversos }
		any_neighboring_and_across_water_top_liege_realm = { # There is someone to do persecuting
			holder = {
				is_ai = yes
				NOT = { root.religion = religion:judaism_religion }
				NOT = { faith = faith:conversos }
			}
		}
		highest_held_title_tier >= tier_county
		any_held_county = {
			is_landless_type_title = no
			title_province = {
				geographical_region = world_europe_west_iberia
			}
			NOT = { # Don't give away the capital
				this = this.holder.top_liege.capital_county
			}
			holder = {
				any_held_title = {
					title_tier = county
					count >= 2
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 1
			any_character_struggle = {
				is_struggle_type = iberian_struggle
				is_struggle_phase = struggle_iberia_phase_hostility
			}
		}
		modifier = {
			factor = 0.1
			any_county_in_region = {
				region = world_europe_west_iberia
				culture = culture:sephardi
			}
		}
	}

	immediate = {
		# Grab the neighbour for loc purposes
		random_neighboring_and_across_water_top_liege_realm = {
			limit = {
				holder = {
					is_ai = yes
					NOT = { root.religion = religion:judaism_religion }
					NOT = { faith = faith:conversos }
				}
			}
			holder = { save_scope_as = fp2_james_003_intolerant_ruler }
		}
		# find a pool character
		if = {
			limit = {
				any_pool_character = {
					province = root.capital_province
					religion = religion:judaism_religion
				}
			}
			random_pool_character = {
				province = root.capital_province
				limit = {
					religion = religion:judaism_religion
				}
				save_scope_as = fp2_james_003_jewish_refugee_leader
			}
		}
		# Otherwise create one
		else = {
			create_character = {
				template = spanish_jewish_merchant_character # May as well reuse the template
				location = root.capital_province
				save_scope_as = fp2_james_003_jewish_refugee_leader
			}
		}
		# Get a religion for them to potentially be secretly praciticing
		religion:judaism_religion = {
			random_faith = {
				limit = { is_mainstream_jewish_faith = yes }
				save_scope_as = fp2_james_0003_jewish_faith
			}
		}
		random_held_county = {
			limit = {
				is_landless_type_title = no
				title_province = {
					geographical_region = world_europe_west_iberia
				}
				NOT = { # Don't give away the capital
					this = this.holder.top_liege.capital_county
				}
				holder = {
					any_held_title = {
						title_tier = county
						count >= 2
					}
				}
			}
			weight = {
				modifier = { # Low-dev counties should be more highly considered
					add = 50
					development_level <= medium_development_level
				}
			}
			save_scope_as = fp2_james_0003_province_to_convert
		}
	}

	option = { # Offer the community protection in your realm
		name = fp2_james.0003.a
		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = no
		}
		scope:fp2_james_0003_province_to_convert.county = {
			change_title_holder = {
				holder = scope:fp2_james_003_jewish_refugee_leader
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		hidden_effect = {
			add_opinion = {
				target = scope:fp2_james_003_jewish_refugee_leader
				modifier = received_title_county
			}
		}
		scope:fp2_james_0003_province_to_convert.county = {
			change_development_level = 1
			if = {
				limit = {
					root = {
						is_ai = no
					}
					NOT = {
						any_county_in_region = {
							region = world_europe_west_iberia
							culture = culture:sephardi
						}
					}
				}
				set_county_culture = scope:fp2_james_003_jewish_refugee_leader.culture
				set_county_faith = scope:fp2_james_003_jewish_refugee_leader.faith
				add_county_modifier = {
					modifier = fp2_thriving_jewish_community_modifier
					years = 10
				}
			}
			else = {
				add_county_modifier = {
					modifier = fp2_thriving_jewish_community_modifier
					years = 10
				}
			}
		}
		scope:fp2_james_003_jewish_refugee_leader.culture = {
			change_cultural_acceptance = {
				target = root.culture
				value = medium_positive_culture_acceptance
				desc = cultural_acceptance_gain_conversos_tolerance
			}
		}

		stress_impact = {
			callous = minor_stress_impact_gain
			greedy = minor_stress_impact_gain
			compassionate = medium_stress_impact_loss
			zealous = medium_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = 1.5
				ai_zeal = -0.5
			}
		}
	}

	option = {
		name = fp2_james.0003.b
		scope:fp2_james_003_jewish_refugee_leader = { silent_disappearance_effect = yes }

		stress_impact = {
			paranoid = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			ai_value_modifier = {
				ai_honor = -0.5
				ai_zeal = 1.5
			}
		}
	}
}

###################################
# Toledan Nights
# By James Beaumont
###################################
fp2_yearly.9005 = {
	type = character_event
	title = fp2_james.0004.t
	desc = fp2_james.0004.desc
	theme = secret
	left_portrait = {
		character = root
		animation = paranoia
	}
	right_portrait = {
		character = scope:fp2_james_0004_murder_baron
		animation = scheme
	}

	trigger = {
		any_sub_realm_county = { # Are any of my realm's counties a hostile faith that is not governed by someone with protected religious rights?
			is_unprotected_hostile_faith = yes
			is_landless_type_title = no
		}
		OR = { # You have to be a bit of a monster to even consider this
			has_trait = zealous
			has_trait = sadistic
			has_trait = callous
			dread >= medium_dread
		}
	}

	immediate = {
		create_character = {
			template = toledan_night_character
			location = root.capital_province
			save_scope_as = fp2_james_0004_murder_baron
		}
		random_sub_realm_county = {
			limit = {
				is_unprotected_hostile_faith = yes
				is_landless_type_title = no
			}
			save_scope_as = fp2_james_0004_place_of_murder
			# If the holder is of that same hostile faith, murder them!
			if = {
				limit = {
					faith = holder.faith
					holder = {
						is_ai = yes
					}
				}
				holder = { save_scope_as = fp2_james_0004_murder_victim }
			}
		}
	}

	option = { # Go ahead and have some people murdered
		name = fp2_james.0004.a
		create_title_and_vassal_change = {
			type = granted
			save_scope_as = change
			add_claim_on_loss = no
		}
		scope:fp2_james_0004_place_of_murder = {
			change_title_holder = {
				holder = scope:fp2_james_0004_murder_baron
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
		hidden_effect = {
			add_opinion = {
				target = scope:fp2_james_0004_murder_baron
				modifier = received_title_county
			}
		}
		scope:fp2_james_0004_place_of_murder = {
			change_county_control = major_county_control_gain
			set_county_faith = root.faith
			add_county_modifier = {
				modifier = fp2_toledo_nights_modifier
				years = 10
			}
		}
		every_sub_realm_county = {
			limit = {
				faith = scope:fp2_james_0004_place_of_murder.faith
			}
			add_county_modifier = fp2_toledo_nights_fallout_modifier
		}
		add_hook = {
			type = favor_hook
			target = scope:fp2_james_0004_murder_baron
		}

		stress_impact = {
			just = massive_stress_impact_gain
			compassionate = major_stress_impact_gain
			forgiving = major_stress_impact_gain
			sadistic = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			paranoid = minor_stress_impact_loss
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				NOR = {
					has_trait = zealous
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}

	option = {
		name = fp2_james.0004.b
		scope:fp2_james_0004_murder_baron = { silent_disappearance_effect = yes }
		ai_chance = {
			base = 10
			modifier = {
				factor = 0.5
				OR = {
					has_trait = zealous
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}
}

###################################################
# Local bishop mad his church faces the wrong way #
# By James Beaumont								  #
###################################################
fp2_yearly.9006 = {
	type = character_event
	title = fp2_james.0005.t
	desc = {
		desc = fp2_james.0005.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion }
				}
				desc = fp2_james.0005.desc.christian
			}
			triggered_desc = {
				trigger = {
					religion = religion:islam_religion
				}
				desc = fp2_james.0005.desc.muslim
			}
		}
		desc = fp2_james.005.desc.outro
	}
	theme = faith
	left_portrait = {
		character = root
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:fp2_james_angry_priest
		animation = personality_zealous
	}

	trigger = {
		any_sub_realm_barony = { # There's a church held by a right-faith bishop in a wrong-faith province
			holder != root # Ensure it's not a lay-clergy player
			holder.faith = root.faith
			holder.capital_province = { has_holding_type = church_holding }
			is_unprotected_hostile_faith = yes
			OR = { # Mosque is now church or church is now mosque
				AND = {
					OR = { root.religion = religion:eastern_orthodox_religion root.religion = religion:catholic_religion root.religion = religion:protestant_religion }
					faith = { religion = religion:islam_religion }
				}
				AND = {
					root.religion = religion:islam_religion
					faith = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
				}
			}
		}
	}

	immediate = {
		random_sub_realm_barony = {
			limit = {
				holder != root
				holder.faith = root.faith
				holder.capital_province = { has_holding_type = church_holding }
				is_unprotected_hostile_faith = yes
				OR = {
					AND = {
						OR = { root.religion = religion:eastern_orthodox_religion root.religion = religion:catholic_religion root.religion = religion:protestant_religion }
						faith = { religion = religion:islam_religion }
					}
					AND = {
						root.religion = religion:islam_religion
						faith = { OR = { religion = religion:eastern_orthodox_religion religion = religion:catholic_religion religion = religion:protestant_religion } }
					}
				}
			}
			save_scope_as = fp2_james_wrong_temple
			holder = { save_scope_as = fp2_james_angry_priest }
		}
	}

	option = { # Change the orientation of the church
		name = fp2_james.0005.a
		remove_treasury_or_gold = medium_treasury_or_gold_value
		add_piety = medium_piety_gain
		scope:fp2_james_wrong_temple.county ={
			set_county_faith = root.faith
			add_county_modifier = {
				modifier = fp2_correctly_facing_church
				years = 15
			}
		}
		reverse_add_opinion = {
			target = scope:fp2_james_angry_priest
			modifier = grateful_opinion
			opinion = 20
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			zealous = minor_stress_impact_loss
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				has_trait = greedy
			}
		}
	}

	option = { # Tell the baron it's not worth the cost are you insane
		name = fp2_james.0005.b
		add_piety = minor_piety_loss
		reverse_add_opinion = {
			target = scope:fp2_james_angry_priest
			modifier = hate_opinion
			opinion = -25
		}

		stress_impact = {
			zealous = medium_stress_impact_gain
		}
		ai_chance = {
			base = 10
			modifier = {
				factor = 0
				has_trait = zealous
			}
		}
	}
}
