﻿house_trad_partition_house_interaction = {
	icon = icon_dynasty
	category = interaction_category_diplomacy
	use_diplomatic_range = no
	interface_priority = 60
	
	is_shown = {
		NOT = { scope:recipient = scope:actor }

		scope:actor = {
			is_dynast = yes
			dynasty = scope:recipient.dynasty
		}
		scope:recipient = {
			is_landed_or_landless_administrative = yes
		}
	}
	
	is_valid = {
		scope:recipient = { is_house_head = no }
		scope:recipient = { is_landed_or_landless_administrative = yes }
		trigger_if = {
			limit = { scope:recipient.top_liege = { government_allows = administrative } }
			custom_description = {
				text = house_trad_not_already_noble_house_tt
				scope:recipient = {
					NAND = {
						house_head = { government_allows = administrative }
						top_liege = house.house_head.top_liege
					}
				}
			}
		}
		trigger_if = {
			limit = { exists = scope:recipient.house.house_head }
			scope:recipient.house.house_head = {
				custom_description = {
					text = house_trad_partition_house_decision_succession_line_tt
					NOT = {
						any_held_title = {
							place_in_line_of_succession = {
								target = scope:recipient
								value <= 1
							}
						}
					}
				}
			} # House Head succession check bloc
		}
	}
	
	on_accept = {
		scope:recipient = {
			found_cadet_house_decision_effect = {
				CHARACTER = scope:recipient
				PRESTIGE = major_prestige_gain
			}
			if = {
				limit = {
					government_allows = administrative
					highest_held_title_tier >= tier_duchy
				}
				create_noble_family_effect = yes
				change_influence = major_influence_gain
			}
		}
	}
	
	cost = {
		prestige = 500
		renown = 250
	}
	auto_accept = yes
	
	ai_will_do = {
		base = 0
	}
}
house_trad_abdicate_house_interaction = {
	icon = icon_dynasty
	category = interaction_category_diplomacy
	use_diplomatic_range = no
	interface_priority = 60
	
	is_shown = {
		NOT = { scope:recipient = scope:actor }

		scope:actor = {
			is_house_head = yes
			house = scope:recipient.house
		}
		scope:recipient = {
			is_landed_or_landless_administrative = yes
		}
	}
	
	is_valid = {
		scope:recipient = { primary_title.tier >= scope:actor.primary_title.tier }
	}
	
	on_accept = {
		scope:actor.house = { set_house_head = scope:recipient }
		scope:actor = { add_prestige_level = -1 }
	}
	
	cost = {
		# Only the Dynasty Head can expend renown.
		prestige = {
			value = {
				add = 500
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = yes
						}
					}
					add = 500
				}
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = no
							any_heir_title = {
								exists = holder
							}
						}
					}
					add = 0
				}
			}
		}
	}
	auto_accept = yes
	
	ai_will_do = {
		base = 0
	}
}

#######################

