code:
#Events for pregnancy on actions

namespace = pregnancy

# This event is always called on pregnancy start. Determines if the pregnancy will continue smoothly, if it will continue with complications, or be terminated prematurely.
#If either the birth goes smoothly, the mother grows sick, or the child grows sick, it will trigger the ordinary birth event (birth.0001). Otherwise a custom event will be triggered.

# by Linnéa Thimrén
pregnancy.0001 = {
	hidden = yes
	trigger = {
		carn_should_suppress_on_pregnancy_maintenance_trigger = no
		carn_has_absolute_birth_control_trigger = no
	}
	immediate = {
		#PREGNANCY COMPLICATION CALCULATIONS & FLAG-SETTING
		random_list = {
			200 = { #All goes smoothly!
				#Less likely if health is bad
				modifier = {
					health <= fine_health
					add = -10
				}
				modifier = {
					health <= poor_health
					add = -15
				}

				#More kids means less risk of complications!
				modifier = {
					add = 5
					any_child = {
						even_if_dead = yes
						count >= 2
					}
				}
				modifier = {
					add = 5
					any_child = {
						even_if_dead = yes
						count >= 4
					}
				}

				#More likely if you have sacred childbirth
				modifier = {
					factor = 2 # Religious doctrine focusing on providing a sanitary birthing chamber and supplies should have a substantial impact on birth complications.
					faith = {
						has_doctrine_parameter = safer_childbirths_active
					}
				}
				#More likely if the Dynasty has the Kin legacy
				modifier = {
					factor = 1.5 # So too should constant care of pregnant/birthing mothers.
					has_dynasty = yes
					dynasty = {
						has_dynasty_perk = kin_legacy_3
					}
				}

				add_character_flag = {
					flag = birth_will_go_smoothly
					days = 270
				}
			}
			10 = { #Pregnancy ends prematurely
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				trigger_event = {
					id = pregnancy.2101
					days = { 80 120 }
				}
			}
			3 = { #Child dies during delivery (this triggers when the birth "should" have gone down, since we don't want to create the baby)
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				trigger_event = {
					id = birth.3001
					days = { 180 200 }
				}
			}
			2 = { #Mother dies
				modifier = { #to keep players from dying excessively
					add = -2
					is_ai = no
				}
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_mother_will_die
					days = 270
				}
			}
			2 = { #Mother and child dies (this triggers when the birth "should" have gone down, since we don't want to create the baby)
				modifier = { #to keep players from dying excessively
					add = -2
					is_ai = no
				}
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				trigger_event = {
					id = birth.3021
					days = { 180 200 }
				}
			}
			10 = { #Sickly child (all other events happen as usual)
				modifier = {
					factor = 0.5 # Religious doctrine focusing on providing a sanitary birthing chamber and supplies should have a substantial impact on birth complications.
					faith = {
						has_doctrine_parameter = healthier_children_active
					}
				}
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_child_will_become_sickly
					days = 270
				}
			}
			5 = { #Ill mother (all other events happen as usual)
				modifier = { #to keep players from dying excessively
					add = -4
					is_ai = no
				}
				modifier = { # Carnalitas game rule
					factor = 0
					carn_should_have_no_pregnancy_complications_trigger = yes
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_mother_will_become_ill
					days = 270
				}
			}
		}
	}
}

#####################################
# Ordinary "I'm pregnant" events!
####################################

# for the mother
pregnancy.1001 = {
	title = pregnancy.1001.t
	desc = pregnancy.1001.d
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = war_over_tie
	}
	right_portrait = {
		character = scope:real_father
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = root } }
			animation = stress
		}
		animation = happiness
	}

	trigger = {
		NOT = { has_variable = borte_first_child_var }
		carn_any_consort_or_slave_or_slave_owner_is_character_trigger = {
			CHARACTER = scope:real_father
		}
		carn_should_suppress_on_pregnancy_notification_trigger = no
		carn_has_absolute_birth_control_trigger = no
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		add_trait = pregnant
		scope:real_father = {
			if = {
				limit = {
					NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				}
			}
			pregnancy_spouse_suspicion_chance_effect = yes
		}
	}

	option = {
		name = pregnancy.1001.a
	}
}

#for the father if it's the first child or the first dynastic heir (assumed biological father)
pregnancy.1002 = {
	title = pregnancy.1002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = character:125501 # You are Temüjin
					scope:mother = { has_variable = borte_first_child_var }
				}
				desc = pregnancy.1002.d.borte
			}
			desc = pregnancy.1002.d
		}
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = scope:mother
		triggered_animation = {
			trigger = {
				scope:mother = { has_variable = borte_first_child_var }
			}
			animation = worry
		}
		animation = love
	}
	right_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
					AND = {
						scope:mother = { has_variable = borte_first_child_var }
						this = character:125501
					}
				}
			}
			animation = stress
		}
		animation = happiness
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
	}

	option = {
		name = {
			trigger = {
				scope:mother = { has_variable = borte_first_child_var }
			}
			text = pregnancy.1002.a.borte
		}
		name = {
			trigger = {
				NOT = {
					scope:mother = { has_variable = borte_first_child_var }
				}
			}
			text = pregnancy.1002.a
		}
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

scripted_trigger former_consort_was_father = {
	OR = {
		any_former_spouse = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
		any_former_concubinist = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
		any_former_concubine = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
	}
}

# Pregnant with late husband or ex-husband's child
# by Sean Hughes
pregnancy.1101 = {
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:ex_spouse = {
						is_alive = no
					}
				}
				desc = pregnancy.1101.t.dead
			}
			desc = pregnancy.1101.t.divorced
		}
	}
	desc = {
		desc = pregnancy.1101.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:ex_spouse = {
						is_alive = no
					}
				}
				desc = pregnancy.1101.desc.dead
			}
			desc = pregnancy.1101.desc.divorced

		}
		desc = pregnancy.1101.desc.end
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
	}
	right_portrait = scope:ex_spouse

	trigger = {
		# Event is only valid if our former spouse (dead or divorced) is both the real and assumed father (e.g., it was a legitimate pregnancy when the child was conceived).
		OR = {
			former_consort_was_father = yes
			carn_real_father_is_former_slave_or_slave_owner_trigger = yes
		}
		carn_should_suppress_on_pregnancy_notification_trigger = no
		carn_has_absolute_birth_control_trigger = no
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		add_trait = pregnant
		scope:father = {
			save_scope_as = ex_spouse
		}
	}

	option = {
		name = {
			trigger = {
				scope:ex_spouse = {
					is_alive = yes
				}
			}
			text = pregnancy.1101.a.divorced
		}
		name = {
			trigger = {
				scope:ex_spouse = {
					is_alive = no
				}
			}
			text = pregnancy.1101.a.dead
		}

		# Notify spouses about the pregnancy.
		every_spouse = {
			trigger_event = pregnancy.1102
		}
		# Notify the father if alive.
		scope:ex_spouse = {
			if = {
				limit = {
					is_alive = yes
				}
				trigger_event = pregnancy.1103
			}
		}
	}
}

