code:
courtier_allowed_to_leave_trigger = {
	save_temporary_scope_as = leaving_courtier
	NOR = {
		# Not blocked by script
		has_character_flag = blocked_from_leaving
		is_councillor_of = scope:liege
		is_consort_of = scope:liege
		scope:liege = {
			player_heir_position = {
				target = scope:leaving_courtier
				value <= 2 #Not 1st, 2nd or 3rd player heir (0,1,2)
			}
		}
		has_any_court_position = yes
		has_relation_lover = scope:liege
		is_knight_of = scope:liege
		is_tax_collector_of = scope:liege
		any_relation = {
			type = ward
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = guardian
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = mentor
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = student
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		has_epidemic_disease_trigger = yes
		#Keep daughters/sons for marriages
		AND = {
			OR = {
				is_child_of = scope:liege
				is_grandchild_of = scope:liege
				is_great_grandchild_of = scope:liege
			}
			NOT = { has_trait = bastard }
			trigger_if = { #Daughters
				limit = { is_female = yes }
				scope:liege = {
					OR = {
						has_realm_law = male_only_law
						has_realm_law = male_preference_law
					}
				}
			}
			trigger_else = { #Sons
				scope:liege = {
					OR = {
						has_realm_law = female_only_law
						has_realm_law = female_preference_law
					}
				}
			}
		}
		#No children of liege can leave court while children
		AND = {
			OR = {
				is_child_of = scope:liege
				is_grandchild_of = scope:liege
				is_great_grandchild_of = scope:liege
			}
			is_adult = no
		}
		#Claimant won't leave while claim is pressed...
		scope:liege = { pressing_claim_of_character_trigger = { CHARACTER = scope:leaving_courtier } }
		#Would be leaving without a child or consort
		any_child_not_in_traveling_family_trigger = yes
		any_consort_not_in_traveling_family_trigger = yes
		#...Or while they have a promise for a claim getting pressed
		has_character_flag = courtier_staying_for_claim

		#...Or if they're involved in an ongoing event
		has_variable = stewardship_duty_1062_employer

		#...Or if someone is trying to elope with them
		any_targeting_scheme = {
			scheme_type = elope
		}

		#Non-dominant spouses don't wander off
		AND = {
			is_married = yes
			any_spouse = {
				OR = {
					AND = {
						exists = liege
						liege = scope:leaving_courtier.liege
					}
					AND = {
						exists = host
						exists = scope:leaving_courtier.host
						liege = scope:leaving_courtier.host
					}
					is_in_the_same_court_as = scope:leaving_courtier
				}
			}
			trigger_if = {
				limit = { is_female = yes }
				scope:liege = {
					OR = {
						has_realm_law = male_only_law
						has_realm_law = male_preference_law
					}
				}
			}
			trigger_else = {
				scope:liege = {
					OR = {
						has_realm_law = female_only_law
						has_realm_law = female_preference_law
					}
				}
			}
		}

		# Diarchs don't leave their court.
		is_diarch = yes
		is_designated_diarch = yes

		#Shieldmaidens stay till dismissed.
		has_trait = shieldmaiden

		# Children taught a lesson won't leave
		has_character_modifier = mellowed_spirit

		# Courtiers with sponsored inspirations won't leave on their own.
		AND = {
			exists = inspiration
			inspiration = {	exists = inspiration_sponsor }
		}

		scope:liege = { government_has_flag = government_is_landless_adventurer }
		is_obedient_to = scope:liege
	}
}

can_recruit_character_to_court_trigger = {
	$RECRUITER$ = { save_temporary_scope_as = recruiter }
	$RECRUITEE$ = { save_temporary_scope_as = recruitee }
	scope:recruitee = {
		bp2_valid_for_standard_interactions_trigger = yes
		NOR = {
			custom_description = {
				text = is_not_wandering_child
				subject = scope:recruitee
				AND = {
					is_adult = no
					NOT = { is_close_or_extended_family_of = scope:recruiter }
				}
			}
			is_imprisoned = yes
			is_theocratic_lessee = yes
			is_diarch = yes
			trigger_if = {
				limit = {
					exists = host
					NOT = { is_player_heir_of = scope:recruiter }
				}
				is_player_heir_of = host
			}
			trigger_if = {
				limit = { exists = host }
				is_consort_of = host
			}
			trigger_if = {
				limit = { exists = host }
				host = {
					pressing_claim_of_character_trigger = { CHARACTER = scope:recruitee }
				}
			}
			trigger_if = {
				limit = { exists = host }
				#Are they employed?
				is_councillor_of = scope:recruitee.host
				is_knight_of = scope:recruitee.host
				any_relation = {
					type = ward
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = guardian
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = mentor
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = student
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_court_position_employer = { this = scope:recruitee.host }
			}
			trigger_if = {
				limit = {
					scope:recruiter = { is_landless_adventurer = yes }
				}
				custom_tooltip = {
					text = can_recruit_character_to_court_trigger.tt.laamps_invitation_restrictions
					NOR = {
						is_player_heir_of = scope:recruiter
						has_relation_soulmate = scope:recruiter
						has_relation_best_friend = scope:recruiter
						is_consort_of = scope:recruiter
						AND = {
							is_pool_character = yes
							OR = {
								has_relation_friend = scope:recruiter
								has_relation_lover = scope:recruiter
								is_close_family_of = scope:recruiter
							}
						}
					}
				}
			}

			#Do they have the "wrong" marriage type and the spouse is employed?
			custom_description = {
				text = is_married_matrilineally_and_spouse_is_dominant_partner
				subject = scope:recruitee
				any_spouse = {
					is_female = yes
					matrilinear_marriage = yes
					exists = host
					host = scope:recruitee.host
					save_temporary_scope_as = spouse
					OR = { #Is employed in some way
						is_councillor_of = scope:recruitee.host
						is_knight_of = scope:recruitee.host
						any_relation = {
							type = ward
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = guardian
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = mentor
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = student
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						scope:spouse = {
							any_court_position_employer = { this = scope:recruitee.host }
						}
					}
				}
			}
			custom_description = {
				text = is_married_patrilineally_and_spouse_is_dominant_partner
				subject = scope:recruitee
				any_spouse = {
					is_male = yes
					patrilinear_marriage = yes
					exists = host
					host = scope:recruitee.host
					save_temporary_scope_as = spouse
					OR = { #Is employed in some way
						is_councillor_of = scope:recruitee.host
						is_knight_of = scope:recruitee.host
						any_relation = {
							type = ward
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = guardian
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = mentor
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = student
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						scope:spouse = {
							any_court_position_employer = { this = scope:recruitee.host }
						}
					}
				}
			}
			custom_description = {
				text = "is_escaped_prisoner"
				subject = scope:recruitee
				OR = {
					has_opinion_modifier = {
						modifier = attempted_imprisonment_opinion
						target = scope:recruiter
					}
					has_opinion_modifier = {
						modifier = treasonous_imprison_refusal
						target = scope:recruiter
					}
					AND = {
						exists = var:escaped_imprisonment_from
						var:escaped_imprisonment_from = scope:recruiter
					}
				}
			}
		}
	}
}


code:
courtier_allowed_to_leave_trigger = {
	save_temporary_scope_as = leaving_courtier
	NOR = {
		# Not blocked by script
		has_character_flag = blocked_from_leaving
		# Carnalitas: does not have slave trait, or any other similar trait or flag
		has_character_flag = carn_blocked_from_leaving
		has_trait_with_flag = can_not_leave_court_voluntarily
		is_councillor_of = scope:liege
		is_consort_of = scope:liege
		scope:liege = {
			player_heir_position = {
				target = scope:leaving_courtier
				value <= 2 #Not 1st, 2nd or 3rd player heir (0,1,2)
			}
		}
		has_any_court_position = yes
		has_relation_lover = scope:liege
		is_knight_of = scope:liege
		is_tax_collector_of = scope:liege
		any_relation = {
			type = ward
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = guardian
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = mentor
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		any_relation = {
			type = student
			OR = {
				this = scope:liege
				AND = {
					is_courtier_of = scope:liege
					OR = {
						NOT = { any_close_family_member = { this = scope:leaving_courtier } }
						any_close_family_member = { this = scope:liege }
					}
				}
			}
		}
		has_epidemic_disease_trigger = yes
		#Keep daughters/sons for marriages
		AND = {
			OR = {
				is_child_of = scope:liege
				is_grandchild_of = scope:liege
				is_great_grandchild_of = scope:liege
			}
			NOT = { has_trait = bastard }
			trigger_if = { #Daughters
				limit = { is_female = yes }
				scope:liege = {
					OR = {
						has_realm_law = male_only_law
						has_realm_law = male_preference_law
					}
				}
			}
			trigger_else = { #Sons
				scope:liege = {
					OR = {
						has_realm_law = female_only_law
						has_realm_law = female_preference_law
					}
				}
			}
		}
		#No children of liege can leave court while children
		AND = {
			OR = {
				is_child_of = scope:liege
				is_grandchild_of = scope:liege
				is_great_grandchild_of = scope:liege
			}
			is_adult = no
		}
		#Claimant won't leave while claim is pressed...
		scope:liege = { pressing_claim_of_character_trigger = { CHARACTER = scope:leaving_courtier } }
		#Would be leaving without a child or consort
		any_child_not_in_traveling_family_trigger = yes
		any_consort_not_in_traveling_family_trigger = yes
		#...Or while they have a promise for a claim getting pressed
		has_character_flag = courtier_staying_for_claim

		#...Or if they're involved in an ongoing event
		has_variable = stewardship_duty_1062_employer

		#...Or if someone is trying to elope with them
		any_targeting_scheme = {
			scheme_type = elope
		}

		#Non-dominant spouses don't wander off
		AND = {
			is_married = yes
			any_spouse = {
				OR = {
					AND = {
						exists = liege
						liege = scope:leaving_courtier.liege
					}
					AND = {
						exists = host
						exists = scope:leaving_courtier.host
						liege = scope:leaving_courtier.host
					}
					is_in_the_same_court_as = scope:leaving_courtier
				}
			}
			trigger_if = {
				limit = { is_female = yes }
				scope:liege = {
					OR = {
						has_realm_law = male_only_law
						has_realm_law = male_preference_law
					}
				}
			}
			trigger_else = {
				scope:liege = {
					OR = {
						has_realm_law = female_only_law
						has_realm_law = female_preference_law
					}
				}
			}
		}

		# Diarchs don't leave their court.
		is_diarch = yes
		is_designated_diarch = yes

		#Shieldmaidens stay till dismissed.
		has_trait = shieldmaiden

		# Children taught a lesson won't leave
		has_character_modifier = mellowed_spirit

		# Courtiers with sponsored inspirations won't leave on their own.
		AND = {
			exists = inspiration
			inspiration = {	exists = inspiration_sponsor }
		}

		scope:liege = { government_has_flag = government_is_landless_adventurer }
		is_obedient_to = scope:liege
	}
}

can_recruit_character_to_court_trigger = {
	$RECRUITER$ = { save_temporary_scope_as = recruiter }
	$RECRUITEE$ = { save_temporary_scope_as = recruitee }
	scope:recruitee = {
		bp2_valid_for_standard_interactions_trigger = yes
		NOR = {
			custom_description = {
				text = is_not_wandering_child
				subject = scope:recruitee
				AND = {
					is_adult = no
					NOT = { is_close_or_extended_family_of = scope:recruiter }
				}
			}
			# Carnalitas: does not have slave trait, or any other similar trait or flag
			has_character_flag = carn_blocked_from_leaving
			has_trait_with_flag = can_not_leave_court_voluntarily
			is_imprisoned = yes
			is_theocratic_lessee = yes
			is_diarch = yes
			trigger_if = {
				limit = {
					exists = host
					NOT = { is_player_heir_of = scope:recruiter }
				}
				is_player_heir_of = host
			}
			trigger_if = {
				limit = { exists = host }
				is_consort_of = host
			}
			trigger_if = {
				limit = { exists = host }
				host = {
					pressing_claim_of_character_trigger = { CHARACTER = scope:recruitee }
				}
			}
			trigger_if = {
				limit = { exists = host }
				#Are they employed?
				is_councillor_of = scope:recruitee.host
				is_knight_of = scope:recruitee.host
				any_relation = {
					type = ward
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = guardian
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = mentor
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_relation = {
					type = student
					OR = {
						this = scope:recruitee.host
						is_close_family_of = scope:recruitee.host
					}
				}
				any_court_position_employer = { this = scope:recruitee.host }
			}
			trigger_if = {
				limit = {
					scope:recruiter = { is_landless_adventurer = yes }
				}
				custom_tooltip = {
					text = can_recruit_character_to_court_trigger.tt.laamps_invitation_restrictions
					NOR = {
						is_player_heir_of = scope:recruiter
						has_relation_soulmate = scope:recruiter
						has_relation_best_friend = scope:recruiter
						is_consort_of = scope:recruiter
						AND = {
							is_pool_character = yes
							OR = {
								has_relation_friend = scope:recruiter
								has_relation_lover = scope:recruiter
								is_close_family_of = scope:recruiter
							}
						}
					}
				}
			}

			#Do they have the "wrong" marriage type and the spouse is employed?
			custom_description = {
				text = is_married_matrilineally_and_spouse_is_dominant_partner
				subject = scope:recruitee
				any_spouse = {
					is_female = yes
					matrilinear_marriage = yes
					exists = host
					host = scope:recruitee.host
					save_temporary_scope_as = spouse
					OR = { #Is employed in some way
						is_councillor_of = scope:recruitee.host
						is_knight_of = scope:recruitee.host
						any_relation = {
							type = ward
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = guardian
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = mentor
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = student
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						scope:spouse = {
							any_court_position_employer = { this = scope:recruitee.host }
						}
					}
				}
			}
			custom_description = {
				text = is_married_patrilineally_and_spouse_is_dominant_partner
				subject = scope:recruitee
				any_spouse = {
					is_male = yes
					patrilinear_marriage = yes
					exists = host
					host = scope:recruitee.host
					save_temporary_scope_as = spouse
					OR = { #Is employed in some way
						is_councillor_of = scope:recruitee.host
						is_knight_of = scope:recruitee.host
						any_relation = {
							type = ward
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = guardian
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = mentor
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						any_relation = {
							type = student
							OR = {
								this = scope:recruitee.host
								is_close_family_of = scope:recruitee.host
							}
						}
						scope:spouse = {
							any_court_position_employer = { this = scope:recruitee.host }
						}
					}
				}
			}
			custom_description = {
				text = "is_escaped_prisoner"
				subject = scope:recruitee
				OR = {
					has_opinion_modifier = {
						modifier = attempted_imprisonment_opinion
						target = scope:recruiter
					}
					has_opinion_modifier = {
						modifier = treasonous_imprison_refusal
						target = scope:recruiter
					}
					AND = {
						exists = var:escaped_imprisonment_from
						var:escaped_imprisonment_from = scope:recruiter
					}
				}
			}
		}
	}
}

repo_name: Synthael/carnalitas

license: mit


code:
#Takes argument disease
can_contract_disease_trigger = {
	save_temporary_scope_as = sick_character_check

	# Is not immune to disease
	NOT = { has_character_flag = immune_to_disease }

	#Doesn't already have the trait
	NOT = { has_trait = $DISEASE$ }

	#Only get measles once
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:measles }
		NOT = { has_character_flag = measles_immunity }
	}

	#Only get bubonic plague once
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:bubonic_plague }
		NOT = { has_character_flag = bubonic_immunity }
	}

	#Young characters do not get gout
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:gout_ridden }
		current_weight >= 50
		is_young_character = no
	}

	save_temporary_scope_value_as = {
		name = disease_type_for_trigger
		value = flag:$DISEASE$
	}

	trigger_if = { #Lover's pox can only be contracted if you are sexually active
		limit = {
			scope:disease_type_for_trigger = flag:lovers_pox
			is_imprisoned = yes
		}
		imprisoner = {
			OR = {
				AND = {
					scope:sick_character_check = { is_in_prison_type = dungeon }
					any_prisoner = {
						OR = {
							has_relation_lover = scope:sick_character_check
							any_consort = {
								this = scope:sick_character_check
							}
						}
					}
				}
				AND = {
					scope:sick_character_check = { is_in_prison_type = house_arrest }
					OR = {
						any_prisoner = {
							OR = {
								has_relation_lover = scope:sick_character_check
								any_consort = {
									this = scope:sick_character_check
								}
							}
						}
						any_courtier = {
							OR = {
								has_relation_lover = scope:sick_character_check
								any_consort = {
									this = scope:sick_character_check
								}
							}
						}
					}
				}
			}
		}
	}

	# Check to see that there is someone for you to have sex with if you are traveling
	trigger_if = {
		limit = {
			scope:disease_type_for_trigger = flag:lovers_pox
			is_travelling = yes
			# Do not block Goliardic Shenanigans!
			involved_activity ?= {
				NOT = { has_activity_type = activity_adult_education }
			}
		}
		current_travel_plan = {
			any_entourage_character = {
				OR = {
					has_relation_lover = scope:sick_character_check
					any_consort = {
						this = scope:sick_character_check
					}
				}
			}
		}
	}

	#Secondary requirements (mutually exclusive diseases or immunity)
	OR = {
		NOR = { #No secondary requirement
			scope:disease_type_for_trigger = flag:ill
			scope:disease_type_for_trigger = flag:smallpox
			scope:disease_type_for_trigger = flag:bubonic_plague
		}
		AND = {
			scope:disease_type_for_trigger = flag:ill
			NOT = { has_trait = pneumonic }
		}
		AND = {
			scope:disease_type_for_trigger = flag:smallpox
			NOT = { has_character_flag = disease_immunity_smallpox }
		}
		AND = {
			scope:disease_type_for_trigger = flag:measles
			NOT = { has_character_flag = disease_immunity_measles }
		}
		AND = {
			scope:disease_type_for_trigger = flag:bubonic_plague
			NOT = { has_character_flag = disease_immunity_bubonic_plague }
		}
	}

	#No disease stacking
	OR = {
		can_get_non_epidemic_disease_trigger = yes
		OR = {
			scope:disease_type_for_trigger = flag:bubonic_plague
			scope:disease_type_for_trigger = flag:smallpox
		}
		AND = {
			scope:disease_type_for_trigger = flag:pneumonic
			has_trait = ill
		}
	}

	#Cooldown is over
	NOR = {
		has_character_flag = contraction_cooldown_general #Haven't had a disease for 2 years
		#No specific cooldowns:
		#Ill, you can get it often
		#Smallpox and bubonic plague, after one time you are immune
		#Lover's pox and leper because you never recover
		AND = {
			has_character_flag = contraction_cooldown_pneumonic
			scope:disease_type_for_trigger = flag:pneumonic
		}
		AND = {
			has_character_flag = contraction_cooldown_gout_ridden
			scope:disease_type_for_trigger = flag:gout_ridden
		}
		AND = {
			has_character_flag = contraction_cooldown_typhus
			scope:disease_type_for_trigger = flag:typhus
		}
		AND = {
			has_character_flag = contraction_cooldown_consumption
			scope:disease_type_for_trigger = flag:consumption
		}
		AND = {
			has_character_flag = contraction_cooldown_cancer
			scope:disease_type_for_trigger = flag:cancer
		}
		AND = {
			has_character_flag = contraction_cooldown_great_pox
			scope:disease_type_for_trigger = flag:great_pox
		}
		AND = {
			has_character_flag = contraction_cooldown_dysentery
			scope:disease_type_for_trigger = flag:dysentery
		}
		AND = {
			has_character_flag = contraction_cooldown_ergotism
			scope:disease_type_for_trigger = flag:ergotism
		}
	}
}


code:
#Takes argument disease
can_contract_disease_trigger = {
	save_temporary_scope_as = sick_character_check

	# Is not immune to disease
	NOR = {
		has_character_flag = immune_to_disease
		has_trait_with_flag = immune_to_disease
	}

	#Doesn't already have the trait
	NOT = { has_trait = $DISEASE$ }

	#Only get measles once
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:measles }
		NOT = { has_character_flag = measles_immunity }
	}

	#Only get bubonic plague once
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:bubonic_plague }
		NOT = { has_character_flag = bubonic_immunity }
	}

	#Young characters do not get gout
	trigger_if = {
		limit = { trait:$DISEASE$ = trait:gout_ridden }
		current_weight >= 50
		is_young_character = no
	}

	save_temporary_scope_value_as = {
		name = disease_type_for_trigger
		value = flag:$DISEASE$
	}

	#Carnalitas: Can't contract STDs if STD Transmission game rule is Never
	trigger_if = {
		limit = {
			OR = {
				has_game_rule = carn_std_disabled
				has_character_flag = immune_to_std
				has_trait_with_flag = immune_to_std
			}
		}
		NOR = {
			scope:disease_type_for_trigger = flag:lovers_pox
			scope:disease_type_for_trigger = flag:great_pox
		}
	}

	trigger_if = { #Lover's pox can only be contracted if you are sexually active
		limit = {
			scope:disease_type_for_trigger = flag:lovers_pox
			is_imprisoned = yes
		}
		imprisoner = {
			OR = {
				AND = {
					scope:sick_character_check = { is_in_prison_type = dungeon }
					any_prisoner = {
						OR = {
							has_relation_lover = scope:sick_character_check
							any_consort = {
								this = scope:sick_character_check
							}
						}
					}
				}
				AND = {
					scope:sick_character_check = { is_in_prison_type = house_arrest }
					OR = {
						any_prisoner = {
							OR = {
								has_relation_lover = scope:sick_character_check
								any_consort = {
									this = scope:sick_character_check
								}
							}
						}
						any_courtier = {
							OR = {
								has_relation_lover = scope:sick_character_check
								any_consort = {
									this = scope:sick_character_check
								}
							}
						}
					}
				}
			}
		}
	}

	# Check to see that there is someone for you to have sex with if you are traveling
	trigger_if = {
		limit = {
			scope:disease_type_for_trigger = flag:lovers_pox
			is_travelling = yes
			# Do not block Goliardic Shenanigans!
			involved_activity ?= {
				NOT = { has_activity_type = activity_adult_education }
			}
		}
		current_travel_plan = {
			any_entourage_character = {
				OR = {
					has_relation_lover = scope:sick_character_check
					any_consort = {
						this = scope:sick_character_check
					}
				}
			}
		}
	}

	#Secondary requirements (mutually exclusive diseases or immunity)
	OR = {
		NOR = { #No secondary requirement
			scope:disease_type_for_trigger = flag:ill
			scope:disease_type_for_trigger = flag:smallpox
			scope:disease_type_for_trigger = flag:bubonic_plague
		}
		AND = {
			scope:disease_type_for_trigger = flag:ill
			NOT = { has_trait = pneumonic }
		}
		AND = {
			scope:disease_type_for_trigger = flag:smallpox
			NOT = { has_character_flag = disease_immunity_smallpox }
		}
		AND = {
			scope:disease_type_for_trigger = flag:measles
			NOT = { has_character_flag = disease_immunity_measles }
		}
		AND = {
			scope:disease_type_for_trigger = flag:bubonic_plague
			NOT = { has_character_flag = disease_immunity_bubonic_plague }
		}
	}

	#No disease stacking
	OR = {
		can_get_non_epidemic_disease_trigger = yes
		OR = {
			scope:disease_type_for_trigger = flag:bubonic_plague
			scope:disease_type_for_trigger = flag:smallpox
		}
		AND = {
			scope:disease_type_for_trigger = flag:pneumonic
			has_trait = ill
		}
	}

	#Cooldown is over
	NOR = {
		has_character_flag = contraction_cooldown_general #Haven't had a disease for 2 years
		#No specific cooldowns:
		#Ill, you can get it often
		#Smallpox and bubonic plague, after one time you are immune
		#Lover's pox and leper because you never recover
		AND = {
			has_character_flag = contraction_cooldown_pneumonic
			scope:disease_type_for_trigger = flag:pneumonic
		}
		AND = {
			has_character_flag = contraction_cooldown_gout_ridden
			scope:disease_type_for_trigger = flag:gout_ridden
		}
		AND = {
			has_character_flag = contraction_cooldown_typhus
			scope:disease_type_for_trigger = flag:typhus
		}
		AND = {
			has_character_flag = contraction_cooldown_consumption
			scope:disease_type_for_trigger = flag:consumption
		}
		AND = {
			has_character_flag = contraction_cooldown_cancer
			scope:disease_type_for_trigger = flag:cancer
		}
		AND = {
			has_character_flag = contraction_cooldown_great_pox
			scope:disease_type_for_trigger = flag:great_pox
		}
		AND = {
			has_character_flag = contraction_cooldown_dysentery
			scope:disease_type_for_trigger = flag:dysentery
		}
		AND = {
			has_character_flag = contraction_cooldown_ergotism
			scope:disease_type_for_trigger = flag:ergotism
		}
	}
}


