targetted_decisions = {
	prisoner_torture = {
		only_playable = yes
		filter = court
		ai_target_filter = court
		ai_check_interval = 12

		from_potential = {
			has_dlc = "Reapers"
			is_playable = yes
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
		}

		potential = {
			prisoner = yes
			host = { character = FROM }
			age = 13
		}

		allow = {
			NOT = { diplomatic_immunity = yes }
			prisoner = yes
		}

		effect = {
			hidden_tooltip = {
				if = {
					limit = {
						FROM = { 
							has_nickname = no
							is_adult = yes
							NOT = { trait = incapable }
						}
					}
					random_list = {
						5 = {
							FROM = { give_nickname = nick_the_cruel }
						}
						5 = {
							FROM = { give_nickname = nick_the_evil }
						}
						5 = {
							FROM = { give_nickname = nick_the_tormentor }
						}
						5 = {
							FROM = { give_nickname = nick_the_depraved }
						}
						100 = {}
					}
				}
			}
			
			hidden_tooltip = {
				random_list = {
					#Normal torture options
					10 = { 
						random_list = {
							10 = {
								# Racks
								FROM = { character_event = { id = RIP.20001 } }
								character_event = { id = RIP.20002 } 
								
							}

							10 = {
								# Whipping
								FROM = { character_event = { id = RIP.20003 } }
								character_event = { id = RIP.20004 } 

							}

							10 = {
								# Rats
								FROM = { character_event = { id = RIP.20005} }
								character_event = { id = RIP.20006 } 
							}
							
							20 = {
								# Heat exposure
								modifier = {
									factor = 0
									NAND = {
										month = 3
										NOT = { month = 9 }

										OR = {
											capital_scope = { region = world_africa }
											capital_scope = { region = world_middle_east }
											capital_scope = { region = world_persia }
											capital_scope = { region = world_india_rajastan }
										}
									}
								}
								FROM = { character_event = { id = RIP.20009 } }
								character_event = { id = RIP.20010 } 
							}
							20 = {
								# Cold exposure
								modifier = {
									factor = 0
									NAND = {
										
										OR = { 
											month = 11
											NOT = { month = 2}
										}

										OR = {
											capital_scope = { region = world_europe_north }
											capital_scope = { region = world_steppe_west }
											capital_scope = { region = world_steppe_east }
										}
									}
								}
								FROM = { character_event = { id = RIP.20011 } }
								character_event = { id = RIP.20012 }
							}
						}
						hidden_tooltip = {

							opinion = {
								modifier = opinion_tortured_me
								who = FROM
							}

							mother = {
								opinion = {
									modifier = opinion_tortured_close_kin
									who = FROM
								}
							}
							father = {
								opinion = {
									modifier = opinion_tortured_close_kin
									who = FROM
								}
							}
							spouse = {
								opinion = {
									modifier = opinion_tortured_close_kin
									who = FROM
								}
							}
							any_child = {
								opinion = {
									modifier = opinion_tortured_close_kin
									who = FROM
								}
							}
							if = {
								limit = {
									FROM = {
										NOT = { dynasty = ROOT }
										NOT = { sibling = ROOT }
									}
								}
								any_sibling = {
									opinion = {
										modifier = opinion_tortured_close_kin
										who = FROM
									}
								}
								any_dynasty_member = {
									opinion = {
										modifier = opinion_tortured_family
										who = FROM
									}
								}
							}
						}
					}

					20 = {
						# Lunatic option
						modifier = {
							factor = 0
							NOT = { FROM = { trait = lunatic } }
						}

						FROM = { character_event = { id = RIP.20007 } }
						character_event = { id = RIP.20008 } 
					}
					70 = {
						# Phalaris option
						trigger = {
							FROM = {
								NOT = { has_dynasty_flag = flag_phalaris_event }
								NOT = { has_global_flag = flag_phalaris_bloodline }
								has_dlc = "Holy Fury"
								culture = greek
								is_female = no
								is_alternate_start = no 
								independent = yes
								primary_title = { title = k_sicily }
								completely_controls = d_sicily
								capital_scope = { de_jure_liege = d_sicily }
								OR = {
									trait = lunatic
									trait = possessed
									trait = impaler
									trait = cruel
								}
								OR = {
									learning = 15
									has_character_modifier = brazen_bull #Already has it from Impaler event.
								}
							}
						}
						FROM = { character_event = { id = HF.24002 } }
						character_event = { id = HF.24003 } 
					}
				}	
			}
			
			tooltip = {
				add_character_modifier = { name = tortured years = 2 }
				opinion = {
					modifier = opinion_tortured_me
					who = FROM
				}
			}

			if = {
				limit = { 
					has_game_rule = {
						name = punishment_release_prisoner
						value = on
					}
				}
				prisoner = no
			}
			
			FROM = {
				show_scope_change = no
				hidden_tooltip = { clear_prison_reasons = ROOT }

				if = {
					limit = {
						NOR = {
							trait = cruel
							trait = kind
						}
					}
				}

				if = {
					limit = { trait = kind }
					random = { 
						chance = 50
						remove_trait = kind
						hidden_tooltip = {
							character_event = { id = 38307 }
						}
					}
					hidden_tooltip = {
						random_list = {
							30 = {
								add_trait = stressed
								hidden_tooltip = { character_event = { id = 38282 } }
							}
							10 = {
								add_trait = depressed
								hidden_tooltip = { character_event = { id = 38288 } }
							}
							60 = {
								#nothing
							}
						}
					}
				}
			}
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0.1
			
			modifier = {
				factor = 0
				OR = {
					reverse_opinion = { who = FROM value = 40 }
					FROM = { NOT = { piety = 100 } }
					FROM = { LIEGE = { dynasty = ROOT } }
				}
			}
			modifier = {
				factor = 0
				FROM = {
					NOR = {
						trait = cruel
						trait = impaler
						trait = wroth
						is_rival = ROOT
						trait = arbitrary
						trait = paranoid
						trait = deceitful
						trait = proud
						trait = lunatic
						trait = possessed
					}
				}
			}
			modifier = {
				factor = 0
				FROM = {
					OR = {
						trait = kind
						trait = just
						trait = patient
						trait = shy
						trait = greedy
					}
				}
			}
			modifier = {
				factor = 10
				FROM = {
					OR = {
						trait = cruel
						trait = impaler
						trait = wroth
						is_rival = ROOT
						trait = arbitrary
					}
				}
			}
		}
	}

	prisoner_mutilate = {
		only_playable = yes

		filter = court
		ai_target_filter = court
		ai_check_interval = 3

		from_potential = {
			has_dlc = "Reapers"
			is_playable = yes
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
			AND = {
				OR = {
					trait = cruel
					trait = impaler
					trait = wroth
					trait = arbitrary
					AND = {
						trait = envious
						trait = ugly
					}
				}
				NOT = { trait = kind }
			}
		}

		potential = {
			host = { character = FROM }
			prisoner = yes
			age = 13

			NOT = {
				AND = {
					trait = one_legged
					trait = one_handed
					trait = disfigured
					OR = {
						trait = one_eyed
						trait = blinded
					}
					OR = {
						is_female = yes
						trait = eunuch
					}
				}
			}
		}

		allow = {
			NOT = { diplomatic_immunity = yes }
			prisoner = yes
		}

		effect = {
			hidden_tooltip = {
				if = {
					limit = {
						FROM = { 
							has_nickname = no
							is_adult = yes
							NOT = { trait = incapable }
						}
					}
					random_list = {
						5 = {
							FROM = { give_nickname = nick_the_evil }
						}
						5 = {
							FROM = { give_nickname = nick_the_tormentor }
						}
						5 = {
							FROM = { give_nickname = nick_the_butcher }
						}
						5 = {
							FROM = { give_nickname = nick_the_mutilator }
						}
						5 = {
							FROM = { give_nickname = nick_the_monster }
						}
						5 = {
							FROM = { give_nickname = nick_son_of_evilgod }
						}
						100 = {}
					}
				}
			}
		
			hidden_tooltip = {
				random_list = {
					10 = {
						# One-legged
						modifier = {
							factor = 0
							trait = one_legged
						}
						FROM = { character_event = { id = RIP.20013 } }
						character_event = { id = RIP.20014 } 
					}

					10 = {
						# One-handed
						modifier = {
							factor = 0
							trait = one_handed
						}
						FROM = { character_event = { id = RIP.20015 } }
						character_event = { id = RIP.20016 }

					}

					10 = {
						# One-eyed
						modifier = {
							factor = 0
							OR = {
								trait = one_eyed
								trait = blinded
							}
						}
						FROM = { character_event = { id = RIP.20017 } }
						character_event = { id = RIP.20018 } 

					}

					10 = {
						# Disfigured
						modifier = {
							factor = 0
							trait = disfigured
						}
						FROM = { character_event = { id = RIP.20019 } }
						character_event = { id = RIP.20020 }
					}	

					10 = {
						# Castrate
						modifier = {
							factor = 0
							OR = {
								is_female = yes
								trait = eunuch 
							}
						}
						FROM = { character_event = { id = RIP.20021 } }
						character_event = { id = RIP.20022 } 
					}
				}
			}
			
			if = {
				limit = { 
					has_game_rule = {
						name = punishment_release_prisoner
						value = on
					}
				}
				prisoner = no
			}
			
			opinion = {
				modifier = opinion_mutilated_me
				who = FROM
			}
			
			FROM = {
				show_scope_change = no
				if = {
					limit = { NOT = { trait = cruel } }
				}
			}
			
			hidden_tooltip = {
				mother = {
					opinion = {
						modifier = opinion_mutilated_close_kin
						who = FROM
					}
				}
				father = {
					opinion = {
						modifier = opinion_mutilated_close_kin
						who = FROM
					}
				}
				spouse = {
					opinion = {
						modifier = opinion_mutilated_close_kin
						who = FROM
					}
				}
				any_child = {
					opinion = {
						modifier = opinion_mutilated_close_kin
						who = FROM
					}
				}
				if = {
					limit = {
						FROM = {
							NOT = { dynasty = ROOT }
							NOT = { sibling = ROOT }
						}
					}
					any_sibling = {
						opinion = {
							modifier = opinion_mutilated_close_kin
							who = FROM
						}
					}
					any_dynasty_member = {
						opinion = {
							modifier = opinion_mutilated_family
							who = FROM
						}
					}
				}
				
				FROM = { clear_prison_reasons = ROOT }

			}
		}
		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0.66
			
			modifier = {
				factor = 0
				OR = {
					reverse_opinion = { who = FROM value = 40 }
					FROM = { NOT = { piety = 100 } }
					FROM = { LIEGE = { dynasty = ROOT } }
				}
			}
			modifier = {
				factor = 0.5 # Less likely to do it
				reverse_opinion = { who = FROM value = 0 }

			}
			modifier = {
				factor = 0
				FROM = {
					NOR = {
						trait = cruel
						trait = impaler
						trait = wroth
						is_rival = ROOT
						trait = arbitrary
					}
				}
			}
		}
	}

	prisoner_read_poetry = {
		only_playable = yes
		filter = court
		ai_target_filter = court
		ai_check_interval = 12

		from_potential = {
			has_dlc = "Reapers"
			is_playable = yes
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
			trait = poet
		}

		potential = {
			host = { character = FROM }
			prisoner = yes
			age = 13
		}

		allow = {
			NOT = { diplomatic_immunity = yes }
			prisoner = yes
		}

		effect = {
			hidden_tooltip = {

				FROM = {

					random_list = {
						10 = {
							# Poem 1
							character_event = { id = RIP.20023 }
							ROOT = { character_event = { id = RIP.20024 } }
							
						}

						10 = {
							# Poem 2
							character_event = { id = RIP.20025 }
							ROOT = { character_event = { id = RIP.20026 } }

						}

						10 = {
							# Poem 3
							character_event = { id = RIP.20027 } 
							ROOT = { character_event = { id = RIP.20028 } }
						}
					}
				}
			}

			if = {
				limit = { 
					has_game_rule = {
						name = punishment_release_prisoner
						value = on
					}
				}
				prisoner = no
			}

			opinion = {
				modifier = opinion_bad_poetry
				who = FROM
			}
			
			hidden_effect = { FROM = { clear_prison_reasons = ROOT } }
		}
		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0.1
			
			modifier = {
				factor = 0
				reverse_opinion = { who = FROM value = 40 }
			}
			modifier = {
				factor = 0.2 # Less likely to do it
			}
			modifier = {
				factor = 5
				FROM = {
					OR = {
						trait = cruel
						trait = envious
						is_rival = ROOT
						trait = arbitrary
					}
				}
			}
		}
	}