# For the mother's husband (not father) to explain why their spouse is pregnant and that it is okay.
pregnancy.1102 = {
	title = pregnancy.1102.t
	desc = pregnancy.1102.desc
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = scope:mother
	}
	right_portrait = {
		character = scope:ex_spouse
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:mother } }
			animation = stress
		}
		animation = happiness
	}

	option = {
		name = pregnancy.1102.a
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

# For the father, explaining that their ex-wife will bear them a new child soon.
pregnancy.1103 = {
	type = letter_event
	opening = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					OR = {
						any_former_concubine = { this = scope:mother }
						any_former_concubinist = { this = scope:mother }
						scope:mother = {
							carn_real_father_is_former_slave_or_slave_owner_trigger = yes
						}
					}
			    }
			    desc = pregnancy.1103.opening_concubine
			}
			desc = pregnancy.1103.opening
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					OR = {
						any_former_concubine = { this = scope:mother }
						any_former_concubinist = { this = scope:mother }
						scope:mother = {
							carn_real_father_is_former_slave_or_slave_owner_trigger = yes
						}
					}
			    }
			    desc = pregnancy.1103.desc_concubine
			}
			desc = pregnancy.1103.desc
		}
	}
	sender = scope:mother

	option = {
		name = pregnancy.1103.a
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

###########################
# Bastard pregnancies
###########################

#Unmarried mother pregnant with child
pregnancy.2001 = {
	title = pregnancy.2001.t
	desc = {
		desc = pregnancy.2001.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:real_father = { is_married = yes }
				}
				desc = pregnancy.2001.father_is_married
			}
			desc = pregnancy.2001.father_is_unmarried
		}
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
	}
	right_portrait = {
		character = scope:real_father
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:mother } }
			animation = stress
		}
		animation = happiness
	}

	trigger = {
		is_pregnant = yes # Fix to prevent pipeline failures on account of set_num_pregnancy_children being used on an unpregnant character
		NOR = {
			# If we are married or have concubines (or are a concubine) this event is not valid, as there is a (assumed) father.
			any_consort = {
				count > 0
			}
			# Same for if a former spouse/concubine got us pregant.
			OR = {
				former_consort_was_father = yes
				carn_real_father_is_former_slave_or_slave_owner_trigger = yes
			}
			# Carnalitas: slave daddies are ok.
			carn_any_consort_or_slave_or_slave_owner_is_character_trigger = {
				CHARACTER = scope:real_father
			}
		}
		carn_should_suppress_on_pregnancy_notification_trigger = no
		carn_has_absolute_birth_control_trigger = no
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		hidden_effect = {
			set_num_pregnancy_children = 1
			add_character_flag = {
				flag = unmarried_bastard_pregnancy
				months = 9
			}
		}
		unmarried_mother_pregnancy_effect = yes
	}

	option = { #Publicly name the father!
		name = pregnancy.2001.a
		bastardy_pregnancy_announcement_effect = yes
		hidden_effect = {
			expose_lover_secret_or_run_consequence_effect = {
				TARGET = scope:real_father
				EXPOSER = scope:mother
			}
		}
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_honor = 0.5
				ai_boldness = 0.5
				ai_compassion = 0.25
			}
			compare_modifier = {
				value = ai_vengefulness
				trigger = {
					opinion = {
						target = scope:real_father
						value < 0
					}
					ai_vengefulness > 0
				}
			}
		}
	}

	option = { #Only tell the real_father
		name = pregnancy.2001.b
		trigger = {
			scope:real_father = { is_alive = yes }
		}
		hidden_effect = {
			add_character_flag = { #Add flag to determine what should happen in adultery.1101
				flag = planning_to_confess_to_real_father
				days = 22
			}
		}
		if = {
			limit = {
				any_owned_story = {
					story_type = story_peasant_affair
					var:peasant_character = {
						this = scope:real_father
					}
				}
			}
			add_character_flag = is_looking_for_peasant #To take the story_peasant_affair to the next step
			add_character_flag = peasant_affair_already_looking
			custom_tooltip = search_for_real_father_tt
		}
		else = {
			custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_compassion = 1
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Keep it secret!
		name = pregnancy.2001.c
		flavor = pregnancy.2001.c.tt
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Attempt to terminate the pregnancy
		name = pregnancy.2001.d
		pregnancy_termination_attempt_effect = yes
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}
}

#Married woman pregnant with a bastard child
pregnancy.2002 = {
	type = character_event
	title = pregnancy.2002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				desc = pregnancy.2002.desc.polyamorous
			}
			desc = pregnancy.2002.desc
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = scope:father
	lower_center_portrait = scope:real_father

	trigger = {
		# If we are married and/or have concubines, but the real father is not one of them, it's a bastard!
		any_consort = {
			carn_gender_can_impregnate_trigger = yes
		}
		pregnancy_real_father = {
			NOT = {	is_consort_of = root }
		}

		# OBJECTION! If a former spouse/concubine is both the real and assumed father, it's not actually a bastard!
		NOR = {
			OR = {
				former_consort_was_father = yes
				carn_real_father_is_former_slave_or_slave_owner_trigger = yes
			}
			# Carnalitas: slave daddies are ok.
			carn_any_consort_or_slave_or_slave_owner_is_character_trigger = {
				CHARACTER = scope:real_father
			}
		}

		carn_should_suppress_on_pregnancy_notification_trigger = no
		carn_has_absolute_birth_control_trigger = no
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		# If we got pregnant before our marriage, there will be no assumed father set. However, we need one for the event logic to work correctly.
		# Since this is a pretty rare edge case, we just go ahead and set the assumed father to a current living spouse.
		if = {
			limit = {
				NOT = { exists = pregnancy_assumed_father }
			}
			random_consort = {
				save_scope_as = assumed_father
			}
			hidden_effect = {
				set_pregnancy_assumed_father = scope:assumed_father
			}
		}

		save_scope_as = mother
		hidden_effect = {
			set_num_pregnancy_children = 1
			if = {
				limit = {
					exists = primary_partner
				}
				primary_partner = {
					save_scope_as = spouse
				}
			}
			else = {
				random_consort = {
					save_scope_as = spouse
				}
			}
			add_character_flag = {
				flag = bastard_pregnancy
				months = 9
			}
		}
	}

	option = { #Confess
		name = {
			trigger = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			text = pregnancy.2002.a
		}
		name = {
			trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
			text = pregnancy.2001.a
		}
		married_mother_pregnancy_effect = yes
		add_fornicator_trait_or_nothing_effect = yes
		bastardy_pregnancy_announcement_effect = yes
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:real_father
			EXPOSER = scope:mother
		}
		ai_chance = {
			base = 0
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				add = 100
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Tell the real father
		name = pregnancy.2002.b
		trigger = {
			NOT = {
				exists = primary_partner
			}
		}
		if = {
			limit = {
				any_owned_story = {
					story_type = story_peasant_affair
					var:peasant_character = {
						this = scope:real_father
					}
				}
			}
			add_character_flag = is_looking_for_peasant #To take the story_peasant_affair to the next step
			add_character_flag = peasant_affair_already_looking
			custom_tooltip = search_for_real_father_tt
		}
		else = {
			custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		}
		add_character_flag = { #Add flag to determine what should happen in adultery.1101
			flag = planning_to_confess_to_real_father
			days = 22
		}
		married_mother_pregnancy_effect = yes
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_compassion = 1
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
		}
	}

	option = { #Keep it secret!
		name = pregnancy.2002.c
		custom_tooltip = pregnancy.2002.c.tt
		married_mother_pregnancy_effect = yes
		stress_impact = {
			honest = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Attempt to get rid of the child
		name = pregnancy.2002.d
		pregnancy_termination_attempt_effect = yes

		ai_chance = {
			base = 0
		}
	}
}

################
# Attempted Termination Chain
# 2003 - 2007
###############
#Successful attempt, no side effects
pregnancy.2003 = {
	type = character_event
	title = pregnancy.2003.t
	desc = {
		random_valid = {
			desc = pregnancy.2003.desc_no_notice
			desc = pregnancy.2003.desc_pain
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = happiness
	}

	immediate = {
		end_pregnancy = yes
		pregnancy_cleanup_effect = yes
	}

	option = { #It is for the best
		name = pregnancy.2003.a
	}
}

#Successful attempt, fall ill
pregnancy.2004 = {
	type = character_event
	title = pregnancy.2004.t
	desc = pregnancy.2004.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	immediate = {
		end_pregnancy = yes
		add_trait_force_tooltip = ill
		pregnancy_cleanup_effect = yes
	}

	option = { #It was what had to be done
		name = pregnancy.2004.a
	}
}

#Failed attempt, no side effects
pregnancy.2005 = {
	type = character_event
	title = pregnancy.2005.t
	desc = pregnancy.2005.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = sadness
	}

	immediate = {
		if = {
			limit = {
				is_married = no
			}
			#unmarried_mother_pregnancy_effect = yes
		}
		else = {
			married_mother_pregnancy_effect = yes
		}
	}

	option = { #I had to try
		name = pregnancy.2005.a
	}
}