code:
# Standard Values
@pos_compat_high = 30
@pos_compat_medium = 15
@pos_compat_low = 5

@neg_compat_high = -30
@neg_compat_medium = -15
@neg_compat_low = -5

futa = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_futa_trait_name_hermaphrodite
				}
				desc = trait_futa_immersive
			}
			desc = trait_futa
		}
	}

	physical = yes

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_futa_desc
			}
			desc = trait_futa_character_desc
		}
	}
}

futa_genetic = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_futa_trait_name_hermaphrodite
				}
				desc = trait_futa_immersive
			}
			desc = trait_futa
		}
	}

	genetic = yes
	physical = yes
	good = yes

	birth = 0
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_futa_desc
			}
			desc = trait_futa_character_desc
		}
	}
}

# Small dick
dick_small_good_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_1_immersive
			}
			desc = trait_dick_small_1
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_bad
	}

	group = dick_small_good
	level = 1

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_1_desc
			}
			desc = trait_dick_small_1_character_desc
		}
	}
}

# Tiny dick
dick_small_good_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_2_immersive
			}
			desc = trait_dick_small_2
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_bad
	}

	group = dick_small_good
	level = 2

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_2_desc
			}
			desc = trait_dick_small_2_character_desc
		}
	}
}

# Micro dick
dick_small_good_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_3_immersive
			}
			desc = trait_dick_small_3
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_bad
	}

	group = dick_small_good
	level = 3

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_3_desc
			}
			desc = trait_dick_small_3_character_desc
		}
	}
}