house_trad_house_disinherit_interaction = {
	icon = icon_dynasty
	category = interaction_category_hostile
	use_diplomatic_range = no
	interface_priority = 60

	desc = disinherit_interaction_desc
	use_diplomatic_range = no
	
	is_shown = {
		NOT = { 
			scope:recipient = scope:actor 

			AND = { # Explicit AND to ensure no funny business
				scope:recipient = { is_child_of = scope:actor }
				scope:actor.house = {
					this = scope:recipient.house
					has_dynasty_perk = fp2_coterie_legacy_5
				}
			}
		}

		scope:actor = {
			is_house_head = yes
			house = scope:recipient.house

		}
		scope:recipient = {
			NOT = {
				has_trait = disinherited
			}
		}
	}

	is_valid = {
		custom_description = {
			scope:actor.culture = {
				NOT = { has_cultural_parameter = cannot_disherit }
			} 
			text = "mystical_ancestors_disinherit"
		}
	}

	is_valid_showing_failures_only = {
		trigger_if = {
			limit = {
				NOT = { # in such cases, it will be free so no need to check for Renown
					scope:recipient = {
						OR = {
							has_trait = disputed_heritage
							any_secret = {
								secret_type = secret_disputed_heritage
								is_known_by = scope:actor
							}
							has_trait = bastard
						}
					}
				}
			}
			scope:actor.dynasty = {
				dynasty_prestige >= medium_dynasty_prestige_value
			}
		}

		scope:recipient = { is_busy_in_events_localised = yes }
		scope:recipient = { NOT = { has_strong_hook = scope:actor } }
#		trigger_if = {
#			limit = {
#				scope:recipient = {
#					NOR = {
#						is_child_of = scope:actor
#						is_grandchild_of = scope:actor
#						is_great_grandchild_of = scope:actor
#					}
#				}
#			}
#			custom_description = {
#				scope:recipient.top_liege = scope:actor.top_liege
#				text = "same_realm_as"
#			}
#		}
# Why should this be disabled if they're not in realm? That's more the reason to disinherit!
		custom_tooltip = {
			text = cannot_take_overt_hostile_actions_against_diarch.tt
			NOT = { scope:recipient ?= scope:actor.diarch }
		}
	}

	on_auto_accept = {
		scope:recipient = {
			trigger_event = char_interaction.0020
		}
	}
	
	on_accept = {
		scope:actor = {
			stress_impact = {
				forgiving = minor_stress_impact_gain
				compassionate = minor_stress_impact_gain
			}
			
			#Legitimacy loss
			if = {
				limit = { has_legitimacy = yes }
				if = {
					limit = { scope:recipient = { is_primary_heir_of = scope:actor } }
					add_legitimacy = {
						value = medium_legitimacy_loss
						multiply = scope:actor.primary_title.tier
					}
				}
				else_if = {
					limit = { scope:recipient = { is_child_of = scope:actor } }
					add_legitimacy = {
						value = minor_legitimacy_loss
						multiply = scope:actor.primary_title.tier
					}
				}
				else = {
					add_legitimacy = {
						value = miniscule_legitimacy_loss
						multiply = scope:actor.primary_title.tier
					}
				}
			}
			hidden_effect = {
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = disinherit_interaction_notification

					left_icon = scope:actor					
					right_icon = scope:recipient

					scope:recipient = {
						show_as_tooltip = {
							disinherit_effect = { DISINHERITOR = scope:actor }
						}
					}
				}
			}
		}

		scope:recipient = {
			disinherit_effect = { DISINHERITOR = scope:actor }
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = medium_unity_loss
			DESC = clan_unity_disinheritance.desc
			REVERSE_NON_HOUSE_TARGET = no
		}

		if = {
			limit = {
				scope:recipient = {
					any_secret = {
						secret_type = secret_disputed_heritage
						is_known_by = scope:actor
						save_temporary_scope_as = secret_to_reveal
					}
				}
			}

			scope:secret_to_reveal = {
				expose_secret = scope:recipient.mother
			}

			scope:recipient = {
				add_trait = disputed_heritage
			}
		}
	}
	
	cost = {
		renown = {
			if = {
				limit = { scope:actor = { is_dynast = yes } }
				value = {
					add = medium_dynasty_prestige_value
					if = {
						limit = {
							scope:recipient = {
								is_landed_or_landless_administrative = yes
							}
						}
						add = major_dynasty_prestige_value
					}
					if = {
						limit = {
							scope:recipient = {
								is_landed_or_landless_administrative = no
								any_heir_title = {
									exists = holder
								}
							}
						}
						add = medium_dynasty_prestige_value
					}
					if = {
						limit = {
							scope:recipient = {
								OR = {
									has_trait = disputed_heritage
									any_secret = {
										secret_type = secret_disputed_heritage
										is_known_by = scope:actor
									}
									has_trait = bastard
								}
							}
						}
						multiply = 0
					}
				}
			} # Only if Dynast.
		}
		prestige = {
			value = {
				add = medium_prestige_value
#				if = {
#					limit = {
#						scope:actor = { is_dynast = no }
#						scope:recipient = {
#							is_landed_or_landless_administrative = yes
#						}
#					}
#					add = medium_prestige_value
#				} # Non-dynasts pay more prestige to compensate, but not if they are already landed. (Massive Prestige Value is huge)
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = yes
						}
					}
					add = massive_prestige_value
				}
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = no
							any_heir_title = {
								exists = holder
							}
						}
					}
					add = medium_prestige_value
				}
				if = {
					limit = {
						scope:recipient = {
							OR = {
								has_trait = disputed_heritage
								any_secret = {
									secret_type = secret_disputed_heritage
									is_known_by = scope:actor
								}
								has_trait = bastard
							}
						}
					}
					multiply = 0
				}
			}
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_at_war = no
		NOT = {
			has_trait = forgiving
		}
	}
	
	ai_targets = {
		ai_recipients = dynasty
		max = 20
	}
	
	ai_frequency = 96
	
	ai_will_do = {
		base = 0
		
		modifier = {
			add = -100
			scope:actor = {
				OR = {
					legitimacy_level = 0
					legitimacy_level = 1
				}
			}
			scope:recipient = { is_primary_heir_of = scope:actor }
		}
		
		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_relation_rival = scope:actor
					has_relation_nemesis = scope:actor
				}
			}
		}
		
		modifier = {
			add = 100
			scope:recipient = {
				is_primary_heir_of = scope:actor
				OR = {
					has_trait = inbred
					has_trait = intellect_bad_3
					has_trait = incapable
				}
			}
		}
		
		modifier = {
			add = 5
			ai_vengefulness >= medium_positive_ai_value
			scope:recipient = {
				is_heir_of = scope:actor
			}
			OR = {
				AND = {
					scope:recipient = {
						has_character_modifier = blacksheep
					}
					NOT = { has_character_modifier = blacksheep }
				}
				AND = {
					scope:recipient = {
						has_trait = incestuous
					}
					NOT = { is_incestuous_trigger = yes }
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = kinslayer
					}
					NOT = { has_trait = kinslayer }
				}
				AND = {
					scope:recipient = {
						has_trait = adulterer
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = fornicator
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = deviant
					}
					NOT = {
						is_deviant_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = witch
					}
					NOT = {
						is_witch_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = sodomite
					}
					NOR = {
						has_trait = sodomite
						any_secret = {
							secret_type = secret_homosexual
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = cannibal
					}
					NOT = {
						is_cannibal_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
			}
		}

		# Unity modifiers
		evaluate_action_decreasing_house_unity = {
			VALUE = 100
		}
		
		modifier = {
			factor = 0
			scope:recipient = {
				OR = {
					has_relation_friend = scope:actor
					has_relation_best_friend = scope:actor
				}
			}
		}
		
		modifier = {
			factor = 0
			scope:recipient = {
				is_ai = no
			}
		}
	}
}

