﻿lay_with_woman_interaction = {
	category = interaction_category_friendly
	use_diplomatic_range = yes
	interface_priority = 60

	ai_maybe = yes
	ai_min_reply_days = 1
	ai_max_reply_days = 2
	popup_on_receive = yes
	pause_on_receive = yes

	desc = lay_with_woman_interaction_desc

	on_decline_summary = laid_with_decline_summary

	is_shown = {
		has_game_rule = GPT_interactions_enabled
		scope:actor = {
		    is_adult = yes
		 #	fertility > 0
			is_imprisoned = no
			is_female = no
			is_attracted_to_gender_of = scope:recipient
			is_commanding_army = no
			is_available = yes
		}
		scope:recipient = {
			NOT = {
				this = scope:actor
			}
			is_at_same_location = scope:actor
			OR = {
				is_consort_of = scope:actor
				is_courtier_of = scope:actor
				is_pool_guest_of = scope:actor
				has_relation_lover = scope:actor
				has_relation_soulmate = scope:actor
			}
		    is_adult = yes
		 #	fertility > 0
			is_imprisoned = no
			is_female = yes
			is_commanding_army = no
			basic_is_available_ai = yes
			NOT = {
				#is_close_family_of = scope:actor
				has_trait = pregnant
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			custom_description = {
				text = has_attempted_sex_desc
				NOT = {
					has_character_flag = has_attempted_sex
				}
			}
		}

		scope:recipient = {
			age <= 35
			custom_description = {
				text = does_not_want_you_desc
				NOT = { has_sexuality = none }
				OR = {
					is_attracted_to_gender_of = scope:actor
					is_consort_of = scope:actor
				}
				NOR = {
					# has_opinion_modifier = {
					# 	target = scope:actor
					# 	modifier = laid_with_opinion
					# }
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_led_on
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_success_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_midsuccess_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_unsuccess_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_OD_opinion
					}
				}
			}	
		}
	}

	#Use hook
	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
			scope:actor = { has_strong_hook = scope:recipient }
		}
	}

	send_option = {
		is_valid = {
			scope:actor = {
				has_usable_hook = scope:recipient
			}
		}
		flag = hook
		localization = SCHEME_HOOK
	}

	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no


	ai_accept = {
		base = 0 #added 75 for maybe

		# HOOK
		modifier = { #Weak hook
			scope:hook = yes
			add = 25
			scope:actor = { NOT = { has_strong_hook = scope:recipient } }
			desc = SCHEME_WEAK_HOOK_USED
		}

		# OPINION INFLUENCE
		modifier = {
			add = intimidated_external_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_external_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}

		modifier = { # They are Married
			desc = lay_with_partner_aibehavior_marriedthey_tt
			scope:recipient = {
				AND = {
					is_married = yes
					NOT = {
						is_consort_of = scope:actor
					}
				}
			}	
			add = -25
		}

		modifier = { # I am Married
			desc = lay_with_partner_aibehavior_marriedme_tt
			scope:actor = {
				AND = {
					is_married = yes
					NOT = {
						is_consort_of = scope:recipient
					}
				}	
			}
			add = -15
		}	

		modifier = { # Your are both single
			desc = lay_with_partner_aibehavior_single_tt
			AND = {
				scope:actor = {
					AND = {
						is_married = no
						is_betrothed = no
					}
				}
				scope:recipient = {
					AND = {
						is_married = no
						is_betrothed = no
					}
				}
			}
			add = 20
		}

		opinion_modifier = { #Compare Opinion of Spouse
			trigger = {
				scope:recipient = {
					is_married = yes
					NOT = {
						is_consort_of = scope:actor
					}
				}
			}
			who = scope:recipient
			opinion_target = scope:recipient.primary_spouse
			multiplier = -0.75
			desc = lay_with_partner_aibehavior_theyrespouse_tt
		}

		opinion_modifier = { #Compare Opinion modifier.
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.45
		}

		modifier = { # They not into you
			desc = lay_with_partner_aibehavior_gender_tt
			scope:recipient = {
				NOT = {
					is_attracted_to_gender_of = scope:actor
				}
			}	
			add = -50
		}

		modifier = { # They are young
			desc = lay_with_partner_aibehavior_youngthey_tt
			scope:recipient = {
				AND = {
					age <= 20
					age >= 18
				}
			}	
			add = 10
		}

		modifier = { # They are naive
			desc = lay_with_partner_aibehavior_naivethey_tt
			scope:recipient = {
					age <= 17
				}
			add = 20
		}

		modifier = { # Virgin
			desc = lay_with_partner_aibehavior_virgin_tt
			scope:recipient = {
				AND = {
					is_likely_virgin = yes
					NOT = {
						has_character_flag = not_virgin
					}
				}	
			}
			add = -15
		}

		modifier = { # They are bonded with you
			desc = lay_with_partner_aibehavior_spousethey_tt
			scope:recipient = {
				is_consort_of = scope:actor
			}
			add = 75
		}
		
		modifier = { # They are a secondary spouse
			desc = lay_with_partner_aibehavior_secspousethey_tt
			scope:recipient = {
				is_concubine_of = scope:actor
			}
			add = 25
		}

		modifier = { # No Heirs
			desc = lay_with_partner_aibehavior_heirs_tt
			OR = {
				AND = {
					scope:recipient = { is_consort_of = scope:actor }
					scope:actor = {
						NOT = {
							any_child = {
								is_heir_of = scope:actor
							}
						}
					}
				}		
				scope:actor = {
					AND = {
						age > 30
						scope:actor = {
							NOT = {
								any_child = {
									is_heir_of = scope:actor
								}
							}
						}
					}	
				}	
			}
			add = 20
		}

		modifier = { # They are Courtier
			desc = lay_with_partner_aibehavior_courtierthey_tt
			scope:recipient = {
				is_courtier_of = scope:actor
				NOT = {is_spouse_of = scope:actor
				}
				NOT = {is_concubine_of = scope:actor
				}
				NOT = {has_relation_lover = scope:actor
				}
				NOT = {has_relation_soulmate = scope:actor
				}
			}
			add = 10
		}	
		
		modifier = { # They are Guest
			desc = lay_with_partner_aibehavior_guestthey_tt
			scope:recipient = {
				is_pool_guest_of = scope:actor
				NOT = {is_spouse_of = scope:actor
				}
				NOT = {is_concubine_of = scope:actor
				}
				NOT = {has_relation_lover = scope:actor
				}
				NOT = {has_relation_soulmate = scope:actor
				}
			}
			add = -10
		}
		
		
		modifier = { # They are Betrothed
			desc = lay_with_partner_aibehavior_betrothedthey_tt
			scope:recipient = {
				is_betrothed = yes
				NOT = {
					this = scope:actor.betrothed
				}
			}
			add = -15
		}	
	
		
		modifier = { # I am Betrothed
			desc = lay_with_partner_aibehavior_betrothedme_tt
			scope:actor = {
				is_betrothed = yes
				NOT = {
					this = scope:recipient.betrothed
				}
			}
			add = -10
		}	

		modifier = { # I am Celibate
			desc = lay_with_partner_aibehavior_celibateme_tt
			scope:actor = {
				has_trait = celibate
			}
			add = -100
		}

		modifier = { # They are Celibate
			desc = lay_with_partner_aibehavior_celibatethey_tt
			scope:recipient = {
				has_trait = celibate
			}
			add = -100
		}

		modifier = { # Lustful
			desc = lay_with_partner_aibehavior_lustful_tt
			scope:recipient = {
				has_trait = lustful
			}
			add = 35
		}

		modifier = { # Chaste
			desc = lay_with_partner_aibehavior_chaste_tt
			scope:recipient = {
				has_trait = chaste
			}
			add = -25
		}

		modifier = { # Shy
			desc = lay_with_partner_aibehavior_shy_tt
			scope:recipient = {
				has_trait = shy
			}
			add = -10
		}

		modifier = { # Trusting
			desc = lay_with_partner_aibehavior_trusting_tt
			scope:recipient = {
				has_trait = trusting
			}
			add = 10
		}

		modifier = { # I have Lover's Pox
			desc = lay_with_partner_aibehavior_loverspoxme_tt
			scope:actor = {
				has_trait = lovers_pox
			}
			add = -30
		}

		modifier = { # They have Lover's Pox
			desc = lay_with_partner_aibehavior_loverspoxthey_tt
			scope:recipient = {
				has_trait = lovers_pox
			}
			add = -20
		}

		modifier = { # I have Great Pox
			desc = lay_with_partner_aibehavior_greatpoxme_tt
			scope:actor = {
				has_trait = great_pox
			}
			add = -40
		}

		modifier = { # They have Great Pox
			desc = lay_with_partner_aibehavior_greatpoxthey_tt
			scope:recipient = {
				has_trait = great_pox
			}
			add = -25
		}

		modifier = { # I am Impotent
			desc = lay_with_partner_aibehavior_impotentme_tt
			scope:actor = {
				has_trait = impotent
			}
			add = -10
		}

		modifier = { # They are Impotent
			desc = lay_with_partner_aibehavior_impotentthey_tt
			scope:recipient = {
				has_trait = impotent
			}
			add = -15
		}

		modifier = { # I have Gout
			desc = lay_with_partner_aibehavior_goutme_tt
			scope:actor = {
				has_trait = gout_ridden 
			}
			add = -20
		}

		modifier = { # They have Gout
			desc = lay_with_partner_aibehavior_goutthey_tt
			scope:recipient = {
				has_trait = gout_ridden
			}
			add = -15
		}

		modifier = { # I am Ill
			desc = lay_with_partner_aibehavior_illme_tt
			scope:actor = {
				has_trait = ill
			}
			add = -25
		}

		modifier = { # They are Ill
			desc = lay_with_partner_aibehavior_illthey_tt
			scope:recipient = {
				has_trait = ill
			}
			add = -20
		}

		modifier = { # I have Pneumonia
			desc = lay_with_partner_aibehavior_pneumonicme_tt
			scope:actor = {
				has_trait = pneumonic
			}
			add = -40
		}

		modifier = { # They have Pneumonia
			desc = lay_with_partner_aibehavior_pneumonicthey_tt
			scope:recipient = {
				has_trait = pneumonic
			}
			add = -30
		}

		modifier = { # I have Consumption
			desc = lay_with_partner_aibehavior_consumptionme_tt
			scope:actor = {
				has_trait = consumption
			}
			add = -35
		}

		modifier = { # They have Consumption
			desc = lay_with_partner_aibehavior_consumptionthey_tt
			scope:recipient = {
				has_trait = consumption
			}
			add = -25
		}

		modifier = { # I have Smallpox
			desc = lay_with_partner_aibehavior_smallpoxme_tt
			scope:actor = {
				has_trait = smallpox
			}
			add = -60
		}

		modifier = { # They have Smallpox
			desc = lay_with_partner_aibehavior_smallpoxthey_tt
			scope:recipient = {
				has_trait = smallpox
			}
			add = -50
		}

		modifier = { # I have Typhus
			desc = lay_with_partner_aibehavior_typhusme_tt
			scope:actor = {
				has_trait = typhus
			}
			add = -65
		}

		modifier = { # They have Typhus
			desc = lay_with_partner_aibehavior_typhusthey_tt
			scope:recipient = {
				has_trait = typhus
			}
			add = -55
		}

		modifier = { # I have Plague
			desc = lay_with_partner_aibehavior_plagueme_tt
			scope:actor = {
				has_trait = bubonic_plague
			}
			add = -80
		}

		modifier = { # They have Plague
			desc = lay_with_partner_aibehavior_plaguethey_tt
			scope:recipient = {
				has_trait = bubonic_plague
			}
			add = -75
		}

		modifier = { # I have Leprosy
			desc = lay_with_partner_aibehavior_leperme_tt
			scope:actor = {
				has_trait = leper
			}
			add = -95
		}

		modifier = { # They have Leprosy
			desc = lay_with_partner_aibehavior_leperthey_tt
			scope:recipient = {
				has_trait = leper
			}
			add = -90
		}

		modifier = { #I am a King!
			desc = lay_with_partner_aibehavior_amking_tt
			trigger = {
				scope:actor = { highest_held_title_tier = tier_kingdom }
			}
			add = 20
		}

		modifier = { #I am an Emperor!
			desc = lay_with_partner_aibehavior_amking_tt
			trigger = {
				scope:actor = { highest_held_title_tier = tier_empire }
			}
			add = 35
		}

		modifier = { #Friend modifier.
			desc = offer_vassalization_interaction_aibehavior_friend_tt
			trigger = {
				scope:recipient = {
					has_relation_friend = scope:actor
					NOT = { has_relation_best_friend = scope:actor }
				}
			}
			add = 10
		}
		
		modifier = { #Best Friend modifier.
			desc = offer_vassalization_interaction_aibehavior_best_friend_tt
			trigger = {
				scope:recipient = {
					has_relation_best_friend = scope:actor
				}
			}
			add = 20
		}

		modifier = { #Lover Modifier
			desc = lay_with_partner_aibehavior_lover_tt
			trigger = {
				scope:recipient = {
					has_relation_lover = scope:actor
				}
			}
			add = 30
		}

		modifier = { #Soulmate Modifier
			desc = lay_with_partner_aibehavior_soulmate_tt
			trigger = {
				scope:recipient = {
					has_relation_soulmate = scope:actor
				}
			}
			add = 40
		}

		modifier = { #Rivalry modifier.
			desc = offer_vassalization_interaction_aibehavior_rival_tt
			trigger = {
				scope:recipient = {
					has_relation_rival = scope:actor
					NOT = { has_relation_nemesis = scope:actor }
				}
			}
			add = -25
		}
		
		modifier = { #Nemesis modifier.
			desc = offer_vassalization_interaction_aibehavior_nemesis_tt
			trigger = {
				scope:recipient = {
					has_relation_nemesis = scope:actor
				}
			}
			add = -75
		}
		
		modifier = { #Language modifiers.
			desc = speaks_same_language_interaction_reason
			add = 10
			scope:actor = {
				knows_language_of_culture = scope:recipient.culture
			}
		}	 
		
		modifier = { #Cultural modifiers.
			desc = offer_vassalization_interaction_aibehavior_culture_tt
			add = -10
			scope:actor = {
				NOT = { has_same_culture_as = scope:recipient }
			}
		}

		modifier = { #Heritage modifiers.
			desc = offer_vassalization_interaction_aibehavior_culture_group_tt
			add = -15
			scope:actor = {
				NOT = { culture = { has_same_culture_heritage = scope:recipient.culture } }
			}
		}

		modifier = { #Faith modifiers.
			desc = offer_vassalization_interaction_aibehavior_differentfaith_tt
			add = -25
			scope:actor = {
				NOT = { faith = scope:recipient.faith }
			}
		}

		modifier = { #Close Family modifier.
			desc = lay_with_partner_aibehavior_clfamily_tt
			add = -75
			scope:actor = {
				AND = {
					is_close_family_of = scope:recipient
					NOR = {
						is_consort_of = scope:recipient
						has_relation_lover = scope:recipient
						has_relation_soulmate = scope:recipient
					}
				}
			}
		}
		
		modifier = { #Extended Family modifier.
			desc = lay_with_partner_aibehavior_exfamily_tt
			add = -30
			scope:actor = {
				AND = {
					is_extended_family_of = scope:recipient
					NOR = {
						is_consort_of = scope:recipient
						has_relation_lover = scope:recipient
						has_relation_soulmate = scope:recipient
					}
				}
			}
		}

	}

	ai_will_do = {
		base = 0 #The AI should never do this!
	}

	on_accept = {
		scope:actor = {
			if = {
				limit = {
					has_usable_hook = scope:recipient
					scope:recipient = {
						NOT = {
							has_trait = lustful
						}
					}
				}
				use_hook = scope:recipient
			}
		}

		scope:actor = {
			trigger_event = lay_with_woman.20
			add_character_flag = {
				flag = has_attempted_sex
				days = 30 #was 14 - Decreased to prevent baby spamming in Polygamous Cultures
			}
		}

		scope:actor = {
			IF = {
				limit = {
					scope:recipient = {
						NOR = {
							is_consort_of = scope:actor
							has_relation_lover = scope:actor
							has_relation_soulmate = scope:actor
							is_close_or_extended_family_of = scope:actor
						}
					}
				}
			add_prestige = miniscule_prestige_gain
			}
		}

		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = laid_with_opinion
			}	
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						NOT = {
							is_consort_of = scope:actor
						}	
						age <= 17 
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_smitten
				}	
			}
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						age <= 20
						age >= 18
						NOT = {
							is_consort_of = scope:actor
						}
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_enamored
				}	
			}
		}
	}

	on_decline = {
		scope:actor = {
			trigger_event = failed_to_lay.01
			stress_impact = {
				base = minor_stress_impact_gain
				chaste = medium_stress_impact_gain
				lustful = miniscule_stress_impact_gain
				shy = medium_stress_impact_gain
			}
			add_character_flag = {
				flag = has_attempted_sex
				days = 30 #was 14 - Decreased to prevent baby spamming in Polygamous Cultures
			}
		}

		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = laid_with_OD_opinion
			}	
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						NOT = {
							is_consort_of = scope:actor
						}	
						age <= 17 
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_OD_smitten
				}	
			}
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						age <= 20
						age >= 18
						NOT = {
							is_consort_of = scope:actor
						}
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_OD_enamored
				}	
			}
		}
	}
}