# Small dick
dick_small_bad_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_1_immersive
			}
			desc = trait_dick_small_1
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_good
	}

	group = dick_small_bad
	level = 1

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_1_desc
			}
			desc = trait_dick_small_1_character_desc
		}
	}
}

# Tiny dick
dick_small_bad_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_2_immersive
			}
			desc = trait_dick_small_2
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_good
	}

	group = dick_small_bad
	level = 2

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_2_desc
			}
			desc = trait_dick_small_2_character_desc
		}
	}
}

# Micro dick
dick_small_bad_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_small_3_immersive
			}
			desc = trait_dick_small_3
		}
	}

	opposites = {
		dick_big_good
		dick_big_bad
		dick_small_good
	}

	group = dick_small_bad
	level = 3

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_small_3_desc
			}
			desc = trait_dick_small_3_character_desc
		}
	}
}

# Big dick
dick_big_good_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_1_immersive
			}
			desc = trait_dick_big_1
		}
	}

	opposites = {
		dick_big_bad
		dick_small_good
		dick_small_bad
	}

	group = dick_big_good
	level = 1

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_1_desc
			}
			desc = trait_dick_big_1_character_desc
		}
	}
}

# Huge dick
dick_big_good_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_2_immersive
			}
			desc = trait_dick_big_2
		}
	}

	opposites = {
		dick_big_bad
		dick_small_good
		dick_small_bad
	}

	group = dick_big_good
	level = 2

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_2_desc
			}
			desc = trait_dick_big_2_character_desc
		}
	}
}

