﻿ttk_travel_event_wound_effect = {
	if = {
		limit = {
			exists = scope:$SCOPE1$
			exists = scope:$SCOPE2$
		}
		hidden_effect = {
			random_list = {
				10 = {
					scope:$LEADER$ = {
						send_interface_toast = {
						type = event_toast_effect_bad
						title = ttk_travel_event_kill.0001.toast.escort
							scope:$SCOPE1$ = {
								death = {
									death_reason = death_fight
								}
							}
							scope:$SCOPE2$ = {
								death = {
									death_reason = death_fight
								}
							}
							left_icon = scope:$SCOPE1$
							right_icon = scope:$SCOPE2$
						}
					}
				}
				30 = {
					scope:$LEADER$ = {
						send_interface_toast = {
						type = event_toast_effect_bad
						title = ttk_travel_event_kill.0001.toast.escort
							scope:$SCOPE1$ = {
								death = {
									death_reason = death_fight
								}
							}
							scope:$SCOPE2$ = {
								increase_wounds_no_death_effect = { REASON = fight }
							}
							left_icon = scope:$SCOPE1$
							right_icon = scope:$SCOPE2$
						}
					}
				}
				60 = {
					scope:$LEADER$ = {
						send_interface_toast = {
						type = event_toast_effect_bad
						title = ttk_travel_event_kill.0001.toast.escort
							scope:$SCOPE1$ = {
								increase_wounds_no_death_effect = { REASON = fight }
							}
							scope:$SCOPE2$ = {
								increase_wounds_no_death_effect = { REASON = fight }
							}
							left_icon = scope:$SCOPE1$
							right_icon = scope:$SCOPE2$
						}
					}
				}
			}
		}
	}
}

ttk_travel_event_wound_leader_effect = {
	if = {
		limit = {
			scope:$LEADER$ ?= { is_alive = yes }
		}
		hidden_effect = {
			scope:$LEADER$ = {
				random_list = {
					40 = {
					}
					60 = {
						increase_wounds_no_death_effect = { REASON = fight }
					}
					
				}
			}
		}
	}
}


ttk_travel_event_opinion_modifier_effect = {
	add_opinion = {
		target = scope:$KILLER$
		modifier = ttk_ambushed_me_opinion
	}
	if = {
		limit = {
			NOT = { has_relation_rival = scope:$KILLER$ }
		}
		set_relation_rival = {
			target = scope:$KILLER$
			reason = ttk_ambushed_me
		}
	}
	else_if = {
		limit = {
			has_relation_rival = scope:$KILLER$
			NOT = { has_relation_nemesis = scope:$KILLER$ }
		}
		set_relation_nemesis = {
			target = scope:$KILLER$
			reason = ttk_ambushed_me
		}
	}
	house ?= {
			change_house_relation_effect = {
			HOUSE = scope:$KILLER$.house
			VALUE = house_relation_damage_minor_value
			REASON = ttk_ambush
			CHAR = scope:$KILLER$
			TARGET_CHAR = scope:ttk_target
			TITLE = scope:dummy_gender
		}
	}
}