#Die
pregnancy.2007 = {
	type = character_event
	title = pregnancy.2007.t
	desc = pregnancy.2007.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_murder"
	}

	option = { #It was what had to be done
		name = pregnancy.2007.a
		death = {
			death_reason = death_attempted_treatment
		}
	}
}

################
# Same-sex
# 250 - 2059
###############

# Pregnant while all mother's consorts are women
# by Linnéa Thimrén
pregnancy.2050 = {
	title = pregnancy.2050.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				desc = pregnancy.2050.desc.polyamorous
			}
			desc = pregnancy.2050.desc
		}
	}
	theme = pregnancy
	left_portrait = scope:real_father
	right_portrait = scope:spouse

	trigger = {
		# If we are married and/or have concubines, but all of them are women as well, it's a bastard!
		any_consort = {
			NOT = { carn_gender_can_impregnate_trigger = yes }
		}
		pregnancy_real_father = {
			NOT = {	is_consort_of = root }
		}

		# OBJECTION! If a former spouse/concubine is both the real and assumed father, it's not actually a bastard!
		NOT = {
			former_consort_was_father = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"

		save_scope_as = mother
		hidden_effect = {
			set_num_pregnancy_children = 1
			if = {
				limit = {
					exists = primary_partner
				}
				primary_partner = {
					save_scope_as = spouse
				}
			}
			else = {
				random_consort = {
					save_scope_as = spouse
				}
			}
			add_character_flag = {
				flag = bastard_pregnancy
				months = 9
			}
		}

		# People will know you've been unfaithful, obviously
		add_fornicator_trait_or_nothing_effect = yes
	}

	option = { #Confess (for now this is the only option since you cannot deny that you've slept with someone else)
		name = {
			trigger = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			text = pregnancy.2002.a
		}
		name = {
			trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
			text = pregnancy.2001.a
		}
		married_mother_pregnancy_effect = yes
		bastardy_pregnancy_announcement_effect = yes
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:real_father
			EXPOSER = scope:mother
		}
		ai_chance = {
			base = 100
		}
	}
}

####################
# Pregnancy ended prematurely (naturally)
# by Linnéa Thimrén
###################
pregnancy.2101 = {
	type = character_event
	title = pregnancy.2101.t
	desc = {
		random_valid = {
			first_valid = {
				triggered_desc = {
					trigger = {
						any_child = {
							even_if_dead = yes
							count >= 1
						}
					}
					desc = pregnancy.2101.desc_other_children
				}
				desc = pregnancy.2101.desc_pain
			}
			desc = pregnancy.2101.desc
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	trigger = {
		is_pregnant = yes
	}

	immediate = {
		if = {
			limit = {
				exists = primary_partner
			}
			primary_partner = {
				save_scope_as = spouse
			}
		}
		create_character_memory = {
			type = child_premature
			participants = { mother = root }
		}
		hidden_effect = {
			end_pregnancy = yes
			pregnancy_cleanup_effect = yes
		}
	}

	option = {
		name = pregnancy.2101.a

		#To tell spouse
		if = {
			limit = {
				exists = scope:spouse
			}
			scope:spouse = { trigger_event = pregnancy.2102 }
		}

		#To tell real_father if they're not your spouse and they know of the pregnancy
		if = {
			limit = {
				exists = scope:spouse
				NOT = {
					scope:spouse = scope:real_father
					has_character_flag = pregnancy_real_father_knows
				}
			}
			scope:real_father = { trigger_event = pregnancy.2102 }
		}
	}
}

#Pregnancy ended prematurely - for father
pregnancy.2102 = {
	type = character_event
	title = pregnancy.2101.t
	desc = pregnancy.2102.desc
	theme = pregnancy
	right_portrait = {
		character = scope:mother
		animation = personality_cynical
	}

	immediate = {
		create_character_memory = {
			type = child_premature
			participants = { mother = scope:mother }
		}
	}

	option = {
		name = pregnancy.2102.a
	}
}

###############
#3000: Events for the real father
######################

#real_father suspects they are the father
#Can be triggered if the mother tries to keep fatherhood hidden from real_father in pregnancy.2002 or 2003
pregnancy.3001 = {
	type = character_event
	title = pregnancy.3001.t
	desc = {
		desc = pregnancy.3001.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:mother = { any_relation = { type = lover this = root } }
					has_opinion_modifier = {
						modifier = love_opinion
						target = scope:mother
					}
				}
				desc = pregnancy.3001.lovers_love
			}
			triggered_desc = {
				trigger = {
					scope:mother = { any_relation = { type = lover this = root } }
				}
				desc = pregnancy.3001.lovers_not_love
			}
			desc = pregnancy.3001.not_lovers
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
			NOR = {
				any_owned_story = {
					exists = var:peasant_character
					var:peasant_character = { this = root }
				}
				has_character_flag = pregnancy_real_father_knows
			}
		}

		#Safety block for spouses that are also lovers, since this event is for bastard fathers
		NOT = { is_consort_of = scope:mother }
	}

	option = { #I must confront her about it!
		name = pregnancy.3001.a
		custom_tooltip = pregnancy.3001.a.tt
		hidden_effect = {
			save_scope_as = real_father_inquirer
			scope:mother = {
				trigger_event = {
					id = pregnancy.5001
					days = { 3 5 }
				}
			}
		}
	}

	option = { #Could it be...
		name = pregnancy.3001.b
		custom_tooltip = pregnancy.3001.b.tt
	}
}

#Mother chooses to tell the real father in pregnancy.2002
pregnancy.3002 = {
	type = character_event
	title = pregnancy.3002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { any_relation = { type = lover this = scope:mother }}
				desc = pregnancy.3002.lovers
			}
			desc = pregnancy.3002.not_lovers
		}
		triggered_desc = {
			trigger = { exists = scope:spouse }
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
	}

	option = { #What will become of the child
		name = pregnancy.3002.a
		trigger = {
			has_opinion_modifier = {
				modifier = love_opinion
				target = scope:mother
			}
		}
		exclusive = yes
		custom_tooltip = pregnancy.3002.a.tt
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
	}

	option = { #What will become of the child
		name = {
			trigger = {
				OR = {
					any_child = {
						OR = {
							has_trait = bastard
							has_trait = legitimized_bastard
							has_trait = wild_oat
						}
					}
					any_known_secret = {
						OR = {
							secret_type = secret_disputed_heritage
							secret_type = secret_unmarried_illegitimate_child
						}
						exists = secret_target
						exists = secret_target.real_father
						secret_target = {
							real_father = root
						}
					}
				}
			}
			text = pregnancy.3002.b.not_again
		}
		name = {
			text = pregnancy.3002.b
		}
		custom_tooltip = pregnancy.3002.a.tt
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
	}

	option = { #The whole world must know the truth
		name = pregnancy.3002.c
		trigger = {
			is_married = no
		}
		save_scope_value_as = {
			name = real_father_revealing
			value = yes
		}
		bastardy_pregnancy_announcement_effect = yes
	}
}

#Unmarried mother comes to unmarried father
pregnancy.3003 = {
	type = character_event
	title = pregnancy.3003.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					faith = {
						has_doctrine_parameter = bastards_none
					}
				}
				desc = pregnancy.3003.desc_no_bastards
			}
			desc = pregnancy.3003.desc
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = tutorial_reactive_advice_bastards
			}
		}
	}

	option = { #This must be kept secret!
		name = pregnancy.3003.a
		custom_tooltip = pregnancy.3003.a.tt
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}

	option = { #The whole world must know!
		name = pregnancy.3003.b
		bastardy_pregnancy_announcement_effect = yes
		ai_chance = {
			base = 25
		}
	}
}

#Unmarried mother comes to married father
pregnancy.3004 = {
	type = character_event
	title = pregnancy.3004.t
	desc = pregnancy.3004.desc
	theme = pregnancy
	left_portrait = scope:mother
	lower_right_portrait = scope:spouse

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		#The real father knows now
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
		#For portrait and desc purposes
		primary_spouse = {
			save_scope_as = spouse
		}
		show_as_tooltip = {
			scope:mother = { add_trait_force_tooltip = pregnant }
		}
	}

	option = { #This must be kept secret!
		name = pregnancy.3004.a
	}
}

