﻿### EK NOTE: Removed references to vanilla titles.
### EK NOTE: Added flags for mindless and summoned characters, Court Physician gains aptitude for Restoration perks

# Have a look at _court_positions.info for documentation

# COURT POSITIONS
# court_physician_court_position
# cultural_emissary_court_position
# keeper_of_swans_court_position
# chief_qadi_court_position
# garuda_court_position
# court_gardener_court_position
# lady_in_waiting_court_position
# antiquarian_court_position
# travel_leader_court_position
# wet_nurse_court_position
# court_tutor_court_position
# food_taster_court_position
# master_of_horse_court_position
# master_of_hunt_court_position
# royal_architect_court_position
# high_almoner_court_position
# seneschal_court_position
# cupbearer_court_position
# chief_eunuch_court_position
# court_jester_court_position
# court_poet_court_position
# court_musician_court_position
# bodyguard_court_position
# champion_court_position
# executioner_court_position
# court_artificer_court_position
# master_assassin_court_position
# cave_hermit_court_position
# chronicler_court_position
# court_scholar_court_position
# charioteer_court_position
# bookmaker_court_position
# akolouthos_court_position
# court_astrologer_court_position

### Important Court Positions ### ( Sort order 399 - 300 )
court_physician_court_position = {
	sort_order = 399
	max_available_positions = 1
	skill = learning

	court_position_asset = {
		animation = physician
		background = "gfx/interface/illustrations/event_scenes/study_physician.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = soon_forgiven_perk
				}
			}
			add = {
				value = 10
				desc = court_position_soon_forgiven_perk
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = friend }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = lover }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_lover
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				is_married = yes
			}
			add = {
				value = 10
				desc = court_position_positions_of_power_perk_marriage
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_best_friend = prev
				}
			}
			add = {
				value = 30
				desc = court_position_best_friend
			}
		}
		else_if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_friend = prev
				}
			}
			add = {
				value = 15
				desc = court_position_friend
			}
		}
		add = court_position_aptitude_boon_voyager_trait
		# Skill
		add = {
			value = learning
			multiply = 1.75
			max = 50
			desc = court_position_skill_learning
		}
		# Physician
		if = {
			limit = { has_trait = lifestyle_physician }
			add = {
				value = 15
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_physician value >= 50 }
					}
					add = 15
				}
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_physician value >= 100 }
					}
					add = 15
				}
				desc = court_position_physician_1_trait
			}
		}
		# Mystic
		if = {
			limit = { has_trait = lifestyle_mystic }
			add = {
				value = 5
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_mystic value >= 50 }
					}
					add = 5
				}
				if = {
					limit = {
						has_trait_xp = { trait = lifestyle_mystic value >= 100 }
					}
					add = 5
				}
				desc = court_position_mystic_1_trait
			}
		}
		# Herbalist
		if = {
			limit = { has_trait = lifestyle_herbalist }
			add = {
				value = 15
				desc = court_position_herbalist_trait
			}
		}
		# Nomad Yurt
		if = {
			limit = {
				employer.domicile ?= {
					has_domicile_building_or_higher = physician_yurt_01
				}
			}
			add = {
				value = 0
				if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_physician_aptitude_lvl_4
						}
					}
					add = 32
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_physician_aptitude_lvl_3
						}
					}
					add = 16
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_physician_aptitude_lvl_2
						}
					}
					add = 8
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_physician_aptitude_lvl_1
						}
					}
					add = 4
				}
				desc = physician_yurt_01_domicile_building
			}
		}
		# Education
		if = {
			limit = { has_trait = education_learning }
			add = {
				value = 4
				if = {
					limit = { has_trait = education_learning_2 }
					add = 4
				}
				else_if = {
					limit = { has_trait = education_learning_3 }
					add = 8
				}
				else_if = {
					limit = { has_trait = education_learning_4 }
					add = 12
				}
				else_if = {
					limit = { has_trait = education_learning_5 }
					add = 22
				}
				desc = education_learning
			}
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				any_character_artifact = {
					has_artifact_modifier = artifact_physician_aptitude_1_modifier
				}
			}
			add = 20
		}
		# EK EDIT: re-enabled this vanilla parameter
		if = {
			limit = {
				culture = { has_cultural_parameter = court_physicians_are_better }
			}
			add = {
				value = learning
				desc = court_physician_tradition_bonus
			}
		}
		# EK EDIT END
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Camp
		if = {
			limit = {
				employer.domicile ?= { has_domicile_parameter = camp_improved_court_physician_aptitude }
			}
			add = {
				value = camp_improved_court_physician_aptitude_value
				desc = camp_improved_court_physician_aptitude_desc
			}
		}
		# Estate
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_physician_aptitude }
				}
			}
			add = {
				value = estate_increase_physician_aptitude_value
				desc = estate_increase_physician_aptitude_desc
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_physician }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK EDIT, Restoration is a perfectly valid school of magic (especially for court physicians)
		add = aptitude_from_arcana_traits
		if = {
			limit = {
				has_perk = restoration_novice_perk
			}
			add = {
				value = 5
				desc = court_position_restoration_novice_perk
			}
		}
		if = {
			limit = {
				has_perk = restoration_apprentice_perk
			}
			add = {
				value = 5
				desc = court_position_restoration_apprentice_perk
			}
		}
		if = {
			limit = {
				has_perk = restoration_journeyman_perk
			}
			add = {
				value = 5
				desc = court_position_restoration_journeyman_perk
			}
		}
		if = {
			limit = {
				has_perk = restoration_expert_perk
			}
			add = {
				value = 5
				desc = court_position_restoration_expert_perk
			}
		}
		if = {
			limit = {
				has_perk = restoration_master_perk
			}
			add = {
				value = 10
				desc = court_position_restoration_master_perk
			}
		}
	}

	is_shown = { }

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}


	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = court_physician
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_physician
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		gold = {
			value = court_position_physician_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_physician } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_physician
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_physician }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_physician }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		round = no
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			epidemic_resistance = 1
		}
		poor = {
			epidemic_resistance = 3
		}
		average = {
			epidemic_resistance = 5
		}
		good = {
			epidemic_resistance = 7
		}
		excellent = {
			epidemic_resistance = 10
		}
	}

	scaling_employer_court_modifiers = {
		terrible = {
			health = 0.01
		}
		poor = {
			health = 0.03
		}
		average = {
			health = 0.05
		}
		good = {
			health = 0.07
		}
		excellent = {
			health = 0.1
		}
	}

	custom_employer_modifier_description = court_physician_employer_custom_effect_description

	modifier = {
		health = 0.1
	}

	#custom_employee_modifier_description = court_physician_employee_custom_effect_description

	on_court_position_received = {
		court_physician_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_physician_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_physician_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_physician_court_position
		}
	}

	search_for_courtier = {
		send_interface_toast = {
			type = event_toast_effect_neutral
			title = hire_physician_decision
			custom_tooltip = hire_physician_decision_effect_tooltip
		}
		hidden_effect = {
			add_character_flag = {
				flag = health_3001_hire_physician_decision_text
				days = 20
			}
		}

		trigger_event = {
			id = health.3001
			days = 14
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
        value = 150
        # Always have this position if you can, regardless of monetary situation
        add = court_position_candidate_score_base_value
        add = court_position_candidate_aptitude_value

		# No debt considerations for Physicians, they are too important
        # AI is less likely to fire the court physician, unless they have a better candidate.
        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 200
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -150
                }
            }
        }

		if = {
			limit = {
				scope:liege = {
					any_held_county = {
						any_county_province = {
							any_province_epidemic = {
								outbreak_intensity = minor
							}
						}
					}
				}
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = {
					any_held_county = {
						any_county_province = {
							any_province_epidemic = {
								outbreak_intensity = major
							}
						}
					}
				}
			}
			add = 100
		}
		if = {
			limit = {
				scope:liege = {
					any_held_county = {
						any_county_province = {
							any_province_epidemic = {
								outbreak_intensity = apocalyptic
							}
						}
					}
				}
			}
			add = 150
		}

        add = adjust_court_position_score_for_unity

		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_physician }
			}
			add = 1000
		}
    }
}

travel_leader_court_position = {
	sort_order = 375
	max_available_positions = 1
	is_travel_related = yes
	skill = stewardship

	court_position_asset = {
		animation = holding_staff
		background = "gfx/interface/illustrations/event_scenes/ep2_travel_mountains.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 1
			max = 50
			desc = court_position_skill_learning
		}
		add = {
			value = stewardship
			multiply = 1.3
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				num_of_known_languages >= 2
			}
			add = {
				value = num_of_known_languages
				subtract = 1
				multiply = 5
				max = 50
				desc = court_position_languages
			}
		}

		# SPEED
		add = {
			value = travel_leader_speed
			multiply = 1.8
			subtract = 10
			min = 0
			desc = court_position_speed
		}

		# SAFETY
		add = {
			value = travel_leader_safety
			multiply = 1.8
			subtract = 10
			min = 0
			desc = court_position_safety
		}

		# POSITIVES
		if = {
			limit = {
				has_trait = adventurer
			}
			add = {
				value = 10
				desc = court_position_adventurer_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 5
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 5
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_hunter
			}
			add = {
				value = 5
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = {
				has_trait = diligent
			}
			add = {
				value = 5
				desc = court_position_diligent_trait
			}
		}
		if = {
			limit = {
				has_trait = flexible_leader
			}
			add = {
				value = 10
				desc = court_position_flexible_leader_trait
			}
		}
		if = {
			limit = {
				has_trait = forest_fighter
			}
			add = {
				value = 10
				desc = court_position_forest_fighter_trait
			}
		}
		if = {
			limit = {
				has_trait = open_terrain_expert
			}
			add = {
				value = 10
				desc = court_position_open_terrain_expert_trait
			}
		}
		if = {
			limit = {
				has_trait = rough_terrain_expert
			}
			add = {
				value = 10
				desc = court_position_rough_terrain_expert_trait
			}
		}
		if = {
			limit = {
				has_trait = desert_warrior
			}
			add = {
				value = 10
				desc = court_position_desert_warrior_trait
			}
		}
		if = {
			limit = {
				has_trait = jungle_stalker
			}
			add = {
				value = 10
				desc = court_position_jungle_stalker_trait
			}
		}
		if = {
			limit = {
				has_trait = winter_soldier
			}
			add = {
				value = 10
				desc = court_position_winter_soldier_trait
			}
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 5
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = {
				has_trait = scholar
			}
			add = {
				value = 5
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_physician
			}
			add = {
				value = 5
				desc = court_position_physician_1_trait
			}
		}
		if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler
					track = travel
					value >= 75
				}
			}
			add = {
				value = 40
				desc = court_position_traveler_trait_experienced
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler
					track = danger
					value >= 75
				}
			}
			add = {
				value = 40
				desc = court_position_traveler_trait_experienced_danger
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler
					track = travel
					value >= 50
				}
			}
			add = {
				value = 30
				desc = court_position_traveler_trait_experienced
			}
		}
		else_if = {
			limit = {
				has_trait_xp = {
					trait = lifestyle_traveler
					track = danger
					value >= 50
				}
			}
			add = {
				value = 30
				desc = court_position_traveler_trait_experienced_danger
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_traveler
			}
			add = {
				value = 20
				desc = court_position_traveler_trait
			}
		}
		if = {
			limit = {
				has_character_modifier = ep2_beastmaster_modifier
			}
			add = {
				value = 30
				desc = court_position_beastmaster_modifier
			}
		}

		if = {
			limit = {
				has_perk = travel_companion_perk
			}
			add = {
				value = 15
				desc = court_position_travel_companion_modifier
			}
		}
		if = {
			limit = {
				liege ?= { has_perk = travel_companion_perk }
			}
			add = {
				value = 15
				desc = court_position_travel_companion_liege_modifier
			}
		}

		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = friend }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = lover }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_lover
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				is_married = yes
			}
			add = {
				value = 10
				desc = court_position_positions_of_power_perk_marriage
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_best_friend = prev
				}
			}
			add = {
				value = 30
				desc = court_position_best_friend
			}
		}
		else_if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_friend = prev
				}
			}
			add = {
				value = 15
				desc = court_position_friend
			}
		}

		add = court_position_aptitude_traveling_friends_value


		# NEGATIVES
		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -20
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				has_trait = lazy
			}
			add = {
				value = -10
				desc = court_position_lazy_trait
			}
		}
		if = {
			limit = {
				has_trait = clubfooted
			}
			add = {
				value = -30
				desc = court_position_clubfooted_trait
			}
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = incapable
			}
			multiply = {
				value = 0
				desc = court_position_incapable_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -50
				desc = court_position_infirm_trait
			}
		}
		if = {
			limit = {
				has_trait = maimed
			}
			add = {
				value = -30
				desc = court_position_maimed_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_reveler
			}
			add = {
				value = -5
				desc = court_position_reveler_1_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:travel_leader }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		min = 0
	}

	is_shown = {}

	# Is this an available position for this court? (root is court owner)
	valid_position = { }

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_clergy = no
			bannable_serving_diarch_trigger = no
			NOT = { has_variable = gone_adventuring }
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = travel_leader
		}
	}

	salary = {
		round = no
		gold = {
			value = court_position_travel_leader_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = travel_leader } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = travel_leader
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = travel_leader }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = travel_leader }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige = {
			value = minor_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = travel_leader
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_wanderer_lifestyle_xp_gain_mult = 0.025
		}
		poor = {
			monthly_wanderer_lifestyle_xp_gain_mult = 0.05
		}
		average = {
			monthly_wanderer_lifestyle_xp_gain_mult = 0.075
		}
		good = {
			monthly_wanderer_lifestyle_xp_gain_mult = 0.15
		}
		excellent = {
			monthly_wanderer_lifestyle_xp_gain_mult = 0.25
		}
	}

	custom_employer_modifier_description = travel_leader_court_position_custom_desc

	modifier = {
		diplomacy = 1
		health = 0.1
	}

	on_court_position_received = {
		court_travel_leader_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_travel_leader_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_travel_leader_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = travel_leader_court_position
		}
	}

	search_for_courtier = {
		send_interface_toast = {
			type = event_toast_effect_neutral
			title = hire_travel_leader_decision
			custom_tooltip = hire_travel_leader_decision_tooltip
		}

		trigger_event = {
			id = travel_events.1010
			days = 14
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
        value = 150
    	# Always have this position if you can, regardless of monetary situation
    	add = court_position_candidate_score_base_value
    	add = court_position_candidate_aptitude_value

		# No debt considerations for Travel Leaders, they are too important

        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 200
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -150
                }
            }
        }

        if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = travel_leader }
			}
			add = 1000
		}
    }
}

