is_major_country = {
	OR = {
		tag = ENG tag = FRA tag = SOV tag = ITA tag = CHI tag = JAP tag = USA
	}
}

is_european_country = {
	OR = {
		capital_scope = { is_on_continent = europe }
		tag = TUR
	}
}

is_asian_country = {
	OR = {
		capital_scope = { is_on_continent = asia }
		capital_scope = { is_on_continent = australia }
	}
}

is_african_country = {
	OR = {
		capital_scope = { is_on_continent = africa }
		capital_scope = { is_on_continent = middle_east }
	}
	NOT = { tag = TUR }
}

is_north_american_country = {
	OR = {
		capital_scope = { is_on_continent = north_america }
		tag = COS tag = ELS tag = GUA tag = HON tag = NIC tag = PAN tag = CUB tag = DOM tag = HAI
	}
}

is_south_american_country = {
	capital_scope = { is_on_continent = south_america }
	NOT = { 
		tag = COS tag = ELS tag = GUA tag = HON tag = NIC tag = PAN tag = CUB tag = DOM tag = HAI
	}
}

is_western_ally = {
	OR = {
		original_tag = FRA
		original_tag = ITA
		original_tag = ENG
		
		original_tag = HOL
		original_tag = BEL
		original_tag = LUX
		
		original_tag = POR
		original_tag = SPA
		
		original_tag = IRE
		original_tag = ICE

		original_tag = GRE
		original_tag = TUR
		
		capital_scope = { is_on_continent = north_america }
		capital_scope = { is_on_continent = south_america }
		capital_scope = { is_on_continent = australia }

		original_tag = SAF
		original_tag = RAJ
		original_tag = MAL
		original_tag = INS
		original_tag = PHI
	}
}

is_eastern_ally = {
	is_western_ally = no
}

is_moscow_safe = {
	SOV = {
		has_full_control_of_state = 219 # Moscow
		
		# plus all surrounding states
		has_full_control_of_state = 205 # Kaluga
		has_full_control_of_state = 223 # Tula
		has_full_control_of_state = 242 # Smolensk
		has_full_control_of_state = 246 # Rzhev
		has_full_control_of_state = 247 # Kalinin
		has_full_control_of_state = 248 # Yaroslavl
		has_full_control_of_state = 253 # Ivanovo
		has_full_control_of_state = 254 # Ryazan
	}
}

flee_mediterranean = {
	TUR = {
		OR = {
			has_capitulated = yes
			surrender_progress > 0.5
		}
	}
	
	OR = {
		SPA = {
			exists = yes
			OR = {
				has_capitulated = yes
				surrender_progress > 0.5
			}
		}
		
		SPR = {
			exists = yes
			OR = {
				has_capitulated = yes
				surrender_progress > 0.5
			}
		}
	}
}

can_defend = {
	has_capitulated = no
	is_neighbor_of = GER
}

can_defend_ITA = {
	ITA = {
		has_capitulated = no
		surrender_progress < 0.8
		is_neighbor_of = GER
	}
}

can_defend_SPA = {
	OR = {
		AND = {
			country_exists = SPA
			SPA = {
				has_capitulated = no
				is_neighbor_of = GER
			}
		}
		
		AND = {
			country_exists = SPR
			SPR = {
				has_capitulated = no
				is_neighbor_of = GER
			}
		}
	}
}

can_defend_POL = {
	POL = {
		num_of_controlled_states > 2
		is_neighbor_of = GER
	}
}

can_defend_SWE = {
	SWE = {
		num_of_controlled_states > 1
		surrender_progress > 0.01
	}
}

can_defend_NOR = {
	NOR = {
		num_of_controlled_states > 1
		is_neighbor_of = GER
	}
}

can_defend_FIN = {
	FIN = {
		num_of_controlled_states > 1
		is_neighbor_of = GER
	}
}

can_defend_CZE = {
	CZE = {
		num_of_controlled_states > 1
		is_neighbor_of = GER
	}
}

can_defend_HUN = {
	HUN = {
		num_of_controlled_states > 0
		is_neighbor_of = GER
	}
}

can_defend_YUG = {
	YUG = {
		num_of_controlled_states > 1
		is_neighbor_of = GER
	}
}

can_defend_ROM = {
	ROM = {
		num_of_controlled_states > 1
		is_neighbor_of = GER
	}
}

is_scandinavian_neighbor_of_GER = {
	OR = {
		surrender_progress > 0.01
	
		AND = { # Sweden will usually only border Germany via Copenhagen
			NOT = { tag = SWE }
			is_neighbor_of = GER
		}
	}
}