# DO NOT ALTER THE NAME OR NUMBER OF THESE!

succession_laws = {
	succ_gavelkind = {
		oldest_child_opinion = -5
		child_opinion = 15
		dynasty_opinion = 5
		vassal_opinion = 5

		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes
			holder_scope = {
				OR = {
					is_feudal = yes
					is_tribal = yes
				}
				NOT = { religion = celtic_pagan }
				in_revolt = no
			}
		}
		allow = {
		}
		effect = {
			succession = gavelkind
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
	}
	
	succ_elective_gavelkind = {
		child_opinion = 15
		dynasty_opinion = 5
	
		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes
			rebel = no
			holder_scope = {
				NOT = { religion = celtic_pagan }
				OR = {
					is_feudal = yes
					is_tribal = yes
				}
				in_revolt = no
			}
		}
		allow = {
		}
		effect = {
			succession = elective_gavelkind
		}
		revoke_allowed = {
			always = no
		}		
	}

	succ_seniority = {
		oldest_child_opinion = -15
		child_opinion = -10
		dynasty_opinion = 10
		vassal_opinion = -5

		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes	
			holder_scope = {
				OR = {
					is_merchant_republic = no
					primary_title = {
						NOT = { title = PREVPREV }
					}
				}
				OR = {
					is_republic = no
					is_patrician = yes
				}
				OR = {
					is_feudal = yes
					is_patrician = yes
				}
				NOT = { religion_group = indian_group }
				NOT = { religion = celtic_pagan }
				OR = {
					NOT = { religion_group = pagan_group }
					is_reformed_religion = yes
					is_tribal = no
					has_global_flag = ancient_religions
				}
			}
			OR = {
				NOT = { tier = baron }
				holder_scope = { is_patrician = yes }
			}
		}
		allow = {
		}
		effect = {
			succession = seniority
		}
		revoke_allowed = {
			always = no
		}
	}

	succ_primogeniture = {
		oldest_child_opinion = 10
		youngest_child_opinion = -15
		child_opinion = -10
		dynasty_opinion = -5
		
		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			OR = {
				holder_scope = { any_demesne_title = { is_vice_royalty = yes } }
				AND = {
					holder_scope = {
						NOT = { religion_group = muslim }
						NOT = { religion = celtic_pagan }
						is_merchant_republic = no
						is_patrician = no
						OR = {
							independent = yes
							NOT = { any_liege = { holy_order = yes } }
						}
						OR = {
							NOT = { religion_group = pagan_group }
							is_reformed_religion = yes
							is_tribal = no
							has_global_flag = ancient_religions
						}
					}
					is_primary_type_title = no
					OR = {
						AND = {
							tier = baron
							is_feudal = yes
						}
						holder_scope = { is_feudal = yes }
					}
				}
			}
		}
		allow = {
		}
		effect = {
			succession = primogeniture
		}
		revoke_allowed = {
			always = no
		}
	}

	succ_feudal_elective = {
		oldest_child_opinion = -15
		child_opinion = -5
		dynasty_opinion = -5
		vassal_opinion = 10

		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes			
			holder_scope = {
				is_feudal = yes
				NOT = { religion_group = indian_group }
				NOT = { religion = celtic_pagan }
				NOT = { culture_group = celtic }
				OR = {
					NOT = { religion_group = pagan_group }
					is_reformed_religion = yes
					is_tribal = no
					has_global_flag = ancient_religions
				}
			}
			NOT = { tier = baron }
		}
		allow = {
		}
		effect = {
			succession = feudal_elective
		}
		revoke_allowed = {
			always = no
		}
	}

	succ_tanistry = {
		oldest_child_opinion = -20
		child_opinion = -10
		dynasty_opinion = 5
		vassal_opinion = 5
		
		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes			
			holder_scope = {
				NOT = { religion_group = indian_group }
				OR = {
					is_feudal = yes
					is_tribal = yes
				}
				OR = {
					culture_group = celtic
					religion = celtic_pagan
				}
			}
			NOT = { tier = baron }
		}
		effect = {
			succession = tanistry
		}
		revoke_allowed = {
			always = no
		}
	}

	succ_ultimogeniture = {
		youngest_child_opinion = 10
		oldest_child_opinion = -15
		child_opinion = -10
		dynasty_opinion = -5
		
		potential = {
			OR = {
				NOT = { e_placeholder = { has_title_flag = startup } }
				has_holder = no
			}
			emf_laws_succ_basic_potential_trigger = yes			
			holder_scope = {
				OR = {
					NOT = { religion_group = pagan_group }
					is_reformed_religion = yes
					is_tribal = no
					culture = mongol
					has_global_flag = ancient_religions
				}
				NOT = { religion = celtic_pagan }
				is_merchant_republic = no
				is_patrician = no
			}			
			OR = {
				AND = {
					tier = baron
					is_feudal = yes
				}
				holder_scope = { is_feudal = yes }
			}
		}
		allow = {
		}
		effect = {
			succession = ultimogeniture
		}
		revoke_allowed = {
			always = no
		}
	}
	
	succ_turkish_succession = {
		oldest_child_opinion = -5
		
		potential = {
			holder_scope = {
				religion_group = muslim
				is_republic = no
				is_merchant_republic = no
				is_nomadic = no
			}			
			OR = {
				holder_scope = { any_demesne_title = { is_vice_royalty = yes } }
				AND = {
					holder_scope = {
						OR = {
							independent = yes
							NOT = { any_liege = { holy_order = yes } }
						}
					}
					OR = {
						is_landless_type_title = no
						is_tribal_type_title = yes
						temporary = yes
					}
					is_primary_type_title = no
				}
			}
		}
		allow = {
		}
		effect = {
			pf_save_old_succ_law_effect = yes
			succession = turkish_succession
		}
		revoke_allowed = {
			always = no
		}
	}
	
	succ_papal_succession = {
		potential = {
			OR = {
				title = k_papal_state
				title = k_chalcedonian
				title = d_celtic_pagan_reformed
				title = d_hellenic_pagan
				title = d_cathar
				title = d_bogomilist
				title = d_manichean
				title = d_fraticelli
			}
		}
		effect = {
			succession = papal_succession
		}
		revoke_allowed = {
			always = no
		}		
	}
	
	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 = {
			NOR = {
				title = k_papal_state
				title = k_chalcedonian
				title = d_celtic_pagan_reformed
				title = d_hellenic_pagan
				title = d_cathar
				title = d_bogomilist
				title = d_manichean
				title = d_fraticelli
			}
			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 }
						}
					}
				}
				# special not-landless title
				title = k_papal_chalcedon
			}			
			OR = {
				is_landless_type_title = yes
				holder_scope = { is_theocracy = no }
				holder_scope = {
					NOR = {
						religion = catholic
						religion = chalcedonian
						religion = celtic_pagan_reformed
						religion = hellenic_pagan
						religion = cathar
						religion = bogomilist
						religion = manichean
						religion = fraticelli
					}
				}
				# special not-landless title
				title = k_papal_chalcedon
			}
			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 = chalcedonian
					religion = celtic_pagan_reformed
					religion = hellenic_pagan
					religion = cathar
					religion = bogomilist
					religion = manichean
					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
				holder_scope = {
					in_revolt = yes
					succ_law_title = {
						title = PREVPREV
					}
				}
			}
			holder_scope = {
				is_merchant_republic = yes
			}
		}
		effect = {
			succession = patrician_elective
		}
		revoke_allowed = {
			always = no
		}
	}
	
	succ_nomad_succession = {
		potential = {
			holder_scope = {
				is_nomadic = yes
			}
		}
		effect = {
			succession = nomad_succession
		}
		revoke_allowed = {
			always = no
		}			
	}
}

