﻿
envoy_court_position = {
	skill = diplomacy
	max_available_positions = 1
	category = court_position_category_common
	minimum_rank = county

	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 = {
			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
			}
		}
		if = {
			limit = {
				has_variable = envoyskill
			}
			add = {
				value = var:envoyskill
				desc = "Skill earned during through job performance."
			}
		}
		add = court_position_aptitude_family_business_value
		add = court_position_aptitude_low_penalty_value
	
	}
	
	# Is this an available position for this court? (root is court owner)
	is_shown = {
		exists = dynasty
	}
	
	# 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 = {
		scope:employee = {
			is_imprisoned = no
			diplomacy >= 8
		}
	}
	
	revoke_cost = {
		prestige = major_court_position_prestige_revoke_cost
	}
	
	salary = {
		round = no
		gold = minor_court_position_salary
	}
	
	scaling_employer_modifiers = {
		#mostly here to enable envoys
		aptitude_level_1 = {
			different_culture_opinion = 1
			monthly_prestige = 0.1
		}
		aptitude_level_2 = {
			different_culture_opinion = 2
			monthly_prestige = 0.2
		}
		aptitude_level_3 = {
			different_culture_opinion = 3
			monthly_prestige = 0.3
		}
		aptitude_level_4 = {
			different_culture_opinion = 4
			monthly_prestige = 0.4
		}
		aptitude_level_5 = {
			different_culture_opinion = 5
			monthly_prestige = 0.5
		}
	}
	
	modifier = {
		monthly_prestige = minor_court_position_prestige_salary
	}
	
	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
		
	}
	candidate_score = {
		value = 100
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
	}
}
