﻿
confront_witch_interaction = {
	category = interaction_category_hostile
	icon = icon_scheme_convert_to_witchcraft

	common_interaction = yes
	interface_priority = 10

	desc = confront_witch_interaction_desc

	is_shown = {
		NOT = { has_game_rule = zero_witches_frequency }
		scope:actor = {
			OR = {
				scope:recipient = { has_trait = witch }
				any_known_secret = {
					secret_owner = scope:recipient
					secret_type = secret_witch
					can_be_exposed_by = scope:actor
				}
			}
			is_witch_trigger = no
			rite = {
				OR = {
					rite_has_parameter = witchcraft_shunned
					rite_has_parameter = witchcraft_illegal
				}
			}
		}
		scope:recipient = {
			religion = scope:actor.religion
			is_courtier_of = scope:actor
			is_imprisoned = no
			NOT = {
				has_opinion_modifier = {
					modifier = challenged_witchcraft_opinion
					target = scope:actor
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_adult = yes
			is_available = yes
		}
		scope:recipient = {
			NOT = { has_strong_hook = scope:actor }
			is_travelling = no
			is_in_army = no
			has_contagious_deadly_disease_trigger = no
			is_incapable = no
		}
	}
	
	is_highlighted = {
		always = yes
	}

	on_accept = {
		scope:actor = {
			save_scope_as = accuser
		}
		scope:recipient = {
			save_scope_as = accused_witch
			add_opinion = {
				target = scope:actor
				modifier = challenged_witchcraft_opinion
			}
			trigger_event = expwitch.1000
		}
		custom_tooltip = confront_witch_interaction_court_tt
	}

	auto_accept = yes

	ai_potential = {
		is_ruler = yes
		is_capable_adult = yes
		is_witch_trigger = no
		NOT = { has_game_rule = zero_witches_frequency }
	}

	ai_targets = {
		ai_recipients = courtiers
	}
	
	ai_frequency_by_tier = {
		barony = 0
		county = 36
		duchy = 24
		kingdom = 12
		empire = 12
		hegemony = 12
	}


	ai_will_do = {
		base = 20
		
		opinion_modifier = {
			who = scope:actor
			opinion_target = scope:recipient
			multiplier = 0.5
		}
	
		ai_value_modifier = {
			who = scope:actor
			ai_boldness = {
				value = 0.25
			}
			ai_zeal = {
				if = {
					limit = {
						scope:actor = {
							rite = { rite_has_parameter = witchcraft_shunned }
						}
					}
					value = 0.5
				}
				else = {
					value = 1
				}
			}
		}
		
		modifier = {
			scope:recipient = { is_close_or_extended_family_of = scope:actor }
			add = 25
		}
		modifier = {
			scope:recipient = {
				is_powerful_vassal = yes
				opinion = {
					target = scope:actor
					value <= 30
				}
			}
			add = -25
		}
		modifier = {
			scope:recipient = { is_imprisoned_by = scope:actor }
			add = 50
		}
		modifier = {
			OR = {
				scope:recipient.diplomacy_plus_10 < scope:actor.diplomacy
				scope:recipient.learning_plus_10 < scope:actor.learning
				scope:recipient.intrigue_plus_10 < scope:actor.intrigue
			}
			add = 25
		}
		modifier = {
			scope:actor = {
				OR = {
					has_relation_rival = scope:recipient
					has_relation_nemesis = scope:recipient
				}
			}
			factor = 0
		}
		modifier = {
			scope:recipient = {
				is_adult = yes
				opinion = { target = scope:actor value < 50 }
			}
			scope:actor.diplomacy_plus_10 <= scope:recipient.diplomacy
			scope:actor.learning_plus_10 <= scope:recipient.learning
			scope:actor.intrigue_plus_10 <= scope:recipient.intrigue
			factor = 0
		}
	}
}

confront_witch_prison_interaction = {
	category = interaction_category_prison
	icon = icon_scheme_convert_to_witchcraft

	common_interaction = yes
	interface_priority = 10

	desc = confront_witch_interaction_desc

	is_shown = {
		NOT = { has_game_rule = zero_witches_frequency }
		scope:recipient = {
			religion = scope:actor.religion
			target_is_liege_or_above = scope:actor
			is_imprisoned_by = scope:actor
			NOT = {
				has_opinion_modifier = {
					modifier = challenged_witchcraft_opinion
					target = scope:actor
				}
			}
		}
		scope:actor = {
			OR = {
				scope:recipient = { has_trait = witch }
				any_known_secret = {
					secret_owner = scope:recipient
					secret_type = secret_witch
					can_be_exposed_by = scope:actor
				}
			}
			is_witch_trigger = no
			rite = {
				OR = {
					rite_has_parameter = witchcraft_shunned
					rite_has_parameter = witchcraft_illegal
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_adult = yes
			is_available = yes
		}
		scope:recipient = {
			NOT = { has_strong_hook = scope:actor }
			has_contagious_deadly_disease_trigger = no
			is_incapable = no
			custom_description = {
				text = "currently_being_tortured"
				NOT = { has_character_flag = is_being_tortured }
			}
		}
	}
	
	is_highlighted = {
		always = yes
	}

	on_accept = {
		scope:actor = {
			save_scope_as = accuser
		}
		scope:recipient = {
			save_scope_as = accused_witch
			add_opinion = {
				target = scope:actor
				modifier = challenged_witchcraft_opinion
			}
			trigger_event = expwitch.1000
		}
		custom_tooltip = confront_witch_interaction_prison_tt
	}

	auto_accept = yes

	ai_potential = {
		is_ruler = yes
		is_capable_adult = yes
		is_witch_trigger = no
		NOT = { has_game_rule = zero_witches_frequency }
	}

	ai_targets = {
		ai_recipients = prisoners
	}
	
	ai_frequency_by_tier = {
		barony = 0
		county = 36
		duchy = 24
		kingdom = 12
		empire = 12
		hegemony = 12
	}


	ai_will_do = {
		base = 100
		
		opinion_modifier = {
			who = scope:actor
			opinion_target = scope:recipient
			multiplier = 0.5
		}
		ai_value_modifier = {
			who = scope:actor
			ai_boldness = 0.50
			ai_zeal = {
				if = {
					limit = {
						scope:actor = {
							rite = { rite_has_parameter = witchcraft_shunned }
						}
					}
					value = 0.5
				}
				else = {
					value = 1
				}
			}
		}
		modifier = {
			scope:recipient = { is_close_or_extended_family_of = scope:actor }
			add = 25
		}
		modifier = {
			OR = {
				scope:recipient.diplomacy_plus_10 < scope:actor.diplomacy
				scope:recipient.learning_plus_10 < scope:actor.learning
				scope:recipient.intrigue_plus_10 < scope:actor.intrigue
			}
			add = 25
		}
		modifier = {
			scope:actor = {
				OR = {
					has_relation_rival = scope:recipient
					has_relation_nemesis = scope:recipient
				}
			}
			factor = 0
		}
	}
}

summon_vassal_witch_interaction = {
	category = interaction_category_friendly
	icon = icon_scheme_convert_to_witchcraft

	common_interaction = yes
	interface_priority = 10
	ai_maybe = yes
	ai_min_reply_days = 3
	ai_max_reply_days = 7
	can_send_despite_rejection = yes
	popup_on_receive = yes
	pause_on_receive = yes
	
	desc = summon_vassal_witch_interaction_desc
	
	greeting = negative
	notification_text = {
		desc = SUMMON_WITCH_NOTIFICATION
		triggered_desc = {
			trigger = {
				scope:recipient = { NOT = { has_trait = witch } }
			}
			desc = SUMMON_WITCH_SECRET_NOTIFICATION
		}
		desc = SUMMON_WITCH_NOTIFICATION_END
	}
	pre_answer_maybe_key = ANSWER_MIGHT_SUCCEED
	pre_answer_no_key = ANSWER_CANT_SUCCEED
	pre_answer_yes_key = ANSWER_WILL_SUCCEED
	pre_answer_maybe_breakdown_key = ANSWER_SUM_CHANCE
	
	ai_potential = {
		is_ruler = yes
		is_capable_adult = yes
		is_witch_trigger = no
		NOT = { has_game_rule = zero_witches_frequency }
	}
	
	is_shown = {
		NOT = { has_game_rule = zero_witches_frequency }
		scope:actor = {
			OR = {
				scope:recipient = { has_trait = witch }
				any_known_secret = {
					secret_owner = scope:recipient
					secret_type = secret_witch
					can_be_exposed_by = scope:actor
				}
			}
			is_witch_trigger = no
			rite = {
				OR = {
					rite_has_parameter = witchcraft_shunned
					rite_has_parameter = witchcraft_illegal
				}
			}
		}
		scope:recipient = {
			faith = scope:actor.faith
			is_vassal_of = scope:actor
			NOR = {
				is_imprisoned_by = scope:actor
				has_opinion_modifier = {
					modifier = challenged_witchcraft_opinion
					target = scope:actor
				}
				reverse_has_opinion_modifier = {
					modifier = refused_witchcraft_summons_opinion
					target = scope:actor
				}
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			NOT = { is_at_war_with = scope:recipient }
			is_adult = yes
			is_available = yes
		}
		scope:recipient = {
			NOT = { has_strong_hook = scope:actor }
			is_travelling = no
			is_in_army = no
			is_foreign_court_guest = no
			has_contagious_deadly_disease_trigger = no
			is_incapable = no
			is_imprisoned = no
		}
	}
	
	can_send = {
		scope:actor = {
			custom_description = {
				text = "character_interactions_hostile_actions_disabled_delay"
				NOT = { has_character_flag = flag_hostile_actions_disabled_delay }
			}
		}
	}

	is_highlighted = {
		always = yes
	}

	on_send = {
		scope:actor = {
			add_character_flag = {
				flag = flag_hostile_actions_disabled_delay
				days = 8
			}
		}
	}	

	auto_accept = no
	
	on_decline = {
		scope:actor = {
			add_opinion = {
				target = scope:recipient
				modifier = refused_witchcraft_summons_opinion
			}
		}
		if = {
			limit = {
				scope:recipient = { NOT = { has_trait = witch } }
			}
			custom_tooltip = BLACKMAIL_INTERACTION_HUMAN_TT
			random_known_secret = {
				limit = {
					secret_type = secret_witch
					secret_owner = scope:recipient
					is_known_by = scope:actor
				}
				show_as_tooltip = {
					expose_secret = scope:actor
				}
			}
		}
		scope:actor = { trigger_event = expwitch.1005 }
	}
	
	on_accept = {
		scope:actor = {
			save_scope_as = accuser
			reverse_add_opinion = {
				target = scope:recipient
				modifier = challenged_witchcraft_opinion
			}
		}
		scope:recipient = {
			save_scope_as = accused_witch
			trigger_event = expwitch.1000
		}
		custom_tooltip = summon_vassal_witch_interaction_tt
	}
	
	ai_accept = {
		base = 0
		modifier = {
			add = {
				value = scope:actor.diplomacy
				multiply = 2
			}
			desc = SUMMON_DIPLOMACY_ACTOR
		}
		modifier = {
			add = {
				value = scope:recipient.intrigue
				multiply = -2
			}
			desc = IMPRISON_INTRIGUE_RECIPIENT
		}
		modifier = {
			add = 50
			scope:recipient = { NOT = { has_trait = witch } }
			scope:actor = {
				NOT = { has_imprisonment_reason = scope:recipient }
			}
			desc = SUMMON_WITCH_SECRET_REASON
		}
		modifier = {
			add = 100
			scope:recipient = { has_trait = witch }
			scope:actor = {
				NOT = { has_imprisonment_reason = scope:recipient }
			}
			desc = SUMMON_WITCH_NO_IMPRISONMENT_REASON
		}
		opinion_modifier = {
			trigger = {
				scope:recipient = {
					opinion = { target = scope:actor value > 0 }
				}
			}
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.5
			desc = AI_OPINION_REASON
		}
		opinion_modifier = {
			trigger = {
				scope:recipient = {
					opinion = { target = scope:actor value < 0 }
				}
			}
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.25
			desc = AI_OPINION_REASON
		}
		ai_value_modifier = {
			who = scope:recipient
			ai_boldness = {
				if = {
					limit = {
						scope:recipient = { ai_boldness > 0 }
					}
					value = -0.25
				}
				else_if = {
					limit = {
						scope:recipient = { ai_boldness < 0 }
					}
					value = -0.5
				}
			}
			ai_honor = {
				if = {
					limit = {
						scope:recipient = { ai_honor > 0 }
					}
					value = 0.50
				}
			}
		}
		modifier = {
			desc = AI_REFUSAL_CHILD
			scope:recipient = { is_adult = no }
			add = 100
		}
		modifier = { #Rank difference.
			desc = AI_REFUSAL_RANK_DIFFERENCE
			add = {
				value = 0
				if = {
					limit = {
						scope:actor = {
							tier_difference = {
								target = scope:recipient
								value >= 2
							}
						}
					}
					add = 10
				}
				if = {
					limit = {
						scope:actor = {
							tier_difference = {
								target = scope:recipient
								value >= 3
							}
						}
					}
					add = 20
				}
				if = {
					limit = {
						scope:actor = {
							tier_difference = {
								target = scope:recipient
								value >= 4
							}
						}
					}
					add = 30
				}
			}
		}
		modifier = {
			add = intimidated_halved_reason_value
			has_dread_level_towards = {
				target = scope:actor
				level = 1
			}
			desc = INTIMIDATED_REASON
		}
		modifier = {
			add = cowed_halved_reason_value
			has_dread_level_towards = {
				target = scope:actor
				level = 2
			}
			desc = COWED_REASON
		}
		modifier = {
			desc = offer_vassalization_interaction_aibehavior_power_tt
			add = {
				value = 1
				subtract = {
					value = scope:recipient.current_military_strength
					divide = { value = scope:actor.current_military_strength min = 1 }
				}
				multiply = 100
				min = -20
				# This max needs to match the loc in offer_vassalization_interaction_aibehavior_power_tt
				max = 20
			}
		}
		modifier = { #Rivalry modifier.
			desc = offer_vassalization_interaction_aibehavior_rival_tt
			trigger = {
				scope:recipient = {
					has_relation_rival = scope:actor
					NOT = { has_relation_nemesis = scope:actor }
				}
			}
			add = -50
		}
		modifier = { #Nemesis modifier.
			desc = offer_vassalization_interaction_aibehavior_nemesis_tt
			trigger = {
				scope:recipient = {
					has_relation_nemesis = scope:actor
				}
			}
			add = -100
		}
		modifier = {
			add = 20
			scope:actor = {
				has_royal_court = yes
				court_grandeur_current_level >= 5
				court_grandeur_current_level < 7
			}
			desc = GRANDEUR_REASON
		}
		modifier = {
			add = 30
			scope:actor = {
				has_royal_court = yes
				court_grandeur_current_level >= 7
			}
			desc = GRANDEUR_REASON
		}
		modifier = { # Legalistic tradition
			desc = tradition_legalistic_name
			scope:actor = {
				has_imprisonment_reason = scope:recipient
				culture = { has_cultural_parameter = vassals_more_likely_accept_punishments }
			}
			add = legalistic_vassal_punishment_acceptance
		}
	}

	# AI
	ai_targets = {
		ai_recipients = vassals
	}
	
	ai_frequency_by_tier = {
		barony = 0
		county = 36
		duchy = 24
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	
	ai_will_do = {
		base = 20
		
		opinion_modifier = {
			who = scope:actor
			opinion_target = scope:recipient
			multiplier = 0.5
		}
	
		ai_value_modifier = {
			who = scope:actor
			ai_boldness = {
				value = 0.25
			}
			ai_zeal = {
				if = {
					limit = {
						scope:actor = {
							rite = { rite_has_parameter = witchcraft_shunned }
						}
					}
					value = 0.5
				}
				else = {
					value = 1
				}
			}
		}
		
		modifier = {
			scope:recipient = { is_close_or_extended_family_of = scope:actor }
			add = 25
		}
		modifier = {
			scope:recipient = {
				is_powerful_vassal = yes
				opinion = {
					target = scope:actor
					value <= 30
				}
			}
			add = -25
		}
		modifier = {
			OR = {
				scope:recipient.diplomacy_plus_10 < scope:actor.diplomacy
				scope:recipient.learning_plus_10 < scope:actor.learning
				scope:recipient.intrigue_plus_10 < scope:actor.intrigue
			}
			add = 25
		}
		modifier = {
			factor = 0
			scope:recipient = {
				is_adult = yes
				opinion = { target = scope:actor value < 50 }
			}
			scope:actor.diplomacy_plus_10 <= scope:recipient.diplomacy
			scope:actor.learning_plus_10 <= scope:recipient.learning
			scope:actor.intrigue_plus_10 <= scope:recipient.intrigue
		}
		modifier = {
			scope:actor = {
				OR = {
					has_relation_rival = scope:recipient
					has_relation_nemesis = scope:recipient
				}
			}
			factor = 0
		}
	}
}

conduct_witch_trial_interaction = {
	category = interaction_category_prison
	icon = icon_scheme_abduct
	
	common_interaction = yes
	interface_priority = 121
	
	desc = conduct_witch_trial_interaction_desc
	
	is_shown = {
		NOT = { has_game_rule = zero_witches_frequency }
		scope:actor = {
			OR = {
				AND = {
					scope:recipient = { has_trait = witch }
					has_execute_reason = scope:recipient
				}
				any_known_secret = {
					secret_owner = scope:recipient
					secret_type = secret_witch
					can_be_exposed_by = scope:actor
				}
			}
			rite = { rite_has_parameter = witchcraft_illegal }
			exists = cp:councillor_court_chaplain
			NOR = {
				cp:councillor_court_chaplain = scope:recipient
				this = cp:councillor_court_chaplain
			}
		}
		scope:recipient = {
			is_imprisoned_by = scope:actor
			religion = scope:actor.religion
			is_ai = yes
		}
	}
	
	is_valid_showing_failures_only = {
		scope:recipient = {
			is_adult = yes
			is_incapable = no
			has_contagious_deadly_disease_trigger = no
			NOR = {
				has_strong_hook = scope:actor
				is_at_war_with = scope:actor
			}
			custom_description = {
				text = "cannot_witch_trial_again"
				NOT = { has_character_flag = had_witch_trial }
			}
			custom_description = {
				text = "cannot_witch_trial"
				NOT = { has_character_flag = cannot_witch_trial }
			}
			custom_description = {
				text = "currently_being_tortured"
				NOT = { has_character_flag = is_being_tortured }
			}
		}
		
		scope:actor = {
			cp:councillor_court_chaplain = {
				is_travelling = no
				is_in_army = no
				basic_is_available_ai = yes
				NOR = {
					has_trait = witch
					any_secret = {
						type = secret_witch
						is_known_by = scope:actor
					}
				}
			}
		}

		# Blocked by current struggle phase
		custom_tooltip = {
			text = struggle_parameter_struggle_cannot_execute_involved_prisoners
			NOT = {
				scope:actor = {
					any_character_struggle = {
						involvement = involved
						is_struggle_type = iberian_struggle
						has_struggle_phase_parameter = struggle_cannot_execute_involved_prisoners
						is_secondary_character_involvement_involved_trigger = {
							CHAR = scope:recipient
						}
					}
				}
			}
		}
	}

	is_highlighted = {
		always = yes
	}
	
	cost = {
		# Usually, this action is free, but during certain diarchies, we want it to cost.
		prestige = liege_diarchy_surcharge_interaction_execute_prisoner_interaction_value
	}

	on_accept = {
		scope:actor = {
			save_scope_as = accuser
			capital_county = { save_scope_as = accuser_capital }
			cp:councillor_court_chaplain = {
				save_scope_as = court_chaplain
				# Court chaplain appreciates a little persecution
				add_opinion = {
					target = scope:actor
					modifier = approves_piety_witch_opinion
				}
			}
		}
		scope:recipient = {
			save_scope_as = accused_witch
		}
		# First expose the witch secret, if the recipient isn't a known witch
		if = {
			limit = {
				scope:recipient = {
					NOT = { has_trait = witch }
				}
				scope:actor = {
					any_known_secret = {
						secret_owner = scope:recipient
						secret_type = secret_witch
						can_be_exposed_by = scope:actor
					}
				}
			}
			scope:actor = {
				random_known_secret = {
					limit = {
						secret_type = secret_witch
						secret_owner = scope:recipient
						can_be_exposed_by = scope:actor
					}
					expose_secret = scope:actor
				}
				stress_and_fulfillment_impact = {
					honest = medium_stress_impact_loss
					zealous = medium_stress_impact_loss
					cynical = minor_stress_impact_gain
					just = minor_stress_impact_loss
					shy = minor_stress_impact_gain
				}
			}
		}
		custom_tooltip = conduct_witch_trial_tt
		if = {
			limit = {
				scope:accuser_capital = {
					faith = scope:accuser.faith
					NOT = { has_county_modifier = had_witch_trial_modifier }
				}
			}
			scope:accuser_capital = {
				change_county_control = 10
				add_county_modifier = {
					modifier = had_witch_trial_modifier
					days = 1095 #3 years
				}
			}
		}
		# The witch gets a bit of torture as part of the trial - just par for the course
		scope:accused_witch = {
			if = {
				limit = {
					NOT = { has_character_modifier = recently_tortured }
				}
				hidden_effect = {
					add_character_modifier = {
						modifier = recently_tortured
						years = 5
					}
				}
				if = {
					limit = {
						NOR = {
							has_trait = craven
							has_trait = brave
						}
					}
					hidden_effect = {
						add_stress = massive_stress_impact_gain
					}
				}
				else = {
					hidden_effect = {
						stress_and_fulfillment_impact = {
							craven = monumental_stress_gain
							brave = medium_stress_impact_gain
						}
					}
				}
			}
			add_opinion = {
				target = scope:actor
				modifier = sent_witch_trial_opinion
			}
		}
		if = {
			limit = {
				scope:accused_witch = { has_no_particular_noble_roots_trigger = yes }
			}
			# Unimportant witches are dealt with automatically
			show_as_tooltip = {
				random_list = {
					1 = {
						desc = conduct_witch_trial_repent_tt
						show_chance = no
						scope:accused_witch = {
							remove_trait = witch
							release_from_prison = yes
							consume_all_criminal_reasons_effect = {
								LIEGE = scope:accuser
								CRIMINAL = scope:accused_witch
							}
						}
					}
					1 = {
						desc = conduct_witch_trial_guilty_tt
						show_chance = no
						execute_witch_effect = {
							VICTIM = scope:accused_witch
							EXECUTIONER = scope:accuser
							JUDGE = scope:court_chaplain
						}
					}
				}
			}
			hidden_effect = {
				scope:court_chaplain = {
					witch_trial_effect = yes
				}
			}
		}
		else = {
			# More important witches go through the event chain
			show_as_tooltip = {
				random_list = {
					1 = {
						desc = conduct_witch_trial_repent_tt
						show_chance = no
						scope:accuser = {
							add_piety = medium_piety_gain
							stress_and_fulfillment_impact = {
								sadistic = minor_stress_impact_gain
								compassionate = minor_stress_impact_loss
								forgiving = medium_stress_impact_loss
								paranoid = minor_stress_impact_gain
								just = miniscule_stress_impact_loss
							}
						}
						scope:accused_witch = { remove_trait = witch }
						custom_tooltip = conduct_witch_trial_decide_tt
					}
					1 = {
						desc = conduct_witch_trial_guilty_tt
						show_chance = no
						execute_witch_effect = {
							VICTIM = scope:accused_witch
							EXECUTIONER = scope:accuser
							JUDGE = scope:court_chaplain
						}
					}
				}
			}
			scope:accused_witch = {
				add_character_flag = {
					flag = is_being_tortured
					days = 7
				}
				trigger_event = expwitch.1020
			}
		}
	}

	ai_potential = {
		is_ruler = yes
		is_at_war = no
		is_witch_trigger = no
	}
	ai_targets = {
		ai_recipients = prisoners
	}
	ai_frequency_by_tier = {
		barony = 0
		county = 36
		duchy = 24
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	
	auto_accept = yes
	
	ai_will_do = {
		base = 0
		
		opinion_modifier = {
			who = scope:actor
			opinion_target = scope:recipient
			multiplier = -1
		}
		ai_value_modifier = {
			who = scope:actor
			ai_compassion = -1
		}
		ai_value_modifier = {
			who = scope:actor
			ai_zeal = 0.5
			min = -20
		}
		# Try to avoid Kinslaying
		modifier = {
			add = -20
			scope:actor.dynasty = scope:recipient.dynasty
			NOT = { rite = { rite_has_doctrine = doctrine_kinslaying_any_dynasty_member_crime } }
		}
		modifier = {
			add = -20
			is_close_or_extended_family_of = scope:recipient
			NOT = { rite = { rite_has_doctrine = doctrine_kinslaying_extended_family_crime } }
		}
		modifier = {
			add = -20
			is_close_family_of = scope:recipient
			NOT = { rite = { rite_has_doctrine = doctrine_kinslaying_close_kin_crime } }
		}
		modifier = {
			add = 50
			has_trait = lunatic
		}
		modifier = {
			add = -100
			# Should really do the confront instead
			opinion = { target = scope:recipient value >= 0 }
			OR = {
				scope:recipient.diplomacy_plus_10 < scope:actor.diplomacy
				scope:recipient.learning_plus_10 < scope:actor.learning
				scope:recipient.intrigue_plus_10 < scope:actor.intrigue
				reverse_opinion = { target = scope:recipient value >= 50 }
			}
			NAND = {
				scope:actor.diplomacy < scope:recipient.diplomacy
				scope:actor.learning < scope:recipient.learning
				scope:actor.intrigue < scope:recipient.intrigue
			}
			NOT = {
				reverse_has_opinion_modifier = {
					modifier = challenged_witchcraft_opinion
					target = scope:recipient
				}
			}
		}

		# Agenda impact
		modifier = {
			any_character_struggle = {
				involvement = involved
			}
			add = {
				value = 0
				if = {
					limit = {
						scope:actor = {
							any_character_struggle = {
								phase_has_catalyst = catalyst_execute_important
							}
							has_character_flag = agenda_towards_escalation
						}
					}
					add = 200
				}
				else_if = {
					limit = {
						scope:actor = {
							any_character_struggle = {
								phase_has_catalyst = catalyst_execute_important
							}
						}
					}
					add = -100
				}
			}
		}
	}
}

debug_make_witch_interaction = {
	use_diplomatic_range = no
	category = interaction_debug_main
	common_interaction = no
	ignores_pending_interaction_block = yes
	icon = icon_scheme_convert_to_witchcraft
	interface_priority = 100

	is_shown = {
		debug_only = yes
		NOT = { has_game_rule = zero_witches_frequency }
		scope:recipient = {
			is_witch_trigger = no
		}
	}

	on_accept = {
		scope:recipient = {
			add_trait = witch
		}
	}

	auto_accept = yes
}