house_trad_disinherit_distant_children_interaction = {
	icon = icon_dynasty
	category = interaction_category_hostile
	interface_priority = 60

	desc = disinherit_children_interaction_desc
	use_diplomatic_range = no

	is_shown = {
		# DLC checking
		has_fp2_dlc_trigger = yes
		# Standard check
		NOT = { scope:recipient = scope:actor }

		scope:actor.dynasty = {
			this = scope:recipient.dynasty
			has_dynasty_perk = fp2_coterie_legacy_5
		}
		scope:recipient = {
			NOT = {
				has_trait = disinherited
			}
			in_diplomatic_range = no
		}
	}

	is_valid = {
		scope:actor = { is_parent_of = scope:recipient }


		custom_description = {
			scope:actor.culture = {
				NOT = { has_cultural_parameter = cannot_disherit }
			}
			text = "mystical_ancestors_disinherit"
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			prestige >= major_prestige_value
		}
		scope:recipient = { is_busy_in_events_localised = yes }
		scope:recipient = { NOT = { has_strong_hook = scope:actor } }
		
		# Probably would never come up but keeping it just in case
		custom_tooltip = {
			text = cannot_take_overt_hostile_actions_against_diarch.tt
			NOT = { scope:recipient ?= scope:actor.diarch }
		}
	}

	on_auto_accept = {
		scope:recipient = {
			trigger_event = char_interaction.0020
		}
	}

	on_accept = {
		scope:actor = {
			stress_impact = {
				forgiving = minor_stress_impact_gain
				compassionate = minor_stress_impact_gain
			}
			add_tyranny = massive_tyranny_value
			hidden_effect = {
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = disinherit_interaction_notification

					left_icon = scope:actor
					right_icon = scope:recipient

					scope:recipient = {
						show_as_tooltip = {
							disinherit_effect = { DISINHERITOR = scope:actor }
						}
					}
				}
			}
		}

		scope:recipient = {
			disinherit_effect = { DISINHERITOR = scope:actor }
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = minor_unity_loss
			DESC = clan_unity_disinheritance.desc
			REVERSE_NON_HOUSE_TARGET = no
		}		
	}

	cost = {
		prestige = {
			value = {
				add = medium_prestige_value
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = yes
						}
					}
					add = massive_prestige_value
				}
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = no
							any_heir_title = {
								exists = holder
							}
						}
					}
					add = medium_prestige_value
				}
			}
		}
	}

	auto_accept = yes

	ai_potential = {
		is_at_war = no
		NOT = {
			has_trait = forgiving
		}
	}

	ai_targets = {
		ai_recipients = dynasty
		max = 20
	}

	ai_frequency = 96

	ai_will_do = {
		base = 0

		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_relation_rival = scope:actor
					has_relation_nemesis = scope:actor
				}
			}
		}

		modifier = {
			add = 100
			scope:recipient = {
				is_primary_heir_of = scope:actor
				OR = {
					has_trait = inbred
					has_trait = intellect_bad_3
					has_trait = incapable
				}
			}
		}

		modifier = {
			add = 5
			ai_vengefulness >= medium_positive_ai_value
			scope:recipient = {
				is_heir_of = scope:actor
			}
			OR = {
				AND = {
					scope:recipient = {
						has_character_modifier = blacksheep
					}
					NOT = { has_character_modifier = blacksheep }
				}
				AND = {
					scope:recipient = {
						has_trait = incestuous
					}
					NOT = { is_incestuous_trigger = yes }
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = kinslayer
					}
					NOT = { has_trait = kinslayer }
				}
				AND = {
					scope:recipient = {
						has_trait = adulterer
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = fornicator
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = deviant
					}
					NOT = {
						is_deviant_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = witch
					}
					NOT = {
						is_witch_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = sodomite
					}
					NOR = {
						has_trait = sodomite
						any_secret = {
							secret_type = secret_homosexual
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = cannibal
					}
					NOT = {
						is_cannibal_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
			}
		}

		# Unity modifiers
		evaluate_action_decreasing_house_unity = {
			VALUE = 100
		}

		modifier = {
			factor = 0
			scope:recipient = {
				OR = {
					has_relation_friend = scope:actor
					has_relation_best_friend = scope:actor
				}
			}
		}

		modifier = {
			factor = 0
			scope:recipient = {
				is_ai = no
			}
		}
	}
}

