namespace = major_decisions

#Decisions:
# decision_convert_to_feudalism, by Mathilda Bjarnehed
# 0001 - I converted to feudalism

# decision_strenghten_bloodline
# 0500 - I have strengthened my bloodline

# decision_dynasty_of_many_crowns
# 0501 - I have completed dynasty of many crowns

# decision_declare_bloodline_holy, by Flavio Verna
# 0100 - I have completed Consecrate Bloodline
# 0101 - Paragon/Savior traits inheritance

#convert_to_feudalism_decision
major_decisions.0001 = { #by Mathilda Bjarnehed
	type = character_event
	title = major_decisions.0001.t
	desc = major_decisions.0001.desc
	theme = realm
	override_background = { reference = courtyard }
	left_portrait = {
		character = root
		animation = storyteller
	}

	immediate = {
		show_as_tooltip = {
			convert_whole_realm_to_feudalism_effect = yes	
		}
		if = {
			limit = {
				has_character_flag = ready_to_receive_seed
			}
			legend_seed_great_deed_dynasty_effect = yes
			remove_character_flag = ready_to_receive_seed
		}
		hidden_effect = {
			every_liege_or_above = {
				limit = {
					NOT = { top_liege = this }
				}
				send_interface_message = {
					type = event_stewardship_neutral_with_text
					title = msg_vassal_feudalised
					desc = msg_vassal_feudalised_desc
					right_icon = root
				}
			}
		}
	}

	option = {
		name = major_decisions.0001.a
	}
}

major_decisions.0002 = { #by Linnéa Thimrén
	type = letter_event
	opening = major_decisions.0002.opening
	desc = major_decisions.0001.desc
	sender = {
		character = scope:actor
		animation = personality_rational
	}

	immediate = {
		show_as_tooltip = {
			if = {
				limit = { government_has_flag = government_is_japan_feudal }
				change_government = japan_feudal_government
			}
			else_if = {
				limit = { government_has_flag = government_is_clan }
				change_government = clan_government
			}
			else = { change_government = feudal_government }
		}
	}

	option = {
		name = major_decisions.0001.a
	}
}

#####################################

#Consecrating Family Decision, by Flavio Verna & Bianca Savazzi

major_decisions.0100 = {
	type = character_event
	title = major_decisions.0100.t
	desc = {
		first_valid = {
			# Divine Blood if Temporal Head.
			triggered_desc = {
				trigger = {
					OR = {
						root.faith.religious_head = root
						root.faith = { has_doctrine = doctrine_no_head }
					}
				}
				desc = major_decisions.0100.desc.temporal
			}
			# Regular.
			desc = major_decisions.0100.desc.spiritual
		}
	}
	theme = faith
	left_portrait = {
		character = root
		animation = personality_zealous
	}
	right_portrait = {
		character = scope:scoped_pope
		animation = admiration
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		hidden_effect = {
			save_scope_as = scoped_ruler
			if = {
				limit = {
					exists = root.faith.religious_head
					root != root.faith.religious_head
				}
				root.faith.religious_head = { save_scope_as = scoped_pope }
			}
			dynasty = {
				set_variable = {
					name = variable_made_bloodline_holy
					value = yes
				}
			}
		}
	}
	option = {
		#Pick what text to display
		name = { #Temporal.
			trigger = {
				root.faith.religious_head = root
			}
			text = major_decisions.0100.a
		}
		name = { #Spiritual.
			trigger = {
				root.faith.religious_head != root
			}
			text = major_decisions.0100.b
		}

		#Next, what nickname is given
		if = {
			limit = {
				root.faith.religious_head = root
			}
			set_nickname_effect = { NICKNAME = nick_the_divine }
		}
		if = { #Spiritual.
			limit = {
				root.faith.religious_head != root
				has_ach_dlc_trigger = no
			}
			set_nickname_effect = { NICKNAME = nick_the_anointed }
		}
		#All live descendants get the descendant trait
		declare_bloodline_holy_decision_effect = yes
		#Notifications
		every_player = {
			limit = {
				faith = root.faith
				NOR = {
					this = root
					this.dynasty = root.dynasty
				}
			}
			trigger_event = major_decisions.0102 #Notify players of same faith.
		}
		every_player = {
			limit = {
				this.dynasty = root.dynasty
				this != root
			}
			trigger_event = major_decisions.0103 #Notify dynasty members.
		}
	}
}

