# DO NOT ALTER THE NAME OR NUMBER OF THESE!

succession_laws = {

	succ_gavelkind = {
		oldest_child_opinion = -20
		child_opinion = 30
		dynasty_opinion = 10
		vassal_opinion = 5
	
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				NOT = { religion_group = muslim }
				is_merchant_republic = no
				is_patrician = no
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
				in_revolt = no
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			
			rebel = no
			
			OR = {
				holder_scope = { is_feudal = yes }
				holder_scope = { is_tribal = yes }
			}
			is_primary_type_title = no
		}
		allow = {
			holder_scope = {
				OR = {
					is_tribal = no
					NOT = { religion_group = pagan_group }
				}
			}
		}
		effect = {
			succession = gavelkind
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_elective_gavelkind = {
		child_opinion = 25
		dynasty_opinion = 10
	
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				NOT = { religion_group = muslim }
				is_merchant_republic = no
				is_patrician = no
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
				in_revolt = no
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			
			rebel = no
			
			OR = {
				holder_scope = { is_feudal = yes }
				holder_scope = { is_tribal = yes }
			}
			is_primary_type_title = no
		}
		effect = {
			succession = elective_gavelkind
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_seniority = {
		oldest_child_opinion = -30
		child_opinion = -20
		dynasty_opinion = 20
	
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				OR = {
					is_merchant_republic = no
					primary_title = {
						NOT = { title = PREVPREV }
					}
				}
				
				NOT = { religion_group = muslim }
				NOT = { religion_group = indian_group }
				
				OR = {
					NOT = { religion_group = pagan_group }
					is_reformed_religion = yes
					religion = hellenic_pagan
					is_patrician = yes
				}
				
				OR = {
					is_republic = no
					is_patrician = yes
				}
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			OR = {
				AND = {
					tier = baron
					is_feudal = yes
				}
				holder_scope = { is_feudal = yes }
				holder_scope = { is_patrician = yes }
			}
			
			is_primary_type_title = no
			
			OR = {
				NOT = { tier = baron }
				holder_scope = { is_patrician = yes }
			}
		}
		
		allow = {
			OR = {
				hidden_tooltip = {
					has_crown_law_title = no
				}
				holder_scope = {
					is_patrician = yes 
					OR = {
						is_merchant_republic = no
						PREV = {
							is_primary_holder_title = no
						}
						NOT = {
							in_revolt = yes
							succ_law_title = {
								title = PREV
							}
						}
					}
				}
				crownlaw_title = {
					OR = {
						has_law = crown_authority_2
						has_law = crown_authority_3
						has_law = crown_authority_4
					}
				}
			}
		}
		
		effect = {
			succession = seniority
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_primogeniture = {
		oldest_child_opinion = 30
		youngest_child_opinion = -30
		child_opinion = -20
		potential = {
			holder_scope = {
				NOT = { religion_group = muslim }
				is_merchant_republic = no
				is_patrician = no
			}
			OR = {
				holder_scope = { # Viceroyalties can always have primogeniture if not muslim
					any_demesne_title = {
						is_vice_royalty = yes
					}
				}
				AND = {
					holder_scope = {
						OR = {
							independent = yes
							NOT = {
								any_liege = {
									holy_order = yes
								}
							}
						}
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							religion = hellenic_pagan
						}
					}
					OR = {
						is_landless_type_title = no
						is_tribal_type_title = yes
						temporary = yes
					}
					is_primary_type_title = no
					OR = {
						AND = {
							tier = baron
							is_feudal = yes
						}
						holder_scope = { is_feudal = yes }
					}
				}
			}
		}
		allow = {
			OR = {
				holder_scope = { # Viceroyalties can always have primogeniture if not muslim
					any_demesne_title = {
						is_vice_royalty = yes
					}
				}
				OR = {
					hidden_tooltip = {
						has_crown_law_title = no
					}
					crownlaw_title = {
						OR = {
						has_law = crown_authority_2
						has_law = crown_authority_3
						has_law = crown_authority_4
						}
					}
				}
			}
		}
		
		effect = {
			succession = primogeniture
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_feudal_elective = {
		oldest_child_opinion = -30
		child_opinion = -20
		dynasty_opinion = -10
		vassal_opinion = 10

		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				NOT = { religion_group = muslim }
				NOT = { religion_group = indian_group }
				is_merchant_republic = no
				is_patrician = no
				
				OR = {
					NOT = { religion_group = pagan_group }
					is_reformed_religion = yes
					religion = hellenic_pagan
				}
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			is_primary_type_title = no
			NOT = { tier = baron }
			holder_scope = { is_feudal = yes }
		}
		effect = {
			succession = feudal_elective
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_tanistry = {
		oldest_child_opinion = -40
		child_opinion = -20
		dynasty_opinion = 10
		vassal_opinion = 5
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				NOT = { religion_group = muslim }
				is_merchant_republic = no
				is_patrician = no
				culture_group = celtic
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			is_primary_type_title = no
			NOT = { tier = baron }
			OR = {
				AND = {
					tier = baron
					is_feudal = yes
				}
				holder_scope = { is_feudal = yes }
			}
		}
		effect = {
			succession = tanistry
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_ultimogeniture = {
		youngest_child_opinion = 20
		oldest_child_opinion = -30
		child_opinion = -20
		dynasty_opinion = -5
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
				OR = {
					culture = mongol
					AND = {
						NOT = { religion = norse_pagan }
						NOT = { religion = tengri_pagan }
						NOT = { religion = baltic_pagan }
						NOT = { religion = finnish_pagan }
						NOT = { religion = aztec }
						NOT = { religion = pagan }
						NOT = { religion = slavic_pagan }
						NOT = { religion = west_african_pagan }
					}
				}
				
				NOT = { religion_group = muslim }
				is_merchant_republic = no
				is_patrician = no
				OR = {
					independent = yes
					NOT = {
						any_demesne_title = {
							is_vice_royalty = yes
						}
					}
				}
			}
			OR = {
				is_landless_type_title = no
				is_tribal_type_title = yes
				temporary = yes
			}
			is_primary_type_title = no
			OR = {
				AND = {
					tier = baron
					is_feudal = yes
				}
				holder_scope = { is_feudal = yes }
			}
		}
		allow = {
			OR = {
				hidden_tooltip = {
					has_crown_law_title = no
				}
				crownlaw_title = {
					NOT = { has_law = crown_authority_0 }
				}
			}
		}
		
		effect = {
			succession = ultimogeniture
		}
		revoke_allowed = {
			always = no
		}
	}

	succ_turkish_succession = {
		oldest_child_opinion = -20
		child_opinion = 30
		dynasty_opinion = 10
		potential = {
			holder_scope = {
				religion_group = muslim
				is_republic = no
				is_merchant_republic = no
			}
			OR = {
				holder_scope = { # Viceroyalties can always have turkish succession if muslim
					any_demesne_title = {
						is_vice_royalty = yes
					}
				}
				AND = {
					OR = {
						is_landless_type_title = no
						is_tribal_type_title = yes
						temporary = yes
					}
					holder_scope = {
						OR = {
							independent = yes
							NOT = {
								any_liege = {
									holy_order = yes
								}
							}
						}
					}
					is_primary_type_title = no
				}
			}
		}
		effect = {
			succession = turkish_succession
		}
		revoke_allowed = {
			always = no
		}			
	}
	succ_papal_succession = {
		potential = {
			title = k_papal_state
		}
		
		effect = {
			succession = papal_succession
		}
		revoke_allowed = {
			always = no
		}		
	}
	
	# Titles revert back to the liege on death
	succ_appointment = {
		potential = {
			holder_scope = {
				is_feudal = yes
				independent = no
				any_liege = {
					holy_order = yes
				}
				is_merchant_republic = no
			}
		}
		effect = {
			succession = appointment
		}
		revoke_allowed = {
			always = no
		}		
	}
	
	succ_open_elective = {
		potential = {
			NOT = { title = k_papal_state }
			temporary = no
			OR = {
				is_primary_type_title = yes
				holy_order = yes
				AND = {
					tier = baron
					OR = {
						is_republic = yes
						AND = {
							is_theocracy = yes
							NOT = { holder_scope = { religion_group = muslim } }
						}
					}
				}
				holder_scope = {
					OR = {
						is_republic = yes
						AND = {
							is_theocracy = yes
							NOT = { religion_group = muslim }
						}
					}
				}
			}
			OR = {
				is_landless_type_title = yes
				holder_scope = { is_theocracy = no }
				holder_scope = { 
					NOT = { religion = catholic }
					NOT = { religion = fraticelli }
				}
			}
			holder_scope = { 
				is_patrician = no
				is_merchant_republic = no
				OR = {
					independent = yes
					is_feudal = no
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
			}
		}
		
		effect = {
			succession = open_elective
		}
		revoke_allowed = {
			always = no
		}
	}
	succ_catholic_bishopric = {
		potential = {
			is_landless_type_title = no
			OR = {
				AND = {
					tier = baron
					is_theocracy = yes
				}
				holder_scope = { is_theocracy = yes }
			}
			
			holder_scope = {
				OR = {
					religion = catholic
					religion = fraticelli
				}
				is_merchant_republic = no
				OR = {
					independent = yes
					is_feudal = no
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
				}
			}
			is_primary_type_title = no
		}
		effect = {
			succession = catholic_bishopric
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_patrician_elective = {
		potential = {
			OR = {
				is_primary_holder_title = yes
				AND = {
					holder_scope = {
						in_revolt = yes
						succ_law_title = {
							title = PREVPREV
						}
					}
				}
			}
			holder_scope = {
				is_merchant_republic = yes
			}
		}
		effect = {
			succession = patrician_elective
		}
		revoke_allowed = {
			always = no
		}			
	}
}

gender_laws = {
	cognatic_succession = {
		potential = {
			holder_scope = {
				OR = {
					independent = yes
					NOT = {
						any_liege = {
							holy_order = yes
						}
					}
					is_merchant_republic = yes
				}
				NOT = { religion_group = muslim }
				NOT = { religion = aztec }
				NOT = { religion = aztec_reformed }
				is_tribal = no
				has_horde_culture = no
				is_merchant_republic = no
				is_patrician = no
			}
			
			is_landless_type_title = no
			
			OR = {
				AND = {
					tier = baron
					is_theocracy = no
					is_republic = no
				}
				holder_scope = {
					is_theocracy = no
					is_republic = no
				}
			}
			
			is_primary_type_title = no
		}
		
		effect = {
			gender_succ = cognatic
		}
		revoke_allowed = {
			always = no
		}			
	}
	agnatic_succession = {
		female_dynasty_opinion = -10
	
		potential = {
			always = yes
		}
		effect = {
			gender_succ = agnatic
		}
		revoke_allowed = {
			always = no
		}			
	}
	true_cognatic_succession = {
		male_dynasty_opinion = -10
		
		potential = {
			holder_scope = { 
				NOT = { religion_group = muslim }
				NOT = { religion = aztec }
				NOT = { religion = aztec_reformed }
				is_tribal = no
				has_horde_culture = no
				is_merchant_republic = no
				is_patrician = no
			}
			
			is_landless_type_title = no
			
			OR = {
				AND = {
					tier = baron
					is_theocracy = no
					is_republic = no
				}
				holder_scope = {
					is_theocracy = no
					is_republic = no
				}
			}
			
			is_primary_type_title = no
		}
		allow = {
			holder_scope = {
				OR = {
					culture = basque
					religion = cathar
					religion = messalian
				}
			}
		}
		effect = {
			gender_succ = true_cognatic
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	enatic_succession = {
		male_dynasty_opinion = 0
		female_dynasty_opinion = 0
		
		potential = {
			holder_scope = {
				religion_group = god_group
			}
		}
		allow = {
			holder_scope = {
				religion_group = god_group
			}
		}
		effect = {
			gender_succ = enatic
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	enatic_cognatic_succession = {
		male_dynasty_opinion = 0
		female_dynasty_opinion = 0
		
		potential = {
			holder_scope = {
				religion_group = god_group
			}
		}
		allow = {
			holder_scope = {
				religion_group = god_group
			}
		}
		effect = {
			gender_succ = enatic_cognatic
		}
		revoke_allowed = {
			always = no
		}			
	}
	
}
