ITA_unit_production = {

	allowed = {	original_tag = ITA }
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 7
	}

	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 2
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = cavalry
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 8
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 80
	}

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 80
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = 10
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 5
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -40 #Just build a few slowly
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = 20
	}

	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 10
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 10
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 40
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 15
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 35
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 40
	}

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 25
	}
}

ITA_trade_with_sweden = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		# if we're not communist and they're not communist
		NOT = { has_government = communism }
		NOT = { SWE = { has_government = communism } }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = SWE
		value = 60
	}
}

ITA_trade_with_germany = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_government = fascism
		GER = { has_government = fascism }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = GER
		value = 40
	}
}

ITA_stresa_front = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_ratify_the_stresa_front
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = ENG
		value = 400
	}
	ai_strategy = {
		type = alliance
		id = FRA
		value = 400
	}
}

ITA_stresa_front_ENG_FRA = {
	allowed = {
		OR = {
			original_tag = FRA
			original_tag = ENG
		}
	}
	enable = {
		ITA = {
			has_completed_focus = ITA_ratify_the_stresa_front
		}
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = alliance
		id = ITA
		value = 400
	}
}

ITA_albania_war_goal = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_albanian_occupation
		country_exists = ALB
	}
	abort = {
		NOT = {
			country_exists = ALB
		}
	}

	ai_strategy = {
		type = antagonize
		id = ALB
		value = 200
	}
}

ITA_greece_war_goal = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_war_with_greece
		country_exists = GRE
	}
	abort = {
		NOT = {
			country_exists = GRE
		}
	}

	ai_strategy = {
		type = antagonize
		id = GRE
		value = 200
	}
}

ITA_shore_up_against_france = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = FRA
		FRA = {
			has_capitulated = no
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request

		# savoy piedmont
		state = 158
		state = 735

		value = 10
	}
}

ITA_slow_going_against_france = {
	allowed = { original_tag = ITA }
	enable = {
		is_historical_focus_on = yes
		has_war_with = FRA
		date < 1940.5.16
		FRA = {
			has_capitulated = no
			surrender_progress < 0.45
		}
		GER = { surrender_progress < 0.1 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = FRA

		ratio = 0.60

		priority = 100
		ordertype = front
		execution_type = careful
		execute_order = no
		manual_attack = no
	}

	ai_strategy = {
		type = front_control

		tag = FRA

		ratio = 0.60

		priority = 100
		ordertype = invasion
		execute_order = no
	}
}

ITA_anti_uk_war_goals = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_war_with_the_uk
		country_exists = ENG
	}
	abort = {
		NOT = {
			country_exists = ENG
		}
	}

	ai_strategy = {
		type = antagonize
		id = ENG
		value = 200
	}
}

ITA_yugoslavia_war_goal = { 
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_balkan_ambition
		has_completed_focus = ITA_war_with_greece
		country_exists = YUG
	}
	abort = {
		NOT = {
			country_exists = YUG
		}
	}

	ai_strategy = {
		type = antagonize
		id = YUG
		value = 200
	}
}

ITA_germany_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_pact_of_steel
		country_exists = GER
	}
	abort = {
		NOT = { country_exists = GER }
	}

	ai_strategy = {
		type = befriend
		id = GER
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = GER
		value = 100
	}
}

ITA_romania_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_potential_allies_in_the_balkans
		country_exists = ROM
	}
	abort = {
		NOT = { country_exists = ROM }
	}

	ai_strategy = {
		type = befriend
		id = ROM
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = ROM
		value = 200
	}
}

ITA_bulgaria_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_potential_allies_in_the_balkans
		country_exists = BUL
	}
	abort = {
		NOT = { country_exists = BUL }
	}

	ai_strategy = {
		type = befriend
		id = BUL
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = BUL
		value = 200
	}
}

ITA_yugoslavia_ally = { 
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_potential_allies_in_the_balkans
		country_exists = YUG
	}
	abort = {
		NOT = { country_exists = YUG }
	}

	ai_strategy = {
		type = befriend
		id = YUG
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = YUG
		value = 100
	}
}