lay_with_man_interaction = {
	category = interaction_category_friendly
	use_diplomatic_range = yes

	ai_maybe = yes
	ai_min_reply_days = 1
	ai_max_reply_days = 2
	popup_on_receive = yes
	pause_on_receive = yes

	desc = lay_with_man_interaction_desc

	on_decline_summary = laid_with_decline_summary

	is_shown = {
		has_game_rule = GPT_interactions_enabled
		scope:actor = {
		    is_adult = yes
			fertility > 0
			is_imprisoned = no
			is_female = yes
			is_attracted_to_gender_of = scope:recipient
			is_commanding_army = no
			is_available = yes
			NOT = { has_trait = pregnant }
		}
		scope:recipient = {
			NOT = {
				this = scope:actor
			}
			is_at_same_location = scope:actor
			OR = {
				is_spouse_of = scope:actor
				is_concubine_of = scope:actor
				is_consort_of = scope:actor
				is_courtier_of = scope:actor
				is_pool_guest_of = scope:actor
				has_relation_lover = scope:actor
				has_relation_soulmate = scope:actor
			}
		    is_adult = yes
			fertility > 0
			is_imprisoned = no
			is_female = no
			is_commanding_army = no
			basic_is_available_ai = yes
			NOT = {
			#is_close_family_of = scope:actor
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			age <= 40
			custom_description = {
				text = has_attempted_sex_desc
				NOT = {
					has_character_flag = has_attempted_sex
			 	}
			}
		}

		scope:recipient = {
			custom_description = {
				text = does_not_want_you_desc
				NOT = { has_sexuality = none }
				OR = {
					is_attracted_to_gender_of = scope:actor
					is_consort_of = scope:actor
				}
				NOR = {
					# has_opinion_modifier = {
					# 	target = scope:actor
					# 	modifier = laid_with_opinion
					# }
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_led_on
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_success_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_midsuccess_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_unsuccess_opinion
					}
					has_opinion_modifier = {
						target = scope:actor
						modifier = laid_with_OD_opinion
					}
				}
			}	
		}
	}

	#Use hook
	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
			scope:actor = { has_strong_hook = scope:recipient }
		}
	}

	send_option = {
		is_valid = {
			scope:actor = {
				has_usable_hook = scope:recipient
			}
		}
		flag = hook
		localization = SCHEME_HOOK
	}

	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no


	ai_accept = {
		base = 0 #added 75 for maybe

		# HOOK
		modifier = { #Weak hook
			scope:hook = yes
			add = 25
			scope:actor = { NOT = { has_strong_hook = scope:recipient } }
			desc = SCHEME_WEAK_HOOK_USED
		}

		# OPINION INFLUENCE
		modifier = {
			add = intimidated_external_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 1
				}
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_external_reason_value
			scope:recipient = {
				has_dread_level_towards = {
					target = scope:actor
					level = 2
				}
			}
			desc = COWED_REASON
		}

		modifier = { # They are Married
			desc = lay_with_partner_aibehavior_marriedthey_tt
			scope:recipient = {
				AND = {
					is_married = yes
					NOT = {
						is_consort_of = scope:actor
					}
				}
			}	
			add = -20
		}

		modifier = { # I am Married
			desc = lay_with_partner_aibehavior_marriedme_tt
			scope:actor = {
				AND = {
					is_married = yes
					NOT = {
						is_consort_of = scope:recipient
					}
				}
			}
			add = -10
		}	

		modifier = { # Your are both single
			desc = lay_with_partner_aibehavior_single_tt
			AND = {
				scope:actor = {
					AND = {
						is_married = no
						is_betrothed = no
					}
				}
				scope:recipient = {
					AND = {
						is_married = no
						is_betrothed = no
					}
				}
			}
			add = 20
		}

		opinion_modifier = { #Compare Opinion of Spouse
			trigger = {
				scope:recipient = {
					is_married = yes
					NOT = {
						is_consort_of = scope:actor
					}
				}
			}
			who = scope:recipient
			opinion_target = scope:recipient.primary_spouse
			multiplier = -0.75
			desc = lay_with_partner_aibehavior_theyrespouse_tt
		}

		opinion_modifier = { #Compare Opinion modifier.
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
		}

		modifier = { # They not into you
			desc = lay_with_partner_aibehavior_gender_tt
			scope:recipient = {
				NOT = {
					is_attracted_to_gender_of = scope:actor
				}
			}	
			add = -50
		}

		modifier = { # They are young
			desc = lay_with_partner_aibehavior_youngthey_tt
			scope:recipient = {
				AND = {
					age <= 20
					age >= 18
				}
			}	
			add = 15
		}

		modifier = { # They are naive
			desc = lay_with_partner_aibehavior_naivethey_tt
			scope:recipient = {
					age <= 17
				}
			add = 25
		}

		modifier = { # Virgin
			desc = lay_with_partner_aibehavior_virgin_tt
			scope:recipient = {
				AND = {
					is_likely_virgin = yes
					NOT = {
						has_character_flag = not_virgin
					}
				}	
			}
			add = -10
		}

		modifier = { # They are bonded with you
			desc = lay_with_partner_aibehavior_spousethey_tt
			scope:recipient = {
				is_consort_of = scope:actor
			}
			add = 75
		}

		modifier = { # They are a secondary spouse
			desc = lay_with_partner_aibehavior_secspousethey_tt
			scope:recipient = {
				is_concubine_of = scope:actor
			}
			add = 25
		}

		modifier = { # No Heirs
			desc = lay_with_partner_aibehavior_heirs_tt
			OR = {
				AND = {
					scope:recipient = { is_consort_of = scope:actor }
					scope:actor = {
						NOT = {
							any_child = {
								is_heir_of = scope:actor
							}
						}
					}
				}		
				scope:actor = {
					AND = {
						age > 30
						scope:actor = {
							NOT = {
								any_child = {
									is_heir_of = scope:actor
								}
							}
						}
					}	
				}	
			}
			add = 25
		}

		modifier = { # They are Courtier
			desc = lay_with_partner_aibehavior_courtierthey_tt
			scope:recipient = {
				is_courtier_of = scope:actor
				NOT = {is_spouse_of = scope:actor
				}
				NOT = {is_concubine_of = scope:actor
				}
				NOT = {has_relation_lover = scope:actor
				}
				NOT = {has_relation_soulmate = scope:actor
				}
			}
			add = 15
		}		

		modifier = { # They are Guest
			desc = lay_with_partner_aibehavior_guestthey_tt
			scope:recipient = {
				is_pool_guest_of = scope:actor
				NOT = {is_spouse_of = scope:actor
				}
				NOT = {is_concubine_of = scope:actor
				}
				NOT = {has_relation_lover = scope:actor
				}
				NOT = {has_relation_soulmate = scope:actor
				}
			}
			add = -10
		}
		

		modifier = { # They are Betrothed
			desc = lay_with_partner_aibehavior_betrothedthey_tt
			scope:recipient = {
				is_betrothed = yes
				NOT = {
					this = scope:actor.betrothed
				}
			}
			add = -10
		}	

		
		modifier = { # I am Betrothed
			desc = lay_with_partner_aibehavior_betrothedme_tt
			scope:actor = {
				is_betrothed = yes
				NOT = {
					this = scope:recipient.betrothed
				}
			}
			add = -10
		}	

		modifier = { # I am Celibate
			desc = lay_with_partner_aibehavior_celibateme_tt
			scope:actor = {
				has_trait = celibate
			}
			add = -100
		}

		modifier = { # They are Celibate
			desc = lay_with_partner_aibehavior_celibatethey_tt
			scope:recipient = {
				has_trait = celibate
			}
			add = -100
		}

		modifier = { # Lustful
			desc = lay_with_partner_aibehavior_lustful_tt
			scope:recipient = {
				has_trait = lustful
			}
			add = 35
		}

		modifier = { # Chaste
			desc = lay_with_partner_aibehavior_chaste_tt
			scope:recipient = {
				has_trait = chaste
			}
			add = -20
		}

		modifier = { # Shy
			desc = lay_with_partner_aibehavior_shy_tt
			scope:recipient = {
				has_trait = shy
			}
			add = -5
		}

		modifier = { # Trusting
			desc = lay_with_partner_aibehavior_trusting_tt
			scope:recipient = {
				has_trait = trusting
			}
			add = 15
		}

		modifier = { # I have Lover's Pox
			desc = lay_with_partner_aibehavior_loverspoxme_tt
			scope:actor = {
				has_trait = lovers_pox
			}
			add = -30
		}

		modifier = { # They have Lover's Pox
			desc = lay_with_partner_aibehavior_loverspoxthey_tt
			scope:recipient = {
				has_trait = lovers_pox
			}
			add = -15
		}

		modifier = { # I have Great Pox
			desc = lay_with_partner_aibehavior_greatpoxme_tt
			scope:actor = {
				has_trait = great_pox
			}
			add = -40
		}

		modifier = { # They have Great Pox
			desc = lay_with_partner_aibehavior_greatpoxthey_tt
			scope:recipient = {
				has_trait = great_pox
			}
			add = -20
		}

		modifier = { # I am Impotent
			desc = lay_with_partner_aibehavior_impotentme_tt
			scope:actor = {
				has_trait = impotent
			}
			add = -10
		}

		modifier = { # They are Impotent
			desc = lay_with_partner_aibehavior_impotentthey_tt
			scope:recipient = {
				has_trait = impotent
			}
			add = -15
		}

		modifier = { # I have Gout
			desc = lay_with_partner_aibehavior_goutme_tt
			scope:actor = {
				has_trait = gout_ridden 
			}
			add = -20
		}

		modifier = { # They have Gout
			desc = lay_with_partner_aibehavior_goutthey_tt
			scope:recipient = {
				has_trait = gout_ridden
			}
			add = -10
		}

		modifier = { # I am Ill
			desc = lay_with_partner_aibehavior_illme_tt
			scope:actor = {
				has_trait = ill
			}
			add = -25
		}

		modifier = { # They are Ill
			desc = lay_with_partner_aibehavior_illthey_tt
			scope:recipient = {
				has_trait = ill
			}
			add = -20
		}

		modifier = { # I have Pneumonia
			desc = lay_with_partner_aibehavior_pneumonicme_tt
			scope:actor = {
				has_trait = pneumonic
			}
			add = -40
		}

		modifier = { # They have Pneumonia
			desc = lay_with_partner_aibehavior_pneumonicthey_tt
			scope:recipient = {
				has_trait = pneumonic
			}
			add = -30
		}

		modifier = { # I have Consumption
			desc = lay_with_partner_aibehavior_consumptionme_tt
			scope:actor = {
				has_trait = consumption
			}
			add = -30
		}

		modifier = { # They have Consumption
			desc = lay_with_partner_aibehavior_consumptionthey_tt
			scope:recipient = {
				has_trait = consumption
			}
			add = -25
		}

		modifier = { # I have Smallpox
			desc = lay_with_partner_aibehavior_smallpoxme_tt
			scope:actor = {
				has_trait = smallpox
			}
			add = -60
		}

		modifier = { # They have Smallpox
			desc = lay_with_partner_aibehavior_smallpoxthey_tt
			scope:recipient = {
				has_trait = smallpox
			}
			add = -50
		}

		modifier = { # I have Typhus
			desc = lay_with_partner_aibehavior_typhusme_tt
			scope:actor = {
				has_trait = typhus
			}
			add = -65
		}

		modifier = { # They have Typhus
			desc = lay_with_partner_aibehavior_typhusthey_tt
			scope:recipient = {
				has_trait = typhus
			}
			add = -55
		}

		modifier = { # I have Plague
			desc = lay_with_partner_aibehavior_plagueme_tt
			scope:actor = {
				has_trait = bubonic_plague
			}
			add = -80
		}

		modifier = { # They have Plague
			desc = lay_with_partner_aibehavior_plaguethey_tt
			scope:recipient = {
				has_trait = bubonic_plague
			}
			add = -75
		}

		modifier = { # I have Leprosy
			desc = lay_with_partner_aibehavior_leperme_tt
			scope:actor = {
				has_trait = leper
			}
			add = -95
		}

		modifier = { # They have Leprosy
			desc = lay_with_partner_aibehavior_leperthey_tt
			scope:recipient = {
				has_trait = leper
			}
			add = -90
		}

		modifier = { #I am a King!
			desc = lay_with_partner_aibehavior_amking_tt
			trigger = {
				scope:actor = { highest_held_title_tier = tier_kingdom }
			}
			add = 15
		}

		modifier = { #I am an Emperor!
			desc = lay_with_partner_aibehavior_amking_tt
			trigger = {
				scope:actor = { highest_held_title_tier = tier_empire }
			}
			add = 35
		}

		modifier = { #Friend modifier.
			desc = offer_vassalization_interaction_aibehavior_friend_tt
			trigger = {
				scope:recipient = {
					has_relation_friend = scope:actor
					NOT = { has_relation_best_friend = scope:actor }
				}
			}
			add = 20
		}
		
		modifier = { #Best Friend modifier.
			desc = offer_vassalization_interaction_aibehavior_best_friend_tt
			trigger = {
				scope:recipient = {
					has_relation_best_friend = scope:actor
				}
			}
			add = 30
		}

		modifier = { #Lover Modifier
			desc = lay_with_partner_aibehavior_lover_tt
			trigger = {
				scope:recipient = {
					has_relation_lover = scope:actor
				}
			}
			add = 30
		}

		modifier = { #Soulmate Modifier
			desc = lay_with_partner_aibehavior_soulmate_tt
			trigger = {
				scope:recipient = {
					has_relation_soulmate = scope:actor
				}
			}
			add = 40
		}

		modifier = { #Rivalry modifier.
			desc = offer_vassalization_interaction_aibehavior_rival_tt
			trigger = {
				scope:recipient = {
					has_relation_rival = scope:actor
					NOT = { has_relation_nemesis = scope:actor }
				}
			}
			add = -25
		}
		
		modifier = { #Nemesis modifier.
			desc = offer_vassalization_interaction_aibehavior_nemesis_tt
			trigger = {
				scope:recipient = {
					has_relation_nemesis = scope:actor
				}
			}
			add = -75
		}
		
		modifier = { #Language modifiers.
			desc = speaks_same_language_interaction_reason
			add = 10
			scope:actor = {
				knows_language_of_culture = scope:recipient.culture
			}
		}	 
		
		modifier = { #Cultural modifiers.
			desc = offer_vassalization_interaction_aibehavior_culture_tt
			add = -10
			scope:actor = {
				NOT = { has_same_culture_as = scope:recipient }
			}
		}

		modifier = { #Heritage modifiers.
			desc = offer_vassalization_interaction_aibehavior_culture_group_tt
			add = -15
			scope:actor = {
				NOT = { culture = { has_same_culture_heritage = scope:recipient.culture } }
			}
		}

		modifier = { #Faith modifiers.
			desc = offer_vassalization_interaction_aibehavior_differentfaith_tt
			add = -25
			scope:actor = {
				NOT = { faith = scope:recipient.faith }
			}
		}

		modifier = { #Close Family modifier.
			desc = lay_with_partner_aibehavior_clfamily_tt
			add = -70
			scope:actor = {
				AND = {
					is_close_family_of = scope:recipient
					NOR = {
						is_consort_of = scope:recipient
						has_relation_lover = scope:recipient
						has_relation_soulmate = scope:recipient
					}
				}
			}
		}	

		modifier = { #Extended Family modifier.
			desc = lay_with_partner_aibehavior_exfamily_tt
			add = -30
			scope:actor = {
				AND = {
					is_extended_family_of = scope:recipient
					NOR = {
						is_consort_of = scope:recipient
						has_relation_lover = scope:recipient
						has_relation_soulmate = scope:recipient
					}
				}
			}
		}

		
	}

	ai_will_do = {
		base = 0 #The AI should never do this!
	}

	on_accept = {
		scope:actor = {
			if = {
				limit = {
					has_usable_hook = scope:recipient
					scope:recipient = {
						NOT = {
							has_trait = lustful
						}
					}
				}
				use_hook = scope:recipient
			}
		}

		scope:actor = {
			trigger_event = lay_with_man.20
			add_character_flag = {
				flag = has_attempted_sex
				days = 30 #was 14 - Decreased to prevent baby spamming in Polygamous Cultures
			}
		}

		scope:actor = {
			IF = {
				limit = {
					scope:recipient = {
						NOR = {
							is_consort_of = scope:actor
							has_relation_lover = scope:actor
							has_relation_soulmate = scope:actor
							is_close_or_extended_family_of = scope:actor
						}
					}
				}
			add_prestige = miniscule_prestige_gain
			}
		}

		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = laid_with_opinion
			}
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						NOT = {
							is_consort_of = scope:actor
						}	
						age <= 17
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_smitten
				}	
			}
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						age <= 20
						age >= 18
						NOT = {
							is_consort_of = scope:actor
						}
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_enamored
				}	
			}
		}
	}

	on_decline = {
		scope:actor = {
			trigger_event = failed_to_lay.01
			stress_impact = {
				base = minor_stress_impact_gain
				chaste = medium_stress_impact_gain
				lustful = miniscule_stress_impact_gain
				shy = medium_stress_impact_gain
			}
			add_character_flag = {
				flag = has_attempted_sex
				days = 30 #was 14 - Decreased to prevent baby spamming in Polygamous Cultures
			}
		}

		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = laid_with_OD_opinion
			}	
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						NOT = {
							is_consort_of = scope:actor
						}	
						age <= 17 
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_OD_smitten
				}	
			}
		}

		scope:recipient = { 
			if = {
				limit = {
					AND = {
						age <= 20
						age >= 18
						NOT = {
							is_consort_of = scope:actor
						}
					}
				}	
				add_opinion = {
					target = scope:actor
					modifier = laid_with_OD_enamored
				}	
			}
		}
	}
}