antiquarian_court_position = {
	sort_order = 350
	max_available_positions = 1
	skill = learning

	court_position_asset = {
		animation = throne_room_one_handed_passive_3
		background = "gfx/interface/illustrations/event_scenes/armory.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = soon_forgiven_perk
				}
			}
			add = {
				value = 10
				desc = court_position_soon_forgiven_perk
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = friend }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = lover }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_lover
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				is_married = yes
			}
			add = {
				value = 10
				desc = court_position_positions_of_power_perk_marriage
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_best_friend = prev
				}
			}
			add = {
				value = 30
				desc = court_position_best_friend
			}
		}
		else_if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = likable_perk
					has_relation_friend = prev
				}
			}
			add = {
				value = 15
				desc = court_position_friend
			}
		}
		add = {
			value = learning
			multiply = 2.5
			max = 60
			desc = court_position_skill_learning
		}
		if = { # Characters with a completed inspiration are very good Antiquarians
			limit = {
				has_completed_inspiration = yes
			}
			add = {
				value = 30
				desc = court_position_completed_inspiration
			}
		}
		if = { # Shy characters are likely to spend more time with the artifacts than other people
			limit = {
				has_trait = shy
			}
			add = {
				value = 15
				desc = court_position_shy_trait
			}
		}
		if = {
			limit = {
				has_trait = diligent
			}
			add = {
				value = 15
				desc = court_position_diligent_trait
			}
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 15
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = { has_trait = overseer }
			add = {
				value = 15
				desc = court_position_overseer_trait
			}
		}
		if = {
			limit = {
				has_variable = fund_inspiration_6508_architect_improvement
			}
			add = {
				value = 5
				desc = court_position_architect_study_experience
			}
		}
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_antiquarian_aptitude }
				}
			}
			add = {
				value = estate_increase_antiquarian_aptitude_value
				desc = estate_increase_antiquarian_aptitude_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:antiquarian }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: Cultural Tradition that improves the aptitude of characters of that culture  new parameter
		if = {
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_antiquarians }
			}
			add = {
				value = 20
				desc = court_position_tradition_antiquarian
			}
		}
		# EK ADDITION END
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
			}
			has_any_artifact = yes
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			antiquarian_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = antiquarian
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = court_position_antiquarian_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = antiquarian } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = antiquarian
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = antiquarian }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = antiquarian }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			artifact_decay_reduction_mult = -0.07
		}
		poor = {
			artifact_decay_reduction_mult = -0.11
		}
		average = {
			artifact_decay_reduction_mult = -0.17
		}
		good = {
			artifact_decay_reduction_mult = -0.25
		}
		excellent = {
			artifact_decay_reduction_mult = -0.35
		}
	}

	custom_employer_modifier_description = antiquarian_employer_custom_effect_description

	modifier = {
		stewardship = 2
		artifact_decay_reduction_mult = -0.2
	}

	on_court_position_received = {
		antiquarian_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		antiquarian_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		antiquarian_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = antiquarian_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = {
			limit = {
				scope:liege = {
					government_allows = administrative
				}
			}
			add = 150
		}
		if = {
			limit = {
				scope:liege = {
					highest_held_title_tier >= tier_duchy
				}
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = {
					highest_held_title_tier >= tier_kingdom
				}
			}
			add = 50
		}
        if = {
            limit = {
                exists = scope:firing_court_position
            }
            add = 100
            scope:employee = {
                # Does the liege have a better candidate that they should be hiring instead?
                if = {
                    limit = {
                        scope:highest_available_aptitude > scope:employee_aptitude
                    }
                    add = -75
                }
            }
        }
        if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = antiquarian }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

### Regular Court Positions ### ( Sort order 299 - 200 )
seneschal_court_position = {
	sort_order = 299
	max_available_positions = 1
	skill = stewardship

	court_position_asset = {
		animation = reading
		background = "gfx/interface/illustrations/event_scenes/ep3_medi_estate.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = stewardship
			multiply = 2.5
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_trait = administrator
			}
			add = {
				value = 20
				desc = court_position_administrator_trait
			}
		}
		if = {
			limit = {
				has_trait = overseer
			}
			add = {
				value = 20
				desc = court_position_overseer_trait
			}
		}
		if = {
			limit = {
				has_trait = organizer
			}
			add = {
				value = 20
				desc = court_position_organizer_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:seneschal }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		is_landed_or_landless_administrative = yes
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			seneschal_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = seneschal
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = seneschal } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = seneschal
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = seneschal }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = seneschal }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = seneschal } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = seneschal
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = seneschal }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = seneschal }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
		  	character_capital_county_monthly_control_add = 0.1
		  	courtier_and_guest_opinion = 1
		  	monthly_legitimacy_add = 0.1
		}
		poor = {
		  	character_capital_county_monthly_control_add = 0.15
		  	courtier_and_guest_opinion = 3
		  	monthly_legitimacy_add = 0.2
		}
		average = {
		  	character_capital_county_monthly_control_add = 0.2
		  	courtier_and_guest_opinion = 5
		  	monthly_legitimacy_add = 0.3
		}
		good = {
		  	character_capital_county_monthly_control_add = 0.25
		  	courtier_and_guest_opinion = 7
		  	monthly_legitimacy_add = 0.5
		}
		excellent = {
		  	character_capital_county_monthly_control_add = 0.3
		  	courtier_and_guest_opinion = 10
		  	monthly_legitimacy_add = 0.7
		}
	}

	modifier = {
		general_opinion = 5
		monthly_stewardship_lifestyle_xp_gain_mult = 0.2
	}

	on_court_position_received = {
		seneschal_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		seneschal_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		seneschal_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = seneschal_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
        if = { # Having a seneschal is excellent if you have legitimacy
            limit = {
				scope:liege = {
					has_legitimacy = yes
				}
            }
            add = 200
        }
        if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = seneschal }
			}
			add = 1000
		}
		add = court_position_seneschal_debt_considerations_value
	}
}

court_tutor_court_position = {
	sort_order = 290
	max_available_positions = 1
	skill = learning

	court_position_asset = {
		animation = happy_teacher
		background = "gfx/interface/illustrations/event_scenes/bp2_university.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				diplomacy >= high_skill_rating
				martial >= high_skill_rating
				stewardship >= high_skill_rating
				intrigue >= high_skill_rating
				learning >= high_skill_rating
			}
			add = {
				value = 20
				desc = court_position_high_skills_trait
			}
		}
		if = {
			limit = {
				has_trait = scholar
			}
			add = {
				value = 15
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = patient
			}
			add = {
				value = 15
				desc = court_position_patient_trait
			}
		}
		if = {
			limit = {
				has_trait = calm
			}
			add = {
				value = 15
				desc = court_position_calm_trait
			}
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = {
				value = -10
				desc = court_position_shy_trait
			}
		}
		if = {
			limit = {
				has_trait = intellect_good_3
			}
			add = {
				value = 40
				desc = court_position_intellect_good_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_2
			}
			add = {
				value = 20
				desc = court_position_intellect_good_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_1
			}
			add = {
				value = 10
				desc = court_position_intellect_good_1_trait
			}
		}
		else_if = {
			limit = {
				has_trait = shrewd
			}
			add = {
				value = 10
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				has_trait = reclusive
			}
			add = {
				value = -10
				desc = court_position_reclusive_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		if = {
			limit = {
				has_character_flag = court_0107_tutor
			}
			add = {
				value = 10
				desc = court_position_liege_support
			}
		}
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increased_tutor_aptitude }
				}
			}
			add = {
				value = estate_increased_tutor_aptitude_value
				desc = estate_increased_tutor_aptitude_desc
			}
		}
		if = {
			limit = {
				has_character_flag = court_language_teacher
			}
			add = {
				value = 20
				desc = court_language_teacher_desc
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_tutor }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		# Nomad Yurt
		if = {
			limit = {
				employer.domicile ?= {
					has_domicile_building_or_higher = wet_nurse_yurt_01
				}
			}
			add = {
				value = 0
				if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_court_tutor_aptitude_lvl_4
						}
					}
					add = 32
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_court_tutor_aptitude_lvl_3
						}
					}
					add = 16
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_court_tutor_aptitude_lvl_2
						}
					}
					add = 8
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_court_tutor_aptitude_lvl_1
						}
					}
					add = 4
				}
				desc = wet_nurse_yurt_01_domicile_building
			}
		}
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			domicile ?= {
				has_domicile_parameter = nomad_unlock_court_tutor
			}
		}
		has_ep1_court_positions_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			domicile ?= {
				has_domicile_parameter = nomad_unlock_court_tutor
			}
		}
		trigger_else = {
			is_landed_or_landless_administrative = yes
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			court_tutor_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_tutor
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_tutor } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_tutor
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_tutor }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_tutor }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Reduction bonus for Admin unlocked from the Estate
			if = {
				limit = {
					scope:liege = {
						domicile ?= { has_domicile_parameter = estate_reduced_tutor_cost }
					}
				}
				multiply = {
					value = estate_court_tutor_cost_reduction_value
					desc = estate_reduced_tutor_cost_desc
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_tutor } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_tutor
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_tutor }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_tutor }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			learn_language_scheme_phase_duration_add = -4
		}
		poor = {
			learn_language_scheme_phase_duration_add = -8
		}
		average = {
			learn_language_scheme_phase_duration_add = -12
		}
		good = {
			learn_language_scheme_phase_duration_add = -16
		}
		excellent = {
			learn_language_scheme_phase_duration_add = -20
		}
	}

	custom_employer_modifier_description = court_tutor_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		stewardship = 1
		diplomacy = 1
		child_opinion = -10
		monthly_learning_lifestyle_xp_gain_mult = 0.1
	}

	on_court_position_received = {
		court_tutor_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_tutor_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_tutor_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_tutor_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = {
					OR = {
						AND = {
							exists = primary_heir
							primary_heir = {
								is_adult = no
								is_courtier_of = scope:liege
							}
						}
						any_child = {
							count >= 3
							is_adult = no
							is_courtier_of = scope:liege
						}
					}
				}
				add = 20
			}
			if = {
				limit = {
					has_perk = pedagogy_perk
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_tutor }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

wet_nurse_court_position = { # BP2
	sort_order = 285
	max_available_positions = 1
	skill = learning

	court_position_asset = {
		animation = newborn
		background = "gfx/interface/illustrations/event_scenes/bp2_nursery.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		if = {
			limit = { health >= 5 }
			add = {
				value = health
				multiply = 5
				add = 10
				desc = court_position_skill_health_good
			}
		}
		else_if = {
			limit = { health < 3 }
			add = {
				value = health
				multiply = 10
				add = -30
				desc = court_position_skill_health_low
			}
		}
		else = {
			add = {
				value = health
				multiply = 2
				desc = court_position_skill_health
			}
		}
		if = {
			limit = {
				any_child = { }
			}
			add = {
				value = 15
				desc = court_position_has_child
			}
		}
		if = {
			limit = {
				has_trait = strong
			}
			add = {
				value = 15
				desc = court_position_strong_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_3
			}
			add = {
				value = 20
				desc = court_position_physique_good_3_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_2
			}
			add = {
				value = 15
				desc = court_position_physique_good_2_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_1
			}
			add = {
				value = 10
				desc = court_position_physique_good_1_trait
			}
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = {
				value = 10
				desc = court_position_loyal_trait
			}
		}
		# Nomad Yurt
		if = {
			limit = {
				employer.domicile ?= {
					has_domicile_building_or_higher = wet_nurse_yurt_01
				}
			}
			add = {
				value = 0
				if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_wet_nurse_aptitude_lvl_4
						}
					}
					add = 32
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_wet_nurse_aptitude_lvl_3
						}
					}
					add = 16
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_wet_nurse_aptitude_lvl_2
						}
					}
					add = 8
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_wet_nurse_aptitude_lvl_1
						}
					}
					add = 4
				}
				desc = wet_nurse_yurt_01_domicile_building
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:wet_nurse }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			domicile ?= {
				has_domicile_parameter = nomad_unlock_wet_nurse
			}
		}
		has_bp2_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		OR = {
			any_child = {
				is_adult = no
			}
			is_adult = no
			any_warden_hostage = {
				is_adult = no
			}
		}
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = {
				text = has_wet_nurse_domicile_building
				domicile ?= {
					has_domicile_parameter = nomad_unlock_wet_nurse
				}
			}
		}
		trigger_else = {
			is_landed_or_landless_administrative = yes
		}
	}

	is_shown_character = {
		scope:employee = {
			NOT = { is_close_family_of = scope:liege }
			ek_human_age_equivalent < 46 #EK EDIT
			is_female = yes
			has_no_particular_noble_roots_trigger = yes
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			wet_nurse_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = minor_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = wet_nurse
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = tiny_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = wet_nurse } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = wet_nurse
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = wet_nurse }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = wet_nurse }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = wet_nurse } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = wet_nurse
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = wet_nurse }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = wet_nurse }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	custom_employer_modifier_description = wet_nurse_employer_custom_effect_description

	modifier = {
		diplomacy = 1
		child_opinion = 15
	}

	on_court_position_received = {
		wet_nurse_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		wet_nurse_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		wet_nurse_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = wet_nurse_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Opinion affects how likely they are to be hired
			if = {
				limit = {
					has_relation_lover = scope:employee
				}
				add = 100
			}
			else_if = {
				limit = {
					has_relation_friend = scope:employee
				}
				add = 75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_positive_opinion
					}
				}
				add = 50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_positive_opinion
					}
				}
				add = 25
			}
			if = {
				limit = {
					has_relation_nemesis = scope:employee
				}
				add = -100
			}
			else_if = {
				limit = {
					has_relation_rival = scope:employee
				}
				add = -75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_negative_opinion
					}
				}
				add = -50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_negative_opinion
					}
				}
				add = -25
			}
			if = {
				limit = {
					NOT = { scope:liege.culture ?= scope:employee.culture }
				}
				add = -25
			}
			if = {
				limit = {
					scope:liege.faith != scope:employee.faith
				}
				add = -25
			}
			if = {
				limit = {
					OR = {
						primary_heir ?= {
							is_adult = no
							is_courtier_of = scope:liege
						}
						any_child = {
							count >= 3
							is_adult = no
							is_courtier_of = scope:liege
						}
					}
				}
				add = 20
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = wet_nurse }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