#On_birth:Child of Paragon/Savior gains proper trait at birth.
major_decisions.0101 = {
	type = character_event
	hidden = yes
	
	trigger = {
		OR = {
			AND = {
				mother ?= {
					OR = {
						has_trait = savior
						has_trait = paragon
						has_trait = divine_blood
						has_trait = consecrated_blood
					}
				}
			}
			AND = {
				father ?= {
					OR = {
						has_trait = savior
						has_trait = paragon
						has_trait = divine_blood
						has_trait = consecrated_blood
					}
				}
			}
			AND = {
				exists = scope:progenitor_holy_blood
				OR = {
					is_grandchild_of = scope:progenitor_holy_blood 
					is_great_grandchild_of = scope:progenitor_holy_blood
				}
			}
		}
		NOR = {
			has_trait = savior
			has_trait = paragon
			has_trait = divine_blood
			has_trait = consecrated_blood
		}
	}
	
	immediate = {
		if = {
			limit = {
				OR = {
					AND = {
						mother ?= {
							OR = {
								has_trait = savior
								has_trait = divine_blood
							}
						}
					}
					AND = {
						father ?= {
							OR = {
								has_trait = savior
								has_trait = divine_blood
							}
						}
					}
				}
			}
			add_trait = divine_blood
		}
		else = {
			add_trait = consecrated_blood
		}
		every_child = {
			trigger_event = major_decisions.0101
		}
	}
}

major_decisions.0102 = {
	type = character_event
	title = major_decisions.0100.t
	desc = {
		first_valid = {
			# Divine Blood if Temporal Head.
			triggered_desc = {
				trigger = {
					scope:scoped_ruler.faith.religious_head = scope:scoped_ruler
				}
				desc = major_decisions.0102.desc.temporal
			}
			# Regular.
			desc = major_decisions.0102.desc.spiritual
		}
	}
	theme = faith
	left_portrait = {
		character = scope:scoped_ruler
		animation = personality_zealous
	}
	right_portrait = {
		character = scope:scoped_pope
		animation = admiration
	}

	immediate = { play_music_cue = "mx_cue_sacredrite" }

	option = {
		name = { #Temporal.
			trigger = {
				scope:scoped_ruler.faith.religious_head = scope:scoped_ruler
			}
			text = major_decisions.0102.a
		}
		name = { #Spiritual.
			trigger = {
				scope:scoped_ruler.faith.religious_head != scope:scoped_ruler
			}
			text = major_decisions.0102.b
		}
	}
}

major_decisions.0103 = {
	type = character_event
	title = major_decisions.0100.t
	desc = {
		first_valid = {
			# Divine Blood if Temporal Head.
			triggered_desc = {
				trigger = {
					scope:scoped_ruler.faith.religious_head = scope:scoped_ruler
				}
				desc = major_decisions.0103.desc.temporal
			}
			# Regular.
			desc = major_decisions.0103.desc.spiritual
		}
	}
	theme = faith
	left_portrait = {
		character = scope:scoped_ruler
		animation = personality_zealous
	}
	right_portrait = {
		character = scope:scoped_pope
		animation = admiration
	}

	immediate = {
		play_music_cue = "mx_cue_sacredrite"
		show_as_tooltip = {
			if = {
				limit = {
					faith = scope:scoped_ruler.faith
				}
				if = {
					limit = {
						scope:scoped_ruler = {
							has_trait = savior
						}
					}
					add_trait = divine_blood
				}
				if = {
					limit = {
						scope:scoped_ruler = {
							has_trait = paragon
						}
					}
					add_trait = consecrated_blood
				}
			}
		}
	}
	option = {
		name = { #Same Faith.
			trigger = {
				faith = scope:scoped_ruler.faith
			}
			text = major_decisions.0103.a
		}
		name = { #Other Faith.
			trigger = {
				faith != scope:scoped_ruler.faith
			}
			text = major_decisions.0103.b
		}
	}
}

##################################################
# Convert to Tribalims
##################################################

major_decisions.0200 = {
	type = character_event
	title = major_decisions.0200.t
	desc = major_decisions.0200.desc
	theme = realm
	left_portrait =	{
		character = root
		animation = personality_honorable
	}

	option = {
		name = major_decisions.0200.a
		ai_chance = {	#The AI should always do this.
			base = 100
		}
	}
}

