### NEW MISTRESS INTERACTION ###

# Invites ANY lover, married or not, to your court to become your mistress.
# Should validate that they can become your mistress.
# Their spouses may be angry at you, or encourage this if they're ambitious

mistress_recruit_interaction = {
	category = interaction_category_vassal
	desc = mistress_recruit_interaction_desc
	
	is_shown = {
		scope:recipient = {
			is_adult = yes
			is_imprisoned = no
			is_ruler = no
			top_liege = scope:actor
			NOT = { is_consort_of = scope:actor }
			NOT = { is_courtier_of = scope:actor }
			
			OR = {
				has_relation_lover = scope:actor
				has_relation_soulmate = scope:actor
			}
		}

		scope:actor = {
			mistress_position_valid_trigger = yes
		}
	}
	
	is_valid_showing_failures_only = {
		custom_tooltip = {
			text = "can_invite_lover_to_court"
			can_recruit_lover_to_court_trigger = {
				RECRUITER = scope:actor
				RECRUITEE = scope:recipient
			}
		}
		
		scope:actor = {
			custom_description = {
				text = "homosexuality_not_accepted"
				trigger_if = {
					limit = {
						sex_same_as = scope:recipient
					}
					OR = {
						custom_description = {
							faith = { has_doctrine_parameter = homosexuality_accepted }
							subject = faith
							text = homosexuality_accepted
						}
						OR = {
							has_trait = arbitrary
							has_trait = lustful
							has_trait = brave
							has_trait = lunatic
						}
					}
				}
			}
		}
		
		scope:actor = {
			NOT = {
				employs_court_position = mistress_court_position
			}
		}
	}
	
	on_accept = {
		hidden_effect = {
			if = {
				limit = {
					exists = scope:recipient.liege
				}
				scope:recipient.liege = {
					send_interface_message = {
						type = event_generic_neutral
						title = msg_courtier_left_court_interaction_title
						
						right_icon = scope:recipient
						
						show_as_tooltip = {
							remove_courtier_or_guest = scope:recipient
						}
					}
				}
			}
		}
		
		scope:actor = {
			trigger_event = mistress_appoint.1001
			send_interface_message = {
				type = event_generic_neutral
				title = invite_to_court_interaction_notification
				right_icon = scope:recipient
				
				scope:recipient = {
					every_traveling_family_member = {
						scope:actor = { add_courtier = prev }
						hidden_effect = {
							return_to_court = yes
						}
					}
				}
			}
		}
	}
		
	ai_accept = {
		base = 0
		
		#Opinions
		opinion_modifier = {
			trigger = {
				exists = liege
				is_courtier_of = liege
			}
			opinion_target = liege
			multiplier = -0.5
			step = 5
			max = 25
		}
		opinion_modifier = {
			opinion_target = scope:actor
			multiplier = 0.5
			step = 5
			max = 25
		}
		
		# Doesn't wanna become gossip
		modifier = {
			sex_same_as = scope:actor
			OR = {
				scope:actor = {
					NOT = { faith = { has_doctrine_parameter = homosexuality_accepted } }
				}
				NOT = { faith = { has_doctrine_parameter = homosexuality_accepted } }
			}
			add = -100
			desc = mistress_fears_repercussions
		}
		
		#Prestiege
		modifier = {
			has_trait = ambitious
			add = 40
			desc = mistress_ambitious_trait
		}
		
		modifier = {
			any_spouse = {
				has_trait = ambitious
			}
			add = 40
			desc = mistress_spouse_ambitious_trait
		}
		
		modifier = {
			any_spouse = {
				has_relation_rival = scope:actor
			}
			add = -100
			desc = mistress_spouse_rival
		}
		
		modifier = {
			scope:actor = {
				OR = {
					dread >= medium_dread
					has_trait = wrathful
				}
			}
			add = 50
			desc = mistress_scared
		}

		#Current roles
		modifier = {
			is_knight = yes
			add = -20
			desc = AI_MY_LIEGES_KNIGHT
		}
		modifier = {
			is_commanding_army = yes
			add = -30
			desc = AI_MY_LIEGES_COMMANDER
		}
		modifier = {
			is_councillor = yes
			add = -40
			desc = AI_ON_THE_COUNCIL
		}
		
		modifier = {
			trigger = { scope:recipient = { has_court_position = court_physician_court_position } }
			add = -20
			desc = AI_COURT_PHYSICIAN
		}
		
		#Relations & relatives (with actor)
		modifier = {
			has_relation_friend = scope:actor
			add = 75
			desc = AI_YOUR_FRIEND
		}

		#Relations & relatives (with host)
		modifier = {
			exists = liege
			has_relation_lover = liege
			add = -100
			desc = AI_THEIR_LOVER
		}
		
		modifier = {
			exists = liege
			has_relation_friend = liege
			add = -75
			desc = AI_THEIR_FRIEND
		}
		
		modifier = {
			exists = liege
			is_child_of = liege
			add = -100
			desc = AI_THEIR_CHILD
		}
		
		modifier = {
			exists = liege
			NOT = { is_child_of = liege }
			is_close_family_of = liege
			add = -75
			desc = AI_THEIR_RELATIVE
		}
		
		#Family (at location)
		modifier = {
			exists = location
			any_consort_not_in_traveling_family_trigger = yes
			desc = AI_LEAVING_MY_SPOUSE
			add = -20
		}
		
		modifier = {
			exists = location
			any_child_not_in_traveling_family_trigger = yes
			desc = AI_LEAVING_MY_CHILD
			add = -50
		}
		
		modifier = {
			add = -50
			desc = AI_INSPIRED
			exists = inspiration
			inspiration = {
				NOT = {
					exists = inspiration_sponsor
				}
			}
		}
		
		modifier = {
			add = -500
			desc = AI_SPONSORED_INSPIRATION
			exists = inspiration
			inspiration = {
				exists = inspiration_sponsor
			}
		}
		
		modifier = {
			add = -500
			desc = AI_WANDERLUST
			is_child_of = scope:actor
			has_character_modifier = lust_for_adventure
		}
		
		# Amenities impact
		## Actor's amenities increases acceptance
		modifier = {
			add = {
				value = 10
				if = {
					limit = {
						scope:actor = {
							has_royal_court = yes
							amenity_level = { type = court_lodging_standards value >=  high_amenity_level }
						}
					}
					add = 10
				}
				if = {
					limit = {
						scope:actor = {
							amenity_level = { type = court_lodging_standards value >=  very_high_amenity_level }
						}
					}
					add = 10
				}
				if = {
					limit = {
						scope:actor = {
							amenity_level = { type = court_lodging_standards value >=  max_amenity_level }
						}
					}
					add = 20
				}
			}
			desc = AI_COURT_LODGING_STANDARDS_QUALITY
			scope:actor = {
				has_royal_court = yes
				amenity_level = { type = court_lodging_standards value >=  medium_amenity_level }
			}
		}
		## Target's liege amenities decreases acceptance
		modifier = {
			add = {
				value = -10
				if = {
					limit = {
						liege = {
							amenity_level = { type = court_lodging_standards value >=  high_amenity_level }
						}
					}
					add = -10
				}
				if = {
					limit = {
						liege = {
							amenity_level = { type = court_lodging_standards value >=  very_high_amenity_level }
						}
					}
					add = -10
				}
				if = {
					limit = {
						liege = {
							amenity_level = { type = court_lodging_standards value >=  max_amenity_level }
						}
					}
					add = -20
				}
			}
			desc = AI_LIEGE_COURT_LODGING_STANDARDS_QUALITY
			exists = liege
			is_courtier_of = liege
			liege = {
				has_royal_court = yes
				amenity_level = { type = court_lodging_standards value >=  medium_amenity_level }
			}
		}
	}
}