charioteer_court_position = {
	sort_order = 284
	max_available_positions = 1
	skill = prowess

	court_position_asset = {
		animation = wrestling_victory
		background = "gfx/interface/illustrations/event_scenes/ep3_hippodrome_chariot_race.dds"
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep3_dlc_trigger = yes
		highest_held_title_tier > tier_county
		# EK EDIT: we currently don't use these
		always = no
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 10
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = prowess
			multiply = 2.5
			max = 50
			desc = court_position_skill_prowess
		}
		# Charioteer Blue Trait
		if = {
			limit = { has_trait = charioteer_blue }
			if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_blue
						value >= 90
					}
				}
				add = {
					value = 40
					desc = court_position_charioteer_blue_trait
				}
			}
			else_if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_blue
						value >= 40
					}
				}
				add = {
					value = 20
					desc = court_position_charioteer_blue_trait
				}
			}
		}
		# Charioteer Green Trait
		if = {
			limit = { has_trait = charioteer_green }
			if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_green
						value >= 90
					}
				}
				add = {
					value = 40
					desc = court_position_charioteer_green_trait
				}
			}
			else_if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_green
						value >= 40
					}
				}
				add = {
					value = 20
					desc = court_position_charioteer_green_trait
				}
			}
		}
		# Charioteer White Trait
		if = {
			limit = { has_trait = charioteer_white }
			if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_white
						value >= 90
					}
				}
				add = {
					value = 40
					desc = court_position_charioteer_white_trait
				}
			}
			else_if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_white
						value >= 40
					}
				}
				add = {
					value = 20
					desc = court_position_charioteer_white_trait
				}
			}
		}
		# Charioteer Red Trait
		if = {
			limit = { has_trait = charioteer_red }
			if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_red
						value >= 90
					}
				}
				add = {
					value = 40
					desc = court_position_charioteer_red_trait
				}
			}
			else_if = {
				limit = {
					has_trait_xp = {
						trait = charioteer_red
						value >= 40
					}
				}
				add = {
					value = 20
					desc = court_position_charioteer_red_trait
				}
			}
		}

		if = {
			limit = {
				OR = {
					has_trait = education_martial_1
					has_trait = education_martial_2
					has_trait = education_martial_3
					has_trait = education_martial_4
					has_trait = education_martial_5
				}
			}
			add = {
				value = 5
				if = {
					limit = { has_trait = education_martial_2 }
					add = 10
				}
				if = {
					limit = {has_trait = education_martial_3 }
					add =  15
				}
				if = {
					limit = { has_trait = education_martial_4 }
					add = 20
				}
				if = {
					limit = { has_trait = education_martial_5 }
					add = 25
				}
				desc = trait_education_martial_prowess
			}
		}
		
		# Estate - Owner bonus from stables
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_charioteer_aptitude }
				}
			}
			add = {
				value = estate_increase_charioteer_aptitude_value
				desc = estate_increase_charioteer_aptitude_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:charioteer }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}

		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		is_landed_or_landless_administrative = yes
		culture = { has_cultural_parameter = hosts_chariot_races }
	}

	is_shown_character = {
		scope:employee = {
			is_ai = yes
			is_landed = no
			has_no_particular_noble_roots_trigger = yes
			age >= 16
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			charioteer_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = charioteer
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	custom_employer_modifier_description = charioteer_employer_custom_effect_description

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary
			if = {
				limit = {
					scope:liege = {
						exists = dynasty
						dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

						employs_court_position = charioteer_court_position
						any_court_position_holder = {
					        type = charioteer_court_position
							exists = dynasty
							house = prev.house
						}
					}
				}
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			else_if = { # Halved via obligation hook
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = charioteer
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = charioteer }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = charioteer }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = charioteer } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = charioteer
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = charioteer }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = charioteer }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_influence_mult = 0.04
		}
		poor = {
			monthly_influence_mult = 0.08
		}
		average = {
			monthly_influence_mult = 0.12
		}
		good = {
			monthly_influence_mult = 0.16
		}
		excellent = {
			monthly_influence_mult = 0.2
		}
	}

	modifier = {
		attraction_opinion = 10
		charioteer_blue_xp_gain_mult = 0.25
		charioteer_green_xp_gain_mult = 0.25
		charioteer_white_xp_gain_mult = 0.25
		charioteer_red_xp_gain_mult = 0.25
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
		# Assign them to a team
		scope:employee = {
			if = {
				limit = { has_any_charioteer_trait = no }
				random_list = {
					2 = {
						add_trait = charioteer_green
					}
					2 = {
						add_trait = charioteer_blue
					}
					1 = {
						add_trait = charioteer_white
					}
					1 = {
						add_trait = charioteer_red
					}
				}
			}
		}
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = charioteer_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
			#EK DISABLED: no Byzantium
			#if = { # Emperor should always have one
			#	limit = {
			#		has_title = title:e_byzantium
			#	}
			#	add = 100
			#}
			if = { # Most governors should have them
				limit = {
					has_trait = governor
				}
				add = 50
			}
		}
		add = court_position_debt_considerations_value
	}
}

bookmaker_court_position = { # EP3
	sort_order = 283
	max_available_positions = 1
	skill = stewardship

	court_position_asset = {
		animation = throne_room_writer
		background = "gfx/interface/illustrations/event_scenes/ep3_medi_study.dds"
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep3_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
		# EK EDIT: we currently don't use these
		always = no
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 15
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = stewardship
			multiply = 2.5
			max = 50
			desc = court_position_skill_stewardship
		}
		add = {
			value = intrigue
			divide = 2
			desc = court_position_skill_intrigue
		}
		if = {
			limit = {
				OR = {
					has_trait = education_stewardship_1
					has_trait = education_stewardship_2
					has_trait = education_stewardship_3
					has_trait = education_stewardship_4
					has_trait = education_stewardship_5
				}
			}
			add = {
				value = 5
				if = {
					limit = { has_trait = education_stewardship_2 }
					add = 5
				}
				else_if = {
					limit = {has_trait = education_stewardship_3 }
					add = 10
				}
				else_if = {
					limit = { has_trait = education_stewardship_4 }
					add = 15
				}
				else_if = {
					limit = { has_trait = education_stewardship_5 }
					add = 20
				}
				desc = trait_education_stewardship
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:bookmaker }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		culture = { has_cultural_parameter = hosts_chariot_races }
	}

	is_shown_character = {
		scope:employee = {
			is_ai = yes
			is_adult = yes
			is_playable_character = no
			is_landed = no
			has_no_particular_noble_roots_trigger = yes
			age >= 16
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			bookmaker_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = bookmaker
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	# No gold salary. they get paid a precentage of the proceeds from gambling during chariot races
	salary = {
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = bookmaker } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = bookmaker
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = bookmaker }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = bookmaker }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_influence_mult = 0.01
		}
		poor = {
			monthly_influence_mult = 0.02
		}
		average = {
			monthly_influence_mult = 0.03
		}
		good = {
			monthly_influence_mult = 0.04
		}
		excellent = {
			monthly_influence_mult = 0.05
		}
	}

	modifier = {
		monthly_stewardship_lifestyle_xp_gain_mult = 0.1
		monthly_income = 0.2
	}

	custom_employer_modifier_description = bookmaker_employer_custom_effect_description
	
	on_court_position_received = {
		scope:employee = { add_character_flag = was_bookmaker }
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = bookmaker_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 300
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# EK DISABLED
		#	if = { # Emperor should always have one
		#		limit = {
		#			has_title = title:e_byzantium
		#		}
		#		add = 100
		#	}
		}
		add = court_position_debt_considerations_value
	}
}

akolouthos_court_position = { # EP1 & EP3
	sort_order = 282
	max_available_positions = 1

	skill = martial

	court_position_asset = {
		animation = marshal_axe
		background = "gfx/interface/illustrations/event_scenes/ep3_city_gate.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = martial
			multiply = 4
			max = 50
			desc = court_position_skill_martial
		}

		if = {
			limit = {
				has_trait = shieldmaiden
			}
			add = {
				value = 5
				desc = court_position_shieldmaiden_trait
			}
		}
		if = {
			limit = {
				has_trait = gallant
			}
			add = {
				value = 5
				desc = court_position_gallant_trait
			}
		}
		if = {
			limit = {
				has_trait = strong
			}
			add = {
				value = 10
				desc = court_position_strong_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_3
			}
			add = {
				value = 15
				desc = court_position_physique_good_3_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_2
			}
			add = {
				value = 10
				desc = court_position_physique_good_2_trait
			}
		}
		if = {
			limit = {
				has_trait = physique_good_1
			}
			add = {
				value = 5
				desc = court_position_physique_good_1_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 15
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = {
				value = 10
				desc = court_position_loyal_trait
			}
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = 10
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = stubborn
			}
			add = {
				value = 5
				desc = court_position_stubborn_trait
			}
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = 10
				desc = court_position_honest_trait
			}
		}
		if = {
			limit = {
				has_trait = unyielding_defender
			}
			add = {
				value = 10
				desc = court_position_unyielding_defender_trait
			}
		}
		if = {
			limit = {
				has_trait = varangian
			}
			add = {
				value = 10
				desc = court_position_varangian_trait
			}
		}

		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -15
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				has_trait = fickle
			}
			add = {
				value = -10
				desc = court_position_fickle_trait
			}
		}
		if = {
			limit = {
				has_trait = disloyal
			}
			add = {
				value = -25
				desc = court_position_disloyal_trait
			}
		}
		if = {
			limit = {
				has_character_flag = best_knight_position
			}
			add = {
				value = 20
				desc = best_knight_position_desc
			}
		}
		if = {
			limit = {
				has_character_flag = competing_knight_position
				OR = {
					any_court_position_holder = {
						type = bodyguard_court_position
						has_character_flag = competing_knight_position
					}
					any_court_position_holder = {
						type = champion_court_position
						has_character_flag = competing_knight_position
					}
				}
			}
			add = 30
			desc = competing_knight_position_desc
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:akolouthos }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		has_ep3_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	is_shown_character = {
		scope:employee = {
			akolouthos_validity_trigger = { EMPLOYER = scope:liege }
			is_mindless_character = no #EK EDIT
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_empire
		save_temporary_scope_as = root_scope
		# EK DISABLED: not relevant
		# custom_tooltip = {
		# 	text = akolouthos_founded_varangians_trigger_tt
		# 	primary_title = { has_variable = founded_varangian_guard }
		# }
		# EK EDIT: relevant for Cyrodiil, also required the liege to be of a culture that maintains the Legion			
		has_cyrodilic_empire_trigger = yes
		# since the tasks depend on having varangians in court you should also have to hold bastion
		has_title = title:c_bastion
		
		culture = { has_cultural_tradition = tradition_imperial_legacy }
	}

	valid_character = {
		scope:employee = {
			akolouthos_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = akolouthos
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = akolouthos } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = akolouthos
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = akolouthos }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = akolouthos }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = medium_court_position_salary
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			heavy_infantry_toughness_mult = -0.05
		}
		poor = {
			heavy_infantry_toughness_mult = 0
		}
		average = {
			heavy_infantry_toughness_mult = 0.05
		}
		good = {
			heavy_infantry_toughness_mult = 0.1
		}
		excellent = {
			heavy_infantry_toughness_mult = 0.2
		}
	}

	custom_employer_modifier_description = akolouthos_employer_custom_effect_description

	modifier = {
		prowess = 1
		intrigue = 1
		enemy_hostile_scheme_success_chance_max_add = -10
	}

	on_court_position_received = {
		akolouthos_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		akolouthos_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		akolouthos_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = akolouthos_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely if you're scared all the time
			if = {
				limit = {
					has_trait = paranoid
				}
				add = 50
			}
		}
		scope:liege = {
			# More likely if you're scared all the time
			if = {
				limit = {
					number_maa_regiments_of_base_type = {
						type = heavy_infantry
						value >= 5
					}
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = akolouthos }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

chief_eunuch_court_position = {
	sort_order = 281
	max_available_positions = 1
	minimum_rank = duchy # Should only be available for dukes and above
	skill = diplomacy

	court_position_asset = {
		animation = scheme
		background = "gfx/interface/illustrations/event_scenes/throneroom_mediterranean.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = intrigue
			multiply = 2.5
			desc = court_position_skill_intrigue
		}
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -75
				desc = court_position_infirm_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		highest_held_title_tier >= tier_duchy
		save_temporary_scope_as = root_scope
		custom_tooltip = {
			text = can_appoint_chief_eunuch_name_tt
			culture = { # Culture that has eunuchs
				has_cultural_parameter = can_appoint_chief_eunuch
			}
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			liege ?= scope:liege #
			chief_eunuch_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_eunuch
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = tiny_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chief_eunuch } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_eunuch
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chief_eunuch }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chief_eunuch }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chief_eunuch } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_eunuch
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chief_eunuch }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chief_eunuch }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			enemy_hostile_scheme_phase_duration_add = 1
			hostile_scheme_phase_duration_add = -1
		}
		poor = {
			court_grandeur_baseline_add = 1
			enemy_hostile_scheme_phase_duration_add = 2
			hostile_scheme_phase_duration_add = -2
		}
		average = {
			court_grandeur_baseline_add = 1
			enemy_hostile_scheme_phase_duration_add = 4
			hostile_scheme_phase_duration_add = -3
		}
		good = {
			court_grandeur_baseline_add = 2
			enemy_hostile_scheme_phase_duration_add = 8
			hostile_scheme_phase_duration_add = -5
		}
		excellent = {
			court_grandeur_baseline_add = 2
			enemy_hostile_scheme_phase_duration_add = 16
			hostile_scheme_phase_duration_add = -7
		}
	}

	modifier = {
		enemy_hostile_scheme_success_chance_max_add = -10
		monthly_intrigue_lifestyle_xp_gain_mult = 0.2
	}

	on_court_position_received = {
		chief_eunuch_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		chief_eunuch_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		chief_eunuch_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = chief_eunuch_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = chief_eunuch }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

