###################################
#
# Better gender laws
# - Additional birth events for when the mother makes the call.
#	#	( BGL.200 to BGL.219)
#
###################################

#Landed women can decide to legitimize their children, and if both parents are unlanded, then who legitimizes them is based on gender law.

namespace = BGL

# On-action event: A child is born out of wedlock, figure out who should control what dynasty the child should be.
character_event = {
	id = 300	#Event id must stay 300 here.
	desc = EVTDESC300
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	trigger = {
		was_conceived_a_bastard = yes
		NOT = { real_father = { always = yes } } # There is no 'real_father' set, i.e. this is not a hidden, cuckoo bastard
	}
	
	option = {	#The father decides what should happen.
		name = OK
		trigger = {
			OR = {
				father = {
					is_landed = yes
				}
				AND = {
					mother = {
						is_landed = no
					}
					OR = {
						liege = {
							primary_title = {
								OR = {
									has_law = cognatic_succession
									has_law = agnatic_succession
								}
							}
						}
						liege = {
							primary_title = {
								has_law = true_cognatic_succession
							}
							NOT  = { mother = { dynasty = PREV } }
						}
					}
				}
			}
		}
		father = {
			character_event = { id = 301 days = 1 } # The father's reaction
		}
	}
	
	option = {	#The mother decides to legitimize the child.
		name = OK
		trigger = {
			father = {
				is_landed = no
			}
			OR = {
				mother = {
					is_landed = yes
				}
				liege = {
					primary_title = {
						OR = {
							has_law = enatic_cognatic_succession
							has_law = enatic_succession
						}
					}
				}
				liege = {
					primary_title = {
						has_law = true_cognatic_succession
					}
					mother = { dynasty = PREV }
				}
			}
		}
		mother = {
			character_event = { id = BGL.210 days = 1 } # The mother's reaction
		}
	}
}

character_event = {	#The mother decides what to do with the child.
	id = BGL.210
	desc = EVTDESCBGL210
	picture = GFX_evt_birth
	
	is_triggered_only = yes

	option = {	#The mother decides to legitimize the child.
		name = EVTOPTABGL210
		FROM = {
			character_event = { id = BGL.200 tooltip = EVTTOOLTIPBGL200 } # The child gets the mother's dynasty
			father = {
				character_event = { id = BGL.201 tooltip = EVTTOOLTIPBGL201 } # The child's father is very pleased
				spouse = {
					character_event = { id = BGL.202 tooltip = EVTTOOLTIPBGL202 } # The child's father's wife is pissed off
				}
			}
		}
		any_child = {
			limit = {
				NOT = { character = FROM }
				dynasty = ROOT
				NOT = { trait = bastard }
			}
			opinion = {
				who = ROOT
				modifier = legitimized_bastard
				months = 12
			}
		}
		
		
	}
	
	option = {	#The mother decides to keep the child.
		name = EVTOPTBBGL210
		FROM = {
			character_event = { id = BGL.203 tooltip = EVTTOOLTIPBGL203 } # The child gets the mother's dynasty, but is not legitimized.
			father = {
				character_event = { id = BGL.204 tooltip = EVTTOOLTIPBGL204 } # The child's father is pleased
				spouse = {
					character_event = { id = BGL.202 tooltip = EVTTOOLTIPBGL202 } # The child's father's wife is pissed off
				}
			}
		}
	}
	
	option = {	#The mother gives the child to the father.
		name = EVTOPTCBGL210
		FROM = {
			character_event = { id = BGL.205 tooltip = EVTTOOLTIPBGL205 } #  The child founds a new bastard dynasty
			if = {
				limit = { trait = born_in_the_purple }
				remove_trait = born_in_the_purple
			}
			if = {
				limit = { trait = saoshyant_descendant }
				remove_trait = saoshyant_descendant
			}
			if = {
				limit = { trait = sayyid }
				remove_trait = sayyid
			}
			father = {
				character_event = { id = BGL.206 tooltip = EVTTOOLTIPBGL206 } # The child's father is dishonoured
				spouse = {
					character_event = { id = BGL.202 tooltip = EVTTOOLTIPBGL202 } # The child's father's wife is pissed off
				}
			}
		}
	}
}

