﻿
#####################################################################
# 05_dlc_bp2_effects
#####################################################################

add_relevant_lifestyle_perk_point_effect = {
	if = {
		limit = {
			has_trait = education_diplomacy
		}
		add_diplomacy_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_martial
		}
		add_martial_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_stewardship
		}
		add_stewardship_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_intrigue
		}
		add_intrigue_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_learning
		}
		add_learning_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_nht_prowess
		}
		add_nht_prowess_lifestyle_perk_points = $NUMBER$
	}
	else_if = {
		limit = {
			has_trait = education_nht_leadership
		}
		add_nht_leadership_lifestyle_perk_points = $NUMBER$
	}
}

disburse_adult_education_reward_effect = {
	switch = { # Hand out education traits
		trigger = has_character_flag
		increase_education_level_1 = {
			increase_education_level_1_effect = yes
			remove_character_flag = increase_education_level_1
		}
		increase_education_level_2 = {
			increase_education_level_2_effect = yes
			remove_character_flag = increase_education_level_2
		}
		increase_education_level_3 = {
			increase_education_level_3_effect = yes
			remove_character_flag = increase_education_level_3
		}
		increase_education_level_4 = {
			increase_education_level_4_effect = yes
			remove_character_flag = increase_education_level_4
		}
	}
	switch = { # Hand out lifestyle perks/xp
		trigger = has_character_flag
		perfect_studies_reward = {
			add_relevant_lifestyle_perk_point_effect = { NUMBER = 3 }
			remove_character_flag = perfect_studies_reward
		}
		high_studies_reward = {
			add_relevant_lifestyle_perk_point_effect = { NUMBER = 2 }
			remove_character_flag = high_studies_reward
		}
		mid_studies_reward = {
			add_relevant_lifestyle_perk_point_effect = { NUMBER = 1 }
			remove_character_flag = mid_studies_reward
		}
		low_studies_reward = {
			bp2_lifestyle_xp_gain_per_type_effect = { VALUE = major }
			remove_character_flag = low_studies_reward
		}
	}
	# Options rewards
	if = {
		limit = {
			scope:activity = {
				has_activity_option = {
					category = adult_education_option_books
					option = adult_education_books_good
				}
			}
			has_dlc_feature = royal_court
			scope:host = { has_royal_court = yes }
		}
		custom_tooltip = adult_education_books_good_reward
		hidden_effect = {
			random_dummy_gender_effect = yes
			create_artifact_book_effect = {
				OWNER = scope:host
				CREATOR = scope:dummy_gender
				SET_SUBJECT = flag:no
				SET_TOPIC = flag:no
			}
			hidden_effect_new_object = {
				scope:newly_created_artifact = {
					set_artifact_rarity = illustrious
				}
			}
			scope:activity = {
				add_to_variable_list = {
					name = artifact_rewards
					target = scope:newly_created_artifact
				}
			}
		}
	}
	else_if = {
		limit = {
			scope:activity = {
				has_activity_option = {
					category = adult_education_option_books
					option = adult_education_books_good
				}
			}
		}
		custom_tooltip = adult_education_books_good_reward
		hidden_effect = {
			save_temporary_scope_value_as = {
				name = should_be_trinket
				value = yes
			}
			random_dummy_gender_effect = yes
			save_scope_value_as = {
				name = quality
				value = 50
			}
			save_scope_value_as = {
				name = wealth
				value = 50
			}
			create_artifact_book_effect = {
				OWNER = scope:host
				CREATOR = scope:dummy_gender
				SET_SUBJECT = flag:no
				SET_TOPIC = flag:no
			}
			hidden_effect_new_object = {
				scope:newly_created_artifact = {
					set_artifact_rarity = illustrious
				}
			}
			scope:activity = {
				add_to_variable_list = {
					name = artifact_rewards
					target = scope:newly_created_artifact
				}
			}
		}
		if = {
			limit = {
				has_trait = education_diplomacy
			}
			add_diplomacy_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_martial
			}
			add_martial_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_stewardship
			}
			add_stewardship_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_intrigue
			}
			add_intrigue_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_learning
			}
			add_learning_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_nht_prowess
			}
			add_prowess_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_nht_leadership
			}
			add_stewardship_skill = 1
		}
	}
	else_if = {
		limit = {
			scope:activity = {
				has_activity_option = {
					category = adult_education_option_books
					option = adult_education_books_normal
				}
			}
		}
		if = {
			limit = {
				has_trait = education_diplomacy
			}
			add_diplomacy_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_martial
			}
			add_martial_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_stewardship
			}
			add_stewardship_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_intrigue
			}
			add_intrigue_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_learning
			}
			add_learning_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_nht_prowess
			}
			add_prowess_skill = 1
		}
		else_if = {
			limit = {
				has_trait = education_nht_leadership
			}
			add_stewardship_skill = 1
		}
	}
}


