﻿#EK NOTE: removed vanilla references
##################################################
# Accolade Effects

accolades_development_growth_for_least_developed_county_effect = {
	# First, should this apply at all?
	if = {
		limit = {
			# Do you have a knight with this accolade at all?
			any_active_accolade = {
				OR = {
					has_accolade_parameter = accolade_development_growth_on_tournament_completion_low
					has_accolade_parameter = accolade_development_growth_on_tournament_completion_high
				}
			}
			# Plus, pre-filter out landless rulers.
			is_landed_or_landless_administrative = yes
		}
		# Now, find our least developed county.
		ordered_held_title = {
			limit = { tier = tier_county }
			order_by = {
				value = development_level
				multiply = -1
			}
			save_scope_as = least_developed_county
		}
		# Next, we'll need to apply a bonus to it.
		## Low boost.
		if = {
			limit = {
				any_active_accolade = {
					has_accolade_parameter = accolade_development_growth_on_tournament_completion_low
				}
			}
			scope:least_developed_county = { change_development_progress_with_overflow = accolade_development_growth_on_tournament_completion_value }
		}
		## High boost.
		if = {
			limit = {
				any_active_accolade = {
					has_accolade_parameter = accolade_development_growth_on_tournament_completion_high
				}
			}
			scope:least_developed_county = { change_development_level = accolade_development_level_on_tournament_completion_value }
		}
	}
}

accolades_contender_tournament_xp_gain_effect = {
	custom_tooltip = accolade_tournament_xp_gain_contender_only.tt
	hidden_effect = {
		if = {
			limit = {
				NOT = { has_trait = tourney_participant }
			}
			add_trait = tourney_participant
		}
	}
	# Low level bonus
	if = {
		limit = {
			accolade = {
				has_accolade_parameter = accolade_tournament_xp_gain_contender_only_low
			}
		}
		
		hidden_effect = {
			random_list = {
				10 = {
					show_chance = no
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = accolade_contender_trait_xp_low_value
					}
				}
				10 = {
					show_chance = no
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = accolade_contender_trait_xp_low_value
					}
				}
				10 = {
					show_chance = no
					add_trait_xp = {
						trait = tourney_participant
						track = bow
						value = accolade_contender_trait_xp_low_value
					}
				}
				10 = {
					show_chance = no
					add_trait_xp = {
						trait = tourney_participant
						track = wit
						value = accolade_contender_trait_xp_low_value
					}
				}
			}
		}
	}
	# Mid level bonus
	else_if = {
		limit = {
			accolade = {
				has_accolade_parameter = accolade_tournament_xp_gain_contender_only
			}
		}
		hidden_effect = {
			random_list = {
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = accolade_contender_trait_xp_medium_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = accolade_contender_trait_xp_medium_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = bow
						value = accolade_contender_trait_xp_medium_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = wit
						value = accolade_contender_trait_xp_medium_value
					}
				}
			}
		}
	}
	# High level bonus
	else_if = {
		limit = {
			accolade = {
				has_accolade_parameter = accolade_tournament_xp_gain_contender_only_high
			}
		}
		hidden_effect = {
			random_list = {
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = accolade_contender_trait_xp_high_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = accolade_contender_trait_xp_high_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = bow
						value = accolade_contender_trait_xp_high_value
					}
				}
				10 = {
					add_trait_xp = {
						trait = tourney_participant
						track = wit
						value = accolade_contender_trait_xp_high_value
					}
				}
			}
		}
	}
}

accolades_all_knights_liege_tournament_xp_gain_effect = {
	custom_tooltip = accolade_tournament_xp_gain_all_knights.tt
	hidden_effect = {
		if = {
			limit = {
				NOT = { has_trait = tourney_participant }
			}
			add_trait = tourney_participant
		}
	}
	# low bonus
	if = {
		limit = {
			liege = {
				any_active_accolade = {
					has_accolade_parameter = accolade_tournament_xp_gain_all_knights
				}
			}
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = accolade_all_knights_trait_xp_low_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = accolade_all_knights_trait_xp_low_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = bow
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = bow
						value = accolade_all_knights_trait_xp_low_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = wit
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = wit
						value = accolade_all_knights_trait_xp_low_value
					}
				}
			}
		}
	}
	# high bonus
	else_if = {
		limit = {
			liege = {
				any_active_accolade = {
					has_accolade_parameter = accolade_tournament_xp_gain_all_knights_high
				}
			}
		}
		hidden_effect = {
			random_list = {
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = foot
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = foot
						value = accolade_all_knights_trait_xp_high_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = horse
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = horse
						value = accolade_all_knights_trait_xp_high_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = bow
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = bow
						value = accolade_all_knights_trait_xp_high_value
					}
				}
				10 = {
					modifier = { 
						add = 20
						has_trait_xp = {
							trait = tourney_participant
							track = wit
							value = 30
						}
					}
					add_trait_xp = {
						trait = tourney_participant
						track = wit
						value = accolade_all_knights_trait_xp_high_value
					}
				}
			}
		}
	}
}

#GLORY GAIN FOR TOURS
accolades_activity_complete_tour_glory_effect = {
	# Decent glory if you did a grand-ass tour
	if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				variable_list_size = {
					name = tour_vassals_to_visit
					value >= activity_tour_high_stop_value
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward_tour
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				every_attending_character = {
					limit = {
						is_knight_of = scope:root_scope
						is_acclaimed = yes
					}
					accolade = { add_glory = medium_glory_gain }
				}
			}
		}
	}
	# An ok amount for a sort of long tour
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				variable_list_size = {
					name = tour_vassals_to_visit
					value >= activity_tour_low_stop_value
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward_tour
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				every_attending_character = {
					limit = {
						is_knight_of = scope:root_scope
						is_acclaimed = yes
					}
					accolade = { add_glory = minor_glory_gain }
				}
			}
		}
	}
	# Otherwise, it's scraps for you.
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward_tour
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				every_attending_character = {
					limit = {
						is_knight_of = scope:root_scope
						is_acclaimed = yes
					}
					accolade = { add_glory = minimal_glory_gain }
				}
			}
		}
	}
}