#Humiliate
	prisoner_humiliation = {
		only_playable = yes
		filter = court
		ai_target_filter = court
		ai_check_interval = 12
	
		from_potential = {
			has_dlc = "Reapers"
			is_playable = yes
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
		}
	
		potential = {
			host = { character = FROM }
			prisoner = yes
			age = 13
		}
		allow = {
			NOT = { diplomatic_immunity = yes }
			prisoner = yes
		}
		effect = {
			hidden_tooltip = {
				FROM = {
					random_list = {
						# Tar 'n' feathers
						33 = {
						modifier = {
							factor = 0
							ROOT = {
								OR = {
									has_character_modifier = incestuous_adulterer
									has_character_modifier = incestuous_adulteress
									has_character_modifier = adulterer
									has_character_modifier = adulteress
									has_character_modifier = known_sodomite
									has_character_modifier = cradle_robber
									has_character_modifier = adulterous_priest
								}
							}
						}
						modifier = {
							factor = 0
							OR = {
								is_nomadic = yes
								is_tribal = yes
							}
						}

						character_event = { id = RIP.15001}
						ROOT = { character_event = { id = RIP.15002} }
						}

						# Tar 'n' feathers NOMAD
						33 = {
						modifier = {
							factor = 0
							ROOT = {
								OR = {
									has_character_modifier = incestuous_adulterer
									has_character_modifier = incestuous_adulteress
									has_character_modifier = adulterer
									has_character_modifier = adulteress
									has_character_modifier = known_sodomite
									has_character_modifier = cradle_robber
									has_character_modifier = adulterous_priest
								}
							}
						}
						modifier = {
							factor = 0
							NOR = {
								is_nomadic = yes
								is_tribal = yes
							}
						}

						character_event = { id = RIP.15007}
						ROOT = { character_event = { id = RIP.15008} }
						}
						
						# the Stocks
						33 = {
							modifier = {
								factor = 0
								ROOT = {
									OR = {
										has_character_modifier = incestuous_adulterer
										has_character_modifier = incestuous_adulteress
										has_character_modifier = adulterer
										has_character_modifier = adulteress
										has_character_modifier = known_sodomite
										has_character_modifier = cradle_robber
										has_character_modifier = adulterous_priest
									}
								}
							}
							modifier = {
								factor = 0
								OR = {
									is_nomadic = yes
									is_tribal = yes
								}
							}
							character_event = { id = RIP.15003}
							ROOT = { character_event = { id = RIP.15004} }
						}
							
						# walk of shame
						33 = {
							modifier = {
								factor = 0
								ROOT = {
									NOT = { 
										OR = {
											has_character_modifier = incestuous_adulterer
											has_character_modifier = incestuous_adulteress
											has_character_modifier = adulterer
											has_character_modifier = adulteress
											has_character_modifier = known_sodomite
											has_character_modifier = cradle_robber
											has_character_modifier = adulterous_priest
										}
									}
								}
							}
							character_event = { id = RIP.15005}
							ROOT = { character_event = { id = RIP.15006} }
						}
					}
				}
			}
				
			if = {
				limit = { 
					has_game_rule = {
						name = punishment_release_prisoner
						value = on
					}
				}
				prisoner = no
			}
			
			add_character_modifier = {
				name = publicly_humiliated
				years = 10
			}

			opinion = {
				modifier = opinion_humiliated_me
				who = FROM
			}
			hidden_tooltip = {
				mother = {
					opinion = {
						modifier = opinion_humiliated_close_kin
						who = FROM
					}
				}
				father = {
					opinion = {
						modifier = opinion_humiliated_close_kin
						who = FROM
					}
				}
				spouse = {
					opinion = {
						modifier = opinion_humiliated_close_kin
						who = FROM
					}
				}
				any_child = {
					opinion = {
						modifier = opinion_humiliated_close_kin
						who = FROM
					}
				}
				if = {
					limit = {
						FROM = {
							NOT = { dynasty = ROOT }
							NOT = { sibling = ROOT }
						}
					}
					any_sibling = {
						opinion = {
							modifier = opinion_humiliated_close_kin
							who = FROM
						}
					}
					any_dynasty_member = {
						opinion = {
							modifier = opinion_humiliated_family
							who = FROM
						}
					}
				}
			}
			hidden_effect = { FROM = { clear_prison_reasons = ROOT } }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.1
			
			modifier = {
				factor = 0
				reverse_opinion = { who = FROM value = 40 }
			}
			modifier = {
				factor = 5
				FROM = { trait = kind }
			}
			modifier = {
				factor = 0
				FROM = { trait = greedy }
			}
			modifier = {
				factor = 10
				is_pretender = yes
				is_rival = ROOT
				
				FROM = {
					OR = {
						is_pretender = yes
						is_primary_heir = yes
					}
				}
			}
		}
	}
	
	execute_eat = {
		only_playable = yes
		filter = court
		ai_target_filter = court
		ai_check_interval = 12
		
		from_potential = {
			has_dlc = "Reapers"
			is_playable = yes
			is_adult = yes
			prisoner = no
			NOT = { trait = incapable }
			OR = {
				has_character_modifier = cannibal
				trait = cannibal_trait
				graphical_culture = beargfx
				graphical_culture = dragongfx
			}
			OR = {
				trait = possessed
				trait = lunatic
				graphical_culture = beargfx
				graphical_culture = dragongfx
			}
		}

		potential = {
			host = { character = FROM }
			prisoner = yes
			age = 12
		}
		
		allow = {
			NOT = { diplomatic_immunity = yes }
		}
		
		ai_will_do = {
			factor = 1
		}
		
		effect = {
			hidden_tooltip = {
				any_dynasty_member = {
					limit = {
						is_offmap_ruler = no
						is_close_relative = ROOT
						NOT = { character = FROM }
					}
					character_event = { id = RIP.11511 days = 1 }
				}
				FROM = {
					add_blood_splatter_effect = yes
					random_list = {
						50 = { # Nothing happens
							modifier = {
								factor = 0
								OR = {
									ROOT = {
										immortal = yes
									}
									AND = {
										ROOT = {
											controls_religion = yes
										}
										FROM = { NOT = { religion_group = ROOT } }
									}
								}
							}
						}
						40 = { # Get sick
							modifier = {
								factor = 0
								OR = {
									immortal = yes
									has_character_flag = demon_child
									ROOT = {
										immortal = yes
									}
									AND = {
										ROOT = {
											controls_religion = yes
										}
										FROM = { NOT = { religion_group = ROOT } }
									}
								}
							}
							random_list = {
								50 = { # Food Poisoning
									if = {
										limit = {
											NOR = {
												num_of_symptoms = 1
												is_ill = yes
												has_character_flag = developing_illness
												has_character_flag = disease_not_serious
											}
										}
										set_character_flag = got_food_poisoning
										set_character_flag = developing_illness
										character_event = { id = RIP.5023 days = 5 }
									}
								}
								25 = { # Diarrhea - Not Serious
									if = {
										limit = {
											NOR = {
												num_of_symptoms = 1
												is_ill = yes
												has_character_flag = developing_illness
												has_character_flag = disease_not_serious
											}
										}
										set_character_flag = disease_not_serious
										character_event = { id = RIP.5002 days = 5 }
										character_event = { id = RIP.11004 days = 10 random = 50 }
									}
								}
								25 = { # Vomiting - Not Serious
									if = {
										limit = {
											NOR = {
												num_of_symptoms = 1
												is_ill = yes
												has_character_flag = developing_illness
												has_character_flag = disease_not_serious
											}
										}
										set_character_flag = disease_not_serious
										character_event = { id = RIP.5003 days = 5 }
										character_event = { id = RIP.11005 days = 10 random = 50 }
									}
								}
							}
						}
						10 = { # Gain power!
							modifier = {
								factor = 0
								has_game_rule = {
									name = supernatural_events
									value = off
								}
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = christian
									}	
									NOT = { religion_group = ROOT }
								}
								set_character_flag = pope_eater	
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = muslim
									}
									NOT = { religion_group = ROOT }
								}
									set_character_flag = caliph_eater	
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = pagan_group
									}
									NOT = { religion_group = ROOT }
								}
									set_character_flag = fylkir_feast	
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = zoroastrian_group
									}
									NOT = { religion_group = ROOT }
								}
									set_character_flag = fire_eater	
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = jewish_group
									}
									NOT = { religion_group = ROOT }
								}
									set_character_flag = non_kosher	
							}
							if = {
								limit = {
									ROOT = {
										controls_religion = yes
										religion_group = indian_group
									}
									NOT = { religion_group = ROOT }
								}
									set_character_flag = dont_even_exist	
							}
							
							character_event = { id = RIP.11510 }
						}
					}
					if = {
						limit = {
							has_nickname = no
						}
						random_list = {
							20 = { # Get nickname The Cannibal
								give_nickname = nick_the_cannibal
							}
							15 = { # Get nickname The Dragon
								give_nickname = nick_the_dragon
							}
							15 = { # Get nickname The Abomination
								give_nickname = nick_the_abomination
							}
							10 = { # Get nickname The Monster
								give_nickname = nick_the_monster
							}
							40 = { } # No nickname
						}
					}
				}
			}
			death = {
				death_reason = death_execution_eaten
				killer = FROM
			}
			save_event_target_as = kinslayer_target
			FROM = {
				if = {
					limit = {
						NOR = {
							trait = lunatic
							graphical_culture = beargfx
							graphical_culture = dragongfx
						}
					}
					add_trait = lunatic
				}
				if = {
					limit = {
						NOR = {
							has_character_modifier = crazy_cannibal
							graphical_culture = beargfx
							graphical_culture = dragongfx
						}
					}
					add_character_modifier = {
						name = crazy_cannibal
						duration = -1
					}
				}
				add_kinslayer_trait_effect = yes
			}
			hidden_tooltip = {
				if = {
					limit = {
						OR = { 
							religion = bon
							religion = bon_reformed
						}
						FROM = { ai = no }
					}
					FROM = {
						set_character_flag = achievement_bon_appetit
					}
				}
			}
		}
	}
}