﻿stonemason_master_court_position = {
	sort_order = 295
	max_available_positions = 1
	minimum_rank = duchy
	skill = stewardship

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


	opinion = {	
		scope:liege = 		{ value = county_court_position_opinion	}
		scope:employee = 	{ value = county_court_position_opinion	}	
		}
	
	aptitude_level_breakpoints = { 20 40 60 80 }
	aptitude = court_position_aptitude_stewardship_builder_80pt 

	is_shown = { 
		highest_held_title_tier >= tier_county
	}
	valid_position = { 
		highest_held_title_tier >= tier_duchy
		has_perk = cutting_corners_perk
	}
	is_shown_character = {
		scope:employee = {
			is_courtier_of = scope:liege
			is_imprisoned = no
		}
	}
	
	valid_character = {
		scope:employee = {
			stonemason_master_validity_trigger = { EMPLOYER = scope:liege }
		}
	}

	revoke_cost = {
		gold =  {	
			value = major_court_position_gold_revoke_cost	
		}
		prestige =  {
			value = minor_court_position_prestige_revoke_cost
			if = {
				limit = {
					court_position_obligation_hook_salary_trigger = {
						POS = stonemason_master
						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
			# Set to 0 with Dynasty Perk Inner Circle
			if = {
				limit = { court_position_inner_circle_salary_trigger = { POS = stonemason_master } }
				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 = stonemason_master
						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 = stonemason_master }
				}
				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 = stonemason_master }
				}
				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 = stonemason_master } }
				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 = stonemason_master
						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 = stonemason_master }
				}
				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 = stonemason_master }
				}
				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 = {
		monthly_prestige = 0.05
	}

	scaling_employer_modifiers = {
		terrible = {	build_gold_cost = -0.01		}
		poor = {		build_gold_cost = -0.02		}
		average = {		build_gold_cost = -0.03		}
		good = {		build_gold_cost = -0.04		}
		excellent = {	build_gold_cost = -0.05		}	}

	custom_scaling_employer_modifier_description = {		
		terrible = 	desc_masterstonemason_terrible
		poor = 		desc_masterstonemason_poor
		average = 	desc_masterstonemason_average
		good = 		desc_masterstonemason_good
		excellent = desc_masterstonemason_excellent
		range = 	desc_masterstonemason_range
	}

	custom_employee_modifier_description = stonemason_master_employee_custom_effect_description

	modifier = {
		stewardship = 1
		monthly_stewardship_lifestyle_xp_gain_mult = 0.1
		monthly_prestige = 0.5
		monthly_dread = 0.0
		monthly_piety = 0.0
		health = 0.0
	}

	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 = stonemason_master_court_position	
		}	
	}

	candidate_score = {
		value = 50
		add = scope:base_value
		add = court_position_candidate_score_base_value
		add = court_position_candidate_aptitude_value
		add = court_position_debt_considerations_value
        # AI is less likely to fire the court position, unless they have a better candidate.
        if = {	limit = {	exists = scope:firing_court_position	}
            add = 200
            scope:employee = {
				if = {	limit = {	scope:highest_available_aptitude > scope:employee_aptitude	}
					add = -150	}	}	}
	}
}