###################################
#
# Better gender laws
# - events to tell rulers their gender succession has been changed
#	#	( BGL.161 to BGL.180)
#
###################################

#	By: The Dark Master

namespace = BGL

character_event = {	# forced to become agnatic-cognatic
	id = BGL.161
	desc = EVTDESC_BGL_161
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_161
	}
}

character_event = {	# forced to become absolute-cognatic
	id = BGL.162
	desc = EVTDESC_BGL_162
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_162
	}
}

character_event = {	# forced to become enatic-cognatic
	id = BGL.163
	desc = EVTDESC_BGL_163
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_163
	}
}

character_event = { #everyone is now Lilithian!
	id = BGL.164
	desc = EVTDESC_BGL_164
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_164
		religion = lilithian
		any_vassal = {
			limit = {
				tier = baron
			}
			religion = lilithian
		}
		
		any_courtier = {
			religion = lilithian
		}
		
		random_demesne_province = {
			religion = lilithian
		}
	}
}

character_event = { #toggle whether or not gender law forcing is available
	id = BGL.165
	desc = EVTDESC_BGL_165
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_BGL_165
		trigger = {
			NOT = { has_global_flag = vassal_law_forcing_enabled }
		}
		set_global_flag = vassal_law_forcing_enabled
	}
	
	option = {
		name = EVTOPTB_BGL_165
		trigger = {
			has_global_flag = vassal_law_forcing_enabled
		}
		clr_global_flag = vassal_law_forcing_enabled
		clr_global_flag = vassal_law_forcing
	}
}

character_event = { #make barony level mayors into women, if necessary.
	id = BGL.166
	
	only_rulers = yes
	only_men = yes
	
	hide_window = yes # This is a background event
	
	trigger = {
		is_republic = yes
		tier = baron
		NOT = { has_character_flag = not_new_mayor }
		independent = no
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		set_character_flag = not_new_mayor
	}
	
	option = {	#make a new mayor
		name = OK
		trigger = {
			liege = {
				primary_title = {
					OR = {
						has_law = true_cognatic_succession
						has_law = enatic_cognatic_succession
						has_law = enatic_succession
					}
				}
			}
		}
		
		random_list = {
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 26
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 27
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 28
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 29
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 30
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 31
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 32
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 33
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 34
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 35
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 36
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 37
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 38
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 39
				}
			}
			10 = {
				create_character = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 40
				}
			}
		}
		
		new_character = {
			hidden_tooltip = {
				if = {
					limit = {
						religion_group = indian_group
					}
					add_trait = vaishya
					character_event = { id = RoI.30121 }
				}
				ROOT = {
					primary_title = {
						gain_title = PREVPREV
					}
				}
				#move_character = PREV
				#banish = PREV
			}
		}
		
		if = {
			limit = {
				wealth = 25
				NOT = { wealth = 50 }
			}
			treasury = -25
			new_character = {
				wealth = 25
			}
		}
		
		if = {
			limit = {
				wealth = 50
				NOT = { wealth = 75 }
			}
			treasury = -50
			new_character = {
				wealth = 50
			}
		}
		
		if = {
			limit = {
				wealth = 75
				NOT = { wealth = 100 }
			}
			treasury = -75
			new_character = {
				wealth = 75
			}
		}
		
		if = {
			limit = {
				wealth = 100
				NOT = { wealth = 150 }
			}
			treasury = -100
			new_character = {
				wealth = 100
			}
		}
		
		if = {
			limit = {
				wealth = 150
				NOT = { wealth = 200 }
			}
			treasury = -150
			new_character = {
				wealth = 150
			}
		}
		
		if = {
			limit = {
				wealth = 200
				NOT = { wealth = 250 }
			}
			treasury = -200
			new_character = {
				wealth = 200
			}
		}
		
		if = {
			limit = {
				wealth = 250
				NOT = { wealth = 300 }
			}
			treasury = -250
			new_character = {
				wealth = 250
			}
		}
		
		if = {
			limit = {
				wealth = 300
				NOT = { wealth = 400 }
			}
			treasury = -300
			new_character = {
				wealth = 300
			}
		}
		
		if = {
			limit = {
				wealth = 400
				NOT = { wealth = 500 }
			}
			treasury = -400
			new_character = {
				wealth = 400
			}
		}
		
		if = {
			limit = {
				wealth = 500
				NOT = { wealth = 600 }
			}
			treasury = -500
			new_character = {
				wealth = 500
			}
		}
		
		if = {
			limit = {
				wealth = 600
				NOT = { wealth = 700 }
			}
			treasury = -600
			new_character = {
				wealth = 600
			}
		}
		
		if = {
			limit = {
				wealth = 700
				NOT = { wealth = 800 }
			}
			treasury = -700
			new_character = {
				wealth = 700
			}
		}
		
		if = {
			limit = {
				wealth = 800
				NOT = { wealth = 900 }
			}
			treasury = -800
			new_character = {
				wealth = 800
			}
		}
		
		if = {
			limit = {
				wealth = 900
				NOT = { wealth = 1000 }
			}
			treasury = -900
			new_character = {
				wealth = 900
			}
		}
		
		if = {
			limit = {
				wealth = 1000
			}
			treasury = 1000
			new_character = {
				wealth = 1000
			}
		}
		
		death = { }
	}
	
	option = {	#keep the current mayor
		name = OK
		trigger = {
			liege = {
				primary_title = {
					OR = {
						has_law = agnatic_succession
						has_law = cognatic_succession
						has_law = true_cognatic_succession
					}
				}
			}
		}
	}
}

