﻿promote_to_head_of_cabinet = {

	sound = PROMOTE_TO_HEAD_OF_CABINET

	message = yes
	on_own_nation = yes

	price = price:head_of_cabinet_promotion

	potential = {
		scope:actor = {
			#country
		}
	} 

	ai_tick = daily
	ai_tick_frequency = 360

	allow = {
		scope:actor = {
			country_can_promote_head_of_cabinet = yes
			NOT = {
				any_cabinet_character = {
					modifier:is_head_of_cabinet = yes
				}
			}
		}
	}

	select_trigger = {
		looking_for_a = character
		source = actor
		target_flag = recipient
		name = "choose_character"
		column = {
			data = name
		}
		visible = {
			is_alive = yes
			is_adult = yes
			in_cabinet = yes
			NOT = { has_character_modifier = head_of_the_cabinet_modifier }
		}
		enabled = {
			custom_tooltip = {
				text = promote_to_head_of_cabinet_timer
				in_cabinet = yes
			}
			NOT = { has_character_modifier = head_of_the_cabinet_modifier }
		}
	}

	effect = {
		scope:actor = {
			if = {
				limit = {
					scope:recipient = { has_variable = no_cost_for_promotion }
				}
				add_political_influence = 25
			}
			promote_to_head_of_cabinet_effect = {
				target = scope:recipient
			}
		}
	}

   ai_will_do = {
   		if = {
   			limit = {
   				scope:actor.political_influence <= 90
   			}

   			add = {
   				value = -250
				desc = "low PI"
			}
   		}

   		add = {
   			desc = "reluctance"
   			value = -250
   		}

		add = {
			desc = "total abilities"
			value = scope:recipient.total_abilities
		}

		if = {
			limit = {
				scope:recipient = { has_trait = corrupt }
			}

			add = {
				desc = "corrupt"
				subtract = 250
			}
		}

		if = {
			limit = { 
				scope:actor = { has_reform = government_reform:powerful_vizierships_reform }
			}
			add = 1000
		}
    }
}