﻿convert_scheme_interaction = {
	icon = icon_convert
	category = interaction_category_hostile
	common_interaction = yes

	send_name = START_SCHEME

	interface_priority = 10
	scheme = convert_scheme
	ignores_pending_interaction_block = yes

	ai_targets = {
		ai_recipients = vassals
		ai_recipients = peer_vassals
		max = 5
	}
	ai_targets = {
		ai_recipients = neighboring_rulers
		max = 5
	}
	ai_frequency = 60

	is_shown = {
		scope:actor = {is_adult = yes}
		scope:actor = {
			NOT = {
				faith = scope:recipient.faith
				}
		}
		NOT = { scope:actor = scope:recipient }
		NOT = { scope:recipient = {is_courtier_of = scope:actor} }
		has_game_rule = cki_rule_convert_active
	}
	

	is_valid_showing_failures_only = {
		scope:actor = {
			can_start_scheme = {
				type = convert_scheme
				target_character = scope:recipient
			}
		}
		scope:recipient = {
			is_ruler=yes
			age >= 10
		}
		#limit range for landless adventurers
		trigger_if = {
			limit = {
				scope:actor = {
					is_landless_adventurer = yes
				}
			}
			#Has to be used instead of diplo range checks in laamp to landed interactions
			ep3_laamp_diplo_range_trigger = {
				TARGET = scope:recipient
				LAAMP = scope:actor
			}
		}
	}

	desc = scheme_interaction_tt_convert_approved

	on_accept = {
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = convert_interaction_notification

				left_icon = scope:actor					
				right_icon = scope:recipient

				begin_scheme_basic_effect = {
					SCHEME_TYPE = convert_scheme
					TARGET_TYPE = target_character
					TARGET_SCOPE = scope:recipient
				}
			}
			stress_impact = {
				zealous = medium_stress_impact_loss
				honest = small_stress_impact_gain
				cynical = medium_stress_impact_gain
			}
		}
	}
	
	ai_potential = {
		OR = {
			primary_title.tier >= tier_duchy
			AND = {
				primary_title.tier >= tier_county
				is_clergy = yes
			}
		}
		learning >= 10
		NOR = {
			has_trait = lazy
			has_trait = paranoid
			has_trait = cynical
			scheme_generic_ai_blocker_trigger = yes
			primary_title = {
				is_mercenary_company = yes
			}
		}
	}
	
	auto_accept = yes
	
	ai_will_do = {
		base = 0
		# Open Minded
		modifier = {
			add = -50
			scope:actor = {
				has_perk = open_minded_perk
			}
		}
		# Leaning Skill is medium
		modifier = {
			add = 10
			learning >= medium_skill_rating
		}
		# Convert Co-religionists
		modifier = {
			add = 5
			scope:actor.religion = scope:recipient.religion
		}
		# Child Target
		modifier = {
			add = 20
			scope:recipient = {
				is_adult = no
			}
		}
		# My Friend
		modifier = {
			add = 25
			scope:recipient = {
				has_relation_friend = scope:actor
			}
		}
		# My lover
		modifier = {
			add = 25
			scope:recipient = {
				has_relation_lover = scope:actor
			}
		}
		# Potential Friend
		modifier = {
			add = 10
			scope:recipient = {
				has_relation_potential_friend = scope:actor
			}
		}
		# Close family ruler
		modifier = {
			add = 20
			scope:recipient = {
				is_close_family_of = scope:actor
				is_ruler = yes
			}
		}
		# Clergy/pious people want to convert people
		modifier = { 
			add = 20
			scope:actor = {
				exists = faith.religious_head
				OR = {
					has_trait = zealous
					is_clergy = yes
				}
			}
		}
	}
}