master_of_horse_court_position = {
	sort_order = 280
	max_available_positions = 1
	minimum_rank = duchy # Should only be available for dukes or higher tiers
	skill = martial

	court_position_asset = {
		animation = throne_room_two_handed_passive_1
		background = "gfx/interface/illustrations/event_scenes/courtyard.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = martial
			multiply = 2.5
			max = 50
			desc = court_position_skill_martial
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = calm
			}
			add = {
				value = 15
				desc = court_position_calm_trait
			}
		}
		if = {
			limit = { has_trait = overseer }
			add = {
				value = 15
				desc = court_position_overseer_trait
			}
		}
		if = {
			limit = { has_trait = gallant }
			add = {
				value = 15
				desc = court_position_gallant_trait
			}
		}
		# Estate - Owner bonus from stables
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_master_of_horse_aptitude }
				}
			}
			add = {
				value = estate_increase_master_of_horse_aptitude_value
				desc = estate_increase_master_of_horse_aptitude_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:master_of_horse }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_duchy
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			master_of_horse_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_horse
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_of_horse } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_horse
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_of_horse }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_of_horse }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = master_of_horse_court_position
						any_court_position_holder = {
					        type = master_of_horse_court_position
					        has_character_flag = free_master_of_horse
						}
					}
				}
				multiply = {
					value = 0
					desc = free_court_position
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_of_horse } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_horse
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_of_horse }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_of_horse }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			knight_effectiveness_mult = 0.01
			character_travel_speed_mult = 0.01
		}
		poor = {
			knight_effectiveness_mult = 0.02
			character_travel_speed_mult = 0.02
			knight_limit = 1
		}
		average = {
			knight_effectiveness_mult = 0.03
			character_travel_speed_mult = 0.03
			knight_limit = 2
		}
		good = {
			knight_effectiveness_mult = 0.05
			character_travel_speed_mult = 0.05
			knight_limit = 2
		}
		excellent = {
			knight_effectiveness_mult = 0.08
			character_travel_speed_mult = 0.08
			knight_limit = 3
		}
	}

	modifier = {
		monthly_martial_lifestyle_xp_gain_mult = 0.15
		knight_effectiveness_mult = 0.15
	}

	on_court_position_received = {
		master_of_horse_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		master_of_horse_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		master_of_horse_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = master_of_horse_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = {
			limit = {
				scope:liege = {
					ai_has_warlike_personality = yes
				}
			}
			add = 200
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = master_of_horse }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

master_of_hunt_court_position = {
	sort_order = {
		value = 275
		if = {
			limit = {
				has_mpo_dlc_trigger = yes
				government_has_flag = government_is_nomadic
			}
			add = 100
		}
	}
	max_available_positions = 1
	minimum_rank = county
	skill = prowess

	court_position_asset = {
		trigger = {
			government_has_flag = government_is_nomadic
		}
		animation = hunting_falcon
		background = "gfx/interface/illustrations/event_scenes/ep2_hunt_poachers_camp.dds"
		localization_key = master_of_hunt_court_position_nomadic
	}

	court_position_asset = {
		animation = hunting_shortbow_aim_arrow_default
		background = "gfx/interface/illustrations/event_scenes/ep2_hunt_poachers_camp.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		add = {
			value = learning
			multiply = 1.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 }
			}
			add = {
				value = 40
				desc = court_position_hunter_3_trait
			}
		}
		else_if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 50 }
			}
			add = {
				value = 30
				desc = court_position_hunter_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_hunter }
			add = {
				value = 20
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = { has_trait = brave }
			add = {
				value = 5
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = { has_trait = craven }
			add = {
				value = -10
				desc = court_position_craven_trait
			}
		}
		# Events
		if = {
			limit = {
				has_character_modifier = ep2_beastmaster_modifier
			}
			add = {
				value = 10
				desc = court_position_beastmaster_modifier
			}
		}
		if = {
			limit = {
				has_character_flag = 7600_taking_child_to_hunt
			}
			add = {
				value = 10
				desc = 7600_taking_child_to_hunt
			}
		}
		# Estate - Owner bonus from stables
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_master_of_hunt_aptitude }
				}
			}
			add = {
				value = estate_increase_master_of_hunt_aptitude_value
				desc = estate_increase_master_of_hunt_aptitude_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:master_of_hunt }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			master_of_hunt_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_hunt
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_of_hunt } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_hunt
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_of_hunt }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_of_hunt }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_of_hunt } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_of_hunt
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_of_hunt }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_of_hunt }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			lifestyle_hunter_xp_gain_mult = 0.02
		}
		poor = {
			lifestyle_hunter_xp_gain_mult = 0.05
		}
		average = {
			lifestyle_hunter_xp_gain_mult = 0.08
		}
		good = {
			lifestyle_hunter_xp_gain_mult = 0.14
		}
		excellent = {
			lifestyle_hunter_xp_gain_mult = 0.2
		}
	}

	custom_employer_modifier_description = master_of_hunt_employer_custom_effect_description

	modifier = {
		monthly_martial_lifestyle_xp_gain_mult = 0.1
		lifestyle_hunter_xp_gain_mult = 0.25
	}

	custom_employee_modifier_description = master_of_hunt_employee_custom_effect_description

	on_court_position_received = {
		master_of_hunt_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		master_of_hunt_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		master_of_hunt_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = master_of_hunt_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire if you're a hunter
			if = {
				limit = {
					has_trait = lifestyle_hunter
				}
				add = 25
			}
			if = {
				limit = {
					has_character_flag = hunts_a_lot
				}
				add = 1000
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = master_of_hunt }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

master_assassin_court_position = {
	sort_order = 250
	max_available_positions = 1
	minimum_rank = county

	court_position_asset = {
		animation = assassin
		background = "gfx/interface/illustrations/event_scenes/fp2_corridor_night.dds"
	}


	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = intrigue
			multiply = 1.25
			max = 50
			desc = court_position_skill_intrigue
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				dynasty ?= { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 15
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 10
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = deceitful
			}
			add = {
				value = 10
				desc = court_position_deceitful_trait
			}
		}
		if = {
			limit = {
				has_trait = murderer
			}
			add = {
				value = 20
				desc = court_position_murderer_trait
			}
		}
		if = {
			limit = {
				has_trait = order_member
			}
			add = {
				value = 25
				desc = court_position_order_member_trait
			}
		}
		if = {
			limit = {
				has_trait = faith_warrior
			}
			add = {
				value = 25
				desc = court_position_faith_warrior_trait
			}
		}
		if = {
			limit = {
				has_trait = zealous
			}
			add = {
				value = 25
				desc = court_position_zealous_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 25
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = compassionate
			}
			add = {
				value = -50
				desc = court_position_compassionate_trait
			}
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = -20
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = -20
				desc = court_position_honest_trait
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_traveling_friends_value

		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:master_assassin }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
		# EK EDIT: we don't use the fedayeen tenet so this isn't needed to show
		always = no
	}

	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		faith = {
			has_doctrine = tenet_fp3_fedayeen
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			master_assassin_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_assassin
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_assassin } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_assassin
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_assassin }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_assassin }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = master_assassin } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = master_assassin
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = master_assassin }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = master_assassin }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			hostile_scheme_phase_duration_add = -3
			enemy_hostile_scheme_success_chance_add = -2
		}
		poor = {
			hostile_scheme_phase_duration_add = -6
			enemy_hostile_scheme_success_chance_add = -4
		}
		average = {
			hostile_scheme_phase_duration_add = -9
			enemy_hostile_scheme_success_chance_add = -6
		}
		good = {
			hostile_scheme_phase_duration_add = -12
			enemy_hostile_scheme_success_chance_add = -8
		}
		excellent = {
			hostile_scheme_phase_duration_add = -15
			enemy_hostile_scheme_success_chance_add = -10
		}
	}

	modifier = {
		monthly_intrigue_lifestyle_xp_gain_mult = 0.2
		owned_hostile_scheme_success_chance_add = 10
		max_hostile_schemes_add = 1
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
		scope:employee = {
			# Moves to pool after 1 day
			# Moving them directly here would invalidate the court position too early
			trigger_event = {
				id = courtier_guest_management.0999
				days = 1
			}
		}
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = master_assassin_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire one if you have high dread
			if = {
				limit = {
					dread > medium_dread
				}
				add = 25
			}
			# More likely if you have dread-traits
			if = {
				limit = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = arbitrary
					}
				}
				add = 25
			}
			# More likely if you are a zealous jihadist
			if = {
				limit = {
					has_trait = zealous
				}
				add = 25
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = master_assassin }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

cultural_emissary_court_position = {
	sort_order = {
		value = 249
		if = { # Prio'd down for landless
			limit = {
				is_landed_or_landless_administrative = no
			}
			subtract = 240
		}
	}
	max_available_positions = 1
	minimum_rank = county
	skill = diplomacy

	court_position_asset = {
		animation = personality_compassionate
		background = "gfx/interface/illustrations/event_scenes/fp3_docks.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = num_of_known_languages
			subtract = 1
			multiply = 10
			max = 100
			desc = court_position_languages
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = 15
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 15
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = diplomat
			}
			add = {
				value = 30
				desc = court_position_diplomat_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:cultural_emissary }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		dynasty ?= {
			has_dynasty_perk = ep1_culture_legacy_4
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}
	# Is this a valid position for this character? Also checks the scripted rule "is_eligible_for_court_positions" in code. (root is potential position holder)
	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = cultural_emissary
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 with obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cultural_emissary
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = cultural_emissary } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cultural_emissary
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = cultural_emissary }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = cultural_emissary }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = cultural_emissary } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cultural_emissary
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = cultural_emissary }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = cultural_emissary }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	scaling_employer_modifiers = {
		terrible = {
			different_culture_opinion = 2
			different_faith_opinion = 2
			different_faith_county_opinion_mult = -0.05
		}
		poor = {
			different_culture_opinion = 5
			different_faith_opinion = 5
			different_faith_county_opinion_mult = -0.1
		}
		average = {
			different_culture_opinion = 10
			different_faith_opinion = 10
			different_faith_county_opinion_mult = -0.15
		}
		good = {
			different_culture_opinion = 15
			different_faith_opinion = 15
			different_faith_county_opinion_mult = -0.2
		}
		excellent = {
			different_culture_opinion = 20
			different_faith_opinion = 20
			different_faith_county_opinion_mult = -0.25
		}
	}

	modifier = {
		different_culture_opinion = 10
		different_faith_opinion = 10
		different_faith_county_opinion_mult = -0.2
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = cultural_emissary_court_position
		}
	}
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = cultural_emissary }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

cave_hermit_court_position = {
	sort_order = 248
	max_available_positions = 1
	skill = learning

	court_position_asset = {
		animation = lantern
		background = "gfx/interface/illustrations/event_scenes/ep2_hunt_cave_entrance.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				has_trait = lifestyle_mystic
				has_trait_xp = {
					trait = lifestyle_mystic
					value >= 100
				}
			}
			add = {
				value = 20
				desc = court_position_mystic_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_mystic
				has_trait_xp = {
					trait = lifestyle_mystic
					value >= 50
				}
			}
			add = {
				value = 10
				desc = court_position_mystic_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_mystic
			}
			add = {
				value = 5
				desc = court_position_mystic_1_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 10
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_gardener
			}
			add = {
				value = 10
				desc = court_position_gardener_trait
			}
		}
		#Events
		if = {
			limit = {
				has_character_modifier = possessed_prophetic_visions
			}
			add = {
				value = 30
				desc = possessed_prophetic_visions
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:cave_hermit }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		custom_tooltip = {
			text = cave_hermit_court_position_tt
			has_variable = encountered_recruitable_hermit
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			cave_hermit_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cave_hermit
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			# Update X_salary_tooltip if script_value is changed
			value = minor_court_position_salary #it's cheap to maintain a hermit in a cave
			# Set to 0 with Dynasty Perk Inner Circle

			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = cave_hermit } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cave_hermit
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Set to 50% if you found your hermit around (variable lasts for 5 years)
			if = {
				limit = {
					scope:liege = {
						employs_court_position = cave_hermit_court_position
						any_court_position_holder = {
					        type = cave_hermit_court_position
					        has_variable = found_hermit_mod
						}
					}
				}
				multiply = {
					value = 0
					desc = found_hermit_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = cave_hermit }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = cave_hermit }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			lifestyle_mystic_xp_gain_mult = 0.02
		}
		poor = {
			monthly_prestige = 0.05
			lifestyle_mystic_xp_gain_mult = 0.05
			monthly_learning_lifestyle_xp_gain_mult = 0.02
		}
		average = {
			monthly_prestige = 0.1
			lifestyle_mystic_xp_gain_mult = 0.08
			monthly_learning_lifestyle_xp_gain_mult = 0.04
		}
		good = {
			monthly_prestige = 0.15
			lifestyle_mystic_xp_gain_mult = 0.14
			monthly_learning_lifestyle_xp_gain_mult = 0.06
		}
		excellent = {
			monthly_prestige = 0.2
			lifestyle_mystic_xp_gain_mult = 0.2
			monthly_learning_lifestyle_xp_gain_mult = 0.1
		}
	}

	modifier = {
		general_opinion = 5
		lifestyle_mystic_xp_gain_mult = 0.25
		monthly_learning_lifestyle_xp_gain_mult = 0.1
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = cave_hermit_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = cave_hermit }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

