﻿find_suitable_accolade_successor_interaction = {
	
	desc = find_suitable_accolade_successor_interaction_desc
	icon = icon_combat

	cooldown = { days = 730 }

	hidden = yes # we use this via the accolade view only

	is_shown = {
		has_dlc_feature = accolades
	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			accolade ?= {
				NOT = { exists = accolade_successor }
				has_potential_accolade_successors = no
				NOT = {
					primary_type = {
						this = accolade_type:house_knight_attribute 
					}
				}
			}
		}
		scope:actor = {
			highest_held_title_tier >= tier_county
		}
		scope:actor = {
			NOT = { government_has_flag = government_is_theocracy }
		}
	}

	on_accept = {
		custom_tooltip = find_suitable_accolade_successor_interaction.tt
		scope:actor = {
			save_scope_as = accolade_owner
		}
		scope:recipient = {
			save_scope_as = knight_in_need
		}
		scope:recipient.accolade = {
			save_scope_as = accolade_in_need
		}
		scope:actor = {
			if = {
				limit = {
					is_ai = yes
				}
				trigger_event = {
					id = accolade.0006
				}
			}
			else = {
				trigger_event = {
					id = accolade.0006
					days = { 60 180 }
				}
			}
		}
	}

	auto_accept = yes

	cost = {
		prestige = {
			value = 75
			if = {
				limit = {
					scope:actor = {
						highest_held_title_tier >= tier_empire
					}
				}
				add = 100
			}
			else_if = {
				limit = {
					scope:actor = {
						highest_held_title_tier = tier_kingdom
					}
				}
				add = 50
			}
			else_if = {
				limit = {
					scope:actor = {
						highest_held_title_tier = tier_duchy
					}
				}
				add = 25
			}
		}
	}

	ai_targets = {
		ai_recipients = courtiers
		ai_recipients = vassals
	}

	ai_frequency = 36

	ai_will_do = {
		base = 100
	}

	ai_potential = {
		highest_held_title_tier >= tier_county
		has_dlc_feature = accolades
	}
}
