﻿escape_prison_interaction = {
	category = interaction_category_hostile
	common_interaction = yes
	desc = escape_from_prison_decision_desc
	interface_priority = 80
	auto_accept = yes
	ai_frequency = 0
	
	
	is_shown = {
		scope:actor = {
			is_imprisoned = yes 
			is_ruler = no
		    NOR = { #Disqualify Hereward, but only when he's been imprisoned via the story cycle
			has_character_flag = harrying_imprisoned_flag
			has_character_flag = recent_escape_attempt
			 }
		}
		OR = {
		scope:actor = { is_imprisoned_by = scope:recipient }
		scope:recipient = scope:actor 
		}
		
	}
	is_valid_showing_failures_only = {
		scope:actor = {
		age >= 10
		}
	}
	
	
	can_send = { always = yes }
	
	
	on_accept = {
	  scope:actor = {
		imprisoner = {
			save_scope_as = imprisoner
		}
		show_as_tooltip = {
			random_list = {
				50 = {
					show_chance = no
					desc = escape_from_prison_decision_success.tt
					release_from_prison = yes
					scope:imprisoner = {
						if = {
							limit = {
								OR = {
									has_revoke_title_reason = scope:actor
									has_banish_reason = scope:actor
									has_execute_reason = scope:actor
								}
							}
							add_opinion = {
								target = scope:actor
								modifier = escaped_from_prison_crime
							}
						}
						else = {
							add_opinion = {
								target = scope:actor
								modifier = escaped_from_prison_opinion
							}
						}
					}
				}
				50 = {
					show_chance = no
					desc = escape_from_prison_decision_failure.tt
					custom_tooltip = escape_from_prison_decision_failure_outcome.tt
				}
			}
		}
		custom_tooltip = escape_from_prison_decision_effect_tooltip
		trigger_event = {
			on_action = escape_from_prison
		}
		add_character_flag = { flag = recent_escape_attempt years = 3 }
	}
}
}		
