# No lists or indexes, only chaos. Keep scrolling down and thou shalt find them.

#############################################
# Hostility Ending					    	#
# by Joe Parkin								#
#############################################

### [ROOT.Char.GetPrimaryTitle.GetAdjectiveNoTooltip] Dominance ###
#struggle_iberia_ending_hostility_decision = {
#	decision_group_type = major
#	title = struggle_iberia_ending_hostility_decision
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_hostility.dds"
#	}
#	extra_picture = "gfx/interface/illustrations/struggle_decision_buttons/fp2_decision_hostility.dds"
#	desc = struggle_iberia_ending_hostility_decision_desc
#	selection_tooltip = struggle_iberia_ending_hostility_decision_tooltip
#	confirm_click_sound = "event:/DLC/FP2/SFX/UI/fp2_struggle_ending_decision_confirm"
#	is_invisible = yes
#	sort_order = 80
#	cooldown = { days = 1 }
#
#	is_shown = {
#		is_landless_adventurer = no
#		has_fp2_dlc_trigger = yes
#	}
#
#	is_valid = {
#		top_liege = this
#
#		OR = {
#			custom_tooltip = {
#				text = struggle_iberia_ending_hostility_decision_correct_phase_tt
#				struggle:iberian_struggle = {
#					is_struggle_phase = struggle_iberia_phase_hostility
#				}
#			}
#			## Completely control Hispania for 5 years
#			AND = {
#				completely_controls_region = world_europe_west_iberia
#				primary_title =  {
#					tier >= tier_kingdom
#					title_held_years >= 5
#				}
#			}
#		}
#
#		# Hold and completely control two de jure kingdoms of Hispania
#		OR = {
#			custom_tooltip = { #
#				text = struggle_iberia_ending_hostility_decision_kingdom_tt
#				any_held_title = { # 1st kingdom
#					title_tier = kingdom
#					de_jure_liege = title:e_spain
#					root = { completely_controls = prev }
#					save_temporary_scope_as = spanish_kingdom
#				}
#				any_held_title = { # 2nd kingdom
#					title_tier = kingdom
#					de_jure_liege = title:e_spain
#					trigger_if = {
#						limit = { exists = scope:spanish_kingdom }
#						this != scope:spanish_kingdom
#					}
#					root = { completely_controls = prev }
#					save_temporary_scope_as = spanish_kingdom_2
#				}
#			}
#			custom_tooltip = {
#				text = struggle_iberia_ending_hostility_decision_united_spanish_throne_tt
#				AND = {
#					exists = global_var:unite_the_spanish_thrones_decision_title
#					primary_title = global_var:unite_the_spanish_thrones_decision_title
#				}
#			}
#		}
#
#
#		# All your capital kingdom's de jure counties are of your culture and faith
#		trigger_if = {
#			limit = {
#				exists = global_var:unite_the_spanish_thrones_decision_title
#				primary_title = global_var:unite_the_spanish_thrones_decision_title
#			}
#			custom_tooltip = {
#				text = struggle_iberia_ending_hostility_decision_county_light_tt
#				capital_county.de_jure_liege.de_jure_liege = {
#					any_de_jure_county = {
#						percent >= 0.75
#						culture = root.culture
#						faith = root.faith
#					}
#				}
#			}
#		}
#		trigger_else = {
#			custom_tooltip = {
#				text = struggle_iberia_ending_hostility_decision_county_tt
#				capital_county.de_jure_liege.de_jure_liege = {
#					any_de_jure_county = {
#						count = all
#						culture = root.culture
#						faith = root.faith
#					}
#				}
#			}
#		}
#
#		# No other realm controls more than 20% of the Iberia region
#		custom_tooltip = {
#			text = struggle_iberia_ending_hostility_decision_region_tt
#			NOT = {
#				struggle:iberian_struggle = {
#					any_involved_ruler = {
#						this != root
#						top_liege = this
#						primary_title ?= { is_mercenary_company = no }
#						save_temporary_scope_as = iberian_realm
#						any_county_in_region = {
#							region = world_europe_west_iberia
#							percent > fp2_struggle_hostility_region_percent_decimal_value
#							holder.top_liege = scope:iberian_realm
#						}
#					}
#				}
#			}
#		}
#
#		# Completely control at least 2 of the important Iberian duchies
#		calc_true_if = {
#			amount >= 2
#			completely_controls = title:d_galicia
#			completely_controls = title:d_toledo
#			completely_controls = title:d_cordoba
#			completely_controls = title:d_valencia
#			completely_controls = title:d_barcelona
#		}
#	}
#
#	effect = {
#		if = {
#			limit = { has_dlc_feature = legends }
#			legend_seed_struggle_ending_effect = {
#				ENDER = root
#				STRUGGLE = iberian_struggle
#			}
#		}
#		if = {
#			limit = { has_ach_dlc_trigger = yes }
#			add_character_flag = ach_ended_struggle
#		}
#
#		##### Major Effects #####
#		show_as_tooltip = {
#			dynasty = { add_dynasty_prestige = 10000 }
#			fp2_struggle_hostility_ender_effect = yes
#		}
#		# Hispania is available!
#		custom_tooltip = fp2_struggle_can_create_empire_of_hispania_tt
#		custom_description_no_bullet = { text = fp2_struggle_house_tt }
#		# Keep the Struggle Clash for your House
#		custom_tooltip = fp2_struggle_can_keep_using_struggle_clash_tt
#		# Boost to culture and faith conversion
#		custom_tooltip = fp2_struggle_hostility_conversion_tt
#		# Damage opinion with other culture/faiths
#		custom_tooltip = fp2_struggle_hostility_opinion_tt
#		custom_tooltip = fp2_struggle_hostility_opinion_negative_tt
#		# Choose Holy War boost, Culture War boost, or both
#		custom_description_no_bullet = { text = fp2_struggle_hostility_list_tt }
#		#custom_tooltip = fp2_struggle_hostility_holy_cb_joint_tt
#		#custom_tooltip = fp2_struggle_hostility_culture_cb_tt
#
#
#
#		show_as_tooltip = {
#			stress_impact = {
#				humble = medium_stress_impact_gain
#				cynical = medium_stress_impact_gain
#			}
#		}
#
#
#		# Achievements
#		add_achievement_global_variable_effect = {
#			VARIABLE = fp2_iberian_hostilities_achievement_unlocked
#			VALUE = yes
#		}
#		fp2_holiday_in_iberia_check = yes
#
#		# Trigger a player facing event as a coda
#		trigger_event = fp2_struggle.0900
#	}
#
#	cost = {}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 120
#		empire = 120
#		hegemony = 120
#	}
#
#	ai_potential = { always = yes }
#
#	ai_will_do = { base = 100 }
#}