increase_education_level_1_effect = {
	if = {
		limit = { has_trait = education_diplomacy }
		increase_education_level_1_type_effect = { TYPE = diplomacy }
	}
	else_if = {
		limit = { has_trait = education_martial }
		increase_education_level_1_type_effect = { TYPE = martial }
	}
	else_if = {
		limit = { has_trait = education_stewardship }
		increase_education_level_1_type_effect = { TYPE = stewardship }
	}
	else_if = {
		limit = { has_trait = education_intrigue }
		increase_education_level_1_type_effect = { TYPE = intrigue }
	}
	else_if = {
		limit = { has_trait = education_learning }
		increase_education_level_1_type_effect = { TYPE = learning }
	}
	else_if = {
		limit = { has_trait = education_nht_prowess }
		increase_education_level_1_type_effect = { TYPE = nht_prowess }
	}
	else_if = {
		limit = { has_trait = education_nht_leadership }
		increase_education_level_1_type_effect = { TYPE = nht_leadership }
	}
}

increase_education_level_2_effect = {
	if = {
		limit = { has_trait = education_diplomacy }
		increase_education_level_2_type_effect = { TYPE = diplomacy }
	}
	else_if = {
		limit = { has_trait = education_martial }
		increase_education_level_2_type_effect = { TYPE = martial }
	}
	else_if = {
		limit = { has_trait = education_stewardship }
		increase_education_level_2_type_effect = { TYPE = stewardship }
	}
	else_if = {
		limit = { has_trait = education_intrigue }
		increase_education_level_2_type_effect = { TYPE = intrigue }
	}
	else_if = {
		limit = { has_trait = education_learning }
		increase_education_level_2_type_effect = { TYPE = learning }
	}
	else_if = {
		limit = { has_trait = education_nht_prowess }
		increase_education_level_2_type_effect = { TYPE = nht_prowess }
	}
	else_if = {
		limit = { has_trait = education_nht_leadership }
		increase_education_level_2_type_effect = { TYPE = nht_leadership }
	}
}

increase_education_level_3_effect = {
	if = {
		limit = { has_trait = education_diplomacy }
		increase_education_level_3_type_effect = { TYPE = diplomacy }
	}
	else_if = {
		limit = { has_trait = education_martial }
		increase_education_level_3_type_effect = { TYPE = martial }
	}
	else_if = {
		limit = { has_trait = education_stewardship }
		increase_education_level_3_type_effect = { TYPE = stewardship }
	}
	else_if = {
		limit = { has_trait = education_intrigue }
		increase_education_level_3_type_effect = { TYPE = intrigue }
	}
	else_if = {
		limit = { has_trait = education_learning }
		increase_education_level_3_type_effect = { TYPE = learning }
	}
	else_if = {
		limit = { has_trait = education_nht_prowess }
		increase_education_level_3_type_effect = { TYPE = nht_prowess }
	}
	else_if = {
		limit = { has_trait = education_nht_leadership }
		increase_education_level_3_type_effect = { TYPE = nht_leadership }
	}
}

increase_education_level_4_effect = {
	if = {
		limit = { has_trait = education_diplomacy }
		increase_education_level_4_type_effect = { TYPE = diplomacy }
	}
	else_if = {
		limit = { has_trait = education_martial }
		increase_education_level_4_type_effect = { TYPE = martial }
	}
	else_if = {
		limit = { has_trait = education_stewardship }
		increase_education_level_4_type_effect = { TYPE = stewardship }
	}
	else_if = {
		limit = { has_trait = education_intrigue }
		increase_education_level_4_type_effect = { TYPE = intrigue }
	}
	else_if = {
		limit = { has_trait = education_learning }
		increase_education_level_4_type_effect = { TYPE = learning }
	}
	else_if = {
		limit = { has_trait = education_nht_prowess }
		increase_education_level_4_type_effect = { TYPE = nht_prowess }
	}
	else_if = {
		limit = { has_trait = education_nht_leadership }
		increase_education_level_4_type_effect = { TYPE = nht_leadership }
	}
}

bp2_lifestyle_xp_gain_per_type_effect = {
	if = {
		limit = {
			has_trait = education_diplomacy
		}
		add_diplomacy_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_martial
		}
		add_martial_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_stewardship
		}
		add_stewardship_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_intrigue
		}
		add_intrigue_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_learning
		}
		add_learning_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_nht_prowess
		}
		add_nht_prowess_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
	else_if = {
		limit = {
			has_trait = education_nht_leadership
		}
		add_nht_leadership_lifestyle_xp =  $VALUE$_lifestyle_xp
	}
}