#5000: Follow-ups
#The child's real_father suspects, confronts mother about it.
#Fired by the real_father choosing to press the mother in pregnancy.3001
pregnancy.5001 = {
	type = character_event
	title = pregnancy.5001.t
	desc = {
		desc = pregnancy.5001.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:real_father = scope:real_father_inquirer }
				desc = pregnancy.5001.real_father
			}
			desc = pregnancy.5001.not_father
		}
	}
	theme = pregnancy
	left_portrait = {
		character = scope:real_father_inquirer
		animation = worry
	}
	right_portrait = {
		trigger = {
			NOT = { scope:spouse = scope:real_father_inquirer }
		}
		character = scope:spouse
	}

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	option = { #It is true!
		name = pregnancy.5001.a
		trigger = {
			scope:real_father_inquirer = scope:real_father
		}
		custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		ai_chance = {
			base = 100
		}
		scope:real_father = {
			trigger_event = {
				id = pregnancy.5002 #The truth is revealed to them
				days = { 3 5 }
			}
		}
	}

	option = { #Insist real_father is wrong
		name = pregnancy.5001.b
		trigger = { NOT = { scope:real_father_inquirer = scope:real_father } }
		fallback = yes # Only show if they are not the father
		ai_chance = {
			base = 100
		}
		scope:real_father = {
			trigger_event = {
				id = pregnancy.5003 #Denial
				days = { 3 5 }
			}
		}
	}
}

#Mother confesses that root is the real_father, sharing the secret with them
pregnancy.5002 = {
	type = character_event
	title = pregnancy.5002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_opinion_modifier = {
						modifier = love_opinion
						target = scope:mother
					}
				}
				desc = pregnancy.5002.love
			}
			desc = pregnancy.5002.not_love
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		hidden_effect = {
			scope:mother = {
				add_character_flag = {
					flag = pregnancy_real_father_knows
					months = 9
				}
			}
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = tutorial_reactive_advice_bastards
			}
		}
	}

	option = { #Ah, what will become of our child?
		name = pregnancy.5002.a
		custom_tooltip = pregnancy.3003.a.tt
	}

	option = {
		name = pregnancy.5002.b
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:mother
			EXPOSER = root
		}
		bastardy_pregnancy_announcement_effect = yes
	}
}

#Mother keeps insisting the child is not root's
pregnancy.5003 = {
	type = character_event
	title = pregnancy.5003.t
	desc = pregnancy.5003.desc
	theme = pregnancy
	left_portrait = {
		character = scope:mother
		animation = personality_callous
	}

	option = { #Are they really telling the truth?
		name = pregnancy.5003.a
	}
}

########################
# Someone publicly announces the child is theirs
# 6000
########################

### 6000 - 6099: Mother announces
#Mother announces the child - and the real father
pregnancy.6001 = {
	type = character_event
	title = pregnancy.6001.t
	desc = pregnancy.6001.desc
	theme = pregnancy
	left_portrait = {
		character = scope:mother
		animation = personality_callous
	}
	right_portrait = scope:real_father

	option = {
		name = pregnancy.6001.a
		custom_tooltip = pregnancy_announcement_my_child_will_be_a_bastard
	}
}

#Mother announces child father - event for real father
pregnancy.6002 = {
	type = character_event
	title = pregnancy.6002.t
	desc = {
		desc = pregnancy.6002.desc
		triggered_desc = {
			trigger = {
				exists = scope:spouse
				scope:spouse = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			}
			desc = pregnancy.6002.married
		}
		triggered_desc = {
			trigger = {
				is_married = no
				opinion = {
					target = scope:mother
					value <= 0
				}
			}
			desc = pregnancy.6002.unmarried_unsympathetic
		}
		triggered_desc = {
			trigger = {
				is_married = no
				opinion = {
					target = scope:mother
					value > 0
				}
			}
			desc = pregnancy.6002.unmarried_sympathetic
		}
	}

	theme = pregnancy
	left_portrait = scope:mother
	right_portrait = {
		character = scope:spouse
		animation = disapproval
	}

	immediate = {
		if = {
			limit = {
				exists = primary_partner
				primary_partner = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			}
			primary_partner = {
				save_scope_as = spouse
			}
		}
		else = {
			random_consort = {
				limit = {
					NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				}
				save_scope_as = spouse
			}
		}
	}

	option = {
		name = pregnancy.6002.a
		trigger = { is_married = no }
	}

	after = {
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard_real_father
	}
}

#Mother announces child father - event for spouse of mother
pregnancy.6003 = {
	type = character_event
	title = pregnancy.6003.t
	desc = pregnancy.6003.desc
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pregnancy.6003.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for family of mother
pregnancy.6004 = {
	type = character_event
	title = pregnancy.6004.t
	desc = {
		desc = pregnancy.6004.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:mother = {
						is_close_family_trigger = {
							CHARACTER = scope:real_father
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = root.faith GENDER_CHARACTER = scope:mother }
				}
				desc = pregnancy.6004.incest
			}
			triggered_desc = {
				trigger = {
					exists = scope:spouse
				}
				desc = pregnancy.6004.mother_married
			}
			desc = pregnancy.6004.mother_unmarried
		}
	}
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father

	immediate = {
		play_music_cue = "mx_cue_prison"
		scope:mother = {
			if = {
				limit = { exists = primary_partner }
				primary_partner = {
					save_scope_as = spouse
				}
			}
		}
	}

	option = {
		name = pregnancy.6004.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for spouse of real_father
pregnancy.6005 = {
	type = character_event
	title = pregnancy.6005.t
	desc = pregnancy.6005.desc
	theme = pregnancy
	left_portrait = scope:real_father
	right_portrait = scope:mother

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pregnancy.6005.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for family of real_father
pregnancy.6006 = {
	type = character_event
	title = pregnancy.6006.t
	desc = {
		desc = pregnancy.6006.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:spouse
				}
				desc = pregnancy.6006.real_father_married
			}
			desc = pregnancy.6006.real_father_unmarried
		}
	}
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father
	lower_center_portrait = scope:spouse
	override_background = {
		reference = dungeon
		trigger = {
			scope:mother = { is_imprisoned = yes }
		}
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
		scope:real_father = {
			if = {
				limit = { exists = primary_partner }
				primary_partner = {
					save_scope_as = spouse
				}
			}
		}
	}

	option = {
		name = pregnancy.6006.a
	}
}