##############################################
## Compromise Ending					    	#
## by Joe Parkin								#
##############################################
#
#### Status Quo ###
#struggle_iberia_ending_compromise_decision = {
#	decision_group_type = major
#	title = struggle_iberia_ending_compromise_decision
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_compromise.dds"
#	}
#	extra_picture = "gfx/interface/illustrations/struggle_decision_buttons/fp2_decision_compromise.dds"
#	desc = struggle_iberia_ending_compromise_decision_desc
#	selection_tooltip = struggle_iberia_ending_compromise_decision_tooltip
#	confirm_click_sound = "event:/DLC/FP2/SFX/UI/fp2_struggle_ending_decision_confirm"
#	is_invisible = yes
#	cooldown = { days = 1 }
#
#	sort_order = 80
#
#	is_shown = {
#		is_landless_adventurer = no
#		has_fp2_dlc_trigger = yes
#	}
#
#	is_valid = {
#		top_liege = this
#
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_decision_correct_phase_tt
#			struggle:iberian_struggle = {
#				is_struggle_phase = struggle_iberia_phase_compromise
#			}
#		}
#
#		OR = {
#			# Exalted among Men or higher
#			prestige_level >= very_high_prestige_level
#			# Hold and completely control a de jure kingdom of Hispania
#			custom_tooltip = {
#				text = struggle_iberia_ending_compromise_decision_kingdom_tt
#				fp2_struggle_ending_hold_de_jure_kingdom_trigger = yes
#			}
#		}
#
#		# Control less than 50% of Iberia
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_decision_region_tt
#			fp2_struggle_ending_percent_iberia_trigger = yes
#		}
#
#		# No one else controls more than 50% of Iberia
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_decision_other_region_tt
#			fp2_struggle_ending_other_percent_iberia_trigger = yes
#		}
#
#		# No Independent Involved rulers are at war with each other
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_truce_tt
#			NOT = {
#				struggle:iberian_struggle = {
#					any_involved_ruler = {
#						top_liege = this
#						is_landless_adventurer = no
#						primary_title = { is_mercenary_company = no }
#						any_primary_war_enemy = {
#							top_liege = this
#							is_landless_adventurer = no
#							any_character_struggle = {
#								involvement = involved
#								is_struggle_type = iberian_struggle
#							}
#							primary_title = { is_mercenary_company = no }
#						}
#					}
#				}
#			}
#		}
#
#		OR = {
#			# Every other involved independent ruler in Iberia has at least 60 opinion of you or is strong hooked
#			custom_tooltip = {
#				text = struggle_iberia_ending_compromise_decision_opinion_tt
#				struggle:iberian_struggle = {
#					NOT = {
#						any_involved_ruler = {
#							this != root
#							top_liege = this
#							primary_title = { is_holy_order = no }
#							primary_title = { is_mercenary_company = no }
#							is_landless_adventurer = no
#							save_temporary_scope_as = this_character
#							NOR = {
#								root = { has_strong_hook = scope:this_character }
#								opinion = {
#									target = root
#									value >= struggle_iberia_ending_compromise_decision_opinion_value
#								}
#							}
#						}
#					}
#				}
#			}
#			# No other independent ruler in Iberia is a king or above
#			custom_tooltip = {
#				text = struggle_iberia_ending_compromise_decision_independent_tt
#				struggle:iberian_struggle = {
#					NOT = {
#						any_involved_ruler = {
#							this != root
#							top_liege = this
#							primary_title = { is_mercenary_company = no }
#							is_landless_adventurer = no
#							primary_title.tier >= tier_kingdom
#						}
#					}
#				}
#			}
#			# More than 25% of Iberia is controlled by Interloper or Uninvolved rulers
#			custom_tooltip = {
#				text = struggle_iberia_ending_compromise_decision_interloper_tt
#				any_county_in_region = {
#					region = world_europe_west_iberia
#					percent > fp2_struggle_compromise_uninvolved_percent_decimal_value
#					holder.top_liege = { fp2_character_interloper_in_struggle_trigger = yes }
#				}
#			}
#		}
#
#		# Completely control any of the important Iberian duchies
#		calc_true_if = {
#			amount >= 1
#			completely_controls = title:d_galicia
#			completely_controls = title:d_toledo
#			completely_controls = title:d_cordoba
#			completely_controls = title:d_valencia
#			completely_controls = title:d_barcelona
#		}
#	}
#
#	effect = {
#		if = {
#			limit = { has_dlc_feature = legends }
#			legend_seed_struggle_ending_effect = {
#				ENDER = root
#				STRUGGLE = iberian_struggle
#			}
#		}
#		if = {
#			limit = { has_ach_dlc_trigger = yes }
#			add_character_flag = ach_ended_struggle
#		}
#		##### Major Effects #####
#		# Personal effects for ruler
#		show_as_tooltip = { fp2_struggle_compromise_ender_effect = yes }
#		# Independent/Split De Jure Duchies will become De Jure Kingdoms
#		if = {
#			limit = {
#				title:e_spain = {
#					any_in_de_jure_hierarchy = { fp2_struggle_ending_compromise_independent_duchy_trigger = yes }
#				}
#			}
#			custom_tooltip = fp2_struggle_compromise_create_new_kingdoms_tt
#		}
#		# Other Tooltips!
#		fp2_struggle_compromise_tooltip_effect = yes
#
#		##### Minor Effects #####
#		# Self-sufficiency/defensive modifiers for each independent realm
#		show_as_tooltip = { fp2_struggle_compromise_modifier_rewards_effect = yes }
#
#		show_as_tooltip = {
#			stress_impact = {
#				arrogant = medium_stress_impact_gain
#			}
#		}
#
#		# Achievements
#		add_achievement_global_variable_effect = {
#			VARIABLE = fp2_iberian_compromise_achievement_unlocked
#			VALUE = yes
#		}
#		fp2_holiday_in_iberia_check = yes
#
#		# Trigger a player facing event as a coda
#		trigger_event = fp2_struggle.0901
#	}
#
#	cost = {}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 120
#		empire = 120
#		hegemony = 120
#	}
#
#	ai_potential = { always = yes }
#
#	ai_will_do = { base = 100 }
#}
#
##############################################
## Conciliation Ending					    #
## by Joe Parkin								#
##############################################
#
#### Détente ###
#struggle_iberia_ending_conciliation_decision = {
#	decision_group_type = major
#	title = struggle_iberia_ending_conciliation_decision
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_conciliation.dds"
#	}
#	extra_picture = "gfx/interface/illustrations/struggle_decision_buttons/fp2_decision_conciliation.dds"
#	desc = struggle_iberia_ending_conciliation_decision_desc
#	selection_tooltip = struggle_iberia_ending_conciliation_decision_tooltip
#	confirm_click_sound = "event:/DLC/FP2/SFX/UI/fp2_struggle_ending_decision_confirm"
#	is_invisible = yes
#	cooldown = { days = 1 }
#
#	sort_order = 80
#
#	is_shown = {
#		is_landless_adventurer = no
#		has_fp2_dlc_trigger = yes
#	}
#
#	is_valid = {
#		top_liege = this
#
#		custom_tooltip = {
#			text = struggle_iberia_ending_conciliation_decision_correct_phase_tt
#			struggle:iberian_struggle = {
#				is_struggle_phase = struggle_iberia_phase_conciliation
#			}
#		}
#
#		prestige_level >= very_high_prestige_level # Exalted among Men or higher
#
#		# Hold and completely control a de jure kingdom of Hispania
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_decision_kingdom_tt
#			fp2_struggle_ending_hold_de_jure_kingdom_trigger = yes
#		}
#
#		# Every other independent involved ruler in Iberia is allied to you
#		custom_tooltip = {
#			text = struggle_iberia_ending_conciliation_decision_alliance_tt
#			struggle:iberian_struggle = {
#				NOT = {
#					any_involved_ruler = {
#						top_liege = this
#						is_landless_adventurer = no
#						primary_title = { is_mercenary_company = no }
#						primary_title = { is_holy_order = no }
#						NOR = {
#							this = root
#							is_allied_to = root
#						}
#					}
#				}
#			}
#		}
#
#		# Control less than 50% of Iberia
#		custom_tooltip = {
#			text = struggle_iberia_ending_compromise_decision_region_tt
#			fp2_struggle_ending_percent_iberia_trigger = yes
#		}
#	}
#
#	effect = {
#		if = {
#			limit = { has_dlc_feature = legends }
#			legend_seed_struggle_ending_effect = {
#				ENDER = root
#				STRUGGLE = iberian_struggle
#			}
#		}
#		if = {
#			limit = { has_ach_dlc_trigger = yes }
#			add_character_flag = ach_ended_struggle
#		}
#		##### Major Effects #####
#		show_as_tooltip = {
#			fp2_struggle_conciliation_ender_effect = yes
#			fp2_struggle_conciliation_tooltip_effect = yes
#			fp2_struggle_conciliation_modifier_rewards_effect = yes
#		}
#
#		show_as_tooltip = {
#			stress_impact = {
#				arrogant = medium_stress_impact_gain
#				zealous = medium_stress_impact_gain
#			}
#		}
#
#		# Achievements
#		add_achievement_global_variable_effect = {
#			VARIABLE = fp2_iberian_conciliation_achievement_unlocked
#			VALUE = yes
#		}
#		fp2_holiday_in_iberia_check = yes
#
#
#		# Trigger a player facing event as a coda
#		trigger_event = fp2_struggle.0902
#	}
#
#	cost = {}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 120
#		empire = 120
#		hegemony = 120
#	}
#
#	ai_potential = { always = yes }
#
#	ai_will_do = { base = 100 }
#}
#
#####################################
### Secure the Mediterranean
### By Hugo Cortell
#####################################
##### Secure The Mediterranean ###
##secure_mediterranean_decision = {
##	title = fp2_secure_mediterranean.t
##	picture = {
##		reference = "gfx/interface/illustrations/event_scenes/fp1_ocean.dds"
##	}
##	desc = fp2_secure_mediterranean.desc
##	decision_group_type = major
##
##	selection_tooltip = fp2_secure_mediterranean.tip
##	sort_order = 50
##
##	is_shown = {
##		# DLC check
##		has_fp2_dlc_trigger = yes
##		# Standard checks
##		is_playable_character = yes
##		exists = dynasty
##		NOT = {
##			is_target_in_global_variable_list = {
##				name = unavailable_unique_decisions
##				target = flag:flag_secured_the_mediterranean
##			}
##		}
##
##		OR = {
##			completely_controls = title:d_sardinia
##			completely_controls = title:d_sicily
##			AND = {
##				completely_controls = title:d_mallorca
##				completely_controls = title:d_corsica
##			}
##		}
##	}
##
##	is_valid = {
##		completely_controls = title:d_mallorca
##		completely_controls = title:d_sardinia
##		completely_controls = title:d_corsica
##		completely_controls = title:d_sicily
##	}
##
##	is_valid_showing_failures_only = {
##		is_landed = yes
##	}
##
##	effect = {
##		add_to_global_variable_list = {
##			name = unavailable_unique_decisions
##			target = flag:flag_secured_the_mediterranean
##		}
##
##		# LOC
##		root = {
##			save_scope_as = mediterranean_conqueror
##			house = { save_scope_as = mediterranean_house }
##		}
##		title:d_mallorca = { save_scope_as = mallorca }
##		title:d_sardinia = { save_scope_as = sardinas }
##		title:d_sicily = { save_scope_as = sicily }
##		title:k_mediterranean_sea = { save_scope_as = mediterranean_title }
##
##		every_player = {
##			limit = {
##				this != ROOT
##				any_held_title = { title_province = { geographical_region = dlc_fp2_mediterranean_shoreline } }
##			}
##			send_interface_message = {
##				type = event_generic_bad_with_text
##				title = secure_mediterranean_decision.involved_notif
##				desc = secure_mediterranean_decision.involved_notif_desc # Players who get this: "why do I hear boss music?" (It is meant to sound vaguely threatening)
##				left_icon = scope:mediterranean_conqueror
##
##				show_as_tooltip = {
##					scope:mediterranean_conqueror = {
##						house = {
##							add_house_modifier = {
##								modifier = fp2_controls_the_mediterranean_house_modifier
##								years = 100
##							}
##						}
##						dynasty = { add_dynasty_prestige = major_prestige_gain }
##					}
##				}
##			}
##		}
##
##		house = {
##			add_house_modifier = {
##				modifier = fp2_controls_the_mediterranean_house_modifier
##				years = 100
##			}
##		}
##		dynasty = { add_dynasty_prestige = major_prestige_gain } # You used to get +25% prestiege, but that caused UI issues
##		custom_tooltip = secure_mediterranean_decision.a
##
##		create_title_and_vassal_change = {
##			type = created
##			save_scope_as = title_change
##			add_claim_on_loss = yes
##		}
##		title:k_mediterranean_sea = {
##			change_title_holder = {
##				holder = root
##				change = scope:title_change
##			}
##		}
##		resolve_title_and_vassal_change = scope:title_change
##		title:d_mallorca = { set_de_jure_liege_title = title:k_mediterranean_sea }
##		title:d_sardinia = { set_de_jure_liege_title = title:k_mediterranean_sea }
##		title:d_corsica = { set_de_jure_liege_title = title:k_mediterranean_sea }
##		title:d_sicily = { set_de_jure_liege_title = title:k_mediterranean_sea }
##
##		hidden_effect = {
##			title:k_mediterranean_sea = { set_de_jure_liege_title = title:e_italy } # Straying closer to remaking the roman empire
##			trigger_event = iberia_north_africa.2105
##		}
##	}
##
##	cost = {
##		gold = {
##			value = 0
##			if = {
##				limit = {
##					has_treasury = no
##				}
##				add = major_gold_value
##				multiply = 1.5
##				round = yes
##			}
##		}
##		treasury = {
##			value = 0
##			if = {
##				limit = {
##					has_treasury = yes
##				}
##				add = major_gold_value
##				multiply = 1.5
##				round = yes
##			}
##		}
##		prestige = {
##			value = major_prestige_gain
##			multiply = 3
##			round = yes
##		}
##	}
##
##	ai_check_interval_by_tier = {
##		barony = 0
##		county = 0
##		duchy = 0
##		kingdom = 730
##		empire = 730
##		hegemony = 730
##	}
##
##	ai_potential = {
##		is_ruler = yes
##		short_term_gold >= {
##			value = major_gold_value
##			multiply = 1.5
##			round = yes
##		}
##		prestige >= {
##			value = major_prestige_gain
##			multiply = 3
##			round = yes
##		}
##	}
##
##	ai_will_do = {
##		base = 80
##	}
##}
#
##############################################
## Eat a Cheese
## by Daniel "yes I know what exciting content is stop bullying me" Moore
############################################################################
#### Eat Your Cheese ###
#eat_cheese_decision = {
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
#	}
#	desc = eat_cheese_decision_desc
#
#	is_shown = {
#		any_character_artifact = {
#			has_variable = has_cheese_artifact
#		}
#	}
#
#	effect = {
#
#		custom_tooltip = eat_cheese_effect_tt
#
#		trigger_event = fp2_yearly.1008
#
#	}
#
#	ai_check_interval = 0
#
#	ai_potential = {
#
#	}
#
#	ai_will_do = {
#		base = 100
#	}
#}
#
####################################
## Sponsor Jewish Sciences
## By Hugo Cortell
####################################
#### Sponsor Jewish Sciences ###
#golden_age_jewish_science_in_iberia_decision = {
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/decision_golden_age.dds"
#	}
#	desc = golden_age_jewish_science_in_iberia_decision_desc
#	decision_group_type = struggle
#
#	is_shown = {
#		has_fp2_dlc_trigger = yes
#		top_liege = root
#		top_liege = this # (Redundancy check)
#		is_landed_or_landless_administrative = yes
#		AND = {
#			exists = struggle:iberian_struggle
#			any_character_struggle = {
#				involvement = involved
#				has_struggle_phase_parameter = unlocks_golden_age_jewish_science_decision
#			}
#		}
#	}
#
#	is_valid = {
#		OR = { # Either the var does not exist (no current golden age) or you are not the sponsor of the current golden age
#			NOT = { exists = global_var:fp2_current_jewish_science_sponsor }
#			trigger_if = {
#				limit = { exists = global_var:fp2_current_jewish_science_sponsor }
#				custom_tooltip = {
#					text = golden_age_jewish_science_in_iberia_decision_hardcoded_trigger_text.b
#					NOT = { root = global_var:fp2_current_jewish_science_sponsor }
#					is_ai = no # Prevents the AI from stealing the golden age, players can steal each other's golden age
#				}
#			}
#		}
#		trigger_if = { # If you are not your culture's head, you must earn their approval
#			limit = {
#				exists = culture.culture_head # Redundancy check!
#				culture.culture_head != root
#			}
#			custom_tooltip = {
#				text = golden_age_jewish_science_in_iberia_decision_hardcoded_trigger_text.a
#				culture.culture_head = {
#					save_temporary_opinion_value_as = {
#						name = target_opinion
#						target = root
#					}
#					scope:target_opinion > 0
#				}
#			}
#		}
#	}
#
#	effect = {
#		hidden_effect = { # Prevent any case in which modifiers could be stacked
#			struggle:iberian_struggle = {
#				every_involved_ruler = {
#					remove_character_modifier = fp2_sponsored_golden_age_modifier
#					remove_character_modifier = fp2_part_of_golden_age_modifier
#				}
#			}
#		}
#
#		send_interface_toast = {
#			type = event_toast_effect_good
#			title = golden_age_jewish_science_in_iberia_decision.player_notif.t
#			right_icon = root
#			play_music_cue = mx_cue_meadandwine
#
#			add_character_modifier = {
#				modifier = fp2_sponsored_golden_age_modifier
#				years = 120
#			}
#			capital_county = {
#				add_county_modifier = {
#					modifier = fp2_epicenter_of_golden_age_modifier
#					years = 60
#				}
#			}
#		}
#		culture = { add_to_list = already_involved_cultures } # Ensures that only one top ruler for each involved culture is picked
#		struggle:iberian_struggle = {
#			every_involved_ruler = {
#				custom = fp2_one_independent_ruler_of_each_culture_notifier
#				limit = {
#					culture = { save_temporary_scope_as = current_culture }
#					NOT = { # Checks that it is not in the list of "I am already benefiting from this"
#						this = root # (Also must not be root)
#						any_in_list = {
#							list = already_involved_cultures
#							this = scope:current_culture
#						}
#					}
#					top_liege = this	# Redundancy checks, vital to ensuring this has a 110% success rate
#					top_liege = this			# Redundancy check
#				}
#				if = {
#					limit = { NOT = { has_character_modifier = fp2_part_of_golden_age_modifier } }
#					culture = { add_to_list = already_involved_cultures }
#					send_interface_toast = {
#						type = event_toast_effect_good
#						title = golden_age_jewish_science_in_iberia_decision.player_notif.t
#						right_icon = root # Showing root is WAD, lets other players know who started it
#
#						add_character_modifier = {
#							modifier = fp2_part_of_golden_age_modifier
#							years = 120
#						}
#					}
#				}
#			}
#		}
#
#		hidden_effect = {
#			random_list = {
#				100 = {
#					trigger_event = { # Translator/book retailer event
#						id = iberia_north_africa.2001
#						days = { 4 32 }
#					}
#				}
#				110 = {
#					trigger_event = { # Cataract Surgery event
#						id = iberia_north_africa.2002
#						days = { 4 32 }
#					}
#				}
#				90 = {
#					trigger_event = { # Bickering scholars event
#						id = iberia_north_africa.2003
#						days = { 4 32 }
#					}
#				}
#			}
#		}
#
#		set_global_variable = {
#			name = fp2_current_jewish_science_sponsor
#			value = root
#			years = 120
#		}
#	}
#
#	cost = {
#		gold = {
#			value = 0
#			if = {
#				limit = {
#					has_treasury = no
#				}
#				add = major_gold_value
#				multiply = 2.25
#				round = yes
#			}
#		}
#		treasury = {
#			value = 0
#			if = {
#				limit = {
#					has_treasury = yes
#				}
#				add = major_gold_value
#				multiply = 2.25
#				round = yes
#			}
#		}
#	}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 730
#		empire = 730
#		hegemony = 730
#	}
#
#	ai_potential = {}
#
#	ai_will_do = {
#		base = 0
#		modifier = {
#			add = {
#				value = learning
#				multiply = 5
#				round = yes
#			}
#			always = yes
#		}
#	}
#}
#
##############################################
## Convene Council of Toledo					#
## by Joe Parkin and Ola Jentzsch			#
##############################################
#### Council Of Toledo Decision ###
#council_of_toledo_decision = {
#	title = council_of_toledo_decision_title
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/decision_major_religion.dds"
#	}
#	desc = {
#		first_valid = {
#			triggered_desc = {
#				trigger = { exists = global_var:council_of_toledo_counter }
#				desc = council_of_toledo_decision_desc_count
#			}
#			desc = council_of_toledo_decision_desc
#		}
#	}
#	selection_tooltip = council_of_toledo_decision_tooltip
#	cooldown = { years = council_of_toledo_decision_decision_cooldown_value }
#	decision_group_type = major
#
#	sort_order = 80
#
#	is_shown = {
#		# DLC check
#		has_fp2_dlc_trigger = yes
#		# Is Mozarabic (or reformed Mozarabic)
#		faith = {
#			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
#		}
#		any_vassal = { }
#	}
#
#	is_valid = {
#		# Owns Toledo
#		custom_tooltip = {
#			text = council_of_toledo_decision_toledo_holder_trigger
#			is_toledo_ownership_valid_trigger = yes
#		}
#		any_vassal = {
#			count >= 3
#			is_powerful_vassal = yes
#			custom_tooltip = {
#				text = council_of_toledo_decision_toledo_faith_trigger
#				faith = root.faith
#			}
#		}
#
#		realm_size >= council_of_toledo_realm_size_value
#		# update fp2_struggle_council_toledo_decision_trigger if changing this
#	}
#
#	is_valid_showing_failures_only = {
#		is_landed = yes
#		# Not at war
#		is_at_war = no
#	}
#
#	effect = {
#		custom_tooltip = council_of_toledo_decision_tt
#		faith:mozarabic_church = {
#			change_fervor = {
#				value = 10
#				desc = fervor_gain_ascetic_example
#			}
#		}
#		# Council counter
#		if = {
#			limit = { exists = global_var:council_of_toledo_counter }
#			change_global_variable = {
#				name = council_of_toledo_counter
#				add = 1
#			}
#		}
#		else = {
#			set_global_variable = {
#				name = council_of_toledo_counter
#				value = 19
#			}
#		}
#		if = {
#			limit = {
#				any_character_struggle = { is_struggle_type = iberian_struggle }
#			}
#			custom_tooltip = council_of_toledo_decision_catalyst_tt
#		}
#		trigger_event = {
#			on_action = fp2_struggle_council_toledo_organize
#			days = 1
#		}
#	}
#
#	cost = {
#		gold = {
#			value = 0
#			if = {
#				limit = {
#					has_treasury = no
#				}
#				add = council_of_toledo_gold_cost_value
#			}
#		}
#		treasury = {
#			value = 0
#			if = {
#				limit = {
#					has_treasury = yes
#				}
#				add = council_of_toledo_gold_cost_value
#			}
#		}
#		piety = council_of_toledo_piety_cost_value
#	}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 60
#		empire = 60
#		hegemony = 60
#	}
#
#	ai_potential = {
#		is_ruler = yes
#		short_term_gold >= council_of_toledo_gold_cost_value
#	}
#
#	ai_will_do = {
#		base = 100
#	}
#}
#
##############################################
## Secure Iberian Foothold
## by Joe Parkin and Ola Jentzsch
##############################################
#### Secure Iberian Foothold Decision ###
#secure_iberian_foothold_decision = {
#	title = secure_iberian_foothold_decision_title
#	picture = {
#		reference = "gfx/interface/illustrations/decisions/decision_destiny_goal.dds"
#	}
#	desc = secure_iberian_foothold_decision_desc
#	selection_tooltip = secure_iberian_foothold_decision_tooltip
#	sort_order = 80
#	decision_group_type = struggle
#
#	is_shown = {
#		is_landless_adventurer = no
#		# DLC check
#		has_fp2_dlc_trigger = yes
#		# Struggle is active
#		exists = struggle:iberian_struggle
#		# Not Involved and capital lies outside Iberia
#		custom_tooltip = {
#			text = fp2_struggle_uninvolved_or_external_tt
#			NOR = {
#				any_character_struggle = {
#					is_struggle_type = iberian_struggle
#					involvement = involved
#				}
#			}
#		}
#		# Hold land near Iberia
#		any_sub_realm_county = {
#			title_province = {
#				OR = {
#					geographical_region = world_europe_west_iberia # Iberia
#					geographical_region = ghw_region_southern_france # Aquitaine
#					geographical_region = world_africa_north_west # Maghreb
#				}
#			}
#		}
#		NOT = { has_title = title:e_spain }
#	}
#
#	is_valid = {
#		##### General triggers #####
#		# Struggle phase must be right
#		custom_tooltip = {
#			text = fp2_struggle_uninvolved_or_external_tt
#			NOT = {
#				capital_province = { geographical_region = world_europe_west_iberia }
#			}
#		}
#		custom_tooltip = {
#			text = fp2_struggle_secure_iberian_foothold_empire_tt
#			any_held_title = {
#				title_tier >= empire
#				NOT = { this = title:e_spain }
#			}
#		}
#		# If my religion is involved, I need to own the better portion of those counties
#		trigger_if = {
#			limit = {
#				religion = {
#					any_faith = {
#						struggle:iberian_struggle = { is_faith_involved_in_struggle = prev }
#					}
#				}
#			}
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_religion_tt
#				fp2_struggle_secure_iberian_foothold_religion_percent_value >= fp2_struggle_secure_iberian_foothold_religion_target_percent_value
#			}
#		}
#		# Otherwise, I need to own a big chunk of the peninsula
#		trigger_else = {
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_outsider_tt
#				any_county_in_region = {
#					region = world_europe_west_iberia
#					percent >= fp2_struggle_secure_iberian_foothold_outsider_target_percent_decimal_value
#					holder.top_liege = root
#				}
#			}
#		}
#
#		##### Iberian kingdom triggers #####
#
#		# Any de jure kingdom of Iberia is completely controlled
#		custom_tooltip = {
#			text = fp2_struggle_secure_iberian_foothold_kingdom_iberian_tt
#			any_held_title = { fp2_struggle_secure_iberian_foothold_iberian_kingdom_trigger = yes }
#		}
#		# Real tooltips
#		trigger_if = {
#			limit = { exists = scope:iberian_kingdom_temp }
#			# That kingdom is mostly my faith
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_faith_tt
#				fp2_struggle_secure_iberian_foothold_faith_trigger = yes
#			}
#			# Borders held lands in a non-Iberian kingdom you hold
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_border_tt
#				scope:iberian_kingdom_temp = { fp2_struggle_secure_iberian_foothold_outsider_kingdom_trigger = yes }
#			}
#			# Held that kingdom for a while
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_held_tt
#				scope:iberian_kingdom_temp = { title_held_years >= fp2_struggle_secure_iberian_foothold_years_value }
#			}
#		}
#		# Fake tooltips
#		trigger_else = {
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_faith_tt
#				always = no
#			}
#			# Borders held lands in a non-Iberian kingdom you hold
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_border_tt
#				always = no
#			}
#			custom_tooltip = {
#				text = fp2_struggle_secure_iberian_foothold_kingdom_held_tt
#				always = no
#			}
#		}
#	}
#
#	is_valid_showing_failures_only = {
#		trigger_if = {
#			limit = { exists = struggle:iberian_struggle }
#			custom_tooltip = {
#				text = fp2_struggle_phase_hostility_or_opportunity_tt
#				struggle:iberian_struggle = {
#					has_struggle_phase_parameter = unlocks_secure_iberian_foothold_decision
#				}
#			}
#		}
#	}
#
#	effect = {
#		legend_seed_struggle_ending_effect = {
#			ENDER = root
#			STRUGGLE = iberian_struggle
#		}
#		if = {
#			limit = { has_ach_dlc_trigger = yes }
#			add_character_flag = ach_ended_struggle
#		}
#		if = {
#			limit = {
#				any_held_title = { title_tier = empire }
#			}
#			custom_tooltip = fp2_struggle_secure_iberian_foothold_empire_held_effect_tt
#		}
#		else = { custom_tooltip = fp2_struggle_secure_iberian_foothold_empire_dejure_effect_tt }
#
#		trigger_event = {
#			id = fp2_other_decisions.1000
#		}
#
#		custom_tooltip = fp2_struggle_secure_iberian_foothold_ends_the_struggle_tt
#	}
#
#	cost = {}
#
#	ai_check_interval_by_tier = {
#		barony = 0
#		county = 0
#		duchy = 0
#		kingdom = 120
#		empire = 120
#		hegemony = 120
#	}
#
#	ai_potential = {}
#
#	ai_will_do = {
#		base = 100
#	}
#}
#
###################################
# Build Pilgrim Roads
# By Hugo Cortell
###################################
### Build Pilgrim Roads ###
build_holy_pilgrim_roads_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/fp2_decision_struggle_opening.dds"
	}
	sort_order = 300
	decision_group_type = struggle

	is_shown = {
		faith = {
			any_holy_site = {
				holder.top_liege = root
				count > 0
			}
		}
		any_character_struggle = {
			involvement = involved
			has_struggle_phase_parameter = unlocks_build_pilgrim_roads_decision
		}
	}

	is_valid = {
		custom_tooltip = {
			text = build_holy_pilgrim_roads_decision_hardcoded_trigger_text.a
			faith = {
				any_holy_site = {
					holder.top_liege = root
					NOT = { county = { has_county_modifier = fp2_pilgrim_roads_modifier } }
					count > 0
				}
			}
		}
	}

	effect = {
		hidden_effect = {
			faith = {
				random_holy_site = {
					limit = {
						holder.top_liege = root
						NOT = { county = { has_county_modifier = fp2_pilgrim_roads_modifier } }
					}
					save_scope_as = chosen_holy_site_for_pilgrim_roads
					county = {
						save_scope_as = chosen_location_for_pilgrim_roads
						add_county_modifier = {
							modifier = fp2_pilgrim_roads_modifier
							years = 50
						}
					}
				}
			}
		}
		send_interface_toast = {
			type = event_toast_effect_good
			title = build_holy_pilgrim_roads_decision_construction_notif.t
			desc = build_holy_pilgrim_roads_decision_construction_notif.desc

			add_piety = major_piety_gain
			show_as_tooltip = {
				scope:chosen_location_for_pilgrim_roads = {
					add_county_modifier = {
						modifier = fp2_pilgrim_roads_modifier
						years = 50
					}
				}
			}
		}

		if = { # QA QoL
			limit = { debug_only = yes }
			custom_tooltip = debug_generic_option_shortened_trigger_can_disable
			hidden_effect = {
				random_list = {
					1 = {
						trigger_event = {
							id = iberia_north_africa.2011
							days = 4
						}
					}
					1 = {
						trigger_event = {
							id = iberia_north_africa.2012
							days = 4
						}
					}
					1 = {
						trigger_event = {
							id = iberia_north_africa.2013
							days = 4
						}
					}
				}
			}
		}
		else = {
			hidden_effect = {
				random_list = {
					1 = {
						trigger_event = {
							id = iberia_north_africa.2011
							days = { 32 2048 }
						}
					}
					1 = {
						trigger_event = {
							id = iberia_north_africa.2012
							days = { 32 2048 }
						}
					}
					1 = {
						trigger_event = {
							id = iberia_north_africa.2013
							days = { 32 2048 }
						}
					}
				}
			}
		}
	}

	cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = massive_gold_value
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = massive_gold_value
			}
		}
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 730
		duchy = 730
		kingdom = 730
		empire = 730
		hegemony = 730
	}
	ai_potential = {}
	ai_will_do = {
		base = 50
		modifier = {
			add = learning
			always = yes
		}
		modifier = {
			add = -50
			has_trait = cynical
		}
		modifier = {
			add = 10
			has_trait = zealous
		}
		modifier = {
			add = -40
			short_term_gold < massive_gold_value
		}
	}
}