#EK EDIT: changed into Chief Justiciar
chief_qadi_court_position = {
	sort_order = 233
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = learning

	court_position_asset = {
		animation = personality_zealous
		background = "gfx/interface/illustrations/event_scenes/bp2_university_mena.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = generous
			}
			add = {
				value = 15
				desc = court_position_generous_trait
			}
		}
		if = {
			limit = {
				has_trait = just
			}
			add = {
				value = 15
				desc = court_position_just_trait
			}
		}
		if = {
			limit = {
				has_trait = temperate
			}
			add = {
				value = 15
				desc = court_position_temperate_trait
			}
		}
		if = {
			limit = {
				has_trait = scholar
			}
			add = {
				value = 15
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = greedy
			}
			add = {
				value = -10
				desc = court_position_greedy_trait
			}
		}
		if = {
			limit = {
				has_trait = arbitrary
			}
			add = {
				value = -10
				desc = court_position_arbitrary_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:chief_qadi }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		#EK EDIT: we changed qadi into Justiciar
		#has_religion = religion:islam_religion
		custom_tooltip = {
			text = court_chief_qadi_requirement.tt
			uses_praxis_mechanics = yes
		}
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			chief_qadi_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_qadi
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chief_qadi } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_qadi
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chief_qadi }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chief_qadi }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chief_qadi } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chief_qadi
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chief_qadi }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chief_qadi }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	base_employer_modifier = {
	}

	scaling_employer_modifiers = {
		terrible = {
			monthly_piety_gain_mult = 0.02
		}
		poor = {
			monthly_piety_gain_mult = 0.04
		}
		average = {
			monthly_piety_gain_mult = 0.06
			stewardship = 1
		}
		good = {
			monthly_piety_gain_mult = 0.08
			stewardship = 2
		}
		excellent = {
			monthly_piety_gain_mult = 0.1
			stewardship = 3
		}
	}

	modifier = {
		monthly_learning_lifestyle_xp_gain_mult = 0.1
		stewardship = 1
		monthly_piety_gain_mult = 0.1
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes #chief_qadi_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes #chief_qadi_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes #chief_qadi_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = chief_qadi_court_position
		}
	}
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = {
					ai_zeal >= -25
				}
				add = 150
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = chief_qadi }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_gardener_court_position = {
	sort_order = 232
	max_available_positions = 1
	minimum_rank = county
	skill = stewardship

	court_position_asset = {
		animation = admiration
		background = "gfx/interface/illustrations/event_scenes/garden.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	aptitude_level_breakpoints = { 20 40 60 80 }

	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = stewardship
			multiply = 2.5
			max = 60
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_trait = lifestyle_gardener
			}
			add = {
				value = 20
				desc = court_position_gardener_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 10
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = patient
			}
			add = {
				value = 10
				desc = court_position_patient_trait
			}
		}
		if = { # Architect gives a tiny bonus, since building stuff is also a part of gardening
			limit = {
				has_trait = architect
			}
			add = {
				value = 5
				desc = court_position_architect_trait
			}
		}
		if = {
			limit = {
				scope:liege ?= {
					domicile ?= {
						has_domicile_parameter = increased_gardener_aptitude_1
					}
				}
			}
			add = {
				value = estate_increase_gardener_aptitude_value_1
				desc = estate_garden_building
			}
		}
		else_if = {
			limit = {
				scope:liege ?= {
					domicile ?= {
						has_domicile_parameter = increased_gardener_aptitude_2
					}
				}
			}
			add = {
				value = estate_increase_gardener_aptitude_value_2
				desc = estate_garden_building
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: new parameter
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_gardeners }
			}
			add = {
				value = 20
				desc = court_position_tradition_gardening
			}
		}
		# EK ADDITION END
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		is_landed_or_landless_administrative = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		culture = { has_cultural_parameter = can_appoint_court_gardener }
	}

	valid_character = {
		scope:employee = {
			court_gardener_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_gardener
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_gardener } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_gardener
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_gardener }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_gardener }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_gardener } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_gardener
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_gardener }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_gardener }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	base_employer_modifier = {
		courtier_and_guest_opinion = 10
	}

	scaling_employer_modifiers = {
		terrible = {
			character_capital_county_monthly_development_growth_add = 0.05
		}
		poor = {
			character_capital_county_monthly_development_growth_add = 0.1
		}
		average = {
			character_capital_county_monthly_development_growth_add = 0.2
		}
		good = {
			character_capital_county_monthly_development_growth_add = 0.35
		}
		excellent = {
			character_capital_county_monthly_development_growth_add = 0.5
		}
	}

	modifier = {
		monthly_stewardship_lifestyle_xp_gain_mult = 0.1
		character_capital_county_monthly_development_growth_add = 0.02
		stress_gain_mult = -0.25
	}

	on_court_position_received = {
		court_gardener_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_gardener_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_gardener_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_gardener_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_gardener }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_scholar_court_position = { # FP3
	sort_order = 231
	max_available_positions = 1
	minimum_rank = kingdom

	court_position_asset = {
		animation = page_flipping
		background = "gfx/interface/illustrations/event_scenes/fp2_relaxing_room.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 0
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 4
			desc = court_position_skill_learning
			max = 65
		}
		if = {
			limit = {
				scope:liege.dynasty ?= { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = { has_trait = theologian }
			add = {
				value = 15
				desc = court_position_theologian_trait
			}
		}
		if = {
			limit = { has_trait = scholar }
			add = {
				value = 15
				desc = court_position_scholar_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_physician
				has_trait_xp = {
					trait = lifestyle_physician
					value >= 100
				}
			}
			add = {
				value = 15
				desc = court_position_physician_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_physician
				has_trait_xp = {
					trait = lifestyle_physician
					value >= 50
				}
			}
			add = {
				value = 10
				desc = court_position_physician_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_physician }
			add = {
				value = 5
				desc = court_position_physician_1_trait
			}
		}
		if = {
			limit = {
				has_trait = intellect_good_3
			}
			add = {
				value = 20
				desc = court_position_intellect_good_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_2
			}
			add = {
				value = 15
				desc = court_position_intellect_good_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = intellect_good_1
			}
			add = {
				value = 10
				desc = court_position_intellect_good_1_trait
			}
		}
		else_if = {
			limit = {
				has_trait = shrewd
			}
			add = {
				value = 10
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				scope:liege.culture ?= {
					has_innovation = fp3_innovation_mural_sextant
				}
			}
			add = {
				value = 10
				desc = court_position_innovation_mural_sextant
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_scholar }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_fp3_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Only Kingdoms+ can attract prominent enough scholars
	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_kingdom
		culture = { has_cultural_tradition = tradition_fp3_beacon_of_learning }
	}

	valid_character = {
		scope:employee = {
			court_scholar_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_scholar
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_scholar } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_scholar
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_scholar }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_scholar }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_scholar } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_scholar
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_scholar }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_scholar }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			cultural_head_fascination_mult = 0.02
		}
		poor = {
			cultural_head_fascination_mult = 0.04
		}
		average = {
			learning = 1
			cultural_head_fascination_mult = 0.06
		}
		good = {
			learning = 2
			cultural_head_fascination_mult = 0.08
		}
		excellent = {
			learning = 3
			cultural_head_fascination_mult = 0.10
		}
	}

	# custom_employer_modifier_description = court_scholar_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		general_opinion = 5
		monthly_learning_lifestyle_xp_gain_mult = 0.2
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_scholar_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			if = {
				limit = { has_trait = scholar }
				add = 25
			}
			if = {
				limit = { has_education_learning_trigger = yes }
				add = 50
			}
			if = {
				limit = {
					has_lifestyle = learning_lifestyle
				}
				add = 100
			}
		}
		if = {
			limit = {
				exists = scope:firing_court_position
			}
			add = 100
			scope:employee = {
				# Does the liege have a better candidate that they should be hiring instead?
				if = {
					limit = {
						scope:highest_available_aptitude > scope:employee_aptitude
					}
					add = -75
 				}
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_scholar }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

chronicler_court_position = { # CE1
	sort_order = 230
	max_available_positions = 1
	skill = diplomacy

	court_position_asset = {
		trigger = {
			OR = {
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_tribal
			}
		}
		animation = storyteller
		background = "gfx/interface/illustrations/event_scenes/throneroom_west.dds"
		localization_key = chronicler_court_position_nomadic_tribal
	}

	court_position_asset = {
		animation = writing
		background = "gfx/interface/illustrations/event_scenes/throneroom_west.dds"
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			domicile ?= {
				has_domicile_building_or_higher = court_yurt_01
			}
		}
		has_dlc_feature = legends
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = learning
			multiply = 1
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				has_trait = poet
			}
			add = {
				value = 15
				desc = court_position_poet_trait
			}
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 15
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = diplomat
			}
			add = {
				value = 30
				desc = court_position_diplomat_trait
			}
		}
		#Events
		if = {
			limit = {
				has_character_modifier = possessed_prophetic_visions
			}
			add = {
				value = 30
				desc = possessed_prophetic_visions
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:chronicler }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	valid_position = {
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			domicile ?= {
				has_domicile_building_or_higher = court_yurt_01
			}
		}
		trigger_else = {
			is_landed_or_landless_administrative = yes
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			chronicler_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chronicler
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chronicler } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chronicler
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chronicler }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chronicler }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = chronicler } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = chronicler
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = chronicler }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = chronicler }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			legitimacy_loss_mult = -0.05
			monthly_dynasty_prestige = 0.01
		}
		poor = {
			legitimacy_loss_mult = -0.10
			monthly_dynasty_prestige = 0.02
		}
		average = {
			legitimacy_loss_mult = -0.15
			monthly_dynasty_prestige = 0.04
		}
		good = {
			legitimacy_loss_mult = -0.20
			monthly_dynasty_prestige = 0.07
		}
		excellent = {
			legitimacy_loss_mult = -0.25
			monthly_dynasty_prestige = 0.1
		}
	}


	modifier = {
		monthly_diplomacy_lifestyle_xp_gain_mult = 0.1
		monthly_prestige = 0.25
		general_opinion = 5
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = chronicler_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = chronicler }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

champion_court_position = { # EP1
	sort_order = 215
	max_available_positions = 1
	skill = prowess

	court_position_asset = {
		animation = marshal_shield
		background = "gfx/interface/illustrations/event_scenes/ep2_tournament_western.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = prowess
			multiply = 4
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 30
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 15
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = shieldmaiden
			}
			add = {
				value = 20
				desc = court_position_shieldmaiden_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 20
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -10
				desc = court_position_craven_trait
			}
		}
		if = {
			limit = {
				has_trait = maimed
			}
			add = {
				value = -50
				desc = court_position_maimed_trait
			}
		}
		if = {
			limit = {
				has_trait = wounded_3
			}
			add = {
				value = -50
				desc = court_position_wounded_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = wounded_2
			}
			add = {
				value = -25
				desc = court_position_wounded_2_trait
			}
		}
		#Wounded_1 is ok since it's not a serious injury... yet
		if = {
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		if = {
			limit = {
				has_trait = infirm
			}
			add = {
				value = -75
				desc = court_position_infirm_trait
			}
		}
		if = {
			limit = {
				has_character_flag = best_knight_position
			}
			add = {
				value = 20
				desc = best_knight_position_desc
			}
		}
		if = {
			limit = {
				has_character_flag = competing_knight_position
				OR = {
					any_court_position_holder = {
						type = bodyguard_court_position
						has_character_flag = competing_knight_position
					}
					any_court_position_holder = {
						type = akolouthos_court_position
						has_character_flag = competing_knight_position
					}
				}
			}
			add = 30
			desc = competing_knight_position_desc
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			champion_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = champion
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = champion } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = champion
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = champion }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = champion }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_prestige = 0.02
			dread_decay_mult = -0.02
		}
		poor = {
			monthly_prestige = 0.05
			dread_decay_mult = -0.05
		}
		average = {
			monthly_prestige = 0.1
			dread_decay_mult = -0.1
		}
		good = {
			monthly_prestige = 0.2
			dread_decay_mult = -0.2
		}
		excellent = {
			monthly_prestige = 0.3
			dread_decay_mult = -0.3
		}
	}

	custom_employer_modifier_description = champion_employer_custom_effect_description

	modifier = {
		monthly_prestige = 0.25
		attraction_opinion = 10
		tourney_participant_xp_gain_mult = 0.25
		lifestyle_blademaster_xp_gain_mult = 0.25
	}

	on_court_position_received = {
		champion_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		champion_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		champion_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = champion_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 25
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value

		scope:liege = {
			# More likely to hire one if you can't fight yourself
			if = {
				limit = {
					NOT = { can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege } }
				}
				add = 50
			}
			# Less likely to hire one if you have high prowess
			if = {
				limit = {
					prowess >= high_skill_rating
				}
				add = -25
			}
			else_if = {
				limit = {
					prowess >= medium_skill_rating
				}
				add = -10
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = champion }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_brewmaster_court_position = {
	sort_order = 210
	max_available_positions = 1
	minimum_rank = county
	skill = learning

	court_position_asset = {
		animation = wedding_drunk
		background = "gfx/interface/illustrations/event_scenes/bp1_wine_cellar.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}

		# Positive Traits
		if = {
			limit = {
				has_trait = diligent
			}
			add = {
				value = 15
				desc = court_position_diligent_trait
			}
		}
		if = {
			limit = {
				has_trait = patient
			}
			add = {
				value = 15
				desc = court_position_patient_trait
			}
		}
		if = {
			limit = {
				has_trait = humble
			}
			add = {
				value = 15
				desc = court_position_humble_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_reveler
			}
			add = {
				value = 15
				desc = court_position_reveler_trait
			}
		}
		# Negative Traits
		if = {
			limit = {
				has_trait = impatient
			}
			add = {
				value = -10
				desc = court_position_impatient_trait
			}
		}
		if = {
			limit = {
				has_trait = lazy
			}
			add = {
				value = -10
				desc = court_position_lazy_trait
			}
		}

		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_brewmaster }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		custom_tooltip = {
			text = court_brewmaster_requirement_tt
			any_sub_realm_barony = {
				county.holder = root
				title_province = { has_building_or_higher = breweries_01 }
			}
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			liege = scope:liege # To ensure invalidation if they leave court
			court_brewmaster_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_brewmaster
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_brewmaster } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_brewmaster
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_brewmaster }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_brewmaster }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = 0
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_brewmaster } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_brewmaster
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_brewmaster }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_brewmaster }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			county_opinion_add = 1
		}
		poor = {
			county_opinion_add = 2
		}
		average = {
			county_opinion_add = 3
		}
		good = {
			county_opinion_add = 6
		}
		excellent = {
			county_opinion_add = 10
		}
	}

	custom_employer_modifier_description = court_brewmaster_employer_custom_effect_description

	modifier = {
		general_opinion = 5
		monthly_prestige = 0.25
		learning = 1
	}

	on_court_position_received = {
		court_brewmaster_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_brewmaster_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_brewmaster_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_brewmaster_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_brewmaster }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

lady_in_waiting_court_position = { # EP1
	sort_order = 205
	max_available_positions = 2
	minimum_rank = duchy # Should only be available for dukes or higher tiers
	skill = diplomacy

	court_position_asset = {
		animation = throne_room_conversation_1
		background = "gfx/interface/illustrations/event_scenes/bedchamber.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 40
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = 10
				desc = court_position_honest_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:lady_in_waiting }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_duchy
		is_female = yes
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			lady_in_waiting_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = lady_in_waiting
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = tiny_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = lady_in_waiting } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = lady_in_waiting
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = lady_in_waiting }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = lady_in_waiting }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = lady_in_waiting } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = lady_in_waiting
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = lady_in_waiting }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = lady_in_waiting }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			stress_loss_mult = 0.10
			enemy_hostile_scheme_phase_duration_add = 1
		}
		poor = {
			stress_loss_mult = 0.15
			enemy_hostile_scheme_phase_duration_add = 2
		}
		average = {
			stress_loss_mult = 0.15
			enemy_hostile_scheme_phase_duration_add = 5
		}
		good = {
			stress_loss_mult = 0.15
			enemy_hostile_scheme_phase_duration_add = 7
		}
		excellent = {
			stress_loss_mult = 0.20
			enemy_hostile_scheme_phase_duration_add = 10
		}
	}

	modifier = {
		monthly_diplomacy_lifestyle_xp_gain_mult = 0.1
		liege_opinion = 25
		enemy_hostile_scheme_success_chance_max_add = -10
	}

	on_court_position_received = {
		lady_in_waiting_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		lady_in_waiting_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		lady_in_waiting_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = lady_in_waiting_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Opinion affects how likely they are to be hired
			if = {
				limit = {
					has_relation_lover = scope:employee
				}
				add = 100
			}
			else_if = {
				limit = {
					has_relation_friend = scope:employee
				}
				add = 75
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= high_positive_opinion
					}
				}
				add = 50
			}
			else_if = {
				limit = {
					opinion = {
						target = scope:employee
						value >= medium_positive_opinion
					}
				}
				add = 25
			}

			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = lady_in_waiting_court_position
				}
				add = -50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = lady_in_waiting }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

