pte_take_advisor_adm_effect = {
	FROM = {
		if = {
			limit = {
				advisor = treasurer
			}
			if = {
				limit = {
					treasurer = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = treasurer skill = 3 }
				}
			}
			else_if = {
				limit = {
					treasurer = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = treasurer skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = treasurer skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = philosopher
			}
			if = {
				limit = {
					philosopher = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = philosopher skill = 3 }
				}
			}
			else_if = {
				limit = {
					philosopher = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = philosopher skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = philosopher skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = artist
			}
			if = {
				limit = {
					artist = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = artist skill = 3 }
				}
			}
			else_if = {
				limit = {
					artist = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = artist skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = artist skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = theologian
			}
			if = {
				limit = {
					theologian = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = theologian skill = 3 }
				}
			}
			else_if = {
				limit = {
					theologian = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = theologian skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = theologian skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = master_of_mint
			}
			if = {
				limit = {
					master_of_mint = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = master_of_mint skill = 3 }
				}
			}
			else_if = {
				limit = {
					master_of_mint = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = master_of_mint skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = master_of_mint skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = inquisitor
			}
			if = {
				limit = {
					inquisitor = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = inquisitor skill = 3 }
				}
			}
			else_if = {
				limit = {
					inquisitor = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = inquisitor skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = inquisitor skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = natural_scientist
			}
			if = {
				limit = {
					natural_scientist = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = natural_scientist skill = 3 }
				}
			}
			else_if = {
				limit = {
					natural_scientist = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = natural_scientist skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = natural_scientist skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				is_expanded_mod_active = { mod = advisor_types }
			}
			ate_pte_take_advisor_adm_effect = yes
		}
		remove_advisor_by_category = ADM
	}
}

pte_take_advisor_dip_effect = {
	FROM = {
		if = {
			limit = {
				advisor = statesman
			}
			if = {
				limit = {
					statesman = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = statesman skill = 3 }
				}
			}
			else_if = {
				limit = {
					statesman = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = statesman skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = statesman skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = diplomat
			}
			if = {
				limit = {
					diplomat = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = diplomat skill = 3 }
				}
			}
			else_if = {
				limit = {
					diplomat = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = diplomat skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = diplomat skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = naval_reformer
			}
			if = {
				limit = {
					naval_reformer = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = naval_reformer skill = 3 }
				}
			}
			else_if = {
				limit = {
					naval_reformer = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = naval_reformer skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = naval_reformer skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = trader
			}
			if = {
				limit = {
					trader = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = trader skill = 3 }
				}
			}
			else_if = {
				limit = {
					trader = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = trader skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = trader skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = colonial_governor
			}
			if = {
				limit = {
					colonial_governor = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = colonial_governor skill = 3 }
				}
			}
			else_if = {
				limit = {
					colonial_governor = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = colonial_governor skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = colonial_governor skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = navigator
			}
			if = {
				limit = {
					navigator = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = navigator skill = 3 }
				}
			}
			else_if = {
				limit = {
					navigator = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = navigator skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = navigator skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = spymaster
			}
			if = {
				limit = {
					spymaster = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = spymaster skill = 3 }
				}
			}
			else_if = {
				limit = {
					spymaster = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = spymaster skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = spymaster skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				is_expanded_mod_active = { mod = advisor_types }
			}
			ate_pte_take_advisor_dip_effect = yes
		}
		remove_advisor_by_category = DIP
	}
}

pte_take_advisor_mil_effect = {
	FROM = {
		if = {
			limit = {
				advisor = army_organiser
			}
			if = {
				limit = {
					army_organiser = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = army_organiser skill = 3 }
				}
			}
			else_if = {
				limit = {
					army_organiser = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = army_organiser skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = army_organiser skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = army_reformer
			}
			if = {
				limit = {
					army_reformer = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = army_reformer skill = 3 }
				}
			}
			else_if = {
				limit = {
					army_reformer = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = army_reformer skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = army_reformer skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = commandant
			}
			if = {
				limit = {
					commandant = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = commandant skill = 3 }
				}
			}
			else_if = {
				limit = {
					commandant = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = commandant skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = commandant skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = grand_captain
			}
			if = {
				limit = {
					grand_captain = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = grand_captain skill = 3 }
				}
			}
			else_if = {
				limit = {
					grand_captain = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = grand_captain skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = grand_captain skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = recruitmaster
			}
			if = {
				limit = {
					recruitmaster = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = recruitmaster skill = 3 }
				}
			}
			else_if = {
				limit = {
					recruitmaster = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = recruitmaster skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = recruitmaster skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = fortification_expert
			}
			if = {
				limit = {
					fortification_expert = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = fortification_expert skill = 3 }
				}
			}
			else_if = {
				limit = {
					fortification_expert = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = fortification_expert skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = fortification_expert skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				advisor = quartermaster
			}
			if = {
				limit = {
					quartermaster = 3
				}
				ROOT = {
					pte_take_advisor_effect = { type = quartermaster skill = 3 }
				}
			}
			else_if = {
				limit = {
					quartermaster = 2
				}
				ROOT = {
					pte_take_advisor_effect = { type = quartermaster skill = 2 }
				}
			}
			else = {
				ROOT = {
					pte_take_advisor_effect = { type = quartermaster skill = 1 }
				}
			}
		}
		else_if = {
			limit = {
				is_expanded_mod_active = { mod = advisor_types }
			}
			ate_pte_take_advisor_mil_effect = yes
		}
		remove_advisor_by_category = MIL
	}
}