#GLORY GAIN FOR HUNTS
accolades_activity_complete_hunt_glory_effect = {
	save_scope_as = root_scope
	# Glory management.
	## We want to toss out a little glory to knights who go hunting without their liege
	if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
		}
		scope:root_scope = {
			accolade = {
				add_glory = {
					value = 20
					multiply = hunt_prestige_animal_level_value
					if = {
						limit = { scope:activity.var:hunt_success = flag:no }
						divide = 5
					}
				}
			}
		}
	}
	## We want to toss out a little glory when lieges' knights go hunting with them
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
				accolade = {
					add_glory = {
						value = 20
						multiply = hunt_prestige_animal_level_value
						if = {
							limit = { scope:activity.var:hunt_success = flag:no }
							divide = 5
						}
					}
				}
			}
		}
	}
}

#GLORY GAIN FOR WEDDINGS
accolades_activity_complete_wedding_glory_effect = {
	# Much glory if you did a magnificent wedding
	if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
			scope:activity = {
				# perfect options
				has_activity_option = {
					category = wedding_option_entertainment
					option = wedding_entertainment_good
				}
				has_activity_option = {
					category = wedding_option_food
					option = wedding_food_good
				}
				has_activity_option = {
					category = wedding_option_decoration
					option = wedding_decoration_good
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if primary participant
				if = {
					limit = {
						scope:root_scope = {
							OR = {
								this = scope:spouse_1
								this = scope:spouse_2
							}
						}
					}
					scope:root_scope = {
						accolade = { add_glory = massive_glory_gain }
					}
				}
				else = {
					scope:root_scope = {
						accolade = { add_glory = minor_glory_gain }
					}
				}
			}
		}
	}
	# Much glory if you did a magnificent wedding
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				# perfect options
				has_activity_option = {
					category = wedding_option_entertainment
					option = wedding_entertainment_good
				}
				has_activity_option = {
					category = wedding_option_food
					option = wedding_food_good
				}
				has_activity_option = {
					category = wedding_option_decoration
					option = wedding_decoration_good
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if you are primary participant
				if = {
					limit = {
						OR = {
							scope:root_scope = scope:host
							scope:root_scope = scope:spouse_1
							scope:root_scope = scope:spouse_2
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = massive_glory_gain }
						}
						else = {
							accolade = { add_glory = medium_glory_gain }
						}
					}
				}
				# more glory for a primary participant knight
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
								this = scope:spouse_1
								this = scope:spouse_2
								}
							}
							accolade = { add_glory = massive_glory_gain }
						}
						else = {
							accolade = { add_glory = minor_glory_gain }
						}
					}
				}
			}
		}
	}
	# Decent glory if acclaimed knights went to a nice wedding without liege
	else_if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
			scope:activity = {
				OR = {
					AND = {
						# at least two tier threes
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
					}
					# a tier 3 and two tier 2s
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if primary participant
				if = {
					limit = {
						scope:root_scope = {
							OR = {
								scope:root_scope = scope:spouse_1
								scope:root_scope = scope:spouse_2
							}
						}
					}
					scope:root_scope = {
						accolade = { add_glory = major_glory_gain }
					}
				}
				else = {
					scope:root_scope = {
						accolade = { add_glory = minimal_glory_gain }
					}
				}
			}
		}
	}
	# Decent glory if you went to a nice wedding with acclaimed knights
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				OR = {
					AND = {
						# at least two tier threes
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
					}
					# a tier 3 and two tier 2s
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_good
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_good
						}
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_good
						}
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if you are primary participant
				if = {
					limit = {
						OR = {
							scope:root_scope = scope:host
							scope:root_scope = scope:spouse_1
							scope:root_scope = scope:spouse_2
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = major_glory_gain }
						}
						else = {
							accolade = { add_glory = minor_glory_gain }
						}
					}
				}
				# more glory for a primary participant knight
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = major_glory_gain }
						}
						else = {
							accolade = { add_glory = minimal_glory_gain }
						}
					}
				}
			}
		}
	}
	# An ok amount for a sort of grand wedding, knights without attending liege
	else_if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
			scope:activity = {
				# 1 tier 3 option
				OR = {
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
					has_activity_option = {
						category = wedding_option_food
						option = wedding_food_good
					}
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_good
					}
					# 2 tier 2 options
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if primary participant
				if = {
					limit = {
						scope:root_scope = {
							OR = {
								this = scope:spouse_1
								this = scope:spouse_2
							}
						}
					}
					scope:root_scope = {
						accolade = { add_glory = medium_glory_gain }
					}
				}
				else = {
					scope:root_scope = {
						accolade = { add_glory = sub_minimal_glory_gain }
					}
				}
			}
		}
	}
	# An ok amount for a sort of grand wedding, liege with attending knights
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				#this
				OR = {
					has_activity_option = {
						category = wedding_option_entertainment
						option = wedding_entertainment_good
					}
					has_activity_option = {
						category = wedding_option_food
						option = wedding_food_good
					}
					has_activity_option = {
						category = wedding_option_decoration
						option = wedding_decoration_good
					}
					# 2 tier 2 options
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_entertainment
							option = wedding_entertainment_normal
						}
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
					}
					AND = {
						has_activity_option = {
							category = wedding_option_decoration
							option = wedding_decoration_normal
						}
						has_activity_option = {
							category = wedding_option_food
							option = wedding_food_normal
						}
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if primary participant
				if = {
					limit = {
						OR = {
							scope:root_scope = scope:host
							scope:root_scope = scope:spouse_1
							scope:root_scope = scope:spouse_2
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = medium_glory_gain }
						}
						else = {
							accolade = { add_glory = minimal_glory_gain }
						}
					}
				}
				# more glory for a primary participant knight
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = medium_glory_gain }
						}
						else = {
							accolade = { add_glory = sub_minimal_glory_gain }
						}
					}
				}
			}
		}
	}
	# Otherwise, attending knights without liege only get glory as a spouse
	else_if = {
		limit = {
			scope:root_scope = {
				OR = {
					this = scope:spouse_1
					this = scope:spouse_2
				}
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope
				
				scope:root_scope = {
					accolade = { add_glory = minor_glory_gain }
				}
			}
		}
	}
	# attending knights of liege get scraps
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if primary participant
				if = {
					limit = {
						OR = {
							scope:root_scope = scope:host
							scope:root_scope = scope:spouse_1
							scope:root_scope = scope:spouse_2
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								OR = {
									this = scope:spouse_1
									this = scope:spouse_2
								}
							}
							accolade = { add_glory = minor_glory_gain }
						}
						else = {
							accolade = { add_glory = sub_minimal_glory_gain }
						}
					}
				}
				# more glory for a primary participant knight
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
							OR = {
								this = scope:spouse_1
								this = scope:spouse_2
							}
						}
						accolade = { add_glory = minor_glory_gain }
					}
				}
			}
		}
	}
}

