﻿thuum_lessons_interaction = {
	icon = icon_thuum
	category = interaction_category_thuum
	interface_priority = 60

	desc = thuum_lessons_interaction_desc
	use_diplomatic_range = yes
	
	cooldown = { years = 2 }
	
	is_shown = {
		NOT = { 
			scope:recipient = scope:actor 
		}
		scope:actor.dynasty = {
			this = scope:recipient.dynasty
			has_dynasty_perk = dragonblood_legacy_5
		}
		scope:actor = {
			is_dynast = yes
			dynasty = scope:recipient.dynasty
			has_trait = thuum_mastery
		}
		scope:recipient = {
			is_player_heir_of = scope:actor
			has_trait = thuum_mastery
		}
	}

	is_valid = {
		scope:actor.dynasty = {
			this = scope:recipient.dynasty
			has_dynasty_perk = dragonblood_legacy_5
		}
		scope:actor = {
			is_dynast = yes
			dynasty = scope:recipient.dynasty
			has_trait = thuum_mastery
			has_trait_xp = { trait = thuum_mastery value >= 60 }

		}
		scope:recipient = {
			age >= 14
			is_player_heir_of = scope:actor
			has_trait = thuum_mastery
			has_trait_xp = { trait = thuum_mastery value <= 56 }
		}
	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			is_available = yes
			is_courtier_of = scope:actor
			opinion = {
				value >= 40
				target = scope:actor
			}
		}
	}

	on_auto_accept = {
		scope:recipient = {
			save_scope_as = thuum_heir
		}
		scope:actor = {
			trigger_event = db_ysmir_event.0012
		}
	}
	
	on_accept = {
		scope:recipient = {
			stress_impact = {
				arrogant = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
				lazy = minor_stress_impact_gain
			}
		}
		scope:actor = {
			stress_impact = {
				lazy = minor_stress_impact_gain
			}
		}
	}
	
	cost = {
		renown = {
			value = scope:actor.dynasty.medium_dynasty_prestige_value
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_at_war = no
		is_dynast = yes
	}
	
	ai_targets = {
		ai_recipients = children
		max = 10
	}
	
	ai_frequency_by_tier = {
		barony = 0
		county = 96
		duchy = 48
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	
	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
				}
			}
		}
	}
}

thuum_passing_interaction = {
	icon = icon_thuum
	category = interaction_category_thuum
	interface_priority = 60

	desc = thuum_passing_interaction_desc
	use_diplomatic_range = yes
	
	cooldown = { years = 10 }
	
	is_shown = {
		NOT = { 
			scope:recipient = scope:actor 
		}
		scope:actor.dynasty = {
			this = scope:recipient.dynasty
			has_dynasty_perk = dragonblood_legacy_5
		}
		scope:actor = {
			is_dynast = yes
			dynasty = scope:recipient.dynasty
			has_trait = thuum_mastery
		}
		scope:recipient = {
			is_player_heir_of = scope:actor
			NOT = { has_trait = thuum_mastery }
		}
	}

	is_valid = {
		scope:actor.dynasty = {
			this = scope:recipient.dynasty
			has_dynasty_perk = dragonblood_legacy_5
		}
		scope:actor = {
			is_dynast = yes
			dynasty = scope:recipient.dynasty
			has_trait = thuum_mastery
			has_trait_xp = { trait = thuum_mastery value >= 100 }
			OR = {
				learning >= 16
				has_arcana >= { VALUE = 16 } 
			}
		}
		scope:recipient = {
			is_player_heir_of = scope:actor
			age >= 14
			NOT = { has_trait = thuum_mastery }
		}
	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			is_available = yes
			is_courtier_of = scope:actor
			opinion = {
				value >= 40
				target = scope:actor
			}
		}
	}

	on_auto_accept = {
		scope:recipient = {
			save_scope_as = thuum_heir
		}
		scope:actor = {
			trigger_event = db_ysmir_event.0020
		}
	}
	
	on_accept = {
		scope:recipient = {
			stress_impact = {
				arrogant = minor_stress_impact_gain
				stubborn = minor_stress_impact_gain
				lazy = minor_stress_impact_gain
			}
		}
		scope:actor = {
			stress_impact = {
				lazy = minor_stress_impact_gain
			}
		}
	}
	
	cost = {
		renown = {
			value = scope:actor.dynasty.major_dynasty_prestige_value
		}
	}
	
	auto_accept = yes

	ai_potential = {
		is_at_war = no
		is_dynast = yes
	}
	
	ai_targets = {
		ai_recipients = children
		max = 10
	}
	
	ai_frequency_by_tier = {
		barony = 0
		county = 96
		duchy = 48
		kingdom = 12
		empire = 12
		hegemony = 12
	}
	
	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
				}
			}
		}
	}
}