ITA_greece_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_befriend_greece
		country_exists = GRE
	}
	abort = {
		NOT = { country_exists = GRE }
	}

	ai_strategy = {
		type = befriend
		id = GRE
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = GRE
		value = 100
	}
}

ITA_turkey_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_befriend_turkey
		country_exists = TUR
	}
	abort = {
		NOT = { country_exists = TUR }
	}

	ai_strategy = {
		type = befriend
		id = TUR
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = TUR
		value = 100
	}
}

ITA_portugal_ally = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_completed_focus = ITA_befriend_portugal
		country_exists = POR
	}
	abort = {
		NOT = { country_exists = POR }
	}

	ai_strategy = {
		type = befriend
		id = POR
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = POR
		value = 100
	}
}

ITA_keep_your_nose_clean_for_a_bit = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		tag = ITA
		date < 1940.5.16
		GER = { 
			has_completed_focus = GER_danzig_or_war
		}
	}
	abort = {
		OR = { 
			date > 1940.5.16
			GER = { 
				has_completed_focus = GER_around_maginot
			}
			GER = {
				surrender_progress > 0.1
			}
		}
	}

	ai_strategy = {
        	type = dont_join_wars_with
        	id = GER
        	value = 1000000
   	 }
    	ai_strategy = {
        	type = dont_join_wars_with
        	id = SLO
        	value = 1000000
    	}
	ai_strategy = {
    		type = diplo_action_desire
    		target = join_allies
    		id = GER
    		value = -1000000
    	}
    	ai_strategy = {
    		type = diplo_action_desire
    		target = join_allies
    		id = SLO
    		value = -1000000
    	}
	ai_strategy = {
		type = ignore
		id = "FRA"
		value = 50
	}
}
ITA_aid_reich_from_now_until_the_end = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		tag = ITA
		GER = { 
			has_completed_focus = GER_around_maginot
		}
	}
	abort = {
		OR = { 
			GER = { 
				has_capitulated = yes
			}
		}
	}

	ai_strategy = {
    		type = diplo_action_desire
    		target = join_allies
    		id = GER
    		value = 1000000
    	}

}

ITA_template_design_1 = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 40
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id  = militias
		value = 5
	}
}

ITA_template_design_2 = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = template_prio
		id = motorized
		value = 30
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = -20
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 40
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = mechanized
		value = -20
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 10
	}

	ai_strategy = {
		type = role_ratio
		id = militias
		value = 5
	}
}

# extra scaryness around italy, this together with sufficient enemy superiority will make ai avoid transports around its coast
ITA_be_careful_transporting_through_the_med = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		date < 1942.1.1
		has_war = yes
		enemies_naval_strength_ratio > 1
	}
	abort = {
		OR = {
			date > 1942.1.1
			has_war = no
			enemies_naval_strength_ratio < 1
		}
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 68
		value = 50
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 169
		value = 50
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 29
		value = 50
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 168
		value = 50
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 69
		value = 50
	}
}

ITA_dont_take_claims_on_yug = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		country_exists = YUG
		is_historical_focus_on = yes
		date < 1941.4.30

	}

	abort = {
		OR = {
			NOT = { country_exists = YUG }
			date > 1941.5.1 #If Germany won't invade Yugoslavia, then we will!
		}
	}

	ai_strategy = {
		type = declare_war
		id = YUG
		value = -200
	}

	ai_strategy = {
		type = ignore_claim
		id = YUG
		value = 1
	}
}

ITA_naval_role_ratios_historical = {
	allowed = {
		has_dlc = "Man the Guns"
		original_tag = ITA
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 10
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 20
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = 5
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 5
	}
}