#GLORY GAIN FOR FEASTS
accolades_activity_complete_feast_glory_effect = {
	if = {
		limit = {
			scope:activity.special_guest:honorary_guest_regular ?= {
				is_acclaimed = yes
			}
		}
		scope:activity.special_guest:honorary_guest_regular ?= {
			save_scope_as = honorary_guest_knight
		}
	}
	# Decent glory if the acclaimed knight attends a grand-ass feast without liege
	if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
			scope:activity = {
				has_activity_option = {
					category = feast_option_food
					option = feast_food_good
				}
				has_activity_option = {
					category = feast_option_courses
					option = feast_courses_good
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope
				if = {
					limit = {
						#more glory gain only if honored guest
						exists = scope:honorary_guest_knight
						scope:root_scope = scope:honorary_guest_knight
					}
					scope:root_scope = {
						accolade = { add_glory = major_glory_gain }
					}
				}
				else = {
					scope:root_scope = {
						accolade = { add_glory = minimal_glory_gain }
					}
				}
				
			}
		}
	}
	# Decent glory if the liege attends a grand-ass feast with acclaimed knights
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				has_activity_option = {
					category = feast_option_food
					option = feast_food_good
				}
				has_activity_option = {
					category = feast_option_courses
					option = feast_courses_good
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if host
				if = {
					limit = {
						scope:root_scope = {
							this = scope:host
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								exists = scope:honorary_guest_knight
								this = scope:honorary_guest_knight
							}
							accolade = { add_glory = major_glory_gain }
						}
						else = {
							accolade = { add_glory = minor_glory_gain }
						}
					}
				}
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								exists = scope:honorary_guest_knight
								this = scope:honorary_guest_knight
							}
							accolade = { add_glory = major_glory_gain }
						}
						else = {
							accolade = { add_glory = minimal_glory_gain }
						}
					}
				}
			}
		}
	}
	# An ok amount for a sort of grand feast, knight's liege not attending
	else_if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
			}
			scope:activity = {
				OR = {
					has_activity_option = {
						category = feast_option_food
						option = feast_food_good
					}
					has_activity_option = {
						category = feast_option_food
						option = feast_food_normal
					}
				}
				OR = {
					has_activity_option = {
						category = feast_option_courses
						option = feast_courses_good
					}
					has_activity_option = {
						category = feast_option_courses
						option = feast_courses_normal
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope
				if = {
					limit = {
						#more glory gain only if honored guest
						exists = scope:honorary_guest_knight
						scope:root_scope = scope:honorary_guest_knight
					}
					scope:root_scope = {
						accolade = { add_glory = medium_glory_gain }
					}
				}
				else = {
					scope:root_scope = {
						accolade = { add_glory = sub_minimal_glory_gain }
					}
				}
			}
		}
	}
	# An ok amount for a sort of grand feast, for acclaimed knights of attending liege
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
			scope:activity = {
				OR = {
					has_activity_option = {
						category = feast_option_food
						option = feast_food_good
					}
					has_activity_option = {
						category = feast_option_food
						option = feast_food_normal
					}
				}
				OR = {
					has_activity_option = {
						category = feast_option_courses
						option = feast_courses_good
					}
					has_activity_option = {
						category = feast_option_courses
						option = feast_courses_normal
					}
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if host
				if = {
					limit = {
						scope:root_scope = {
							this = scope:host
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								exists = scope:honorary_guest_knight
								this = scope:honorary_guest_knight
							}
							accolade = { add_glory = medium_glory_gain }
						}
						else = {
							accolade = { add_glory = minimal_glory_gain }
						}
					}
				}
				else = {
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								exists = scope:honorary_guest_knight
								this = scope:honorary_guest_knight
							}
							accolade = { add_glory = medium_glory_gain }
						}
						else = {
							accolade = { add_glory = sub_minimal_glory_gain }
						}
					}
				}
			}
		}
	}
	# Otherwise, it's scraps for attending knights without liege
	else_if = {
		limit = {
			scope:root_scope = {
				is_acclaimed = yes
				#this acclaimed knight's liege is not present
				exists = liege
				NOT = {
					scope:root_scope.location = liege.location
				}
				exists = scope:honorary_guest_knight
				this = scope:honorary_guest_knight
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = knight_accolade_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope
				
				scope:root_scope = {
					accolade = { add_glory = minor_glory_gain }
				}
			}
		}
	}
	# Otherwise, it's scraps for attending knights of liege
	else_if = {
		limit = {
			scope:activity = {
				any_attending_character = {
					is_knight_of = scope:root_scope
					is_acclaimed = yes
				}
			}
		}
		scope:activity = {
			add_activity_log_entry = {
				key = liege_accolades_glory_reward
				tags = { completed }
				score = 10
				# this line below adds the entry to the Effects section of the conclusion UI
				show_in_conclusion = yes
				character = scope:root_scope

				#more glory gain if host
				if = {
					limit = {
						scope:root_scope = {
							this = scope:host
						}
					}
					every_attending_character = {
						limit = {
							is_knight_of = scope:root_scope
							is_acclaimed = yes
						}
						if = {
							limit = {
								exists = scope:honorary_guest_knight
								this = scope:honorary_guest_knight
							}
							accolade = { add_glory = minor_glory_gain }
						}
						else = {
							accolade = { add_glory = sub_minimal_glory_gain }
						}
					}
				}
				else = {
					scope:honorary_guest_knight ?= {
						accolade = { add_glory = minor_glory_gain }
					}
				}
			}
		}
	}
}


#Glory Gain from winning wars against THE BIG BAD
# little wars when the attacker wins
accolade_attacker_war_end_glory_gain_low_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = minor_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = minimal_glory_gain
			}
		}
	}
}

# little wars when the defender wins
accolade_defender_war_end_glory_gain_low_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = minor_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = minimal_glory_gain
			}
		}
	}
}

# duchy-type wars when the attacker wins
accolade_attacker_war_end_glory_gain_med_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = major_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = minor_glory_gain
			}
		}
	}
}	

# duchy-type wars when the defender wins
accolade_defender_war_end_glory_gain_med_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = major_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = minor_glory_gain
			}
		}
	}
}

# KINGDOM-type wars when the attacker wins
accolade_attacker_war_end_glory_gain_high_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = massive_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = major_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
	}
}

