﻿### EK NOTE: Added stat-focused tenet effect
#Education focuses
#List them in the order they appear in the interface, clockwise

#diplomacy
education_diplomacy = {
	type = education
	
	skill = diplomacy
	
	desc = {
		desc = education_diplomacy_desc
		first_valid = {
			triggered_desc = {
				trigger = { has_diplomacy_education_affinity_childhood_trait_trigger = yes }
				desc = education_diplomacy_tt.affinity
			}
			triggered_desc = {
				trigger = { has_diplomacy_education_disaffinity_childhood_trait_trigger = yes }
				desc = education_diplomacy_tt.disaffinity
			}
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = court_tutor_court_position }
			}
			desc = education_any_tt.court_tutor
		}
		desc = line_break
	}

	is_default = {
		has_trait = curious
	}

	is_good_for = {
		has_diplomacy_education_affinity_childhood_trait_trigger = yes
	}

	is_bad_for = {
		has_diplomacy_education_disaffinity_childhood_trait_trigger = yes
	}
	
	on_change_to = {
		if = {
			limit = {
				exists = var:education_point_gain_variable
			}
			change_variable = {
				name = education_point_gain_variable
				multiply = point_conversion_factor
			}
			set_variable = {
				name = education_diplomacy_variable
				value = var:education_point_gain_variable
			}
			remove_variable = education_point_gain_variable
		}
	}
	
	on_change_from = {
		if = {
			limit = {
				is_alive = yes
				is_adult = no
			}
			add_character_flag = diplomacy_previous_education
			if = {
				limit = {
					has_variable = education_diplomacy_variable
				}
				set_variable = {
					name = education_point_gain_variable
					value = var:education_diplomacy_variable
				}
				remove_variable = education_diplomacy_variable
			}
			else = {
				set_variable = {
					name = education_point_gain_variable
					value = 0
				}
			}
			if = {
				limit = {
					any_relation = {
						type = guardian
						NOT = { is_parent_of = root }
					}
				}
				save_scope_as = ward
				random_relation = {
					type = guardian
					trigger_event = childhood_education.0004
				}
			}
		}
	}

	auto_selection_weight = {
		value = 100
		if = {
			limit = { has_diplomacy_education_affinity_childhood_trait_trigger = yes }
			add = 900
		}
		if = {
			limit = { has_diplomacy_education_disaffinity_childhood_trait_trigger = yes }
			add = -900
		}
		if = { #EK ADDITION: new parameter
			limit = { faith = { has_doctrine_parameter = children_education_diplomacy } }
			multiply = 1.2
		}
	}
		
	modifier = {
		diplomacy = 1
	}
}


#martial
education_martial = {
	type = education

	skill = martial
	
	desc = {
		desc = education_martial_desc
		first_valid = {
			triggered_desc = {
				trigger = { has_martial_education_affinity_childhood_trait_trigger = yes }
				desc = education_martial_tt.affinity
			}
			triggered_desc = {
				trigger = { has_martial_education_disaffinity_childhood_trait_trigger = yes }
				desc = education_martial_tt.disaffinity
			}
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = court_tutor_court_position }
			}
			desc = education_any_tt.court_tutor
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = huntperson_camp_officer }
			}
			desc = education_martial_tt.huntperson
		}
		desc = line_break
	}

	is_default = {
		has_trait = rowdy
	}

	is_good_for = {
		has_martial_education_affinity_childhood_trait_trigger = yes
	}

	is_bad_for = {
		has_martial_education_disaffinity_childhood_trait_trigger = yes
	}
	
	on_change_to = {
		if = {
			limit = {
				exists = var:education_point_gain_variable
			}
			change_variable = {
				name = education_point_gain_variable
				multiply = point_conversion_factor
			}
			set_variable = {
				name = education_martial_variable
				value = var:education_point_gain_variable
			}
			remove_variable = education_point_gain_variable
		}
	}
	
	on_change_from = {
		if = {
			limit = {
				is_alive = yes
				is_adult = no
			}
			add_character_flag = martial_previous_education
			if = {
				limit = {
					has_variable = education_martial_variable
				}
				set_variable = {
					name = education_point_gain_variable
					value = var:education_martial_variable
				}
				remove_variable = education_martial_variable
			}
			else = {
				set_variable = {
					name = education_point_gain_variable
					value = 0
				}
			}
			if = {
				limit = {
					any_relation = {
						type = guardian
						NOT = { is_parent_of = root }
					}
				}
				save_scope_as = ward
				random_relation = {
					type = guardian
					trigger_event = childhood_education.0004
				}
			}
		}
	}
		
	modifier = {
		martial = 1
	}


	auto_selection_weight = {
		value = 100
		if = {
			limit = {
				has_martial_education_affinity_childhood_trait_trigger = yes
			}
			add = 900
		}
		if = {
			limit = { has_martial_education_disaffinity_childhood_trait_trigger = yes }
			add = -900
		}
		if = { # Life is hard on the steppe
			limit = {
				liege ?= { is_ai = yes }
				government_has_flag = government_is_nomadic
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
			}
			add = 10000
		}
		if = {
			limit = { NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root } } }
			multiply = 0.2
		}
		if = { #EK ADDITION: new parameter
			limit = { faith = { has_doctrine_parameter = children_education_martial } }
			multiply = 1.2
		}
	}
}


