###################################
#
# Better gender laws
# - events for setting the game up and giving out titles
#	#	( BGL.121 to BGL.140)
#
###################################

#	By: The Dark Master

namespace = BGL

#Set things up, let players decide if they want to change their succession law out the gate
character_event = {
	id = BGL.121
	
	trigger = {
		religion = catholic
		controls_religion = yes # Let it happen for the Pope - he's always around
		NOT = { has_global_flag = better_gender_setup }
	}
	
	immediate = {
		set_global_flag = better_gender_setup
		narrative_event = { id = BGL.122 days = 1 }
	}
}
	
narrative_event = {
	id = BGL.122
	title = EVTNAME_BGL_122
	desc = EVTDESC_BGL_122
	
	major = yes
	only_rulers = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_122	#default (agnatic-cognatic)
		ai_chance = {
			factor = 1
			modifier  = {
				factor = 0
				culture = basque
			}
		}
	}
	
	option = {
		name = EVTOPTB_BGL_122	#absolute cognatic
		ai_chance = {
			factor = 1
			modifier  = {
				factor = 0
				NOT = { culture = basque }
			}
		}
		trigger = {
			NOT = { religion_group = muslim }
			NOT = { religion = tengri_pagan_reformed }
			NOT = { religion = tengri_pagan }
			has_horde_culture = no
			is_merchant_republic = no
			is_patrician = no
			
			primary_title = {
				higher_tier_than = baron
				is_landless_type_title = no
				is_primary_type_title = no
			}
		}
		
		primary_title = { 
			gender_succ = true_cognatic
			#recalc_succession
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					is_feudal = yes
					NOT = { religion_group = muslim }
					NOT = { religion = tengri_pagan_reformed }
					NOT = { religion = tengri_pagan }
					has_horde_culture = no
				}
				
				letter_event = {
					id = BGL.123
					days = 1
				}
			}
		}
	}
	
	option = {
		name = EVTOPTC_BGL_122	#enatic-cognatic
		ai_chance = {
			factor = 0
		}
		trigger = {
			NOT = { religion_group = muslim }
			NOT = { religion = tengri_pagan_reformed }
			NOT = { religion = tengri_pagan }
			has_horde_culture = no
			is_merchant_republic = no
			is_patrician = no
			
			primary_title = {
				higher_tier_than = baron
				is_landless_type_title = no
				is_primary_type_title = no
			}
		}
		
		primary_title = { 
			gender_succ = enatic_cognatic
			#recalc_succession
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					is_feudal = yes
					NOT = { religion_group = muslim }
					NOT = { religion = tengri_pagan_reformed }
					NOT = { religion = tengri_pagan }
					has_horde_culture = no
				}
				
				letter_event = {
					id = BGL.124
					days = 1
				}
			}
		}
	}
	
}

#Send a message to your vassals to tell them the liege's succession law has changed to absolute cognatic
letter_event = {
	id = BGL.123
	title = EVTNAME_BGL_123
	desc = EVTDESC_BGL_123
	
	is_triggered_only = yes
	
	option = {
		name = OK
		trigger = {
			ai = no
		}
	}
	
	#AI only, become absolute cognatic
	option = {
		name = OK
		trigger = {
			ai = yes
		}
		
		primary_title = {
			gender_succ = true_cognatic
			#recalc_succession
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					is_feudal = yes
					NOT = { religion_group = muslim }
					NOT = { religion = tengri_pagan_reformed }
					NOT = { religion = tengri_pagan }
					has_horde_culture = no
				}
				
				letter_event = {
					id = BGL.123
					days = 1
				}
			}
		}
	}
	
}

#Send a message to your vassals to tell them the liege's succession law has changed to enatic-cognatic
letter_event = {
	id = BGL.124
	title = EVTNAME_BGL_124
	desc = EVTDESC_BGL_124
	
	is_triggered_only = yes
	
	option = {
		name = OK
		trigger = {
			ai = no
		}
	}
	
	#AI only, become enatic-cognatic
	option = {
		name = OK
		trigger = {
			ai = yes
		}
		
		primary_title = {
			gender_succ = enatic_cognatic
			#recalc_succession
		}
		
		hidden_tooltip = {
			any_vassal = {
				limit = {
					is_feudal = yes
					NOT = { religion_group = muslim }
					NOT = { religion = tengri_pagan_reformed }
					NOT = { religion = tengri_pagan }
					has_horde_culture = no
				}
				
				letter_event = {
					id = BGL.124
					days = 1
				}
			}
		}
	}
	
}