### Kingdom Tier Court Positions ### ( Sort order 199 - 100 )
royal_architect_court_position = { # EP1
	sort_order = 199
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = stewardship

	court_position_asset = {
		animation = survey
		background = "gfx/interface/illustrations/event_scenes/market_west.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = stewardship
			multiply = 2.5
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp3_khvarenah_legacy_1 }
			}
			add = {
				value = 10
				desc =  court_position_khvarenah_legacy_1
			}
		}
		if = {
			limit = {
				has_trait = architect
			}
			add = {
				value = 40
				desc = court_position_architect_trait
			}
		}
		if = { #Hard to design building if you can't see them
			limit = {
				has_trait = blind
			}
			add = {
				value = -50
				desc = court_position_blind_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:royal_architect }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: new parameter #Cultural Tradition that improves the aptitude of characters of that culture
		if = { 
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_architects }
			}
			add = {
				value = 20
				desc = court_position_tradition_architect
			}
		}
		# EK ADDITION END
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			royal_architect_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = royal_architect
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = royal_architect } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = royal_architect
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#Reduce salary for employing green architect from travel_events.2028
			if = {
				limit = {
					scope:liege = {
						employs_court_position = royal_architect_court_position
						any_court_position_holder = {
					        type = royal_architect_court_position
					        has_variable = trainee_salary
						}
					}
				}
				multiply = {
					value = 0.5
					desc = trainee_salary_mod
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = royal_architect }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = royal_architect }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = royal_architect } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = royal_architect
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = royal_architect }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = royal_architect }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			build_speed = -0.05
			domicile_build_speed = -0.05
			holding_build_speed = -0.02
		}
		poor = {
			build_speed = -0.1
			domicile_build_speed = -0.1
			holding_build_speed = -0.04
		}
		average = {
			build_speed = -0.15
			domicile_build_speed = -0.15
			holding_build_speed = -0.08
		}
		good = {
			build_speed = -0.2
			domicile_build_speed = -0.2
			holding_build_speed = -0.12
		}
		excellent = {
			build_speed = -0.3
			domicile_build_speed = -0.3
			holding_build_speed = -0.2
		}
	}

	modifier = {
		build_speed = -0.15
		build_gold_cost = -0.15
		monthly_stewardship_lifestyle_xp_gain_mult = 0.1
	}

	on_court_position_received = {
		royal_architect_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		royal_architect_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		royal_architect_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = royal_architect_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Unless you have lots of gold to spend on buildings, there's no point
			if = {
				limit = {
					short_term_gold < 500
					monthly_character_income < monthly_character_expenses_plus_fourty_percent
				}
				add = -100
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = royal_architect }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

high_almoner_court_position = {
	sort_order = 190
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = learning

	court_position_asset = {
		animation = prayer
		background = "gfx/interface/illustrations/event_scenes/temple.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = learning
			multiply = 2.5
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				is_clergy = yes
			}
			add = {
				value = 20
				desc = court_position_clergy_trait
			}
		}
		if = {
			limit = {
				has_trait = generous
			}
			add = {
				value = 20
				desc = court_position_generous_trait
			}
		}
		if = {
			limit = {
				has_trait = theologian
			}
			add = {
				value = 20
				desc = court_position_theologian_trait
			}
		}
		if = {
			limit = {
				has_trait = compassionate
			}
			add = {
				value = 20
				desc = court_position_compassionate_trait
			}
		}
		if = {
			limit = {
				has_trait = greedy
			}
			add = {
				value = -10
				desc = court_position_greedy_trait
			}
		}
		if = {
			limit = {
				has_trait = profligate
			}
			add = {
				value = -10
				desc = court_position_profligate_trait
			}
		}
		if = {
			limit = {
				has_trait = avaricious
			}
			add = {
				value = -10
				desc = court_position_avaricious_trait
			}
		}
		if = {
			limit = {
				has_trait = devoted
				culture = { has_cultural_parameter = devoted_trait_bonuses }
			}
			add = {
				value = 20
				desc = tradition_monastic_communities_name
			}
		}
		if = {
			limit = {
				has_character_flag = plenty_to_donate_almoner
			}
			add = {
				value = 30
				desc = plenty_to_donate_almoner_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:high_almoner }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			high_almoner_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = high_almoner
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = high_almoner } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = high_almoner
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = high_almoner }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = high_almoner }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			monthly_piety_gain_mult = 0.02
		}
		poor = {
			monthly_piety_gain_mult = 0.05
		}
		average = {
			monthly_piety_gain_mult = 0.10
		}
		good = {
			monthly_piety_gain_mult = 0.15
		}
		excellent = {
			monthly_piety_gain_mult = 0.2
		}
	}

	modifier = {
		monthly_piety = 0.1
		monthly_piety_gain_mult = 0.1
		monthly_learning_lifestyle_xp_gain_mult = 0.1
	}

	on_court_position_received = {
		high_almoner_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		high_almoner_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		high_almoner_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = high_almoner_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Zealous AI's like this
			if = {
				limit = {
					ai_zeal > 75
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = high_almoner }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_poet_court_position = { # EP1
	sort_order = 180
	max_available_positions = 1
	minimum_rank = duchy # Usually available only to kings++, but at times available to dukes
	skill = diplomacy

	court_position_asset = {
		trigger = {
			root.culture ?= {
				# EK EDIT: replaced with something more appropriate for EK
				#has_cultural_pillar = heritage_north_germanic
				has_cultural_tradition = tradition_bards
			}
		}
		animation = storyteller
		background = "gfx/interface/illustrations/event_scenes/tavern.dds"
		localization_key = court_poet_skald
	}

	court_position_asset = {
		animation = storyteller
		background = "gfx/interface/illustrations/event_scenes/tavern.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		add = {
			value = learning
			multiply = 1
			max = 50
			desc = court_position_skill_learning
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 15
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_reveler
			}
			add = {
				value = 15
				desc = court_position_reveler_1_trait
			}
		}
		if = {
			limit = {
				has_trait = diplomat
			}
			add = {
				value = 15
				desc = court_position_diplomat_trait
			}
		}
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				NOT = {
					has_trait = poet
				}
			}
			add = {
				value = -20
				desc = court_position_no_poet_trait
			}
		}
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_poets }
			}
			add = {
				value = 20
				desc = court_position_tradition_poetry
			}
		}
		#Events
		if = {
			limit = {
				has_character_modifier = possessed_prophetic_visions
			}
			add = {
				value = 30
				desc = possessed_prophetic_visions
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_poet }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: Being a member of the House of Reveries improves the aptitude
		if = {
			limit = {
				has_trait = house_of_reveries
			}
			add = {
				value = 20
				desc = court_position_house_of_reveries
			}
		}
		# EK ADDITION END
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		has_ep1_court_positions_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
				root.culture ?= {
					has_cultural_parameter = better_court_poets
				}
			}
			OR = {
				has_realm_law = nomadic_authority_5
				has_realm_law = nomadic_authority_4
				has_realm_law = nomadic_authority_3
				has_realm_law = nomadic_authority_2
			}
		}
		trigger_else_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			OR = {
				has_realm_law = nomadic_authority_5
				has_realm_law = nomadic_authority_4
				has_realm_law = nomadic_authority_3
			}
		}
		trigger_else_if = {
			limit = {
				root.culture ?= {
					has_cultural_parameter = better_court_poets
				}
			}
			highest_held_title_tier >= tier_duchy
		}
		trigger_else = {
			highest_held_title_tier >= tier_kingdom
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			court_poet_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_poet
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_poet } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_poet
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_poet }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_poet }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_poet } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_poet
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_poet }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_poet }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Free if you have the cultural tradition to increase prestige (so you don't have a cost and a gain at the same time)
			if = {
				limit = {
					scope:liege.culture ?= { has_cultural_parameter = better_court_poets }
				}
				multiply = {
					value = 0
					desc = court_position_poets_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			stress_loss_mult = 0.01
			court_grandeur_baseline_add = 1
		}
		poor = {
			stress_loss_mult = 0.025
			court_grandeur_baseline_add = 1
		}
		average = {
			stress_loss_mult = 0.05
			court_grandeur_baseline_add = 2
		}
		good = {
			stress_loss_mult = 0.075
			court_grandeur_baseline_add = 2
		}
		excellent = {
			stress_loss_mult = 0.1
			court_grandeur_baseline_add = 3
		}
	}

	custom_employer_modifier_description = court_poet_employer_custom_effect_description

	modifier = {
		stress_gain_mult = -0.25
		monthly_diplomacy_lifestyle_xp_gain_mult = 0.1
		general_opinion = 5
	}

	culture_modifier = {
		parameter = better_court_poets
		monthly_prestige = 0.25
	}

	on_court_position_received = {
		court_poet_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_poet_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_poet_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_poet_court_position
		}
	}

	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value
		scope:liege = {
			# More likely for very generous characters
			if = {
				limit = {
					ai_greed <= -75
				}
				add = 25
			}
			# Lots of gold to spend on inspirations!
			if = {
				limit = {
					gold >= 500
					monthly_character_income > monthly_character_expenses_plus_fourty_percent
				}
				add = 50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_poet }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_musician_court_position = {
	sort_order = 175
	max_available_positions = 1
	minimum_rank = duchy # Usually available only to kings++, but at times available to dukes
	skill = diplomacy

	court_position_asset = {
		animation = lute_active
		background = "gfx/interface/illustrations/event_scenes/bp1_relaxing_room_western.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 30
				desc = court_position_gregarious_trait
			}
		}
		if = { #Being a poet helps a little bit
			limit = {
				has_trait = poet
			}
			add = {
				value = 10
				desc = court_position_poet_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_reveler
			}
			add = {
				value = 15
				desc = court_position_reveler_1_trait
			}
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = {
				value = -10
				desc = court_position_shy_trait
			}
		}
		if = { #Cultural Tradition that improves the aptitude of characters of that culture
			limit = {
				culture = { has_cultural_parameter = characters_are_better_court_musicians }
			}
			add = {
				value = 20
				desc = court_position_tradition_music_theory
			}
		}
		#Events
		if = {
			limit = {
				has_character_modifier = possessed_prophetic_visions
			}
			add = {
				value = 30
				desc = possessed_prophetic_visions
			}
		}
		if = {
			limit = {
				has_trait = beardless_eunuch
			}
			add = {
				value = 10
				desc = court_position_eunuch_falsetto
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_traveling_friends_value

		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_musician }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: Being a member of the House of Reveries improves the aptitude
		if = {
			limit = {
				has_trait = house_of_reveries
			}
			add = {
				value = 20
				desc = court_position_house_of_reveries
			}
		}
		# EK ADDITION END
	}

	is_shown = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
				root.culture ?= {
					has_cultural_parameter = better_court_musicians
				}
			}
			OR = {
				has_realm_law = nomadic_authority_5
				has_realm_law = nomadic_authority_4
				has_realm_law = nomadic_authority_3
				has_realm_law = nomadic_authority_2
			}
		}
		trigger_else_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			OR = {
				has_realm_law = nomadic_authority_5
				has_realm_law = nomadic_authority_4
				has_realm_law = nomadic_authority_3
			}
		}
		trigger_else_if = {
			limit = {
				root.culture ?= {
					has_cultural_parameter = better_court_musicians
				}
			}
			highest_held_title_tier >= tier_duchy
		}
		trigger_else = {
			highest_held_title_tier >= tier_kingdom
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			court_musician_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_musician
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_musician } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_musician
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_musician }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_musician }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_musician } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_musician
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_musician }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_musician }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Free if you have the cultural tradition to increase prestige (so you don't have a cost and a gain at the same time)
			if = {
				limit = {
					scope:liege.culture ?= { has_cultural_parameter = better_court_musicians }
				}
				multiply = {
					value = 0
					desc = court_position_poets_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			stress_loss_mult = 0.01
			court_grandeur_baseline_add = 1
		}
		poor = {
			stress_loss_mult = 0.025
			court_grandeur_baseline_add = 1
		}
		average = {
			stress_loss_mult = 0.05
			court_grandeur_baseline_add = 2
		}
		good = {
			stress_loss_mult = 0.075
			court_grandeur_baseline_add = 2
		}
		excellent = {
			stress_loss_mult = 0.1
			court_grandeur_baseline_add = 3
		}
	}

	custom_employer_modifier_description = court_musician_employer_custom_effect_description

	modifier = {
		stress_gain_mult = -0.25
		monthly_diplomacy_lifestyle_xp_gain_mult = 0.1
		general_opinion = 5
	}

	culture_modifier = {
		parameter = better_court_musicians
		monthly_prestige = 0.25
	}

	on_court_position_received = {
		court_musician_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_musician_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_musician_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_musician_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		scope:employee = {
			# Does the liege have a better candidate that they should be hiring instead?
			if = {
				limit = {
					scope:highest_available_aptitude > scope:employee_aptitude
				}
				add = -125
			}
			# More likely to pick a courtier with a high aptitude, less likely to pick one with low
			add = {
				value = scope:employee_aptitude
				multiply = 4
			}
		}

		add = scope:base_value
		add = court_position_candidate_score_base_value

		 if = { # Having a musician is good if you have legitimacy
            limit = {
				scope:liege = {
					has_legitimacy = yes
				}
            }
            add = 50
        }

		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_musician }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

cupbearer_court_position = {
	sort_order = 170
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = diplomacy

	court_position_asset = {
		animation = toast_goblet
		background = "gfx/interface/illustrations/event_scenes/councilchamber.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 25
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = {
				value = 15
				desc = court_position_honest_trait
			}
		}
		if = {
			limit = {
				has_trait = trusting
			}
			add = {
				value = 15
				desc = court_position_trusting_trait
			}
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = {
				value = 15
				desc = court_position_loyal_trait
			}
		}
		if = {
			limit = {
				has_trait = deceitful
			}
			add = {
				value = -10
				desc = court_position_deceitful_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:cupbearer }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		highest_held_title_tier >= tier_kingdom
		is_landed_or_landless_administrative = yes
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			cupbearer_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = cupbearer
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = {
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		prestige = major_court_position_prestige_salary
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 1
		}
		poor = {
			court_grandeur_baseline_add = 2
		}
		average = {
			court_grandeur_baseline_add = 2
		}
		good = {
			court_grandeur_baseline_add = 3
		}
		excellent = {
			court_grandeur_baseline_add = 3
		}
	}

	custom_employer_modifier_description = cupbearer_employer_custom_effect_description

	modifier = {
		monthly_diplomacy_lifestyle_xp_gain_mult = 0.1
		monthly_prestige = 0.25
	}

	on_court_position_received = {
		cupbearer_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		cupbearer_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		cupbearer_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_musician_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = cupbearer }
			}
			add = 1000
		}
	}
}