# Gigantic dick
dick_big_good_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_3_immersive
			}
			desc = trait_dick_big_3
		}
	}

	opposites = {
		dick_big_bad
		dick_small_good
		dick_small_bad
	}

	group = dick_big_good
	level = 3

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_3_desc
			}
			desc = trait_dick_big_3_character_desc
		}
	}
}

# Big dick
dick_big_bad_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_1_immersive
			}
			desc = trait_dick_big_1
		}
	}

	opposites = {
		dick_big_good
		dick_small_good
		dick_small_bad
	}

	group = dick_big_bad
	level = 1

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_1_desc
			}
			desc = trait_dick_big_1_character_desc
		}
	}
}

# Huge dick
dick_big_bad_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_2_immersive
			}
			desc = trait_dick_big_2
		}
	}

	opposites = {
		dick_big_good
		dick_small_good
		dick_small_bad
	}

	group = dick_big_bad
	level = 2

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_2_desc
			}
			desc = trait_dick_big_2_character_desc
		}
	}
}

# Gigantic dick
dick_big_bad_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_dick_big_3_immersive
			}
			desc = trait_dick_big_3
		}
	}

	opposites = {
		dick_big_good
		dick_small_good
		dick_small_bad
	}

	group = dick_big_bad
	level = 3

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_dick_big_3_desc
			}
			desc = trait_dick_big_3_character_desc
		}
	}
}