#I have strengthened our bloodline
major_decisions.0500 = { #by Mathilda Bjarnehed
	type = character_event
	title = major_decisions.0500.t
	desc = major_decisions.0500.desc
	theme = physical_health
	left_portrait = {
		character = root
		animation = personality_bold
	}
	override_background = { reference = throne_room }
	
	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		strengthen_bloodline_decision_effects = yes
		legend_seed_great_deed_dynasty_effect = yes
	}

	option = {
		name = major_decisions.0500.a

		give_nickname = nick_the_blood_motherfather
	}
}


#Dynasty of Many Crowns
major_decisions.0501 = { #by Mathilda Bjarnehed
	type = character_event
	title = dynasty_of_many_crowns
	desc = major_decisions.0501.desc
	theme = dynasty
	left_portrait = {
		character = root
		animation = personality_bold
	}
	
	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		dynasty_of_many_crowns_effects = yes

		#For desc
		hidden_effect = {
			primary_title = { save_scope_as = realm_1 }

			dynasty = {
				every_dynasty_member = {
					limit = {
						this != root
						top_liege = this
						highest_held_title_tier >= tier_kingdom
					}
					primary_title = { add_to_list = dynasty_realms }
				}
			}

			random_in_list = {
				list = dynasty_realms
				limit = { tier = tier_empire }
				alternative_limit = { always = yes }
				save_scope_as = realm_2
			}

			random_in_list = {
				list = dynasty_realms
				limit = {
					tier = tier_empire
					this != scope:realm_2
				}
				alternative_limit = {
					this != scope:realm_2
				}
				save_scope_as = realm_3
			}

			random_in_list = {
				list = dynasty_realms
				limit = {
					tier = tier_empire
					NOR = {
						this = scope:realm_2
						this = scope:realm_3
					}
				}
				alternative_limit = {
					NOR = {
						this = scope:realm_2
						this = scope:realm_3
					}
				}
				save_scope_as = realm_4
			}
		}

		legend_seed_great_deed_dynasty_effect = yes

	}

	option = {
		name = major_decisions.0501.a
	}
}


################
# Accept cannibalism
# by Linnéa Thimrén
################
major_decisions.1001 = {
	type = character_event
	title = major_decisions.1001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_government = landless_adventurer_government }
				desc = major_decisions.1001.desc_landless
			}
			desc = major_decisions.1001.desc
		}
		desc = major_decisions.1001.desc_outro
	}
	theme = skull
	left_portrait = {
		character = scope:cannibal
		animation = personality_greedy
	}
	right_portrait = {
		trigger = { exists = scope:court_chaplain }
		character = scope:court_chaplain
		animation = admiration
	}
	override_background = { 
		trigger = { is_landless_adventurer = no }
		reference = feast 
	}
	override_background = { 
		trigger = { has_government = landless_adventurer_government }
		reference = bp1_bonfire
	}
	immediate = {
		play_music_cue = "mx_cue_meadandwine"
		accept_cannibalism_decision_effect = yes
	}
	option = {
		name = major_decisions.1001.a
	}
}


#Players informed
major_decisions.1002 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { is_cannibal_trigger = yes }
				desc = major_decisions.1001.t
			}
			desc = major_decisions.1002.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:cannibal = { has_government = landless_adventurer_government }
					is_cannibal_trigger = yes
				}
				desc = major_decisions.1002.desc_cannibal_landless
			}
			triggered_desc = {
				trigger = {
					scope:cannibal = { has_government = landless_adventurer_government }
				}
				desc = major_decisions.1002.desc_landless
			}
			triggered_desc = {
				trigger = {
					is_cannibal_trigger = yes
				}
				desc = major_decisions.1002.desc_cannibal
			}
			desc = major_decisions.1002.desc
		}
	}
	theme = skull
	left_portrait = {
		character = scope:cannibal
		animation = personality_greedy
	}
	override_background = { 
		trigger = { 
			scope:cannibal = { is_landed_or_landless_administrative = yes }
		}
		reference = feast 
	}
	override_background = { 
		trigger = { 
			scope:cannibal = { has_government = landless_adventurer_government }
		}
		reference = army_camp
	}
	option = {
		name = {
			text = {
				first_valid = {
					#Noyce!
					triggered_desc = {
						trigger = { is_cannibal_trigger = yes }
						desc = major_decisions.1002.a
					}
					#Oh dear...
					desc = major_decisions.1002.b
				}
			}
		}
	}
}


