﻿holy_order_succession_law = {
law_group_type = succession_order_laws
index = 13
		can_keep = {
			can_have_holy_order_succession_law_trigger = yes # same as can_have
		}
		can_have = {
			can_have_holy_order_succession_law_trigger = yes
		}
		should_start_with = {
			government_has_flag = government_is_holy_order
		}
		succession = {
			order_of_succession = appointment
			NOT = {
			primary_title ?= {
				has_variable = order_heritage
			}
		   }
			appointment_type = holy_order
		}
		flag = appointment_type_succession

		potential = {
			can_have_holy_order_succession_law_trigger = yes
		}
	}
cultural_holy_order_succession_law = {
	law_group_type = succession_order_laws
	index = 14

	can_keep = {
		can_have_cultural_holy_order_succession_law_trigger = yes # same as can_have
	}
	can_have = {
		can_have_cultural_holy_order_succession_law_trigger = yes
	}
	should_start_with = {
		government_has_flag = government_is_military_holy_order
		primary_title ?= {
			has_variable = order_heritage
		}
	}
	succession = {
		order_of_succession = appointment
			NOT = {
			primary_title ?= {
				has_variable = order_heritage
			}
		   }
			appointment_type = holy_order
	}
    
	flag = appointment_type_succession
	
	potential = {
		can_have_cultural_holy_order_succession_law_trigger = yes
	}
}


mercenary_company_succession_law = {
	law_group_type = succession_order_laws
	index = 8

	can_keep = {
		can_have_mercenary_succession_law_trigger = yes
		
	}
	can_have = {
		can_have_mercenary_succession_law_trigger = yes
	}
	can_pass = {
		can_change_appointment_succession_law_trigger = yes
	}
	should_start_with = {
		government_has_flag = government_is_mercenary
	}
	succession = {
		order_of_succession = appointment
		appointment_type = mercenary
	}
	flag = advanced_succession_law
	flag = appointment_type_succession
	pass_cost = {
		prestige = change_succession_law_prestige_cost
	}
	revoke_cost = {
		prestige = change_succession_law_prestige_cost
	}

	ai_will_do = {
		if = {
			limit = {
				OR = {
					has_realm_law = confederate_partition_succession_law
					has_realm_law = partition_succession_law
					has_realm_law = high_partition_succession_law
				}
			}
			value = 3
		}
	}

	potential = {
		government_has_mechanic = mercenary # Default succession law for all admin types...
		NOR = { # ... Unless you have a unique succession available
			government_has_flag = government_is_japan_administrative
			government_has_flag = government_has_merit
		}
	}
}

bishopric_elective_succession_law = {
	law_group_type = succession_order_laws
	index = 10

	can_have = {
		should_use_theocratic_elective_succession_law_trigger = yes
	}
	can_pass = {
		always = yes
	}
	can_title_have = {
		always = yes
	}
	succession = {
		order_of_succession = election
		election_type = bishopric
		faith = same_faith
		resign_outside_realm = yes
	}
	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
	}
	potential = {
		should_use_theocratic_elective_succession_law_trigger = yes
	}

	modifier = {
		rite_creation_piety_cost_mult = 3 # Steers the Pope toward Bulls and Councils rather than editing rites directly
		character_travel_speed = 15
		character_travel_safety = 15 # He has to reach coronations and councils across Europe
		enemy_hostile_scheme_success_chance_max_add = -20
		enemy_hostile_scheme_success_chance_growth_add = -2 # The Curia around him makes murder harder
	}
}

bishopric_succession_law = {
	law_group_type = succession_order_laws
	index = 9

	can_keep = {
		government_has_flag = government_is_theocracy
	}
	can_have = {
		government_has_flag = government_is_theocracy
	}
	can_pass = {
		government_has_flag = government_is_theocracy
	}
	should_start_with = {
		government_has_flag = government_is_theocracy
	}
	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 = inheritance
		traversal_order = children
		rank = oldest
		title_division = single_heir
		exclude_rulers = yes
		limit_to_courtiers = yes
	}
	flag = can_designate_heirs

	potential = {
		government_has_flag = government_is_theocracy
	}
}