# KINGDOM-type wars when the defender wins
accolade_defender_war_end_glory_gain_high_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = massive_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = major_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = medium_glory_gain
			}
		}
	}
}

# EMPIRE-type wars when the attacker wins
accolade_attacker_war_end_glory_gain_very_high_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = monumental_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = massive_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:defender
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.attacker_every_active_accolade
				add_glory = major_glory_gain
			}
		}
	}
}

# EMPIRE-type wars when the defender wins
accolade_defender_war_end_glory_gain_very_high_effect = {
	if = {
		limit = {
			has_dlc_feature = accolades
		}
		if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value <= -3
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = monumental_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -2
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = massive_glory_gain
			}
		}
		else_if = {
			limit = {
				tier_difference = {
					target = scope:attacker
					value = -1
				}
			}
			every_active_accolade = {
				custom = custom.defender_every_active_accolade
				add_glory = major_glory_gain
			}
		}
	}
}

#Add glory with accolade checks MINIMAL GAIN
accolade_minimal_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = minimal_glory_gain
		}
	}
}
#Add glory with accolade checks MINOR GAIN
accolade_minor_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = minor_glory_gain
		}
	}
}
#Add glory with accolade checks MEDIUM GAIN
accolade_medium_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = medium_glory_gain
		}
	}
}
#Add glory with accolade checks MAJOR GAIN
accolade_major_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = major_glory_gain
		}
	}
}
#Add glory with accolade checks MASSIVE GAIN
accolade_massive_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = massive_glory_gain
		}
	}
}

#Add glory with accolade checks MONUMENTAL GAIN
accolade_monumental_glory_gain_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = monumental_glory_gain
		}
	}
}

#Add glory with accolade checks MINIMAL LOSS
accolade_minimal_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = minimal_glory_loss
		}
	}
}
#Add glory with accolade checks MINOR LOSS
accolade_minor_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = minor_glory_loss
		}
	}
}
#Add glory with accolade checks MEDIUM LOSS
accolade_medium_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = medium_glory_loss
		}
	}
}
#Add glory with accolade checks MAJOR LOSS
accolade_major_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = major_glory_loss
		}
	}
}
#Add glory with accolade checks MASSIVE LOSS
accolade_massive_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = massive_glory_loss
		}
	}
}

#Add glory with accolade checks MONUMENTAL LOSS
accolade_monumental_glory_loss_with_checks_effect = {
	if = {
		limit = {
			is_acclaimed = yes
			is_alive = yes
			accolade = {
				is_accolade_active = yes
			}
		}
		accolade = {
			add_glory = monumental_glory_loss
		}
	}
}

# FIND SUITABLE ACCOLADE SUCCESSOR INTERACTION
#this saves a random culture that's known for its knights and is familiar enough to the accolade_tournament_xp_gain_all_knights
save_general_accolade_successor_culture_effect = {
	random_culture_global = {
		limit = {
			OR = {
				has_cultural_pillar = ethos_stoic
				has_cultural_pillar = ethos_bellicose
				has_cultural_parameter = wanderers_gain_extra_combat_skills
				has_cultural_parameter = high_prowess_ignores_knight_restrictions
				has_cultural_parameter = prowess_from_martial_education
				has_cultural_parameter = martial_education_more_valued
				has_cultural_parameter = strong_traits_more_valued
			}
			trigger_if = {
				limit = {
					root = {
						highest_held_title_tier >= tier_duchy
					}
					exists = root.capital_county
				}
				any_culture_county = {
					OR = {
						holder = {
							this = root
						}
						holder.liege = {
							this = root
						}
						holder.top_liege = {
							this = root
						}
						empire = root.capital_county.empire 
					}
				}
			}
			trigger_else = {
				exists = root.capital_county
				any_culture_county = {
					OR = {
						holder = {
							this = root
						}
						holder.liege = {
							this = root
						}
						holder.top_liege = {
							this = root
						}
						kingdom = root.capital_county.kingdom 
					}
				}
			}
			culture_number_of_counties > 0
			cultural_acceptance = {
				target = root.culture
				value >= 15
			}
		}
		save_scope_as = knight_culture
	}
}

#this one's just for the varangians
save_varangian_successor_culture_effect = {
	#EK DISABLED
	#if = {
	#	limit = {
	#		current_date < 1400
	#		root = {
	#			has_title = title:e_byzantium
	#		}
	#	}
	#	random_culture_global = {
	#		limit = {
	#			OR = {
	#				has_cultural_parameter = unlock_maa_huscarls
	#				has_cultural_parameter = unlock_maa_varangian_veterans
	#			}
	#			culture_number_of_counties > 0
	#			any_culture_duchy = {
	#				NOT = {
	#					this = title:d_iceland
	#				}
	#			}
	#			NOT = {
	#				this = culture:estonian
	#			}
	#			NAND = {
	#				this = culture:anglo_saxon
	#				current_date < 1067
	#			}
	#		}
	#		save_scope_as = varangian_culture
	#	}
	#}
}

#this one's just for the varangians
save_turkic_successor_culture_effect = {
	#EK DISABLED
	#if = {
	#	limit = {
	#		root = {
	#			faith.religion = religion:islam_religion
	#			capital_county.title_province ?= {
   	#				OR = {
	#					geographical_region = world_middle_east
	#					geographical_region = world_africa_north_east
	#					geographical_region = world_asia_minor
	#					geographical_region = world_europe_south_east
	#					geographical_region = world_steppe
	#				}
	#			}
	#			culture = {
	#				NOT = {
	#					has_cultural_parameter = unlock_maa_horse_archers
	#				}
	#			}
	#			highest_held_title_tier >= tier_kingdom
	#		}
	#	}
	#	random_culture_global = {
	#		limit = {
	#			has_cultural_parameter = unlock_maa_horse_archers
	#			has_cultural_pillar = heritage_turkic
	#			culture_number_of_counties > 0
	#			any_culture_county = {
	#				holder = {
	#					in_diplomatic_range = root
	#				}
	#			}
	#		}
	#		weight = {
	#			modifier = {
	#				add = 100
	#				any_culture_county = {
	#					empire = root.capital_county.empire 
	#				}
	#			}
	#			modifier = {
	#				add = 50
	#				any_culture_county = {
	#					kingdom = root.capital_county.kingdom
	#				}
	#			}
	#		}
	#		save_scope_as = turkic_culture
	#	}
	#}
}