# Small tits
tits_small_good_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_1_immersive
			}
			desc = trait_tits_small_1
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_bad
	}

	group = tits_small_good
	level = 1

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_1_desc
			}
			desc = trait_tits_small_1_character_desc
		}
	}
}

# Tiny tits
tits_small_good_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_2_immersive
			}
			desc = trait_tits_small_2
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_bad
	}

	group = tits_small_good
	level = 2

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_2_desc
			}
			desc = trait_tits_small_2_character_desc
		}
	}
}

# Micro tits
tits_small_good_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_3_immersive
			}
			desc = trait_tits_small_3
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_bad
	}

	group = tits_small_good
	level = 3

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_3_desc
			}
			desc = trait_tits_small_3_character_desc
		}
	}
}

# Small tits
tits_small_bad_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_1_immersive
			}
			desc = trait_tits_small_1
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_good
	}

	group = tits_small_bad
	level = 1

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_1_desc
			}
			desc = trait_tits_small_1_character_desc
		}
	}
}

# Tiny tits
tits_small_bad_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_2_immersive
			}
			desc = trait_tits_small_2
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_good
	}

	group = tits_small_bad
	level = 2

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_2_desc
			}
			desc = trait_tits_small_2_character_desc
		}
	}
}

# Micro tits
tits_small_bad_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_small_3_immersive
			}
			desc = trait_tits_small_3
		}
	}

	opposites = {
		tits_big_good
		tits_big_bad
		tits_small_good
	}

	group = tits_small_bad
	level = 3

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_small_3_desc
			}
			desc = trait_tits_small_3_character_desc
		}
	}
}

