﻿@minspec_skill_rating = decent_skill_rating
@basic_will_do = 500

second_camp_officer = {
	sort_order = 49
	max_available_positions = 1
	skill = diplomacy

	court_position_asset = {
		animation = stressed_teacher
		background = "gfx/interface/illustrations/event_scenes/ep3_camp_arid_terrain.dds"
	}

	opinion = {
		value = high_camp_officer_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
		if = {
			limit = {
				employer ?= { has_perk = soon_forgiven_perk }
			}
			add = {
				value = 10
				desc = court_position_soon_forgiven_perk
			}
		}
		if = {
			limit = {
				employer ?= { has_perk = local_arbitration_perk }
			}
			add = {
				value = 15
				desc = court_position_local_arbitration_perk_boon
			}
		}
		if = {
			limit = {
				employer ?= {
					is_landless_adventurer = yes
					has_perk = positions_of_power_perk
				}
				num_of_relation_friend > 0
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}
		if = {
			limit = {
				employer ?= {
					is_landless_adventurer = yes
					has_perk = positions_of_power_perk
				}
				num_of_relation_lover > 0
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_lover
			}
		}
		if = {
			limit = {
				employer ?= {
					is_landless_adventurer = yes
					has_perk = positions_of_power_perk
				}
				is_married = yes
			}
			add = {
				value = 10
				desc = court_position_positions_of_power_perk_marriage
			}
		}
		if = {
			limit = {
				employer ?= {
					has_perk = likable_perk
					has_relation_best_friend = prev
				}
			}
			add = {
				value = 30
				desc = court_position_best_friend
			}
		}
		else_if = {
			limit = {
				employer ?= {
					has_perk = likable_perk
					has_relation_friend = prev
				}
			}
			add = {
				value = 15
				desc = court_position_friend
			}
		}
		add = {
			value = diplomacy
			multiply = 1.5
			max = 60
			desc = court_position_skill_diplomacy
		}
		add = {
			value = martial
			multiply = 0.75
			max = 60
			desc = court_position_skill_martial
		}
		add = {
			value = stewardship
			multiply = 0.75
			max = 60
			desc = court_position_skill_stewardship
		}
		add = {
			value = intrigue
			multiply = 0.75
			max = 60
			desc = court_position_skill_intrigue
		}
		add = {
			value = learning
			multiply = 0.75
			max = 60
			desc = court_position_skill_learning
		}
		add = {
			value = prowess
			multiply = 0.75
			max = 60
			desc = court_position_skill_prowess
		}
		if = {
			limit = {
				has_trait = sadistic
			}
			add = 10
			desc = court_position_sadistic_trait
		}
		if = {
			limit = {
				has_trait = callous
			}
			add = 10
			desc = court_position_callous_trait
		}
		if = {
			limit = {
				has_trait = overseer
			}
			add = 20
			desc = court_position_overseer_trait
		}
		if = {
			limit = {
				has_trait = loyal
			}
			add = 15
			desc = court_position_loyal_trait
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = -20
			desc = court_position_craven_trait
		}
		if = {
			limit = {
				has_trait = fickle
			}
			add = -20
			desc = court_position_fickle_trait
		}
		add = court_position_aptitude_high_penalty_value
	}

	is_shown = {
		has_ep3_dlc_trigger = yes
		custom_tooltip = {
			text = landless_government_tt
			government_has_flag = government_is_landless_adventurer
		}
	}

	valid_position = {
		custom_tooltip = {
			text = landless_government_tt
			government_has_flag = government_is_landless_adventurer
		}
		custom_tooltip = {
			text = second_camp_officer_parameter_tt
			domicile ?= { has_domicile_parameter = camp_unlocks_second_officer }
		}
	}

	is_shown_character = {
		scope:employee = {
			is_incapable = no
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = second
		}
	}

	revoke_cost = {
		prestige =  {
			value = minor_court_position_prestige_revoke_cost

			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = {
					exists = dynasty
					dynasty = { has_dynasty_perk = fp2_coterie_legacy_1 }

					employs_court_position = second_camp_officer
					any_court_position_holder = {
				        type = second_camp_officer
						exists = dynasty
						house = prev.house
					}
				}
				multiply = 0
			}
		}
	}

	salary = {
		#officers have no salary
	}

	# These modifiers are employed based on what level the aptitude reaches (levels are defined as breakpoints)
	scaling_employer_modifiers = {
		terrible = {
			diplomacy = 1
			martial = 1
			stewardship = 1
			intrigue = 1
			learning = 1
			prowess = 1
		}
		poor = {
			diplomacy = 1
			martial = 1
			stewardship = 1
			intrigue = 1
			learning = 1
			prowess = 1
		}
		average = {
			diplomacy = 2
			martial = 2
			stewardship = 2
			intrigue = 2
			learning = 2
			prowess = 2
		}
		good = {
			diplomacy = 3
			martial = 3
			stewardship = 3
			intrigue = 3
			learning = 3
			prowess = 3
		}
		excellent = {
			diplomacy = 5
			martial = 5
			stewardship = 5
			intrigue = 5
			learning = 5
			prowess = 5
		}
	}

	modifier = {
		monthly_prestige = 0.1
		enemy_hostile_scheme_success_chance_max_add = -10
		owned_hostile_scheme_success_chance_max_add = 10
		owned_personal_scheme_success_chance_max_add = 10
	}

	on_court_position_received = {
		second_camp_officer_title_accepted_effect = yes
	}
	on_court_position_revoked = {
		second_camp_officer_title_revoked_effect = yes
	}
	on_court_position_invalidated = {
		second_camp_officer_title_invalidated_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = second_camp_officer
		}
	}
	# 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 = @basic_will_do

		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
	}
}