﻿court_greybeard_court_position = {
	sort_order = 380
	max_available_positions = 1

	skill = learning

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

	opinion = {
		value = regular_court_position_opinion
	}
	
	aptitude_level_breakpoints = { 20 40 60 80 }
	
	aptitude = {
		value = 1
		if = {
			limit = {
				has_trait_xp = { trait = thuum_mastery value >= 40 }
			}
			add = {
				value = 20
				desc = has_thuum_xp_1
			}
		}
		if = {
			limit = {
				has_trait_xp = { trait = thuum_mastery value >= 60 }
			}
			add = {
				value = 20
				desc = has_thuum_xp_2
			}
		}
		if = {
			limit = {
				has_trait_xp = { trait = thuum_mastery value >= 80 }
			}
			add = {
				value = 20
				desc = has_thuum_xp_3
			}
		}
		if = {
			limit = {
				has_trait_xp = { trait = thuum_mastery value >= 100 }
			}
			add = {
				value = 20
				desc = has_thuum_xp_4
			}
		}
	}
	
	minimum_rank = empire 

	is_shown = {
		is_ai = no
		dynasty ?= { has_dynasty_perk = dragonblood_legacy_5 }
		is_target_in_global_variable_list = {
			name = talos_patron_available
			target = flag:db_ysmir_dragon_of_the_north
		}
	}

	is_shown_character = {
		scope:employee = {
			has_trait = thuum_mastery
			is_mindless_character = no
		}
	}

	valid_position = {
		dynasty ?= { has_dynasty_perk = dragonblood_legacy_5 }
		is_target_in_global_variable_list = {
			name = talos_patron_available
			target = flag:db_ysmir_dragon_of_the_north
		}
	}

	valid_character = {
		scope:employee = {
			has_trait = thuum_mastery
			is_mindless_character = no
		}
	}

	revoke_cost = {
		piety =  {
			value = 200
			if = {
				limit = {
					exists = this
					is_ai = yes
				}
				multiply = 0
			}
			if = {
				limit = {
					exists = this
					has_character_flag = free_revoke_cost
				}
				multiply = 0
			}
		}
	}

	salary = {
		gold = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = no
					}
				}
				add = court_mage_total_salary_value
			}
		}
		treasury = {
			value = 0
			if = {
				limit = {
					scope:liege = {
						has_treasury = yes
					}
				}
				add = court_mage_total_salary_value
			}
		}
		prestige = {
			value = court_mage_prestige_salary_value
		}
	}

	received_salary = {
		gold = {
			value = court_mage_total_salary_value
		}
		prestige = {
			value = court_mage_prestige_salary_value
		}
		round = no
	}

	is_powerful_agent = yes
	
	base_employer_modifier = {
		learning = 2
		monthly_lifestyle_xp_gain_mult = 0.05
	}

	modifier = {
		learning = 2
		monthly_prestige = 0.05
	}

	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_mage_court_position
		}
	}
	
	search_for_courtier = {
		send_interface_toast = {
			title = court_greybeard_decision
			custom_tooltip = court_greybeard_decision_effect_tooltip
		}
		trigger_event = {
			id = db_ysmir_event.0010
			days = 14
		}
	}
}