#this saves appropriate cultures for specific accolade types, just need to check for the type along with its relevant cultural triggers
save_type_specific_successor_culture_effect = {
	random_culture_global = {
		limit = {
			OR = {
				# Marauder
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:marauder_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_tradition = tradition_ruling_caste
						has_cultural_tradition = tradition_eye_for_an_eye
					}
				}
				# Idealist
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:idealist_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_egalitarian
						has_cultural_tradition = tradition_charitable
						has_cultural_tradition = tradition_loyal_soldiers
						has_cultural_tradition = tradition_chivalry
					}
				}
				# Charmer
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:charmer_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_courtly
						has_cultural_tradition = tradition_welcoming
					}
				}
				# Thug
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:thug_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_tradition = tradition_battlefield_looters
						has_cultural_tradition = tradition_ruling_caste
						has_cultural_tradition = tradition_quarrelsome
					}
				}
				# Disciplinarian
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:disciplinarian_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_stoic
						has_cultural_pillar = ethos_bureaucratic
						has_cultural_tradition = tradition_hard_working
						has_cultural_tradition = tradition_staunch_traditionalists
						has_cultural_tradition = tradition_formation_fighting
					}
				}
				# Valiant
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:valiant_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_tradition = tradition_talent_acquisition
						has_cultural_tradition = tradition_only_the_strong
						has_cultural_tradition = tradition_stand_and_fight
						has_cultural_tradition = tradition_warrior_culture
						has_cultural_tradition = tradition_fp1_performative_honour
						has_cultural_tradition = tradition_fp1_the_right_to_prove
					}
				}
				# Stalwart
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:stalwart_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_stoic
						has_cultural_pillar = ethos_communal
						has_cultural_tradition = tradition_stalwart_defenders
                        has_cultural_tradition = tradition_stand_and_fight
                        has_cultural_tradition = tradition_druzhina
                        has_cultural_tradition = tradition_hird
                        has_cultural_tradition = tradition_fp1_coastal_warriors
					}
					NOT = {
						has_cultural_tradition = tradition_hit_and_run
					}
				}
				# Scoundrel
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:scoundrel_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_tradition = tradition_hit_and_run
                        has_cultural_tradition = tradition_quarrelsome
                        has_cultural_tradition = tradition_swords_for_hire
                        has_cultural_tradition = tradition_ep3_audacious_cadets
                        has_cultural_tradition = tradition_fp1_coastal_warriors
                        has_cultural_tradition = tradition_fp2_state_ransoming
                        has_cultural_tradition = tradition_practiced_pirates
					}
					NOT = {
						has_cultural_tradition = tradition_hit_and_run
					}
				}
				# Politicker
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:politicker_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_courtly
						has_cultural_pillar = ethos_egalitarian
						has_cultural_parameter = facilitate_alliance_acceptance
						has_cultural_parameter = can_make_republican_vassals
						has_cultural_parameter = learns_more_languages
						has_cultural_parameter = diplomacy_education_better_outcomes
						has_cultural_parameter = eunuch_trait_bonuses
					}
					#EK EDIT: new parameter
					NOR = {
						has_cultural_parameter = is_isolationist_tradition
						has_cultural_parameter = ai_doesnt_marry_outside_culture
					}
				}
				# Tactician
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:tactician_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_pillar = ethos_bureaucratic
						has_cultural_tradition = tradition_adaptive_skirmishing
						has_cultural_tradition = tradition_formation_fighting
						has_cultural_parameter = better_knights_from_decision
						has_cultural_tradition = tradition_hit_and_run
					}
				}
				# Reeve
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:reeve_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bureaucratic
						has_cultural_pillar = ethos_egalitarian
						has_cultural_parameter = martial_education_worse_outcomes
						has_cultural_parameter = poorly_educated_leaders_distrusted
						has_cultural_parameter = just_trait_more_common
						has_cultural_tradition = tradition_hard_working
					}
				}
				# Manipulator
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:manipulator_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_courtly
						has_cultural_pillar = ethos_communal
						has_cultural_parameter = eunuch_trait_bonuses
						has_cultural_parameter = rivalries_more_common
					}
					NOR = {
						has_cultural_tradition = tradition_stand_and_fight
						has_cultural_parameter = honest_trait_more_common
					}
				}
				# Mentor
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:mentor_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_communal
						has_cultural_pillar = ethos_spiritual
						has_cultural_parameter = guardians_can_transfer_commander_traits
						has_cultural_parameter = generous_trait_more_common
						has_cultural_parameter = patient_trait_more_common
						has_cultural_parameter = innovation_from_learning_traits
						has_cultural_parameter = better_ward_education
					}
					NOT = {
						has_cultural_parameter = minimum_prowess_for_knights
					}
				}
				# Contender
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:contender_attribute
						}
					}
					OR = {
						has_cultural_pillar = ethos_bellicose
						has_cultural_pillar = ethos_stoic
						has_cultural_parameter = high_prowess_ignores_knight_restrictions
						has_cultural_parameter = prowess_from_martial_education
						has_cultural_parameter = martial_education_more_valued
						has_cultural_parameter = strong_traits_more_valued
						has_cultural_parameter = better_knights_from_decision
						has_cultural_parameter = minimum_prowess_for_knights
						has_cultural_parameter =
						has_access_to_trials_by_combat
					}
				}
				# Archer
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:archer_attribute
						}
					}
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_brythonic
					#	has_cultural_pillar = heritage_east_african
					#	has_cultural_pillar = heritage_indo_aryan
					#	has_cultural_pillar = heritage_dravidian
					#	has_cultural_pillar = heritage_burman
					#	has_cultural_pillar = heritage_yoruba
					#	has_cultural_pillar = heritage_baltic
					#	has_cultural_pillar = heritage_balto_finnic
					#}
				}
				# Skirmisher
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:skirmisher_attribute
						}
					}
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_baltic
					#	has_cultural_pillar = heritage_ugro_permian
					#	has_cultural_pillar = heritage_balto_finnic
					#	has_cultural_pillar = heritage_somalian
					#	has_cultural_pillar = heritage_west_african
					#	has_cultural_pillar = heritage_goidelic
					#	has_cultural_pillar = heritage_brythonic
					#}
				}
				# Pike
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:pike_attribute
						}
					}
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_central_germanic
					#	has_cultural_pillar = heritage_latin
					#}
				}
				# Outrider
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:outrider_attribute
						}
					}
					OR = {
						has_cultural_tradition = tradition_ep3_indomitable_azatani
						has_cultural_tradition = tradition_desert_ribat
						has_cultural_tradition = tradition_chanson_de_geste
						has_cultural_tradition = tradition_hussar
					}
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_iranian
					#	has_cultural_pillar = heritage_turkic
					#	has_cultural_pillar = heritage_mongolic
					#	has_cultural_pillar = heritage_arabic
					#	has_cultural_pillar = heritage_berber
					#	has_cultural_pillar = heritage_iberian
					#	has_cultural_pillar = heritage_indo_aryan
					#	has_cultural_pillar = heritage_magyar
					#}
				}
				# Vanguard
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:vanguard_attribute
						}
					}
					OR = {
						has_innovation = innovation_quilted_armor
						has_cultural_tradition = tradition_fp1_coastal_warriors
						has_cultural_tradition = tradition_hird
						has_cultural_tradition = tradition_futuwaa
						has_cultural_tradition = tradition_druzhina
						has_cultural_tradition = tradition_khadga_puja
						has_cultural_tradition = tradition_garuda_warriors
						has_cultural_tradition = tradition_himalayan_settlers
						has_cultural_tradition = tradition_mubarizuns
						has_cultural_tradition = tradition_burman_royal_army
						has_cultural_tradition = tradition_mountaineer_ruralism
						#has_innovation = innovation_sarawit # EK DISABLED
						#has_innovation = innovation_legionnaires
					}
					#OR = { # EK DISABLED
					#	has_cultural_pillar = heritage_central_germanic
					#	has_cultural_pillar = heritage_north_germanic
					#	has_cultural_pillar = heritage_west_germanic
					#	has_cultural_pillar = heritage_east_slavic
					#	has_cultural_pillar = heritage_burman
					#	has_cultural_pillar = heritage_qiangic
					#	has_cultural_pillar = heritage_tibetan
					#}
				}
				# Lancer
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:lancer_attribute
						}
					}
					OR = {
						has_innovation = innovation_arched_saddle
						has_cultural_tradition = tradition_caucasian_wolves
						has_cultural_tradition = tradition_roman_legacy
						#has_innovation = innovation_valets #EK DISABLED
						has_cultural_tradition = tradition_ep3_audacious_cadets
						has_cultural_tradition = tradition_ep3_imperial_tagmata
					}
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_iranian
					#	has_cultural_pillar = heritage_turkic
					#	has_cultural_pillar = heritage_mongolic
					#	has_cultural_pillar = heritage_central_germanic
					#	has_cultural_pillar = heritage_frankish
					#	has_cultural_pillar = heritage_indo_aryan
					#	has_cultural_pillar = heritage_byzantine
					#}
				}
				# Besieger
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:besieger_attribute
						}
					}
					has_innovation = innovation_mangonel
					OR = {
						has_cultural_tradition = tradition_castle_keepers
						has_cultural_tradition = tradition_hereditary_hierarchy
						has_cultural_tradition = tradition_hard_working
						has_cultural_tradition = tradition_swords_for_hire
						has_cultural_tradition = tradition_ep3_audacious_cadets
						has_cultural_tradition = tradition_malleable_invaders
						has_cultural_tradition = tradition_metal_craftsmanship
					}
				}
				# Crossbowman
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:crossbowmen_attribute
						}
					}
					OR = {
						has_innovation = innovation_advanced_bowmaking
						#has_innovation = innovation_repeating_crossbow #EK DISABLED
					}
					OR = {
						#EK DISABLED
						#has_cultural_pillar = heritage_chinese
						#has_cultural_pillar = heritage_latin
						has_cultural_tradition = tradition_swords_for_hire
					}
				}
				# Camel Rider
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:camelry_attribute
						}
					}
					has_innovation = innovation_war_camels
					OR = {
						#EK DISABLED
						#has_cultural_pillar = heritage_arabic
						#has_cultural_pillar = heritage_berber
						has_cultural_tradition = tradition_desert_nomads
						has_cultural_tradition = tradition_warriors_of_the_dry
					}
				}
				# Elephant Rider
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:elephantry_attribute
						}
					}
					has_innovation = innovation_elephantry
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_dravidian
					#	has_cultural_pillar = heritage_indo_aryan
					#	has_cultural_pillar = heritage_burman
					#}
				}
				# Horse Archer
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:horse_archer_attribute
						}
					}
					has_cultural_parameter = unlock_maa_horse_archers
					#EK DISABLED
					#OR = {
					#	has_cultural_pillar = heritage_turkic
					#	has_cultural_pillar = heritage_mongolic
					#	has_cultural_pillar = heritage_burman
					#}
				}
				# Huntsmaster
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:huntsmaster_attribute
						}
					}
					OR = {
						has_cultural_tradition = tradition_bush_hunting
						has_cultural_tradition = tradition_hunters
						has_cultural_tradition = tradition_sacred_hunts
						has_cultural_tradition = tradition_forest_fighters
						has_cultural_tradition = tradition_jungle_warriors
						has_cultural_tradition = tradition_land_of_the_bow
						has_cultural_tradition = tradition_bush_hunting
						has_cultural_tradition = tradition_hunters
						has_cultural_tradition = tradition_sacred_hunts
					}
					NOT = {
						has_cultural_tradition = tradition_vegetarianism
					}
				}
				# Blademaster
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:blademaster_attribute
						}
					}
					OR = {
						has_cultural_tradition = tradition_druzhina
						has_cultural_tradition = tradition_futuwaa
						has_cultural_tradition = tradition_khadga_puja
						has_cultural_tradition = tradition_talent_acquisition
						has_cultural_tradition = tradition_swords_for_hire
						has_cultural_tradition = tradition_warriors_by_merit
						has_cultural_tradition = tradition_only_the_strong
						has_cultural_tradition = tradition_martial_admiration
						has_cultural_tradition = tradition_fp1_trials_by_combat
						has_cultural_tradition = tradition_chanson_de_geste
						has_cultural_tradition = tradition_fp1_performative_honour
						has_cultural_tradition = tradition_chivalry
						has_cultural_tradition = tradition_warrior_culture
						has_cultural_tradition = tradition_fp1_the_right_to_prove
						has_cultural_tradition = tradition_garuda_warriors
					}
				}
				# Master of Revels
				AND = {
					scope:accolade_in_need = {
						primary_type = {
							this = accolade_type:master_of_revels_attribute
						}
					}
					OR = {
						has_cultural_tradition = tradition_esteemed_hospitality
						has_cultural_tradition = tradition_wedding_ceremonies
						has_cultural_tradition = tradition_welcoming
						has_cultural_tradition = tradition_music_theory
						has_cultural_tradition = tradition_festivities
						has_cultural_tradition = tradition_culinary_art
					}
				}
			}
			trigger_if = {
				limit = {
					exists = root.capital_county
					root = {
						highest_held_title_tier >= tier_duchy
					}
				}
				any_culture_county = {
					OR = {
						holder = {
							this = root
						}
						holder.liege = {
							this = root
						}
						holder.top_liege = {
							this = root
						}
						empire = root.capital_county.empire 
					}
				}
			}
			trigger_else = {
				exists = root.capital_county
				any_culture_county = {
					OR = {
						holder = {
							this = root
						}
						holder.liege = {
							this = root
						}
						holder.top_liege = {
							this = root
						}
						kingdom = root.capital_county.kingdom 
					}
				}
			}
			culture_number_of_counties > 0
			cultural_acceptance = {
				target = root.culture
				value >= 15
			}
		}
		save_scope_as = type_specific_culture
	}
}

