﻿# Shown when an important decision/interaction is available.

#INTERACTIONS
action_invite_spouse_ruler = {
	priority = 200
	check_create_action = {
		if = {
			limit = {
				OR = {
					has_game_rule = lmf_realistic_pregnancies_player_only
					has_game_rule = lmf_realistic_pregnancies_active
				}
				# player is married and can have children
				is_married = yes
				fertility > 0.1
				primary_spouse.fertility > 0.1
				exists = capital_province
				primary_spouse = {
					is_ruler = yes
					sex_opposite_of = root
				}
				trigger_if = {
					limit = { is_female = yes }
					is_pregnant = no
					NOT = { has_character_flag = lmf_no_children }
				}
				trigger_else = {
					primary_spouse = {
						is_pregnant = no
						NOT = { has_character_flag = lmf_no_children }
					}
				}
				OR = {
					NOT = {
						has_inheritable_children = { TOTAL = 1 PREFER = no }
					}
					primary_spouse = {
						NOT = {
							any_child = {
								is_child_of = root
							}
						}
					}
				}
				is_character_interaction_valid = {
					recipient = root.primary_spouse
					interaction = invite_to_visit_interaction
				}
			}
			try_create_important_action = {
				important_action_type = action_invite_spouse_ruler
				actor = root
				recipient = root.primary_spouse
			}
		}
	}

	effect = {
		open_interaction_window = {
			interaction = invite_to_visit_interaction
			actor = scope:actor
			recipient = scope:recipient
		}
	}
}

action_send_courtier_to_spouse = {
	priority = 200
	check_create_action = {
		every_close_family_member = {
			if = {
				limit = {
					OR = {
						is_child_of = root
						is_grandchild_of = root
					}
					root = {
						is_character_interaction_valid = {
							recipient = prev
							interaction = send_to_spouse_court_interaction
						}
					}
				}
				try_create_important_action = {
					important_action_type = action_send_courtier_to_spouse
					actor = root
					recipient = this
				}
			}
		}
	}
	
	effect = {
		open_interaction_window = {
			interaction = send_to_spouse_court_interaction
			actor = scope:actor
			recipient = scope:recipient
		}
	}
}