ttk_execute_prisoner_effect = {

	$VICTIM$ = {
		save_scope_as = victim
	}

	$EXECUTIONER$ = {
		save_scope_as = executioner
		save_scope_as = imprisoner #Save this scope to show correct tyranny tooltip
	}

	show_as_tooltip = {
		if = {
			limit = {
				exists = scope:execution_devour
				scope:execution_devour = yes
			}
			$VICTIM$ = {
				death = {
					death_reason = death_eaten
					killer = $EXECUTIONER$
				}
			}
		}
		else = {
			$VICTIM$ = {
				death = {
					death_reason = death_execution
					killer = $EXECUTIONER$
				}
			}
		}
	}

	scope:executioner = {
		# Dread gain
		if = {
			limit = {
				scope:victim = {
					time_in_prison = { years > 15 } # No one even remembers who they are anymore
				}
			}
			# No dread for you
		}
		else_if = { # Executing Emperors/HoF is quite dreadful
			limit = {
				scope:victim = {
					OR = {
						highest_held_title_tier >= tier_empire
						scope:executioner.faith.religious_head = scope:victim # Your head of faith
					}
				}
			}
			add_dread = execute_interaction_massive_dread_gain
		}
		else_if = {
			limit = {
				scope:victim = {
					OR = {
						highest_held_title_tier >= tier_kingdom
						tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_empire }
						is_powerful_vassal_of = scope:executioner # Is your powerful vassal
						target_is_vassal_or_below = scope:executioner # Your liege/s
						is_close_family_of = scope:executioner
					}
				}
			}
			add_dread = execute_interaction_major_dread_gain
		}
		else_if = {
			limit = {
				scope:victim = {
					OR = {
						highest_held_title_tier >= tier_duchy
						tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_kingdom }
						AND = { # Is your vassal, and higher than Baron
							is_vassal_of = scope:executioner
							primary_title.tier > tier_barony
						}
						AND = { # Peer Vassals
							exists = primary_title
							primary_title.tier > tier_barony
							liege ?= scope:executioner.liege
						}
						has_trait = peasant_leader
					}
				}
			}
			add_dread = execute_interaction_medium_dread_gain
		}
		else_if = {
			limit = {
				scope:victim = {
					OR = {
						highest_held_title_tier >= tier_county
						tier_or_related_liege_tier_greater_or_equal_trigger = { TIER = tier_duchy }
						is_vassal_of = scope:executioner # Is your Baron vassal
						is_close_or_extended_family_of = scope:executioner
						
						scope:executioner = { # Executing close family of your vassals is dreadful...
							any_vassal = {
								is_close_family_of = scope:victim
							}
						}
						scope:executioner = { # Executing close family of your liege/s is the same...
							any_liege_or_above = {
								is_close_family_of = scope:victim
							}
						}
					}
				}
			}
			add_dread = execute_interaction_minor_dread_gain
		}
		
		# Piety loss (or gain) from executions
		if = {
			limit = {
				rite = {
					rite_has_parameter = human_sacrifice_active
				}
			}
			scope:victim = {
				if = {
					limit = {
						OR = {
							highest_held_title_tier >= tier_empire
							any_close_family_member = {
								highest_held_title_tier >= tier_empire
							}
						}
					}
					scope:executioner = { add_piety = massive_piety_gain }
				}
				else_if = {
					limit = {
						OR = {
							highest_held_title_tier >= tier_kingdom
							any_close_family_member = {
								highest_held_title_tier >= tier_kingdom
							}
						}
					}
					scope:executioner = { add_piety = major_piety_gain }
				}
				else_if = {
					limit = {
						OR = {
							highest_held_title_tier >= tier_duchy
							any_close_family_member = {
								highest_held_title_tier >= tier_duchy
							}
						}
					}
					scope:executioner = { add_piety = medium_piety_gain }
				}
				else_if = {
					limit = {
						OR = {
							is_ruler = yes
							is_lowborn = no
							any_close_family_member = {
								is_ruler = yes
							}
						}
					}
					scope:executioner = { add_piety = minor_piety_gain }
				}
				else = {
					scope:executioner = { add_piety = miniscule_piety_gain }
				}
			}
		}
		else_if = { # Sacrilege regardless of birth, so killing a lowborn Head of Faith is still impactful
			limit = {
				exists = faith.religious_head
				faith.religious_head = scope:victim
				NOT = { has_perk = divine_retribution_perk }
				NOT = { has_execute_reason = scope:victim }
			}
			clerical_kill_piety_effect = {
				VICTIM = scope:victim
				KILLER = scope:executioner
			}
		}
		else_if = {
			limit = {
				NOT = { has_perk = divine_retribution_perk }
				NOT = { has_execute_reason = scope:victim }
				scope:victim = {
					pam_is_senior_cleric_of_character_trigger = {
						CHARACTER = scope:executioner
					}
				}
			}
			clerical_kill_piety_effect = {
				VICTIM = scope:victim
				KILLER = scope:executioner
			}
		}
		else_if = {
			limit = {
				faith = scope:victim.faith
				NOT = { has_perk = divine_retribution_perk }
				scope:victim = {
					has_no_particular_noble_roots_trigger = yes
				}
			}
			add_piety = miniscule_piety_loss
		}
		else_if = {
			limit = {
				faith = scope:victim.faith
				NOT = { has_perk = divine_retribution_perk }
			}
			add_piety = medium_piety_loss
		}
		if = {
			limit = {
				NOT = { rite = { rite_has_parameter = human_sacrifice_active } }
			}
			clerical_kill_memory_effect = {
				VICTIM = scope:victim
				KILLER = scope:executioner
			}
			if = {
				limit = {
					exists = faith.religious_head
					faith.religious_head = scope:victim
					NOT = { has_perk = divine_retribution_perk }
				}
				if = {
					limit = {
						OR = {
							has_execute_reason = scope:victim
							situation:the_christian_church ?= {
								has_situation_top_phase_parameter = the_christian_church_clerical_violence_less_consequential
							}
						}
					}
					execute_senior_clergy_outrage_effect = { MODIFIER = executed_head_of_faith_opinion }
				}
				else = {
					execute_senior_clergy_outrage_effect = { MODIFIER = executed_head_of_faith_crime_opinion }
				}
			}
			else_if = {
				limit = {
					NOT = { has_perk = divine_retribution_perk }
					scope:victim = {
						pam_is_senior_cleric_of_character_trigger = {
							CHARACTER = scope:executioner
						}
					}
				}
				if = {
					limit = {
						OR = {
							has_execute_reason = scope:victim
							situation:the_christian_church ?= {
								has_situation_top_phase_parameter = the_christian_church_clerical_violence_less_consequential
							}
						}
					}
					execute_senior_clergy_outrage_effect = { MODIFIER = executed_senior_cleric_opinion }
				}
				else = {
					execute_senior_clergy_outrage_effect = { MODIFIER = executed_senior_cleric_crime_opinion }
				}
			}
		}
		if = {
			limit = {
				has_personal_tenet_flag = tenet_human_sacrifice_execution_piety_bonus
			}
			scope:victim = { human_sacrifice_personal_execution_piety_bonus_effect = yes }
		}
		if = {
			limit = {
				has_personal_tenet_flag = tenet_fp3_fedayeen_other_faith_kill_fulfillment
				NOT = { faith = scope:victim.faith }
			}
			change_spiritual_fulfillment = minor_spiritual_fulfillment_value
		}
		# Extinction of Dharma: slaying a rival faith's followers hastens the age of decline
		if = {
			limit = {
				rite = { rite_has_parameter = killing_buddhists_is_pious }
				NOT = { faith = scope:victim.faith }
				scope:victim.faith.religion = faith.religion
			}
			send_interface_toast = {
				title = killing_buddhists_is_pious_toast
				left_icon = scope:victim
				if = {
					limit = { scope:victim = { has_no_particular_noble_roots_trigger = yes } }
					add_piety = medium_piety_gain
				}
				else = {
					add_piety = major_piety_gain
				}
			}
		}
		# Extinction of Dharma personal tenet: hastening the decline is spiritually fulfilling
		if = {
			limit = {
				has_personal_tenet_flag = tenet_extinction_of_dharma_execution_fulfillment
				NOT = { faith = scope:victim.faith }
				scope:victim.faith.religion = faith.religion
			}
			change_spiritual_fulfillment = minor_spiritual_fulfillment_value
		}
		# Benevolent Governance personal tenet: executions are a failure to rule by virtue
		if = {
			limit = {
				has_personal_tenet_flag = tenet_benevolent_governance_clemency_fulfillment
			}
			if = {
				limit = { has_execute_reason = scope:victim }
				change_spiritual_fulfillment = medium_spiritual_fulfillment_loss
			}
			else = {
				change_spiritual_fulfillment = major_spiritual_fulfillment_loss
			}
		}
		
		# Stress loss
		if = {
			limit = { has_relation_rival = scope:victim }

			if = {
				limit = {
					NOR = {
						has_trait = sadistic
						has_trait = vengeful
						has_trait = compassionate
						has_trait = forgiving
					}
				}
				add_stress = medium_stress_loss
			}
			else = {
				stress_and_fulfillment_impact = {
					sadistic = major_stress_impact_loss
					vengeful = massive_stress_impact_loss
					compassionate = minor_stress_impact_gain
					forgiving = minor_stress_impact_gain
				}
			}
		}
		else_if = { #Killing infidels is relaxing
			limit = {
				has_trait = zealous
				scope:executioner.faith != scope:victim.faith
			}

			if = {
				limit = {
					NOR = {
						has_trait = sadistic
						has_trait = compassionate
						has_trait = forgiving
					}
				}
				add_stress = medium_stress_loss
			}
			else = {
				stress_and_fulfillment_impact = {
					sadistic = major_stress_impact_loss
					compassionate = minor_stress_impact_gain
					forgiving = minor_stress_impact_gain
				}
			}
		}
		# Stress Gain
		else_if = {
			limit = {
				exists = scope:victim
				has_execute_reason = scope:victim
				NOT = {
					has_trait = sadistic
				}
				scope:victim = {
					OR = {
						is_child_of = scope:executioner
						is_grandchild_of = scope:executioner
						is_great_grandchild_of = scope:executioner
					}
				}
			}
			stress_and_fulfillment_impact = {
				base = minor_stress_impact_gain
				compassionate = massive_stress_impact_gain
				forgiving = major_stress_impact_gain
				generous = minor_stress_impact_gain
				family_first = minor_stress_impact_gain
			}
		}
		else_if = {
			limit = {
				NOT = {
					has_trait = sadistic
				}
				scope:victim = {
					OR = {
						is_child_of = scope:executioner
						is_grandchild_of = scope:executioner
						is_great_grandchild_of = scope:executioner
					}
				}
			}
			stress_and_fulfillment_impact = {
				base = medium_stress_impact_gain
				compassionate = massive_stress_impact_gain
				forgiving = major_stress_impact_gain
				generous = medium_stress_impact_gain
				trusting = minor_stress_impact_gain
				content = minor_stress_impact_gain
				family_first = minor_stress_impact_gain
			}
			if = {
				limit = {
					exists = scope:execution_sacrifice
					NOT = { always = scope:execution_sacrifice }
				}
				stress_and_fulfillment_impact = {
					just = medium_stress_impact_gain
				}
			}
		}
		else_if = {
			limit = {
				NOT = {
					has_trait = sadistic
				}
				scope:victim = {
					OR = {
						has_relation_friend = scope:executioner
						has_relation_lover = scope:executioner
					}
				}
			}
			stress_and_fulfillment_impact = {
				base = medium_stress_impact_gain
				compassionate = massive_stress_impact_gain
				forgiving = major_stress_impact_gain
				generous = medium_stress_impact_gain
				trusting = minor_stress_impact_gain
				content = minor_stress_impact_gain
			}
			if = {
				limit = {
					exists = scope:execution_sacrifice
					NOT = { always = scope:execution_sacrifice }
				}
				stress_and_fulfillment_impact = {
					just = medium_stress_impact_gain
				}
			}
		}
		else_if = {
			limit = {
				exists = scope:victim
				has_execute_reason = scope:victim
			}
			stress_and_fulfillment_impact = {
				sadistic = medium_stress_impact_loss
				compassionate = medium_stress_impact_gain
				forgiving = minor_stress_impact_gain
				generous = minor_stress_impact_gain
			}
		}
		else = {
			stress_and_fulfillment_impact = {
				sadistic = medium_stress_impact_loss
				compassionate = major_stress_impact_gain
				forgiving = medium_stress_impact_gain
				generous = medium_stress_impact_gain
				trusting = minor_stress_impact_gain
				content = minor_stress_impact_gain
			}
			if = {
				limit = {
					exists = scope:execution_sacrifice
					NOT = { always = scope:execution_sacrifice }
				}
				stress_and_fulfillment_impact = {
					just = medium_stress_impact_gain
				}
			}
		}
		
		#Kinslaying
		add_kinslayer_trait_or_nothing_effect = { VICTIM = scope:victim }

		#Tyranny
		if = {
			limit = {
				exists = scope:recipient
				has_execute_reason = scope:victim
			}
			custom_tooltip = IS_ALLOWED_TO_EXECUTE_DESC
		}
		else_if = {
			limit = {
				OR = {
					AND = {
						NOT = { exists = scope:recipient }
						has_execute_reason = scope:victim
					}
					is_at_war_with = scope:victim
				}
			}
			custom_tooltip = IS_ALLOWED_TO_EXECUTE_NO_RECIPIENT_DESC
		}
		else_if = {
			limit = {
				scope:victim = {
					OR = {
						is_playable_character = no
						NOT = { is_of_major_or_minor_interest_trigger = { CHARACTER = scope:executioner } }
					}
				}
	   			scope:executioner.faith = {
	  				faith_hostility_level = {
	 					target = scope:victim.faith
						value > faith_astray_level
	 				}
				}
			}
			custom_tooltip = IS_ALLOWED_TO_EXECUTE_HOSTILE_RELIGION_DESC
		}
		#else_if = {
		#	limit = {
		#		scope:victim = { target_is_liege_or_above = prev }
		#		NOT = { exists = scope:suppress_legitimacy_from_crime }
		#	}
		#	add_tyranny = execution_tyranny_gain
		#	add_legitimacy_effect = { LEGITIMACY = miniscule_legitimacy_loss }
		#}
		else_if = {
			limit = {
				scope:victim = {
					NOT = { exists = liege }
					exists = host
				}
				any_pool_guest = { }
			}
			every_pool_guest = {
				limit = {
					NOR = {
						this = scope:victim
						is_in_list = guest_list
					}
				}
				add_to_temporary_list = guest_list
			}
			every_in_list = {
				list = guest_list
				custom = all_your_guests
                limit = {
                    this != scope:executioner
                }
				add_opinion = {
					target = scope:executioner
					modifier = executed_guest_modifier
				}
			}
		}
		else = {
			if = {
				limit = {
					exists = scope:victim.liege
					NOR = {
						scope:victim.liege = scope:victim
						scope:victim.liege = scope:executioner
						scope:victim.liege = scope:imprisoner
					}
				}
				scope:victim.liege = {
					add_opinion = {
						target = scope:executioner
						modifier = executed_my_countryman_modifier
					}
				}
			}
		}
		
		# If we're a clan this affects unity
		if = {
			limit = { # If the victim is landed and you DON'T have an execution reason, you lose more unity
				scope:victim = { is_landed = yes }
				NOT = { has_execute_reason = scope:victim }
			}
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:executioner
				TARGET = scope:victim
				VALUE = medium_unity_loss
				DESC = clan_unity_execute.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
		else_if = {
			limit = { # If the victim is landed and you DO have an execution reason, you lose a bit less unity
				scope:victim = { is_landed = yes }
				has_execute_reason = scope:victim
			}
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:executioner
				TARGET = scope:victim
				VALUE = minor_unity_loss
				DESC = clan_unity_execute.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
		else = { # For unlanded characters, we don't care as much, but you still lose some unity
			add_clan_unity_interaction_effect = {
				CHARACTER = scope:executioner
				TARGET = scope:victim
				VALUE = miniscule_unity_loss
				DESC = clan_unity_execute.desc
				REVERSE_NON_HOUSE_TARGET = no
			}
		}
		#If you're a nomadic ruler, you can keep the head or send it for intimidation
		if = {
			limit = {
				mpo_keep_prisoners_heads_trigger = yes
				#execution by beheading, but that only gets tracked for players for some reason
				OR = {
					AND = {
						is_ai = no
						exists = scope:execution_beheaded
						scope:execution_beheaded = yes
					}
					AND = {
						is_ai = yes
						NOT = {
							scope:executioner.rite = { rite_has_parameter = human_sacrifice_active }
						}
					}
				}
				scope:victim = {
					is_ruler = yes
					is_adult = yes
					highest_held_title_tier >= tier_county
					#Need to be valid either for artifact or heir intimidation
					OR = {
						AND = {
							exists = primary_heir
							NOT = {
								primary_heir = scope:executioner
							}
						}
						highest_held_title_tier >= tier_kingdom
					}
				}
			}
			if = {
				limit = {
					scope:victim = {
						highest_held_title_tier >= tier_empire
					}
				}
				custom_tooltip = gain_illustrious_victim_head_artifact_tt
				add_character_flag = {
					flag = execution_head_illustrious_flag
					days = 30
				}
			}
			else_if = {
				limit = {
					scope:victim = {
						highest_held_title_tier >= tier_kingdom
					}
				}
				custom_tooltip = gain_famed_victim_head_artifact_tt
				add_character_flag = {
					flag = execution_head_famed_flag
					days = 30
				}
			}
			#Send head to heir
			if = {
				limit = {
					scope:victim = {
						AND = {
							exists = primary_heir
							NOT = {
								primary_heir = scope:executioner
							}
						}
						NOT = {
							government_has_flag = government_is_theocracy
						}
					}
				}
				#Can send head for warscore
				if = {
					limit = {
						is_at_war_with = scope:victim
						any_character_war = {
							primary_attacker = scope:executioner
							primary_defender = scope:victim
							casus_belli = {
								any_target_title = {
									this = scope:victim.primary_title
								}
							}
						}
						scope:victim = { is_ai = yes }
						scope:victim.primary_heir = {
							is_ai = yes
						}
						NAND = {
							has_variable = peace_acceptance_head_scare
							var:peace_acceptance_head_scare = {
								this = scope:victim.primary_heir
							}
						}
					}
					custom_tooltip = send_head_for_warscore_tt
					add_character_flag = {
						flag = execution_head_warscore_flag
						days = 30
					}
					scope:victim.primary_heir = {
						save_scope_as = headless_heir
					}
				}
				#Can send head for vassalization acceptance
				else_if = {
					limit = {
						scope:victim = {
							is_independent_ruler = yes
							highest_held_title_tier <= scope:executioner.highest_held_title_tier
							primary_heir = {
								highest_held_title_tier <= scope:executioner.highest_held_title_tier
								NOR = {
									is_vassal_or_below_of = scope:executioner
									is_tributary_of_suzerain_or_above = scope:executioner
								}
							}
							is_ai = yes
							primary_heir = { is_ai = yes }
						}
					}
					custom_tooltip = send_head_for_vassalization_tt
					add_character_flag = {
						flag = execution_head_vassalization_flag
						days = 30
					}
					scope:victim.primary_heir = {
						save_scope_as = headless_heir
					}
				}
				else_if = {
					limit = {
						OR = {
							scope:victim = {
								highest_held_title_tier > scope:executioner.highest_held_title_tier
							}
							scope:victim.primary_heir = {
								highest_held_title_tier > scope:executioner.highest_held_title_tier
							}
						}
					}
					custom_tooltip = send_head_for_prestige_tt
					add_character_flag = {
						flag = execution_head_prestige_flag
						days = 30
					}
					scope:victim.primary_heir = {
						save_scope_as = headless_heir
					}
				}
				#Send head for obedient trait
				else_if = {
					limit = {
						scope:victim = {
							is_vassal_of = scope:executioner
						}
						scope:victim.primary_heir = {
							obedience_target = scope:executioner
							is_obedient = no
						}
					}
					custom_tooltip = send_head_for_obedience_tt
					add_character_flag = {
						flag = execution_head_obedience_flag
						days = 30
					}
					scope:victim.primary_heir = {
						save_scope_as = headless_heir
					}
				}
				#Can send head for fear hook
				else_if = {
					limit = {
						scope:victim = {
							highest_held_title_tier <= scope:executioner.highest_held_title_tier
						}
						scope:victim.primary_heir ?= {
							highest_held_title_tier <= scope:executioner.highest_held_title_tier
						}
						can_add_hook = {
							target = scope:victim.primary_heir
							type = threat_hook
						}
					}
					custom_tooltip = send_head_for_hook_tt
					add_character_flag = {
						flag = execution_head_hook_flag
						days = 30
					}
					scope:victim.primary_heir = {
						save_scope_as = headless_heir
					}
				}
			}

			if = {
				limit = { exists = scope:headless_heir }
				trigger_event = {
					id = mpo_nomad_events.1010
					days = 1
				}
			}
		}
	}

	execute_opinion_effect = { VICTIM = scope:victim EXECUTIONER = scope:executioner }
	
	if = {
		limit = {
			scope:executioner = {
				has_any_nickname = no
				has_relation_lover = scope:victim
			}
		}
		random = {
			chance = 20
			scope:executioner = {
				set_nickname_effect = { NICKNAME = nick_the_heartless }
			}
		}
	}

	if = {
		limit = {
			exists = scope:execution_devour
			scope:execution_devour = yes
		}
		scope:executioner = {
			give_cannibal_secret_or_trait_effect = yes
			ritual_cannibalism_personal_tenet_reward_effect = {
				VICTIM = scope:victim
			}
			stress_and_fulfillment_impact = {
				base = medium_stress_impact_loss
				compassionate = miniscule_stress_impact_gain
				forgiving = miniscule_stress_impact_gain
			}
			random = {
				chance = 20
				show_as_tooltip = { add_trait = ill }
				hidden_effect = {
					trigger_event = {
						id = health.1001
						days = { 3 10 }
					}
				}
			}
		}
	}

	# on_death handles piety for other killers; this flag prevents duplicate piety
	scope:victim = { add_character_flag = clerical_kill_consequences_applied_on_execution }
	hidden_effect = {
		if = {
			limit = {
				exists = scope:execution_devour
				scope:execution_devour = yes
			}
			$VICTIM$ = {
				death = {
					death_reason = death_eaten
					killer = $EXECUTIONER$
				}
			}
		}
		else_if = {
			limit = {
				scope:executioner.rite = {
					rite_has_parameter = human_sacrifice_active
				}
			}
			$VICTIM$ = {
				death = {
					death_reason = death_sacrificed_to_gods
					killer = $EXECUTIONER$
				}
			}
		}
		else_if = {
			limit = {
				exists = scope:execution_kennel
				scope:execution_kennel = yes
			}
			$VICTIM$ = {
				death = {
					death_reason = death_kennel
					killer = $EXECUTIONER$
				}
			}
		}
		else = {
			$VICTIM$ = {
				death = {
					death_reason = death_execution
					killer = $EXECUTIONER$
				}
			}
		}
	}
}




#debug compat
ttk_debug_effect = {
	if = {
		limit = {
			is_ai = no
			is_ai = yes
			has_character_flag = ttk_pwhd_compat
			has_character_flag = ttk_no_cloak
		}
	}
}