ITA_share_borders_with_GER_against_SOV = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		is_in_faction_with = GER
		GER = {
			going_war_with_SOV = yes
		}

		GER_should_split_SOV_front_with_ITA = yes
	}
	abort = {
		not = {
			is_in_faction_with = GER
			GER = {
				going_war_with_SOV = yes
			}
			GER_should_continue_split_SOV_front_with_ITA = yes
		}
	}

	ai_strategy = {
		type = force_defend_ally_borders
		id = CRO
		value = 100
	}
	ai_strategy = {
		type = force_defend_ally_borders
		id = ROM
		value = 100
	}
	ai_strategy = {
		type = force_defend_ally_borders
		id = HUN
		value = 100
	}
	ai_strategy = {
		type = force_defend_ally_borders
		id = SLO
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = GER
		value = 100
	}
}

ITA_spain_scw_support_la_resistance = {
	allowed = {
		original_tag = ITA
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = fascism
		country_exists = SPA
	}
	abort = {
		OR = {
			NOT = { country_exists = SPA }
			SPA = { has_completed_focus = SPA_join_the_allies }
		}
	}

	ai_strategy = {
		type = support
		id = SPA
		value = 100
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = SPA
		value = 100
	}
}

ITA_stockpile_less_early_game = {
	allowed = {
		original_tag = ITA
	}

	enable = {
		date < 1939.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = -25 # reduce while we build up troops for africa etc
	}
}

ITA_please_help_me_buget_this_my_country_is_dieing = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_government = fascism
		date < 1937.6.1
	}

	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 35
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = armor
		value = 1
	}
}

ITA_hold_africa = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		date < 1941.1.1
	}
	abort = {
		any_owned_state = { is_core_of = ITA NOT = { is_controlled_by = ITA } }
		date > 1941.1.1
	}

	# Tripoli
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 448
		value = 2
	}

	# Benghasi
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 450
		value = 2
	}

	# Alexandria
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 447
		value = 2
	}
}

# lets not invade until we have europe
ITA_dont_invade_NOR_until_FRA_falls = {
	allowed = {
		original_tag = ITA
		is_historical_focus_on = yes
	}

	enable = {
		has_war_together_with = GER
		date < 1942.1.1  # Italy should probably stay out of Norway for a while even if France has capitulated
		#FRA = {
		#	has_capitulated = no
		#}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		tag = NOR
		value = -100
	}
}

ITA_let_germany_handle_polish_front_alone = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		is_in_faction_with = GER
		OR = {
			AND = {
				has_war_together_with = GER
				has_war_with = POL
			}
			GER = {
				focus_progress = {
					focus = GER_danzig_or_war
					progress > 0.01
				}
			}
		}
		date < 1940.8.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "GER"
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "SLO"
		value = 100
	}
}

ITA_commit_to_ethiopian_theatre = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_global_flag = second_italo_ethiopian_war_flag
		country_exists = ETH
		ETH = { has_country_flag = italian_major_offensive_against_ethiopia_flag }
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort = {
		OR = {
			NOT = { has_global_flag = second_italo_ethiopian_war_flag }
			NOT = { country_exists = ETH }
			date > 1939.6.1
			any_enemy_country = {
				is_major = yes
				capital_scope = { is_on_continent = europe }
			}
		}
	}

	# Eritrea
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 550
		value = 2
	}

	# Somaliland
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 559
		value = 2
	}

	#### Horn of Africa
	ai_strategy = {
		type = area_priority
		id = horn_of_africa
		value = 100
	}
}

ITA_prepare_ethiopian_theatre = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort = {
		OR = {
			NOT = { has_global_flag = second_italo_ethiopian_war_flag }
			NOT = { country_exists = ETH }
			date > 1939.6.1
			any_enemy_country = {
				is_major = yes
				capital_scope = { is_on_continent = europe }
			}
			ETH = { has_country_flag = italian_major_offensive_against_ethiopia_flag }
		}
	}

	# Guard Sidamo for feck's sake
	ai_strategy = {
		type = put_unit_buffers
		states = {
			844
		}
		ratio = 0.2

		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}
}

