﻿cof_break_prisoner = {
	interface_priority = 60
 #	common_interaction = yes
	category = interaction_category_prison
	icon = court_artificer_court_position

	is_shown = {
		has_game_rule = GPT_interactions_enabled
		NOT = { scope:actor = scope:recipient }
		scope:actor = {
			is_ai = no
		}
		scope:recipient = {
			is_imprisoned_by = scope:actor
			is_adult = yes
			OR = {
				NOT = {
					is_landed = yes
				}
				is_vassal_or_below_of = scope:actor
			}
		}
	}

	is_valid_showing_failures_only = {
	 #	custom_tooltip = {
	 #		text = cof_ti_break_prisoner_high_compassion
	 #		scope:actor = { ai_compassion <= 0 }
	 #	}
		custom_tooltip = {
			text = cof_ti_break_prisoner_lack_piety
			scope:actor = { piety >= 300 }
		}
	}

	cooldown_against_recipient = { years = 10 }

	force_notification = yes
 #	show_answer_notification = no

	desc = cof_break_prisoner_desc

	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}

	on_accept = {

		scope:actor = {
			stress_impact = {
				vengeful = -20
				paranoid = -30
				arbitrary = -10
				callous = -10
				eccentric = -20
				wrathful = -10
				arrogant = -10
				sadistic = -40
			}
			stress_impact = {
				compassionate = 100
				trusting = 60
				forgiving = 40
				content = 40
				shy = 20
				just = 40
				temperate = 10
			}
			add_piety = -300
			add_hook = {
				type = cof_broken_master
				target = scope:recipient
			}
		}

		scope:recipient = {
			add_stress = 150
			add_opinion = {
				modifier = cof_ti_broken_master_opinion
				target = scope:actor
			}
			add_character_modifier = {
				modifier = cof_ti_broken_modifier
				years = -1
			}
		}

		# Tyranny Calculation | 40 for Kings, 30 for Landed, 10 for Unlanded
		IF = {
			limit = {
				scope:recipient = {
					is_landed = yes
				}
			}
			scope:actor = {
				add_dread = 30
				add_tyranny = 20
				add_secret = {
					type = secret_deviant
				}
			}
		}
		IF = {
			limit = {
					scope:recipient = {
						is_landed = no
					}
			}
			scope:actor = {
				add_dread = 15
				add_tyranny = 10
				add_secret = {
					type = secret_deviant
				}
			}
		}
		scope:recipient = {
			release_from_prison = yes
			every_close_family_member = {
				add_opinion = {
					modifier = cof_ti_broke_family_member
					target = scope:actor
				}
			}
		}

	}

	auto_accept = yes
}