#	Example:
# 
#	example_trigger = {
#		tag = GER
#		is_ai = no
#	}
#
#
#	In a script file:
#
#	trigger = {
#		exampel_trigger = yes
#	}
# 

ITA_missiolinis_system_available = {
	hidden_trigger = {
		has_country_flag = ITA_missiolinis_system_active_flag
	}
	has_country_leader = {
		character = ITA_benito_mussolini
		ruling_only = yes
	}
}

ITA_missiolinis_cd_ready = {
	NOT = { has_country_flag = ITA_missiolini_activated_recently_flag }
}

ITA_missiolinis_can_have_a_new_mission = {
	check_variable = { ITA_missiolinis_active_missions = 2 compare = less_than_or_equals }
}

ITA_has_missiolini_easier_goals = {
	has_completed_focus = ITA_boost_the_grand_council_of_fascism
}

ITA_missiolinis_weigh_mussolini_esta_flipado = {
	has_completed_focus = ITA_to_live_as_a_lion
}

ITA_missiolinis_weigh_mussolini_feels_invincible = {
	check_variable = { ITA_missiolinis_successful_missions = 12 compare = greater_than_or_equals }
}

ITA_missiolinis_weigh_mussolini_feels_safe = {
	surrender_progress < 0.01
}

ETH_is_in_exile = { #Add any more stuff needed here
	ETH = {
		is_government_in_exile = yes
	}
}

ITA_is_italian_colony = { #State scope
	OR = {
		is_core_of = ERI
		is_core_of = LBA
		is_core_of = SOM
		is_core_of = ETH
	}
}

ITA_is_antifascist_civil_war_over = {
	has_global_flag = ITA_antifascist_civil_war_triggered_flag
	has_civil_war = no
}

ITA_cw_branches_are_visible = {
	has_global_flag = ITA_antifascist_civil_war_triggered_flag
	OR = {
		tag = RDS
		tag = RSI
	}
}

ITA_is_compatible_spanish_tag = { #THIS is Spanish tag, ROOT is ITA
	OR = { #Nationalist Spain
		AND = {
			tag = SPA
			ROOT = { has_government = fascism }
		}
		AND = { #Carlists
			tag = SPB
			ROOT = { has_government = neutrality }
		}
		AND = {
			tag = SPD
			OR = {
				ROOT = { has_government = democratic }
				ROOT = { has_government = communism }
			}
		}
	}
}

ITA_has_foreign_affairs_or_nice_guy_hired = {
	original_tag = ITA
	OR = {
		has_idea = ITA_gian_galeazzo_ciano #Ciano as Foreign Affairs Minister
		has_dino_grandi = yes #Grandi as advisor or country leader
	}
}

ITA_is_ruled_by_a_monarchy = {
	OR = {
		has_country_leader = {
			character = ITA_vittorio_emanuele_iii
			ruling_only = yes
		}
		has_country_leader = {
			character = ITA_prince_umberto
			ruling_only = yes
		}
	}
}

ITA_is_ruled_by_a_pope = {
	custom_trigger_tooltip = {
		tooltip = ITA_is_ruled_by_a_pope_tt
		OR = {
			has_country_leader = {
				character = ITA_papa_pio_xi
				ruling_only = yes
			}
			has_country_leader = {
				character = ITA_papa_pio_xii
				ruling_only = yes
			}
		}
	}
}

ITA_is_protestant_or_orthodox_country_in_europe_for_pope = {
	OR = {
		#"PROTESTANTS"
		original_tag = ENG
		original_tag = DEN
		original_tag = NOR
		original_tag = SWE
		original_tag = FIN
		original_tag = GER
		original_tag = HOL
		original_tag = LAT
		original_tag = LIT
		#ORTHODOX / MUSLIM
		original_tag = EST
		original_tag = SOV
		original_tag = ALB
		original_tag = GRE
		original_tag = ROM
		original_tag = BUL
		original_tag = YUG
		original_tag = SER
		original_tag = MNT
		original_tag = KOS
		original_tag = BOS
		original_tag = HRZ
		original_tag = MAC
		original_tag = TRA
		original_tag = MOL
		original_tag = UKR
		original_tag = BLR
		original_tag = CRI
		original_tag = KAR
	}
}

ITA_has_disbanded_blackshirts = {
	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		custom_trigger_tooltip = {
			tooltip = ITA_has_disbanded_blackshirts_tt
			has_completed_focus = ITA_disband_the_blackshirts
		}
	}
	else = {
		hidden_trigger = {
			always = no
		}
	}
}

ITA_government_is_really_fascist = {
	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		NOT = {
			has_completed_focus = ITA_defy_the_duce
			has_completed_focus = ITA_disband_the_blackshirts
			has_completed_focus = ITA_crush_opposition
			has_government = communism
		}
	}
	else = {
		has_government = fascism
	}
}