# Big tits
tits_big_good_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_1_immersive
			}
			desc = trait_tits_big_1
		}
	}

	opposites = {
		tits_big_bad
		tits_small_good
		tits_small_bad
	}

	group = tits_big_good
	level = 1

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_1_desc
			}
			desc = trait_tits_big_1_character_desc
		}
	}
}

# Huge tits
tits_big_good_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_2_immersive
			}
			desc = trait_tits_big_2
		}
	}

	opposites = {
		tits_big_bad
		tits_small_good
		tits_small_bad
	}

	group = tits_big_good
	level = 2

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_2_desc
			}
			desc = trait_tits_big_2_character_desc
		}
	}
}

# Gigantic tits
tits_big_good_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_3_immersive
			}
			desc = trait_tits_big_3
		}
	}

	opposites = {
		tits_big_bad
		tits_small_good
		tits_small_bad
	}

	group = tits_big_good
	level = 3

	genetic = yes
	physical = yes
	good = yes

	birth = 0 # handled through script
	random_creation = 0

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_3_desc
			}
			desc = trait_tits_big_3_character_desc
		}
	}
}

# Big tits
tits_big_bad_1 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_1_immersive
			}
			desc = trait_tits_big_1
		}
	}

	opposites = {
		tits_big_good
		tits_small_good
		tits_small_bad
	}

	group = tits_big_bad
	level = 1

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_1_desc
			}
			desc = trait_tits_big_1_character_desc
		}
	}
}