#####################################################################
# 05_dlc_fp3_scripted_effects
#####################################################################

remove_any_education_traits_effect = { # Looks ugly but performance is better than with an IF check
	remove_trait = education_martial_1
	remove_trait = education_martial_2
	remove_trait = education_martial_3
	remove_trait = education_martial_4
	remove_trait = education_martial_prowess_1
	remove_trait = education_martial_prowess_2
	remove_trait = education_martial_prowess_3
	remove_trait = education_martial_prowess_4
	remove_trait = education_learning_1
	remove_trait = education_learning_2
	remove_trait = education_learning_3
	remove_trait = education_learning_4
	remove_trait = education_intrigue_1
	remove_trait = education_intrigue_2
	remove_trait = education_intrigue_3
	remove_trait = education_intrigue_4
	remove_trait = education_stewardship_1
	remove_trait = education_stewardship_2
	remove_trait = education_stewardship_3
	remove_trait = education_stewardship_4
	remove_trait = education_diplomacy_1
	remove_trait = education_diplomacy_2
	remove_trait = education_diplomacy_3
	remove_trait = education_diplomacy_4
	remove_trait = education_nht_leadership_1
	remove_trait = education_nht_leadership_2
	remove_trait = education_nht_leadership_3
	remove_trait = education_nht_leadership_4	
	remove_trait = education_nht_prowess_1
	remove_trait = education_nht_prowess_2
	remove_trait = education_nht_prowess_3
	remove_trait = education_nht_prowess_4	
}


#####################################################################
# 03_dlc_fp2_scripted_effects
#####################################################################

synergise_friendship_interaction_bonus_individual_effect = {
	$SENIOR_CHARACTER$ = {
		# Diplomacy education.
		if = {
			limit = { has_trait = education_diplomacy }
			add_character_modifier = fp2_single_synergy_diplomacy_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_diplomacy_modifier }
		}
		# Martial education.
		if = {
			limit = { has_trait = education_martial }
			add_character_modifier = fp2_single_synergy_martial_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_martial_modifier }
		}
		# Stewardship education.
		if = {
			limit = { has_trait = education_stewardship }
			add_character_modifier = fp2_single_synergy_stewardship_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_stewardship_modifier }
		}
		# Intrigue education.
		if = {
			limit = { has_trait = education_intrigue }
			add_character_modifier = fp2_single_synergy_intrigue_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_intrigue_modifier }
		}
		# Learning education.
		if = {
			limit = { has_trait = education_learning }
			add_character_modifier = fp2_single_synergy_learning_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_learning_modifier }
		}
		# Prowess education.
		if = {
			limit = { has_trait = education_nht_prowess }
			add_character_modifier = fp2_single_synergy_nht_prowess_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_nht_prowess_modifier }
		}
		# Leadership education.
		if = {
			limit = { has_trait = education_nht_leadership }
			add_character_modifier = fp2_single_synergy_nht_leadership_modifier
			$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_single_synergy_nht_leadership_modifier }
		}		
	}
}