house_trad_house_restore_inheritance_interaction = {
	icon = icon_dynasty
	category = interaction_category_friendly
	desc = restore_inheritance_interaction_desc

	interface_priority = 60

	is_shown = {
		scope:actor = {
			is_dynast = no
			is_house_head = yes
			house = scope:recipient.house

		}
		scope:recipient = {
			has_trait = disinherited
		}
	}

	is_valid_showing_failures_only = {
		scope:actor ={
			prestige >= medium_prestige_value
		}
		scope:recipient = { is_busy_in_events_localised = yes }
	}

	on_auto_accept = {
		scope:recipient = {
			trigger_event = char_interaction.0030
		}
	}
	
	on_accept = {
		scope:actor = {
			stress_impact = {
				vengeful = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
			}
			hidden_effect = {
				send_interface_message = {
					type = event_dynasty_neutral
					title = restore_inheritance_interaction_notification
					right_icon = scope:recipient
					show_as_tooltip = {
						scope:recipient = {
							restore_inheritance_effect = yes
						}
					}
				}
			}
		}

		scope:recipient = {
			restore_inheritance_effect = yes
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = minor_unity_gain
			DESC = clan_unity_re_inheritance.desc
			REVERSE_NON_HOUSE_TARGET = no
		}		
	}

	cost = {
		prestige = {
			value = medium_prestige_value
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_at_war = no
	}
	
	ai_targets = {
		ai_recipients = dynasty
		max = 20
	}
	
	ai_frequency = 120
	
	ai_will_do = {
		base = 0
		
		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_relation_friend = scope:actor
					has_relation_best_friend = scope:actor
				}
			}
		}
		
		modifier = {
			add = 5
			ai_vengefulness <= medium_negative_ai_value
		}
		
		modifier = {
			add = 100
			scope:recipient = scope:actor
		}

		# Unity modifiers
		evaluate_action_increasing_house_unity = {
			VALUE = 100
		}
		
		modifier = {
			factor = 0
			scope:recipient = {
				OR = {
					has_relation_rival = scope:actor
					has_relation_nemesis = scope:actor
				}
			}
		}
	}
}

