﻿action_empty_council_position = {
	type = alert

	check_create_action = {
		if = {
			limit = {
				highest_held_title_tier > tier_barony
				has_free_council_slot = yes

				OR = {
					AND = {
						highest_held_title_tier >= tier_empire
						any_normal_councillor = {
							count < 23
						}
					}
					AND = {
						highest_held_title_tier >= tier_kingdom
						any_normal_councillor = {
							count < 17
						}
					}
					AND = {
						highest_held_title_tier > tier_barony
						any_normal_councillor = {
							count < 11
						}
					}
				}


				# OR = {
				# 	any_normal_councillor = {
				# 		OR = {
				# 			has_council_position = councillor_advisor_1
				# 			has_council_position = councillor_advisor_2
				# 			has_council_position = councillor_advisor_3
				# 			has_council_position = councillor_advisor_4
				# 			has_council_position = councillor_advisor_5
				# 			has_council_position = councillor_advisor_6
				# 		}
				# 		count < 6
				# 	}
				# 	AND = {
				# 		highest_held_title_tier >= tier_kingdom
				# 		any_normal_councillor = {
				# 			OR = {
				# 				has_council_position = councillor_advisor_king_1
				# 				has_council_position = councillor_advisor_king_2
				# 				has_council_position = councillor_advisor_king_3
				# 				has_council_position = councillor_advisor_king_4
				# 				has_council_position = councillor_advisor_king_5
				# 				has_council_position = councillor_advisor_king_6
				# 			}
				# 			count < 6
				# 		}
				# 	}
				# 	AND = {
				# 		highest_held_title_tier >= tier_empire
				# 		any_normal_councillor = {
				# 			OR = {
				# 				has_council_position = councillor_advisor_emperor_1
				# 				has_council_position = councillor_advisor_emperor_2
				# 				has_council_position = councillor_advisor_emperor_3
				# 				has_council_position = councillor_advisor_emperor_4
				# 				has_council_position = councillor_advisor_emperor_5
				# 				has_council_position = councillor_advisor_emperor_6
				# 			}
				# 			count < 6
				# 		}
				# 	}
				# }
			}
			try_create_important_action = {
				important_action_type = action_empty_council_position
				actor = root
			}
		}
	}
	effect = {
		scope:actor = {
			open_view_data = {
				view = council_window
			}
		}
	}
}