# Huge tits
tits_big_bad_2 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_2_immersive
			}
			desc = trait_tits_big_2
		}
	}

	opposites = {
		tits_big_good
		tits_small_good
		tits_small_bad
	}

	group = tits_big_bad
	level = 2

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_2_desc
			}
			desc = trait_tits_big_2_character_desc
		}
	}
}

# Gigantic tits
tits_big_bad_3 = {
	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_game_rule = carn_dt_trait_names_immersive
				}
				desc = trait_tits_big_3_immersive
			}
			desc = trait_tits_big_3
		}
	}

	opposites = {
		tits_big_good
		tits_small_good
		tits_small_bad
	}

	group = tits_big_bad
	level = 3

	genetic = yes
	physical = yes

	birth = 0 # handled through script
	random_creation = 0

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_tits_big_3_desc
			}
			desc = trait_tits_big_3_character_desc
		}
	}
}

slave = { # Chattel Slave
	opposites = {
		former_slave
	}

	diplomacy = -3
	general_opinion = -10
	same_opinion = 10
	monthly_prestige_gain_mult = -0.75
	hostile_scheme_phase_duration_add = minor_scheme_phase_duration_malus_value

	flag = can_not_marry
	flag = can_not_be_granted_titles
	flag = can_not_leave_court_voluntarily
	inheritance_blocker = all
	claim_inheritance_blocker = all

	inherit_chance = 100
	parent_inheritance_sex = female

	shown_in_ruler_designer = no

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_slave_desc
			}
			desc = trait_slave_character_desc
		}
	}
	compatibility = {
		slave = @pos_compat_medium
		former_slave = @pos_compat_medium
	}
}

former_slave = { # Freedman/Freedwoman
	opposites = {
		slave
	}

	name = {
		first_valid = {
			triggered_desc = {
				trigger = { NOT = { exists = this } }
				desc = trait_former_slave_neutral
			}
			triggered_desc = {
				trigger = { is_female = yes }
				desc = trait_former_slave_female
			}
			desc = trait_former_slave_male
		}
	}

	diplomacy = -1

	ruler_designer_cost = 0

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_former_slave_desc
			}
			desc = trait_former_slave_character_desc
		}
	}

	compatibility = {
		slave = @pos_compat_medium
		former_slave = @pos_compat_medium
	}
}