ITA_government_is_somewhat_fascist = {
	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		OR = {
			has_government = fascism
			has_completed_focus = ITA_utilize_the_blackshirts
		}
	}
	else = {
		OR = {
			has_government = fascism
			has_government = neutrality
		}
	}
}

ITA_is_going_antifascist_in_bba = {
	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		OR = {
			has_completed_focus = ITA_unite_the_opposition
			has_completed_focus = ITA_defy_the_duce
		}
	}
}

ITA_is_in_liberation_war = {
	custom_trigger_tooltip = {
		tooltip = ITA_is_in_liberation_war_tt
		has_completed_focus = ITA_the_italian_liberation_war
	}
}

ITA_is_valid_free_states_of_europe_target = {
	has_government = democratic
	is_in_faction = no
	is_subject = no
	NOT = { has_war_with = ROOT }
	OR = {
		original_tag = FRA
		original_tag = SPR
		original_tag = POR
		original_tag = SWI
		original_tag = AUS
		original_tag = YUG
		original_tag = SER
		original_tag = CRO
		original_tag = MNT
		original_tag = BOS
		original_tag = KOS
		original_tag = GRE
		original_tag = ALB
		original_tag = TUR
		AND = {
			OR = {
				original_tag = GER
				original_tag = BUL
				original_tag = ROM
				original_tag = HUN
				original_tag = CZE
				original_tag = SLO
				original_tag = SLV
				original_tag = MAC
				original_tag = TRA
				original_tag = LUX
				original_tag = BEL
				original_tag = HOL
				original_tag = POL
			}
			is_neighbor_of = ROOT
		}
	}
}

ITA_state_is_in_north_africa = { #West/East Maghreb + Tripoli + Egypt + Upper Nile
	OR = {
		region = 182 #WESTERN MAGHREB
		region = 126 #EASTERN MAGHREB
		region = 225 #TRIPOLI
		region = 128 #EGYPT
		region = 216 #UPPER NILE
	}
}

ITA_state_is_in_east_africa = { #Danakil + ETH Highlands + Ogaden + Lake Victoria + SE Africa + Madagascar
	is_on_continent = africa
	OR = {
		region = 273 #DANAKIL
		region = 17 #ETHIOPIAN HIGHLANDS
		region = 274 #OGADEN
		region = 217 #LAKE VICTORIA
		region = 185 #SOUTH EAST AFRICA
		region = 181 #MADAGASCAR
	}
}

ITA_state_is_in_west_africa = { #West Africa + Sub-Saharian Africa
	is_on_continent = africa
	OR = {
		region = 226 #WEST AFRICA
		region = 140 #SUB-SAHARIAN AFRICA
	}
}

ITA_state_is_in_central_africa = { #Cameroon + Central Africa + W Congo + NE Congo + SE Congo + Angola
	is_on_continent = africa
	OR = {
		region = 184 #CAMEROON
		region = 183 #CENTRAL AFRICA
		region = 272 #WEST CONGO
		region = 227 #NORTH EAST CONGO
		region = 271 #SOUTH EAST CONGO
		region = 224 #ANGOLA
	}
}

ITA_state_is_in_south_africa = { #Namibia + Zambezi + South Africa
	is_on_continent = africa
	OR = {
		region = 215 #NAMIBIA
		region = 223 #ZAMBEZI
		region = 139 #SOUTH EAST AFRICA
		region = 181 #MADAGASCAR
	}
}

ITA_state_is_in_middle_east = { #Levant + Middle East + Hejaz + Central Arabia + S Arabia + E Arabia + Asia Minor
	is_on_continent = middle_east
}

ITA_state_is_in_asia = {
	is_on_continent = asia
}

ITA_state_is_in_latin_america = {
	OR = {
		is_on_continent = south_america
		is_core_of = MEX
	}
}

ITA_state_is_in_north_america = { #Not Mexico
	OR = {
		is_on_continent = north_america
		NOT = { is_core_of = MEX }
	}
}

ITA_state_is_in_oceania = {
	is_on_continent = australia
}

ITA_is_northern_designer = { #Only meant to be used for tooltip purposes
	custom_trigger_tooltip = {
		tooltip = ITA_northern_designer_tt
		hidden_trigger = {
			always = yes	
		}
	}
}

ITA_is_southern_designer = { #Only meant to be used for tooltip purposes
	custom_trigger_tooltip = {
		tooltip = ITA_southern_designer_tt
		hidden_trigger = {
			always = yes	
		}
	}
}

ITA_is_northern_designer_improved = { #Only meant to be used for tooltip purposes
	custom_trigger_tooltip = {
		tooltip = ITA_northern_designer_improved_tt
		hidden_trigger = {
			always = yes	
		}
	}
}