#stewardship
education_stewardship = {
	type = education
	
	skill = stewardship

	desc = {
		desc = education_stewardship_desc
		first_valid = {
			triggered_desc = {
				trigger = { has_stewardship_education_affinity_childhood_trait_trigger = yes }
				desc = education_stewardship_tt.affinity
			}
			triggered_desc = {
				trigger = { has_stewardship_education_disaffinity_childhood_trait_trigger = yes }
				desc = education_stewardship_tt.disaffinity
			}
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = court_tutor_court_position }
			}
			desc = education_any_tt.court_tutor
		}
		desc = line_break
	}

	is_default = {
		has_trait = bossy
	}

	is_good_for = {
		has_stewardship_education_affinity_childhood_trait_trigger = yes
	}

	is_bad_for = {
		has_stewardship_education_disaffinity_childhood_trait_trigger = yes
	}
	
	on_change_to = {
		if = {
			limit = {
				exists = var:education_point_gain_variable
			}
			change_variable = {
				name = education_point_gain_variable
				multiply = point_conversion_factor
			}
			set_variable = {
				name = education_stewardship_variable
				value = var:education_point_gain_variable
			}
			remove_variable = education_point_gain_variable
		}
	}
	
	on_change_from = {
		if = {
			limit = {
				is_alive = yes
				is_adult = no
			}
			add_character_flag = stewardship_previous_education
			if = {
				limit = {
					has_variable = education_stewardship_variable
				}
				set_variable = {
					name = education_point_gain_variable
					value = var:education_stewardship_variable
				}
				remove_variable = education_stewardship_variable
			}
			else = {
				set_variable = {
					name = education_point_gain_variable
					value = 0
				}
			}
			if = {
				limit = {
					any_relation = {
						type = guardian
						NOT = { is_parent_of = root }
					}
				}
				save_scope_as = ward
				random_relation = {
					type = guardian
					trigger_event = childhood_education.0004
				}
			}
		}
	}

	auto_selection_weight = {
		value = 100
		if = {
			limit = { has_stewardship_education_affinity_childhood_trait_trigger = yes }
			add = 900
		}
		if = {
			limit = { has_stewardship_education_disaffinity_childhood_trait_trigger = yes }
			add = -900
		}
		if = { #EK ADDITION: new parameter
			limit = { faith = { has_doctrine_parameter = children_education_stewardship } }
			multiply = 1.2
		}
	}
		
	modifier = {
		stewardship = 1
	}
}