accolade_character_creation_effect = {
	#don't want AI using our performance intensive checks
	if = {
		limit = {
			root = {
				OR = {
					is_ai = no
					any_held_title = { this = title:c_bastion } #EK EDIT: was e_byzantium
				}
			}
		}
		#save a general knight-y culture that can randomly be used
		save_general_accolade_successor_culture_effect = yes
		#EK DISABLED: no varangians
		#varangians if relevant
		#save_varangian_successor_culture_effect = yes
		#EK DISABLED: no turks
		#turkic warriors if relevant
		#save_turkic_successor_culture_effect = yes
		#save one specific to the accolade type
		save_type_specific_successor_culture_effect = yes
	}
	#let's get creating - but needs to be the right type of knight
	#Marauder
	if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:marauder_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_marauder_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Idealist
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:idealist_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_idealist_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Charmer
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:charmer_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_charmer_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Thug
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:thug_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_thug_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Disciplinarian
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:disciplinarian_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_disciplinarian_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Fanatic
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:fanatic_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_fanatic_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Valiant
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:valiant_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_valiant_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Stalwart
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:stalwart_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_stalwart_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Scoundrel
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:scoundrel_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_scoundrel_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Politicker
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:politicker_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_politicker_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { diplomacy < 15 }
			}
			scope:chosen_knight = {
				add_diplomacy_skill = {
					value = 15
					subtract = diplomacy
				}
			}
		}
	}
	#Tactician
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:tactician_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_tactician_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { martial < 15 }
			}
			scope:chosen_knight = {
				add_martial_skill = {
					value = 15
					subtract = martial
				}
			}
		}
	}
	#Reeve
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:reeve_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_reeve_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { stewardship < 15 }
			}
			scope:chosen_knight = {
				add_stewardship_skill = {
					value = 15
					subtract = stewardship
				}
			}
		}
	}
	#Manipulator
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:manipulator_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_manipulator_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { intrigue < 15 }
			}
			scope:chosen_knight = {
				add_intrigue_skill = {
					value = 15
					subtract = intrigue
				}
			}
		}
	}
	#Mentor
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:mentor_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_mentor_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { learning < 15 }
			}
			scope:chosen_knight = {
				add_learning_skill = {
					value = 15
					subtract = learning
				}
			}
		}
	}
	#Contender
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:contender_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_contender_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
		if = {
			limit = {
				scope:chosen_knight = { prowess < 20 }
			}
			scope:chosen_knight = {
				add_prowess_skill = {
					value = 20
					subtract = prowess
				}
			}
		}
	}
	#Archer
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:archer_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_archer_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Skirmisher
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:skirmisher_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_skirmisher_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Pike
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:pike_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_pike_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = { exists = scope:varangian_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Outrider
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:outrider_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_outrider_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = { exists = root.location.culture }
				}
				scope:knight_culture = {
					trigger = { exists = scope:knight_culture }
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = { exists = scope:turkic_culture }
				#}
				scope:type_specific_culture = {
					trigger = { exists = scope:type_specific_culture }
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Vanguard
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:vanguard_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_vanguard_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = {
							OR = {
								has_innovation = innovation_quilted_armor
								has_cultural_tradition = tradition_fp1_coastal_warriors
								has_cultural_tradition = tradition_hird
								has_cultural_tradition = tradition_futuwaa
								has_cultural_tradition = tradition_druzhina
								has_cultural_tradition = tradition_khadga_puja
								has_cultural_tradition = tradition_garuda_warriors
								has_cultural_tradition = tradition_himalayan_settlers
								has_cultural_tradition = tradition_mubarizuns
								has_cultural_tradition = tradition_burman_royal_army
								has_cultural_tradition = tradition_mountaineer_ruralism
								#EK DISABLED
								#has_innovation = innovation_sarawit
								#has_innovation = innovation_legionnaires
							}
						}
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = {
							OR = {
								has_innovation = innovation_quilted_armor
								has_cultural_tradition = tradition_fp1_coastal_warriors
								has_cultural_tradition = tradition_hird
								has_cultural_tradition = tradition_futuwaa
								has_cultural_tradition = tradition_druzhina
								has_cultural_tradition = tradition_khadga_puja
								has_cultural_tradition = tradition_garuda_warriors
								has_cultural_tradition = tradition_himalayan_settlers
								has_cultural_tradition = tradition_mubarizuns
								has_cultural_tradition = tradition_burman_royal_army
								has_cultural_tradition = tradition_mountaineer_ruralism
								#EK DISABLED
								#has_innovation = innovation_sarawit
								#has_innovation = innovation_legionnaires
							}
						}
					}
				}
				#scope:varangian_culture = {
				#	trigger = {
				#		exists = scope:varangian_culture
				#		scope:varangian_culture = {
				#			OR = {
				#				has_innovation = innovation_quilted_armor
				#				has_cultural_tradition = tradition_fp1_coastal_warriors
				#				has_cultural_tradition = tradition_hird
				#				has_cultural_tradition = tradition_futuwaa
				#				has_cultural_tradition = tradition_druzhina
				#				has_cultural_tradition = tradition_khadga_puja
				#				has_cultural_tradition = tradition_garuda_warriors
				#				has_cultural_tradition = tradition_himalayan_settlers
				#				has_cultural_tradition = tradition_mubarizuns
				#				has_cultural_tradition = tradition_burman_royal_army
				#				has_cultural_tradition = tradition_mountaineer_ruralism
				#				#EK DISABLED
				#				#has_innovation = innovation_sarawit
				#				#has_innovation = innovation_legionnaires
				#			}
				#		}
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = {
							OR = {
								has_innovation = innovation_quilted_armor
								has_cultural_tradition = tradition_fp1_coastal_warriors
								has_cultural_tradition = tradition_hird
								has_cultural_tradition = tradition_futuwaa
								has_cultural_tradition = tradition_druzhina
								has_cultural_tradition = tradition_khadga_puja
								has_cultural_tradition = tradition_garuda_warriors
								has_cultural_tradition = tradition_himalayan_settlers
								has_cultural_tradition = tradition_mubarizuns
								has_cultural_tradition = tradition_burman_royal_army
								has_cultural_tradition = tradition_mountaineer_ruralism
								#EK DISABLED
								#has_innovation = innovation_sarawit
								#has_innovation = innovation_legionnaires
							}
						}
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Lancer
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:lancer_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_lancer_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = {
							OR = {
								has_innovation = innovation_arched_saddle
								has_cultural_tradition = tradition_caucasian_wolves
								has_cultural_tradition = tradition_ep3_audacious_cadets
								has_cultural_tradition = tradition_roman_legacy
								has_cultural_tradition = tradition_ep3_imperial_tagmata
								#has_innovation = innovation_valets #EK DISABLED
							}
						}
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = {
							OR = {
								has_innovation = innovation_arched_saddle
								has_cultural_tradition = tradition_caucasian_wolves
								has_cultural_tradition = tradition_ep3_audacious_cadets
								has_cultural_tradition = tradition_roman_legacy
								has_cultural_tradition = tradition_ep3_imperial_tagmata
								#has_innovation = innovation_valets #EK DISABLED
							}
						}
					}
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = {
				#			OR = {
				#				has_innovation = innovation_arched_saddle
				#				has_cultural_tradition = tradition_caucasian_wolves
				#				has_cultural_tradition = tradition_roman_legacy
				#				#has_innovation = innovation_valets
				#			}
				#		}
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = {
							OR = {
								has_innovation = innovation_arched_saddle
								has_cultural_tradition = tradition_caucasian_wolves
								has_cultural_tradition = tradition_ep3_audacious_cadets
								has_cultural_tradition = tradition_roman_legacy
								has_cultural_tradition = tradition_ep3_imperial_tagmata
								#has_innovation = innovation_valets #EK DISABLED
							}
						}
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Besieger
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:besieger_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_besieger_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = { has_innovation = innovation_mangonel }
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = { has_innovation = innovation_mangonel }
					}
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = {
				#		exists = scope:varangian_culture
				#		scope:varangian_culture = { has_innovation = innovation_mangonel }
				#	}
				#}
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = { has_innovation = innovation_mangonel }
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = { has_innovation = innovation_mangonel }
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Crossbowman
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:crossbowmen_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_crossbowmen_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						OR = {
							root.location.culture = {
								has_innovation = innovation_advanced_bowmaking
								#has_innovation = innovation_repeating_crossbow #EK DISABLED
							}
						}
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = {
							OR = {
								has_innovation = innovation_advanced_bowmaking
								#has_innovation = innovation_repeating_crossbow #EK DISABLED
							}
						}
					}
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = {
				#			OR = {
				#				has_innovation = innovation_advanced_bowmaking
				#				has_innovation = innovation_repeating_crossbow
				#			}
				#		}
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = {
							OR = {
								has_innovation = innovation_advanced_bowmaking
								#has_innovation = innovation_repeating_crossbow #EK DISABLED
							}
						}
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Camel Rider
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:camelry_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_camelry_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = { has_innovation = innovation_war_camels }
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = { has_innovation = innovation_war_camels }
					}
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = { has_innovation = innovation_war_camels }
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = { has_innovation = innovation_war_camels }
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Elephant Rider
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:elephantry_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_elephantry_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = { has_innovation = innovation_elephantry }
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = { has_innovation = innovation_elephantry }
					}
				}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = { has_innovation = innovation_elephantry }
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Horse Archer
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:horse_archer_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_horse_archer_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = { culture_has_archer_cavalry_maa = yes }
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = { culture_has_archer_cavalry_maa = yes }
					}
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = { has_cultural_parameter = unlock_maa_horse_archers }
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = { culture_has_archer_cavalry_maa = yes }
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Huntsmaster
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:huntsmaster_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_huntsmaster_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
						root.location.culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } }
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
						scope:knight_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } }
					}
				}
				#EK DISABLED
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#		scope:turkic_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } }
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
						scope:type_specific_culture = { NOT = { has_cultural_tradition = tradition_vegetarianism } }
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Blademaster
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:blademaster_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_blademaster_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
					}
				}
				#EK DISABLED
				#scope:varangian_culture = {
				#	trigger = {
				#		exists = scope:varangian_culture
				#	}
				#}
				#scope:turkic_culture = {
				#	trigger = {
				#		exists = scope:turkic_culture
				#	}
				#}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	#Reveler
	else_if = {
		limit = {
			scope:accolade_in_need = {
				primary_type = {
					this = accolade_type:master_of_revels_attribute
				}
			}
		}
		create_character = {
			location = root.capital_province
			template = accolade_master_of_revels_character
			faith = root.faith
			random_culture = {
				root.culture = {
					trigger = { always = yes }
				}
				root.location.culture = {
					trigger = {
						exists = root.location.culture
					}
				}
				scope:knight_culture = {
					trigger = {
						exists = scope:knight_culture
					}
				}
				scope:type_specific_culture = {
					trigger = {
						exists = scope:type_specific_culture
					}
				}
			}
			save_scope_as = chosen_knight
		}
	}
	if = {
		limit = {
			scope:chosen_knight = { prowess < 12 }
		}
		scope:chosen_knight = {
			add_prowess_skill = {
				value = 12
				subtract = prowess
			}
		}
	}
	if = {
		limit = {
			scope:chosen_knight = { has_trait = devoted }
		}
		scope:chosen_knight = {
			remove_trait = devoted
		}
	}
	if = {
		limit = {
			scope:chosen_knight = { has_trait = celibate }
		}
		scope:chosen_knight = {
			remove_trait = celibate
		}
	}
}