house_trad_house_denounce_interaction = {
	icon = icon_dynasty
	category = interaction_category_hostile
	interface_priority = 60

	desc = denounce_interaction_desc
	
	is_shown = {
		NOT = { scope:recipient = scope:actor }

		scope:actor = {
			is_dynast = no
			is_house_head = yes
			house = scope:recipient.house
		}
		scope:recipient = {
			NOT = {
				has_trait = denounced
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			prestige >= medium_prestige_value
		}
		scope:recipient = { is_busy_in_events_localised = yes }
		scope:recipient = { NOT = { has_strong_hook = scope:actor } }
		custom_tooltip = {
			text = cannot_take_overt_hostile_actions_against_diarch.tt
			NOT = { scope:recipient ?= scope:actor.diarch }
		}
	}

	on_auto_accept = {
		scope:recipient = {
			trigger_event = char_interaction.0040
		}
	}
	
	on_accept = {
		scope:actor = {
			stress_impact = {
				forgiving = minor_stress_impact_gain
				compassionate = minor_stress_impact_gain
			}

			hidden_effect = {
				send_interface_toast = {
					type = event_toast_effect_neutral
					title = denounce_interaction_notification

					left_icon = scope:actor					
					right_icon = scope:recipient

					scope:recipient = {
						show_as_tooltip = {
							denounce_effect = { ACTOR = scope:actor RECIPIENT = scope:recipient }
						}
					}
				}
			}
		}

		scope:recipient = {
			denounce_effect = { ACTOR = scope:actor RECIPIENT = scope:recipient }
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = minor_unity_loss
			DESC = clan_unity_denouncement.desc
			REVERSE_NON_HOUSE_TARGET = no
		}		
	}

	cost = {
		prestige = {
			value = {
				add = medium_prestige_value
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = yes
						}
					}
					add = major_prestige_value
				}
				if = {
					limit = {
						scope:recipient = {
							is_landed_or_landless_administrative = no
							any_heir_title = {
								exists = holder
							}
						}
					}
					add = medium_prestige_value
				}
			}
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_adult = yes
		NOT = {
			has_trait = forgiving
		}
	}
	
	ai_targets = {
		ai_recipients = dynasty
		max = 20
	}
	
	ai_frequency = 96
	
	ai_will_do = {
		base = 0
		
		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_relation_rival = scope:actor
					has_relation_nemesis = scope:actor
				}
			}
		}
		
		modifier = {
			add = 5
			ai_vengefulness >= medium_positive_ai_value
			OR = {
				AND = {
					scope:recipient = {
						has_character_modifier = blacksheep
					}
					NOT = { has_character_modifier = blacksheep }
				}
				AND = {
					scope:recipient = {
						has_trait = incestuous
					}
					NOT = { is_incestuous_trigger = yes }
					trait_is_criminal_in_faith_trigger = { TRAIT = incestuous FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = kinslayer
					}
					NOT = { has_trait = kinslayer }
				}
				AND = {
					scope:recipient = {
						has_trait = adulterer
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = adulterer FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = fornicator
					}
					NOR = {
						has_trait = adulterer
						has_trait = fornicator
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = fornicator FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = deviant
					}
					NOT = {
						is_deviant_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = deviant FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = witch
					}
					NOT = {
						is_witch_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = witch FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = sodomite
					}
					NOR = {
						has_trait = sodomite
						any_secret = {
							secret_type = secret_homosexual
						}
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = sodomite FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
				AND = {
					scope:recipient = {
						has_trait = cannibal
					}
					NOT = {
						is_cannibal_trigger = yes
					}
					trait_is_criminal_in_faith_trigger = { TRAIT = cannibal FAITH = scope:actor.faith GENDER_CHARACTER = scope:recipient }
				}
			}
		}

		# Unity modifiers
		evaluate_action_decreasing_house_unity = {
			VALUE = 100
		}
		
		modifier = {
			factor = 0
			scope:recipient = {
				OR = {
					has_relation_friend = scope:actor
					has_relation_best_friend = scope:actor
				}
			}
		}
	}
}