#Mother announces child father - event for real_father
pregnancy.6999 = {
	type = character_event
	title = pregnancy.6999.t
	desc = pregnancy.6999.desc
	theme = pregnancy
	left_portrait = scope:mother
	right_portrait = scope:real_father

	option = {
		name = pregnancy.6999.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}


code:
#Events for pregnancy on actions

namespace = pregnancy

# This event is always called on pregnancy start. Determines if the pregnancy will continue smoothly, if it will continue with complications, or be terminated prematurely.
#If either the birth goes smoothly, the mother grows sick, or the child grows sick, it will trigger the ordinary birth event (birth.0001). Otherwise a custom event will be triggered.

# by Linnéa Thimrén
pregnancy.0001 = {
	hidden = yes
	immediate = {
		#PREGNANCY COMPLICATION CALCULATIONS & FLAG-SETTING
		random_list = {
			200 = { #All goes smoothly!
				#Less likely if health is bad
				modifier = {
					health <= fine_health
					add = -10
				}
				modifier = {
					health <= poor_health
					add = -15
				}

				#More kids means less risk of complications!
				modifier = {
					add = 5
					any_child = {
						even_if_dead = yes
						count >= 2
					}
				}
				modifier = {
					add = 5
					any_child = {
						even_if_dead = yes
						count >= 4
					}
				}

				#More likely if you have sacred childbirth
				modifier = {
					factor = 2 # Religious doctrine focusing on providing a sanitary birthing chamber and supplies should have a substantial impact on birth complications.
					faith = {
						has_doctrine_parameter = safer_childbirths_active
					}
				}
				#More likely if the Dynasty has the Kin legacy
				modifier = {
					factor = 1.5 # So too should constant care of pregnant/birthing mothers.
					has_dynasty = yes
					dynasty = {
						has_dynasty_perk = kin_legacy_3
					}
				}

				add_character_flag = {
					flag = birth_will_go_smoothly
					days = 270
				}
			}
			10 = { #Pregnancy ends prematurely
				trigger_event = {
					id = pregnancy.2101
					days = { 80 120 }
				}
			}
			3 = { #Child dies during delivery (this triggers when the birth "should" have gone down, since we don't want to create the baby)
				trigger_event = {
					id = birth.3001
					days = { 180 200 }
				}
			}
			2 = { #Mother dies
				modifier = { #to keep players from dying excessively
					add = -2
					is_ai = no
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_mother_will_die
					days = 270
				}
			}
			2 = { #Mother and child dies (this triggers when the birth "should" have gone down, since we don't want to create the baby)
				modifier = { #to keep players from dying excessively
					add = -2
					is_ai = no
				}
				trigger_event = {
					id = birth.3021
					days = { 180 200 }
				}
			}
			10 = { #Sickly child (all other events happen as usual)
				modifier = {
					factor = 0.5 # Religious doctrine focusing on providing a sanitary birthing chamber and supplies should have a substantial impact on birth complications.
					faith = {
						has_doctrine_parameter = healthier_children_active
					}
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_child_will_become_sickly
					days = 270
				}
			}
			5 = { #Ill mother (all other events happen as usual)
				modifier = { #to keep players from dying excessively
					add = -4
					is_ai = no
				}
				add_character_flag = { #Flags blocks other birth events
					flag = birth_mother_will_become_ill
					days = 270
				}
			}
		}
	}
}

#####################################
# Ordinary "I'm pregnant" events!
####################################

# for the mother
pregnancy.1001 = {
	title = pregnancy.1001.t
	desc = pregnancy.1001.d
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = war_over_tie
	}
	right_portrait = {
		character = scope:real_father
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = root } }
			animation = stress
		}
		animation = happiness
	}

	trigger = {
		NOT = { has_variable = borte_first_child_var }
		any_consort = {
			this = scope:real_father
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		add_trait = pregnant
		scope:real_father = {
			if = {
				limit = {
					NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				}
			}
			pregnancy_spouse_suspicion_chance_effect = yes
		}
	}

	option = {
		name = pregnancy.1001.a
	}
}

#for the father if it's the first child or the first dynastic heir (assumed biological father)
pregnancy.1002 = {
	title = pregnancy.1002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					this = character:125501 # You are Temüjin
					scope:mother = { has_variable = borte_first_child_var }
				}
				desc = pregnancy.1002.d.borte
			}
			desc = pregnancy.1002.d
		}
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = scope:mother
		triggered_animation = {
			trigger = {
				scope:mother = { has_variable = borte_first_child_var }
			}
			animation = worry
		}
		animation = love
	}
	right_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_any_bad_relationship_with_character_trigger = { CHARACTER = root }
					AND = {
						scope:mother = { has_variable = borte_first_child_var }
						this = character:125501
					}
				}
			}
			animation = stress
		}
		animation = happiness
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
	}

	option = {
		name = {
			trigger = {
				scope:mother = { has_variable = borte_first_child_var }
			}
			text = pregnancy.1002.a.borte
		}
		name = {
			trigger = {
				NOT = {
					scope:mother = { has_variable = borte_first_child_var }
				}
			}
			text = pregnancy.1002.a
		}
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

scripted_trigger former_consort_was_father = {
	OR = {
		any_former_spouse = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
		any_former_concubinist = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
		any_former_concubine = {
			even_if_dead = yes
			this = scope:father
			this = scope:real_father
			trigger_if = {
				limit = {
					is_alive = yes
				}
				NOT = { any_consort = { this = root } }
			}
		}
	}
}

# Pregnant with late husband or ex-husband's child
# by Sean Hughes
pregnancy.1101 = {
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:ex_spouse = {
						is_alive = no
					}
				}
				desc = pregnancy.1101.t.dead
			}
			desc = pregnancy.1101.t.divorced
		}
	}
	desc = {
		desc = pregnancy.1101.desc.start
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:ex_spouse = {
						is_alive = no
					}
				}
				desc = pregnancy.1101.desc.dead
			}
			desc = pregnancy.1101.desc.divorced

		}
		desc = pregnancy.1101.desc.end
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
	}
	right_portrait = scope:ex_spouse

	trigger = {
		# Event is only valid if our former spouse (dead or divorced) is both the real and assumed father (e.g., it was a legitimate pregnancy when the child was conceived).
		former_consort_was_father = yes
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		add_trait = pregnant
		scope:father = {
			save_scope_as = ex_spouse
		}
	}

	option = {
		name = {
			trigger = {
				scope:ex_spouse = {
					is_alive = yes
				}
			}
			text = pregnancy.1101.a.divorced
		}
		name = {
			trigger = {
				scope:ex_spouse = {
					is_alive = no
				}
			}
			text = pregnancy.1101.a.dead
		}

		# Notify spouses about the pregnancy.
		every_spouse = {
			trigger_event = pregnancy.1102
		}
		# Notify the father if alive.
		scope:ex_spouse = {
			if = {
				limit = {
					is_alive = yes
				}
				trigger_event = pregnancy.1103
			}
		}
	}
}

# For the mother's husband (not father) to explain why their spouse is pregnant and that it is okay.
pregnancy.1102 = {
	title = pregnancy.1102.t
	desc = pregnancy.1102.desc
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = scope:mother
	}
	right_portrait = {
		character = scope:ex_spouse
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:mother } }
			animation = stress
		}
		animation = happiness
	}

	option = {
		name = pregnancy.1102.a
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

# For the father, explaining that their ex-wife will bear them a new child soon.
pregnancy.1103 = {
	type = letter_event
	opening = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					OR = {
						any_former_concubine = { this = scope:mother }
						any_former_concubinist = { this = scope:mother }
					}
			    }
			    desc = pregnancy.1103.opening_concubine
			}
			desc = pregnancy.1103.opening
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					OR = {
						any_former_concubine = { this = scope:mother }
						any_former_concubinist = { this = scope:mother }
					}
			    }
			    desc = pregnancy.1103.desc_concubine
			}
			desc = pregnancy.1103.desc
		}
	}
	sender = scope:mother

	option = {
		name = pregnancy.1103.a
		show_as_tooltip = {
			scope:mother = {
				add_trait_force_tooltip = pregnant
			}
		}
	}
}

###########################
# Bastard pregnancies
###########################