character_event = { #make sure all Maryite religious heads are female.
	id = BGL.167
	
	only_rulers = yes
	only_men = yes
	
	hide_window = yes # This is a background event
	
	trigger = {
		religion = maryite
		controls_religion = yes
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		random_list = {
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 30
				}
			}
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 32
				}
			}
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 34
				}
			}
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 36
				}
			}
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 38
				}
			}
			10 = {
				create_random_priest = {
					random_traits = yes
					female = yes
					dynasty = none
					age = 40
				}
			}
		}
		
		new_character = {
			ROOT = {
				primary_title = {
					gain_title = PREVPREV
				}
				any_demesne_title = {
					gain_title = PREVPREV
				}
			}
			#move_character = PREV
			#banish = PREV
		}

		if = {
			limit = {
				wealth = 25
				NOT = { wealth = 50 }
			}
			treasury = -25
			new_character = {
				wealth = 25
			}
		}
		
		if = {
			limit = {
				wealth = 50
				NOT = { wealth = 75 }
			}
			treasury = -50
			new_character = {
				wealth = 50
			}
		}
		
		if = {
			limit = {
				wealth = 75
				NOT = { wealth = 100 }
			}
			treasury = -75
			new_character = {
				wealth = 75
			}
		}
		
		if = {
			limit = {
				wealth = 100
				NOT = { wealth = 150 }
			}
			treasury = -100
			new_character = {
				wealth = 100
			}
		}
		
		if = {
			limit = {
				wealth = 150
				NOT = { wealth = 200 }
			}
			treasury = -150
			new_character = {
				wealth = 150
			}
		}
		
		if = {
			limit = {
				wealth = 200
				NOT = { wealth = 250 }
			}
			treasury = -200
			new_character = {
				wealth = 200
			}
		}
		
		if = {
			limit = {
				wealth = 250
				NOT = { wealth = 300 }
			}
			treasury = -250
			new_character = {
				wealth = 250
			}
		}
		
		if = {
			limit = {
				wealth = 300
				NOT = { wealth = 400 }
			}
			treasury = -300
			new_character = {
				wealth = 300
			}
		}
		
		if = {
			limit = {
				wealth = 400
				NOT = { wealth = 500 }
			}
			treasury = -400
			new_character = {
				wealth = 400
			}
		}
		
		if = {
			limit = {
				wealth = 500
				NOT = { wealth = 600 }
			}
			treasury = -500
			new_character = {
				wealth = 500
			}
		}
		
		if = {
			limit = {
				wealth = 600
				NOT = { wealth = 700 }
			}
			treasury = -600
			new_character = {
				wealth = 600
			}
		}
		
		if = {
			limit = {
				wealth = 700
				NOT = { wealth = 800 }
			}
			treasury = -700
			new_character = {
				wealth = 700
			}
		}
		
		if = {
			limit = {
				wealth = 800
				NOT = { wealth = 900 }
			}
			treasury = -800
			new_character = {
				wealth = 800
			}
		}
		
		if = {
			limit = {
				wealth = 900
				NOT = { wealth = 1000 }
			}
			treasury = -900
			new_character = {
				wealth = 900
			}
		}
		
		if = {
			limit = {
				wealth = 1000
			}
			treasury = 1000
			new_character = {
				wealth = 1000
			}
		}
		
		death = { }
	}
}