#################
#Found a custom Kingdom/Empire
#	#by Petter Vilberg
#################

#I have founded a Kingdom
major_decisions.1101 = {
	type = character_event
	title = major_decisions.1101.t
	desc = {
		triggered_desc = {
			trigger = { exists = scope:three_duchies }
			desc = {
				desc = major_decisions.1101.opening_duchies
				desc = double_line_break
			}
		}
		desc = major_decisions.1101.desc
	}
	theme = realm
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	
	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		# If Kingdom is formed from three Duchies, specifically shout that out
		if = {
			limit = {
				any_held_title = {
					title_tier = duchy
					count >= 3
				}
			}
			scope:old_title = { # Carried over from the decision
				save_scope_as = duchy_1
			}
			random_held_title = {
				title_tier = duchy
				limit = {
					this != scope:duchy_1
				}
				save_scope_as = duchy_2
			}
			random_held_title = {
				title_tier = duchy
				limit = {
					NOR = {
						this = scope:duchy_1
						this = scope:duchy_2
					}
				}
				save_scope_as = duchy_3
			}
			if = { # Safeguarding against loc-breaking here
				limit = {
					exists = scope:duchy_1
					exists = scope:duchy_2
					exists = scope:duchy_3
				}
				save_scope_value_as = {
					name = three_duchies
					value = yes
				}
			}
		}
		show_as_tooltip = {
			set_primary_title_to = scope:new_title
		}
	}

	option = {
		name = major_decisions.1101.a
		custom_tooltip = major_decisions.1101.i_have_become_royal
	}
}

#My liege has founded a Kingdom
major_decisions.1102 = {
	type = character_event
	title = major_decisions.1101.t
	desc = major_decisions.1102.desc
	theme = realm
	left_portrait = {
		character = root
		animation = personality_greedy
	}

	immediate = { play_music_cue = "mx_cue_succession" }

	option = {
		name = {
			text = major_decisions.1102.a
			trigger = {
				reverse_opinion = {
					target = scope:founder
					value >= 0
				}
			}
		}
		name = {
			text = major_decisions.1102.a.dislike
			trigger = {
				reverse_opinion = {
					target = scope:founder
					value < 0
				}
			}
		}
		custom_tooltip = major_decisions.1102.has_become_royal
	}
}


#I have founded an Empire
major_decisions.1103 = {
	type = character_event
	title = major_decisions.1101.t
	desc = {
		triggered_desc = {
			trigger = { exists = scope:three_kingdoms }
			desc = {
				desc = major_decisions.1103.opening_kingdoms
				desc = double_line_break
			}
		}
		desc = major_decisions.1103.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = faith.religious_head
					faith.religious_head = root
				}
				desc = major_decisions.1103.i_am_religious_head
			}
			triggered_desc = {
				trigger = {
					exists = faith.religious_head
				}
				desc = major_decisions.1103.blessed_by_religious_head
			}
			desc = major_decisions.1103.i_am_religious_head
		}
	}
	theme = realm
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	
	immediate = {
		play_music_cue = "mx_cue_positive_effect"
		# If Empire is formed from three Kingdoms, specifically shout that out
		if = {
			limit = {
				any_held_title = {
					title_tier = kingdom
					count >= 3
				}
			}
			scope:old_title = { # Carried over from the decision
				save_scope_as = kingdom_1
			}
			random_held_title = {
				title_tier = kingdom
				limit = {
					this != scope:kingdom_1
				}
				save_scope_as = kingdom_2
			}
			random_held_title = {
				title_tier = kingdom
				limit = {
					NOR = {
						this = scope:kingdom_1
						this = scope:kingdom_2
					}
				}
				save_scope_as = kingdom_3
			}
			if = { # Safeguarding against loc-breaking here
				limit = {
					exists = scope:kingdom_1
					exists = scope:kingdom_2
					exists = scope:kingdom_3
				}
				save_scope_value_as = {
					name = three_kingdoms
					value = yes
				}
			}
		}
		if = {
			limit = {
				exists = faith.religious_head
			}
			faith.religious_head = {
				save_scope_as = religious_figure
			}
		}
		show_as_tooltip = {
			set_primary_title_to = scope:new_title
		}
	}

	option = {
		name = major_decisions.1103.a
		custom_tooltip = major_decisions.1101.i_have_become_royal
	}
}