pte_take_advisor_effect = {
	define_advisor = {
		type = $type$
		skill = $skill$
		culture = PREV
		religion = PREV
		cost_multiplier = 0.66
	}
}

pte_move_monument_effect = {
	random_owned_province = {
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_in_capital_area = yes
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_in_capital_area = yes
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_in_capital_area = yes
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_in_capital_area = yes
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			is_in_capital_area = yes
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			is_in_capital_area = yes
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			is_in_capital_area = yes
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			is_state_core = ROOT
			is_in_capital_area = yes
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			NOT = { is_capital_of = ROOT }
			any_province_in_state = {
				is_capital_of = ROOT
			}
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			NOT = { is_capital_of = ROOT }
			any_province_in_state = {
				is_capital_of = ROOT
			}
			development = 10
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			NOT = { is_capital_of = ROOT }
			any_province_in_state = {
				is_capital_of = ROOT
			}
			development = 20
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	random_owned_province = {
		limit = {
			is_state = yes
			NOT = { is_capital_of = ROOT }
			any_province_in_state = {
				is_capital_of = ROOT
			}
			development = 30
			pte_can_use_monument_trigger = { $monument$ = yes }
		}
		save_event_target_as = new_monument_location
	}
	capital_scope = {
		if = {
			limit = {
				pte_can_use_monument_trigger = { $monument$ = yes }
			}
			save_event_target_as = new_monument_location
		}
	}
	event_target:new_monument_location = {
		random_province = {
			limit = {
				has_great_project = { type = $monument$ }
			}
			move_great_project = { type = $monument$ instant = yes province = PREV }
		}
	}
}

pte_update_cultural_hegemony_targets = {
	hidden_effect = {
		if = {
			limit = {
				has_saved_global_event_target = pte_cultural_hegemony_target_1
			}
			clear_global_event_target = pte_cultural_hegemony_target_1
		}
		if = {
			limit = {
				has_saved_global_event_target = pte_cultural_hegemony_target_2
			}
			clear_global_event_target = pte_cultural_hegemony_target_2
		}
		if = {
			limit = {
				has_saved_global_event_target = pte_cultural_hegemony_target_3
			}
			clear_global_event_target = pte_cultural_hegemony_target_3
		}
		if = {
			limit = {
				has_saved_global_event_target = pte_cultural_hegemony_target_4
			}
			clear_global_event_target = pte_cultural_hegemony_target_4
		}
		if = {
			limit = {
				has_saved_global_event_target = pte_cultural_hegemony_target_5
			}
			clear_global_event_target = pte_cultural_hegemony_target_5
		}
		every_country = {
			limit = {
				has_country_modifier = pte_culture_group_hegemony_modifier
				NOT = { is_variable_equal = { which = pte_culture_group_hegemony_var value = 0 } }
			}
			if = {
				limit = {
					NOT = { has_saved_global_event_target = pte_cultural_hegemony_target_1 }
				}
				save_global_event_target_as = pte_cultural_hegemony_target_1
			}
			else_if = {
				limit = {
					NOT = { has_saved_global_event_target = pte_cultural_hegemony_target_2 }
				}
				save_global_event_target_as = pte_cultural_hegemony_target_2
			}
			else_if = {
				limit = {
					NOT = { has_saved_global_event_target = pte_cultural_hegemony_target_3 }
				}
				save_global_event_target_as = pte_cultural_hegemony_target_3
			}
			else_if = {
				limit = {
					NOT = { has_saved_global_event_target = pte_cultural_hegemony_target_4 }
				}
				save_global_event_target_as = pte_cultural_hegemony_target_4
			}
			else_if = {
				limit = {
					NOT = { has_saved_global_event_target = pte_cultural_hegemony_target_5 }
				}
				save_global_event_target_as = pte_cultural_hegemony_target_5
			}
		}
	}
}