#Learning
education_learning = {
	type = education
	
	skill = learning

	desc = {
		desc = education_learning_desc
		first_valid = {
			triggered_desc = {
				trigger = { has_learning_education_affinity_childhood_trait_trigger = yes }
				desc = education_learning_tt.affinity
			}
			triggered_desc = {
				trigger = { has_learning_education_disaffinity_childhood_trait_trigger = yes }
				desc = education_learning_tt.disaffinity
			}
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = court_tutor_court_position }
			}
			desc = education_any_tt.court_tutor
		}
		desc = line_break
	}

	is_default = {
		has_trait = pensive
	}

	is_good_for = {
		has_learning_education_affinity_childhood_trait_trigger = yes
	}

	is_bad_for = {
		has_learning_education_disaffinity_childhood_trait_trigger = yes
	}
	
	on_change_to = {
		if = {
			limit = {
				exists = var:education_point_gain_variable
			}
			change_variable = {
				name = education_point_gain_variable
				multiply = point_conversion_factor
			}
			set_variable = {
				name = education_learning_variable
				value = var:education_point_gain_variable
			}
			remove_variable = education_point_gain_variable
		}
	}
	
	on_change_from = {
		if = {
			limit = {
				is_alive = yes
				is_adult = no
			}
			add_character_flag = learning_previous_education
			if = {
				limit = {
					has_variable = education_learning_variable
				}
				set_variable = {
					name = education_point_gain_variable
					value = var:education_learning_variable
				}
				remove_variable = education_learning_variable
			}
			else = {
				set_variable = {
					name = education_point_gain_variable
					value = 0
				}
			}
			if = {
				limit = {
					any_relation = {
						type = guardian
						NOT = { is_parent_of = root }
					}
				}
				save_scope_as = ward
				random_relation = {
					type = guardian
					trigger_event = childhood_education.0004
				}
			}
		}
	}

	auto_selection_weight = {
		value = 100
		if = {
			limit = { has_learning_education_affinity_childhood_trait_trigger = yes }
			add = 900
		}
		if = {
			limit = { has_learning_education_disaffinity_childhood_trait_trigger = yes }
			add = -900
		}
		if = { #EK ADDITION: new parameter
			limit = { faith = { has_doctrine_parameter = children_education_learning } }
			multiply = 1.2
		}
	}
		
	modifier = {
		learning = 1
	}
}



#intrigue
education_intrigue = {
	type = education
	
	skill = intrigue

	desc = {
		desc = education_intrigue_desc
		first_valid = {
			triggered_desc = {
				trigger = { has_intrigue_education_affinity_childhood_trait_trigger = yes }
				desc = education_intrigue_tt.affinity
			}
			triggered_desc = {
				trigger = { has_intrigue_education_disaffinity_childhood_trait_trigger = yes }
				desc = education_intrigue_tt.disaffinity
			}
		}
		triggered_desc = {
			trigger = {
				liege = { employs_court_position = court_tutor_court_position }
			}
			desc = education_any_tt.court_tutor
		}
		desc = line_break
	}

	is_default = {
		has_trait = charming
	}

	is_good_for = {
		has_intrigue_education_affinity_childhood_trait_trigger = yes
	}

	is_bad_for = {
		has_intrigue_education_disaffinity_childhood_trait_trigger = yes
	}
	
	on_change_to = {
		if = {
			limit = {
				exists = var:education_point_gain_variable
			}
			change_variable = {
				name = education_point_gain_variable
				multiply = point_conversion_factor
			}
			set_variable = {
				name = education_intrigue_variable
				value = var:education_point_gain_variable
			}
			remove_variable = education_point_gain_variable
		}
	}
	
	on_change_from = {
		if = {
			limit = {
				is_alive = yes
				is_adult = no
			}
			add_character_flag = intrigue_previous_education
			if = {
				limit = {
					has_variable = education_intrigue_variable
				}
				set_variable = {
					name = education_point_gain_variable
					value = var:education_intrigue_variable
				}
				remove_variable = education_intrigue_variable
			}
			else = {
				set_variable = {
					name = education_point_gain_variable
					value = 0
				}
			}
			if = {
				limit = {
					any_relation = {
						type = guardian
						NOT = { is_parent_of = root }
					}
				}
				save_scope_as = ward
				random_relation = {
					type = guardian
					trigger_event = childhood_education.0004
				}
			}
		}
	}

	auto_selection_weight = {
		value = 100
		if = {
			limit = { has_intrigue_education_affinity_childhood_trait_trigger = yes }
			add = 900
		}
		if = {
			limit = { has_intrigue_education_disaffinity_childhood_trait_trigger = yes }
			add = -900
		}
		if = { #EK ADDITION: new parameter
			limit = { faith = { has_doctrine_parameter = children_education_intrigue } }
			multiply = 1.2
		}
	}
		
	modifier = {
		intrigue = 1
	}
}

