﻿je_risorgimento = {
	icon = "gfx/interface/icons/event_icons/waving_flag.dds"
	
	group = je_group_historical_content

	is_shown_when_inactive = {
		OR = {
			country_has_primary_culture = cu:north_italian
			country_has_primary_culture = cu:south_italian
		}
		NOR = {
			is_revolutionary = yes
			is_secessionist = yes
		}
	}	
	
	scripted_button = je_risorgimento_austrian_radicals_button
	scripted_button = je_risorgimento_italian_radicals_button

	immediate = {
		set_variable = { name = italian_states_radicals_total_bar value = 0 }
		cu:north_italian = {
			save_scope_as = north_italian_scope
		}
		cu:south_italian = {
			save_scope_as = south_italian_scope
		}
		trigger_event = { id = italian_unification.10 popup = yes }
	}
		
	possible = {
		has_technology_researched = nationalism
		NOR = {
			country_tier = hegemony
			country_tier = empire
		}
	}

	complete = {
		hidden_trigger = {
			has_variable = je_unification_progress
		}
		custom_tooltip = {
			text = is_italy_tt
			c:ITA ?= this
		}
		
	}

	on_weekly_pulse = {
		events = {
			italian_unification.4
		}
		effect = {
			if = {
				limit = {
					any_scope_state = {
						state_region = {
							OR = {
								is_homeland = cu:north_italian
								is_homeland = cu:south_italian
							}
						}
					}
				}
				do_risorgimento_math = yes
			}
		}
	}

	on_monthly_pulse = {
		random_events = {
			180 = 0
			20 = italian_unification.2
		}
		effect = {
			do_risorgimento_math = yes
			if = { 
				limit = { NOT = { has_variable = je_unification_progress } } 
				set_variable = je_unification_progress
			}
		}
	}

	on_complete = {
		show_as_tooltip = {
			trigger_event = { id = italian_unification.1 popup = yes }
		}
	}

	fail = {
		custom_tooltip = {
			text = owns_no_italian_homelands_tt
			NOT = {
				any_scope_state = {
					state_region = {
						OR = {
							is_homeland = cu:north_italian
							is_homeland = cu:south_italian
						}
					}
				}
			}
		}
	}

	current_value = {
		value = root.var:italian_states_radicals_total_bar
	}

	goal_add_value = {
		add = 25
	}

	progressbar = yes

	weight = 100

	should_be_pinned_by_default = yes
}