﻿qs_send_into_hiding_interaction = { # Send into Hiding
	interface_priority = 60
	common_interaction = yes
	category = interaction_category_friendly
	icon = qs_in_hiding
	desc = qs_send_into_hiding_interaction_desc
	
	cost = { 
		prestige = major_prestige_value
	}
	is_shown = {
		has_game_rule = qs_decision_go_into_hiding_enabled
		scope:recipient = {
			OR = {
				is_child_of = scope:actor
				is_spouse_of = scope:actor
			}
			NOT = { has_trait = qs_in_hiding }
		}
	}
	is_valid_showing_failures_only = {
		scope:recipient = {
			is_landed = no
		}
	}
	on_accept = {
		scope:actor = {
			send_interface_toast = {
				title =  qs_send_into_hiding_interaction_title
				left_icon = scope:actor
				right_icon = scope:recipient
				scope:recipient = {	
					add_trait = qs_in_hiding
					add_character_flag = qs_character_sent_into_hiding
					add_character_flag = { # 3 years in hiding
						flag = qs_character_sent_into_hiding_timer
						days = 1095
					}
					if = {
						limit = {
							NOT = { has_trait = paranoid }
						}
						add_opinion = {
							target = scope:actor
							opinion = -25
							modifier = qs_sent_into_hiding_opinion
						}
					}
				}	
			}
		}
	}
	ai_accept = {
		base = 0
		opinion_modifier = {
 			opinion_target = scope:actor
 			multiplier = 0.5
 			step = 5
 			max = 30
 		}
		modifier = {
			has_relation_nemesis = scope:actor
			add = -1000
			desc = QS_AI_YOUR_NEMESIS
		}
		modifier = { 
			has_relation_rival = scope:actor
			NOT = { has_relation_nemesis = scope:actor }
			add = -100
			desc = AI_YOUR_RIVAL
		}
		modifier = {
 			is_adult = yes
 			add = -25
 			desc = QS_INTERACTION_ADULT
 		}
		modifier = {
			has_trait = trusting
			add = -25
			desc = INTERACTION_TRUSTING
		}
		modifier = {
 			is_councillor = yes
			NOT = { is_spouse_of = scope:actor }
 			add = -40
 			desc = QS_AI_ON_THE_COUNCIL
 		}
		modifier = {
 			is_child_of = scope:actor
 			add = 10
 			desc = AI_YOUR_CHILD
 		}
		modifier = {
 			has_relation_friend = scope:actor
 			add = 25
 			desc = AI_YOUR_FRIEND
 		}
		modifier = {
 			has_relation_lover = scope:actor
 			add = 50
 			desc = QS_AI_YOUR_LOVER
 		}
		modifier = {
			has_trait = paranoid
			desc = INTERACTION_PARANOID	
			add = 50
		}
		modifier = {
 			has_character_modifier = watchful_modifier
 			add = 100
 			desc = QS_INTERACTION_WATCHFUL
 		}
		modifier = {
 			is_adult = no
 			add = 200
 			desc = QS_INTERACTION_NOT_ADULT
 		}
	}
	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
		}
	}

	ai_frequency = 24

	ai_will_do = {
		base = 0
		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_character_modifier = watchful_modifier
					any_targeting_scheme = {
						is_hostile = yes
						is_scheme_exposed = yes
					}
				}
			}
		}
	}
	ai_targets = {
		ai_recipients = spouses
	}
	ai_targets = {
		ai_recipients = children
		max = 10
	}
	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
}
qs_take_out_of_hiding_interaction = { # Take out of Hiding
	interface_priority = 60
	common_interaction = yes
	category = interaction_category_friendly
	icon = qs_in_hiding
	desc = qs_take_out_of_hiding_interaction_desc
	
	is_shown = {
		has_game_rule = qs_decision_go_into_hiding_enabled
		scope:recipient = {
			OR = {
				is_child_of = scope:actor
				is_spouse_of = scope:actor
			}
			has_trait = qs_in_hiding
		}
	}
	is_valid_showing_failures_only = {
		scope:recipient = {
			is_landed = no
		}
	}
	on_accept = {
		scope:actor = {
			send_interface_toast = {
				title =  qs_take_out_of_hiding_interaction_title
				left_icon = scope:actor
				right_icon = scope:recipient
				scope:recipient = {	
					remove_trait = qs_in_hiding
					if = {
						limit = {
							has_character_flag = qs_character_is_in_hiding
						}
						remove_character_flag = qs_character_is_in_hiding
					}
					if = {
						limit = {
							has_character_flag = qs_character_sent_into_hiding
						}
						remove_character_flag = qs_character_sent_into_hiding
					}
					if = {
						limit = {
							has_character_flag = qs_character_sent_into_hiding_timer
						}
						remove_character_flag = qs_character_sent_into_hiding_timer
					}
				}	
			}
		}
	}
	ai_accept = {
		base = 25
		opinion_modifier = {
 			opinion_target = scope:actor
 			multiplier = 0.5
 			step = 5
 			max = 30
 		}
		modifier = {
			has_trait = paranoid
			desc = INTERACTION_PARANOID	
			add = -50
		}
		modifier = {
 			has_character_flag = qs_character_is_in_hiding
 			add = -100
 			desc = QS_INTERACTION_WANTS_TO_HIDE
 		}
		modifier = {
 			has_character_modifier = watchful_modifier
 			add = -100
 			desc = QS_INTERACTION_WATCHFUL
 		}
		modifier = { 
			has_relation_rival = scope:actor
			NOT = { has_relation_nemesis = scope:actor }
			add = -100
			desc = AI_YOUR_RIVAL
		}
		modifier = {
			has_relation_nemesis = scope:actor
			add = -1000
			desc = QS_AI_YOUR_NEMESIS
		}
	}
	auto_accept = {
		custom_description = {
			text = "spending_hook"
			subject = scope:actor
			object = scope:recipient
			scope:hook = yes
		}
	}
	
	ai_frequency = 24
	
	ai_will_do = {
		base = 0
		modifier = {
			add = 100
			scope:recipient = {
				has_trait = qs_in_hiding
				has_character_flag = qs_character_sent_into_hiding
				NOT = { has_character_flag = qs_character_sent_into_hiding_timer } 
			}
		}
	}
	
	ai_targets = {
		ai_recipients = spouses
	}
	ai_targets = {
		ai_recipients = children
		max = 10
	}
	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
}