

going_slow = {
	allowed = {
		NOT = {
			OR = {
				tag = SOV
				tag = GER
			}
		}
	}
	enable = {
		has_equipment = { infantry_equipment < -2000 }
	}
	abort = {
		has_equipment = { infantry_equipment > 2000 }
	}
	
	ai_strategy = {
		type = front_control

		country_trigger = {
			has_war_with = FROM
		}

		ratio = 0.0

		priority = 500
		ordertype = front
		execution_type = careful
	}
	
}
going_rslow = {
	allowed = {
		NOT = {
			OR = {
				tag = SOV
				tag = GER
			}
		}
	}
	enable = {
		has_equipment = { infantry_equipment < -8000 }
	}
	abort = {
		has_equipment = { infantry_equipment > 500 }
	}
	
	ai_strategy = {
		type = front_control

		country_trigger = {
			has_war_with = FROM
		}

		ratio = 0.0

		priority = 1999
		ordertype = front
		execution_type = careful
		execute_order = no
	}
	
}


going_erslow = {
	allowed = {
		NOT = {
			tag = DNZ
		}
	}
	enable = {
		has_equipment = { infantry_equipment < -20000 }
	}
	abort = {
		has_equipment = { infantry_equipment > 0 }
	}
	
	ai_strategy = {
		type = front_control

		country_trigger = {
			has_war_with = FROM
		}

		ratio = 0.0

		priority = 3000
		ordertype = front
		execution_type = careful
		execute_order = no
	}
	
}


GER_nonhis_always_prioritize_europe_core = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = no
		any_country = {
			is_neighbor_of = GER
			is_major = yes
			is_in_faction = yes
			any_owned_state = {
				is_on_continent = europe
			}
			NOT = { is_in_faction_with = GER }
			NOT = { has_non_aggression_pact_with = GER }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_in_home_area = no
		}
		value = -5
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_core_of = GER
		}
		value = 20
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			OR = {
				AND = {
					owner = { NOT = { original_tag = SOV } }
					OR = {
						is_on_continent = asia
						is_on_continent = north_america
						is_on_continent = south_america
						is_on_continent = middle_east
					}
				}
			}
		}
		value = -20
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 500
	}

	ai_strategy = {
		type = area_priority
		id = western_front
		value = 200
	}
}

FRA_nonhis_always_prioritize_europe_core = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		is_historical_focus_on = no
		any_country = {
			is_neighbor_of = FRA
			is_major = yes
			is_in_faction = yes
			NOT = { is_in_faction_with = FRA }
			NOT = { has_non_aggression_pact_with = FRA }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_in_home_area = no
		}
		value = -5
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_on_continent = europe
			is_core_of = FRA
			is_in_home_area = yes
		}
		value = 30
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			owner = { NOT = { original_tag = SOV } }
			OR = {
				is_on_continent = asia
				is_on_continent = north_america
				is_on_continent = south_america
				is_on_continent = middle_east
			}
		}
		value = -15
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 500
	}

	ai_strategy = {
		type = area_priority
		id = western_front
		value = 200
	}

}


nonhis_save_your_faction_leader = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		NOT = { surrender_progress > 0.1 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			owner = { 
				is_in_faction_with = FROM.FROM
				is_faction_leader = yes
				surrender_progress > 0
				ROOT = { is_core_of = PREV }
			}
		}
		value = 50
	}

}

