﻿start_mentor_interaction = {
	icon = icon_mentor  #ICON
	common_interaction = yes
	interface_priority = 10
	category = interaction_category_friendly

	ignores_pending_interaction_block = yes

	#scheme = mentor_scheme

	send_name = START_SCHEME

	is_shown = {
		scope:actor = {is_adult = yes}
		NOT = { scope:recipient = scope:actor }
		has_game_rule = cki_rule_mentor_active
		scope:recipient = {age>=10}
		
	}

	is_valid_showing_failures_only = {
		scope:actor = {
					OR = {
						can_start_scheme = {
							type = mentor_diplomacy_scheme
							target_character = scope:recipient
						}
						can_start_scheme = {
							type = mentor_martial_scheme
							target_character = scope:recipient
						}
						can_start_scheme = {
							type = mentor_stewardship_scheme
							target_character = scope:recipient
						}
						can_start_scheme = {
							type = mentor_intrigue_scheme
							target_character = scope:recipient
						}
						can_start_scheme = {
							type = mentor_learning_scheme
							target_character = scope:recipient
						}
					}
				}
		scope:recipient = { 
			NOT = { 
				has_strong_hook = scope:actor 
				OR = {
					has_opinion_modifier = {target = scope:actor modifier = intimidate_scheme_failure_opinion}
					has_opinion_modifier = {target = scope:actor modifier = intimidate_scheme_success_opinion}
				}
			} 
		}
		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_mentor_approved

	# Scheme Starter Packages
	options_heading = start_mentor_interaction.t.options
	send_options_exclusive = yes
	## diplomacy
	send_option = {
		flag = mentor_diplomacy
		current_description = start_mentor_interaction.tt.mentor_diplomacy
	}
	## martial
	send_option = {
		flag = mentor_martial
		current_description = start_mentor_interaction.tt.mentor_martial
	}
	## Stewarship
	send_option = {
		flag = mentor_stewardship
		current_description = start_mentor_interaction.tt.mentor_stewardship
	}
	## Intrigue
	send_option = {
		flag = mentor_intrigue
		current_description = start_mentor_interaction.tt.mentor_intrigue
	}
	## Learning
	send_option = {
		flag = mentor_learning
		current_description = start_mentor_interaction.tt.mentor_learning
	}

	on_accept = {
		scope:actor = {
			stress_impact = {
				compassionate = minor_stress_impact_loss
				generous = minor_stress_impact_loss
				education_learning_1 = minor_stress_impact_loss
				education_learning_2 = minor_stress_impact_loss
				education_learning_3 = minor_stress_impact_loss
				education_learning_4 = minor_stress_impact_loss
				education_learning_5 = minor_stress_impact_loss
			}
		}
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = start_mentor_interaction_notification

				left_icon = scope:actor					
				right_icon = scope:recipient

				# Success.
				if = {
					limit = { scope:mentor_diplomacy ?= yes }
					begin_scheme_basic_effect = {
						SCHEME_TYPE = mentor_diplomacy_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
					}
				}
				else_if = {
					limit = { scope:mentor_martial ?= yes }
					begin_scheme_basic_effect = {
						SCHEME_TYPE = mentor_martial_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
					}
				}
				else_if = {
					limit = { scope:mentor_stewardship ?= yes }
					begin_scheme_basic_effect = {
						SCHEME_TYPE = mentor_stewardship_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
					}
				}
				else_if = {
					limit = { scope:mentor_intrigue ?= yes }
					begin_scheme_basic_effect = {
						SCHEME_TYPE = mentor_intrigue_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
					}
				}
				else_if = {
					limit = { scope:mentor_learning ?= yes }
					begin_scheme_basic_effect = {
						SCHEME_TYPE = mentor_learning_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
					}
				}
				
			}
		}
	}
	
	auto_accept = yes
	ai_targets = { ai_recipients = family }
	ai_targets = { 
		ai_recipients = neighboring_rulers 
		ai_recipients = vassals
		ai_recipients = peer_vassals
		ai_recipients = liege
		max = 10
	}
	ai_frequency = 60

	ai_potential = {
		learning > 12
	}

	ai_will_do = {
		# They shouldn't always do this.
		base = 0

		# Obvious factor.
		opinion_modifier = {
			opinion_target = scope:recipient
			multiplier = -1
		}
		ai_value_modifier = { ai_honor = -1 }

		# Child Target
		modifier = {
			add = 50
			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 = 40
			scope:recipient = {
				is_close_family_of = scope:actor
			}
		}
		# Traits.
		## Arrogant.
		modifier = {
			add = -25
			has_trait = arrogant
		}
		## Intellect.
		modifier = {
			add = 15
			has_trait = intellect_good_1
		}
		## Intellect.
		modifier = {
			add = 25
			has_trait = intellect_good_2
		}
		## Intellect.
		modifier = {
			add = 35
			has_trait = intellect_good_3
		}
		## Callous.
		modifier = {
			add = -15
			has_trait = callous
		}
		## Compassionate.
		modifier = {
			add = 50
			has_trait = compassionate
		}
		## Content.
		modifier = {
			add = -100
			has_trait = content
		}
		## Greedy.
		modifier = {
			add = -50
			has_trait = greedy
		}
	}
}