#Unmarried mother pregnant with child
pregnancy.2001 = {
	title = pregnancy.2001.t
	desc = {
		desc = pregnancy.2001.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:real_father = { is_married = yes }
				}
				desc = pregnancy.2001.father_is_married
			}
			desc = pregnancy.2001.father_is_unmarried
		}
	}
	theme = pregnancy
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
	}
	right_portrait = {
		character = scope:real_father
		triggered_animation = {
			trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:mother } }
			animation = stress
		}
		animation = happiness
	}

	trigger = {
		is_pregnant = yes # Fix to prevent pipeline failures on account of set_num_pregnancy_children being used on an unpregnant character
		NOR = {
			# If we are married or have concubines (or are a concubine) this event is not valid, as there is a (assumed) father.
			any_consort = {
				count > 0
			}
			# Same for if a former spouse/concubine got us pregant.
			former_consort_was_father = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		hidden_effect = {
			set_num_pregnancy_children = 1
			add_character_flag = {
				flag = unmarried_bastard_pregnancy
				months = 9
			}
		}
		unmarried_mother_pregnancy_effect = yes
	}

	option = { #Publicly name the father!
		name = pregnancy.2001.a
		bastardy_pregnancy_announcement_effect = yes
		hidden_effect = {
			expose_lover_secret_or_run_consequence_effect = {
				TARGET = scope:real_father
				EXPOSER = scope:mother
			}
		}
		ai_chance = {
			base = 20
			ai_value_modifier = {
				ai_honor = 0.5
				ai_boldness = 0.5
				ai_compassion = 0.25
			}
			compare_modifier = {
				value = ai_vengefulness
				trigger = {
					opinion = {
						target = scope:real_father
						value < 0
					}
					ai_vengefulness > 0
				}
			}
		}
	}

	option = { #Only tell the real_father
		name = pregnancy.2001.b
		trigger = {
			scope:real_father = { is_alive = yes }
		}
		hidden_effect = {
			add_character_flag = { #Add flag to determine what should happen in adultery.1101
				flag = planning_to_confess_to_real_father
				days = 22
			}
		}
		if = {
			limit = {
				any_owned_story = {
					story_type = story_peasant_affair
					var:peasant_character = {
						this = scope:real_father
					}
				}
			}
			add_character_flag = is_looking_for_peasant #To take the story_peasant_affair to the next step
			add_character_flag = peasant_affair_already_looking
			custom_tooltip = search_for_real_father_tt
		}
		else = {
			custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_compassion = 1
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Keep it secret!
		name = pregnancy.2001.c
		flavor = pregnancy.2001.c.tt
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Attempt to terminate the pregnancy
		name = pregnancy.2001.d
		pregnancy_termination_attempt_effect = yes
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}
}

#Married woman pregnant with a bastard child
pregnancy.2002 = {
	type = character_event
	title = pregnancy.2002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				desc = pregnancy.2002.desc.polyamorous
			}
			desc = pregnancy.2002.desc
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = worry
	}
	right_portrait = scope:father
	lower_center_portrait = scope:real_father

	trigger = {
		# If we are married and/or have concubines, but the real father is not one of them, it's a bastard!
		any_consort = {
			is_male = yes
		}
		pregnancy_real_father = {
			NOT = {	is_consort_of = root }
		}

		# OBJECTION! If a former spouse/concubine is both the real and assumed father, it's not actually a bastard!
		NOT = {
			former_consort_was_father = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		# If we got pregnant before our marriage, there will be no assumed father set. However, we need one for the event logic to work correctly.
		# Since this is a pretty rare edge case, we just go ahead and set the assumed father to a current living spouse.
		if = {
			limit = {
				NOT = { exists = pregnancy_assumed_father }
			}
			random_consort = {
				save_scope_as = assumed_father
			}
			hidden_effect = {
				set_pregnancy_assumed_father = scope:assumed_father
			}
		}

		save_scope_as = mother
		hidden_effect = {
			set_num_pregnancy_children = 1
			if = {
				limit = {
					exists = primary_partner
				}
				primary_partner = {
					save_scope_as = spouse
				}
			}
			else = {
				random_consort = {
					save_scope_as = spouse
				}
			}
			add_character_flag = {
				flag = bastard_pregnancy
				months = 9
			}
		}
	}

	option = { #Confess
		name = {
			trigger = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			text = pregnancy.2002.a
		}
		name = {
			trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
			text = pregnancy.2001.a
		}
		married_mother_pregnancy_effect = yes
		add_fornicator_trait_or_nothing_effect = yes
		bastardy_pregnancy_announcement_effect = yes
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:real_father
			EXPOSER = scope:mother
		}
		ai_chance = {
			base = 0
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				add = 100
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Tell the real father
		name = pregnancy.2002.b
		trigger = {
			NOT = {
				exists = primary_partner
			}
		}
		if = {
			limit = {
				any_owned_story = {
					story_type = story_peasant_affair
					var:peasant_character = {
						this = scope:real_father
					}
				}
			}
			add_character_flag = is_looking_for_peasant #To take the story_peasant_affair to the next step
			add_character_flag = peasant_affair_already_looking
			custom_tooltip = search_for_real_father_tt
		}
		else = {
			custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		}
		add_character_flag = { #Add flag to determine what should happen in adultery.1101
			flag = planning_to_confess_to_real_father
			days = 22
		}
		married_mother_pregnancy_effect = yes
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_honor = 0.5
				ai_compassion = 1
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
		stress_impact = {
			honest = medium_stress_impact_gain
		}
	}

	option = { #Keep it secret!
		name = pregnancy.2002.c
		custom_tooltip = pregnancy.2002.c.tt
		married_mother_pregnancy_effect = yes
		stress_impact = {
			honest = major_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
			modifier = { # Never hide the truth in faiths with the Polyamory tenet.
				factor = 0
				faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active }
			}
		}
	}

	option = { #Attempt to get rid of the child
		name = pregnancy.2002.d
		pregnancy_termination_attempt_effect = yes

		ai_chance = {
			base = 0
		}
	}
}

################
# Attempted Termination Chain
# 2003 - 2007
###############
#Successful attempt, no side effects
pregnancy.2003 = {
	type = character_event
	title = pregnancy.2003.t
	desc = {
		random_valid = {
			desc = pregnancy.2003.desc_no_notice
			desc = pregnancy.2003.desc_pain
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = happiness
	}

	immediate = {
		end_pregnancy = yes
		pregnancy_cleanup_effect = yes
	}

	option = { #It is for the best
		name = pregnancy.2003.a
	}
}

#Successful attempt, fall ill
pregnancy.2004 = {
	type = character_event
	title = pregnancy.2004.t
	desc = pregnancy.2004.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	immediate = {
		end_pregnancy = yes
		add_trait_force_tooltip = ill
		pregnancy_cleanup_effect = yes
	}

	option = { #It was what had to be done
		name = pregnancy.2004.a
	}
}

#Failed attempt, no side effects
pregnancy.2005 = {
	type = character_event
	title = pregnancy.2005.t
	desc = pregnancy.2005.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = sadness
	}

	immediate = {
		if = {
			limit = {
				is_married = no
			}
			#unmarried_mother_pregnancy_effect = yes
		}
		else = {
			married_mother_pregnancy_effect = yes
		}
	}

	option = { #I had to try
		name = pregnancy.2005.a
	}
}

#Die
pregnancy.2007 = {
	type = character_event
	title = pregnancy.2007.t
	desc = pregnancy.2007.desc
	theme = pregnancy
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_murder"
	}

	option = { #It was what had to be done
		name = pregnancy.2007.a
		death = {
			death_reason = death_attempted_treatment
		}
	}
}

################
# Same-sex
# 250 - 2059
###############

# Pregnant while all mother's consorts are women
# by Linnéa Thimrén
pregnancy.2050 = {
	title = pregnancy.2050.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				desc = pregnancy.2050.desc.polyamorous
			}
			desc = pregnancy.2050.desc
		}
	}
	theme = pregnancy
	left_portrait = scope:real_father
	right_portrait = scope:spouse

	trigger = {
		# If we are married and/or have concubines, but all of them are women as well, it's a bastard!
		any_consort = {
			NOT = { is_male = yes }
		}
		pregnancy_real_father = {
			NOT = {	is_consort_of = root }
		}

		# OBJECTION! If a former spouse/concubine is both the real and assumed father, it's not actually a bastard!
		NOT = {
			former_consort_was_father = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"

		save_scope_as = mother
		hidden_effect = {
			set_num_pregnancy_children = 1
			if = {
				limit = {
					exists = primary_partner
				}
				primary_partner = {
					save_scope_as = spouse
				}
			}
			else = {
				random_consort = {
					save_scope_as = spouse
				}
			}
			add_character_flag = {
				flag = bastard_pregnancy
				months = 9
			}
		}

		# People will know you've been unfaithful, obviously
		add_fornicator_trait_or_nothing_effect = yes
	}

	option = { #Confess (for now this is the only option since you cannot deny that you've slept with someone else)
		name = {
			trigger = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			text = pregnancy.2002.a
		}
		name = {
			trigger = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
			text = pregnancy.2001.a
		}
		married_mother_pregnancy_effect = yes
		bastardy_pregnancy_announcement_effect = yes
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:real_father
			EXPOSER = scope:mother
		}
		ai_chance = {
			base = 100
		}
	}
}

