# 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
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = gavelkind
		}
		ai_will_do = {
			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
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = elective_gavelkind
		}
	}

	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 = {
					is_pagan_religion = no
					is_reformed_pagan_religion = yes
					is_tribal = no
					has_global_flag = ancient_religions
				}
			}
			OR = {
				NOT = { tier = baron }
				holder_scope = { is_patrician = yes }
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = seniority
		}
	}

	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 = {
							is_pagan_religion = no
							religion = bon
							is_reformed_pagan_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 }
					}
				}
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = primogeniture
		}
	}

	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 = {
					is_pagan_religion = no
					is_reformed_pagan_religion = yes
					is_tribal = no
					has_global_flag = ancient_religions
				}
			}
			NOT = { tier = baron }
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = feudal_elective
		}
	}

	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 }
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		effect = {
			succession = tanistry
		}
	}

	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 = {
					is_pagan_religion = no
					is_reformed_pagan_religion = yes
					is_tribal = no
					culture = mongol
					religion = bon
					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 }
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			succession = ultimogeniture
		}
	}
	
	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
				}
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		allow = {
		}
		effect = {
			pf_save_old_succ_law_effect = yes
			succession = turkish_succession
		}
	}
	
	succ_papal_succession = {
		potential = {
			OR = {
				title = k_papal_state
				title = k_chalcedonian
				title = d_celtic_pagan_reformed
				title = d_pontifex_maximus
				title = d_cathar
				title = d_bogomilist
				title = d_manichean
				title = d_fraticelli
			}
		}
		effect = {
			succession = papal_succession
		}
	}
	
	succ_appointment = {
		potential = {
			holder_scope = {
				is_feudal = yes
				independent = no
				any_liege = { holy_order = yes }
				is_merchant_republic = no
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		effect = {
			succession = appointment
		}
	}
	
	succ_open_elective = {
		potential = {
			NOR = {
				title = k_papal_state
				title = k_chalcedonian
				title = d_celtic_pagan_reformed
				title = d_pontifex_maximus
				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 = roman_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 } }
				}
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		effect = {
			succession = open_elective
		}
	}
	
	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
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		effect = {
			succession = catholic_bishopric
		}
	}

	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
			}
			NOT = { holder_scope = { government = confucian_bureaucracy } }
			NOT = { holder_scope = { government = chinese_imperial_government } }
		}
		effect = {
			succession = patrician_elective
		}
	}
	
	succ_offmap_succession = {
		potential = {
			holder_scope = {
				top_liege = { is_offmap_governor = yes }
				government = confucian_bureaucracy # To use this with future offmap powers, use an OR clause here with the new government types
			}
		}
		effect = {
			succession = offmap_succession
			# This succession type generates a character of China's culture and religion
			# They have decent (4-10) stats, and good (7-11) stewardship, and will always have a Stewardship education
			# The offmap power defined in the top liege's government is used to determine the culture and religion. Will not function if this isn't defined
		}
		revoke_allowed = {
			always = no
		}			
	}
	
	succ_nomad_succession = {
		potential = {
			holder_scope = {
				is_nomadic = yes
			}
		}
		effect = {
			succession = nomad_succession
		}
	}
}

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
		}
		ai_will_do = {
			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
		}
		ai_will_do = {
			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
		}
		ai_will_do = {
			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
		}
	}
	
	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
		}
	}
}