ITA_prepare_losing_ethiopian_theatre = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		 OR = {
			NOT = { has_global_flag = second_italo_ethiopian_war_flag }
			NOT = { country_exists = ETH }
			any_enemy_country = {
				is_major = yes
				capital_scope = { is_on_continent = europe }
			}
			ETH = { has_country_flag = italian_major_offensive_against_ethiopia_flag }
		}
	}
	abort = {
		has_war_with = ETH
	}

	# ethiopia is not defending much
	ai_strategy = {
		type = area_priority
		id = horn_of_africa
		value = -25
	}
}

ITA_attack_north = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		has_active_mission = ITA_conquer_the_north_mission
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_control

		state = 841 # assault Begemder

		ratio = 0.2

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
}

ITA_attack_south = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		has_active_mission = ITA_conquer_the_south_mission
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_control

		state = 837 # assault Sidamo

		ratio = 0.2

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
}

ITA_attack_addis = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		has_active_mission = ETH_conquer_addis_ababa_mission
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_control

		state = 271 # assault Addis

		ratio = 0.2

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
}

ITA_attack_harar = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		has_active_mission = ETH_conquer_harar_mission
		ITA_is_communist_ai = no
		ITA_is_socialist_ai = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_control

		state = 835 # assault Hararghe

		ratio = 0.2

		priority = 100
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
}

ITA_prepare_to_invade_afar = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		AFA = { exists = yes }
		date < 1937.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = prepare_for_war
		id = AFA
		value = 200
	}
}

ITA_communists_downplay_ethiopian_theatre = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		has_war_with = ETH
		OR = {
			ITA_is_communist_ai = yes
			ITA_is_socialist_ai = yes
		}
		NOT = { has_completed_focus = ITA_defy_the_duce }
	}
	abort = {
		NOT = { has_war_with = ETH }
	}

	ai_strategy = {
		type = area_priority
		id = horn_of_africa
		value = -100
	}
	ai_strategy = {
		type = front_control

		tag = ETH

		ratio = 0.6

		priority = 100
		ordertype = front
		execution_type = careful
		manual_attack = no
	}
}

ITA_prepare_yugoslavian_invasion = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		country_exists = YUG
		NOT = {
			has_global_flag = second_italo_ethiopian_war_flag #Don't attack YUG if you can't handle ETH
			OR = {
				YUG = { is_subject_of = ROOT }
				is_in_faction_with = YUG
			}
		}
		OR = {
			focus_progress = { focus = ITA_balkan_ambition progress > 0.5 }
			has_decision = ITA_send_ultimatum_to_country_balkan
			has_wargoal_against = YUG
			is_justifying_wargoal_against = YUG
		}
	}

	abort = { #Italy gotta focus on bigger, badder nations
		any_other_country = {
			is_major = yes
			OR = {
				is_justifying_wargoal_against = ROOT
				has_wargoal_against = ROOT
				has_war_with = ROOT
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = prepare_for_war
		id = YUG
		value = 100
	}

	ai_strategy = {
	    type = front_unit_request
	    tag = YUG
	    value = 300
	}

	ai_strategy = { #Pull troops from the FRA border in order to be able to invade YUG, mainly from Africa
	    type = front_unit_request
	    tag = FRA
	    value = -70
	}

	ai_strategy = { #Pull troops from the ENG border in order to be able to invade YUG, mainly from africa
	    type = front_unit_request
	    tag = ENG
	    value = -70
	}
}

ITA_balbo_ignore_germany = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		ITA_is_alt_fascist_balbo_ai = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			is_in_faction = yes
			date > 1940.01.01
		}
	}
	ai_strategy = {
		type = ignore
		id = GER
		value = 200
	}
}

ITA_invasion_buffer = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		is_historical_focus_on = yes
		date > 1943.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers
		states = {
			156
			117
			849
			157
			2
			162
			161
			### Oh no we forgot sicily! What could possibly go wrong.
		}
		ratio = 0.20
		area = italy
		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}
}