#My liege has founded an Empire
major_decisions.1104 = {
	type = character_event
	title = major_decisions.1101.t
	desc = {
		desc = major_decisions.1104.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = faith.religious_head
					faith.religious_head = root
				}
				desc = major_decisions.1104.i_am_religious_head
			}
			triggered_desc = {
				trigger = {
					exists = faith.religious_head
					faith.religious_head = scope:founder
				}
				desc = major_decisions.1104.religious_head_empire
			}
			triggered_desc = {
				trigger = {
					exists = faith.religious_head
				}
				desc = major_decisions.1104.blessed_by_religious_head
			}
			desc = major_decisions.1104.religious_head_empire
		}
		desc = major_decisions.1104.end
	}
	theme = realm
	left_portrait = {
		character = root
		animation = personality_greedy
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		if = {
			limit = {
				exists = scope:founder.faith.religious_head
			}
			scope:founder.faith.religious_head = {
				save_scope_as = religious_figure
			}
		}
		show_as_tooltip = {
			set_primary_title_to = scope:new_title
		}
	}

	option = {
		name = major_decisions.1104.a
		custom_tooltip = major_decisions.1102.has_become_royal
	}
}


#I have lost de jure territory to a new Kingdom
major_decisions.1105 = {
	type = character_event
	title = major_decisions.1105.t
	desc = major_decisions.1105.desc
	theme = realm
	left_portrait = {
		character = scope:founder
		animation = personality_greedy
	}
	
	option = {
		name = major_decisions.1105.a
		show_as_tooltip = {
			every_in_list = {
				list = notification_titles
				set_de_jure_liege_title = scope:new_title
			}
		}
	}
}


################
# Found University
# by Linnéa Thimrén
################
major_decisions.2001 = {
	type = character_event
	title = major_decisions.2001.t
	desc = {
		desc = major_decisions.2001.desc_first
		first_valid = {
			triggered_desc = {
				trigger = {
					any_sub_realm_barony = {
						count >= 2
						title_province = {
							OR = {
								has_building = generic_university
								has_building = al_azhar_university
								has_building = sankore_university
								has_building = nalanda_university
							}
						}
					}
				}
				desc = major_decisions.2001.desc_more
			}
			desc = major_decisions.2001.desc
		}
	}
	theme = learning
	left_portrait = {
		character = scope:founder
		animation = personality_rational
	}

	immediate = {
		found_university_decision_event_effect = yes
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_fes }
			title:b_fes = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_fes.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_fes = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_fes
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_cairo }
			title:b_cairo = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_cairo.title_province = {
			add_special_building_slot = al_azhar_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_cairo = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_cairo
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_bologna }
			title:b_bologna = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_bologna.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_bologna = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_bologna
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_salamanca }
			title:b_salamanca = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_salamanca.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_salamanca = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_salamanca
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_madrid }
			title:b_madrid = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_madrid.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_madrid = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_madrid
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_oxford }
			title:b_oxford = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_oxford.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_oxford = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_oxford
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_cambridge }
			title:b_cambridge = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_cambridge.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_cambridge = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_cambridge
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_padua }
			title:b_padua = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_padua.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_padua = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_padua
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_siena }
			title:b_siena = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_siena.title_province = {
			add_special_building_slot = siena_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_siena = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_siena
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_coimbra }
			title:b_coimbra = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_coimbra.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_coimbra = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_coimbra
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_napoli }
			title:b_napoli = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_napoli.title_province = {
			add_special_building_slot = generic_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_napoli = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_napoli
	}

	option = {
		trigger = {
			any_sub_realm_barony = { this = title:b_tirakka }
			title:b_tirakka = {
				county = { development_level >= 30 }
				title_province = { has_special_building_slot = no }
			}
		}
		title:b_tirakka.title_province = {
			add_special_building_slot = sankore_university
			set_variable = { #To unlock the building
				name = university
				value = yes
			}
			title:b_tirakka = {
				if = {
					limit = { holder != root }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
		name = major_decisions.2001.b_tirakka
	}	

	option = { # fallback in case development somehow tumbles
		trigger = { always = no }
		fallback = yes
		name = major_decisions.2001.fallback
		custom_tooltip = major_decisions.2001.fallback.tt
	}
}

#Other players informed
major_decisions.2002 = {
	type = character_event
	title = major_decisions.2001.t
	desc = major_decisions.2002.desc
	left_portrait = {
		character = scope:founder
		animation = personality_rational
	}
	theme = learning

	option = {
		name = major_decisions.2002.a
	}
}

#A skilled courtier turns up at your court
major_decisions.2011 = {
	type = character_event
	title = major_decisions.2011.t
	desc = major_decisions.2011.desc
	theme = learning
	left_portrait = {
		character = scope:new_courtier
		animation = thinking
	}
	override_background = { reference = throne_room }
	trigger = {
		any_sub_realm_barony = {
			title_province = {
				OR = {
					has_building = generic_university
					has_building = al_azhar_university
					has_building = sankore_university
					has_building = nalanda_university
				}
			}
		}
	}

	immediate = {
		create_character = {
			employer = root
			template = scholar_character
			save_scope_as = new_courtier
		}
	}

	option = { #Welcome!
		name = major_decisions.2011.a
		scope:new_courtier = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 15
			}
		}
	}

	option = { #Send away
		name = major_decisions.2011.b
		scope:new_courtier = {
			move_to_pool = yes
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = -10
			}
		}
	}
}