####################
# Pregnancy ended prematurely (naturally)
# by Linnéa Thimrén
###################
pregnancy.2101 = {
	type = character_event
	title = pregnancy.2101.t
	desc = {
		random_valid = {
			first_valid = {
				triggered_desc = {
					trigger = {
						any_child = {
							even_if_dead = yes
							count >= 1
						}
					}
					desc = pregnancy.2101.desc_other_children
				}
				desc = pregnancy.2101.desc_pain
			}
			desc = pregnancy.2101.desc
		}
	}
	theme = pregnancy
	left_portrait = {
		character = root
		animation = personality_cynical
	}

	trigger = {
		is_pregnant = yes
	}

	immediate = {
		if = {
			limit = {
				exists = primary_partner
			}
			primary_partner = {
				save_scope_as = spouse
			}
		}
		create_character_memory = {
			type = child_premature
			participants = { mother = root }
		}
		hidden_effect = {
			end_pregnancy = yes
			pregnancy_cleanup_effect = yes
		}
	}

	option = {
		name = pregnancy.2101.a

		#To tell spouse
		if = {
			limit = {
				exists = scope:spouse
			}
			scope:spouse = { trigger_event = pregnancy.2102 }
		}

		#To tell real_father if they're not your spouse and they know of the pregnancy
		if = {
			limit = {
				exists = scope:spouse
				NOT = {
					scope:spouse = scope:real_father
					has_character_flag = pregnancy_real_father_knows
				}
			}
			scope:real_father = { trigger_event = pregnancy.2102 }
		}
	}
}

#Pregnancy ended prematurely - for father
pregnancy.2102 = {
	type = character_event
	title = pregnancy.2101.t
	desc = pregnancy.2102.desc
	theme = pregnancy
	right_portrait = {
		character = scope:mother
		animation = personality_cynical
	}

	immediate = {
		create_character_memory = {
			type = child_premature
			participants = { mother = scope:mother }
		}
	}

	option = {
		name = pregnancy.2102.a
	}
}

###############
#3000: Events for the real father
######################

#real_father suspects they are the father
#Can be triggered if the mother tries to keep fatherhood hidden from real_father in pregnancy.2002 or 2003
pregnancy.3001 = {
	type = character_event
	title = pregnancy.3001.t
	desc = {
		desc = pregnancy.3001.opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:mother = { any_relation = { type = lover this = root } }
					has_opinion_modifier = {
						modifier = love_opinion
						target = scope:mother
					}
				}
				desc = pregnancy.3001.lovers_love
			}
			triggered_desc = {
				trigger = {
					scope:mother = { any_relation = { type = lover this = root } }
				}
				desc = pregnancy.3001.lovers_not_love
			}
			desc = pregnancy.3001.not_lovers
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
			NOR = {
				any_owned_story = {
					exists = var:peasant_character
					var:peasant_character = { this = root }
				}
				has_character_flag = pregnancy_real_father_knows
			}
		}

		#Safety block for spouses that are also lovers, since this event is for bastard fathers
		NOT = { is_consort_of = scope:mother }
	}

	option = { #I must confront her about it!
		name = pregnancy.3001.a
		custom_tooltip = pregnancy.3001.a.tt
		hidden_effect = {
			save_scope_as = real_father_inquirer
			scope:mother = {
				trigger_event = {
					id = pregnancy.5001
					days = { 3 5 }
				}
			}
		}
	}

	option = { #Could it be...
		name = pregnancy.3001.b
		custom_tooltip = pregnancy.3001.b.tt
	}
}

#Mother chooses to tell the real father in pregnancy.2002
pregnancy.3002 = {
	type = character_event
	title = pregnancy.3002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { any_relation = { type = lover this = scope:mother }}
				desc = pregnancy.3002.lovers
			}
			desc = pregnancy.3002.not_lovers
		}
		triggered_desc = {
			trigger = { exists = scope:spouse }
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
	}

	option = { #What will become of the child
		name = pregnancy.3002.a
		trigger = {
			has_opinion_modifier = {
				modifier = love_opinion
				target = scope:mother
			}
		}
		exclusive = yes
		custom_tooltip = pregnancy.3002.a.tt
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
	}

	option = { #What will become of the child
		name = {
			trigger = {
				OR = {
					any_child = {
						OR = {
							has_trait = bastard
							has_trait = legitimized_bastard
							has_trait = wild_oat
						}
					}
					any_known_secret = {
						OR = {
							secret_type = secret_disputed_heritage
							secret_type = secret_unmarried_illegitimate_child
						}
						exists = secret_target
						exists = secret_target.real_father
						secret_target = {
							real_father = root
						}
					}
				}
			}
			text = pregnancy.3002.b.not_again
		}
		name = {
			text = pregnancy.3002.b
		}
		custom_tooltip = pregnancy.3002.a.tt
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
	}

	option = { #The whole world must know the truth
		name = pregnancy.3002.c
		trigger = {
			is_married = no
		}
		save_scope_value_as = {
			name = real_father_revealing
			value = yes
		}
		bastardy_pregnancy_announcement_effect = yes
	}
}

#Unmarried mother comes to unmarried father
pregnancy.3003 = {
	type = character_event
	title = pregnancy.3003.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					faith = {
						has_doctrine_parameter = bastards_none
					}
				}
				desc = pregnancy.3003.desc_no_bastards
			}
			desc = pregnancy.3003.desc
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = tutorial_reactive_advice_bastards
			}
		}
	}

	option = { #This must be kept secret!
		name = pregnancy.3003.a
		custom_tooltip = pregnancy.3003.a.tt
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}

	option = { #The whole world must know!
		name = pregnancy.3003.b
		bastardy_pregnancy_announcement_effect = yes
		ai_chance = {
			base = 25
		}
	}
}

#Unmarried mother comes to married father
pregnancy.3004 = {
	type = character_event
	title = pregnancy.3004.t
	desc = pregnancy.3004.desc
	theme = pregnancy
	left_portrait = scope:mother
	lower_right_portrait = scope:spouse

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		play_music_cue = "mx_cue_succession"
		#The real father knows now
		scope:mother = {
			add_character_flag = {
				flag = pregnancy_real_father_knows
				months = 9
			}
		}
		#For portrait and desc purposes
		primary_spouse = {
			save_scope_as = spouse
		}
		show_as_tooltip = {
			scope:mother = { add_trait_force_tooltip = pregnant }
		}
	}

	option = { #This must be kept secret!
		name = pregnancy.3004.a
	}
}

#5000: Follow-ups
#The child's real_father suspects, confronts mother about it.
#Fired by the real_father choosing to press the mother in pregnancy.3001
pregnancy.5001 = {
	type = character_event
	title = pregnancy.5001.t
	desc = {
		desc = pregnancy.5001.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:real_father = scope:real_father_inquirer }
				desc = pregnancy.5001.real_father
			}
			desc = pregnancy.5001.not_father
		}
	}
	theme = pregnancy
	left_portrait = {
		character = scope:real_father_inquirer
		animation = worry
	}
	right_portrait = {
		trigger = {
			NOT = { scope:spouse = scope:real_father_inquirer }
		}
		character = scope:spouse
	}

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	option = { #It is true!
		name = pregnancy.5001.a
		trigger = {
			scope:real_father_inquirer = scope:real_father
		}
		custom_tooltip = reveal_illegitimate_pregnancy_to_real_father_tt
		ai_chance = {
			base = 100
		}
		scope:real_father = {
			trigger_event = {
				id = pregnancy.5002 #The truth is revealed to them
				days = { 3 5 }
			}
		}
	}

	option = { #Insist real_father is wrong
		name = pregnancy.5001.b
		trigger = { NOT = { scope:real_father_inquirer = scope:real_father } }
		fallback = yes # Only show if they are not the father
		ai_chance = {
			base = 100
		}
		scope:real_father = {
			trigger_event = {
				id = pregnancy.5003 #Denial
				days = { 3 5 }
			}
		}
	}
}