food_taster_court_position = { # EP1
	sort_order = 165
	max_available_positions = 1
	minimum_rank = duchy # Usually available only to kings++, but at times available to dukes
	skill = intrigue

	court_position_asset = {
		animation = drink
		background = "gfx/interface/illustrations/event_scenes/bp1_kitchen_western.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 10
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = intrigue
			multiply = 3
			max = 50
			desc = court_position_skill_intrigue
		}
		if = {
			limit = {
				has_trait = gluttonous
			}
			add = {
				value = 25
				desc = court_position_gluttonous_trait
			}
		}
		if = {
			limit = {
				has_trait = comfort_eater
			}
			add = {
				value = 15
				desc = court_position_comfort_eater_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_herbalist
			}
			add = {
				value = 25
				desc = court_position_herbalist_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_gardener
			}
			add = {
				value = 15
				desc = court_position_gardener_trait
			}
		}
		if = {
			limit = {
				has_trait = trusting
			}
			add = {
				value = 15
				desc = court_position_trusting_trait
			}
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = {
				value = 15
				desc = court_position_loyal_trait
			}
		}
		if = {
			limit = {
				has_trait = inappetetic
			}
			add = {
				value = -50
				desc = court_position_inappetetic_trait
			}
		}
		if = {
			limit = {
				culture = { has_cultural_parameter = characters_are_better_food_tasters }
			}
			add = {
				value = 20
				desc = court_position_tradition_culinary_art
			}
		}
		if = {
			limit = {
				has_character_flag = food_taster_mettle_tested
			}
			add = {
				value = 30
				desc = food_taster_mettle_tested_desc
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:food_taster }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		trigger_if = {
			limit = {
				root.culture ?= {
					has_cultural_parameter = better_food_tasters
				}
			}
			highest_held_title_tier >= tier_duchy
		}
		trigger_else = {
			highest_held_title_tier >= tier_kingdom
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = scope:liege }
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			food_taster_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = food_taster
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = food_taster } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = food_taster
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = food_taster }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = food_taster }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = food_taster } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = food_taster
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = food_taster }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = food_taster }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Free if you have the cultural tradition to increase prestige (so you don't have a cost and a gain at the same time)
			if = {
				limit = {
					scope:liege.culture ?= { has_cultural_parameter = better_food_tasters }
				}
				multiply = {
					value = 0
					desc = court_position_food_tasters_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 1
		}
		poor = {
			enemy_hostile_scheme_success_chance_add = -2
			court_grandeur_baseline_add = 1
		}
		average = {
			enemy_hostile_scheme_success_chance_add = -4
			court_grandeur_baseline_add = 2
		}
		good = {
			enemy_hostile_scheme_success_chance_add = -6
			court_grandeur_baseline_add = 2
		}
		excellent = {
			enemy_hostile_scheme_success_chance_add = -10
			court_grandeur_baseline_add = 3
		}
	}

	custom_employer_modifier_description = food_taster_employer_custom_effect_description

	base_employer_modifier = {
	}

	modifier = {
		diplomacy = 1
		enemy_hostile_scheme_success_chance_max_add = 10
	}

	culture_modifier = {
		parameter = better_food_tasters
		monthly_prestige = 0.25
	}

	on_court_position_received = {
		food_taster_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		food_taster_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		food_taster_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = food_taster_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = food_taster }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}
# EK DISABLED: not using this
keeper_of_swans_court_position = {
	sort_order = 164
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = stewardship

	court_position_asset = {
		animation = personality_compassionate
		background = "gfx/interface/illustrations/event_scenes/bp2_courtyard.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 40
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = stewardship
			multiply = 4
			max = 50
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 100 }
			}
			add = {
				value = 20
				desc = court_position_hunter_3_trait
			}
		}
		else_if = {
			limit = {
				hunt_lifestyle_track_greater_equal_trigger = { TRACK = hunter GREATER_EQUAL = 50 }
			}
			add = {
				value = 10
				desc = court_position_hunter_2_trait
			}
		}
		else_if = {
			limit = { has_trait = lifestyle_hunter }
			add = {
				value = 5
				desc = court_position_hunter_1_trait
			}
		}
		if = {
			limit = {
				has_trait = blind # Can't see the damn birds
			}
			add = {
				value = -20
				desc = court_position_blind_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:keeper_of_swans }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
		# EK DISABLED: no
		always = no
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_kingdom
		# culture = {
		# 	has_cultural_pillar = heritage_west_germanic
		# }
		# EK DISABLED: no
		always = no
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}


	valid_character = {
		scope:employee = {
			keeper_of_swans_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = keeper_of_swans
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = keeper_of_swans } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = keeper_of_swans
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = keeper_of_swans }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = keeper_of_swans }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = keeper_of_swans } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = keeper_of_swans
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = keeper_of_swans }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = keeper_of_swans }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	base_employer_modifier = {
		diplomacy_per_prestige_level = 1
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
		}
		poor = {
			court_grandeur_baseline_add = 1
		}
		average = {
			court_grandeur_baseline_add = 1
		}
		good = {
			court_grandeur_baseline_add = 2
		}
		excellent = {
			court_grandeur_baseline_add = 2
		}
	}

	modifier = {
		diplomacy = 2
		general_opinion = 5
	}

	on_court_position_received = {
		keeper_of_swans_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		keeper_of_swans_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		keeper_of_swans_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = keeper_of_swans_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 25
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = keeper_of_swans }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_jester_court_position = {
	sort_order = 150
	max_available_positions = 1
	minimum_rank = duchy
	skill = diplomacy

	court_position_asset = {
		animation = dancing
		background = "gfx/interface/illustrations/event_scenes/feast.dds"
	}

	opinion = {
		value = court_jester_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = diplomacy
			multiply = 2.5
			max = 50
			desc = court_position_skill_diplomacy
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = {
				value = 20
				desc = court_position_gregarious_trait
			}
		}
		if = {
			limit = {
				has_trait = stubborn
			}
			add = {
				value = 20
				desc = court_position_stubborn_trait
			}
		}
		if = {
			limit = {
				has_trait = shrewd
			}
			add = {
				value = 20
				desc = court_position_shrewd_trait
			}
		}
		if = {
			limit = {
				has_trait = poet
			}
			add = {
				value = 10
				desc = court_position_poet_trait
			}
		}
		if = { # An acrobatic jester is a good jester
			limit = {
				has_trait = athletic
			}
			add = {
				value = 10
				desc = court_position_athletic_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		if = { # ep3_emperor_yearly.2090
			limit = {
				has_character_flag = famous_mime_court
			}
			add = {
				value = 30
				desc = court_position_famous_mime
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_jester }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
		#EK ADDITION: Being a member of the House of Reveries improves the aptitude
		if = {
			limit = {
				has_trait = house_of_reveries
			}
			add = {
				value = 20
				desc = court_position_house_of_reveries
			}
		}
		# EK ADDITION END
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	# Is this an available position for this court? (root is court owner)
	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_duchy
		#EK EDIT: court jester doesnt suit some cultures, for now im locking it to some specific heritages
		# nords dont have jesters according to skyrim dialogue
		# EK COMPATCH TODO: tooltip this?
		OR = {
			culture = { has_cultural_pillar = heritage_cyrodiilic }
			culture = { has_cultural_pillar = heritage_breton }
			culture = { has_cultural_pillar = heritage_yokudan }
			culture = { has_cultural_parameter = allows_jesters_tradition }
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			court_jester_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_jester
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_jester } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_jester
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_jester_court_position
						any_court_position_holder = {
					        type = court_jester_court_position
					        has_variable = king_of_fools_var
						}
					}
				}
				multiply = {
					value = 0.25
					desc = king_of_fools_salary
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_jester_court_position
						any_court_position_holder = {
							type = court_jester_court_position
							has_character_flag = cp_discount
						}
					}
				}
				multiply = {
					value = 0.5
					desc = generic_cp_discount
				}
			}
			if = {
				limit = {
					scope:liege = {
						employs_court_position = court_jester_court_position
						any_court_position_holder = {
							type = court_jester_court_position
							has_character_flag = cp_discount
						}
					}
				}
				multiply = {
					value = 0.5
					desc = generic_cp_discount
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_jester }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_jester }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_jester } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_jester
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_jester }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_jester }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	custom_employer_modifier_description = court_jester_employer_custom_effect_description

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			stress_gain_mult = -0.01
		}
		poor = {
			stress_gain_mult = -0.02
		}
		average = {
			stress_gain_mult = -0.03
		}
		good = {
			stress_gain_mult = -0.05
		}
		excellent = {
			stress_gain_mult = -0.08
		}
	}

	modifier = {
		monthly_prestige = -0.5
		hostile_scheme_phase_duration_add = -3
		owned_hostile_scheme_success_chance_add = -10
	}

	on_court_position_received = {
		court_jester_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		court_jester_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		court_jester_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_jester_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely for very stressed characters
			if = {
				limit = {
					stress_level >= 1
				}
				add = 20
			}
		}
		scope:employee = {
			if = {
				limit = {
					OR = {
						is_close_family_of = scope:liege
						is_consort_of = scope:liege
						is_ruler = yes
						AND = {
							exists = dynasty
							dynasty = {
								any_dynasty_member = {
									count <= 2
								}
							}
						}
						is_clergy = yes
						is_theocratic_lessee = yes
					}
					NOR = {
						has_relation_potential_rival = scope:liege
						has_relation_rival = scope:liege
					}
				}
				add = -1000
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_jester }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

executioner_court_position = { # EP1
	sort_order = 140
	max_available_positions = 1
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = intrigue

	court_position_asset = {
		animation = marshal_axe
		background = "gfx/interface/illustrations/event_scenes/gallows.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = intrigue
			multiply = 2.5
			max = 50
			desc = court_position_skill_intrigue
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = torturer
			}
			add = {
				value = 25
				desc = court_position_torturer_trait
			}
		}
		if = {
			limit = {
				has_trait = sadistic
			}
			add = {
				value = 20
				desc = court_position_sadistic_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:executioner }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		highest_held_title_tier >= tier_kingdom
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		scope:employee = {
			executioner_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = executioner
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = executioner } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = executioner
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = executioner }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = executioner }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			dread_gain_mult = 0.05
			dread_decay_mult = -0.05
		}
		poor = {
			dread_gain_mult = 0.1
			dread_decay_mult = -0.1
		}
		average = {
			dread_gain_mult = 0.15
			dread_decay_mult = -0.15
		}
		good = {
			dread_gain_mult = 0.20
			dread_decay_mult = -0.20
		}
		excellent = {
			dread_gain_mult = 0.25
			dread_decay_mult = -0.25
		}
	}

	custom_employer_modifier_description = executioner_employer_custom_effect_description

	modifier = {
		dread_baseline_add = 25
		general_opinion = -15
		dread_gain_mult = 0.5
	}

	on_court_position_received = {
		# Consume hook if that is what is being used to assign them as Executioner
		scope:liege = {
			if = {
				limit = {
					NOR = {
						has_imprisonment_reason = scope:employee
						scope:employee = { is_imprisoned_by = scope:liege }
					}
					has_usable_hook = scope:employee
				}
				use_hook = scope:employee
			}
		}
		executioner_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		executioner_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		executioner_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = executioner_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# More likely to hire one if you have high dread
			if = {
				limit = {
					dread > medium_dread
				}
				add = 25
			}
			# More likely if you have dread-traits
			if = {
				limit = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = arbitrary
					}
				}
				add = 25
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = executioner }
			}
			add = 1000
		}
	}
}