ITA_prepare_british_invasion = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		NOT = {	has_war_with = ENG }
		OR = {
			focus_progress = { focus = ITA_war_with_the_uk progress > 0.1}
			has_completed_focus = ITA_war_with_the_uk
		}
	}

	abort = {
		any_other_country = {
			original_tag = ENG
			has_government = fascism
		}
	}

	ai_strategy = {
		type = prepare_for_war
		id = ENG
		value = 200
	}
}

ITA_dont_die_in_mountains = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		date < 1942.5.1
		country_exists = SWI
		is_historical_focus_on = no
	}
	abort = {
		NOT = { country_exists = FRA }
		date > 1942.5.1
	}

	ai_strategy = {
		type = ignore
		id = SWI
		value = 1000
	}
}

ITA_ignore_vichy_we_will_annex_them_later = {
	allowed = {
		original_tag = ITA
	}
	enable = {
		country_exists = VIC
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = VIC
		value = 100
	}
}

ITA_other_priorities = {
	allowed = { original_tag = ITA }
	enable = {
		is_historical_focus_on = yes
		date > 1941.4.6
		date < 1943.6.6
		ENG = {
			is_ai = yes
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = north_africa
		value = -30
	}

	ai_strategy = {
		type = front_unit_request
		area = north_africa
		value = -50
	}
}

# Don't consider joining Italy if they are only at war with GiEs
ITA_AXIS_dont_join_against_eth = {
	allowed = {
		always = yes
	}
	enable = {
		is_in_faction_with = ITA
		NOT = { original_tag = ITA }
		ITA = {
			all_enemy_country = {
				is_government_in_exile = yes
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
	    type = diplo_action_desire
	    id = ITA
	    value = -1000
	    target = join_allies
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = ITA
		value = -1000
		target = call_allies
	}

}

# reverse  AI strat to make italy not call allies while fighting only Ethiopia in exile
ITA_dont_call_allies = {
	allowed = {
		always = yes
	}
	enable = {
		is_in_faction_with = ITA
		ITA = {
			all_enemy_country = {
				is_government_in_exile = yes
			}
		}
	}
	abort_when_not_enabled = yes
	reversed = yes

	ai_strategy = {
		type = diplo_action_desire
		id = ITA
		value = -1000
		target = call_allies
	}
}

# We don't want to join to early, better not risk our forces until the enemy is tired...
ITA_dont_join_ww2_too_early = {
	allowed = {
		always = yes
	}
	enable = {
		date < 1940.6.9 # It is ok after historical date
		FRA = {
			surrender_progress < 0.05 # If France is falling, it should be safe
		}
		is_in_faction_with = ITA
		GER = { # Only hold back if we're in the Axis together with Germany, Otherwise, we'll do whatever we feel like.
			is_in_faction_with = ITA
			is_faction_leader = yes
		}
		ITA = {
			OR = {
				ITA_is_historical_ai = yes
				ITA_is_alt_fascist_balbo_ai = yes
				ITA_is_alt_fascist_grandi_ai = yes
			}
		}
	}
	abort_when_not_enabled = yes
	reversed = yes

	ai_strategy = {
		type = diplo_action_desire
		id = ITA
		value = -1000
		target = join_allies
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = ITA
		value = -1000
		target = call_allies
	}
}

ITA_contest_the_med = {
	allowed = {
		original_tag = ITA
	}
	
	enable = {
		OR = {
			has_war_with = ENG
			has_war_with = SOU
			has_war_with = FRA
		}
		date > 1939.9.1
		# We just want to always do this, this is our home coast
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = naval_dominance
		id = western_med_control_zone
		value = 80
	}
	
	ai_strategy = {
		type = naval_dominance
		id = italy_med_control_zone
		value = 80
	}
}

ITA_dont_invade_uk_early = {
	allowed = { 
		original_tag = ITA
	}
	
	enable = {
		is_historical_focus_on = yes
		date < 1941.1.1
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = invade
		id = ENG
		value = -500
	}
}