gender_laws = {
	cognatic_succession = {
		potential = {
			OR = {
				has_holder = no
				has_law = cognatic_succession
				NOT = { e_placeholder = { has_title_flag = startup } }
			}
			NOT = { has_global_flag = gender_equality }
			holder_scope = {
				OR = {
					independent = yes
					NOT = { any_liege = { holy_order = yes } }
					is_merchant_republic = yes
				}
			}
			OR = {
				AND = {
					tier = baron
					is_theocracy = no
					is_republic = no
				}
				holder_scope = {
					is_theocracy = no
					is_republic = no
				}
			}
			is_primary_type_title = no
		}
		allow = { }
		effect = {
			gender_succ = cognatic
			set_allows_matrilineal_marriage = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		
		default = yes
		default_selection = {
			factor = 0
			additive_modifier = {
				value = 100
				has_law = cognatic_succession
			}
			additive_modifier = {
				value = 10
				holder_scope = {
					OR = {
						culture = welsh
						culture = breton
						culture = norman
						culture = english
						culture = basque
						culture = castillan
						culture = portuguese
						culture = outremer
						is_female = yes
					}
				}
			}
		}
	}

	true_cognatic_succession = {
		male_dynasty_opinion = -5
		female_dynasty_opinion = 5

		potential = {
			OR = {
				has_holder = no
				has_law = true_cognatic_succession
				NOT = { e_placeholder = { has_title_flag = startup } }
			}
			OR = {
				AND = {
					tier = baron
					is_theocracy = no
					is_republic = no
				}
				holder_scope = {
					is_theocracy = no
					is_republic = no
				}
			}
			is_primary_type_title = no
		}
		allow = { }
		effect = {
			gender_succ = true_cognatic
			set_allows_matrilineal_marriage = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		
		default = yes
		default_selection = {
			factor = 0
			additive_modifier = {
				value = 100
				has_law = true_cognatic_succession
			}
			additive_modifier = {
				value = 20
				holder_scope = { is_feminist_trigger = yes }
			}
		}
	}
	
	agnatic_succession = {
		female_dynasty_opinion = -5

		potential = {
			OR = {
				has_holder = no
				has_law = agnatic_succession
				NOT = { e_placeholder = { has_title_flag = startup } }
			}
			NOT = { has_global_flag = gender_equality }
		}
		allow = { }
		effect = {
			gender_succ = agnatic
			set_allows_matrilineal_marriage = no
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
		ai_will_revoke = {
			factor = 0
		}
		
		default = yes
		default_selection = {
			factor = 1
		}
	}
	
	enatic_succession = {
		male_dynasty_opinion = -15
		female_dynasty_opinion = 10

		potential = {
			OR = {
				has_holder = no
				has_law = enatic_succession
				NOT = { e_placeholder = { has_title_flag = startup } }
			}
			holder_scope = {
				ai = no
			}
			OR = {
				AND = {
					tier = baron
					OR = {
						is_feudal = yes
						is_tribal = yes
					}
				}
				holder_scope = { is_feudal = yes }
				holder_scope = { is_tribal = yes }
			}
			is_primary_type_title = no
			NOT = { has_global_flag = gender_equality }
		}
		allow = { }
		effect = {
			gender_succ = enatic
			set_allows_matrilineal_marriage = yes
		}
		revoke_allowed = {
			always = no
		}
	}
	
	enatic_cognatic_succession = {
		male_dynasty_opinion = -10
		female_dynasty_opinion = 10

		potential = {
			OR = {
				has_holder = no
				has_law = enatic_cognatic_succession
				NOT = { e_placeholder = { has_title_flag = startup } }
			}
			OR = {
				AND = {
					tier = baron
					OR = {
						is_feudal = yes
						is_tribal = yes
					}
				}
				holder_scope = { is_feudal = yes }
				holder_scope = { is_tribal = yes }
			}
			is_primary_type_title = no
			NOT = { has_global_flag = gender_equality }
		}
		allow = { }
		effect = {
			gender_succ = enatic_cognatic
			set_allows_matrilineal_marriage = yes
		}
		revoke_allowed = {
			always = no
		}
	}
}