ITA_is_southern_designer_improved = { #Only meant to be used for tooltip purposes
	custom_trigger_tooltip = {
		tooltip = ITA_southern_designer_improved_tt
		hidden_trigger = {
			always = yes	
		}
	}
}

ITA_has_rejected_monarchy = { # Used to change NS names from Regio/a to something not referencing monarchy
	OR = {
		has_government = communism
		AND = {
			has_government = democratic
			has_completed_focus = ITA_the_italian_republic
		}
		has_completed_focus = ITA_capo_supremo
		tag = RSI
	}
}

ITA_basic_ultimatum_triggers = { #Used in foreign politics targeted decs - Expected Scope: ROOT = ITA // FROM = Target
	country_exists = FROM
	FROM = {
		NOT = { has_war_with = ROOT }
		NOT = { is_in_faction_with = ROOT } #CAN'T SEND ULTIMATUMS TO ALLIES OR SUBJECTS
		NOT = { is_subject_of = FROM }
		NOT = { has_country_flag = ITA_ultimatum_sent_flag }
	}
}

ITA_has_peaced_out_eth_on_startup = {
	hidden_trigger = {
		has_global_flag = ITA_peace_with_eth_on_startup_flag
	}
}

ITA_state_has_any_version_of_mafia_rising_modifier = {
	OR = {
		has_dynamic_modifier = { modifier = ITA_mafia_on_the_rise_no_lar }
		has_dynamic_modifier = { modifier = ITA_mafia_on_the_rise }
	}
}

ITA_is_advisor_available = {
	is_country_leader = no
	NOT = { has_character_flag = ITA_has_new_duce_flag }
}

ITA_is_italian_tag = {
	OR = {
		original_tag = ITA
		tag = RDS
		tag = RSI
	}
}

#################
### CIVIL WAR ###
#################
ITA_is_southern_state_for_cw = {
	OR = {
		state = 115 #SICILIA
		state = 156 #CALABRIA
		state = 117 #CAMPANIA (Napoli)
		state = 849 #PUGLIA
	}
}

ITA_is_centre_state_for_cw = {
	OR = {
		state = 2 #LATIUM (Roma)
		state = 157 #ABRUZZO
	}
}

ITA_is_north_western_state_for_cw = {
	OR = {
		state = 162 #TOSCANA
		state = 158 #PIEMONTE
	}
}

ITA_is_north_eastern_state_for_cw = {
	OR = {
		state = 161 #EMILIA ROMAGNA
		state = 160 #VENETO
		state = 736 #LITORALE
		state = 852 #ISTRIA
	}
}

#Used to change name of States and VPs when appropriate. Expected to be used inside on_state_control_changed. FROM.FROM is state / ROOT is new controller / FROM is former controller
ITA_state_or_vp_name_should_change = {
	OR = {
		AND = {
			ROOT = { original_tag = ITA }
			NOT = { FROM = { original_tag = ITA } } #Not civil wars
		}
		AND = {
			FROM = { original_tag = ITA }
			NOT = { ROOT = { original_tag = ITA } } #Not civil wars
		}
	}
	OR = {
		FROM.FROM = { state = 852 } # ISTRIA (Fiume / Rijeka)
		FROM.FROM = { state = 163 } # ZARA / ZADAR // (Zara / Zadar)
		FROM.FROM = { state = 164 } # DODECANESO / DODECANESE // (Rodi / Rhodes)
	}
}

has_dino_grandi = {
	has_country_leader = {
		character = ITA_dino_grandi
		ruling_only = yes
	}
	has_idea = ITA_dino_grandi
}

ITA_is_kinda_fascist = {
	OR = {
		has_government = fascism
		has_government = neutrality
		if = {
			limit = {
				has_dlc = "By Blood Alone"
			}
			custom_trigger_tooltip = {
				tooltip = ITA_is_constitutional_monarchy_tt
				AND = {
					has_government = democratic
					OR = {
						has_completed_focus = ITA_christian_democracy
						has_completed_focus = ITA_democratic_king
					}
				}
			}
		}
	}
}

ITA_is_anti_fascist = {
	if = {
		limit = {
			has_dlc = "By Blood Alone"
		}
		NOT = { has_government = fascism }
		NOT = { has_government = neutrality }
		NOT = {
			custom_trigger_tooltip = {
				tooltip = ITA_is_not_constitutional_monarchy_tt
				AND = {
					has_government = democratic
					OR = {
						has_completed_focus = ITA_christian_democracy
						has_completed_focus = ITA_democratic_king
					}
				}
			}
		}
	}
	else = {
		OR = {
			has_government = communism
			has_government = democratic
		}
	}
}

