﻿
#### Break Betrothal Interacion

rk_break_betrothal_interaction = {
    icon = icon_marriage
	category = interaction_category_friendly
	common_interaction = no
	interface_priority = -1
	desc = rk_break_betrothal_interaction_desc
    
    is_highlighted = { always = no }
    
	ai_maybe = yes
	ai_max_reply_days = 0
	popup_on_receive = yes
	pause_on_receive = yes
	use_diplomatic_range = yes
	can_send_despite_rejection = yes
	
	#ai_will_do = { base = 0 }
	#ai_frequency = 0
	#ai_potential = { always = no }
	ai_min_reply_days = 1
	ai_max_reply_days = 1	
    
	is_shown = {
		scope:actor = {
			is_ai = no	
			has_title = title:h_the_iron_throne
		}	
		scope:recipient = {
			exists = liege
			OR = {
				liege = {
					is_vassal_or_below_of = scope:actor				
				}
				is_vassal_or_below_of = scope:actor		
			}							
			is_ai = yes
			NOT = { this = scope:actor }	
            is_betrothed = yes			
		}

	}
	can_send = {
		scope:recipient = {
			NOT = { this = scope:actor }
			is_imprisoned = no
		}
		scope:actor = {
			is_ai = no	
			is_imprisoned = no
		}
	}	
	is_valid_showing_failures_only = {
		scope:recipient = { 
			NOR = {
				is_at_war_with = scope:actor
			}
		} 
	} 
    #send_option = {
    #    flag = flag_break
    #    localization = rk_flag_break
    #}
    #send_options_exclusive = yes  
	on_accept = {	
        scope:recipient = {
			if = {
				limit = {
					NOT = {
						liege = scope:actor		
					}				
				}
				liege = {
					save_scope_as = rk_liege
				}
			}
			#custom_tooltip = rk_break_betrothal_interaction_accept_desc_a
            scope:recipient.betrothed = { save_scope_as = the_betrothed }
            break_betrothal = scope:the_betrothed
			add_opinion = {
				modifier = angry_opinion
				opinion = -20				
				target = scope:actor
			}				
            #switch = {
            #    trigger = yes
                
            #    scope:flag_break = {
            #    }
            #}
			scope:rk_liege = {
				add_opinion = {
					modifier = angry_opinion
					opinion = -20				
					target = scope:actor
				}			
			}
            
        }
		scope:actor = { 
			send_interface_toast = {
				title = rk_break_betrothal_interaction_interface_toast_accept
				left_icon = scope:recipient
				add_piety = -150
				add_tyranny = 5
				stress_impact = {
					craven = medium_stress_impact_gain
					shy = medium_stress_impact_gain
					trusting = medium_stress_impact_gain
					compassionate = medium_stress_impact_gain
					arrogant = medium_stress_impact_loss
					paranoid = major_stress_impact_loss
				}			
			}			
		}	
		scope:the_betrothed = {
			add_opinion = {
				modifier = angry_opinion
				opinion = -10				
				target = scope:actor
			}							
		}
	}
	on_decline = { 
		scope:recipient = { 
			add_prestige = -150
			if = {
				limit = {
					NOT = {
						liege = scope:actor		
					}				
				}
				liege = {
					save_scope_as = rk_liege
				}
			}
			add_opinion = {
				target = scope:recipient
				modifier = angry_opinion
				opinion = -5
			}				
		}
		scope:actor = {
			send_interface_toast = {
				title = rk_break_betrothal_interaction_interface_toast_decline
				left_icon = scope:recipient
				type = event_toast_effect_bad	
				add_prestige = -100
				add_legitimacy = -5
				add_opinion = {
					target = scope:recipient
					modifier = angry_opinion
					opinion = -20
				}			
			}							
		}
		scope:rk_liege = {
			add_opinion = {
				modifier = angry_opinion
				opinion = -10				
				target = scope:actor
			}		
		}
	}	
	ai_accept = {
		base = 0

		modifier = {
			add = 75
			desc = AI_ROYAL_COMMAND
		}

		opinion_modifier = { 
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}		
		modifier = {
			add = -30
			scope:recipient = {
				highest_held_title_tier = tier_empire
			}	
			desc = I_AM_LORD_PARAMOUNT			
		}

		modifier = {
			add = 40
			scope:recipient = {
				has_relation_friend = scope:actor
			}
			desc = WE_ARE_FRIENDS
		}

		modifier = {
			add = -50
			scope:recipient = {
				has_relation_rival = scope:actor
			}
			desc = WE_ARE_RIVALS
		}		

		modifier = { 
			add = -50
			scope:recipient = {
				has_trait = craven
			}
			desc = RK_AI_IS_CRAVEN
		}
		modifier = { 
			add = -50
			scope:recipient = {
				has_trait = content
			}
			desc = RK_AI_IS_CONTENT
		}
		modifier = { 
			add = 50
			scope:recipient = {
				has_trait = arrogant
			}
			desc = RK_AI_IS_ARROGANT
		}		


	}	
}

