#############################################
#
# EVENTS FOR LOVE, PREGNANCY AND BIRTH
#
#############################################
# by Henrik Fåhraeus
#############################################

#############################################
# EVENTS LEADING UP TO BASTARD PREGNANCY
#############################################

# A courtier initiates romance with their liege
# Hidden start
character_event = {
	id = 449

	is_triggered_only = yes # on_yearly_pulse, random_events, courtier_liege_romance
	hide_window = yes

	only_playable = yes
	min_age = 16
	max_age = 65
	only_capable = yes
	prisoner = no

	trigger = {
		is_landed = yes
		is_marriage_adult = yes
		is_senior_consort_party = no
		is_ill = no
		is_pregnant = no
		has_regent = no
		is_inaccessible_trigger = no

		trigger_if = {
			limit = { is_female = yes }
			practical_age < 40
		}

		trigger_if = {
			limit = { is_married = yes }

			OR = {
				trait = lustful
				trait = hedonist
				trait = deceitful

				opinion = {
					who = spouse
					value < 0
				}
			}
		}

		trigger_if = {
			limit = { has_lover = yes }

			trait = lustful
			num_of_lovers < 5
		}

		NOR = {
			trait = infirm
			trait = celibate
			trait = eunuch
			trait = in_hiding
			trait = disfigured
			trait = hunchback
			trait = dwarf
			trait = ugly
			is_lover = spouse
			has_character_modifier = lustful_affair_timer
			has_character_modifier = seduction_timer
		}

		any_courtier = {
			trigger_if = {
				limit = { is_female = yes }
				practical_age < 40
			}

			is_valid_romance_target = ROOT
			has_lover = no
			is_consort = no
			is_pregnant = no
			prisoner = no
			is_inaccessible_trigger = no

			NOR = {
				is_married = ROOT
				is_rival = ROOT
				trait = infirm
				trait = celibate
				trait = eunuch
				trait = chaste
				trait = in_hiding
				trait = disfigured
			}

			trigger_if = {
				limit = { is_married = yes }

				OR = {
					trait = lustful
					trait = deceitful
					trait = hedonist

					AND = {
						NOT = { is_lover = spouse }

						opinion = {
							who = spouse
							value < 50
						}
					}
				}
			}

			trigger_if = {
				limit = { is_ruler = yes }
				at_location = liege
			}

			liege = {
				OR = {
					PREV = { trait = hedonist }
					PREV = { trait = lustful }
					PREV = { trait = divine_blood }
					trait = hedonist
					trait = lustful
					trait = divine_blood
				}

				opinion = {
					who = PREV
					value >= 25
				}

				reverse_opinion = {
					who = PREV
					value >= 25
				}

				NOR = {
					reverse_has_opinion_modifier = {
						name = opinion_spurned
						who = PREV
					}

					has_opinion_modifier = {
						name = opinion_spurned
						who = PREV
					}

					has_opinion_modifier = {
						name = opinion_embarrassed
						who = PREV
					}

					has_opinion_modifier = {
						name = opinion_seducing
						who = PREV
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2
			has_focus = focus_seduction
		}

		mult_modifier = {
			factor = 0.67
			num_of_lovers >= 1
		}

		mult_modifier = {
			factor = 0.5
			num_of_lovers >= 2
		}

		mult_modifier = {
			factor = 0.25
			num_of_lovers >= 3
		}

		mult_modifier = {
			factor = 0.2
			num_of_lovers >= 4
		}

		mult_modifier = {
			factor = 0.25
			religion_group = muslim
		}

		mult_modifier = {
			factor = 3
			trait = homosexual # To balance for fewer potential lovers
		}

		mult_modifier = {
			factor = 0.5
			spouse = { practical_age < 30 }
		}

		mult_modifier = {
			factor = 2
			spouse = { practical_age >= 45 }
		}

		mult_modifier = {
			factor = 2
			trait = hedonist
		}

		mult_modifier = {
			factor = 2
			trait = lustful
		}

		mult_modifier = {
			factor = 2
			has_fair_trait_trigger = yes
		}

		mult_modifier = {
			factor = 0.5
			trait = shy
		}

		mult_modifier = {
			factor = 0.5
			has_ugly_trait_trigger = yes
		}

		mult_modifier = {
			factor = 0.1
			trait = chaste
		}

		# CK2Plus
		mult_modifier = {
			factor = 0.33

			has_dlc = "Way of Life"
			NOT = { has_focus = focus_seduction }
		}

		mult_modifier = {
			factor = 5

			has_character_flag = debutante

			had_character_flag = {
				flag = debutante
				years < 3
			}
		}

		mult_modifier = {
			factor = 1.33

			is_female = yes
			practical_age < 20
		}

		mult_modifier = {
			factor = 1.33
			trait = gregarious
		}

		mult_modifier = {
			factor = 0.5
			trait = imbecile
		}

		mult_modifier = {
			factor = 0.33
			trait = inbred
		}

		mult_modifier = {
			factor = 0.33
			trait = blinded
		}
	}

	immediate = {
		any_courtier = {
			limit = {
				trigger_if = {
					limit = { is_female = yes }
					practical_age < 40
				}

				is_valid_romance_target = ROOT
				has_lover = no
				is_consort = no
				is_pregnant = no
				prisoner = no
				is_inaccessible_trigger = no

				NOR = {
					is_married = ROOT
					is_rival = ROOT
					trait = infirm
					trait = celibate
					trait = eunuch
					trait = chaste
					trait = in_hiding
					trait = disfigured
				}

				trigger_if = {
					limit = { is_married = yes }

					OR = {
						trait = lustful
						trait = deceitful
						trait = hedonist

						AND = {
							NOT = { is_lover = spouse }

							opinion = {
								who = spouse
								value < 50
							}
						}
					}
				}

				trigger_if = {
					limit = { is_ruler = yes }
					at_location = liege
				}

				liege = {
					OR = {
						PREV = { trait = hedonist }
						PREV = { trait = lustful }
						PREV = { trait = divine_blood }
						trait = hedonist
						trait = lustful
						trait = divine_blood
					}

					opinion = {
						who = PREV
						value >= 25
					}

					reverse_opinion = {
						who = PREV
						value >= 25
					}

					NOR = {
						reverse_has_opinion_modifier = {
							name = opinion_spurned
							who = PREV
						}

						has_opinion_modifier = {
							name = opinion_spurned
							who = PREV
						}

						has_opinion_modifier = {
							name = opinion_embarrassed
							who = PREV
						}

						has_opinion_modifier = {
							name = opinion_seducing
							who = PREV
						}
					}
				}
			}

			score_value = {
				value = 10
				interesting_courtier_selection_score = yes
			}

			character_event = { id = 450 }
		}
	}
}

# A courtier initiates romance with their liege
character_event = {
	id = 450
	desc = EVTDESC450
	picture = GFX_evt_lovers

	is_triggered_only = yes

	immediate = {
		add_character_modifier = {
			name = lustful_affair_timer
			years = 4
			hidden = yes
		}
	}

	option = {
		name = EVTOPTA450

		FROM = {
			show_scope_change = no

			add_character_modifier = {
				name = lustful_affair_timer
				years = 1
				hidden = yes
			}

			character_event = {
				id = 451
				days = 7
				tooltip = EVTTOOLTIP451
			}
		}
	}

	option = {
		name = EVTOPTB450

		piety = 5

		trigger = { ai = no }
	}
}

# The liege responds
character_event = {
	id = 451
	desc = EVTDESC451
	picture = GFX_evt_lovers
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	trigger = {
		FROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA451 # Make a move

		FROM = {
			show_scope_change = no

			character_event = {
				id = 452
				days = 7
				tooltip = EVTTOOLTIP452
			}
		}

		ai_chance = {
			factor = 60

			# CK2Plus
			mult_modifier = {
				factor = 5

				has_ambition = obj_find_lover

				trigger_if = {
					limit = { is_close_relative = FROM }

					OR = {
						religion = zoroastrian
						religion = zurvanist
						religion = messalian
						trait = divine_blood
						FROM = { trait = divine_blood }
					}
				}
			}

			mult_modifier = {
				factor = 0.5
				num_of_lovers >= 1
			}

			mult_modifier = {
				factor = 0.33
				num_of_lovers >= 2
			}

			mult_modifier = {
				factor = 0.25
				num_of_lovers >= 3
			}

			mult_modifier = {
				factor = 0.2
				num_of_lovers >= 4
			}

			mult_modifier = {
				factor = 2
				FROM = { trait = attractive }
			}

			mult_modifier = {
				factor = 2

				FROM = {
					is_female = no
					is_strong_trigger = yes
				}
			}

			mult_modifier = {
				factor = 1.25
				FROM = { trait = gregarious }
			}

			mult_modifier = {
				factor = 0.75
				FROM = { trait = clubfooted }
			}

			mult_modifier = {
				factor = 0.75
				FROM = { trait = harelip }
			}

			mult_modifier = {
				factor = 0.75
				FROM = { trait = gluttonous }
			}

			mult_modifier = {
				factor = 0.5
				FROM = { trait = slow }
			}

			mult_modifier = {
				factor = 0.5
				FROM = { trait = dull }
			}

			mult_modifier = {
				factor = 0.5

				FROM = {
					is_female = no
					is_weak_trigger = yes
				}
			}

			mult_modifier = {
				factor = 0.25
				FROM = { trait = imbecile }
			}

			mult_modifier = {
				factor = 0.25
				FROM = { trait = inbred }
			}

			mult_modifier = {
				factor = 0.25
				FROM = { trait = blinded }
			}

			mult_modifier = {
				factor = 1.5

				opinion = {
					who = FROM
					value >= 50
				}
			}

			mult_modifier = {
				factor = 1.5

				is_married = yes
				NOT = { is_lover = spouse }
				spouse = { has_lover = yes }
			}
		}
	}

	option = {
		name = EVTOPTB451 # Not appropriate

		trigger = {
			NOR = {
				trait = lustful
				trait = hedonist
			}
		}

		if = {
			limit = {
				OR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}
			piety = -5
		}
		else = {
			piety = 5
		}

		hidden_effect = {
			reverse_opinion = {
				name = opinion_spurned
				who = FROM
				years = 5
			}
		}

		ai_chance = {
			factor = 40

			mult_modifier = {
				factor = 5
				trait = chaste
			}

			mult_modifier = {
				factor = 4
				trait = shy
			}

			mult_modifier = {
				factor = 0.5
				trait = trusting
			}

			mult_modifier = {
				factor = 0.01
				has_focus = focus_seduction
			}

			# CK2Plus
			mult_modifier = {
				factor = 2
				trait = craven
			}

			mult_modifier = {
				factor = 2
				trait = temperate
			}

			mult_modifier = {
				factor = 0.5
				trait = greedy
			}

			mult_modifier = {
				factor = 0.5
				trait = gluttonous
			}

			mult_modifier = {
				factor = 2

				is_married = yes

				OR = {
					trait = content
					trait = just
					trait = craven
					trait = humble
					trait = zealous
					trait = honest
				}
			}

			mult_modifier = {
				factor = 1.5

				is_female = yes

				OR = {
					AND = {
						is_married = yes
						has_living_children = yes
					}
					trait = zealous
					trait = humble
					trait = content
				}
			}

			mult_modifier = {
				factor = 4

				any_close_relative = {
					is_married = FROM
				}
			}

			mult_modifier = {
				factor = 10

				is_close_relative = FROM

				NOR = {
					trait = divine_blood
					FROM = { trait = divine_blood }
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}

			mult_modifier = {
				factor = 0.5

				is_close_relative = FROM
				religion = FROM

				OR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}

			mult_modifier = {
				factor = 1.5

				opinion = {
					who = FROM
					value < 25
				}
			}

			mult_modifier = {
				factor = 0.5

				has_ambition = obj_find_lover

				trigger_if = {
					limit = { is_close_relative = FROM }

					OR = {
						religion = zoroastrian
						religion = zurvanist
						religion = messalian
						trait = divine_blood
						FROM = { trait = divine_blood }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTC451 # Not my type

		trigger = {
			OR = {
				trait = lustful
				trait = hedonist
			}
		}

		random = {
			chance = 25
			remove_trait_silently_lustful_effect = yes
		}

		random = {
			chance = 25
			remove_trait_silently_hedonist_effect = yes
		}

		prestige = -5

		hidden_effect = {
			reverse_opinion = {
				name = opinion_spurned
				who = FROM
				years = 5
			}
		}

		ai_chance = { factor = 0 }
	}
}

# The courtier accepts or spurns the liege lord
character_event = {
	id = 452
	desc = EVTDESC452
	picture = GFX_evt_lovers

	is_triggered_only = yes

	trigger = {
		is_alive = yes
		FROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA452 # What took him/her so long?

		ai_chance = {
			factor = 70

			# CK2Plus
			mult_modifier = {
				factor = 5

				trait = hedonist

				trigger_if = {
					limit = { trait = homosexual }
					same_sex = FROM
				}
				trigger_else = {
					is_opposite_sex = FROM
				}
			}

			mult_modifier = {
				factor = 2

				trait = hedonist

				trigger_if = {
					limit = { trait = homosexual }
					is_opposite_sex = FROM
				}
				trigger_else = {
					same_sex = FROM
				}
			}

			mult_modifier = {
				factor = 3

				has_ambition = obj_find_lover

				trigger_if = {
					limit = { trait = homosexual }
					same_sex = FROM
				}
				trigger_else = {
					is_opposite_sex = FROM
				}

				trigger_if = {
					limit = { is_close_relative = FROM }

					OR = {
						religion = zoroastrian
						religion = zurvanist
						religion = messalian
						trait = divine_blood
						FROM = { trait = divine_blood }
					}
				}
			}

			mult_modifier = {
				factor = 3

				trait = lustful

				trigger_if = {
					limit = { trait = homosexual }
					same_sex = FROM
				}
				trigger_else = {
					is_opposite_sex = FROM
				}
			}

			mult_modifier = {
				factor = 1.25

				trait = lustful

				trigger_if = {
					limit = { trait = homosexual }
					is_opposite_sex = FROM
				}
				trigger_else = {
					same_sex = FROM
				}
			}

			mult_modifier = {
				factor = 3
				FROM = { trait = attractive }
			}

			mult_modifier = {
				factor = 2
				FROM = { is_smart_trigger = yes }
			}

			mult_modifier = {
				factor = 2

				FROM = {
					is_female = no
					is_strong_trigger = yes
				}
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = gregarious }
			}

			mult_modifier = {
				factor = 2
				trait = trusting
			}

			mult_modifier = {
				factor = 2

				trait = ambitious
				vassal_of = FROM
			}

			mult_modifier = {
				factor = 2

				practical_age < 25
				FROM = { practical_age >= 25 }
				is_smart_trigger = no
				vassal_of = FROM

				OR = {
					trait = trusting
					trait = shy
					is_dumb_trigger = yes
					trait = craven
					trait = envious
				}
			}

			mult_modifier = {
				factor = 2

				opinion = {
					who = FROM
					value >= 50
				}
			}

			mult_modifier = {
				factor = 1.5

				is_married = yes
				NOT = { is_lover = spouse }
				spouse = { has_lover = yes }
			}
		}

		add_lover = FROM

		hidden_effect = {
			change_variable = {
				which = lifestyle_hedonist
				value = 1
			}
		}

		FROM = {
			show_scope_change = no

			character_event = {
				id = 453
				tooltip = EVTTOOLTIP453
			}
		}

#		log = "452: [From.GetBestName] tumbles [Root.GetBestName]"

		if = {
			limit = {
				NOT = { trait = homosexual }
				same_sex = FROM
			}

			add_trait = homosexual
			set_character_flag = revealed_homosexual@ROOT
		}

		if = {
			limit = {
				is_close_relative = FROM

				NOR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}

			piety = -25
		}

		# Chance of impregnation
		hidden_effect = { unprotected_sex_effect = yes }
	}

	option = {
		name = EVTOPTB452 # Dissuade

		trigger = {
			NOR = {
				trait = lustful
				trait = hedonist
			}
		}

		FROM = {
			show_scope_change = no

			character_event = {
				id = 454
				tooltip = EVTTOOLTIP454
			}
		}

#		log = "452: [Root.GetBestName] rebuffs [From.GetBestName]"

		ai_chance = {
			factor = 30

			trigger = {
				trigger_if = {
					limit = { trait = homosexual }
					is_opposite_sex = FROM
				}
				trigger_else = {
					same_sex = FROM
				}
			}

			mult_modifier = {
				factor = 10
				trait = chaste
			}

			mult_modifier = {
				factor = 2

				is_female = yes
				is_opposite_sex = FROM
			}

			mult_modifier = {
				factor = 2
				trait = shy
			}

			mult_modifier = {
				factor = 0.5
				trait = trusting
			}

			mult_modifier = {
				factor = 0.1

				FROM = {
					OR = {
						trait = master_seducer
						trait = master_seductress
					}
				}
			}

			# CK2Plus
			mult_modifier = {
				factor = 10

				same_sex = FROM

				NOR = {
					trait = hedonist
					trait = homosexual
				}
			}

			mult_modifier = {
				factor = 2

				is_married = yes

				OR = {
					trait = content
					trait = just
					trait = craven
					trait = humble
					trait = zealous
					trait = honest
				}
			}

			mult_modifier = {
				factor = 3

				any_spouse = {
					is_close_relative = FROM
				}
			}

			mult_modifier = {
				factor = 3

				any_close_relative = {
					is_married = FROM
				}
			}

			mult_modifier = {
				factor = 3
				FROM = { trait = ugly }
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = clubfooted }
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = slow }
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = dull }
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = blinded }
			}

			mult_modifier = {
				factor = 3
				FROM = { trait = imbecile }
			}

			mult_modifier = {
				factor = 3
				FROM = { trait = inbred }
			}

			mult_modifier = {
				factor = 3

				FROM = { trait = dwarf }
				NOT = { trait = dwarf }
			}

			mult_modifier = {
				factor = 10

				is_close_relative = FROM

				NOR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
					trait = divine_blood
					FROM = { trait = divine_blood }
				}
			}

			mult_modifier = {
				factor = 0.5

				is_close_relative = FROM
				religion = FROM

				OR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}

			mult_modifier = {
				factor = 2

				opinion = {
					who = FROM
					value < 25
				}
			}
		}
	}

	option = {
		name = EVTOPTC452 # Scream for help!

		trigger = {
			is_female = yes
			is_opposite_sex = FROM

			NOR = {
				trait = lustful
				trait = hedonist
			}
		}

		FROM = {
			show_scope_change = no

			character_event = {
				id = 455
				tooltip = EVTTOOLTIP455
			}
		}

#		log = "452: [Root.GetBestName] embarrasses [From.GetBestName]"

		ai_chance = {
			factor = 20

			trigger = {
				NOR = {
					is_friend = FROM
					trait = craven
					trait = humble
					trait = shy
				}

				is_weak_trigger = no
			}

			mult_modifier = {
				factor = 10
				trait = chaste
			}

			mult_modifier = {
				factor = 2
				trait = shy
			}

			mult_modifier = {
				factor = 0.5
				trait = trusting
			}

			mult_modifier = {
				factor = 0.01

				FROM = {
					OR = {
						trait = master_seducer
						trait = master_seductress
					}
				}
			}

			# CK2Plusmodifier = {
			mult_modifier = {
				factor = 5

				OR = {
					trait = wroth
					trait = paranoid
				}
			}

			mult_modifier = {
				factor = 10

				is_close_relative = FROM

				NOR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
					trait = divine_blood
					FROM = { trait = divine_blood }
				}
			}

			mult_modifier = {
				factor = 0.5

				is_close_relative = FROM
				religion = FROM

				OR = {
					religion = zoroastrian
					religion = zurvanist
					religion = messalian
				}
			}
		}
	}

	option = {
		name = EVTOPTD452 # Kick him out and tell everyone what happened!

		trigger = {
			same_sex = FROM
			NOT = { trait = homosexual }
		}

		random = {
			chance = 25
			add_rival = FROM
		}

		FROM = {
			show_scope_change = no

			character_event = {
				id = 455
				tooltip = EVTTOOLTIP455
			}
		}

		# log = "452: [Root.GetBestName] embarrasses [From.GetBestName]"

		ai_chance = {
			factor = 10

			trigger = {
				NOR = {
					is_friend = FROM
					trait = craven
					trait = humble
					trait = shy
				}

				is_weak_trigger = no
			}

			mult_modifier = {
				factor = 10
				trait = zealous
			}

			mult_modifier = {
				factor = 5

				OR = {
					trait = wroth
					trait = proud
					trait = cruel
					trait = paranoid
				}
			}

			mult_modifier = {
				factor = 0.1
				trait = kind
			}

			mult_modifier = {
				factor = 0.5
				vassal_of = FROM
			}

			mult_modifier = {
				factor = 10
				is_close_relative = FROM
			}

			mult_modifier = {
				factor = 0.1

				FROM = {
					OR = {
						trait = master_seducer
						trait = master_seductress
					}
				}
			}
		}
	}
}

# The ruler becomes his/her lover
character_event = {
	id = 453
	desc = EVTDESC453
	picture = GFX_evt_lovers
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	ai = no

	option = {
		name = EVTOPTA453

		tooltip = {
			add_lover = FROM
		}
	}
}

# The initiator is spurned and disappointed
character_event = {
	id = 454
	picture = GFX_evt_quarrel

	is_triggered_only = yes

	desc = EVTDESC454

	option = {
		name = EVTOPTA454

		opinion = {
			name = opinion_spurned
			who = FROM
			years = 5
		}
	}
}

# The ruler is spurned and embarrassed
character_event = {
	id = 455
	picture = GFX_evt_quarrel
	desc = EVTDESC455

	is_triggered_only = yes

	option = {
		name = EVTOPTA455

		prestige = -10

		opinion = {
			name = opinion_embarrassed
			who = FROM
			years = 5
		}
	}
}

# A courtier initiates romance with another courtier
character_event = {
	id = 456

	is_triggered_only = yes # on_yearly_pulse, random_events, courtier_romance
	hide_window = yes

	min_age = 16
	max_age = 65
	only_capable = yes
	prisoner = no

	trigger = {
		is_ruler = no
		is_marriage_adult = yes

		liege = {
			trigger_if = {
				limit = { ai = yes }
				higher_tier_than = DUKE
			}

			is_landed = yes
		}

		trigger_if = {
			limit = { is_female = yes }
			practical_age < 40
		}

		# Faithful spouses/consorts don't cheat
		trigger_if = {
			limit = { is_married = yes }

			OR = {
				trait = lustful
				trait = deceitful
				trait = arbitrary
				trait = hedonist

				opinion = {
					who = spouse
					value < 0
				}
			}
		}

		trigger_if = {
			limit = { is_consort = yes }

			OR = {
				trait = lustful
				trait = deceitful
				trait = arbitrary

				opinion = {
					who = consort
					value < 0
				}
			}
		}

		NOR = {
			trait = chaste
			trait = infirm
			trait = celibate
			trait = eunuch
			trait = hunchback
			trait = dwarf
			trait = ugly
			has_character_modifier = lustful_affair_timer
		}

		has_lover = no
		is_pregnant = no
		is_ill = no
		is_inaccessible_trigger = no

		liege = {
			any_courtier = {
				is_valid_romance_target = ROOT

				trigger_if = {
					limit = { is_female = yes }
					practical_age < 40
				}

				opinion = {
					who = ROOT
					value >= 0
				}

				reverse_opinion = {
					who = ROOT
					value >= 0
				}

				is_marriage_adult = yes
				is_ruler = no
				is_pregnant = no
				prisoner = no
				is_ill = no
				is_inaccessible_trigger = no

				NOR = {
					character = ROOT
					is_lover = ROOT
					is_married = ROOT
					is_consort = ROOT
					is_former_lover = ROOT
					is_rival = ROOT
					has_character_modifier = lustful_affair_timer
					trait = infirm
					trait = celibate
					trait = eunuch
					trait = chaste
				}

				trigger_if = {
					limit = { is_close_relative = ROOT }

					religion = ROOT
					religion_has_incest = yes
				}

				trigger_if = {
					limit = { has_lover = yes }

					trait = lustful
					num_of_lovers < 5
				}

				trigger_if = {
					limit = {
						OR = {
							trait = inbred
							trait = imbecile
							trait = dwarf
						}
					}

					ROOT = {
						OR = {
							trait = inbred
							trait = imbecile
							trait = dwarf
							has_ugly_trait_trigger = yes
						}
					}
				}

				# Faithful spouses/consorts don't cheat
				trigger_if = {
					limit = { is_married = yes }

					OR = {
						trait = lustful
						trait = deceitful
						trait = arbitrary

						opinion = {
							who = spouse
							value < 0
						}
					}
				}

				trigger_if = {
					limit = { is_consort = yes }

					OR = {
						trait = lustful
						trait = deceitful
						trait = arbitrary

						opinion = {
							who = consort
							value < 0
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2
			spouse = { is_ruler = yes }
		}

		mult_modifier = {
			factor = 2
			spouse = { has_lover = yes }
		}

		mult_modifier = {
			factor = 2
			practical_age < 30
			spouse = { practical_age >= 50 }
		}

		mult_modifier = {
			factor = 3
			trait = homosexual # to balance for fewer potential lovers
		}

		mult_modifier = {
			factor = 3
			trait = lustful
		}

		mult_modifier = {
			factor = 2
			trait = hedonist
		}

		mult_modifier = {
			factor = 1.33
			practical_age < 20
		}

		mult_modifier = {
			factor = 0.5

			is_female = yes
			practical_age >= 30
		}

		# Harems are well guarded...
		mult_modifier = {
			factor = 0.33

			is_female = yes
			is_married = yes
			has_polygamy = yes
		}

		# Wives and Concubines of rulers have a harder time initiating this (unless it's their Focus)
		mult_modifier = {
			factor = 0.33

			is_female = yes
			NOT = { has_focus = focus_seduction }

			OR = {
				is_married = liege
				is_consort = liege
			}
		}
	}

	immediate = {
		liege = {
			any_courtier = {
				limit = {
					is_valid_romance_target = ROOT

					trigger_if = {
						limit = { is_female = yes }
						practical_age < 40
					}

					opinion = {
						who = ROOT
						value >= 0
					}

					reverse_opinion = {
						who = ROOT
						value >= 0
					}

					is_marriage_adult = yes
					is_ruler = no
					is_pregnant = no
					prisoner = no
					is_ill = no
					is_inaccessible_trigger = no

					NOR = {
						character = ROOT
						is_lover = ROOT
						is_married = ROOT
						is_consort = ROOT
						is_former_lover = ROOT
						is_rival = ROOT
						has_character_modifier = lustful_affair_timer
						trait = infirm
						trait = celibate
						trait = eunuch
						trait = chaste
					}

					trigger_if = {
						limit = { is_close_relative = ROOT }

						religion = ROOT
						religion_has_incest = yes
					}

					trigger_if = {
						limit = { has_lover = yes }

						trait = lustful
						num_of_lovers < 5
					}

					trigger_if = {
						limit = {
							OR = {
								trait = inbred
								trait = imbecile
								trait = dwarf
							}
						}

						ROOT = {
							OR = {
								trait = inbred
								trait = imbecile
								trait = dwarf
								has_ugly_trait_trigger = yes
							}
						}
					}

					# Faithful spouses/consorts don't cheat
					trigger_if = {
						limit = { is_married = yes }

						OR = {
							trait = lustful
							trait = deceitful
							trait = arbitrary

							opinion = {
								who = spouse
								value < 0
							}
						}
					}

					trigger_if = {
						limit = { is_consort = yes }

						OR = {
							trait = lustful
							trait = deceitful
							trait = arbitrary

							opinion = {
								who = consort
								value < 0
							}
						}
					}
				}

				score_value = {
					value = 10
					interesting_courtier_selection_score = yes
				}

				character_event = { id = 457 }
			}
		}
	}
}

# Courtier advances accepted or rebuffed by other courtier
character_event = {
	id = 457

	hide_window = yes
	is_triggered_only = yes

	only_capable = yes
	prisoner = no

	option = {
		# Let's tumble!

		add_lover = FROM

		add_character_modifier = {
			name = lustful_affair_timer
			years = 6
			hidden = yes
		}

#		log = "457: [From.GetBestName] tumbles [Root.GetBestName]"

		# Chance of impregnation
		hidden_effect = { unprotected_sex_effect = yes }

		ai_chance = {
			factor = 100

			mult_modifier = {
				factor = 3
				trait = lustful
			}

			mult_modifier = {
				factor = 2
				trait = hedonist
			}
		}
	}

	option = {
		# No way!

		reverse_opinion = {
			name = opinion_spurned
			who = FROM
			years = 5
		}

#		log = "457: [Root.GetBestName] rebuffs [From.GetBestName]"

		ai_chance = {
			factor = 10

			mult_modifier = {
				factor = 50

				OR = {
					is_ascetic_trigger = yes
					trait = chaste
				}
			}

			mult_modifier = {
				factor = 30

				FROM = {
					has_ugly_trait_trigger = yes

					NOR = {
						trait = master_seducer
						trait = master_seductress
					}
				}

				has_ugly_trait_trigger = no

				NOR = {
					trait = dwarf
					trait = imbecile
					trait = inbred
				}
			}

			mult_modifier = {
				factor = 30

				FROM = {
					trait = dwarf

					NOR = {
						trait = master_seducer
						trait = master_seductress
					}
				}

				has_ugly_trait_trigger = no

				NOR = {
					trait = dwarf
					trait = imbecile
					trait = inbred
				}
			}

			mult_modifier = {
				factor = 30

				FROM = {
					trait = imbecile

					NOR = {
						trait = master_seducer
						trait = master_seductress
					}
				}

				has_ugly_trait_trigger = no

				NOR = {
					trait = dwarf
					trait = imbecile
					trait = inbred
				}
			}

			mult_modifier = {
				factor = 100

				FROM = {
					trait = inbred

					NOR = {
						trait = master_seducer
						trait = master_seductress
					}
				}

				has_ugly_trait_trigger = no

				NOR = {
					trait = dwarf
					trait = imbecile
					trait = inbred
				}
			}

			# Wives and Concubines of rulers are watched...
			mult_modifier = {
				factor = 60

				OR = {
					is_married = liege
					is_consort = liege
				}

				is_female = yes
				has_polygamy = no
				NOT = { has_focus = focus_seduction }
			}

			# Harems are especially well guarded...
			mult_modifier = {
				factor = 200

				OR = {
					is_married = liege
					is_consort = liege
				}

				is_female = yes
				has_polygamy = yes
				is_main_spouse = no
			}
		}
	}
}

#############################################
# PREGNANCY STARTS SHOWING EVENTS
#############################################

# On-action event: Pregnancy starts showing
character_event = {
	id = 400
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_religion

	desc = {
		text = evt_400_desc_a
		trigger = { # The father is alive and a spouse
			is_married = yes

			father_of_unborn = {
				is_alive = yes
				is_married = ROOT
			}
		}
	}
	desc = {
		text = evt_CK2_400_desc_b
		trigger = { # The father is dead and a spouse
			is_married = no

			father_of_unborn = {
				is_alive = no

				ROOT = {
					any_spouse_even_if_dead = {
						character = PREVPREV
					}
				}
			}
		}
	}
	desc = {
		text = evt_CK2_400_desc_c
		trigger = { # The father is a consort
			is_married = no
			num_of_consorts < 2

			NOT = {
				father_of_unborn = {
					is_alive = no

					ROOT = {
						any_spouse_even_if_dead = {
							character = PREVPREV
						}
					}
				}
			}
		}
	}
	desc = {
		text = evt_CK2_400_DESC_D
		trigger = { # The father is one of multiple consorts
			is_married = no
			num_of_consorts >= 2

			NOT = {
				father_of_unborn = {
					is_alive = no

					ROOT = {
						any_spouse_even_if_dead = {
							character = PREVPREV
						}
					}
				}
			}
		}
	}

	is_triggered_only = yes # on_pregnancy

	trigger = {
		NOT = { trait = pregnant }
		is_consort = no

		father_of_unborn = {
			OR = {
				is_consort = ROOT

				trigger_if = { # The father is alive and a spouse
					limit = { is_alive = yes }
					is_married = ROOT
				}

				trigger_else = { # The father is dead and a spouse
					ROOT = {
						any_spouse_even_if_dead = {
							character = PREVPREV
						}
					}
				}
			}
		}
	}

	immediate = {
		add_trait = pregnant
	}

	option = {
		name = OK

		tooltip = {
			add_trait = pregnant
		}

		prestige = 10

		if = {
			limit = {
				ai = no

				NOR = {
					has_assigned_minor_title = title_appointed_regent
					has_dynasty_flag = pregnancy_regent_warning
				}
			}

			character_event = { id = HFP.20400 } # Pregnant ruler notified she hasn't appointed a regent
		}

		hidden_effect = {
			random_list = {
				80 = {
					mult_modifier = {
						factor = 0.8
						trait = shy
					}

					mult_modifier = {
						factor = 0.8
						is_ill = yes
					}

					mult_modifier = {
						factor = 0.9
						trait = possessed
					}

					mult_modifier = {
						factor = 0.9
						trait = paranoid
					}

					mult_modifier = {
						factor = 0.9
						trait = lunatic
					}

					mult_modifier = {
						factor = 0.8
						trait = weak
					}

					mult_modifier = {
						factor = 0.9
						practical_age >= 37
					}

					mult_modifier = {
						factor = 0.9
						practical_age < 20
					}

					mult_modifier = {
						factor = 0.8
						num_of_children >= 4
					}

					mult_modifier = {
						factor = 0.8
						num_of_children >= 5
					}

					mult_modifier = {
						factor = 0.8
						num_of_children >= 6
					}

					mult_modifier = {
						factor = 0.8
						num_of_children >= 7
					}

					mult_modifier = {
						factor = 0.8
						num_of_children >= 8
					}

					mult_modifier = {
						factor = 0.8
						has_character_flag = special_marshal
					}

					mult_modifier = {
						factor = 1.5
						is_tribal = yes
					}

					mult_modifier = {
						factor = 1.5
						is_nomadic = yes
					}

					mult_modifier = {
						factor = 0.6
						trait = frail
					}

					mult_modifier = {
						factor = 0.5
						trait = malnourished
					}

					mult_modifier = {
						factor = 1.75
						trait = brawny
					}

					mult_modifier = {
						factor = 1.5
						trait = strong
					}

					mult_modifier = {
						factor = 1.5
						trait = sturdy
					}
				}

				20 = {
					mult_modifier = {
						factor = 0.5
						is_ill = no
					}

					mult_modifier = {
						factor = 0.25
						practical_age >= 18
						practical_age < 40
					}

					mult_modifier = {
						factor = 2
						trait = drunkard
					}

					mult_modifier = {
						factor = 2
						has_character_modifier = hashish_addict
					}

					mult_modifier = {
						factor = 3
						has_character_modifier = withdrawal_symptoms
					}

					character_event = {
						id = HFP.20404 # Hard pregnancy
						days = 10
						random = 5
					}
				}
			}
		}

		father_of_unborn = {
			show_scope_change = no

			if = {
				limit = {
					is_alive = yes
					is_consort = no # No authority to be paranoid. Indeed, he has no way of knowing the child is his.
				}

				custom_tooltip = {
					text = EVTTOOLTIP403

					# 1% chance of incredulous husband if not trusting
					# 50% if paranoid
					# Trusting fathers will never worry

					random_list = {
						1 = {
							trigger = { NOT = { trait = trusting } }

							additive_modifier = {
								value = 49 # for 50% chance
								trait = paranoid
							}

							character_event = { id = 404 }
						}

						99 = {
							additive_modifier = {
								value = -49 # for 50% chance
								trait = paranoid
							}

							character_event = { id = 403 }
						}
					}
				}
			}
		}
	}
}

# On-action event: Pregnancy out of wedlock!
character_event = {
	id = 401
	desc = EVTDESC401
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes # on_pregnancy

	is_married = no

	trigger = {
		is_consort = no
		NOT = { trait = pregnant }

		father_of_unborn = {
			NOR = {
				is_married = ROOT
				is_consort = ROOT
			}
		}
	}

	immediate = {
		add_trait = pregnant
	}

	option = {
		name = OK

		tooltip = {
			add_trait = pregnant
		}

		piety = -25

		if = {
			limit = {
				ai = no

				NOR = {
					has_assigned_minor_title = title_appointed_regent
					has_global_flag = pregnancy_regent_warning
				}
			}

			character_event = { id = HFP.20400 } # Pregnant ruler notified she hasn't appointed a regent
		}

		random_list = {
			50 = {
				mult_modifier = {
					factor = 0.8
					trait = shy
				}

				mult_modifier = {
					factor = 0.8
					is_ill = yes
				}

				mult_modifier = {
					factor = 0.8
					trait = possessed
				}

				mult_modifier = {
					factor = 0.8
					trait = paranoid
				}

				mult_modifier = {
					factor = 0.8
					trait = lunatic
				}

				mult_modifier = {
					factor = 0.8
					trait = weak
				}

				mult_modifier = {
					factor = 0.8
					practical_age >= 37
				}

				mult_modifier = {
					factor = 0.8
					practical_age < 20
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 3
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 4
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 5
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 6
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 7
				}

				mult_modifier = {
					factor = 0.8
					has_character_flag = special_marshal
				}

				mult_modifier = {
					factor = 0.8
					trait = shieldmaiden
				}

				mult_modifier = {
					factor = 0.6
					trait = frail
				}

				mult_modifier = {
					factor = 1.75
					trait = brawny
				}

				mult_modifier = {
					factor = 1.5
					trait = strong
				}
			}

			50 = {
				mult_modifier = {
					factor = 0.5
					is_ill = no
				}

				mult_modifier = {
					factor = 0.25
					practical_age >= 18
					practical_age < 40
				}

				mult_modifier = {
					factor = 2
					trait = drunkard
				}

				mult_modifier = {
					factor = 2
					has_character_modifier = hashish_addict
				}

				mult_modifier = {
					factor = 3
					has_character_modifier = withdrawal_symptoms
				}

				character_event = {
					id = HFP.20404 # Hard pregnancy
					days = 10
					random = 5
				}
			}
		}
	}
}

# On-action event: Pregnancy in matrimony, with another father!
character_event = {
	id = 402
	desc = EVTDESC402
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes # on_pregnancy

	is_married = yes

	trigger = {
		NOT = { trait = pregnant }

		father_of_unborn = {
			NOT = { is_married = ROOT }
		}
	}

	immediate = {
		add_trait = pregnant
	}

	option = {
		name = EVTOPTA402

		tooltip = {
			add_trait = pregnant
		}

#		log = "402: [Root.GetTitledName], wife of [Root.Spouse.GetTitledName] in [Root.Employer.PrimaryTitle.GetName] gets pregnant with [Root.FatherOfUnborn.GetTitledName]."

		spouse = {
			show_scope_change = no

			character_event = {
				id = 404
				tooltip = EVTTOOLTIP404
			}
		}

		if = {
			limit = {
				ai = no

				NOT = {
					has_assigned_minor_title = title_appointed_regent
					has_global_flag = pregnancy_regent_warning
				}
			}

			character_event = { id = HFP.20400 } # Pregnant ruler notified she hasn't appointed a regent
		}

		random_list = {
			70 = {
				mult_modifier = {
					factor = 0.8
					trait = shy
				}

				mult_modifier = {
					factor = 0.8
					is_ill = yes
				}

				mult_modifier = {
					factor = 0.8
					trait = possessed
				}

				mult_modifier = {
					factor = 0.8
					trait = paranoid
				}

				mult_modifier = {
					factor = 0.8
					trait = lunatic
				}

				mult_modifier = {
					factor = 0.8
					trait = weak
				}

				mult_modifier = {
					factor = 0.8
					practical_age >= 37
				}

				mult_modifier = {
					factor = 0.8
					practical_age < 20
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 3
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 4
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 5
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 6
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 7
				}

				mult_modifier = {
					factor = 0.8
					has_character_flag = special_marshal
				}

				mult_modifier = {
					factor = 0.8
					trait = shieldmaiden
				}

				mult_modifier = {
					factor = 0.6
					trait = frail
				}

				mult_modifier = {
					factor = 1.75
					trait = brawny
				}

				mult_modifier = {
					factor = 1.5
					trait = strong
				}
			}

			30 = {
				mult_modifier = {
					factor = 0.5
					is_ill = no
				}

				mult_modifier = {
					factor = 0.25
					practical_age >= 18
					practical_age < 40
				}

				mult_modifier = {
					factor = 2
					trait = drunkard
				}

				mult_modifier = {
					factor = 2
					has_character_modifier = hashish_addict
				}

				mult_modifier = {
					factor = 3
					has_character_modifier = withdrawal_symptoms
				}

				character_event = {
					id = HFP.20404 # Hard pregnancy
					days = 10
					random = 5
				}
			}
		}
	}
}

# The husband is a proud father!
character_event = {
	id = 403
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	desc = EVTDESC403

	option = {
		name = EXCELLENT

		prestige = 5
	}
}

# The husband suspects something ain't right
character_event = {
	id = 404
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_intrigue

	desc = {
		text = EVTDESC404_KF
		trigger = {
			FROM = {
				father_of_unborn_known = yes

				father_of_unborn = {
					NOT = { character = ROOT }
				}
			}
		}
	}

	desc = {
		text = EVTDESC404
		trigger = {
			random < 50

			FROM = {
				OR = {
					father_of_unborn_known = no

					father_of_unborn = {
						character = ROOT
					}
				}
			}
		}
	}

	desc = {
		text = EVTDESC404_2
		trigger = {
			random >= 50

			FROM = {
				OR = {
					father_of_unborn_known = no

					father_of_unborn = {
						character = ROOT
					}
				}
			}
		}
	}

	is_triggered_only = yes

	trigger = {
		NOT = {
			FROM = { has_character_flag = DW_unholy_mother }
		}
	}

	option = {
		name = EVTOPTA404 # Doubt besets me...

		trigger = {
			FROM = {
				OR = {
					father_of_unborn_known = no

					father_of_unborn = {
						character = ROOT
					}
				}
			}
		}

		if = {
			limit = {
				OR = {
					trait = paranoid
					intrigue >= 10
					random < 25
				}

				NOT = { trait = trusting }
			}

			character_event = {
				id = 21001 # Investigate this further
				days = 7
				random = 16
			}
		}
	}

	option = {
		name = EVTOPTB404 # Denounce them both as traitors!

		trigger = {
			FROM = {
				father_of_unborn_known = yes

				father_of_unborn = {
					NOT = { character = ROOT }
				}
			}
		}

		FROM = {
			father_of_unborn = {
				save_event_target_as = target_adulterer
				character_event = { id = 21006 } # Adulterer is notified that the husband knows
			}

			character_event = { id = 20 } # Adultery fallout
			character_event = { id = 21005 } # Unfaithful wife is notified that the husband knows
		}
	}
}

# Husband suspects wife is pregnant with another man
character_event = {
	id = 21001
	desc = EVTDESC21001
	picture = GFX_evt_lunatic
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	trigger = {
		FROMFROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA21001 # Hire someone to find out

		wealth = -5

		FROMFROM = {
			character_event = { id = 21002 } # Investigate this further
		}

		ai_chance = {
			factor = 100

			trigger = {
				NOT = { trait = trusting }
			}

			mult_modifier = {
				factor = 0.25
				trait = craven
			}

			mult_modifier = {
				factor = 0.25
				trait = kind
			}

			mult_modifier = {
				factor = 0.5
				trait = arbitrary
			}

			mult_modifier = {
				factor = 0.5
				trait = temperate
			}

			mult_modifier = {
				factor = 2.0
				trait = deceitful
			}

			mult_modifier = {
				factor = 2.0
				trait = wroth
			}

			mult_modifier = {
				factor = 5.0
				trait = cruel
			}

			mult_modifier = {
				factor = 5.0
				trait = impaler
			}

			mult_modifier = {
				factor = 10
				trait = paranoid
			}
		}
	}

	option = {
		name = EVTOPTB21001 # No, I trust her word!

		ai_chance = { factor = 100 }
	}
}

# Wife: Hidden bounce event: The husband is investigating
character_event = {
	id = 21002

	hide_window = yes
	is_triggered_only = yes

	trigger = {
		is_pregnant = yes
	}

	option = {
		# Success
		trigger = {
			father_of_unborn = {
				NOT = { character = FROM }
			}
		}

		clr_character_flag = final_unfaithful_investigation

		ai_chance = {
			factor = 100

			mult_modifier = {
				factor = 0.5
				FROM = { intrigue < 2 }
			}

			mult_modifier = {
				factor = 0.5
				FROM = { intrigue < 5 }
			}

			mult_modifier = {
				factor = 2.0
				FROM = { intrigue >= 10 }
			}

			mult_modifier = {
				factor = 3.0
				FROM = { intrigue >= 15 }
			}

			mult_modifier = {
				factor = 1.5
				FROM = { trait = deceitful }
			}

			mult_modifier = {
				factor = 2.0
				FROM = { trait = master_schemer }
			}

			mult_modifier = {
				factor = 2.0

				FROM = {
					any_courtier = {
						has_opinion_modifier = {
							name = opinion_chasing_friend
							who = ROOT
						}
					}
				}
			}

			mult_modifier = {
				factor = 2.0

				FROM = {
					any_courtier = {
						has_opinion_modifier = {
							name = opinion_chasing_spouse
							who = ROOT
						}
					}
				}
			}

			mult_modifier = {
				factor = 2.0

				FROM = {
					any_courtier = {
						has_opinion_modifier = {
							name = opinion_chasing_child
							who = ROOT
						}
					}
				}
			}

			mult_modifier = {
				factor = 2.0
				FROM = { has_focus = focus_intrigue }
			}
		}

		set_character_flag = spies_adultery

		FROM = {
			character_event = {
				id = 21003
				days = 10
				random = 30
			}
		}
	}

	option = {
		# No success yet

		if = {
			limit = { has_character_flag = final_unfaithful_investigation }

			clr_character_flag = final_unfaithful_investigation

			FROM = {
				character_event = {
					id = 21011 # Husband fails
					days = 15
					random = 30
				}
			}
		}

		else = {
			FROM = {
				character_event = {
					id = 21010 # Husband can escalate investigation
					days = 15
					random = 30
				}
			}
		}

		ai_chance = {
			factor = 100

			mult_modifier = {
				factor = 0.5
				intrigue < 2
			}

			mult_modifier = {
				factor = 0.5
				intrigue < 5
			}

			mult_modifier = {
				factor = 2.0
				intrigue >= 10
			}

			mult_modifier = {
				factor = 3.0
				intrigue >= 15
			}

			mult_modifier = {
				factor = 1.5
				trait = deceitful
			}

			mult_modifier = {
				factor = 1.5
				trait = master_seducer
			}

			mult_modifier = {
				factor = 2.0
				trait = master_schemer
			}

			mult_modifier = {
				factor = 5.0
				has_character_modifier = wol_court_vixen
			}

			mult_modifier = {
				factor = 5.0
				father_of_unborn = { has_character_modifier = wol_court_tomcat }
			}

			mult_modifier = {
				factor = 2.0
				has_focus = focus_intrigue
			}
		}
	}
}

# Husband's investigation is not going well. What now?
character_event = {
	id = 21010
	desc = EVTDESC21010
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA21010 # What a relief!

		ai_chance = {
			factor = 100

			trigger = {
				NOT = { trait = paranoid }
			}

			mult_modifier = {
				factor = 0.1
				has_focus = focus_intrigue
			}

			mult_modifier = {
				factor = 3.0
				trait = trusting
			}
		}
	}

	option = {
		name = EVTOPTB21010 # Confront her directly

		FROM = {
			character_event = {
				id = 21012
				days = 2
			}
		}

		ai_chance = { factor = 100 }
	}

	option = {
		name = EVTOPTC21010 # Hire more spies!

		wealth = -20

		FROM = {
			set_character_flag = final_unfaithful_investigation
			character_event = { id = 21002 }
		}

		ai_chance = {
			factor = 100

			trigger = { wealth >= 100 }

			mult_modifier = {
				factor = 0.1
				trait = greedy
			}
		}
	}

	option = {
		name = EVTOPTD21010 # Lay a trap
		tooltip_info = intrigue

		trigger = {
			OR = {
				trait = master_schemer

				trigger_if = {
					limit = { has_focus = focus_intrigue }
					intrigue >= 5
				}
				trigger_else = {
					intrigue >= 12
				}
			}

			FROM = {
				intrigue < 9

				NOR = {
					trait = master_schemer
					has_character_modifier = wol_court_vixen
				}

				father_of_unborn = {
					is_alive = yes

					NOR = {
						character = ROOT
						has_character_modifier = wol_court_tomcat
					}
				}
			}
		}

		FROM = {
			character_event = {
				id = 21016
				days = 2
			}
		}

		ai_chance = { factor = 10000 }
	}
}

# Husband's investigation fails
character_event = {
	id = 21011
	desc = EVTDESC21011
	picture = GFX_evt_lunatic
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA21011 # Damnation

		opinion = {
			name = opinion_suspected_adultery
			who = FROM
			years = 5
		}
	}
}

# Husband confronts wife directly
character_event = {
	id = 21012
	desc = EVTDESC21012
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA21012 # Deny

		FROM = {
			character_event = {
				id = 21013
				days = 1
			}
		}

		ai_chance = { factor = 100 }
	}

	option = {
		name = EVTOPTB21012 # Tearfully confess

		trigger = {
			father_of_unborn = {
				NOT = { character = FROM }
			}
		}

		set_character_flag = confessed_adultery

		FROM = {
			character_event = {
				id = 21003
				days = 1
			}
		}

		ai_chance = {
			factor = 10

			trigger = {
				NOR = {
					trait = deceitful
					trait = cruel
				}
			}

			mult_modifier = {
				factor = 10.0
				trait = kind
			}

			mult_modifier = {
				factor = 10.0
				trait = just
			}

			mult_modifier = {
				factor = 20.0

				opinion = {
					who = FROM
					value >= 50
				}
			}
		}
	}

	option = {
		name = EVTOPTC21012 # Skillfully manipulate him
		tooltip_info = intrigue

		trigger = {
			OR = {
				intrigue >= 12
				has_focus = focus_intrigue
				has_focus = focus_seduction
				has_character_modifier = wol_court_vixen
				trait = master_seductress
			}

			FROM = {
				intrigue < 9
				NOT = { has_focus = focus_intrigue }
			}
		}

		FROM = {
			character_event = {
				id = 21015
				days = 1
			}
		}

		ai_chance = { factor = 10000 }
	}
}

# Wife denies. Husband's investigation fails.
character_event = {
	id = 21013
	desc = EVTDESC21013
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	trigger = {
		FROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA21013 # Alright

		opinion = {
			name = opinion_suspected_adultery
			who = FROM
			years = 5
		}
	}
}

# Wife caught. Consequences...
character_event = {
	id = 21003
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	desc = {
		text = EVTDESC21003_CR
		trigger = {
			FROM = {
				has_character_flag = spies_adultery
				father_of_unborn = {
					is_close_relative = PREV
				}
			}
		}
	}
	desc = {
		text = EVTDESC21003
		trigger = {
			FROM = {
				has_character_flag = spies_adultery
				father_of_unborn = {
					NOT = { is_close_relative = PREV }
				}
			}
		}
	}
	desc = {
		text = EVTDESC21003_CONF_CR
		trigger = {
			FROM = {
				has_character_flag = confessed_adultery
				father_of_unborn = {
					is_close_relative = PREV
				}
			}
		}
	}
	desc = {
		text = EVTDESC21003_CONF
		trigger = {
			FROM = {
				has_character_flag = confessed_adultery
				father_of_unborn = {
					NOT = { is_close_relative = PREV }
				}
			}
		}
	}
	desc = {
		text = EVTDESC21003_TRAP_CR
		trigger = {
			FROM = {
				has_character_flag = trap_adultery
				father_of_unborn = {
					is_close_relative = PREV
				}
			}
		}
	}
	desc = {
		text = EVTDESC21003_TRAP
		trigger = {
			FROM = {
				has_character_flag = trap_adultery
				father_of_unborn = {
					NOT = { is_close_relative = PREV }
				}
			}
		}
	}

	is_triggered_only = yes

	trigger = {
		FROM = { is_alive = yes }
	}

	immediate = {
		if = {
			limit = {
				OR = {
					has_character_flag = trap_adultery
					has_character_flag = spies_adultery
				}
			}

			if = {
				limit = { trait = trusting }

				random = {
					chance = 20
					remove_trait_trusting_effect = yes
				}
			}
			else_if = {
				limit = {
					NOT = { trait = paranoid }
				}

				random = {
					chance = 10
					add_trait_paranoid_effect = yes
				}
			}
		}
	}

	option = {
		name = EVTOPTA21003 # Keep this quiet

		FROM = {
			show_scope_change = no

			clr_character_flag = trap_adultery
			clr_character_flag = confessed_adultery
			clr_character_flag = spies_adultery

			reverse_opinion = {
				name = opinion_unfaithful_private
				who = ROOT
				years = 5
			}

			father_of_unborn = {
				show_scope_change = no

				reverse_opinion = {
					name = opinion_cuckolded_private
					who = ROOT
					years = 5
				}
			}
		}

		ai_chance = {
			factor = 10

			trigger = {
				NOR = {
					trait = wroth
					trait = cruel
					trait = envious
					trait = zealous
				}
			}

			mult_modifier = {
				factor = 0.5
				trait = just
			}

			mult_modifier = {
				factor = 3
				trait = craven
			}

			mult_modifier = {
				factor = 2
				trait = arbitrary
			}

			mult_modifier = {
				factor = 2
				trait = temperate
			}

			mult_modifier = {
				factor = 5
				trait = kind
			}

			mult_modifier = {
				factor = 5
				trait = cynical
			}
		}
	}

	option = {
		name = {
			text = EVTOPTB21003 # Unholy!

			trigger = {
				religion_has_incest = no

				FROM = {
					father_of_unborn = {
						is_close_relative = PREV
					}
				}
			}
		}
		name = {
			text = EVTOPTC21003 # Holy, but they are still traitors!

			trigger = {
				religion_has_incest = yes

				FROM = {
					father_of_unborn = {
						is_close_relative = PREV
					}
				}
			}
		}
		name = {
			text = EVTOPTD21003 # Traitors!

			trigger = {
				FROM = {
					father_of_unborn = {
						NOT = { is_close_relative = PREV }
					}
				}
			}
		}

		FROM = {
			show_scope_change = no

			father_of_unborn = {
				save_event_target_as = target_adulterer # For event 20, below
				character_event = { id = 21006 } # The adulterer is notified that the husband knows
			}

			character_event = { id = 20 } # Adultery fallout
			father_of_unborn_known = yes

			if = {
				limit = { has_character_flag = spies_adultery }
				character_event = { id = 21005 } # The unfaithful wife is notified that the husband knows
			}

			clr_character_flag = trap_adultery
			clr_character_flag = confessed_adultery
			clr_character_flag = spies_adultery
		}

		ai_chance = { factor = 100 }
	}
}

# Wife denies and manipulates husband.
character_event = {
	id = 21015
	desc = EVTDESC21015
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	trigger = {
		FROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA21015 # Alright

		opinion = {
			name = opinion_regrets_accusation
			who = FROM
			years = 3
		}

		random = {
			chance = 20
			add_trait_partially_trusting_effect = yes
		}
	}
}

# Wife: husband has laid a trap
character_event = {
	id = 21016
	desc = EVTDESC21016
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	trigger = {
		FROM = { is_alive = yes }
	}

	option = {
		name = EVTOPTA21016 # That conniving bastard!

		set_character_flag = trap_adultery

		FROM = {
			show_scope_change = no

			character_event = {
				id = 21003
				tooltip = EVTTOOLTIP21003_TRAP
			}
		}
	}
}

# The unfaithful wife is notified that the husband knows
character_event = {
	id = 21005
	desc = EVTDESC21005
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	ai = no

	option = {
		name = EVTOPTA21005 # Damn!
	}
}

# The adulterer is notified that the husband knows
character_event = {
	id = 21006
	desc = EVTDESC21006
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	ai = no

	option = {
		name = {
			text = EVTOPTA21006 # Damn!
			trigger = { is_vassal_or_below_of = FROM }
		}
		name = {
			text = EVTOPTB21006 # Damn!
			trigger = { NOT = { is_vassal_or_below_of = FROM } }
		}
	}
}


# Consort: Pregnancy starts showing
character_event = {
	id = 410
	desc = EVTDESC410
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # on_pregnancy

	trigger = {
		NOT = { trait = pregnant }

		father_of_unborn = {
			ROOT = {
				is_consort = PREV
			}
		}
	}

	immediate = {
		add_trait = pregnant
	}

	option = {
		name = ALAS

		tooltip = {
			add_trait = pregnant
		}

		prestige = 10

		random_list = {
			70 = {
				mult_modifier = {
					factor = 0.8
					trait = shy
				}

				mult_modifier = {
					factor = 0.8
					is_ill = yes
				}

				mult_modifier = {
					factor = 0.8
					trait = possessed
				}

				mult_modifier = {
					factor = 0.8
					trait = paranoid
				}

				mult_modifier = {
					factor = 0.8
					trait = lunatic
				}

				mult_modifier = {
					factor = 0.8
					trait = weak
				}

				mult_modifier = {
					factor = 0.8
					practical_age >= 37
				}

				mult_modifier = {
					factor = 0.8
					practical_age < 20
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 3
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 4
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 5
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 6
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 7
				}

				mult_modifier = {
					factor = 0.8
					has_character_flag = special_marshal
				}

				mult_modifier = {
					factor = 0.8
					trait = shieldmaiden
				}

				mult_modifier = {
					factor = 0.6
					trait = frail
				}

				mult_modifier = {
					factor = 1.75
					trait = brawny
				}

				mult_modifier = {
					factor = 1.5
					trait = strong
				}
			}

			30 = {
				mult_modifier = {
					factor = 0.5
					is_ill = no
				}

				mult_modifier = {
					factor = 0.25
					practical_age >= 18
					practical_age < 40
				}

				mult_modifier = {
					factor = 2
					trait = drunkard
				}

				mult_modifier = {
					factor = 2
					has_character_modifier = hashish_addict
				}

				mult_modifier = {
					factor = 3
					has_character_modifier = withdrawal_symptoms
				}

				character_event = {
					id = HFP.20404 # Hard pregnancy
					days = 10
					random = 5
				}
			}
		}

		father_of_unborn = {
			show_scope_change = no

			if = {
				limit = { is_alive = yes }

				if = {
					limit = {
						NOT = { trait = trusting }
					}

					random = {
						chance = 1

						mult_modifier = {
							factor = 50
							trait = paranoid
						}

						character_event = { id = 404 }
					}
				}

				if = {
					limit = { is_lover = ROOT }
					custom_tooltip = { text = EVTTOOLTIP413 }
				}
				else = {
					character_event = {
						id = 413
						tooltip = EVTTOOLTIP413
					}
				}
			}
		}
	}
}

# Consort: Pregnancy with another father!
character_event = {
	id = 412
	desc = EVTDESC412
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes # on_pregnancy

	trigger = {
		is_consort = yes

		NOR = {
			trait = pregnant

			father_of_unborn = {
				ROOT = {
					is_consort = PREV
				}
			}
		}
	}

	immediate = {
		add_trait = pregnant
	}

	option = {
		name = EVTOPTA412

		tooltip = {
			add_trait = pregnant
		}

		consort = {
			show_scope_change = no

			character_event = {
				id = 404
				tooltip = EVTTOOLTIP404
			}
		}

		random_list = {
			70 = {

				mult_modifier = {
					factor = 0.8
					trait = shy
				}

				mult_modifier = {
					factor = 0.8
					is_ill = yes
				}

				mult_modifier = {
					factor = 0.8
					trait = possessed
				}

				mult_modifier = {
					factor = 0.8
					trait = paranoid
				}

				mult_modifier = {
					factor = 0.8
					trait = lunatic
				}

				mult_modifier = {
					factor = 0.8
					trait = weak
				}

				mult_modifier = {
					factor = 0.8
					practical_age >= 37
				}

				mult_modifier = {
					factor = 0.8
					practical_age < 20
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 3
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 4
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 5
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 6
				}

				mult_modifier = {
					factor = 0.8
					num_of_children >= 7
				}

				mult_modifier = {
					factor = 0.8
					has_character_flag = special_marshal
				}

				mult_modifier = {
					factor = 0.8
					trait = shieldmaiden
				}

				mult_modifier = {
					factor = 0.6
					trait = frail
				}

				mult_modifier = {
					factor = 1.75
					trait = brawny
				}

				mult_modifier = {
					factor = 1.5
					trait = strong
				}
			}

			30 = {
				mult_modifier = {
					factor = 0.5
					is_ill = no
				}

				mult_modifier = {
					factor = 0.25
					practical_age >= 18
					practical_age < 40
				}

				mult_modifier = {
					factor = 2
					trait = drunkard
				}

				mult_modifier = {
					factor = 2
					has_character_modifier = hashish_addict
				}

				mult_modifier = {
					factor = 3
					has_character_modifier = withdrawal_symptoms
				}

				character_event = {
					id = HFP.20404 # Hard pregnancy
					days = 10
					random = 5
				}
			}
		}
	}
}

# The consort's liege is a proud father!
character_event = {
	id = 413
	desc = EVTDESC413
	picture = GFX_evt_pregnancy
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = {
		name = OK

		prestige = 5
	}
}

#############################################
# EVENTS ON THE BIRTH OF A BASTARD CHILD
#############################################

# On-action event: A child is born out of wedlock
character_event = {
	id = 300
	desc = EVTDESC300
	picture = GFX_evt_birth

	is_triggered_only = yes # on_birth

	trigger = {
		was_conceived_a_bastard = yes

		OR = {
			# There is no 'real_father' set, i.e. this is not a hidden, cuckoo bastard
			NOT = { real_father = { always = yes } }

			AND = {
				real_father = {
					is_alive = yes
					is_ruler = yes
				}

				# The mother is the landless lover of somebody else
				mother_even_if_dead = {
					is_married = no
				}
			}
		}
	}

	# Mothers who are married matrilineally automatically legitimize their bastards
	option = {
		name = OK

		trigger = {
			mother = {
				is_married_matrilineally = yes
			}
		}

		mother = {
			character_event = {
				id = Plus.425
				days = 1
			}
		}
	}

	option = {
		name = OK

		trigger = {
			mother = {
				is_married_matrilineally = no
			}
		}

		if = {
			limit = {
				father = {
					is_lowborn = no
				}

				NOT = {
					real_father = { always = yes }
				}
			}

			father = {
				character_event = {
					id = 301 # The father's reaction
					days = 1
				}
			}
		}
		else_if = {
			limit = {
				real_father = {
					is_alive = yes
					is_ruler = yes
				}

				mother_even_if_dead = {
					is_married = no # The mother is the landless lover of somebody else
				}
			}

			set_father = real_father

			real_father = {
				character_event = {
					id = 301 # The father's reaction
					days = 1
				}
			}
		}
	}
}

# The father reacts to the bastard birth
character_event = {
	id = 301
	desc = EVTDESC301
	picture = GFX_evt_birth
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA301 # Legitimize the child

		trigger = {
			has_polygamy = no

			FROM = {
				mother = {
					OR = {
						# In case the mother is a higher tier ruler, she gets to decide what happens to the child.
						lower_real_tier_than = ROOT

						# In case mother is same tier as real_father, real_father gets to claim the child, depending on succession law
						AND = {
							real_tier = ROOT

							NOR = {
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
								has_law = true_cognatic_succession
							}
						}
					}
				}
			}
		}

		custom_tooltip = { text = EVTOPTA301_DESC }

		spouse = {
			show_scope_change = no

			tooltip = { # Spouse reaction
				opinion = {
					name = legitimized_bastard
					who = ROOT
					years = 10
				}
			}
		}

		FROM = {
			show_scope_change = no

			character_event = { id = 302 } # The child gets the father's dynasty

			mother = {
				show_scope_change = no

				tooltip = {
					opinion = {
						name = legitimized_child
						who = ROOT
						years = 10
					}
				}

				character_event = {
					id = 303 # The child's mother is very pleased
					# tooltip = EVTTOOLTIP303
				}

				spouse = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's husband is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}

				consort = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's lord is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}
			}
		}

		if = {
			limit = {
				any_child = {
					is_alive = yes
					dynasty = ROOT

					NOR = {
						character = FROM
						is_mother = FROM
						trait = bastard
						trait = legit_bastard
					}
				}
			}

			custom_tooltip = {
				text = EVTOPTA301_legchildren_TOOLTIP

				any_child = {
					limit = {
						dynasty = ROOT

						NOR = {
							character = FROM
							is_mother = FROM
							trait = bastard
							trait = legit_bastard
						}
					}

					opinion = {
						name = legitimized_bastard
						who = ROOT
						years = 1
					}
				}
			}
		}

		ai_chance = {
			factor = 25

			mult_modifier = {
				factor = 0.5
				FROM = { is_female = no }
			}

			mult_modifier = {
				factor = 2
				FROM = { is_female = yes }
			}

			mult_modifier = {
				factor = 0.2

				trait = zealous
				religion_group = christian

				NOR = {
					religion = bogomilist
					religion = cathar
					religion = tondrakian
					religion = messalian
				}
			}

			mult_modifier = {
				factor = 2.0
				trait = just
			}

			mult_modifier = {
				factor = 2.0
				trait = kind
			}

			# CK2Plus
			mult_modifier = {
				factor = 2

				FROM = { is_female = no }

				NOT = {
					any_child = {
						is_female = no
						is_alive = yes

						NOR = {
							character = FROM
							trait = bastard
						}
					}
				}
			}

			mult_modifier = {
				factor = 3

				practical_age >= 40
				FROM = { is_female = no }

				NOT = {
					any_child = {
						is_female = no
						is_alive = yes

						NOR = {
							character = FROM
							trait = bastard
						}
					}
				}
			}

			mult_modifier = {
				factor = 0.25

				is_ruler = yes
				FROM = { is_female = no }

				any_child = {
					is_female = no
					is_alive = yes

					NOR = {
						character = FROM
						trait = bastard
					}
				}
			}

			mult_modifier = {
				factor = 2
				trait = diligent
			}

			mult_modifier = {
				factor = 0.5
				trait = deceitful
			}

			mult_modifier = {
				factor = 0.5

				is_married = yes

				opinion = {
					who = spouse
					value >= 40
				}
			}
		}
	}

	option = {
		name = EVTOPTB301 # Acknowledge the child

		trigger = {
			FROM = {
				mother = {
					OR = {
						# In case the mother is a higher tier ruler, she gets to decide what happens to the child.
						lower_real_tier_than = ROOT

						# In case mother is same tier as real_father, real_father gets to claim the child, depending on succession law
						AND = {
							real_tier = ROOT

							NOR = {
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
								has_law = true_cognatic_succession
							}
						}
					}
				}
			}
		}

		custom_tooltip = { text = EVTOPTB301_DESC }

		spouse = {
			show_scope_change = no

			tooltip = {
				opinion = { # Spouse reaction
					name = acknowledged_bastard
					who = ROOT
					years = 10
				}
			}
		}

		FROM = {
			show_scope_change = no

			character_event = { id = 306 } # The child gets the father's dynasty, but is not legitimized.

			if = {
				limit = { trait = born_in_the_purple }
				remove_trait = born_in_the_purple
			}

			mother = {
				show_scope_change = no

				tooltip = {
					opinion = {
						name = acknowledged_child
						who = ROOT
						years = 10
					}
				}

				character_event = {
					id = 307 # The child's mother is pleased
					# tooltip = EVTTOOLTIP307
				}

				spouse = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's husband is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}

				consort = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's man is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}
			}
		}

		ai_chance = {
			factor = 25

			mult_modifier = {
				factor = 0.5

				FROM = { is_female = yes }
				is_ruler = yes

				any_child = {
					is_female = no

					NOR = {
						character = FROM
						trait = bastard
					}
				}
			}

			mult_modifier = {
				factor = 0.5

				trait = zealous
				religion_group = christian
				gender_equality_trigger = no

				NOR = {
					religion = bogomilist
					religion = cathar
					religion = tondrakian
					religion = messalian
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = just
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			# CK2Plus
			mult_modifier = {
				factor = 1.5
				trait = diligent
			}

			mult_modifier = {
				factor = 0.5
				trait = deceitful
			}
		}
	}

	option = {
		name = EVTOPTC301 # Denounce the child

		trigger = {
			FROM = {
				mother = {
					OR = {
						# In case the mother is a higher tier ruler, she gets to decide what happens to the child.
						lower_real_tier_than = ROOT

						# In case mother is same tier as real_father, real_father gets to claim the child, depending on succession law
						AND = {
							real_tier = ROOT

							NOR = {
								has_law = enatic_succession
								has_law = enatic_cognatic_succession
								has_law = true_cognatic_succession
							}
						}
					}
				}
			}
		}

		custom_tooltip = { text = EVTOPTC301_DESC }

		FROM = {
			show_scope_change = no

			character_event = { id = 309 } # 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
			}

			mother = {
				show_scope_change = no

				tooltip = {
					opinion = {
						name = denounced_child
						who = ROOT
						years = 10
					}
				}

				character_event = {
					id = 310 # The child's mother is dishonoured
					# tooltip = EVTTOOLTIP310
				}

				spouse = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's husband is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}

				consort = {
					show_scope_change = no

					tooltip = {
						opinion = {
							name = opinion_cuckolded
							who = ROOT
							years = 10
						}
					}

					character_event = {
						id = 304 # The child's mother's man is pissed off
						# tooltip = EVTTOOLTIP304
					}
				}
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 2.0
				trait = cruel
			}

			mult_modifier = {
				factor = 1.5
				trait = arbitrary
			}

			# CK2Plus
			mult_modifier = {
				factor = 0.5
				is_married = no
			}

			mult_modifier = {
				factor = 0.5

				FROM = { is_female = no }

				NOT = {
					any_child = {
						is_female = no
						is_alive = yes
						NOT = { character = FROM }
					}
				}
			}

			mult_modifier = {
				factor = 1.25
				num_of_children >= 2
			}

			mult_modifier = {
				factor = 1.25
				num_of_children >= 3
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 4
			}

			mult_modifier = {
				factor = 2
				num_of_children >= 5
			}

			mult_modifier = {
				factor = 0.5
				trait = kind
			}

			mult_modifier = {
				factor = 0.5
				trait = diligent
			}

			mult_modifier = {
				factor = 0.5
				trait = just
			}

			mult_modifier = {
				factor = 0.5
				trait = honest
			}

			mult_modifier = {
				factor = 0.75
				trait = humble
			}

			mult_modifier = {
				factor = 1.5
				trait = proud
			}

			mult_modifier = {
				factor = 1.5
				trait = craven
			}

			mult_modifier = {
				factor = 2
				trait = zealous
			}

			mult_modifier = {
				factor = 0.5

				FROM = {
					mother = {
						reverse_opinion = {
							who = ROOT
							value >= 40
						}
					}
				}
			}

			mult_modifier = {
				factor = 2

				FROM = {
					mother = {
						reverse_opinion = {
							who = ROOT
							value < 0
						}
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTD301 # Do nothing

		trigger = {
			FROM = {
				mother = {
					# In case the mother is a lower tier ruler, the father gets to decide what happens to the child.
					higher_real_tier_than = ROOT
				}
			}
		}

		ai_chance = { factor = 100 }
	}
}

# The child gets the father's dynasty
character_event = {
	id = 302
	desc = EVTDESC302
	picture = GFX_evt_birth
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = OK

		dynasty = FROM
		culture = FROM
		religion = FROM

		remove_trait = bastard
		add_trait = legit_bastard
		recalc_succession = yes

		if = {
			limit = {
				FROM = { is_female = no }
			}

			opinion = {
				name = legitimized_me
				who = FROM
				years = 10
			}
		}

		hidden_effect = {
			if = {
				limit = {
					FROM = {
						trait = divine_blood
					}
				}
				add_trait = divine_blood
			}
			else = {
				remove_trait = divine_blood
			}
		}

		father = {
			show_scope_change = no

			spouse = {
				show_scope_change = no

				character_event = {
					id = 305 # The father's wife is enraged
					tooltip = EVTTOOLTIP305
				}
			}
		}
	}
}

# The child's mother is very pleased
character_event = {
	id = 303
	desc = EVTDESC303
	picture = GFX_evt_birth
	border = GFX_event_normal_frame_diplomacy

	is_triggered_only = yes

	option = {
		name = EVTOPTA303

		opinion = {
			name = legitimized_child
			who = FROM
			years = 10
		}
	}
}

# The child's mother's husband is pissed off
character_event = {
	id = 304
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_intrigue

	desc = {
		text = evt_304_desc_a

		trigger = {
			FROMFROM = {
				mother = {
					NOR = {
						has_character_modifier = adulteress
						has_character_modifier = incestuous_adulteress
					}
				}
			}
		}
	}

	desc = {
		text = evt_CK2_304_desc_b

		trigger = {
			FROMFROM = {
				mother = {
					OR = {
						has_character_modifier = adulteress
						has_character_modifier = incestuous_adulteress
					}
				}
			}
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTA304

		FROMFROM = {
			show_scope_change = no

			real_father = {
				show_scope_change = no

				reverse_opinion = {
					name = opinion_cuckolded
					who = ROOT
					years = 10
				}
			}

			mother = {
				show_scope_change = no

				reverse_opinion = {
					name = opinion_unfaithful_wife
					who = ROOT
					years = 10
				}
			}
		}
	}
}

# The father's wife is enraged
character_event = {
	id = 305
	desc = EVTDESC305
	picture = GFX_evt_quarrel

	is_triggered_only = yes

	option = {
		name = EVTOPTA305

		opinion = {
			name = legitimized_bastard
			who = spouse
			years = 20
		}

		FROM = {
			show_scope_change = no

			mother = {
				show_scope_change = no

				reverse_opinion = {
					name = slut_seductress
					who = ROOT
					years = 20
				}
			}
		}
	}
}

# The child gets the father's dynasty, but is not legitimized.
character_event = {
	id = 306
	desc = EVTDESC306
	picture = GFX_evt_birth

	is_triggered_only = yes

	option = {
		name = OK

		dynasty = FROM
		add_trait = bastard

		father = {
			show_scope_change = no

			spouse = {
				show_scope_change = no

				character_event = {
					id = 308 # The father's wife is angered
					tooltip = EVTTOOLTIP308
				}
			}
		}
	}
}

# The child's mother is pleased
character_event = {
	id = 307
	desc = EVTDESC307
	picture = GFX_evt_birth

	is_triggered_only = yes

	option = {
		name = EVTOPTA307

		opinion = {
			name = acknowledged_child
			who = FROM
			years = 10
		}
	}
}

# The father's wife is angered
character_event = {
	id = 308
	desc = EVTDESC308
	picture = GFX_evt_quarrel

	is_triggered_only = yes

	option = {
		name = EVTOPTA308

		opinion = {
			name = acknowledged_bastard
			who = spouse
			years = 10
		}

		FROM = {
			show_scope_change = no

			mother = {
				show_scope_change = no

				reverse_opinion = {
					name = slut_seductress
					who = ROOT
					years = 20
				}
			}
		}
	}
}

# The child is denounced
character_event = {
	id = 309
	desc = EVTDESC309
	picture = GFX_evt_birth

	is_triggered_only = yes

	option = {
		name = OK

		dynasty = mother_bastard

		father = {
			spouse = {
				character_event = { id = 311 } # The father's wife is displeased
			}
		}

		set_father = 0
		set_real_father = FROM
	}
}

# The child's mother is dishonoured
character_event = {
	id = 310
	desc = EVTDESC310
	picture = GFX_evt_quarrel

	is_triggered_only = yes

	option = {
		name = EVTOPTA310

		opinion = {
			name = denounced_child
			who = FROM
			years = 10
		}
	}
}

# The father's wife is displeased
character_event = {
	id = 311
	desc = EVTDESC311
	picture = GFX_evt_quarrel

	is_triggered_only = yes

	option = {
		name = EVTOPTA311

		FROM = {
			show_scope_change = no

			mother = {
				show_scope_change = no

				reverse_opinion = {
					name = slut_seductress
					who = ROOT
					years = 20
				}
			}
		}

		spouse = {
			show_scope_change = no

			if = {
				limit = { gender_equality_trigger = yes }

				reverse_opinion = {
					name = opinion_unfaithful_husband_crime
					who = ROOT
					years = 5
				}
			}
			else = {
				reverse_opinion = {
					name = opinion_unfaithful_husband
					who = ROOT
					years = 5
				}
			}
		}
	}
}

character_event = {
	id = 312

	is_triggered_only = yes # on_birth
	hide_window = yes

	option = {
		if = {
			limit = {
				mother = { is_consort = yes }
			}
			add_trait = child_of_consort
		}
		else_if = {
			limit = {
				father = { is_consort = yes }
			}
			add_trait = child_of_consort_male
		}
	}
}

# On-action event: Birth complications - Pointing out that the baby receives this event, and thus is the one who has to 'decide' if mother gets to die or not.
character_event = {
	id = 313

	is_triggered_only = yes # on_post_birth
	hide_window = yes

	trigger = {
		age < 1
	}

	immediate = {
		if = {
			limit = {
				mother_even_if_dead = {
					OR = {
						has_character_flag = gabriel_baby
						has_character_flag = lucifer_baby
						has_character_flag = iblis_baby
						has_character_flag = thor_baby
						has_character_flag = loki_baby
						has_character_flag = tengri_baby
						has_character_flag = erlik_baby
					}
				}
			}

			character_event = {
				id = HFP.20538 # Baby vision
				days = 1
			}
		}

		# Child born in good health?
		random_list = {
			50 = {
				# All is well

				mult_modifier = {
					factor = 0.5

					OR = {
						trait = hunchback
						trait = dwarf
						trait = inbred
					}
				}

				mult_modifier = {
					factor = 4.0
					is_strong_trigger = yes
				}

				mult_modifier = {
					factor = 0.25
					is_weak_trigger = yes
				}
			}

			# CK2Plus
			30 = {
				trigger = {
					mother = {
						NOR = {
							has_character_flag = gabriel_baby
							has_character_flag = lucifer_baby
							has_character_flag = iblis_baby
							has_character_flag = thor_baby
							has_character_flag = loki_baby
							has_character_flag = tengri_baby
							has_character_flag = erlik_baby
						}
					}
				}

				mult_modifier = { # Old remedy
					factor = 0.25

					mother = {
						has_character_flag = flag_mother_dark_rest
					}
				}

                if = {
                    limit = { has_dlc = "Reapers" }
                    add_symptom_effect = yes
                }
				else = {
                    add_trait = ill
                }
			}

			10 = {
				trigger = {
					NOR = {
						has_character_flag = gabriel_baby
						has_character_flag = lucifer_baby
						has_character_flag = iblis_baby
						has_character_flag = thor_baby
						has_character_flag = loki_baby
						has_character_flag = tengri_baby
						has_character_flag = erlik_baby
					}
				}

				mult_modifier = { # Old remedy
					factor = 0.25
					mother = { has_character_flag = flag_mother_dark_rest }
				}

				add_trait = sickly

				# Sickly infant treatment event
				if = {
					limit = {
						has_dlc = "Reapers"

						host = {
							any_courtier_or_vassal = {
								has_minor_title = title_court_physician
								vassal_of = PREVPREV
							}
						}
					}

					save_event_target_as = sickly_infant
					father = { save_event_target_as = sickly_father }

					# Decided which parent will choose treatment
					if = {
						limit = {
							father = { is_ruler = yes }
							host = { character = event_target:sickly_father }
							mother = { is_ruler = no }
						}

						father = {
							save_event_target_as = infant_guardian
						}
					}
					else = {
						mother = {
							save_event_target_as = infant_guardian
						}
					}

					# Makes court physician examine child
					host = {
						random_courtier_or_vassal = {
							limit = {
								has_minor_title = title_court_physician
								vassal_of = PREV
							}

							save_event_target_as = court_physician
						}
					}

					event_target:infant_guardian = {
						character_event = {
							id = RIP.11067
							days = 7
						}
					}
				}

				mother = {
					if = {
						limit = { trait = pregnant }
						remove_trait = pregnant
					}
				}
			}
		}

		# Chance mother gets sick
		random_list = {
			65 = { # No complications
				trigger = {
					mother = {
						NOT = { trait = troubled_pregnancy }
					}
				}

				mult_modifier = {
					factor = 2.0
					mother = { health >= 6 }
				}

				mult_modifier = {
					factor = 2.0
					mother = { health >= 7 }
				}

				mult_modifier = {
					factor = 1.25
					mother = { num_of_children >= 3 }
				}

				mult_modifier = {
					factor = 0.75
					mother = { practical_age >= 20 }
				}

				mult_modifier = {
					factor = 0.75
					mother = { practical_age >= 25 }
				}

				mult_modifier = {
					factor = 0.75
					mother = { practical_age >= 30 }
				}

				# CK2Plus
				mult_modifier = {
					factor = 0.5
					mother = { practical_age >= 35 }
				}

				mult_modifier = {
					factor = 0.5
					mother = { practical_age >= 40 }
				}

				mult_modifier = {
					factor = 1.5
					mother = { is_strong_trigger = yes }
				}

				mult_modifier = {
					factor = 0.25
					mother = { is_ill = yes }
				}

				mult_modifier = {
					factor = 0.5
					mother = { is_weak_trigger = yes }
				}
			}

			55 = { # Mother gets ill
				trigger = {
					mother = {
						is_ill = no
						NOT = { trait = troubled_pregnancy }
					}
				}

				mult_modifier = {
					factor = 2
					mother = { trait = hard_pregnancy }
				}

				mult_modifier = {
					factor = 25
					mother = { health < 4.1 }
				}

				mult_modifier = {
					factor = 1.5
					mother = { num_of_children < 2 }
				}

				# CK2Plus
				mult_modifier = {
					factor = 10
					mother = { num_of_children < 1 }
				}

				mother = {
					if = {
						limit = { is_ill = yes }
						character_event = { id = 316 } # Gets pneumonia
					}
					else = {
						character_event = { id = 315 } # Becomes ill
					}
				}
			}

			6 = { # Mother has troubled pregnancy
				trigger = {
					mother = {
						OR = {
							is_ill = yes
							trait = troubled_pregnancy

							check_variable = {
								which = troubled_pregnancy_variable
								value >= 1
							}
						}
					}
				}

				mult_modifier = {
					factor = 1.5
					mother = { health < 4.1 }
				}

				mult_modifier = {
					factor = 2
					mother = { health < 3.1 }
				}

				mult_modifier = {
					factor = 1.5
					mother = { num_of_children < 2 }
				}

				mult_modifier = {
					factor = 1.5

					mother = {
						check_variable = {
							which = troubled_pregnancy_variable
							value >= 2
						}
					}
				}

				mult_modifier = {
					factor = 1.5

					mother = {
						check_variable = {
							which = troubled_pregnancy_variable
							value >= 3
						}
					}
				}

				mult_modifier = {
					factor = 2

					mother = {
						check_variable = {
							which = troubled_pregnancy_variable
							value >= 4
						}
					}
				}

				mult_modifier = {
					factor = 3

					mother = {
						check_variable = {
							which = troubled_pregnancy_variable
							value >= 5
						}
					}
				}


				mother = {
					character_event = { id = 316 } # Troubled pregnancy gets worse
				}
			}
		}
	}
}

# On-action event: Birth complications after a stillbirth - Technically disabled.
# (in mother scope)
character_event = {
	id = 314

	hide_window = yes
	is_triggered_only = yes # on_post_birth_stillbirth

	trigger = {
		age >= 1
		immortal = no
	}

	immediate = {
		remove_trait = pregnancy_finishing

		if = {
			limit = { trait = pregnant }
			remove_trait = pregnant
		}

		random_list = { # No complications
			50 = {
				trigger = {
					NOT = { trait = troubled_pregnancy }
				}

				mult_modifier = {
					factor = 0.7
					trait = hard_pregnancy
				}

				mult_modifier = {
					factor = 0.7
					is_ill = yes
				}

				mult_modifier = {
					factor = 2.0
					health = 6
				}

				mult_modifier = {
					factor = 2.0
					health = 7
				}

				mult_modifier = {
					factor = 1.25
					num_of_children >= 3
				}

				mult_modifier = {
					factor = 0.75
					practical_age >= 20
				}

				mult_modifier = {
					factor = 0.75
					practical_age >= 25
				}

				mult_modifier = {
					factor = 0.75
					practical_age >= 30
				}

				# CK2Plus
				mult_modifier = {
					factor = 1.25
					practical_age < 20
				}

				mult_modifier = {
					factor = 0.5
					practical_age >= 35
				}

				mult_modifier = {
					factor = 0.5
					practical_age >= 40
				}

				mult_modifier = {
					factor = 1.5
					is_strong_trigger = yes
				}

				mult_modifier = {
					factor = 0.5
					is_weak_trigger = yes
				}
			}

			19 = { # Mother gets ill
				trigger = {
					is_ill = no
					NOT = { trait = troubled_pregnancy }
				}

				mult_modifier = {
					factor = 2
					trait = hard_pregnancy
				}

				mult_modifier = {
					factor = 5
					health < 4.1
				}

				mult_modifier = {
					factor = 1.5
					num_of_children < 2
				}

				# CK2Plus
				mult_modifier = {
					factor = 1.5
					num_of_children < 1
				}

				character_event = { id = 315 } # Mother ill after giving birth
			}

			10 = { # Mother has troubled pregnancy
				trigger = {
					OR = {
						trait = troubled_pregnancy
						is_ill = yes

						check_variable = {
							which = troubled_pregnancy_variable
							value = 1
						}
					}
				}

				mult_modifier = {
					factor = 1.5
					health < 4.1
				}

				mult_modifier = {
					factor = 2
					health < 3.1
				}

				mult_modifier = {
					factor = 1.5
					num_of_children < 2
				}

				mult_modifier = {
					factor = 1.5

					check_variable = {
						which = troubled_pregnancy_variable
						value >= 2
					}
				}

				mult_modifier = {
					factor = 1.5

					check_variable = {
						which = troubled_pregnancy_variable
						value >= 3
					}
				}

				mult_modifier = {
					factor = 2

					check_variable = {
						which = troubled_pregnancy_variable
						value >= 4
					}
				}

				mult_modifier = {
					factor = 3

					check_variable = {
						which = troubled_pregnancy_variable
						value >= 5
					}
				}

				character_event = { id = 316 } # Troubled pregnancy gets worse
			}
		}
	}
}

# Mother ill after giving birth
character_event = {
	id = 315
	desc = EVTDESC315
	picture = GFX_evt_illness

	is_triggered_only = yes

	trigger = {
		immortal = no
	}

	option = {
		name = EVTOPTA315

		if = {
			limit = { has_dlc = "Reapers" }
			add_symptom_effect = yes
		}
		else = {
			add_trait = ill
		}

		# CK2Plus
		hidden_effect = {
			random_list = {
				50 = {
					# no additional issues
					mult_modifier = {
						factor = 1.5
						num_of_children < 2
					}

					mult_modifier = {
						factor = 0.75
						num_of_children >= 3
					}

					mult_modifier = {
						factor = 0.75
						num_of_children >= 5
					}

					mult_modifier = {
						factor = 1.25
						practical_age < 20
					}

					mult_modifier = {
						factor = 0.75
						practical_age >= 30
					}

					mult_modifier = {
						factor = 0.75
						practical_age >= 35
					}

					mult_modifier = {
						factor = 0.75
						practical_age >= 40
					}

					mult_modifier = {
						factor = 1.5
						is_strong_trigger = yes
					}

					mult_modifier = {
						factor = 0.75
						is_weak_trigger = yes
					}
				}

				30 = {
					trigger= {
						NOR = {
							trait = infertile
							has_character_modifier = barren
						}
					}

					# Temporary infertility
					add_character_modifier = {
						name = infertile
						years = 5
						hidden = yes
					}
				}

				15 = {
					trigger = {
						NOR = {
							trait = infertile
							has_character_modifier = barren
						}
					}

					add_trait = infertile
				}

				5 = {
					trigger = {
						NOT = {has_character_modifier = barren }
					}

					if = {
						limit = { trait = infertile }
						remove_trait = infertile
					}

					set_character_flag = is_barren

					add_character_modifier = {
						name = barren
						duration = -1
						hidden = yes
					}
				}
			}
		}
	}
}

# Mother troubled after giving birth
character_event = {
	id = 316
	picture = GFX_evt_illness

	desc = {
		text = EVTDESCA316
		trigger = { trait = troubled_pregnancy }
	}
	desc = {
		text = EVTDESCB316
		trigger = {
			NOT = { trait = troubled_pregnancy }
		}
	}

	is_triggered_only = yes

	trigger = {
		immortal = no
	}

	option = {
		name = EVTOPTA315

		if = {
			limit = { NOT = { trait = troubled_pregnancy } }

			set_character_flag = troubled_pregnancy_relapse # Determines different desc for spouse
			add_trait = troubled_pregnancy
		}

		if = {
			limit = { is_married = yes }

			spouse = {
				character_event = { id = HFP.20552 }
			}
		}

		random_list = {
			10 = {
				mult_modifier = {
					factor = 0.7
					persistent_event_target:pregnancy_mother_physician_per = { learning < 5 }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_mother_physician_per = { learning < 10 }
				}

				mult_modifier = {
					factor = 0.9
					persistent_event_target:pregnancy_mother_physician_per = { trait = slow }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_mother_physician_per = { trait = imbecile }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_mother_physician_per = { trait = scholar }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_mother_physician_per = { trait = physician }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_mother_physician_per = { trait = quick }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_mother_physician_per = { trait = genius }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_mother_physician_per = { learning >= 10 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_mother_physician_per = { learning >= 15 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_mother_physician_per = { learning >= 20 }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_mother_physician_per = { learning >= 25 }
				}

				mult_modifier = {
					factor = 0.7
					persistent_event_target:pregnancy_spouse_physician_per = { learning < 5 }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_spouse_physician_per = { learning < 10 }
				}

				mult_modifier = {
					factor = 0.9
					persistent_event_target:pregnancy_spouse_physician_per = { trait = slow }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_spouse_physician_per = { trait = imbecile }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_spouse_physician_per = { trait = scholar }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_spouse_physician_per = { trait = physician }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_spouse_physician_per = { trait = quick }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_spouse_physician_per = { trait = genius }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_spouse_physician_per = { learning >= 10 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_spouse_physician_per = { learning >= 15 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_spouse_physician_per = { learning >= 20 }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_spouse_physician_per = { learning >= 25 }
				}

				mult_modifier = {
					factor = 0.7
					persistent_event_target:pregnancy_regent_physician_per = { learning < 5 }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_regent_physician_per = { learning < 10 }
				}

				mult_modifier = {
					factor = 0.9
					persistent_event_target:pregnancy_regent_physician_per = { trait = slow }
				}

				mult_modifier = {
					factor = 0.8
					persistent_event_target:pregnancy_regent_physician_per = { trait = imbecile }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_regent_physician_per = { trait = scholar }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_regent_physician_per = { trait = physician }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_regent_physician_per = { trait = quick }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_regent_physician_per = { trait = genius }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_regent_physician_per = { learning >= 10 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_regent_physician_per = { learning >= 15 }
				}

				mult_modifier = {
					factor = 1.25
					persistent_event_target:pregnancy_regent_physician_per = { learning >= 20 }
				}

				mult_modifier = {
					factor = 1.5
					persistent_event_target:pregnancy_regent_physician_per = { learning >= 25 }
				}

				character_event = { id = HFP.20544 days = 12 random = 5 } # recovers completely
			}

			30 = { character_event = { id = HFP.20541 days = 12 random = 5 } } # fever
			15 = { character_event = { id = HFP.20542 days = 12 random = 5 } } # hair loss
			20 = { character_event = { id = HFP.20543 days = 12 random = 5 } } # blood
			20 = { character_event = { id = HFP.20545 days = 12 random = 5 } } # recovers weakened
			2 = { character_event = { id = HFP.20546 days = 12 random = 5 } } # remains infirm
			3 = { character_event = { id = HFP.20547 days = 12 random = 5 } } # DEATH
		}
	}
}

# On-action event: A bastard child is born, but is not recognized as such by the spouse of the mother
character_event = {
	id = 318

	is_triggered_only = yes # on_birth
	hide_window = yes

	trigger = {
		real_father = {
			is_alive = yes

			ROOT = {
				father = {
					NOT = { character = PREVPREV }
				}
			}
		}
	}

	immediate = {
		real_father = {
			character_event = { id = 319 } # The real father is notified
		}
	}
}

# FROM is bastard baby
character_event = {
	id = 319
	desc = EVTDESC319
	picture = GFX_evt_birth
	border = GFX_event_normal_frame_intrigue

	is_triggered_only = yes

	option = {
		name = EVTOPTA319

		piety = -1

		# Just to get the portraits
		FROM = {
			show_portrait = yes

			father = {
				show_portrait = yes
			}
		}
	}
}

# On-action event: A satanic orgy child is born. Hidden utility event.
# CleanSlate: Event 335 renumbered to MNM.20005 and moved to mnm_devil_worshipers_events.txt

# Bastard child is born to mother who is married matrilineally
# TODO: Move to Plus events file
character_event = {
	id = Plus.425
	desc = EVTDESC_Plus_425
	picture = GFX_evt_birth

	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_425

		FROM = {
			show_scope_change = no

			character_event = {
				id = 306 # The child gets the mother's dynasty, but is not legitimized
				tooltip = EVTTOOLTIP_PLUS_425
			}
		}

		spouse = {
			show_scope_change = no

			character_event = {
				id = 304 # The mother's husband is pissed off
				tooltip = EVTTOOLTIP304
			}
		}

		consort = {
			show_scope_change = no

			character_event = {
				id = 304 # The mother's lord is pissed off
				tooltip = EVTTOOLTIP304
			}
		}
	}
}