# Being $SENIOR_CHARACTER$ doesn't actually do anything in this variant, just maintaining term parity with the other synergy effect.
synergise_friendship_interaction_bonus_combined_effect = {
	$SENIOR_CHARACTER$ = {
		# Diplomacy combi-synergies.
		if = {
			limit = { has_trait = education_diplomacy }
			# Diplomacy-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier }
			}
			# Diplomacy-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_diplomacy_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_martial_modifier }
			}
			# Diplomacy-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier }
			}
			# Diplomacy-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier }
			}
			# Diplomacy-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_diplomacy_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_diplomacy_learning_modifier }
			}
			# Diplomacy-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier }
			}			
			# Diplomacy-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier }
			}				
		}
		# Martial combi-synergies.
		if = {
			limit = { has_trait = education_martial }
			# Martial-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_martial_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_diplomacy_modifier }
			}
			# Martial-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_martial_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_martial_modifier }
			}
			# Martial-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_martial_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_stewardship_modifier }
			}
			# Martial-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_martial_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_intrigue_modifier }
			}
			# Martial-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_martial_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_martial_learning_modifier }
			}
			# Martial-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier }
			}			
			# Martial-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier }
			}
		}
		# Stewardship combi-synergies.
		if = {
			limit = { has_trait = education_stewardship }
			# Stewardship-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier }
			}
			# Stewardship-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_stewardship_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_martial_modifier }
			}
			# Stewardship-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier }
			}
			# Stewardship-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier }
			}
			# Stewardship-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_stewardship_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_stewardship_learning_modifier }
			}
			# Stewardship-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier }
			}			
			# Stewardship-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier }
			}
		}
		# Intrigue combi-synergies.
		if = {
			limit = { has_trait = education_intrigue }
			# Intrigue-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier }
			}
			# Intrigue-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_intrigue_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_martial_modifier }
			}
			# Intrigue-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier }
			}
			# Intrigue-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier }
			}
			# Intrigue-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_intrigue_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_intrigue_learning_modifier }
			}
			# Intrigue-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier }
			}			
			# Intrigue-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier }
			}
		}
		# Learning combi-synergies.
		if = {
			limit = { has_trait = education_learning }
			# Learning-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_learning_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_diplomacy_modifier }
			}
			# Learning-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_learning_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_martial_modifier }
			}
			# Learning-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_learning_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_stewardship_modifier }
			}
			# Learning-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_learning_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_intrigue_modifier }
			}
			# Learning-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_learning_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_learning_learning_modifier }
			}
			# Learning-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier }
			}			
			# Learning-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier }
			}
		}
		#######
		# Prowess combi-synergies.
		if = {
			limit = { has_trait = education_nht_prowess }
			# Prowess-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier }
			}
			# Prowess-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier }
			}
			# Prowess-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier }
			}
			# Prowess-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier }
			}
			# Prowess-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier }
			}
			# Prowess-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_prowess_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_prowess_modifier }
			}			
			# Prowess-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier }
			}
		}
		#######
		# Leadership combi-synergies.
		if = {
			limit = { has_trait = education_nht_leadership }
			# Leadership-Diplomacy
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_diplomacy }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier }
			}
			# Leadership-Martial
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_martial }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier }
			}
			# Leadership-Stewardship
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_stewardship }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier }
			}
			# Leadership-Intrigue
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_intrigue }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier }
			}
			# Leadership-Learning
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_learning }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier }
			}
			# Leadership-Prowess
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_prowess }
				}
				add_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier 
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier }
			}			
			# Leadership-Leadership
			if = {
				limit = {
					$JUNIOR_CHARACTER$ = { has_trait = education_nht_leadership }
				}
				add_character_modifier = fp2_double_synergy_nht_leadership_leadership_modifier
				$JUNIOR_CHARACTER$ = { add_character_modifier = fp2_double_synergy_nht_leadership_leadership_modifier }
			}
		}
	}
}


remove_every_best_friend_synergy_bonus_modifier_effect = {
	if = {
		limit = { has_character_modifier = fp2_single_synergy_diplomacy_modifier }
		remove_character_modifier = fp2_single_synergy_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_single_synergy_martial_modifier }
		remove_character_modifier = fp2_single_synergy_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_single_synergy_stewardship_modifier }
		remove_character_modifier = fp2_single_synergy_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_single_synergy_intrigue_modifier }
		remove_character_modifier = fp2_single_synergy_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_single_synergy_learning_modifier }
		remove_character_modifier = fp2_single_synergy_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_diplomacy_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_diplomacy_martial_modifier }
		remove_character_modifier = fp2_double_synergy_diplomacy_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_diplomacy_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_diplomacy_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_diplomacy_learning_modifier }
		remove_character_modifier = fp2_double_synergy_diplomacy_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_martial_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_martial_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_martial_martial_modifier }
		remove_character_modifier = fp2_double_synergy_martial_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_martial_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_martial_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_martial_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_martial_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_martial_learning_modifier }
		remove_character_modifier = fp2_double_synergy_martial_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_stewardship_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_stewardship_martial_modifier }
		remove_character_modifier = fp2_double_synergy_stewardship_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_stewardship_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_stewardship_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_stewardship_learning_modifier }
		remove_character_modifier = fp2_double_synergy_stewardship_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_intrigue_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_intrigue_martial_modifier }
		remove_character_modifier = fp2_double_synergy_intrigue_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_intrigue_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_intrigue_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_intrigue_learning_modifier }
		remove_character_modifier = fp2_double_synergy_intrigue_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_learning_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_learning_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_learning_martial_modifier }
		remove_character_modifier = fp2_double_synergy_learning_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_learning_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_learning_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_learning_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_learning_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_learning_learning_modifier }
		remove_character_modifier = fp2_double_synergy_learning_learning_modifier
	}
	###### Start More Lifestyles Submod Modifications
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_prowess_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_prowess_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_learning_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier }
		remove_character_modifier = fp2_double_synergy_nht_prowess_leadership_modifier
	}

	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_diplomacy_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_martial_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_leadership_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_leadership_modifier 
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_stewardship_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_intrigue_modifier
	}
	if = {
		limit = { has_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier }
		remove_character_modifier = fp2_double_synergy_nht_leadership_learning_modifier
	}	
}