﻿je_caudillo = {
	icon = "gfx/interface/icons/ig_icons/armed_forces.dds"

	group = je_group_internal_affairs

	# see also: exiling an armed forces character depletes the progress bar

	scripted_button = caudillo_decree_button

	immediate = {
		save_scope_as = caudillo_country_scope
	}

	complete = {
		ig:ig_armed_forces = {
			is_in_government = no
		}
		custom_tooltip = {
			text = caudillo_complete
			root.var:caudillo_var <= 0
		}
	}

	on_complete = {
		trigger_event = { id = caudillo.2 popup = yes }
		show_as_tooltip = {
			ig:ig_armed_forces = {
				remove_ideology = ideology_caudillismo
			}
			remove_modifier = age_of_caudillos_modifier
		}
	}

	fail = {
		ig:ig_armed_forces = {
			is_in_government = yes
		}
		custom_tooltip = {
			text = je_caudillo_goal_tt
			scope:journal_entry = {
				is_goal_complete = yes
			}
		}
	}

	on_fail = {
		trigger_event = { id = caudillo.3 popup = yes }
		show_as_tooltip = {
			add_modifier = {
				name = age_of_caudillos_modifier
				multiplier = 2
			}
		}
	}

	on_weekly_pulse = {
		effect = {
            calculate_caudillo_progress = yes
        }
	}

	on_monthly_pulse = {
		effect = {
			change_variable = { name = caudillo_var add = var:caudillo_next }
		}
		random_events = {
			# Pulse events affect the progress bar
			120 = 0 
			10 = caudillo.4
			25 = caudillo.6
		}
	}

	current_value = {
		value = root.var:caudillo_var
	}

	goal_add_value = {
		add = 1200
	}

	progressbar = yes

	weight = 100

	can_revolution_inherit = yes
	transferable = yes
	should_be_pinned_by_default = yes
}