lifestyle_prostitute = {
	category = lifestyle
	icon = prostitute.dds

	minimum_age = 16

	# Modifiers
	intrigue = 1
	flag = carn_no_consequences_for_extramarital_sex_with_others
	triggered_opinion = {
		parameter = carn_prostitution_illegal
		opinion_modifier = carn_prostitution_crime_opinion
		ignore_opinion_value_if_same_trait = yes
	}

	triggered_opinion = {
		parameter = carn_prostitution_shunned
		opinion_modifier = carn_prostitution_intolerant_opinion
		ignore_opinion_value_if_same_trait = yes
	}

	track = {
		50 = {
			diplomacy = 1
			intrigue = 2
			attraction_opinion = 10
			seduce_scheme_phase_duration_add = -10
		}
		100 = {
			diplomacy = 2
			intrigue = 3
			attraction_opinion = 20
			seduce_scheme_phase_duration_add = -20
		}
	}

	ruler_designer_cost = 0

	ai_greed = medium_positive_ai_value
	ai_sociability = medium_positive_ai_value

	name = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_prostitute_1_neutral
			}

			# Masterful Prostitute

			triggered_desc = {
				trigger = {
					is_female = yes
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 100
					}
				}
				desc = trait_prostitute_3_female
			}
			triggered_desc = {
				trigger = {
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 100
					}
				}
				desc = trait_prostitute_3_male
			}

			# Experienced Prostitute

			triggered_desc = {
				trigger = {
					is_female = yes
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 50
					}
				}
				desc = trait_prostitute_2_female
			}
			triggered_desc = {
				trigger = {
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 50
					}
				}
				desc = trait_prostitute_2_male
			}

			# Novice Prostitute

			triggered_desc = {
				trigger = {
					is_female = yes
				}
				desc = trait_prostitute_1_female
			}
			desc = trait_prostitute_1_male
		}
	}

	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					NOT = { exists = this }
				}
				desc = trait_prostitute_1_character_desc
			}
			triggered_desc = {
				trigger = {
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 100
					}
				}
				desc = trait_prostitute_3_character_desc
			}
			triggered_desc = {
				trigger = {
					has_trait_xp = {
						trait = lifestyle_prostitute
						value >= 50
					}
				}
				desc = trait_prostitute_2_character_desc
			}
			desc = trait_prostitute_1_character_desc
		}
	}

	compatibility = {
		lustful = @pos_compat_high
		lifestyle_prostitute = @pos_compat_medium
		lifestyle_reveler = @pos_compat_low
		seducer = @pos_compat_medium
		gregarious = @pos_compat_low
		shy = @neg_compat_low
		chaste = @neg_compat_high
		celibate = @neg_compat_high
	}
}


code:
carn_can_be_granted_titles = {
	first = carn_i_can_be_granted_titles
	first_not = carn_not_i_can_be_granted_titles
	third = carn_they_can_be_granted_titles
	third_not = carn_not_they_can_be_granted_titles
	global = carn_can_be_granted_titles
	global_not = carn_not_can_be_granted_titles
}

carn_can_always_have_sex = {
	first = carn_can_always_have_sex
	third = carn_can_always_have_sex
}

carn_cannot_be_raped = {
	first_not = carn_cannot_be_raped
	third_not = carn_cannot_be_raped
}

carn_cannot_have_max_number_of_slave_prostitutes = {
	first = carn_cannot_have_max_number_of_slave_prostitutes
	third = carn_cannot_have_max_number_of_slave_prostitutes
}

carn_cannot_have_sex = {
	first_not = carn_cannot_have_sex
	third_not = carn_cannot_have_sex
}

carn_effective_age_under_value_cutoff = {
	first = carn_effective_age_under_value_cutoff
	third = carn_effective_age_under_value_cutoff
}

carn_has_any_fetish_trigger = {
	first = carn_i_have_a_fetish_trigger
	first_not = carn_not_i_have_a_fetish_trigger
	third = carn_they_have_a_fetish_trigger
	third_not = carn_not_they_have_a_fetish_trigger
	global = carn_has_any_fetish_trigger
	global_not = carn_not_has_a_fetish_trigger
}

carn_is_busy_in_events_localised = {
	first_not = carn_is_not_diplomatically_available
	third_not = carn_is_not_diplomatically_available
}

carn_is_lactating_trigger = {
	first = carn_i_am_lactating_trigger
	first_not = carn_not_i_am_lactating_trigger
	third = carn_they_are_lactating_trigger
	third_not = carn_not_they_are_lactating_trigger
	global = carn_is_lactating_trigger
	global_not = carn_not_is_lactating_trigger
}

carn_slavery_is_illegal = {
	first_not = carn_slavery_is_illegal
	third_not = carn_slavery_is_illegal
}


code:
version="2.10.0"
tags={
	"Gameplay"
	"Character Interactions"
	"Events"
}
name="Carnalitas"
supported_version="1.16.*"