##### Summon to Bend the Knee Interaction

ask_for_knee_vassal_interaction = {
	icon = icon_vassal
	category = interaction_category_vassal
	common_interaction = yes
	interface_priority = 60
	desc = ask_for_knee_vassal_interaction_desc

	ai_maybe = yes
	ai_max_reply_days = 0
	popup_on_receive = yes
	pause_on_receive = yes
	use_diplomatic_range = yes
	can_send_despite_rejection = yes
	
	#ai_will_do = { base = 0 }
	#ai_frequency = 0
	#ai_potential = { always = no }
	ai_min_reply_days = 1
	ai_max_reply_days = 1	

	is_shown = {
		scope:actor = {
			is_ai = no	
			has_title = title:h_the_iron_throne
		}		
		scope:recipient = {
			NOT = { this = scope:actor }
			exists = liege
			liege = scope:actor
			is_ruler = yes
			highest_held_title_tier >= tier_county
			is_ai = yes
		}
	}

	is_valid_showing_failures_only = {
		scope:recipient = { 
			NOR = {
				is_at_war_with = scope:actor
				is_allied_to = scope:actor
				has_strong_hook = scope:actor 
				has_character_flag = joining_faction_block
			}
			can_join_or_create_faction_against = scope:actor
		} 
	}

	can_send = {
		scope:recipient = {
			NOT = { this = scope:actor }
			exists = liege
			liege = scope:actor
			is_ruler = yes
			is_imprisoned = no
			age >= 13
		}
		scope:actor = {
			prestige >= { 
				value = 500
				multiply = -1
			}
			is_ai = no	
			is_imprisoned = no
		}
	}

	on_auto_accept = { }

	ai_accept = {
		base = 0

		modifier = {
			add = 125
			scope:actor = {
				any_vassal_or_below = { this = scope:recipient }
			}
			desc = AI_REFUSAL_IS_TREASON
		}

		opinion_modifier = { 
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}

		modifier = {
			add = 40
			scope:recipient = {
				has_relation_friend = scope:actor
			}
			desc = WE_ARE_FRIENDS
		}

		modifier = {
			add = -50
			scope:recipient = {
				has_relation_rival = scope:actor
			}
			desc = WE_ARE_RIVALS
		}

		modifier = { 
			add = 50
			scope:recipient = {
				has_trait = craven
			}
			desc = SUMMON_TO_BEND_KNEE_AI_IS_craven
		}
		modifier = { 
			add = 15
			scope:recipient = {
				has_trait = content
			}
			desc = SUMMON_TO_BEND_KNEE_AI_IS_content
		}
		modifier = { 
			add = 15
			scope:recipient = {
				has_trait = just
			}
			desc = SUMMON_TO_BEND_KNEE_AI_IS_just
		}
		modifier = { 
			add = -15
			scope:recipient = {
				has_trait = arrogant
			}
			desc = SUMMON_TO_BEND_KNEE_AI_IS_arrogant
		}
		modifier = { 
			add = -25
			scope:actor = {
				tyranny >= 1
				tyranny <= 20
			}
			desc = SUMMON_TO_BEND_KNEE_TYRANNY
		}
		modifier = { 
			add = -50
			scope:actor = {
				tyranny >= 21
				tyranny <= 75
			}
			desc = SUMMON_TO_BEND_KNEE_TYRANNY
		}
		modifier = { 
			add = -100
			scope:actor = {
				tyranny >= 76
			}
			desc = SUMMON_TO_BEND_KNEE_TYRANNY
		}

		modifier = { 
			add = -50
			scope:recipient = {
				has_strong_claim_on = title:h_the_iron_throne
			}
			desc = SUMMON_TO_BEND_KNEE_PRESSED_CLAIM
		}

	}

	on_accept = {
		scope:recipient = { 
			custom_tooltip = ask_for_knee_vassal_interaction_accept_desc_a
			custom_tooltip = ask_for_knee_vassal_interaction_accept_desc_b
		}
		scope:actor = { 
			add_prestige = -500
			add_tyranny = 5
			stress_impact = {
				craven = medium_stress_impact_gain
				shy = medium_stress_impact_gain
				trusting = medium_stress_impact_gain
				compassionate = medium_stress_impact_gain
				arrogant = medium_stress_impact_loss
				paranoid = major_stress_impact_loss
			}			
			trigger_event = agot_bend_knee.1000
		}
	}
	
	on_decline = { 
		scope:recipient = { 
			add_prestige = -500
		}
		scope:actor = {
			add_opinion = {
				target = scope:recipient
				modifier = ag_bend_the_knee_refusal_opinion
			}
			send_interface_toast = {
				title = ask_for_knee_vassal_interaction_refusal_msg_title
				custom_tooltip = ask_for_knee_vassal_interaction_refusal_msg_desc
				left_icon = scope:recipient
			}				
		}
	}


}