bodyguard_court_position = { # EP1
	sort_order = {
		value = 131
		if = { # Lower for landless
			limit = {
				is_landed_or_landless_administrative = no
			}
			subtract = 101
		}
	}
	max_available_positions = 2

	skill = prowess

	#court_position_asset = {
	#	trigger = {
	#		culture = { has_cultural_pillar = heritage_mongolic }
	#	}
	#	animation = menacing
	#	background = "gfx/interface/illustrations/event_scenes/corridor.dds"
	#	localization_key = bodyguard_court_position_nomadic
	#}

	court_position_asset = {
		animation = menacing
		background = "gfx/interface/illustrations/event_scenes/corridor.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = soon_forgiven_perk
				}
			}
			add = {
				value = 10
				desc = court_position_soon_forgiven_perk
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = friend }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}
		# Nomad Yurt
		if = {
			limit = {
				employer.domicile ?= {
					has_domicile_building_or_higher = bodyguard_yurt_01
				}
			}
			add = {
				value = 0
				if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_bodyguard_aptitude_lvl_3
						}
					}
					add = 30
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_bodyguard_aptitude_lvl_2
						}
					}
					add = 20
				}
				else_if = {
					limit = {
						employer.domicile ?= {
							has_domicile_parameter = nomad_yurt_increased_bodyguard_aptitude_lvl_1
						}
					}
					add = 10
				}
				desc = bodyguard_yurt_01_domicile_building
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				any_relation = { type = lover }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_lover
			}
		}
		if = {
			limit = {
				employer ?= {
					government_has_flag = government_is_landless_adventurer
					has_perk = positions_of_power_perk
				}
				is_married = yes
			}
			add = {
				value = 10
				desc = court_position_positions_of_power_perk_marriage
			}
		}
		add = {
			value = prowess
			multiply = 4
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = shieldmaiden
			}
			add = {
				value = 20
				desc = court_position_shieldmaiden_trait
			}
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 15
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 10
				desc = court_position_blademaster_2_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		if = {
			limit = {
				has_trait = gallant
			}
			add = {
				value = 5
				desc = court_position_gallant_trait
			}
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = {
				value = 20
				desc = court_position_brave_trait
			}
		}
		if = {
			limit = {
				has_trait = paranoid
			}
			add = {
				value = 10
				desc = court_position_paranoid_trait
			}
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = {
				value = -15
				desc = court_position_craven_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		if = {
			limit = {
				has_trait = varangian
				employer ?= {
					#has_title = title:e_byzantium # EK EDIT: no byz
					employs_court_position = akolouthos_court_position
				}
			}
			add = {
				value = 5
				multiply = employer.court_position:akolouthos_court_position.aptitude:akolouthos_court_position
				desc = court_position_akolouthos_bonus
			}
		}
		if = {
			limit = {
				employer ?= {
					culture = {
						has_cultural_parameter = reduced_bodyguard_aptitude
					}
				}
			}
			add = {
				value = -10
				desc = court_position_palace_politics
			}
		}
		#Pick _one_
		if = {
			limit = {
				employer ?= { has_relation_soulmate = prev } #The considered character
			}
			add = {
				value = 40
				desc = court_position_soulmate
			}
		}
		else_if = {
			limit = {
				employer ?= { has_relation_best_friend = prev } #The considered character
			}
			add = {
				value = 30
				desc = court_position_best_friend
			}
		}
		else_if = {
			limit = {
				employer ?= { has_relation_friend = prev } #The considered character
			}
			add = {
				value = 15
				desc = court_position_friend
			}
		}
		if = {
			limit = {
				has_character_flag = best_knight_position
			}
			add = {
				value = 20
				desc = best_knight_position_desc
			}
		}
		if = {
			limit = {
				has_character_flag = competing_knight_position
				OR = {
					any_court_position_holder = {
						type = bodyguard_court_position
						has_character_flag = competing_knight_position
						NOT = { this = prev }
					}
					any_court_position_holder = {
						type = champion_court_position
						has_character_flag = competing_knight_position
					}
					any_court_position_holder = {
						type = akolouthos_court_position
						has_character_flag = competing_knight_position
					}
				}
			}
			add = 30
			desc = competing_knight_position_desc
		}
		# Estate bonus
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_bodyguard_aptitude_1 }
				}
			}
			add = {
				value = estate_increase_bodyguard_aptitude_1_value
				desc = estate_increase_bodyguard_aptitude_desc
			}
		}
		if = {
			limit = {
				liege ?= {
					domicile ?= { has_domicile_parameter = estate_increase_bodyguard_aptitude_2 }
				}
			}
			add = {
				value = estate_increase_bodyguard_aptitude_2_value
				desc = estate_increase_bodyguard_aptitude_desc
			}
		}

		if = {
			limit = {
				has_perk = praetorian_guard_perk
			}
			add = {
				value = 15
				desc = court_position_bodyguard_modifier
			}
		}
		if = {
			limit = {
				liege ?= { has_perk = praetorian_guard_perk }
			}
			add = {
				value = 15
				desc = court_position_bodyguard_liege_modifier
			}
		}
		
		if = { # Cherbi / Chief Bodyguard bonus
			limit = {
				exists = liege.court_position:cherbi_court_position
			}
			switch = {
				trigger = "liege.court_position:cherbi_court_position.aptitude(cherbi_court_position)"
				1 = { 
					add = {
						value = 1 
						desc = court_position_bodyguard_cherbi_modifier
					}
				}
				2 = {
					add = {
						value = 4
						desc = court_position_bodyguard_cherbi_modifier
					}
				}
				3 = { 
					add = {
						value = 7
						desc = court_position_bodyguard_cherbi_modifier
					}
				}
				4 = {
					add = {
						value = 10
						desc = court_position_bodyguard_cherbi_modifier
					}
				}
				5 = {
					add = {
						value = 15
						desc = court_position_bodyguard_cherbi_modifier
					}
				}
			}
		}
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:bodyguard }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		has_ep1_court_positions_dlc_trigger = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		trigger_if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			domicile ?= {
				has_domicile_building_or_higher = character_warfare_yurt_01
			}
		}
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = bodyguard
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = bodyguard
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = bodyguard } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = bodyguard
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#Set to 0 with our psycho bodyguard from travel_events.2040
			if = {
				limit = {
					scope:liege = {
						employs_court_position = bodyguard_court_position
						any_court_position_holder = {
					        type = bodyguard_court_position
					        has_variable = insane_bodyguard
						}
					}
				}
				multiply = {
					value = 0
					desc = insane_bodyguard_salary_mod
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = bodyguard }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = bodyguard }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = bodyguard } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = bodyguard
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#Set to 0 with our psycho bodyguard from travel_events.2040
			if = {
				limit = {
					scope:liege = {
						employs_court_position = bodyguard_court_position
						any_court_position_holder = {
					        type = bodyguard_court_position
					        has_variable = insane_bodyguard
						}
					}
				}
				multiply = {
					value = 0
					desc = insane_bodyguard_salary_mod
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = bodyguard }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = bodyguard }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	is_powerful_agent = yes

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			enemy_hostile_scheme_success_chance_max_add = -1
		}
		poor = {
			enemy_hostile_scheme_success_chance_max_add = -2
		}
		average = {
			enemy_hostile_scheme_success_chance_max_add = -5
		}
		good = {
			enemy_hostile_scheme_success_chance_max_add = -7
		}
		excellent = {
			enemy_hostile_scheme_success_chance_max_add = -10
		}
	}

	custom_employer_modifier_description = bodyguard_employer_custom_effect_description

	modifier = {
		dread_baseline_add = 10
		intrigue = 1
		enemy_hostile_scheme_success_chance_max_add = -10
	}

	on_court_position_received = {
		bodyguard_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		bodyguard_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		bodyguard_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = bodyguard_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value

		#counter the base_value for landless adventurers, as it assumes you would have a monthly income, don't worry court position don't have salary when hired by landless adventurers
    	if = {
    		limit = {
    			scope:liege = {
    				government_has_flag = government_is_landless_adventurer
    			}
    		}
    		add = {
    			value = scope:base_value
    			multiply = -1
    		}
    	}

		scope:liege = {
			# More likely if you're scared all the time
			if = {
				limit = {
					has_trait = paranoid
				}
				add = 50
			}

			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = bodyguard_court_position
				}
				add = -50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = bodyguard }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

court_artificer_court_position = { # EP1
	sort_order = 130
	max_available_positions = 3
	minimum_rank = kingdom
	skill = learning

	court_position_asset = {
		animation = page_flipping
		background = "gfx/interface/illustrations/event_scenes/study.dds"
	}

	opinion = {
		value = ceremonial_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = prowess
			desc = court_position_skill_intrigue
		}
		add = {
			value = diplomacy
			desc = court_position_skill_diplomacy
		}
		add = {
			value = intrigue
			desc = court_position_skill_intrigue
		}
		add = {
			value = learning
			desc = court_position_skill_learning
		}
		add = {
			value = martial
			desc = court_position_skill_martial
		}
		add = {
			value = stewardship
			desc = court_position_skill_stewardship
		}
		if = {
			limit = {
				has_character_modifier = local_artisan_modifier
			}
			add = {
				value = -20
				desc = local_artisan_modifier
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_eunuch_tradition_value
		add = court_position_aptitude_family_business_value
		#add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:court_artificer }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	is_shown = {
		is_landed_or_landless_administrative = yes
		has_ep1_court_positions_dlc_trigger = yes
		NOT = { government_has_flag = government_is_nomadic }
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
	}

	valid_position = {
		is_landed_or_landless_administrative = yes
		has_royal_court = yes
	}

	is_shown_character = {
		scope:employee = {
			OR = {
				has_completed_inspiration = yes
				custom_tooltip = {
					text = has_an_inspiration
					exists = inspiration
				}
			}
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = court_artificer
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_artificer
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = medium_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_artificer } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_artificer
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_artificer }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_artificer }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = medium_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = court_artificer } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = court_artificer
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = court_artificer }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = court_artificer }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			court_grandeur_baseline_add = 0
		}
		poor = {
			court_grandeur_baseline_add = 1
		}
		average = {
			court_grandeur_baseline_add = 1
		}
		good = {
			court_grandeur_baseline_add = 2
		}
		excellent = {
			court_grandeur_baseline_add = 2
		}
	}

	custom_employer_modifier_description = court_artificer_employer_custom_effect_description

	modifier = {
		monthly_learning_lifestyle_xp_gain_mult = 0.1
		artifact_decay_reduction_mult = -0.2
	}

	on_court_position_received = {
		basic_gained_court_position_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_court_position_effect = yes
		scope:employee = {
			# Moves to pool after 1 day
			# Moving them directly here would invalidate the court position too early
			trigger_event = {
				id = courtier_guest_management.0999
				days = 1
			}
		}
	}
	on_court_position_invalidated = {
		basic_invalidated_court_position_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = court_artificer_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		scope:liege = {
			# Unless you have lots of gold to spend, there's no point
			if = {
				limit = {
					short_term_gold < 500
					monthly_character_income < monthly_character_expenses_plus_fourty_percent
				}
				add = -100
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = court_artificer }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}

### Special Court Positions ### ( Sort order 99 - 50 )

garuda_court_position = {
	sort_order = 65
	max_available_positions = 2
	minimum_rank = kingdom # Should only be available for kings and emperors
	skill = martial

	court_position_asset = {
		animation = marshal_shield
		background = "gfx/interface/illustrations/event_scenes/bp1_courtyard_indian.dds"
	}

	opinion = {
		value = regular_court_position_opinion
	}

	# How high the aptitude has to be to reach the 5 different modifier levels
	aptitude_level_breakpoints = { 20 40 60 80 }

	# How good is this character in this position? root scope is the holder of the court position
	aptitude = {
		value = 1
		add = court_position_aptitude_boon_voyager_trait
		add = {
			value = martial
			multiply = 2.5
			max = 50
			desc = court_position_skill_martial
		}
		add = {
			value = prowess
			multiply = 2
			max = 50
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 100
				}
			}
			add = {
				value = 30
				desc = court_position_blademaster_3_trait
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
				has_trait_xp = {
					trait = lifestyle_blademaster
					value >= 50
				}
			}
			add = {
				value = 15
			}
		}
		else_if = {
			limit = {
				has_trait = lifestyle_blademaster
			}
			add = {
				value = 5
				desc = court_position_blademaster_1_trait
			}
		}
		add = court_position_aptitude_traveling_friends_value
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_high_penalty_value
		# Bonus from court.8311
		if = {
			limit = { var:bonus_aptitude_role ?= flag:garuda }
			add = {
				value = cp_bonus_aptitude_value
				desc = cp_bonus_aptitude
			}
		}
		# Seneschal
		if = {
			limit = {
				liege.court_position:seneschal_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:seneschal_court_position.seneschal_improve_court_value
				desc = seneschal_improve_court_aptitude_desc
			}
		}
		# Yeke Jarquchi
		if = {
			limit = {
				liege.court_position:yeke_jarquchi_court_position ?= {
					has_variable = performing_improve_court
				}
			}
			add = {
				value = liege.court_position:yeke_jarquchi_court_position.yeke_jarquchi_improve_court_value
				desc = yeke_jarquchi_improve_court_aptitude_desc
			}
		}
	}

	# Is this an available position for this court? (root is court owner)
	is_shown = {
		is_landed_or_landless_administrative = yes
		trigger_if = {
			limit = {
				is_ai = yes
				highest_held_title_tier <= tier_county
			}
			always = no
		}
		# EK EDIT: we don't use this
		always = no
	}

	valid_position = {
		OR = {
			is_landed_or_landless_administrative = yes
			government_has_flag = government_is_nomadic
		}
		highest_held_title_tier >= tier_kingdom
		culture = { has_cultural_tradition = tradition_garuda_warriors }
	}

	is_shown_character = {
		scope:employee = {
			is_imprisoned = no
			is_mindless_character = no #EK EDIT
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = garuda
		}
	}

	revoke_cost = { # root is the liege, no other scopes are passed here!
		prestige =  {
			value = major_court_position_prestige_revoke_cost
			# Set to 0 via obligation hook
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = garuda
						LIEGE = root
					}
				}
				multiply = 0
			}
			# Avoid AI prestige issues
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			# Special case for events
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
			#Lowering for LAAMPS, to match Camp Officer revoke cost
			if = {
				limit = { 
					exists = this
					government_has_flag = government_is_landless_adventurer
				}
				value = minor_court_position_prestige_revoke_cost
			}
		}
	}

	salary = {
		round = no
		gold = {
			value = minor_court_position_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = garuda } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved with obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = garuda
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = garuda }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = garuda }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
		prestige = {
			value = minor_court_position_prestige_salary # Update X_salary_tooltip if script_value is changed
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = garuda } }
				multiply = {
					value = 0
					desc = inner_circle_salary_mod
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved via obligation hook
			else_if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = garuda
						LIEGE = scope:liege
					}
				}
				multiply = {
					value = 0.5
					desc = obligation_hook_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Halved salary
			if = {
				limit = {
					court_position_halved_salary_trigger = { POS = garuda }
				}
				multiply = {
					value = 0.5
					desc = court_position_halved_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			# Increased salary
			if = {
				limit = {
					court_position_increased_salary_trigger = { POS = garuda }
				}
				multiply = {
					value = 1.5
					desc = court_position_increased_salary
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
			#You're working with LAAMPS now
			if = {
				limit = { 
					scope:liege ?= { government_has_flag = government_is_landless_adventurer }
				}
				multiply = {
					value = 0
					desc = court_position_laamps_free
					format = "BASE_VALUE_FORMAT_DECIMALS_MINUS_POSITIVE"
				}
			}
		}
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			dread_baseline_add = 1
		}
		poor = {
			dread_gain_mult = 0.05
			dread_decay_mult = -0.05
			dread_baseline_add = 2
		}
		average = {
			dread_gain_mult = 0.1
			dread_decay_mult = -0.1
			dread_baseline_add = 4
		}
		good = {
			dread_gain_mult = 0.2
			dread_decay_mult = -0.2
			dread_baseline_add = 7
		}
		excellent = {
			dread_gain_mult = 0.3
			dread_decay_mult = -0.3
			dread_baseline_add = 10
		}
	}

	custom_employer_modifier_description = garuda_employer_custom_effect_description

	modifier = {
		dread_baseline_add = 15
		dread_decay_mult = -0.25
	}

	on_court_position_received = {
		garuda_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		garuda_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		garuda_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = garuda_court_position
		}
	}
	# Scripted value to determine whether an AI will hire/fire a position or not. Hires over 0, fires under -50. Look in _court_positions.info for more extensive documentation!
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value

		scope:liege = {
			# Less likely to hire an additional one if you're already employing one
			if = {
				limit = {
					employs_court_position = garuda_court_position
				}
				add = -50
			}
		}
		if = { # To stop petitioned positions immediately being fired by the AI
			limit = {
				court_position_petition_ai_weight_trigger = { ROLE = garuda }
			}
			add = 1000
		}
		add = court_position_debt_considerations_value
	}
}