#Mother confesses that root is the real_father, sharing the secret with them
pregnancy.5002 = {
	type = character_event
	title = pregnancy.5002.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_opinion_modifier = {
						modifier = love_opinion
						target = scope:mother
					}
				}
				desc = pregnancy.5002.love
			}
			desc = pregnancy.5002.not_love
		}
	}
	theme = pregnancy
	left_portrait = scope:mother

	trigger = {
		scope:mother = {
			is_pregnant = yes
		}
	}

	immediate = {
		hidden_effect = {
			scope:mother = {
				add_character_flag = {
					flag = pregnancy_real_father_knows
					months = 9
				}
			}
		}
		if = {
			limit = {
				is_ai = no
			}
			add_character_flag = {
				flag = tutorial_reactive_advice_bastards
			}
		}
	}

	option = { #Ah, what will become of our child?
		name = pregnancy.5002.a
		custom_tooltip = pregnancy.3003.a.tt
	}

	option = {
		name = pregnancy.5002.b
		expose_lover_secret_or_run_consequence_effect = {
			TARGET = scope:mother
			EXPOSER = root
		}
		bastardy_pregnancy_announcement_effect = yes
	}
}

#Mother keeps insisting the child is not root's
pregnancy.5003 = {
	type = character_event
	title = pregnancy.5003.t
	desc = pregnancy.5003.desc
	theme = pregnancy
	left_portrait = {
		character = scope:mother
		animation = personality_callous
	}

	option = { #Are they really telling the truth?
		name = pregnancy.5003.a
	}
}

########################
# Someone publicly announces the child is theirs
# 6000
########################

### 6000 - 6099: Mother announces
#Mother announces the child - and the real father
pregnancy.6001 = {
	type = character_event
	title = pregnancy.6001.t
	desc = pregnancy.6001.desc
	theme = pregnancy
	left_portrait = {
		character = scope:mother
		animation = personality_callous
	}
	right_portrait = scope:real_father

	option = {
		name = pregnancy.6001.a
		custom_tooltip = pregnancy_announcement_my_child_will_be_a_bastard
	}
}

#Mother announces child father - event for real father
pregnancy.6002 = {
	type = character_event
	title = pregnancy.6002.t
	desc = {
		desc = pregnancy.6002.desc
		triggered_desc = {
			trigger = {
				exists = scope:spouse
				scope:spouse = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			}
			desc = pregnancy.6002.married
		}
		triggered_desc = {
			trigger = {
				is_married = no
				opinion = {
					target = scope:mother
					value <= 0
				}
			}
			desc = pregnancy.6002.unmarried_unsympathetic
		}
		triggered_desc = {
			trigger = {
				is_married = no
				opinion = {
					target = scope:mother
					value > 0
				}
			}
			desc = pregnancy.6002.unmarried_sympathetic
		}
	}

	theme = pregnancy
	left_portrait = scope:mother
	right_portrait = {
		character = scope:spouse
		animation = disapproval
	}

	immediate = {
		if = {
			limit = {
				exists = primary_partner
				primary_partner = { NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } } }
			}
			primary_partner = {
				save_scope_as = spouse
			}
		}
		else = {
			random_consort = {
				limit = {
					NOT = { faith = { has_doctrine_parameter = no_unfaithfulness_penalty_active } }
				}
				save_scope_as = spouse
			}
		}
	}

	option = {
		name = pregnancy.6002.a
		trigger = { is_married = no }
	}

	after = {
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard_real_father
	}
}

#Mother announces child father - event for spouse of mother
pregnancy.6003 = {
	type = character_event
	title = pregnancy.6003.t
	desc = pregnancy.6003.desc
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pregnancy.6003.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for family of mother
pregnancy.6004 = {
	type = character_event
	title = pregnancy.6004.t
	desc = {
		desc = pregnancy.6004.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:mother = {
						is_close_family_trigger = {
							CHARACTER = scope:real_father
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = root.faith GENDER_CHARACTER = scope:mother }
				}
				desc = pregnancy.6004.incest
			}
			triggered_desc = {
				trigger = {
					exists = scope:spouse
				}
				desc = pregnancy.6004.mother_married
			}
			desc = pregnancy.6004.mother_unmarried
		}
	}
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father

	immediate = {
		play_music_cue = "mx_cue_prison"
		scope:mother = {
			if = {
				limit = { exists = primary_partner }
				primary_partner = {
					save_scope_as = spouse
				}
			}
		}
	}

	option = {
		name = pregnancy.6004.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for spouse of real_father
pregnancy.6005 = {
	type = character_event
	title = pregnancy.6005.t
	desc = pregnancy.6005.desc
	theme = pregnancy
	left_portrait = scope:real_father
	right_portrait = scope:mother

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pregnancy.6005.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

#Mother announces child father - event for family of real_father
pregnancy.6006 = {
	type = character_event
	title = pregnancy.6006.t
	desc = {
		desc = pregnancy.6006.desc
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:spouse
				}
				desc = pregnancy.6006.real_father_married
			}
			desc = pregnancy.6006.real_father_unmarried
		}
	}
	theme = pregnancy
	left_portrait = scope:mother
	lower_left_portrait = scope:real_father
	lower_center_portrait = scope:spouse
	override_background = {
		reference = dungeon
		trigger = {
			scope:mother = { is_imprisoned = yes }
		}
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
		scope:real_father = {
			if = {
				limit = { exists = primary_partner }
				primary_partner = {
					save_scope_as = spouse
				}
			}
		}
	}

	option = {
		name = pregnancy.6006.a
	}
}

#Mother announces child father - event for real_father
pregnancy.6999 = {
	type = character_event
	title = pregnancy.6999.t
	desc = pregnancy.6999.desc
	theme = pregnancy
	left_portrait = scope:mother
	right_portrait = scope:real_father

	option = {
		name = pregnancy.6999.a
		custom_tooltip = pregnancy_announcement_the_child_will_be_a_bastard
	}
}

repo_name: Synthael/carnalitas

license: mit


code:
# This file is named 00_carn_tits so that the vanilla game's clothing replacement for bust gene will be loaded after it.
# DO NOT RENAME THIS FILE to anything after 01_clothes, or you will get boobs clipping with clothes.

carn_tits = {
	usage = game
	selection_behavior = weighted_random
	tits_average_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_average_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				range = { 0.4 0.6 }
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 1
				has_game_rule = carn_dt_enabled
				NOR = {
					carn_has_small_tits_trigger = yes
					carn_has_big_tits_trigger = yes
				}
			}
		}
	}
	tits_small_3_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_3_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 0.0
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_3_trigger = yes
			}
		}
	}
	tits_small_2_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_2_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 0.15
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_2_trigger = yes
			}
		}
	}
	tits_small_1_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_small_1_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 0.35
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_small_1_trigger = yes
			}
		}
	}
	tits_big_1_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_1_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 0.65
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				OR = {
					carn_has_tits_big_1_trigger = yes
				}
			}
		}
	}
	tits_big_2_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_2_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 0.85
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_2_trigger = yes
			}
		}
	}
	tits_big_3_bust_default = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_default
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_1_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_half
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_1_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_1_full
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_2_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_half
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_2_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_2_full
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_3_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_half
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_3_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_3_full
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_4_half = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_half
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
	tits_big_3_bust_shape_4_full = {
		dna_modifiers = {
			morph = {
				mode = replace
				gene = gene_bs_bust
				template = bust_shape_4_full
				value = 1.00
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 3
				carn_has_tits_big_3_trigger = yes
			}
		}
	}
}


code:
carn_custom_pregnancy = {

	usage = game

	carn_custom_pregnancy = {
		ignore_outfit_tags = yes
		dna_modifiers = {
			morph = {
				mode = add
				gene = gene_bs_pregnant
				template = pregnant
				value = {
					value = 1
					if = {
						# Overweight females should have less visible pregnancy, so we change the 100% pregnant value
						limit = { current_weight > overweight_threshold }
						value = current_weight_for_portrait # An absolute and normalized value derived from character body weight
						multiply = -1.0
						add = 1.5
						max = 1.0
					}
					multiply = 0.75
				}
			}
		}
		weight = {
			base = 0
			modifier = {
				add = 100
				has_trait_with_flag = carn_use_pregnant_portrait
			}
		}
	}
}


code:
texticon = {
	icon = carn_icon
	iconsize = {
		texture = "gfx/interface/icons/carn_icon.dds"
		size = { 25 25 }
		offset = { 0 6 }
		fontsize = 16
	}
}