house_trad_house_forgive_interaction = {
	icon = icon_dynasty
	category = interaction_category_friendly
	interface_priority = 60

	desc = forgive_interaction_desc
	
	is_shown = {
		NOT = { scope:recipient = scope:actor }

		scope:actor = {
			is_dynast = no
			is_house_head = yes
			house = scope:recipient.house
		}
		scope:recipient = {
			has_trait = denounced
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			prestige >= minor_prestige_value
		}
		scope:recipient = { is_busy_in_events_localised = yes }
	}

	on_auto_accept = {
		scope:recipient = {
			trigger_event = char_interaction.0050
		}
	}

	on_accept = {
		scope:actor = {
			stress_impact = {
				vengeful = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
			}
			hidden_effect = {
				send_interface_message = {
					type = event_generic_neutral
					title = forgive_interaction_notification
					right_icon = scope:recipient
					show_as_tooltip = {
						scope:recipient = {
							forgive_effect = yes
						}
					}
				}
			}
		}

		scope:recipient = {
			forgive_effect = yes
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = minor_unity_gain
			DESC = clan_unity_forgiveness.desc
			REVERSE_NON_HOUSE_TARGET = no
		}		
	}

	cost = {
		prestige = {
			value = minor_prestige_value
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_at_war = no
	}
	
	ai_targets = {
		ai_recipients = dynasty
		max = 20
	}
	
	ai_frequency = 120
	
	ai_will_do = {
		base = 0
		
		modifier = {
			add = 100
			scope:recipient = {
				OR = {
					has_relation_friend = scope:actor
					has_relation_best_friend = scope:actor
				}
			}
		}
		
		modifier = {
			add = 5
			ai_vengefulness <= medium_negative_ai_value
		}
		
		modifier = {
			add = 100
			scope:recipient = scope:actor
		}

		# Unity modifiers
		evaluate_action_increasing_house_unity = {
			VALUE = 100
		}
		
		modifier = {
			factor = 0
			scope:recipient = {
				OR = {
					has_relation_rival = scope:actor
					has_relation_nemesis = scope:actor
				}
			}
		}
	}
}