character_event = { # Child is legitimized by mother.
	id = BGL.200
	desc = EVTDESCBGL200
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	option = {
		name = OK
		dynasty = FROM
		remove_trait = bastard
		add_trait = legit_bastard
		
		mother = {
			spouse = {
				character_event = { id = BGL.207 tooltip = EVTTOOLTIPBGL207 } # The mother's husband is enraged
			}
		}
	}
}

character_event = { # Father is very pleased by mother's decision to legitimize the child.
	id = BGL.201
	desc = EVTDESCBGL201
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTABGL201
		opinion = {
			who = FROM
			modifier = legitimized_child
			years = 10
		}
	}
}

character_event = { # Child's father's wife is pissed about the mother's adulterous behaviour.
	id = BGL.202
	desc = EVTDESCBGL202
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
		option = {
		name = EVTOPTABGL202
		opinion = {
			who = FROM
			modifier = cuckolded
			years = 10
		}
		spouse = {
			reverse_opinion = {
				who = ROOT
				modifier = unfaithful
				years = 10
			}
		}
	}
}

character_event = { # Child is kept by mother, but not legitimized.
	id = BGL.203
	desc = EVTDESCBGL203
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	option = {
		name = OK
		dynasty = FROM
		add_trait = bastard
		
		mother = {
			spouse = {
				character_event = { id = BGL.208 tooltip = EVTTOOLTIPBGL208 } # The mother's husband is angered
			}
		}
	}
}

character_event = { # Father is pleased by mother's decision to keep the child.
	id = BGL.204
	desc = EVTDESCBGL204
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA3BGL204
		opinion = {
			who = FROM
			modifier = acknowledged_child
			years = 10
		}
	}
}

character_event = { # Child forms a new bastard dynsaty.
	id = BGL.205
	desc = EVTDESCBGL205
	picture = GFX_evt_birth
	
	is_triggered_only = yes

	option = {
		name = OK
		dynasty = father_bastard
		
		mother = {
			spouse = {
				character_event = { id = BGL.209 } # The mother's husband is displeased
			}
		}
		set_mother = 0
		#set_real_mother = FROM
	}
}

character_event = { # Father is dishonoured by mother.
	id = BGL.206
	desc = EVTDESCBGL206
	picture = GFX_evt_birth
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTABGL206
		opinion = {
			who = FROM
			modifier = denounced_child
			years = 10
		}
	}
}

character_event = { # The mother's husband is enraged
	id = BGL.207
	desc = EVTDESCBGL207
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTABGL207
		FROM = {
			father = {
				reverse_opinion = {
					who = ROOT
					modifier = slut_seductress
					years = 20
				}
			}
		}
		
		spouse = {
			reverse_opinion = {
				who = ROOT
				modifier = legitimized_bastard
				years = 20
			}
		}
	}
}

character_event = { # The mother's husband is angered
	id = BGL.208
	desc = EVTDESCBGL208
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA308
		FROM = {
			father = {
				reverse_opinion = {
					who = ROOT
					modifier = slut_seductress
					years = 20
				}
			}
		}
		
		spouse = {
			reverse_opinion = {
				who = ROOT
				modifier = acknowledged_bastard
				years = 10
			}
		}
	}
}
	
character_event = { # The mother's husband is displeased
	id = BGL.209
	desc = EVTDESCBGL209
	picture = GFX_evt_quarrel
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTABGL209
		FROM = {
			father = {
				reverse_opinion = {
					who = ROOT
					modifier = slut_seductress
					years = 20
				}
			}
		}
		
		spouse = {
			reverse_opinion = {
				who = ROOT
				modifier = unfaithful
				years = 5
			}
		}
	}
}