#Tags
is_relavent_tag = {
	#Determines If A Nation Is Relavent To Content
	OR = {
		has_content_tag = yes
		has_skeleton_tag = yes
	}
}

has_content_tag = {
	#Has Full Content Available
	OR = {
		tag = SOV
		tag = USA
		USA_is_civil_war_faction = yes
		tag = JAP
		tag = PRC
		tag = FRA
		tag = GER
		tag = FPR
		tag = UKR
	}
}

has_skeleton_tag = {
	#Has Skeleton Content Or Is Important To A Full Content Tag
	#COUNTRIES BLANKED OUT DO NOT NEED TO PRODUCE DIVISIONS
	OR = {
		tag = ENG		#Sad
		tag = PLD
		tag = AST
		tag = ITA
		tag = CHI
		tag = PRK
		tag = KOR
		tag = SAF
		tag = SAU
		tag = SER
		tag = BLR
		#tag = HOL
		#tag = POR
		#tag = SPR
		tag = MEX
		tag = EGY
		tag = HRL
		tag = PER
		tag = ETH
		tag = TZN
		tag = COG
		tag = SUD
		tag = SYR
		tag = ISR
		tag = NOV
		tag = NIC
		#tag = ELS
		#tag = SWE
		#tag = NOR
		tag = TUR
		tag = GRE
		#tag = HUN
		tag = RAJ
		tag = PAK
		tag = ERI
		tag = RCG
		tag = DJI
		tag = CAR
		tag = CPC
		#tag = CHA
		tag = MLI
		tag = NGA
		tag = MRT
		tag = MOR
		tag = ALG
		tag = TUN
		#tag = UAE
		tag = CMR
		tag = IVO
		tag = NMB
		tag = INS
		tag = CAN
		#tag = SLO
		tag = ROM
		#tag = BUL
		#tag = LIT
		#tag = LAT
		#tag = EST
		#tag = CZE
		#tag = AUS
		#tag = ALB
		#tag = KOS
		#tag = MOL
		tag = TAL
	}
}

#Government
has_totalitarian_government = {
	OR = {
		has_government = totalitarian_socialist
		has_government = communist
		has_government = national_socialist
		has_government = fascist
		has_government = nationalist
	}
}

has_democratic_form_of_government = {
	OR = {
		has_government = social_democrat
		has_government = social_liberal
		has_government = market_liberal
		has_government = conservative
		has_government = authoritarian_democrat
	}
}

has_ruling_party_popularity_less_than = {
	OR = {
		AND = {
			has_government = totalitarian_socialist
			totalitarian_socialist < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = communist
			communist < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = libertarian_socialist
			libertarian_socialist < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = social_democrat
			social_democrat < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = social_liberal
			social_liberal < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = market_liberal
			market_liberal < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = conservative
			conservative < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = authoritarian_democrat
			authoritarian_democrat < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = nationalist
			nationalist < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = fascist
			fascist < ruling_popularity_trigger_temp
		}
		AND = {
			has_government = national_socialist
			national_socialist < ruling_popularity_trigger_temp
		}
	}
}

#Laws
non_changable_law = {
	custom_trigger_tooltip = {
		tooltip = non_changable_law_trigger_tooltip
		has_country_flag = manual_law_change_allowed
	}
}

development = {
	custom_trigger_tooltip = {
		tooltip = development_trigger_tooltip
		has_country_flag = manual_development_change_allowed
	}
}

head_minister_trigger = {
	custom_trigger_tooltip = {
		tooltip = head_minister_trigger_tooltip
		has_country_flag = manual_head_minister_change_allowed
	}
}

generic_has_corona = {
	OR = {
		has_idea = lower_covid_cases
		has_idea = low_covid_cases
		has_idea = medium_covid_cases
		has_idea = high_covid_cases
		has_idea = higher_covid_cases
	}
}

generic_not_has_corona = {
	NOT = {
		has_idea = lower_covid_cases
		has_idea = low_covid_cases
		has_idea = medium_covid_cases
		has_idea = high_covid_cases
		has_idea = higher_covid_cases
	}
}