#############################################
# Found Kingdom of Toledo
# by Joe Parkin
#############################################
### Found Kingdom Toledo Decision ###
found_kingdom_toledo_decision = {
	title = found_kingdom_toledo_decision_title
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_found_kingdom.dds"
	}
	desc = found_kingdom_toledo_decision_desc
	selection_tooltip = found_kingdom_toledo_decision_tooltip
	sort_order = 80

	decision_group_type = major

	is_shown = {
		# DLC check
		has_fp2_dlc_trigger = yes
  		culture = { has_cultural_pillar = heritage_iberian }
		faith = {
			portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
		}
		NOT = {
			is_target_in_global_variable_list = {
				name = unavailable_unique_decisions
				target = flag:form_toledo_decision
			}
		}
		title:e_spain = {
			any_in_de_jure_hierarchy = {
				any_title_to_title_neighboring_and_across_water_duchy = { this = title:d_toledo }
				de_jure_liege = {
					any_in_de_jure_hierarchy = {
						count > 2
						tier = tier_duchy
					}
				}
			}
		}
	}

	is_valid = {
		top_liege = this
		custom_tooltip = {
			text = found_kingdom_toledo_capital_tt
			capital_county = title:c_toledo
		}
		custom_tooltip = {
			text = found_kingdom_toledo_culture_tt
			culture = { has_cultural_pillar = heritage_iberian }
		}
		custom_tooltip = {
			text = found_kingdom_toledo_faith_tt
			faith = {
				portrait_religious_faith_or_foundational_trigger = { FAITH = faith:mozarabic_church }
			}
		}
		completely_controls = title:d_toledo
		custom_tooltip = {
			text = found_kingdom_toledo_duchy_tt
			any_held_title = {
				title_tier = duchy
				is_titular = no
				NOT = { this = title:d_toledo }
				root = { completely_controls = prev }
				any_title_to_title_neighboring_and_across_water_duchy = { this = title:d_toledo }
			}
		}
	}

	is_valid_showing_failures_only = {
		is_landed = yes
	}

	cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = 250
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = 250
			}
		}
	}

	effect = {
		save_scope_as = toledo_former
		gain_heroic_legend_seed_tooltip_effect = yes
		fp2_struggle_found_kingdom_toledo_empire_effect = yes
		save_scope_value_as = {
			name = has_kingdom_toledo_absorb_list_been_created
			value = yes
		}
		trigger_event = fp2_other_decisions.1100
		#Can only happen once
		add_to_global_variable_list = {
			name = unavailable_unique_decisions
			target = flag:form_toledo_decision
		}
		set_global_variable = {
			name = form_toledo_decision
			value = scope:toledo_former
		}
	}
	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 120
		kingdom = 120
		empire = 120
		hegemony = 120
	}

	ai_potential = {}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Develop a city