ITA_hosting_exiled_ethiopia = {
	OR = {
		check_variable = { ETH.host_nation = ENG }
		var:ETH.host_nation = {	is_in_faction_with = ENG }
	}
}

#A.I.#

ITA_is_historical_ai = {
	OR = {
		AND = {
			is_historical_focus_on = yes
			has_game_rule = {
				rule = ITA_ai_behavior
				option = DEFAULT
			}
		}
		has_country_flag = ITA_AI_RANDOM_FASCIST_HISTORICAL
		has_game_rule = {
			rule = ITA_ai_behavior
			option = FASCIST_HISTORICAL
		}
	}
}

ITA_is_alt_fascist_balbo_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_FASCIST_BALBO
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ALT_FASCIST_BALBO
		}
	}
}

ITA_is_alt_fascist_grandi_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_FASCIST_GRANDI
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ALT_FASCIST_GRANDI
		}
	}
}

ITA_is_monarchist_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_MONARCHIST
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ITA_MONARCHIST_ROMAN_EMPIRE
		}
	}
}

ITA_is_christian_democracy_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_CHRISTIAN_DEMOCRACY
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ITA_CHRISTIAN_DEMOCRACY
		}
	}
}

ITA_is_communist_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_COMMUNIST_PLAN
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ITA_COMMUNIST_PLAN
		}
	}
}

ITA_is_socialist_ai = {
	OR = {
		has_country_flag = ITA_AI_RANDOM_DEMOCRATIC_PLAN
		has_game_rule = {
			rule = ITA_ai_behavior
			option = ITA_DEMOCRATIC_PLAN
		}
	}
}

ITA_is_italian_tag_for_music = {
	OR = {
		original_tag = ITA
		original_tag = AOI
		original_tag = LBV
		original_tag = PAP
		original_tag = TOS
		original_tag = SPM
		original_tag = TTS
	}
}

ITA_is_appropriate_cw_side_for_character_split = {
	if = { #BoP CW
		limit = {
			NOT = { has_completed_focus = ITA_defy_the_duce }
		}
		#FASCIST
		if = {
			limit = {
				FROM = {
					#OR = {
						#has_unit_leader_flag = ITA_cw_unit_leader_fascist_side_flag
						has_character_flag = ITA_cw_character_fascist_side_flag
					#}
				}
			}
			has_country_flag = ITA_fascist_side_for_character_split_flag
			#log = "I am a FASCIST [FROM.GetName]"
			#has_government = fascism
		}
		#MONARCHIST & ANTIFASCIST
		else_if = {
			limit = {
				FROM = {
					OR = {
						#has_unit_leader_flag = ITA_cw_unit_leader_monarchist_side_flag
						has_character_flag = ITA_cw_character_monarchist_side_flag

						#has_unit_leader_flag = ITA_cw_unit_leader_antifascist_side_flag
						has_character_flag = ITA_cw_character_antifascist_side_flag
					}
				}
			}
			NOT = { has_country_flag = ITA_fascist_side_for_character_split_flag }
			#log = "I am a GOOD PERSON [FROM.GetName]"
		}
		else = {
			#log ="I have no idea what I am [FROM.GetName]"
		}

		#if = { #Cannot check for unit_leader_flags from character scope
		#	limit = {
		#		FROM = {
		#			OR = {
		#				has_unit_leader_flag = ITA_cw_unit_leader_monarchist_side_flag
		#				has_unit_leader_flag = ITA_cw_unit_leader_antifascist_side_flag
		#			}
		#		}
		#	}
		#	log = "I have a unit leader flag ([FROM.GetName])"
		#}
	}
	else = { #Anti-Fascist Focus CW
		#MONARCHIST & ANTIFASCIST
		if = {
			limit = {
				FROM = {
					OR = {
						#has_unit_leader_flag = ITA_cw_unit_leader_monarchist_side_flag
						has_character_flag = ITA_cw_character_monarchist_side_flag

						#has_unit_leader_flag = ITA_cw_unit_leader_antifascist_side_flag
						has_character_flag = ITA_cw_character_antifascist_side_flag
					}
				}
			}
			has_country_flag = ITA_antifa_side_for_character_split_flag
			#log = "I am a GOOD PERSON [FROM.GetName]"
		}
		#FASCIST
		else_if = {
			limit = {
				FROM = {
					#OR = {
						#has_unit_leader_flag = ITA_cw_unit_leader_fascist_side_flag
						has_character_flag = ITA_cw_character_fascist_side_flag
					#}
				}
			}
			NOT = { has_country_flag = ITA_antifa_side_for_character_split_flag }
			#log = "I am a FASCIST [FROM.GetName]"
			#has_government = fascism
		}
		else = {
			#log ="I have no idea what I am [FROM.GetName]"
		}
	}
}