title_succession_laws = {
	# Default Feudal Elective
	feudal_elective_succession_law = {
		can_have = {
			government_has_flag = government_is_feudal
			highest_held_title_tier >= tier_county
			NOR = { #Cultures have their special flavor.
				culture = { has_cultural_parameter = witenagemot_succession_enabled }
				culture = { has_cultural_parameter = scandinavian_elective_enabled }
				culture = { has_cultural_parameter = tribal_elective_enabled } #FP3 addition
			}
		}
		can_pass = {
			can_change_title_law_trigger = yes
		}
		can_title_have = {
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = feudal_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 10
		revoke_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# HRE Succession
	princely_elective_succession_law = {
		can_have = {
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
			}
			highest_held_title_tier = tier_empire
		}
		can_pass = {
			can_change_title_law_trigger = yes
		}
		can_title_have = {
			this = title:e_hre
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = princely_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 10
		modifier = {
			vassal_limit = 20
			minority_opinion = -15
		}
		revoke_cost = {
			prestige = change_hre_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# Witenagemot
	saxon_elective_succession_law = {
		can_have = {
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
				government_has_flag = government_is_tribal
			}
			highest_held_title_tier >= tier_kingdom
		}
		can_pass = {
			can_change_title_law_trigger = yes
			culture = { has_cultural_parameter = witenagemot_succession_enabled }
		}
		can_title_have = {
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = saxon_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 5
		revoke_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# Thing
	scandinavian_elective_succession_law = {
		can_have = {
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
				government_has_flag = government_is_tribal
			}
			highest_held_title_tier >= tier_duchy
		}
		can_pass = {
			can_change_title_law_trigger = yes
			culture = { has_cultural_parameter = scandinavian_elective_enabled }
		}
		can_title_have = {
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = scandinavian_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 5
		revoke_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# Tanistry
	gaelic_elective_succession_law = {
		can_have = {
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
				government_has_flag = government_is_tribal
			}
			highest_held_title_tier >= tier_duchy
		}
		can_pass = {
			can_change_title_law_trigger = yes
			custom_description = {
				OR = {
					culture = { has_cultural_pillar = heritage_brythonic }
					culture = { has_cultural_pillar = heritage_goidelic }
				}
				text = succession_laws_must_have_valid_tanistry_culture
			}
		}
		can_title_have = {
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = gaelic_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 5
		revoke_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# Jirga elective
	tribal_elective_succession_law = { #FOR FP3
		can_have = {
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_clan
				government_has_flag = government_is_tribal
			}
			highest_held_title_tier >= tier_kingdom
		}
		can_pass = {
			can_change_title_law_trigger = yes
			culture = { has_cultural_parameter = tribal_elective_enabled }
		}
		can_title_have = {
			can_title_have_law_general_trigger = yes
		}
		succession = {
			order_of_succession = election
			election_type = tribal_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 5
		revoke_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}

	# Player Heir
	temporal_head_of_faith_succession_law = {
		can_title_have = {
			is_temporal_head_of_faith_trigger = yes
		}
		should_show_for_title = { # Never show this in the UI, just apply it through script
			always = no
		}
		can_remove_from_title = {
			custom_description = {
				text = succession_laws_must_not_be_temporal
				is_temporal_head_of_faith_trigger = no
			}
		}
		succession = {
			order_of_succession = player_heir
		}
	}

	# Noble Family Succession
	noble_family_succession_law = {
		can_title_have = {
			is_noble_family_title = yes
		}
		should_show_for_title = { # Never show this in the UI, just apply it through script
			always = no
		}
		can_remove_from_title = {
			always = no
		}
		succession = {
			order_of_succession = noble_family
			title_division = single_heir
		}
		flag = can_designate_heirs
	}

	# Law of the Land Title Succession
	# Applied in on_title_gain when a county title's capital province has required heir government types defined and the new holder does not meet the requirement. 
	law_of_the_land_succession_law = {
		can_title_have = {
			tier = tier_county
			title_province = {
				holding_type = {
					has_required_heir_governments = yes
					NOT = {
						any_required_heir_government_type = {
							this = root.holder.government_type
						}
					}
				}
			}
		}
		# Never show this in the UI, just apply it through script
		should_show_for_title = { always = no }
		can_remove_from_title = { always = no }
		succession = {
			order_of_succession = generate_from_template
		}
	}
	#Confederation elective
	confederation_elective_succession_law = {
		can_title_have = {
			tier >= tier_kingdom
		}
		should_show_for_title = {
			has_variable = confederation_culture
		}
		succession = {
			order_of_succession = election
			election_type = confederation_elective
		}
		flag = elective_succession_law
		title_allegiance_opinion = 10
		revoke_cost = {
			prestige = {
				value = change_title_succession_law_prestige_cost
				multiply = 8
				if = {
					limit = {
						NOR = {
							government_has_flag = government_is_tribal
							government_has_flag = government_is_nomadic
						}
					}
					multiply = 0.1
				}
			}
		}
		pass_cost = {
			prestige = change_title_succession_law_prestige_cost
		}
	}
	
	# Celestial Ministry Succession
	celestial_ministry_appointment_succession_law = {
		can_have = {
			government_has_flag = government_is_celestial
		}
		can_pass = {
		}
		can_title_have = {
			OR = {
				this = title:e_minister_chancellor
				this = title:e_minister_censor
				this = title:e_minister_of_personnel
				this = title:e_minister_of_revenue
				this = title:e_minister_of_rites
				this = title:e_minister_of_war
				this = title:e_minister_of_justice
				this = title:e_minister_of_works
			}
		}
		can_realm_have = {
			always = no
		}
		can_remove_from_title = {
			custom_tooltip = {
				text = celestial_ministry_appointment_cannot_remove_desc
				always = no
			}
		}
		succession = {
			order_of_succession = appointment
			appointment_type = celestial_minister
		}
		modifier = {
			celestial_government_opinion = 5
		}
		flag = appointment_type_succession
	}
	
	# Celestial Grand Marshal Succession
	celestial_grand_marshal_appointment_succession_law = {
		can_have = {
			government_has_flag = government_is_celestial
		}
		can_pass = {
		}
		can_title_have = {
			this = title:e_minister_grand_marshal
		}
		can_realm_have = {
			always = no
		}
		can_remove_from_title = {
			custom_tooltip = {
				text = celestial_ministry_appointment_cannot_remove_desc
				always = no
			}
		}
		succession = {
			order_of_succession = appointment
			appointment_type = celestial_military_governor
		}
		modifier = {
			celestial_government_opinion = 5
		}
		flag = appointment_type_succession
	}
}