this_state_is_empty = {
	enable = {
		always = yes
	}
	abort = {
		always = no
	}
	
	ai_strategy = {
		type = front_control

		state_trigger = {
			FROM = { has_war_with = FROM.FROM }
			FROM = {
				divisions_in_state = { state = ROOT size < 1 }
			}
		}

		ratio = 0.8

		priority = 5000
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
	
}
always_prioritize_our_core = {
	enable = {
		surrender_progress > 0.05
	}
	abort = {
		surrender_progress < 0.01
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_core_of = FROM.FROM
		}
		value = 15
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			NOT = { is_core_of = FROM.FROM }
			NOT = { any_neighbor_state = { is_core_of = FROM.FROM } }
			NOT = { is_controlled_by = FROM.FROM }
			NOT = { any_neighbor_state = { is_controlled_by = FROM.FROM } }
		}
		value = -15
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_in_home_area = no
		}
		value = -5
	}

	
}
forced_check_omega_lul = {
	enable = {
		always = yes
	}
	abort = {
		always = no
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			has_state_flag = recent_naval_invasion_flag
			controller = { is_in_faction_with = FROM.FROM }
		}
		value = 10
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_controlled_by = FROM.FROM
			any_province_building_level = {
				province = {
					all_provinces = yes
				}
				building = supply_node
				level > 0
			}
		}
		value = 5
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			is_capital = yes
			owner = { tag = FROM.FROM }
		}
		value = 15
	}
	ai_strategy = {
		type = invasion_unit_request
		state_trigger = {
			NOT = { has_state_flag = recent_naval_invasion_flag }
			check_variable = { state_strategic_value < 3 }
			OR = {
				has_state_category = wasteland
				has_state_category = pastoral
				has_state_category = rural
			}
		}
		value = -5
	}
	ai_strategy = {
		type = invasion_unit_request
		state_trigger = { 
			NOT = { is_core_of = FROM.FROM }
			NOT = { has_state_flag = recent_naval_invasion_flag }
			check_variable = { state_strategic_value < 8 }
			OR = {
				has_state_category = wasteland
				has_state_category = pastoral
				has_state_category = rural
			}
		}
		value = -5
	}
	ai_strategy = {
		type = invasion_unit_request
		state_trigger = { 
			NOT = { is_core_of = FROM.FROM }
			NOT = { has_state_flag = recent_naval_invasion_flag }
			OR = {
				has_state_category = wasteland
				has_state_category = pastoral
				has_state_category = rural
			}
		}
		value = -5
	}
	ai_strategy = {
		type = invasion_unit_request
		state_trigger = { 
			NOT = { is_core_of = FROM.FROM }
			NOT = { has_state_flag = recent_naval_invasion_flag }
			NOT = {
				any_province_building_level = {
					province = {
						all_provinces = yes
					}
					building = supply_node
					level > 0
				}
			}
		}
		value = -5
	}
	ai_strategy = {
		type = invasion_unit_request
		state_trigger = { 
			NOT = { is_core_of = FROM.FROM }
			is_coastal = yes
			NOT = { has_state_flag = recent_naval_invasion_flag }
			NOT = {
				any_province_building_level = {
					province = {
						all_provinces = yes
						limit_to_coastal = yes
					}
					building = naval_base
					level > 1
				}
			}
		}
		value = -20
	}
}



