namespace = fp2_other_decisions

##################################################
# #Dynasty Decision Events
# 0001 - manage invite following the Celebration Decision
# 0002 - Feedback on the festival
##################################################





##################################################
# Celebration - Inviting guests
# by Maxence Voleau
# 0001 Invite guest in the background
##################################################

#Inviting guest from Celebration
fp2_other_decisions.0001 = {
	hidden = yes

	trigger = {
		# DLC checking
		has_fp2_dlc_trigger = yes
		# Standard check
		exists = var:number_prestigious_new_guests
	}

	immediate = {
		save_scope_as = host #Must be permanent for courtier_guest_management.1001

		# create list of available faith / culture
		every_sub_realm_county = {
			faith = {
				if = {
					limit = {
						NOT = {
							any_in_list = {
								list = potential_faiths
							}
						}
					}
					add_to_list = potential_faiths
				}
			}
			culture = {
				if = {
					limit = {
						NOT = {
							any_in_list = {
								list = potential_cultures
							}
						}
					}
					add_to_list = potential_cultures
				}
			}
		}

		# If the festival is grandiose, add faith / culture from neighbouring realms
		if = {
			limit = {
				exists = var:holding_quality
				var:holding_quality > 1
			}
			every_neighboring_and_across_water_realm_same_rank_owner = {
				every_sub_realm_county = {
					faith = {
						if = {
							limit = {
								NOT = {
									any_in_list = {
										list = potential_faiths
									}
								}
							}
							add_to_list = potential_faiths
						}
					}
					culture = {
						if = {
							limit = {
								NOT = {
									any_in_list = {
										list = potential_cultures
									}
								}
							}
							add_to_list = potential_cultures
						}
					}
				}
			}
		}


		# If the festival is at max level, add faith and culture from the whole diplomatic range
		if = {
			limit = {
				exists = var:holding_quality
				var:holding_quality > 2
			}
			every_ruler = {
				limit = {
					in_diplomatic_range = scope:host
				}
				every_sub_realm_county = {
					faith = {
						if = {
							limit = {
								NOT = {
									any_in_list = {
										list = potential_faiths
									}
								}
							}
							add_to_list = potential_faiths
						}
					}
					culture = {
						if = {
							limit = {
								NOT = {
									any_in_list = {
										list = potential_cultures
									}
								}
							}
							add_to_list = potential_cultures
						}
					}
				}
			}
		}

		# Pick a faith and a culture from the list to forward it to the template
		random_in_list = {
			list = potential_faiths
			save_scope_as = guest_faith
		}

		random_in_list = {
			list = potential_cultures
			save_scope_as = guest_culture
		}


		#Randomly select a type of character and generate it
		random_list = {
			# Skilled Martial / Commander
			100 = {
				# lower the value for each commander already generated
				modifier = {
					exists = var:nb_commander_generated
					add = {
						value = var:nb_commander_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_commander_generated }
					change_variable = {
						name = nb_commander_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_commander_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_martial_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Diplomat
			100 = {

				# lower the value for each diplomat already generated
				modifier = {
					 exists = var:nb_diplomat_generated
					add = {
						value = var:nb_diplomat_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_diplomat_generated }
					change_variable = {
						name = nb_diplomat_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_diplomat_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_diplomat_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Spy
			100 = {

				# lower the value for each spy already generated
				modifier = {
					exists = var:nb_spy_generated
					add = {
						value = var:nb_spy_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_spy_generated }
					change_variable = {
						name = nb_spy_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_spy_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_spy_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Steward
			100 = {

				# lower the value for each spy already generated
				modifier = {
					exists = var:nb_steward_generated
					add = {
						value = var:nb_steward_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_steward_generated }
					change_variable = {
						name = nb_steward_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_steward_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_steward_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Hunter
			100 = {
				# lower the value for each hunter already generated
				modifier = {
					exists = var:nb_hunter_generated
					add = {
						value = var:nb_hunter_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_hunter_generated }
					change_variable = {
						name = nb_hunter_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_hunter_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_hunter_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Priest
			100 = {
				trigger = {
					# can replace the court chaplain
					faith = {
						has_doctrine_parameter = clerical_appointment_fixed
					}
				}

				# lower the value for each priest already generated
				modifier = {
					exists = var:nb_priest_generated
					add = {
						value = var:nb_priest_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_priest_generated }
					change_variable = {
						name = nb_priest_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_priest_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_martial_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Scholar
			100 = {
				# lower the value for each scholar already generated
				modifier = {
					exists = var:nb_scholar_generated
					add = {
						value = var:nb_scholar_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_scholar_generated }
					change_variable = {
						name = nb_scholar_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_scholar_generated
						value = 1
					}
				}

				create_character = {
					template = celebration_scholar_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}

			# Skilled Artisan - default wait is lower has they are going to be inspired
			50 = {
				trigger = {
					# Only for RoCo owners
					has_ep1_dlc_trigger = yes
					# has_royal_court = yes # Should check royal court?
				}

				# lower the value for each artisan already generated
				modifier = {
					exists = var:nb_artisan_generated
					add = {
						value = var:nb_artisan_generated
						multiply = -20
					}
				}

				if = {
					limit = { exists = var:nb_artisan_generated }
					change_variable = {
						name = nb_artisan_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_artisan_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_artisan_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}


			# Chess Master
			100 = {
				trigger = {
					# As the Strategy game tradition
				}

				# lower the value for each priest already generated
				modifier = {
					exists = var:nb_chessmaster_generated
					add = {
						value = var:nb_chessmaster_generated
						multiply = -5
					}
				}

				if = {
					limit = { exists = var:nb_chessmaster_generated }
					change_variable = {
						name = nb_chessmaster_generated
						add = 1
					}
				}
				else = {
					set_variable = {
						name = nb_chessmaster_generated
						value = 1
					}
				}

				# Generate the actual character
				create_character = {
					template = celebration_chessmaster_character
					location = root.capital_province
					save_scope_as = new_guest
				}
			}
		}


		#Does claimant exist? Send it my way and count down the variable
		if = {
			limit = { exists = scope:new_guest }

			add_visiting_courtier = scope:new_guest

			scope:new_guest = {
				save_scope_as = guest #For courtier_guest_management.1001
				trigger_event = courtier_guest_management.1001 #For message
			}
			change_variable = {
				name = number_prestigious_new_guests
				subtract = 1
			}
		}

		#Either end the chain or resend this event
		if = {
			limit = { var:number_prestigious_new_guests = 0 }
			remove_variable = number_prestigious_new_guests
			remove_variable = holding_quality

			if = {	limit = { exists = var:nb_commander_generated } remove_variable = nb_commander_generated }
			if = {	limit = { exists = var:nb_diplomat_generated } remove_variable = nb_diplomat_generated }
			if = {	limit = { exists = var:nb_spy_generated } remove_variable = nb_spy_generated }
			if = {	limit = { exists = var:nb_steward_generated } remove_variable = nb_steward_generated }
			if = {	limit = { exists = var:nb_hunter_generated } remove_variable = nb_hunter_generated }
			if = {	limit = { exists = var:nb_priest_generated } remove_variable = nb_priest_generated }
			if = {	limit = { exists = var:nb_scholar_generated } remove_variable = nb_scholar_generated }
			if = {	limit = { exists = var:nb_artisan_generated } remove_variable = nb_artisan_generated }
			if = {	limit = { exists = var:nb_chessmaster_generated } remove_variable = nb_chessmaster_generated }
		}
		else = {
			trigger_event = {
				id = fp2_other_decisions.0001
				days = { 10 20 }
			}
		}
	}
}

###################################################
## Council of Toledo - Organization
## by Joe Parkin and Ola Jentzsch
## 0700 Decide who to invite
###################################################
#
#scripted_effect fetch_council_toledo_priest_effect = {
#	if = {
#		limit = { exists = cp:councillor_court_chaplain }
#		cp:councillor_court_chaplain = { save_scope_as = council_priest }
#	}
#	else = {
#		random_vassal_or_below = {
#			limit = {
#				NOR = {
#					government_has_flag = government_is_republic
#					government_has_flag = government_is_feudal
#				}
#				OR = {
#					has_trait = devoted
#					has_education_learning_trigger = yes
#				}
#			}
#			save_scope_as = council_priest
#		}
#	}
#}
#
#scripted_effect fp2_struggle_council_toledo_attendee_effect = {
#	hidden_effect = {
#		if = {
#			limit = { government_has_flag = government_is_theocracy }
#			random = {
#				chance = 25
#				fp2_council_toledo_attendee_modifier = yes
#				add_to_list = $LIST$
#			}
#		}
#		if = {
#			limit = {
#				exists = cp:councillor_court_chaplain
#				cp:councillor_court_chaplain = { fp2_struggle_council_toledo_attendee_trigger = yes }
#			}
#			cp:councillor_court_chaplain = {
#				random = {
#					chance = 25
#					fp2_council_toledo_attendee_modifier = yes
#					add_to_list = $LIST$
#				}
#			}
#		}
#	}
#}
#
#scripted_effect fp2_council_toledo_guest_populate_effect = {
#	while = {
#		limit = {
#			any_in_list = {
#				list = $LIST$
#				NOT = { is_in_list = council_toledo_guest_list }
#			}
#			any_in_list = {
#				list = $LIST$
#				count < 10
#				is_in_list = council_toledo_guest_list
#			}
#		}
#		random_in_list = {
#			list = $LIST$
#			limit = {
#				NOT = { is_in_list = council_toledo_guest_list }
#			}
#			weight = {
#				modifier = { factor = learning }
#				modifier = {
#					factor = 10
#					is_landed = yes
#				}
#				modifier = {
#					factor = 10
#					has_trait = theologian
#				}
#			}
#			add_to_list = council_toledo_guest_list
#		}
#	}
#}
#
#fp2_other_decisions.0700 = {
#	type = character_event
#	title = fp2_other_decisions.0700.t
#	desc = {
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					exists = global_var:council_of_toledo_counter
#					global_var:council_of_toledo_counter = 19
#				}
#				desc = fp2_other_decisions.0700.19
#			}
#			desc = fp2_other_decisions.0700.desc
#		}
#	}
#	theme = faith
#	override_background = { reference = temple_church }
#	left_portrait = {
#		character = scope:council_priest
#		animation = chaplain
#	}
#	lower_right_portrait = {
#		trigger = {
#			exists = faith.religious_head
#			faith = {
#				portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#				religious_head != root
#			}
#		}
#		character = faith.religious_head
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#		# Decision triggers
#		fp2_struggle_council_toledo_decision_trigger = yes
#
#	}
#
#	immediate = {
#		save_scope_as = council_toledo_host
#		fetch_council_toledo_priest_effect = yes
#		scope:council_priest = { add_to_list = council_toledo_guest_list }
#		hidden_effect = {
#			religion = {
#				every_faith = {
#					limit = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#					every_faith_ruler = {
#						limit = {
#							primary_title.tier >= tier_county
#							exists = capital_county
#							capital_county.title_province = { geographical_region = world_europe_west_iberia }
#						}
#						fp2_struggle_council_toledo_attendee_effect = { LIST = council_toledo_mozarab_list }
#					}
#				}
#				every_faith = {
#					limit = {
#						NOT = {
#							portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#						}
#					}
#					every_faith_ruler = {
#						limit = {
#							in_diplomatic_range = root
#							primary_title.tier >= tier_county
#							faith = {
#								OR = {
#									portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#									portrait_religious_faith_or_foundational_trigger = { FAITH = faith:catholic }
#								}
#							}
#						}
#						fp2_struggle_council_toledo_attendee_effect = { LIST = council_toledo_regional_list }
#					}
#				}
#			}
#		}
#		custom_tooltip = fp2_other_decisions.0700.tt
#	}
#
#	# Default option: Local council
#	option = {
#		name = fp2_other_decisions.0700.a
#		# Attendees
#		show_as_tooltip = {
#			title:c_toledo = {
#				add_county_modifier = {
#					modifier = fp2_small_council_modifier
#					years = 5
#				}
#			}
#		}
#		religion = {
#			every_faith = {
#				limit = {
#					this != root.faith
#					religious_head ?= { in_diplomatic_range = root }
#				}
#				religious_head = { add_to_list = hof_list }
#			}
#		}
#		every_in_list = {
#			list = hof_list
#			custom = excluded_from_council_toledo_tt
#			add_opinion = {
#				target = root
#				modifier = fp2_excluded_from_council_toledo_opinion
#				opinion = -10
#			}
#		}
#		ai_chance = {
#			base = 100
#		}
#	}
#
#	# Default option: Regional council
#	option = {
#		name = fp2_other_decisions.0700.b
#		add_character_flag = {
#			flag = regional_toledo_council 
#			months = 2
#		}
#		remove_treasury_or_gold = medium_treasury_or_gold_value
#		hidden_effect = {
#			while = {
#				count = 10
#				random_in_list = {
#					list = council_toledo_regional_list
#					limit = {
#						NOT = { is_in_list = council_toledo_guest_list }
#					}
#					weight = {
#						modifier = { factor = learning }
#						modifier = {
#							factor = 10
#							is_landed = yes
#						}
#						modifier = {
#							factor = 10
#							has_trait = theologian
#						}
#					}
#					add_to_list = council_toledo_guest_list
#				}
#			}
#		}
#		show_as_tooltip = {
#			title:c_toledo = {
#				random_list = {
#					1 = {
#						desc = fp2_other_decisions.0700.b.success
#						show_chance = no
#						add_county_modifier = {
#							modifier = fp2_big_council_modifier
#							years = 5
#						}
#					}
#					1 = {
#						desc = fp2_other_decisions.0700.b.failure
#						show_chance = no
#						add_county_modifier = {
#							modifier = fp2_disappointing_council_modifier
#							years = 5
#						}
#					}
#				}
#			}
#		}
#		stress_impact = {
#			zealous = medium_stress_impact_gain
#			greedy = medium_stress_impact_gain
#			arrogant = medium_stress_impact_gain
#		}
#		ai_chance = {
#			base = 50
#		}
#	}
#
#	after = {
#		# Attendees
#		# Populate guest list
#		hidden_effect = {
#			while = {
#				count = 10
#				random_in_list = {
#					list = council_toledo_mozarab_list
#					limit = {
#						NOT = { is_in_list = council_toledo_guest_list }
#					}
#					weight = {
#						modifier = { factor = learning }
#						modifier = {
#							factor = 10
#							is_landed = yes
#						}
#						modifier = {
#							factor = 10
#							has_trait = theologian
#						}
#					}
#					add_to_list = council_toledo_guest_list
#				}
#			}
#			if = {
#				limit = {
#					any_in_list = { list = council_toledo_mozarab_list }
#				}
#				every_in_list = {
#					list = council_toledo_mozarab_list
#					remove_from_list = council_toledo_mozarab_list
#				}
#			}
#			if = {
#				limit = {
#					any_in_list = { list = council_toledo_regional_list }
#				}
#				every_in_list = {
#					list = council_toledo_regional_list
#					remove_from_list = council_toledo_regional_list
#				}
#			}
#		}
#		trigger_event = {
#			on_action = fp2_struggle_council_toledo_attend
#			days = { 14 21 }
#		}
#	}
#}
#
###################################################
## Council of Toledo - Arrival
## by Joe Parkin and Ola Jentzsch
## 0701 See who turned up
###################################################
#
#scripted_trigger fp2_council_toledo_successful_regional_trigger = {
#	has_character_flag = regional_toledo_council
#	any_in_list = {
#		list = council_toledo_guest_list
#		count > council_toledo_success_guest_value
#		faith = {
#			NOT = {
#				portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#			}
#		}
#	}
#}
#
#scripted_trigger fp2_council_toledo_failure_regional_trigger = {
#	has_character_flag = regional_toledo_council
#	any_in_list = {
#		list = council_toledo_guest_list
#		count <= council_toledo_success_guest_value
#		faith = {
#			NOT = {
#				portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#			}
#		}
#	}
#}
#
#scripted_trigger fp2_council_toledo_flavor_bishop_trigger = {
#	exists = scope:portrait_bishop
#	exists = scope:$TYPE$_bishop
#	scope:portrait_bishop = scope:$TYPE$_bishop
#}
#
#fp2_other_decisions.0701 = {
#	type = character_event
#	title = fp2_other_decisions.0701.t
#	desc = {
#		first_valid = {
#			triggered_desc = {
#				trigger = { fp2_council_toledo_successful_regional_trigger = yes }
#				desc = fp2_other_decisions.0701.opening.success
#			}
#			triggered_desc = {
#				trigger = { fp2_council_toledo_failure_regional_trigger = yes }
#				desc = fp2_other_decisions.0701.opening.failure
#			}
#			triggered_desc = {
#				trigger = { has_character_flag = regional_toledo_council }
#				desc = fp2_other_decisions.0701.opening.catastrophe
#			}
#			desc = fp2_other_decisions.0701.opening
#		}
#		# Attendee flavor
#		random_valid = {
#			triggered_desc = {
#				trigger = {
#					exists = scope:portrait_bishop
#					scope:portrait_bishop = root.faith.religious_head
#				}
#				desc = fp2_other_decisions.0701.religious_head_bishop
#			}
#			triggered_desc = {
#				trigger = {
#					fp2_council_toledo_flavor_bishop_trigger = { TYPE = powerful }
#				}
#				desc = fp2_other_decisions.0701.powerful_bishop
#			}
#			triggered_desc = {
#				trigger = {
#					fp2_council_toledo_flavor_bishop_trigger = { TYPE = saint }
#				}
#				desc = fp2_other_decisions.0701.saint_bishop
#			}
#			triggered_desc = {
#				trigger = {
#					fp2_council_toledo_flavor_bishop_trigger = { TYPE = theologian }
#				}
#				desc = fp2_other_decisions.0701.theologian_bishop
#			}
#			triggered_desc = {
#				trigger = {
#					fp2_council_toledo_flavor_bishop_trigger = { TYPE = bad }
#				}
#				desc = fp2_other_decisions.0701.bad_bishop
#			}
#			triggered_desc = {
#				trigger = {
#					fp2_council_toledo_flavor_bishop_trigger = { TYPE = senior }
#				}
#				desc = fp2_other_decisions.0701.senior_bishop
#			}
#		}
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					has_character_flag = regional_toledo_council
#					any_in_list = {
#						list = council_toledo_guest_list
#						count < council_toledo_success_guest_value
#						faith = {
#							NOT = {
#								portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#							}
#						}
#					}
#				}
#				desc = fp2_other_decisions.0701.failure
#			}
#			desc = fp2_other_decisions.0701.desc
#		}
#	}
#	theme = faith
#	override_background = { reference = temple_church }
#	left_portrait = scope:portrait_bishop
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#		# Decision triggers
#		fp2_struggle_council_toledo_decision_trigger = yes
#	}
#
#	immediate = {
#		# Attendee flavor
#		if = {
#			limit = {
#				any_in_list = {
#					list = council_toledo_guest_list
#					this = root.faith.religious_head
#				}
#			}
#			random_in_list = {
#				list = council_toledo_guest_list
#				limit = { this = root.faith.religious_head }
#				save_scope_as = religious_head_bishop
#			}
#		}
#		if = {
#			limit = {
#				any_in_list = {
#					list = council_toledo_guest_list
#					primary_title.tier > tier_county
#				}
#			}
#			ordered_in_list = {
#				list = council_toledo_guest_list
#				limit = { primary_title.tier > tier_county }
#				order_by = primary_title.tier
#				save_scope_as = powerful_bishop
#			}
#		}
#		if = {
#			limit = {
#				any_in_list = {
#					list = council_toledo_guest_list
#					has_trait = saint
#				}
#			}
#			ordered_in_list = {
#				list = council_toledo_guest_list
#				limit = { has_trait = saint }
#				order_by = piety_level
#				save_scope_as = saint_bishop
#			}
#		}
#		if = {
#			limit = {
#				any_in_list = {
#					list = council_toledo_guest_list
#					has_trait = theologian
#				}
#			}
#			ordered_in_list = {
#				list = council_toledo_guest_list
#				limit = { has_trait = theologian }
#				order_by = learning
#				save_scope_as = theologian_bishop
#			}
#		}
#		if = {
#			limit = {
#				any_in_list = {
#					list = council_toledo_guest_list
#					num_sinful_traits > 0
#				}
#			}
#			ordered_in_list = {
#				list = council_toledo_guest_list
#				limit = { num_sinful_traits > 1 }
#				order_by = num_sinful_traits
#				save_scope_as = bad_bishop
#			}
#		}
#		if = {
#			limit = {
#				OR = {
#					exists = scope:powerful_bishop
#					exists = scope:saint_bishop
#					exists = scope:theologian_bishop
#					exists = scope:bad_bishop
#				}
#			}
#			hidden_effect = {
#				random_list = {
#					10 = {
#						trigger = { exists = scope:religious_head_bishop }
#						scope:religious_head_bishop = { save_scope_as = portrait_bishop }
#					}
#					1 = {
#						trigger = { exists = scope:powerful_bishop }
#						modifier = {
#							add = 4
#							scope:powerful_bishop.primary_title.tier >= tier_kingdom
#						}
#						scope:powerful_bishop = { save_scope_as = portrait_bishop }
#					}
#					5 = {
#						trigger = { exists = scope:saint_bishop }
#						scope:saint_bishop = { save_scope_as = portrait_bishop }
#					}
#					5 = {
#						trigger = { exists = scope:theologian_bishop }
#						scope:theologian_bishop = { save_scope_as = portrait_bishop }
#					}
#					1 = {
#						trigger = { exists = scope:bad_bishop }
#						scope:bad_bishop = { save_scope_as = portrait_bishop }
#					}
#				}
#			}
#		}
#		else = {
#			ordered_in_list = {
#				list = council_toledo_guest_list
#				order_by = age
#				save_scope_as = senior_bishop
#				save_scope_as = portrait_bishop
#			}
#		}
#	}
#
#	# Default option: Local council
#	option = {
#		name = {
#			trigger = { fp2_council_toledo_successful_regional_trigger = yes }
#			text = fp2_other_decisions.0701.a
#		}
#		name = {
#			trigger = { fp2_council_toledo_failure_regional_trigger = yes }
#			text = fp2_other_decisions.0701.b
#		}
#		name = {
#			trigger = {
#				NOT = { has_character_flag = regional_toledo_council }
#			}
#			text = fp2_other_decisions.0701.c
#		}
#		if = {
#			limit = { fp2_council_toledo_successful_regional_trigger = yes }
#			title:c_toledo = {
#				add_county_modifier = {
#					modifier = fp2_big_council_modifier
#					years = 5
#				}
#			}
#		}
#		else_if = {
#			limit = { has_character_flag = regional_toledo_council }
#			title:c_toledo = {
#				add_county_modifier = {
#					modifier = fp2_disappointing_council_modifier
#					years = 5
#				}
#			}
#		}
#		else = {
#			title:c_toledo = {
#				add_county_modifier = {
#					modifier = fp2_small_council_modifier
#					years = 5
#				}
#			}
#		}
#	}
#
#	after = {
#		custom_tooltip = fp2_other_decisions.0701.tt
#		trigger_event = {
#			on_action = fp2_struggle_council_toledo_debate
#			days = { 3 6 }
#		}
#	}
#}
#
###################################################
## Council of Toledo - Debate
## by Joe Parkin and Ola Jentzsch
## 0702 Bicker with them
###################################################
#
#scripted_effect fp2_council_toledo_debate_bishop_effect = {
#	save_scope_value_as = {
#		name = mozarabic
#		value = flag:$MOZARABIC$
#	}
#	random_in_list = {
#		list = council_toledo_guest_list
#		limit = {
#			this != scope:council_priest
#			faith = {
#				trigger_if = {
#					limit = { scope:mozarabic = flag:yes }
#					portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#				}
#				trigger_else = {
#					NOT = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#				}
#			}
#		}
#		weight = {
#			modifier = {
#				factor = 4
#				has_trait = theologian
#			}
#		}
#		save_scope_as = debate_bishop
#	}
#	if = {
#		limit = { 
#			NOT = {
#				exists = scope:debate_bishop 
#			}
#		}
#		create_character = {
#			age = { 35 75 } 
#			location = root.capital_province
#			gender_female_chance = root_faith_dominant_gender_female_chance 
#			trait = zealous 
#			faith = faith:mozarabic_church 
#			culture = root.culture 
#			learning = {
#				min_template_high_skill
#				max_template_high_skill
#			}
#		
#			save_scope_as = debate_bishop 	 
#
#			after_creation = {
#				add_character_flag = {
#					flag = need_priest_outfit
#				}
#				add_character_flag = {
#					flag = need_a_ruler
#				}
#			}
#		}
#	}
#	random_in_list = {
#		list = council_toledo_guest_list
#		limit = {
#			trigger_if = {
#				limit = {
#					exists = scope:debate_bishop
#				}
#				this != scope:debate_bishop
#				trigger_if = {
#					limit = {
#						scope:debate_bishop.faith = {
#							portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#						}
#					}
#					NOT = {
#						faith = {
#							portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#						}
#					}
#				}
#				trigger_else = {
#					faith = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#				}
#			}			
#		}
#		alternative_limit = {
#			NOR = {
#				this = scope:council_priest
#				trigger_if = {
#					limit = {
#						exists = scope:debate_bishop
#					}
#					this = scope:debate_bishop
#				}
#			}
#		}
#		weight = {
#			modifier = {
#				factor = 4
#				has_trait = theologian
#			}
#		}
#		save_scope_as = counter_bishop
#	}
#}
#
#scripted_effect fp2_council_opinion_mozarabic_effect = {
#	hidden_effect = {
#		every_in_list = {
#			list = council_toledo_guest_list
#			limit = {
#				NOR = {
#					this = scope:debate_bishop
#					this = scope:counter_bishop
#				}
#				liege = root
#				faith = {
#					portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#				}
#			}
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = $VALUE$
#			}
#		}
#		every_in_list = {
#			list = council_toledo_guest_list
#			limit = {
#				NOR = {
#					this = scope:debate_bishop
#					this = scope:counter_bishop
#					liege = root
#				}
#				faith = {
#					portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#				}
#			}
#			custom = fp2_council_opinion_mozarabic_effect_tt
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = $VALUE$
#			}
#		}
#	}
#}
#
#scripted_effect fp2_council_opinion_other_effect = {
#	if = {
#		limit = {
#			any_in_list = {
#				list = council_toledo_guest_list
#				faith = {
#					NOT = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#				}
#			}
#		}
#		hidden_effect = {
#			every_in_list = {
#				list = council_toledo_guest_list
#				limit = {
#					NOR = {
#						this = scope:debate_bishop
#						this = scope:counter_bishop
#					}
#					liege = root
#					faith = {
#						NOT = {
#							portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#						}
#					}
#				}
#				add_opinion = {
#					target = root
#					modifier = fp2_council_toledo_opinion
#					opinion = $VALUE$
#				}
#			}
#			every_in_list = {
#				list = council_toledo_guest_list
#				limit = {
#					NOR = {
#						this = scope:debate_bishop
#						this = scope:counter_bishop
#						liege = root
#					}
#					faith = {
#						NOT = {
#							portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#						}
#					}
#				}
#				custom = fp2_council_opinion_other_effect_tt
#				add_opinion = {
#					target = root
#					modifier = fp2_council_toledo_opinion
#					opinion = $VALUE$
#				}
#			}
#		}
#	}
#}
#
#scripted_effect fp2_council_modifier_effect = {
#	scope:council_toledo_faith = {
#		every_faith_ruler = {
#			limit = { primary_title.tier >= tier_county }
#			custom = council_of_toledo_ruler_effect_tt
#			add_character_modifier = {
#				modifier = $MODIFIER$
#				years = council_toledo_modifier_duration_value
#			}
#			if = {
#				limit = {
#					is_ai = no
#					this != root
#				}
#				trigger_event = fp2_other_decisions.0704
#			}
#		}
#	}
#}
#
#scripted_effect fp2_council_strife_catalyst_effect = {
#	struggle:iberian_struggle = {
#		if = {
#			limit = { is_struggle_phase = struggle_iberia_phase_compromise }
#			change_struggle_phase = struggle_iberia_phase_opportunity
#		}
#		else_if = {
#			limit = {
#				is_struggle_phase = struggle_iberia_phase_opportunity
#
#			}
#			change_struggle_phase = struggle_iberia_phase_hostility
#		}
#	}
#}
#
#scripted_effect fp2_council_peace_catalyst_effect = {
#	struggle:iberian_struggle = {
#		if = {
#			limit = { is_struggle_phase = struggle_iberia_phase_compromise }
#			change_struggle_phase = struggle_iberia_phase_conciliation
#		}
#		else_if = {
#			limit = {
#				is_struggle_phase = struggle_iberia_phase_hostility 
#
#			}
#			change_struggle_phase = struggle_iberia_phase_compromise
#		}
#	}
#}
#
#fp2_other_decisions.0702 = {
#	type = character_event
#	title = fp2_other_decisions.0702.t
#	desc = {
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					exists = global_var:council_of_toledo_counter
#					global_var:council_of_toledo_counter = 19
#				}
#				desc = fp2_other_decisions.0702.19
#			}
#			desc = fp2_other_decisions.0702.opening
#		}
#		first_valid = { # Conversion
#		    triggered_desc = {
#		        trigger = { var:council_toledo_issue = 1 }
#		        desc = fp2_other_decisions.0702.conversion
#		    }
#		    triggered_desc = { # Reform
#		        trigger = { var:council_toledo_issue = 2 }
#		        desc = fp2_other_decisions.0702.reform
#		    }
#		    triggered_desc = { # Tolerance
#		        trigger = { var:council_toledo_issue = 3 }
#		        desc = fp2_other_decisions.0702.tolerance
#		    }
#		    triggered_desc = { # Clergy Rights
#		        trigger = { var:council_toledo_issue = 4 }
#		        desc = fp2_other_decisions.0702.rights
#		    }
#		    triggered_desc = { # New HoF
#		        trigger = { var:council_toledo_issue = 5 }
#		        desc = fp2_other_decisions.0702.hof
#		    }
#		    triggered_desc = { # Closer to Pope
#		        trigger = { var:council_toledo_issue = 6 }
#		        desc = fp2_other_decisions.0702.pope
#		    }
#		    triggered_desc = { # Target Heresy
#		        trigger = { var:council_toledo_issue = 7 }
#		        desc = fp2_other_decisions.0702.heresy
#		    }
#		}
#		first_valid = {
#		    triggered_desc = {
#		        trigger = {
#		        	faith = { has_doctrine = doctrine_theocracy_lay_clergy }
#		        }
#		        desc = fp2_other_decisions.0702.present
#		    }   
#		    desc = fp2_other_decisions.0702.second_hand
#		}
#	}
#	theme = faith
#	override_background = { reference = temple_church }
#	left_portrait = scope:debate_bishop
#	right_portrait = scope:counter_bishop
#	lower_right_portrait = scope:rival_scope
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#		# Decision triggers
#		fp2_struggle_council_toledo_decision_trigger = yes
#	}
#
#	immediate = {
#		fetch_council_toledo_priest_effect = yes
#		faith = { save_scope_as = council_toledo_faith }
#		hidden_effect = {
#			random_list = {
#				10 = { # Conversion
#					trigger = {
#						NOT = {
#							faith = { has_doctrine = doctrine_pluralism_pluralistic }
#						}
#						root = {
#							any_realm_county = {
#								religion != root.religion
#							}
#						}
#					}
#					fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#					set_variable = {
#						name = council_toledo_issue
#						value = 1
#					}
#				}
#				5 = { # Reform
#					trigger = {
#						NOT = { exists = faith.var:foundational_faith } # set on reform
#					}
#					modifier = {
#						factor = 2
#						has_perk = prophet_perk
#					}
#					fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#					set_variable = {
#						name = council_toledo_issue
#						value = 2
#					}
#				}
#				10 = { # Tolerance
#					trigger = {
#						NOT = {
#							faith = { has_doctrine = doctrine_pluralism_fundamentalist }
#						}
#					}
#					fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#					every_culture_global = {		
#						limit = {
#							this != root.culture
#							NOT = { has_same_culture_heritage = root.culture }
#							save_temporary_scope_as = this_culture
#							trigger_if = {
#								limit = {
#									struggle:iberian_struggle = { is_culture_involved_in_struggle = scope:this_culture }
#								}
#								struggle:iberian_struggle = { is_culture_involved_in_struggle = scope:this_culture }
#							}
#							trigger_else = {
#								any_culture_duchy = {
#									title_province ?= { geographical_region = world_europe_west_iberia }
#								}
#							}
#							culture_number_of_counties > 0
#						}
#						add_to_list = fp2_council_culture_list
#					}
#					set_variable = {
#						name = council_toledo_issue
#						value = 3
#					}
#				}
#				5 = { # Clergy Opinion
#					modifier = {
#						factor = 2
#						any_vassal = {
#							count >= 2
#							government_has_flag = government_is_theocracy
#						}
#					}
#					fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#					set_variable = {
#						name = council_toledo_issue
#						value = 4
#					}
#				}
#				5 = { # New HoF
#					trigger = {
#						any_in_list = {
#							list = council_toledo_guest_list
#							percent >= 0.5
#							is_in_list = council_toledo_mozarab_list
#						}
#						faith != faith.religious_head.faith
#					}
#					modifier = {
#						factor = 2
#						faith.religious_head.faith.num_county_followers < root.faith.num_county_followers
#					}
#					modifier = {
#						factor = 2
#						has_trait = excommunicated
#					}
#					modifier = {
#						factor = 2
#						reverse_opinion = {
#							target = faith.religious_head
#							value < -25
#						}
#					}
#					fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#					set_variable = {
#						name = council_toledo_issue
#						value = 5
#					}
#				}
#				5 = { # Closer to Pope
#					trigger = {
#						faith = { has_doctrine = special_doctrine_ecumenical_christian }
#						NOT = { has_trait = excommunicated }
#						faith != faith.religious_head.faith
#					}
#					modifier = {
#						factor = 2
#						reverse_opinion = {
#							target = title:k_papal_state.holder
#							value > 25
#						}
#					}
#					modifier = {
#						factor = 2
#						faith.religious_head.faith.num_county_followers > root.faith.num_county_followers
#					}
#					random_list = {
#						1 = {
#							fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#						}
#						50 = {
#							fp2_council_toledo_debate_bishop_effect = { MOZARABIC = no }
#						}
#					}
#					# if the priest is in no court
#					if = {
#						limit = {
#							exists = scope:debate_bishop
#							scope:debate_bishop = {
#								has_character_flag = need_a_ruler
#							}
#						}
#						root = { add_courtier = scope:debate_bishop }
#					}
#					set_variable = {
#						name = council_toledo_issue
#						value = 6
#					}
#				}
#				10 = { # Target Heresy
#					trigger = {
#						any_county_in_region = {
#							region = world_europe_west_iberia
#							faith = {
#								religion = root.faith.religion
#								NOT = {
#									portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#								}
#								NOT = { exists = religious_head }
#							}
#						}
#					}
#					random_county_in_region = {
#						region = world_europe_west_iberia
#						limit = {
#							faith = {
#								religion = root.faith.religion
#								NOT = {
#									portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#								}
#								NOT = { exists = religious_head }
#							}
#						}
#						faith = { save_scope_as = heretic_faith }
#					}
#					random_list = {
#						1 = {
#							fp2_council_toledo_debate_bishop_effect = { MOZARABIC = yes }
#						}
#						1 = {
#							fp2_council_toledo_debate_bishop_effect = { MOZARABIC = no }
#						}
#					}
#					set_variable = {
#						name = council_toledo_issue
#						value = 7
#					}
#				}
#			}
#		}
#		if = {
#			limit = {
#				any_relation = {
#					type = rival
#					faith = root.faith
#				}
#			}
#			save_scope_as = rival_scope
#		}
#		custom_tooltip = fp2_council_end_tt
#	}
#
#	option = { # Accept
#		name = fp2_other_decisions.0702.a
#		add_piety = medium_piety_value
#		scope:debate_bishop = {
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = {
#					value = 10
#					multiply = 2
#				}
#			}
#		}
#		scope:counter_bishop = {
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = {
#					value = -10
#					multiply = 2
#				}
#			}
#		}
#		switch = {
#			trigger = var:council_toledo_issue
#			1 = { # Conversion
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_conversion_modifier }
#				custom_tooltip = fp2_council_conversion_modifier_tt
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = 5 }
#				fp2_council_strife_catalyst_effect = yes
#				stress_impact = {
#					cynical = minor_stress_impact_gain
#				}
#			}
#			2 = { # Reform
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_reform_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = -10 }
#				stress_impact = {
#					zealous = minor_stress_impact_gain
#				}
#			}
#			3 = { # Tolerance
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_tolerance_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = 10 }
#				hidden_effect = {
#					every_in_list = {
#						list = fp2_council_culture_list
#						root.culture = {
#							change_cultural_acceptance = {
#								target = prev
#								value = council_toledo_culture_acceptance_value
#								desc = fp2_council_toledo_culture_acceptance_desc
#							}
#						}
#					}
#				}
#				custom_tooltip = fp2_council_culture_tt
#				fp2_council_peace_catalyst_effect = yes
#				stress_impact = {
#					arrogant = minor_stress_impact_gain
#				}
#			}
#			4 = { # Clergy Rights
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_rights_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = 5 }
#				stress_impact = {
#					greedy = minor_stress_impact_gain
#					cynical = minor_stress_impact_gain
#				}
#			}
#			5 = { # New HoF
#				reverse_add_opinion = {
#					target = faith.religious_head
#					modifier = fp2_council_toledo_new_hof_opinion
#				}
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_hof_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = -10 }
#				stress_impact = {
#					humble = minor_stress_impact_gain
#				}
#			}
#			6 = { # Closer to Pope
#				reverse_add_opinion = {
#					target = faith.religious_head
#					modifier = fp2_council_toledo_pope_opinion
#				}
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_pope_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = 10 }
#				stress_impact = {
#					arrogant = minor_stress_impact_gain
#				}
#			}
#			7 = { # Target Heresy
#				custom_tooltip = fp2_council_heresies_modifier_tt
#				fp2_council_modifier_effect = { MODIFIER = fp2_council_heresy_modifier }
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = 10 }
#				stress_impact = {
#					cynical = minor_stress_impact_gain
#				}
#			}
#		}
#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0.5
#				OR = {
#					var:council_toledo_issue = 1
#					var:council_toledo_issue = 4
#					var:council_toledo_issue = 7
#				}
#				has_trait = cynical
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 2
#				has_trait = zealous
#			}
#			modifier = {
#				factor = 0.5
#				OR = {
#					var:council_toledo_issue = 3
#					var:council_toledo_issue = 6
#				}
#				has_trait = arrogant
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 4
#				has_trait = greedy
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 5
#				has_trait = humble
#			}
#		}
#	}
#
#	option = { # Veto
#		name = {
#			trigger = { faith.religious_head = root }
#			text = fp2_other_decisions.0702.b.hof
#		}
#		name = {
#			trigger = {
#				faith.religious_head != root
#			}
#			text = fp2_other_decisions.0702.b
#		}
#		add_piety = minor_piety_loss
#		add_character_modifier = {
#			modifier = fp2_stifled_council_modifier
#			years = 5
#		}
#		scope:debate_bishop = {
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = {
#					value = -10
#					multiply = 2
#				}
#			}
#		}
#		scope:counter_bishop = {
#			add_opinion = {
#				target = root
#				modifier = fp2_council_toledo_opinion
#				opinion = {
#					value = 10
#					multiply = 2
#				}
#			}
#		}
#		switch = {
#			trigger = var:council_toledo_issue
#			1 = { # Conversion
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = -5 }
#				fp2_council_peace_catalyst_effect = yes
#				stress_impact = {
#					zealous = minor_stress_impact_gain
#				}
#			}
#			2 = { # Reform
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = 10 }
#				stress_impact = {
#					cynical = minor_stress_impact_gain
#				}
#			}
#			3 = { # Tolerance
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = -10 }
#				fp2_council_strife_catalyst_effect = yes
#				stress_impact = {
#					humble = minor_stress_impact_gain
#				}
#			}
#			4 = { # Clergy Rights
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = -5 }
#				stress_impact = {
#					zealous = minor_stress_impact_gain
#					generous = minor_stress_impact_gain
#				}
#			}
#			5 = { # New HoF
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = 10 }
#				stress_impact = {
#					arrogant = minor_stress_impact_gain
#				}
#			}
#			6 = { # Closer to Pope
#				fp2_council_opinion_mozarabic_effect = { VALUE = 10 }
#				fp2_council_opinion_other_effect = { VALUE = -10 }
#				stress_impact = {
#					humble = minor_stress_impact_gain
#				}
#			}
#			7 = { # Target Heresy
#				fp2_council_opinion_mozarabic_effect = { VALUE = -10 }
#				fp2_council_opinion_other_effect = { VALUE = -10 }
#				stress_impact = {
#					zealous = minor_stress_impact_gain
#				}
#			}
#		}
#		stress_impact = {
#			just = medium_stress_impact_gain
#		}
#		ai_chance = {
#			base = 100
#			modifier = {
#				factor = 0.5
#				OR = {
#					var:council_toledo_issue = 1
#					var:council_toledo_issue = 4
#					var:council_toledo_issue = 7
#				}
#				has_trait = zealous
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 2
#				has_trait = cynical
#			}
#			modifier = {
#				factor = 0.5
#				OR = {
#					var:council_toledo_issue = 3
#					var:council_toledo_issue = 6
#				}
#				has_trait = humble
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 4
#				has_trait = generous
#			}
#			modifier = {
#				factor = 0.5
#				var:council_toledo_issue = 5
#				has_trait = arrogant
#			}
#		}
#	}
#
#	after = { remove_variable = council_toledo_issue }
#}
#
## Cancellation due to loss of control or war
#fp2_other_decisions.0703 = {
#	type = character_event
#	title = fp2_other_decisions.0703.t
#	desc = {
#		first_valid = {
#		    triggered_desc = {
#		        trigger = { is_at_war = yes }
#		        desc = fp2_other_decisions.0703.war
#		    }
#		    desc = fp2_other_decisions.0703.control
#		}
#		desc = fp2_other_decisions.0703.desc
#	}
#	theme = learning_theology_focus
#	override_background = { reference = temple_church }
#	left_portrait = {
#		character = root
#		animation = personality_zealous
#	}
#	right_portrait = {
#		character = scope:council_priest
#		animation = chaplain
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#		# Decision triggers
#		fp2_struggle_council_toledo_decision_trigger = no
#	}
#
#	immediate = {
#		fetch_council_toledo_priest_effect = yes
#		change_global_variable = {
#			name = council_of_toledo_counter
#			add = -1
#		}
#		if = {
#			limit = { is_at_war = yes }
#			ordered_character_war = {
#				order_by = {
#					value = 0
#					subtract = war_days
#				}
#				save_scope_as = council_war
#			}
#		}
#		title:c_toledo = {
#			if = {
#				limit = { has_county_modifier = fp2_small_council_modifier }
#				remove_county_modifier = fp2_small_council_modifier
#			}
#			else_if = {
#				limit = { has_county_modifier = fp2_big_council_modifier }
#				remove_county_modifier = fp2_big_council_modifier
#			}
#			else_if = {
#				limit = { has_county_modifier = fp2_disappointing_council_modifier }
#				remove_county_modifier = fp2_disappointing_council_modifier
#			}
#		}
#		add_gold = council_of_toledo_gold_cost_value
#		add_piety = council_of_toledo_piety_cost_value
#	}
#
#	option = {
#		name = fp2_other_decisions.0703.a
#		remove_decision_cooldown = council_of_toledo_decision
#	}
#}
#
#fp2_other_decisions.0704 = {
#	type = character_event
#	title = fp2_other_decisions.0704.t
#	desc = {
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					exists = global_var:council_of_toledo_counter
#					global_var:council_of_toledo_counter = 19
#				}
#				desc = fp2_other_decisions.0702.19
#			}
#			desc = fp2_other_decisions.0702.opening
#		}
#		first_valid = {
#		    triggered_desc = { # Conversion
#		        trigger = { has_character_modifier = fp2_council_conversion_modifier }
#		        desc = fp2_other_decisions.0702.conversion
#		    }
#		    triggered_desc = { # Reform
#		        trigger = { has_character_modifier = fp2_council_tolerance_modifier }
#		        desc = fp2_other_decisions.0702.reform
#		    }
#		    triggered_desc = { # Tolerance
#		        trigger = { has_character_modifier = fp2_council_reform_modifier }
#		        desc = fp2_other_decisions.0702.tolerance
#		    }
#		    triggered_desc = { # Clergy Rights
#		        trigger = { has_character_modifier = fp2_council_rights_modifier }
#		        desc = fp2_other_decisions.0702.rights
#		    }
#		    triggered_desc = { # Ecumenical dialogue
#		       trigger = { has_character_modifier = fp2_council_pope_modifier }
#		        desc = fp2_other_decisions.0702.pope
#		    }
#		    triggered_desc = { # New HoF
#		        trigger = { has_character_modifier = fp2_council_hof_modifier }
#		        desc = fp2_other_decisions.0702.hof
#		    }
#		    triggered_desc = { # Target Heresy
#		        trigger = { has_character_modifier = fp2_council_heresy_modifier }
#		        desc = fp2_other_decisions.0702.heresy
#		    }
#		}
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					OR = {
#						has_character_modifier = fp2_council_conversion_modifier
#						has_character_modifier = fp2_council_tolerance_modifier
#						has_character_modifier = fp2_council_reform_modifier
#						has_character_modifier = fp2_council_rights_modifier
#						has_character_modifier = fp2_council_hof_modifier
#						has_character_modifier = fp2_council_pope_modifier
#						has_character_modifier = fp2_council_heresy_modifier
#					}
#				}
#				desc = fp2_other_decisions.0704.success
#			}
#			desc = fp2_other_decisions.0704.failure
#		}
#	}
#	theme = learning_theology_focus
#	override_background = { reference = temple_church }
#	left_portrait = {
#		character = scope:council_toledo_host
#		triggered_animation = {
#			trigger = {
#				NOT = { has_character_modifier = fp2_stifled_council_modifier }
#			}
#			animation = personality_zealous
#		}
#		triggered_animation = {
#			trigger = { has_character_modifier = fp2_stifled_council_modifier }
#			animation = anger
#		}
#	}
#	right_portrait = {
#		character = scope:council_priest
#		animation = chaplain
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#	}
#
#	option = {
#		name = fp2_other_decisions.0704.a
#		show_as_tooltip = {
#			if = {
#				limit = {
#					OR = {
#						has_character_modifier = fp2_council_conversion_modifier
#						has_character_modifier = fp2_council_tolerance_modifier
#						has_character_modifier = fp2_council_reform_modifier
#						has_character_modifier = fp2_council_rights_modifier
#						has_character_modifier = fp2_council_hof_modifier
#						has_character_modifier = fp2_council_pope_modifier
#						has_character_modifier = fp2_council_heresy_modifier
#					}
#				}
#				switch = {
#					trigger = has_character_modifier
#					fp2_council_conversion_modifier = {
#						custom_tooltip = fp2_council_conversion_modifier_tt
#						add_character_modifier = {
#							modifier = fp2_council_conversion_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_tolerance_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_tolerance_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_reform_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_reform_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_rights_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_rights_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_pope_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_pope_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_hof_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_hof_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_pope_modifier = {
#						add_character_modifier = {
#							modifier = fp2_council_pope_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#					fp2_council_heresy_modifier = {
#						custom_tooltip = fp2_council_heresies_modifier_tt
#						add_character_modifier = {
#							modifier = fp2_council_heresy_modifier
#							years = council_toledo_modifier_duration_value
#						}
#					}
#				}
#			}
#			else = {
#				scope:council_toledo_host = {
#					add_character_modifier = {
#						modifier = fp2_stifled_council_modifier
#						years = council_toledo_modifier_duration_value
#					}
#				}
#			}
#		}
#	}
#}
###################################################
## Secure Iberian Foothold - Notification
## by Joe Parkin and Ola Jentzsch
## 1000 Decision taker event
###################################################
#
#fp2_other_decisions.1000 = {
#	type = character_event
#	title = fp2_other_decisions.1000.t
#	desc = {
#		first_valid = {
#		    triggered_desc = {
#		        trigger = {
#					religion = {
#						any_faith = {
#							struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#						}
#					}
#		        }
#		        desc = fp2_other_decisions.1000.involved_religion
#		    }
#		    desc = fp2_other_decisions.1000.desc
#		}
#		first_valid = {
#		    triggered_desc = {
#		        trigger = {
#					struggle:iberian_struggle = { is_faith_involved_in_struggle = root.faith }
#		        }
#		        desc = fp2_other_decisions.1000.involved_faith
#		    }
#		    triggered_desc = {
#		        trigger = {
#					religion = {
#						any_faith = {
#							struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#						}
#					}
#		        }
#		        desc = fp2_other_decisions.1000.uninvolved_faith
#		    }
#		    desc = fp2_other_decisions.1000.closing
#		}
#	}
#	theme = realm
#	left_portrait = {
#		character = root
#		animation = war_over_win
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#	}
#
#	immediate = {
#		save_scope_as = iberian_footholder
#		every_held_title = {
#			limit = {
#				# Any de jure kingdom of Iberia is completely controlled
#				fp2_struggle_secure_iberian_foothold_iberian_kingdom_trigger = yes
#				# That kingdom is mostly my faith
#				fp2_struggle_secure_iberian_foothold_faith_trigger = yes
#				scope:iberian_kingdom_temp = { title_held_years >= fp2_struggle_secure_iberian_foothold_years_value }
#			}
#			add_to_list = iberian_footholder_list
#		}
#		hidden_effect  = {
#			while = {
#				limit = {
#					any_in_list = {
#						list = iberian_footholder_list
#						# Borders held lands in a non-Iberian kingdom you hold
#						any_de_jure_county = {
#							any_title_to_title_neighboring_and_across_water_county = { fp2_struggle_secure_iberian_foothold_outsider_kingdom_trigger = yes }
#						}
#						NOT = { is_in_list = iberian_footholder_transfer_list }
#					}
#				}
#				random_in_list = {
#					list = iberian_footholder_list
#					limit = {
#						# Borders held lands in a non-Iberian kingdom you hold
#						any_de_jure_county = {
#							any_title_to_title_neighboring_and_across_water_county = { fp2_struggle_secure_iberian_foothold_outsider_kingdom_trigger = yes }
#						}
#						NOT = { is_in_list = iberian_footholder_transfer_list }
#					}
#					random_de_jure_county = {
#						limit = {
#							any_title_to_title_neighboring_and_across_water_county = { fp2_struggle_secure_iberian_foothold_outsider_kingdom_trigger = yes }
#						}
#						random_title_to_title_neighboring_and_across_water_county = {
#							limit = { fp2_struggle_secure_iberian_foothold_outsider_kingdom_trigger = yes }
#							empire = { save_scope_as = transfer_empire }
#						}
#					}
#					add_to_list = iberian_footholder_transfer_list
#					set_de_jure_liege_title = scope:transfer_empire
#					custom_tooltip = iberian_footholder_transfer_tt
#				}
#			}
#		}
#		show_as_tooltip = {
#			every_in_list = {
#				list = iberian_footholder_transfer_list
#				set_de_jure_liege_title = scope:transfer_empire
#			}
#		}
#	}
#
#	option = {
#		name = fp2_other_decisions.1000.a
#	}
#
#	after = {
#		struggle:iberian_struggle = {
#			every_involved_ruler = {
#				limit = { is_ai = no }
#				trigger_event = fp2_other_decisions.1001
#			}
#		}
#		# End Struggle
#		struggle:iberian_struggle = {
#			end_struggle = secure_iberian_foothold_decision_title
#		}
#	}
#}
#
###################################################
## Secure Iberian Foothold - Notification
## by Joe Parkin and Ola Jentzsch
## 1001 Info event
###################################################
#
#fp2_other_decisions.1001 = {
#	type = character_event
#	title = fp2_other_decisions.1000.t
#	desc = {
#		first_valid = {
#		    triggered_desc = {
#		        trigger = {
#					scope:iberian_footholder.religion = {
#						any_faith = {
#							struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#						}
#					}
#		        }
#		        desc = fp2_other_decisions.1001.involved_religion
#		    }
#		    desc = fp2_other_decisions.1001.desc
#		}
#		first_valid = {
#		    triggered_desc = {
#		        trigger = {
#					struggle:iberian_struggle = { is_faith_involved_in_struggle = scope:iberian_footholder.faith }
#		        }
#		        desc = fp2_other_decisions.1001.involved_faith
#		    }
#		    triggered_desc = {
#		        trigger = {
#					scope:iberian_footholder.religion = {
#						any_faith = {
#							struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#						}
#					}
#					religion = scope:iberian_footholder.religion
#		        }
#		        desc = fp2_other_decisions.1001.same_uninvolved_faith
#		    }
#		    triggered_desc = {
#		        trigger = {
#					scope:iberian_footholder.religion = {
#						any_faith = {
#							struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#						}
#					}
#		        }
#		        desc = fp2_other_decisions.1001.uninvolved_faith
#		    }
#		    desc = fp2_other_decisions.1001.closing
#		}
#	}
#	theme = realm
#	left_portrait = {
#		character = scope:iberian_footholder
#		animation = war_over_win
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#	}
#
#	immediate = {
#		show_as_tooltip = {
#			every_in_list = {
#				list = iberian_footholder_transfer_list
#				set_de_jure_liege_title = scope:transfer_empire
#			}
#		}
#	}
#
#	option = {
#		name = fp2_other_decisions.1001.a
#		
#	}
#}
#
#
###################################################
## Found Kingdom of Toledo
## by Joe Parkin
## 1100 Decision taker event
###################################################
#
#fp2_other_decisions.1100 = {
#	type = character_event
#	title = fp2_other_decisions.1100.t
#	desc = fp2_other_decisions.1100.desc
#	theme = realm
#	left_portrait = {
#		character = root
#		animation = war_over_win
#	}
#	lower_right_portrait = scope:de_jure_anger_1
#	lower_center_portrait = scope:de_jure_anger_2
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#	}
#
#	immediate = {
#		show_as_tooltip = { fp2_struggle_found_kingdom_toledo_empire_effect = yes }
#		hidden_effect = {
#			if = {
#				limit = {
#					any_in_list = { list = kingdom_toledo_opinion_list }
#				}
#				while = {
#					count = 2
#					ordered_in_list = {
#						list = kingdom_toledo_opinion_list
#						limit = {
#							trigger_if = {
#								limit = { exists = scope:de_jure_anger_1 }
#								this != scope:de_jure_anger_1
#							}
#						}
#						if = {
#							limit = {
#								NOT = { exists = scope:de_jure_anger_1 }
#							}
#							save_scope_as = de_jure_anger_1
#						}
#						else = { save_scope_as = de_jure_anger_2 }
#					}
#				}
#			}
#		}
#		legend_seed_new_title_effect = yes
#	}
#
#	option = {
#		name = fp2_other_decisions.1100.a
#	}
#
#	after = {
#		every_player = {
#			limit = {
#				this != scope:toledo_former
#				is_within_diplo_range = { CHARACTER = scope:toledo_former }
#			}
#			trigger_event = fp2_other_decisions.1101
#		}
#	}
#}
#
#fp2_other_decisions.1101 = {
#	type = character_event
#	title = fp2_other_decisions.1100.t
#	desc = {
#		desc = fp2_other_decisions.1101.desc
#		first_valid = {
#			triggered_desc = {
#				trigger = {
#					trigger_if = {
#						limit = { exists = scope:de_jure_anger_1 }
#						this = scope:de_jure_anger_1
#					}
#					trigger_else_if = {
#						limit = { exists = scope:de_jure_anger_2 }
#						this = scope:de_jure_anger_2
#					}
#					trigger_else = { always = no }
#				}
#				desc = fp2_other_decisions.1101.stolen
#			}
#			triggered_desc = {
#				trigger = {
#					faith = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#				}
#				desc = fp2_other_decisions.1101.mozarab
#			}
#		}
#	}
#	theme = realm
#	override_background = { reference = throne_room_scope }
#	left_portrait = {
#		character = scope:toledo_former
#		animation = war_over_win
#	}
#
#	trigger = {
#		# DLC checking
#		has_fp2_dlc_trigger = yes
#	}
#
#	immediate = {
#		scope:toledo_former = { save_scope_as = background_throne_room_scope }
#		show_as_tooltip = {
#			scope:toledo_former = { get_title = title:k_toledo }
#			title:k_toledo = {
#				every_in_de_jure_hierarchy = {
#					limit = { tier = tier_duchy }
#					set_de_jure_liege_title = title:k_toledo
#				}
#			}
#		}
#	}
#
#	option = {
#		name = {
#			trigger = {
#				trigger_if = {
#					limit = { exists = scope:de_jure_anger_1 }
#					this = scope:de_jure_anger_1
#				}
#				trigger_else_if = {
#					limit = { exists = scope:de_jure_anger_2 }
#					this = scope:de_jure_anger_2
#				}
#				trigger_else = { always = no }
#			}
#			text = fp2_other_decisions.1101.a
#		}
#		name = {
#			trigger = {
#				trigger_if = {
#					limit = { exists = scope:de_jure_anger_1 }
#					this != scope:de_jure_anger_1
#				}
#				trigger_if = {
#					limit = { exists = scope:de_jure_anger_2 }
#					this != scope:de_jure_anger_2
#				}
#				faith = {
#					portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#				}
#			}
#			text = fp2_other_decisions.1101.b
#		}
#		name = {
#			trigger = {
#				trigger_if = {
#					limit = { exists = scope:de_jure_anger_1 }
#					this != scope:de_jure_anger_1
#				}
#				trigger_if = {
#					limit = { exists = scope:de_jure_anger_2 }
#					this != scope:de_jure_anger_2
#				}
#				faith = {
#					NOT = {
#						portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#					}
#				}
#			}
#			text = fp2_other_decisions.1101.c
#		}
#	}
#}
#