﻿@base_position_score = 500
@base_candidate_score = 500

# Pilgrims and Preachers - camp officers
# Relic Keeper - unlocked by the Reliquary Wagon (ppr_baggage_train_reliquary).
# Structure copied from vanilla camp_priest_camp_officer.

ppr_relic_keeper_camp_officer = {
	sort_order = 21
	max_available_positions = 1
	skill = learning

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

	opinion = {
		value = regular_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_government = landless_adventurer_government
					has_perk = positions_of_power_perk
				}
				any_relation = { type = friend }
			}
			add = {
				value = 5
				desc = court_position_positions_of_power_perk_friend
			}
		}

		add = {
			value = learning
			multiply = 3
			max = 55
			desc = court_position_skill_learning
		}
		if = {
			limit = { has_trait = pilgrim }
			add = {
				value = 20
				desc = court_position_pilgrim_trait
			}
		}
		if = {
			limit = { has_trait = theologian }
			add = {
				value = 15
				desc = court_position_theologian_trait
			}
		}
		if = {
			limit = { has_trait = erudite }
			add = {
				value = 10
				desc = court_position_erudite_trait
			}
		}
		if = {
			limit = { has_trait = zealous }
			add = {
				value = 10
				desc = court_position_zealous_trait
			}
		}
		if = {
			limit = { has_trait = diligent }
			add = {
				value = 5
				desc = court_position_diligent_trait
			}
		}
		if = {
			limit = { has_trait = lazy }
			add = {
				value = -10
				desc = court_position_lazy_trait
			}
		}
		add = court_position_aptitude_high_penalty_value
		add = general_aptitude_bonus
	}

	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 = ppr_relic_keeper_camp_officer_parameter_tt
			domicile ?= { has_domicile_parameter = ppr_camp_unlocks_relic_keeper_officer }
		}
	}

	is_shown_character = {
		scope:employee = {
			is_incapable = no
			faith = scope:liege.faith
		}
	}

	valid_character = {
		valid_camp_officer_trigger = {
			OFFICER = ppr_relic_keeper
		}
	}

	revoke_cost = {
		prestige = {
			value = minor_court_position_prestige_revoke_cost

			if = {
				limit = { camp_officer_inner_circle_revoke_trigger = { POS = ppr_relic_keeper } }
				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 = {
			monthly_learning_lifestyle_xp_gain_mult = 0.02
			artifact_decay_reduction_mult = -0.05
		}
		poor = {
			monthly_learning_lifestyle_xp_gain_mult = 0.05
			artifact_decay_reduction_mult = -0.1
		}
		average = {
			monthly_learning_lifestyle_xp_gain_mult = 0.075
			artifact_decay_reduction_mult = -0.15
			same_faith_opinion = 3
		}
		good = {
			monthly_learning_lifestyle_xp_gain_mult = 0.1
			artifact_decay_reduction_mult = -0.2
			same_faith_opinion = 5
		}
		excellent = {
			monthly_learning_lifestyle_xp_gain_mult = 0.15
			artifact_decay_reduction_mult = -0.25
			same_faith_opinion = 10
		}
	}

	modifier = {
		monthly_piety = 0.25
	}

	on_court_position_received = {
		basic_gained_camp_officer_effect = yes
	}
	on_court_position_revoked = {
		basic_revoked_camp_officer_effect = yes
	}
	on_court_position_invalidated = {
		basic_invalidated_camp_officer_effect = yes
	}
	on_court_position_vacated = {
		court_position_vacated_event_effect = {
			COURT_POSITION_TYPE = ppr_relic_keeper_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!
	ai_position_score = {
		value = @base_position_score
	}
	ai_candidate_score = {
		value = @base_candidate_score
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
	}
}