#You've built a greenhouse!
major_decisions.3001 = {
	type = character_event
	title = major_decisions.3001.t
	desc = major_decisions.3001.desc
	theme = stewardship
	left_portrait = {
		character = scope:builder
		animation = personality_irrational
	}
	override_background = { reference = garden }

	immediate = {
		lunatic_building_decision_effect = yes
		play_music_cue = "mx_cue_low_key_positive"
	}

	option = {
		name = major_decisions.3001.a
	}
}


#Other players informed
major_decisions.3002 = {
	type = character_event
	title = major_decisions.3001.t
	desc = major_decisions.3002.desc
	theme = stewardship
	left_portrait = {
		character = scope:builder
		animation = personality_irrational
	}
	override_background = { reference = garden }

	option = {
		name = major_decisions.3002.a
	}
}

##################################################
# Special Succession Acquisition
# by Ewan Cowhig Croft
##################################################

major_decisions.3100 = {
	type = character_event
	title = major_decisions.3100.t
	desc = major_decisions.3100.desc
	theme = realm
	left_portrait =	{
		character = root
		animation = personality_rational
	}

	#Change based on my culture. Or, occasionally, dynasty.
	option = {
		name = major_decisions.3100.a
		trigger = {
			OR = {
				special_succession_witengamot_trigger = yes
				special_succession_thing_trigger = yes
				special_succession_tanistry_trigger = yes
				special_succession_jirga_trigger = yes
			}
		}
		if = {
			limit = { special_succession_witengamot_trigger = yes }
			special_succession_witengamot_effect = yes
		}
		else_if = {
			limit = { special_succession_thing_trigger = yes }
			special_succession_thing_effect = yes
		}
		else_if = {
			limit = { special_succession_tanistry_trigger = yes }
			special_succession_tanistry_effect = yes
		}
		else_if = {
			limit = { special_succession_jirga_trigger = yes }
			special_succession_jirga_effect = yes
		}
		ai_chance = {	#The AI should always do this.
			base = 100
		}
	}
	
	#Change based on my faith; not currently used, but can be set up in future if needed.
	#option = {
		#name = major_decisions.3100.b
		#ai_chance = {	#Stay away, robots.
			#base = 0
		#}
	#}

	#Actually, no thanks.
	option = {
		name = major_decisions.3100.d
		ai_chance = {	#Seriously, stay away.
			base = 0
		}
		hidden_effect = { # Reimburse cost.
			add_prestige_no_experience = 300
		}
	}
}