lets_gang_on_germany = {
	enable = {
		has_idea = SOV_unprepared_offensive
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			OR = {
				tag = GER
				is_in_faction_with = GER 
			}
		}
		value = 25
	}

	ai_strategy = {
		type = garrison
		value = -50
	}
}
lets_have_fun_invading_the_soviet_onion = {
	enable = {
		has_war_with = SOV
		any_state = {
			is_core_of = SOV
			OR = {
				is_core_of = UKR
				is_core_of = EST
				any_neighbor_state = {
					OR = {
						is_core_of = UKR
						is_core_of = EST
					}
				}
			}
			SOV = { divisions_in_state = { state = PREV size < 1 } }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		state_trigger = {
			is_core_of = SOV
			OR = {
				is_core_of = UKR
				is_core_of = EST
				any_neighbor_state = {
					OR = {
						is_core_of = UKR
						is_core_of = EST
					}
				}
			}
			SOV = { divisions_in_state = { state = PREV size < 1 } }
		}
		value = 15
	}

	ai_strategy = {
		type = invade
		id = "SOV"
		value = 25
	}
}
dont_help_player_target = {
	enable = {
		has_country_flag = avoid_player_like_a_plague
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		country_trigger = { has_country_flag = LSM_designated_target }
		value = -500
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = { has_state_flag = LSM_designated_state_target }
		value = -500
	}

	ai_strategy = {
		type = garrison
		value = 50
	}
}

help_player_target = {
	enable = {
		has_country_flag = help_player
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		country_trigger = { has_country_flag = LSM_designated_target }
		value = 50
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = { has_state_flag = LSM_designated_state_target }
		value = 50
	}
}

axis_avoid_helping_germany_if_they_are_pushing_too_quickly_vs_Soviets = {
	enable = {
		is_historical_focus_on = yes
		OR = {
			SOV = {
				has_country_flag = {
					flag = last_map_change_axis_purpose
					days < 30
				}
			}
			SOV = { has_army_manpower = { size < 2000000 } }
		}
		is_in_faction_with = GER
		has_war_with = SOV
		NOT = { tag = GER }
		NOT = { is_neighbor_of = SOV }
		GER = { is_ai = yes }
		OR = {
			is_major = no
			is_ai_mass_mob = yes
		}
		OR = {
			SOV = {
				has_country_flag = {
					flag = last_map_change_allies_purpose
					days > 59
				}
			}
			SOV = {
				NOT = { has_country_flag = last_map_change_allies_purpose }
			}
		}
	}
	abort = {
		OR = {
			is_historical_focus_on = no
			AND = {
				is_major = yes
				is_ai_mass_mob = no
			}
			AND = {
				has_country_flag = help_player
				SOV = { has_country_flag = LSM_designated_target }
			}
			SOV = {
				has_country_flag = {
					flag = last_map_change_axis_purpose
					days > 119 #it has calmed down, lets dig in
				}
			} 
			AND = {
				has_global_flag = GER_ally_support
			}
			SOV = {
				has_country_flag = {
					flag = last_map_change_axis_purpose
					days > 90
				}
				has_country_flag = {
					flag = last_map_change_allies_purpose
					days > 2
				}
				has_country_flag = {
					flag = last_map_change_allies_purpose
					days < 60
				}
			}
			SOV = { 
				NOT = { has_country_flag = last_map_change_axis_purpose }
			}
			SOV = { 
				has_country_flag = last_map_change_allies_purpose
				OR = {
					NOT = { has_country_flag = last_map_change_axis_purpose }
					has_country_flag = {
						flag = last_map_change_axis_purpose
						days > 365
					}
					AND = {
						SOV = { has_army_manpower = { size > 2999999 } } 
						has_country_flag = {
							flag = last_map_change_axis_purpose
							days > 60
						}
					}
					has_global_flag = d_day_crisis
				}
			}
		}
		OR = {
			SOV = { has_army_manpower = { size > 1999999 } } 
			AND = {
				has_country_flag = help_player
				SOV = { has_country_flag = LSM_designated_target }
			}
			AND = {
				has_global_flag = GER_ally_support
			}
			AND = {
				SOV = {
					has_country_flag = {
						flag = last_map_change_axis_purpose
						days > 60
					}
					has_country_flag = {
						flag = last_map_change_allies_purpose
						days > 7
					}
					has_country_flag = {
						flag = last_map_change_allies_purpose
						days < 119
					}
				}
			}
			SOV = { 
				NOT = { has_country_flag = last_map_change_axis_purpose }
			}
			SOV = { 
				has_country_flag = last_map_change_allies_purpose
				OR = {
					NOT = { has_country_flag = last_map_change_axis_purpose }
					has_country_flag = {
						flag = last_map_change_axis_purpose
						days > 365
					}
				}
			}
		}	
	}
	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			tag = SOV
		}
		value = -70
	}
	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			NOT = { tag = SOV }
			is_in_faction_with = SOV
		}
		value = -90
	}

	ai_strategy = {
		type = garrison
		value = 80
	}
}

remember_to_help_on_nonhis_ITA = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = ITA
		ITA = { surrender_progress > 0 }
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "ITA"
	}
}

remember_to_help_on_nonhis_GER = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = GER
		GER = { surrender_progress > 0 }
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "GER"
	}
}
remember_to_help_on_nonhis_FRA = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = FRA
		FRA = { surrender_progress > 0 }
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "FRA"
	}
}
remember_to_help_on_nonhis_ENG = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = ENG
		ENG = { surrender_progress > 0 }
		ENG = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "ENG"
	}
}
remember_to_help_on_nonhis_JAP = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = JAP
		JAP = { surrender_progress > 0 }
		JAP = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "JAP"
	}
}
remember_to_help_on_nonhis_SOV = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = SOV
		SOV = { surrender_progress > 0 }
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "SOV"
	}
}
remember_to_help_on_nonhis_USA = {
	enable = {
		is_historical_focus_on = no
		is_in_faction = yes
		is_in_faction_with = USA
		USA = { surrender_progress > 0 }
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "USA"
	}
}