has_mask_supply_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_mask_supply_greater_than_or_equals_tooltip
		check_variable = {
			var = mask_supply_var
			value = mask_supply_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_legit_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_legit_greater_than_or_equals_tooltip
		check_variable = {
			var = legit_var
			value = legit_var_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

is_completed_by_event = {
	custom_trigger_tooltip = {
		tooltip = completed_by_event_tooltip
		always = no
	}
}

#War Support
has_unsupported_economic_law = {
	if = {
		limit = {
			has_idea = early_mobilization
		}
		has_idea = early_mobilization
		has_war_support < 0.15
	}
	else_if = {
		limit = {
			has_idea = partial_mobilization
		}
		has_idea = partial_mobilization
		has_war_support < 0.25
	}
	else_if = {
		limit = {
			has_idea = war_mobilization
		}
		has_idea = war_mobilization
		has_war_support < 0.5
	}
	else_if = {
		limit = {
			has_idea = total_mobilization
		}
		has_idea = total_mobilization
		has_war_support < 0.8
	}
	else = {
		always = no
	}
}

has_unsupported_manpower_law = {
	if = {
		limit = {
			has_idea = low_conscription
		}
		has_idea = low_conscription
		has_war_support < 0.1
	}
	else_if = {
		limit = {
			has_idea = medium_conscription
		}
		has_idea = medium_conscription
		has_war_support < 0.2
		NOT = {
			has_totalitarian_government = yes
		}
	}
	else_if = {
		limit = {
			has_idea = high_conscription
		}
		has_idea = high_conscription
		has_war_support < 0.6
		NOT = {
			has_totalitarian_government = yes
		}
	}
	else_if = {
		limit = {
			has_idea = higher_conscription
		}
		has_idea = higher_conscription
		has_war_support < 0.7
		NOT = {
			has_totalitarian_government = yes
		}
	}
	else_if = {
		limit = {
			has_idea = highest_conscription
		}
		has_idea = highest_conscription
		has_war_support < 0.85
		NOT = {
			has_totalitarian_government = yes
		}
	}
	else = {
		always = no
	}
}

#Development
has_academic_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_academic_development_greater_than_or_equals_tooltip
		check_variable = {
			var = academic_development_var
			value = academic_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_farming_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_farming_development_greater_than_or_equals_tooltip
		check_variable = {
			var = farming_development_var
			value = farming_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_poverty_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_poverty_development_greater_than_or_equals_tooltip
		check_variable = {
			var = poverty_development_var
			value = poverty_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_industrial_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_industrial_development_greater_than_or_equals_tooltip
		check_variable = {
			var = industrial_development_var
			value = industrial_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_military_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_military_development_greater_than_or_equals_tooltip
		check_variable = {
			var = military_development_var
			value = military_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

has_society_development_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_society_development_greater_than_or_equals_tooltip
		check_variable = {
			var = society_development_var
			value = society_development_trigger_temp
			compare = greater_than_or_equals
		}
	}
}

#Economy
has_income_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_income_greater_than_or_equals_tooltip
		check_variable = {
			var = income_var
			value = income_trigger_temp_var
			compare = greater_than_or_equals
		}
	}
}

has_debt_greater_than_or_equals = {
	custom_trigger_tooltip = {
		tooltip = has_debt_greater_than_or_equals_tooltip
		check_variable = {
			var = debt_var
			value = debt_trigger_temp_var
			compare = greater_than_or_equals
		}
	}
}

has_income_with_inflation_greater_than_or_equals = {
	set_temp_variable = {
		var = income_factor_trigger_temp_var
		value = income_trigger_temp_var
	}
	multiply_temp_variable = {
		var = income_factor_trigger_temp_var
		value = inflation_var
	}
	add_to_temp_variable = {
		var = income_trigger_temp_var
		value = income_factor_trigger_temp_var
	}
	custom_trigger_tooltip = {
		tooltip = has_income_greater_than_or_equals_tooltip
		check_variable = {
			var = income_var
			value = income_trigger_temp_var
			compare = greater_than_or_equals
		}
	}
}

has_debt_with_inflation_greater_than_or_equals = {
	set_temp_variable = {
		var = debt_factor_trigger_temp_var
		value = debt_trigger_temp_var
	}
	multiply_temp_variable = {
		var = debt_factor_trigger_temp_var
		value = inflation_var
	}
	add_to_temp_variable = {
		var = debt_trigger_temp_var
		value = debt_factor_trigger_temp_var
	}
	custom_trigger_tooltip = {
		tooltip = has_debt_greater_than_or_equals_tooltip
		check_variable = {
			var = debt_var
			value = debt_trigger_temp_var
			compare = greater_than_or_equals
		}
	}
}

#Misc
has_campaign_slot = {
	custom_trigger_tooltip = {
		tooltip = has_campaign_slot_trigger_tooltip
		check_variable = {
			var = campaign_slot_var
			value = 1
			compare = greater_than_or_equals
		}
	}
}

has_disabled_ideas = {
	if = {
		limit = {
			check_variable = {
				var = modifier@disabled_ideas
				value = 1
				compare = equals
			}
		}
		custom_trigger_tooltip = {
			tooltip = has_disabled_ideas_tooltip
			NOT = {
				check_variable = {
					var = modifier@disabled_ideas
					value = 1
					compare = equals
				}
			}
		}
	}
}

has_achievements_enabled = {
	is_ironman = yes
	has_any_custom_difficulty_setting = no
	game_rules_allow_achievements = yes
	has_start_date < 2020.01.02
	NOT = {
		difficulty < 1
	}
	is_debug = no
	is_ai = no
}

# requires a temp variable coalition_target
has_coalition_with_target = {
	custom_trigger_tooltip = {
		tooltip = has_coalition_with_target
		has_variable = is_in_coalition_with_@var:coalition_target
	}
}

is_in_coalition = {
	OR = {
		is_in_coalition_with_authoritarian_democrat = yes
		is_in_coalition_with_communist = yes
		is_in_coalition_with_conservative = yes
		is_in_coalition_with_fascist = yes
		is_in_coalition_with_libertarian_socialist = yes
		is_in_coalition_with_market_liberal = yes
		is_in_coalition_with_national_socialist = yes
		is_in_coalition_with_nationalist = yes
		is_in_coalition_with_social_democrat = yes
		is_in_coalition_with_social_liberal = yes
		is_in_coalition_with_totalitarian_socialist = yes
	}
}

is_in_coalition_with_totalitarian_socialist = {
	set_temp_variable = {
		coalition_target = token:totalitarian_socialist
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_communist = {
	set_temp_variable = {
		coalition_target = token:communist
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_libertarian_socialist = {
	set_temp_variable = {
		coalition_target = token:libertarian_socialist
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_social_democrat = {
	set_temp_variable = {
		coalition_target = token:social_democrat
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_social_liberal = {
	set_temp_variable = {
		coalition_target = token:social_liberal
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_market_liberal = {
	set_temp_variable = {
		coalition_target = token:market_liberal
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_conservative = {
	set_temp_variable = {
		coalition_target = token:conservative
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_authoritarian_democrat = {
	set_temp_variable = {
		coalition_target = token:authoritarian_democrat
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_nationalist = {
	set_temp_variable = {
		coalition_target = token:nationalist
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_fascist = {
	set_temp_variable = {
		coalition_target = token:fascist
	}
	has_coalition_with_target = yes
}

is_in_coalition_with_national_socialist = {
	set_temp_variable = {
		coalition_target = token:national_socialist
	}
	has_coalition_with_target = yes
}

can_ROOT_get_wargoal_on_THIS = {
	exists = yes
	NOT = {
		is_in_faction_with = ROOT
	}
	NOT = {
		is_subject_of = ROOT
	}
}

is_border_conflict_defender_vs_FROM = {
	has_variable = ROOT.defender_state_vs_@FROM
}

has_not_initiated_border_incident_with_FROM = {
	custom_trigger_tooltip = {
		tooltip = not_initiated_border_incident_with_FROM
		NOT = {
			any_state = {
				check_variable = {
					FROM.defender_state_vs_@PREV = id
				}
			}
		}
	}
}

has_not_initiated_border_incident_with_ROOT = {
	custom_trigger_tooltip = {
		tooltip = not_initiated_border_incident_with_ROOT
		NOT = {
			any_state = {
				check_variable = {
					ROOT.defender_state_vs_@PREV = id
				}
			}
		}
	}
}

is_able_to_nuke_trigger = {
	is_controlled_by_ROOT_or_ally = no
}

#State scope
has_ROOT_at_least_1_div_in_current_state_scope = {
	custom_trigger_tooltip = {
		tooltip = at_least_one_division_in_state
		ROOT = {
			divisions_in_state = {
				state = PREV
				size > 0
			}
		}
	}
}

#State scope
is_controlled_by_ROOT_or_subject = {
	custom_trigger_tooltip = {
		tooltip = is_controlled_by_ROOT_or_subject
		CONTROLLER = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

#Country scope
is_free_or_subject_of_root = {
	OR = {
		is_subject = no
		is_subject_of = ROOT
	}
}

#State scope
is_controlled_by_ROOT_or_ally = {
	custom_trigger_tooltip = {
		tooltip = is_controlled_by_ROOT_or_ally
		CONTROLLER = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
				is_in_faction_with = ROOT
			}
		}
	}
}

ai_air_doctrine_tier_1_trigger = {
	OR = {
		has_tech = naval_strike_tactics
		has_tech = direct_ground_support
		#has_tech = low_echelon_support
	}
}

ai_air_doctrine_tier_2_trigger = {
	OR = {
		has_tech = multialtitude_flying
		has_tech = hunt_and_destroy
		#has_tech = operational_destruction
	}
}

ai_air_doctrine_tier_3_trigger = {
	OR = {
		has_tech = air_offense
		has_tech = naval_strike_torpedo_tactics
		has_tech = offensive_formations
	}
}

ai_land_doctrine_tier_1_trigger = {
	OR = {
		has_tech = elastic_defence
		has_tech = defence_in_depth
	}
}

ai_land_doctrine_tier_2_trigger = {
	OR = {
		has_tech = kampfgruppe
		has_tech = mechanised_offensive
		has_tech = vast_offensives
		has_tech = large_front_offensive
	}
}

enemy_has_equal_or_better_radar_tech_trigger = {
	custom_trigger_tooltip = {
		tooltip = enemy_has_equal_or_better_radar_tech_trigger_tt
		if = {
			limit = {
				ROOT = {
					has_tech = radio_detection
					NOT = {
						has_tech = decimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = radio_detection
					has_tech = decimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = decimetric_radar
					NOT = {
						has_tech = improved_decimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = decimetric_radar
					has_tech = improved_decimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = improved_decimetric_radar
					NOT = {
						has_tech = centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = improved_decimetric_radar
					has_tech = centimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = centimetric_radar
					NOT = {
						has_tech = improved_centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = centimetric_radar
					has_tech = improved_centimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = improved_centimetric_radar
					NOT = {
						has_tech = advanced_centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = improved_centimetric_radar
					has_tech = advanced_centimetric_radar
				}
			}
		}
		#no more steps needed because end of research tree is reached
	}
}

is_available_to_collaboration_government = {
	# occupied_countries.1 should be updated along with this
	NOT = {
		AND = {
			FROM = {
				original_tag = YUG
			}
			original_tag = ITA
		}
		AND = {
			FROM = {
				original_tag = DNZ
			}
			original_tag = POL
		}
		#TUR_cannot_form_kurdish_collaboration_government = yes
		any_country_with_original_tag = {
			original_tag_to_check = FROM
			is_puppet_of = PREV			# if already created one do not create another
			has_autonomy_state = autonomy_collaboration_government
		}
	}
}

has_large_ally_not_pick_closed_economy = {
	any_of_scopes = {
		array = faction_members
		NOT = {
			tag = PREV
		}
		num_of_military_factories > 30
	}
}

owns_or_subject_of = {
	custom_trigger_tooltip = {
		tooltip = owns_or_subject_of_tt
		owner = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

controls_or_subject_of = {
	custom_trigger_tooltip = {
		tooltip = controls_or_subject_of_tt
		controller = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

is_core_or_compliance_60 = {
	custom_trigger_tooltip = {
		tooltip = is_core_or_compliance_60_tt
		OR = {
			controller = {
				PREV = {
					is_core_of = PREV
				}
			}
			compliance > 60
		}
	}
}

is_controlled_by_SOV_or_ally = {
	custom_trigger_tooltip = {
		CONTROLLER = {
			OR = {
				tag = SOV
				is_subject_of = SOV
				is_in_faction_with = SOV
			}
		}
	}
}

is_controlled_by_GER_or_ally = {
	custom_trigger_tooltip = {
		CONTROLLER = {
			OR = {
				tag = GER
				is_subject_of = GER
				is_in_faction_with = GER
			}
		}
	}
}

has_same_ideology = {
	custom_trigger_tooltip = {
		tooltip = has_same_ideology_tt
		OR = {
			AND = {
				has_government = totalitarian_socialist
				ROOT = {
					has_government = totalitarian_socialist
				}
			}
			AND = {
				has_government = communist
				ROOT = {
					has_government = communist
				}
			}
			AND = {
				has_government = libertarian_socialist
				ROOT = {
					has_government = libertarian_socialist
				}
			}
			AND = {
				has_government = social_democrat
				ROOT = {
					has_government = social_democrat
				}
			}
			AND = {
				has_government = social_liberal
				ROOT = {
					has_government = social_liberal
				}
			}
			AND = {
				has_government = market_liberal
				ROOT = {
					has_government = market_liberal
				}
			}
			AND = {
				has_government = conservative
				ROOT = {
					has_government = conservative
				}
			}
			AND = {
				has_government = authoritarian_democrat
				ROOT = {
					has_government = authoritarian_democrat
				}
			}
			AND = {
				has_government = nationalist
				ROOT = {
					has_government = nationalist
				}
			}
			AND = {
				has_government = fascist
				ROOT = {
					has_government = fascist
				}
			}
			AND = {
				has_government = national_socialist
				ROOT = {
					has_government = national_socialist
				}
			}
		}
	}
}

has_specialist_level_trigger = {
	skill > 5
	skill < 6
}

has_expert_level_trigger = {
	skill > 6
	skill < 7
}

has_genius_level_trigger = {
	skill > 7
}

is_major_not_original_tag_root = {
	is_major = yes
	hidden_trigger = {
		NOT = {
			original_tag = ROOT
		}
	}
}

has_subject_autonomy_feature = {
	has_dlc = "Together for Victory"
	#TODO_Manu: More DLCs?
}

has_tech_sharing_feature = {
	OR = {
		has_dlc = "Together for Victory"
		has_dlc = "Death or Dishonor"
		has_dlc = "Waking the Tiger"
		has_dlc = "La Resistance"
	}
}

has_war_with_non_exiled_country = {
	custom_trigger_tooltip = {
		tooltip = has_war_with_non_exiled_country_tt
		has_war = yes
		any_enemy_country = {
			is_government_in_exile = no
		}
	}
}

is_at_peace_exiled_countries_excluded = {
	custom_trigger_tooltip = {
		tooltip = is_at_peace_exiled_countries_excluded_tt
		NOT = {
			any_enemy_country = {
				is_government_in_exile = no
			}
		}
	}
}

#State scope
state_is_fully_controlled_by_ROOT_or_subject = {
	custom_trigger_tooltip = {
		tooltip = state_is_fully_controlled_by_ROOT_or_subject_tt
		OR = {
			is_fully_controlled_by = ROOT
			controller = {
				is_subject_of = ROOT
				has_full_control_of_state = PREV
			}
		}
	}
}

state_has_any_resource = {
	OR = {
		has_resources_amount = {
			resource = oil
			amount > 0
		}
		has_resources_amount = {
			resource = aluminium
			amount > 0
		}
		has_resources_amount = {
			resource = rubber
			amount > 0
		}
		has_resources_amount = {
			resource = tungsten
			amount > 0
		}
		has_resources_amount = {
			resource = steel
			amount > 0
		}
		has_resources_amount = {
			resource = chromium
			amount > 0
		}
	}
}

country_can_be_reasonable_target_of_wargoal = {
	#Expected scopes: Target country is THIS, country getting wargoal is PREV
	NOT = {
		has_war_with = ROOT
		is_in_faction_with = PREV
		has_guaranteed = PREV
		is_guaranteed_by = PREV
		has_non_aggression_pact_with = PREV
		is_subject_of = PREV
	}
}

big_communist_exists = {
	any_other_country = {
		is_major = yes
		OR = {
			has_government = totalitarian_socialist
			has_government = communist
			has_government = libertarian_socialist
		}
		has_capitulated = no
		exists = yes
	}
}

big_fascist_exists = {
	any_other_country = {
		is_major = yes
		OR = {
			has_government = nationalist
			has_government = fascist
			has_government = national_socialist
		}
		has_capitulated = no
		exists = yes
	}
}

has_lar = {
	has_dlc = "La Resistance"
}

has_mtg = {
	has_dlc = "Man the Guns"
}

# has_hide_rule = {
# 	has_game_rule = {
# 		rule = obsolete_focus_branches_visibility
# 		option = HIDE
# 	}
# }

has_aat = {
	has_dlc = "Arms Against Tyranny"
}

has_any_tank_tech = {
	if = {
		limit = {
			has_dlc = "No Step Back"
		}
		OR = {
			has_tech = basic_medium_tank_chassis
			has_tech = basic_light_tank_chassis
		}
	}
	else = {
		OR = {
			has_tech = main_battle_tank1
			has_tech = light_tank1
		}
	}
}

has_any_tanks = {
	if = {
		limit = {
			has_dlc = "No Step Back"
		}
		OR = {
			has_equipment = {
				light_tank_chassis_0 > 0
			}
			has_equipment = {
				medium_tank_chassis > 0
			}
			has_equipment = {
				light_tank_chassis > 0
			}
			has_equipment = {
				heavy_tank_chassis > 0
			}
			has_equipment = {
				modern_tank_chassis > 0
			}
		}
	}
	else = {
		OR = {
			has_equipment = {
				gw_tank_equipment > 0
			}
			has_equipment = {
				light_tank_equipment_1 > 0
			}
			has_equipment = {
				light_tank_equipment_2 > 0
			}
			has_equipment = {
				light_tank_equipment_3 > 0
			}
			has_equipment = {
				medium_tank_equipment_1 > 0
			}
			has_equipment = {
				medium_tank_equipment_2 > 0
			}
			has_equipment = {
				medium_tank_equipment_3 > 0
			}
			has_equipment = {
				modern_tank_equipment_1 > 0
			}
			has_equipment = {
				heavy_tank_equipment_1 > 0
			}
			has_equipment = {
				heavy_tank_equipment_2 > 0
			}
			has_equipment = {
				heavy_tank_equipment_3 > 0
			}
			has_equipment = {
				super_heavy_tank_equipment_1 > 0
			}
		}
	}
}

mio_original_country_exists_and_not_at_war_with_ROOT = {
	#Used for MIO decisions visibility - THIS is original country
	exists = yes
	has_capitulated = no
	NOT = {
		has_war_with = ROOT
	}
}

can_unlock_new_special_forces_tree = {
	if = {
		limit = {
			NOT = {
				has_variable = sf_trees
			}
		}
		custom_trigger_tooltip = {
			tooltip = can_unlock_new_special_forces_tree_none
			NOT = {
				has_variable = sf_trees
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				sf_trees > 0
			}
		}
		custom_trigger_tooltip = {
			tooltip = can_unlock_new_special_forces_tree_more_yes
			check_variable = {
				sf_trees > 0
			}
		}
	}
	else = {
		custom_trigger_tooltip = {
			tooltip = can_unlock_new_special_forces_tree_more_no
			always = no
		}
	}
}

# These are to make strength comparisons easier 
FROM_is_stronger = {
	strength_ratio = {
		tag = FROM
		ratio < 1
	}
}

FROM_is_twice_as_strong = {
	strength_ratio = {
		tag = FROM
		ratio < 0.5
	}
}

FROM_is_weaker = {
	strength_ratio = {
		tag = FROM
		ratio > 1
	}
}

FROM_is_twice_as_weak = {
	strength_ratio = {
		tag = FROM
		ratio > 2
	}
}

ai_has_completed_army_doctrine = {
	is_ai = yes
	OR = {
		has_tech = werwolf_guerillas
		has_tech = modern_blitzkrieg
		# has_tech = air_land_battle
		# has_tech = shock_and_awe
		# has_tech = c3i_theory
		# has_tech = infiltration_in_depth
		has_tech = continuous_offensive
		has_tech = guerilla_warfare
	}
}

ai_has_completed_air_doctrine = {
	is_ai = yes
	OR = {
		has_tech = offensive_formations
		has_tech = air_offense
		has_tech = forward_interception
		#has_tech = high_level_bombing
	}
}

ai_has_completed_naval_doctrine = {
	is_ai = yes
	OR = {
		has_tech = grand_battlefleet
		has_tech = submarine_offensive
		has_tech = floating_airfield
		has_tech = combined_operations_raiding
		has_tech = integrated_convoy_defence
		has_tech = submarine_offensive_bs
		has_tech = carrier_battlegroups
	}
}

anti_submarine_strategy_required_trigger = {
	convoy_threat > 0.3
}