###################
# Merge Aquitaine #
###################
major_decisions.3200 = {
	type = character_event
	title = major_decisions.3200.t
	desc = major_decisions.3200.desc
	theme = realm
	left_portrait =	{
		trigger = {
			this != scope:rightful_liege
		}
		character = root
		triggered_animation = {
			trigger = {
				NOR = {
					opinion = {
						target = scope:rightful_liege
						value >= 25
					}
					root.culture = scope:rightful_liege.culture
					culture = { any_parent_culture_or_above = { this = scope:rightful_liege.culture } }
				}
			}
			animation = disapproval
		}
		animation = obsequious_bow
	}

	right_portrait = {
		character = scope:rightful_liege
		animation = personality_honorable
	}

	immediate = {
		show_as_tooltip = {
			destroy_title = scope:destroyed_title
			scope:rightful_title = {
				if = {
					limit = {
						this = title:k_aquitaine
					}
					every_in_de_jure_hierarchy = {
						custom = merge_aquitaine_decision_tooltip_alt
						custom_tooltip = merge_aquitaine_decision_tooltip_2_alt
					}
				}
				else = {
					every_in_de_jure_hierarchy = {
						custom = merge_aquitaine_decision_tooltip_original
						custom_tooltip = merge_aquitaine_decision_tooltip_2_original
					}
				}
			}
		}
	}

	option = {
		name = major_decisions.3200.a
		trigger = {
			NOR = {
				opinion = {
					target = scope:rightful_liege
					value >= 25
				}
				root.culture = scope:rightful_liege.culture
				culture = { any_parent_culture_or_above = { this = scope:rightful_liege.culture } }
			}
		}
	}

	option = {
		name = major_decisions.3200.b
		trigger = {
			OR = {
				opinion = {
					target = scope:rightful_liege
					value >= 25
				}
				root.culture = scope:rightful_liege.culture
				culture = { any_parent_culture_or_above = { this = scope:rightful_liege.culture } }
			}
		}
	}
}
#Restore Carthage 
major_decisions.3300 = { 
	type = character_event
	title = major_decisions.3300.t
	desc = major_decisions.3300.desc
	theme = crown

	override_effect_2d = { reference = legend_glow }

	left_portrait = {
		character = root 
		animation = sword_coup_degrace
		camera = camera_torso_scheme_right_look_right
	}

	immediate = {
		restore_carthage_scripted_effect = yes

		culture = { save_scope_as = founder_culture }
	}

	option = {
		name = major_decisions.3300.a

		hidden_effect = {
			culture:carthaginian = {
				get_all_innovations_from = scope:founder_culture
			}
		}

		#convert people to your new culture
		convert_family_culture_and_notify_vassals_effect = {
			OLD_CULTURE = root.culture
			NEW_CULTURE = culture:carthaginian
			CONVERTER = root
		}
		
		#convert capital counties to carthaginian
		title:c_tunis = {
			set_county_culture = culture:carthaginian
		}
		title:c_tripolitana = {
			set_county_culture = culture:carthaginian
		}
		title:c_algier = {
			set_county_culture = culture:carthaginian		
		}
		title:c_murcia = {
			set_county_culture = culture:carthaginian
		}
	}

	option = {
		name = major_decisions.3300.b
	}
}

##############
# Carantania #
##############
major_decisions.3400 = {
	type = character_event
	title = major_decisions.3400.t
	desc = major_decisions.3400.desc
	theme = crown
	override_background = ce1_legendary_spring
	left_portrait =	{
		character = root
		animation = pondering
	}
	window = big_event_window

	widget = { gui = event_window_widget_vfx_godray container = foreground_shader_vfx_container }

	immediate = {
		decision_restore_carantania_effect = yes
	}

	option = {
		name = major_decisions.3400.a
	}
}

###########
# Cumbria #
###########
major_decisions.3500 = {
	type = character_event
	title = major_decisions.3500.t
	desc = major_decisions.3500.desc
	theme = crown
	override_background = council_chamber
	left_portrait =	{
		character = root
		animation = pondering
	}
	window = big_event_window

	widget = { gui = event_window_widget_vfx_godray container = foreground_shader_vfx_container }

	immediate = {
		form_cumbria_decision_scripted_effect = yes
	}

	option = {
		name = major_decisions.3500.a
	}
}
#
####################
## Cossack Kingdom #
####################
#
##Create Cossack Kingdom
#major_decisions.3600 = { 
#	type = character_event
#	title = major_decisions.3600.t
#	desc = major_decisions.3600.desc
#	theme = crown
#	override_background = council_chamber
#
#	window = big_event_window
#
#	override_effect_2d = { reference = legend_glow }
#
#	left_portrait = {
#		character = root 
#		animation = sword_coup_degrace
#		camera = camera_torso_scheme_right_look_right
#	}
#
#	immediate = {
#		create_cossack_scripted_effect = yes
#	}
#
#	option = {
#		name = major_decisions.3600.a
#		convert_family_culture_and_notify_vassals_effect = {
#			OLD_CULTURE = scope:founder_culture
#			NEW_CULTURE = scope:new_culture
#			CONVERTER = root
#		}
#	}
#	option = {
#		name = major_decisions.3600.b
#	}
#}
#