# by Maxence Voleau
#############################################
### Expand Cities ###
improve_city_province_decision = {
	title = improve_city_province_decision_name
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_misc.dds"
	}
	desc = improve_city_province_decision_desc
	selection_tooltip = improve_city_province_decision_tooltip
	cooldown = { years = 50 }
	sort_order = 90

	is_shown = {
		is_landless_adventurer = no
		dynasty ?= {
			has_dynasty_perk = fp2_urbanism_legacy_5
		}
	}

	is_valid_showing_failures_only = {
		custom_tooltip = {
			text = improve_city_province_decision_at_least_one_city_tt
			any_sub_realm_county = {
				count > 0
				holder = root
				any_county_province = {
					building_slots <= 5
					has_holding_type = city_holding
				}
			}
		}
	}

	effect = {

		#Generate intelligible effect
		if = {
			limit = {
				any_sub_realm_county = {
					count > 0
					holder = root
					any_county_province = {
						building_slots <= 5
						has_holding_type = city_holding
					}
				}
			}
			every_sub_realm_county = {
				# only county directly owned by the character
				limit = { holder = root }
				every_county_province = {
					limit = {
						has_holding_type = city_holding
						building_slots <= 5
					}
					save_scope_as = current_province
					prev.holder = {
						send_interface_toast = {
							type = event_toast_effect_good
							title = city_gained_building_slots
							left_icon = scope:current_province.barony

							scope:current_province = {
								add_province_modifier = extra_building_slot
							}
						}
					}

				}
			}
		}
		else = {
			custom_tooltip = improve_city_province_decision_decision_no_effect
		}
	}

	cost = {
		gold = {
			value = 0
			if = {
				limit = {
					has_treasury = no
				}
				add = improve_city_province_decision_cost
				multiply = {
					value = 1
					every_sub_realm_county = {
						# only county directly owned by the character
						limit = { holder = root }
						every_county_province = {
							limit = {
								building_slots <= 5
								has_holding_type = city_holding
							}
							add = 1
						}
					}
				}
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					has_treasury = yes
				}
				add = improve_city_province_decision_cost
				multiply = {
					value = 1
					every_sub_realm_county = {
						# only county directly owned by the character
						limit = { holder = root }
						every_county_province = {
							limit = {
								building_slots <= 5
								has_holding_type = city_holding
							}
							add = 1
						}
					}
				}
			}
		}
	}

	ai_check_interval_by_tier = {
		barony = 0
		county = 0
		duchy = 120
		kingdom = 120
		empire = 120
		hegemony = 120
	}

	ai_potential = {
		is_at_war = no
		# Has enough gold.
		short_term_gold >= ai_war_chest_desired_gold_value
		NOR = {
			has_trait = lazy
			has_trait = callous
		}
	}

	ai_will_do = {
		base = 100
	}
}
