# befriend
# conquer
# antagonize
# build_ship
# build_army
# unit_ratio
# build_building
# research_tech
# garrison
# protect
# influence

# NOTE: 
# This file encompasses ALL Allied nations

CHI_leave_yunnan_alone = {
	allowed = {
		OR = {
			tag = CHI
			tag = PRC
			tag = XSM
			tag = GXC
			tag = SHX
		}
	}
	enable = {
		date < 1946.1.1
	}

	abort = {
		YUN = {
			surrender_progress > 0.04
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "YUN"
		value = 500
	}	
}

ALLIES_europe_first_policy = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
		}
	}
	enable = {
		has_war_with = GER
	}

	abort = {
		NOT = {
			has_war_with = GER
		}
	}	
	ai_strategy = {
		type = front_unit_request
		id = GER
		value = 200
	}
}

ALLIES_pacific_vday = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
		}
	}
	enable = {
		has_war_with = JAP
		OR = {
			date > 1946.3.1 #TODO: Remove?
			has_global_flag = scenario_scripted_invasions_disabled
		}
		NOT = {
			has_war_with = GER
		}
	}

	abort = {
		NOT = {
			has_war_with = JAP
		}
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = 50
	}

	ai_strategy = {
		type = front_unit_request
		area = pacific
		value = 50
	}
	ai_strategy = {
		type = area_priority
		id = asia
		value = 50
	}

	ai_strategy = {
		type = front_unit_request
		area = asia
		value = 50
	}

	ai_strategy = {
		type = put_unit_buffers

		ratio = 0.05
		area = pacific
		subtract_invasions_from_need = no
		subtract_fronts_from_need = no
	}

}

dont_naval_invade_when_already_in_europe = {
	allowed = {
		is_in_faction_with = ENG
	}
	enable = {
		date > 1945.1.1
	}

	abort = {
		FRA = {
			NOT = {
				controls_state = 16
			}
		}
	}

	ai_strategy = {
		type = invade
		id = "BLR"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "CRO"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "HOL"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "GER"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "NOR"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "ITA"
		value = -9999
	}
}


# March offensive
ENG_invasion_of_germany_2 = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
			tag = FRA
		}
	}
	enable = {
		date < 1945.3.12
	}

	abort = {
		date > 1945.3.20
	}

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.1
		priority = 500
		ordertype = front
		execution_type = careful
		execute_order = no
		manual_attack = no
	}
}

#CRO
CRO_defend_croatia = {
	allowed = {
		original_tag = CRO
	}
	enable = {
		has_war_with = YUG
	}

	abort = {
		NOT = {
			has_war_with = YUG
		}
	}

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

# Operation Grapeshot
ENG_operation_grapeshot = {
	allowed = {
		original_tag = RD2
	}
	enable = {
		has_war_with = ITA
		date > 1945.4.11
	}

	abort = {
		has_global_flag = scenario_italy
	}

	ai_strategy = {
		type = area_priority
		id = italy
		value = 150
	}

	ai_strategy = {
		type = front_unit_request
		area = italy
		value = 3000
	}

	ai_strategy = {
		type = front_control

		area = italy

		ratio = 0.1
		priority = 4000
		ordertype = front
		execution_type = balanced
		execute_order = yes
	}
}
RD2_garrison = {
	allowed = {
		original_tag = RD2
	}

	enable = {
		has_war_with = ITA
	}

	abort = {
		NOT = { has_war_with = ITA }
	}

	ai_strategy = {
    	type = garrison
    	value = -50000
	}
	ai_strategy = {
    	type = garrison_reinforcement_priority
    	value = -50000
	}
}

ENG_let_holland_stay_safe_awhile = {
	allowed = {
		is_in_faction_with = ENG
	}
	enable = {
		date < 1945.4.11
	}

	abort = {
		date > 1945.4.11
	}

	ai_strategy = {
		type = area_priority
		id = italy
		value = 150
	}

	ai_strategy = {
		type = front_unit_request
		area = italy
		value = 150
	}
}

# AST ast Australia australia
AST_pacific = {
	allowed = {
		original_tag = AST
	}
	enable = {
		has_war_with = JAP
	}

	abort = {
		NOT = {
			has_war_with = JAP
		}
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = 150
	}

	ai_strategy = {
		type = front_unit_request
		area = pacific
		value = 150
	}

	ai_strategy = {
		type = put_unit_buffers

		ratio = 0.05
		area = pacific
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}

}

# USA usa
USA_prioritize_home_islands_and_philippines = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_war_with = JAP
	}

	abort = {
		NOT = {
			has_war_with = JAP
		}
	}

	ai_strategy = {
		type = area_priority
		id = home_islands
		value = 150
	}

	ai_strategy = {
		type = front_unit_request
		area = home_islands
		value = 150
	}

	ai_strategy = {
		type = put_unit_buffers

		ratio = 0.05
		area = home_islands
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}

	ai_strategy = {
	    type = force_defend_ally_borders
	    id = PHI
	    value = 100
	}
}
USA_island_hop_ffs = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_war_with = JAP
		date < 1946.1.1
		has_global_flag = scenario_scripted_invasions_disabled
	}

	abort_when_not_enabled = yes

	ai_strategy = {
    	type = invasion_unit_request
    	strategic_region = 84
    	value = -9999
	}
	ai_strategy = {
    	type = invasion_unit_request
    	strategic_region = 97
    	value = -9999
	}
	ai_strategy = {
    	type = invasion_unit_request
    	strategic_region = 91
    	value = -9999
	}
}
USA_invade_iwo_jima = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_war_with = JAP
		date > 1945.1.1
		has_global_flag = scenario_scripted_invasions_disabled
	}
	abort = {
		OR = {
			USA = {
				controls_state = 645
			}
			ENG = {
				controls_state = 645
			}
		}
	}
	ai_strategy = {
	    type = invasion_unit_request
	    state = 645
	    value = 200
	}
}

USA_invade_okinawa = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_war_with = JAP
		date > 1945.3.1
		has_global_flag = scenario_scripted_invasions_disabled
	}
	abort = {
		OR = {
			USA = {
				controls_state = 526
			}
			ENG = {
				controls_state = 526
			}
		}
	}
	ai_strategy = {
	    type = invasion_unit_request
	    state = 526
	    value = 200
	}
}

# British Raj british raj RAJ
RAJ_burma_campaign  = {
	allowed = {
		original_tag = RAJ
	}

	enable = {
		has_war_with = JAP
	}

	abort = {
		NOT = {
			has_war_with = JAP
		}
	}

	ai_strategy = {
		type = area_priority
		id = burma
		value = 1000
	}

	ai_strategy = {
		type = front_unit_request
		area = burma
		value = 1000
	}
	ai_strategy = {
		type = force_defend_ally_borders
		value = 500
		id = BRM
	}
	ai_strategy = {
		type = front_control

		area = burma

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

#ENG
ENG_dont_defend_china = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		CHI = {
			surrender_progress < 0.90
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "CHI"
		value = 10000
	}
}

#TUR
TUR_keep_to_yourselves = {
	allowed = {
		original_tag = TUR
	}
	enable = {
		is_in_faction_with = ENG
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "RD2"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "USA"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "ENG"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "FRA"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "AST"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "INS"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "RAJ"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "PHI"
		value = 10000
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "BRM"
		value = 10000
	}
	ai_strategy = {
		type = invade
		id = "JAP"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "SIA"
		value = -9999
	}
	ai_strategy = {
		type = invade
		id = "MEN"
		value = -9999
	}
}

ENG_unit_production = {

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

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

	# Old garrison system against resistance
	# ai_strategy = {
	# 	type = role_ratio
	# 	id = suppression
	# 	value = 1
	# }


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

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

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

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

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

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

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

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

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

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 10
	}

}

ENG_bomber_production = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		num_of_military_factories > 30
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = tactical_bomber
		value = 1
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = strategic_bomber
		value = 1
	}
}

bba_air_prod_1 = {
	# TODO BFW:
	allowed = { original_tag = ENG }
	enable = {
		date < 1940.1.1
	}
	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 15 #because doctrine this = 15
	}

 	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 1
	}

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 5
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = large_plane_airframe
		value = 1
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = 2
	}

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

	ai_strategy = {
		type = unit_ratio
		id = scout_plane
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = 25
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = 25
	}
}

bba_air_prod_2 = {
	# TODO BFW:
	allowed = { original_tag = ENG }
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 5
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 15
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3
	}
 
	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 5
	}

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 15
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = large_plane_airframe
		value = 10
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = 5
	}

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

	ai_strategy = {
		type = unit_ratio
		id = scout_plane
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = 25
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = 25
	}

}

build_more_patrol_bombers = {

	enable = {
		has_dlc = "By Blood Alone"
		has_navy_size = {
			size > 1
		}
		tag = ENG
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = 15
	}
}

eng_fighter_enhanced_production = {
	allowed = { original_tag = ENG }

	enable = {
		date < 1943.1.1
	}

	abort = {
		has_equipment = { small_plane_airframe > 4000 }
	}

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

	ai_strategy = {
		type = air_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}

}

eng_the_home_fleet  = {
	allowed = { original_tag = ENG }

	enable = {
		has_war = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strike_force_home_base
		id = 16 # north sea
	}
}

eng_the_med_fleet  = {
	allowed = { original_tag = ENG }

	enable = {
		has_war = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strike_force_home_base
		id = 69 # nice #eastern med
	}
}

eng_build_kgv_battleships = {
	allowed = { original_tag = ENG }

	enable = {
		date > 1936.1.1
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = navy_xp_spend_priority
		id = upgrade_xp_cutoff
		value = 100
	}
}

protect_poland_against_germany = {
	allowed = { original_tag = ENG }

	enable = {
		GER = { has_completed_focus = GER_fate_of_czechoslovakia }
		GER = { NOT = { has_war_with = POL } }
		country_exists = POL
	}
	abort = {
		OR = {
			NOT = { country_exists = POL }
			has_war_with = POL
		}
	}

	ai_strategy = {
		type = protect
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = diplo_action_desire
		id = POL
		target = guarantee
		value = 20
	}
}

defend_poland_against_germany = {
	allowed = { original_tag = ENG }
	enable = {
		GER = { has_war_with = POL }
		country_exists = POL
	}
	abort = {
		OR = {
			NOT = { country_exists = POL }
			has_war_with = POL
		}
	}

	ai_strategy = {
		type = befriend
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 200
	}
}

royal_air_force = {
	allowed = { original_tag = ENG }
	enable = {
		date > 1939.4.1
	}
	abort = {
		date < 1939.4.1
	}

	ai_strategy = {
		type = air_factory_balance
		value = 50
	}

}

ENG_template_design_1 = {
	allowed = { original_tag = ENG }
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}
	ai_strategy = {
		type = template_prio
		id = infantry
		value = 40
	}

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

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

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

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

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

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

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

ENG_template_design_2 = {
	allowed = { original_tag = ENG }
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = template_prio
		id = infantry
		value = -10
	}

	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 = -10
	}

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

	ai_strategy = {
		type = template_prio
		id = modern_armor
		value = 50
	}

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

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

	ai_strategy = {
		type = template_prio
		id = mechanized
		value = 10
	}
}
# lets make sure the allies dont overcommit to invasions early on
careful_with_early_invasions = {
	enable = {
		date < 1943.1.1

		#if = { # commented in case we want to add it back
		#	limit = { NOT = { has_dlc = "Man the Guns"} }
		#	NOT = { has_tech = landing_craft }
		#}
		#else = {
		#	NOT = { has_tech = mtg_landing_craft }
		#}

		OR = {
			is_in_faction_with = ENG # anyone in allies
			tag = FRA
		}

		NOT = {
			SOV = {
				has_war_with = GER
				surrender_progress > 0.15
			}
		}
	}
	# HERE Here here
	abort = {
		#OR = { # commented in case we want to add it back
		#	has_tech = landing_craft
		#	has_tech = mtg_landing_craft
		#}
			SOV = {
				surrender_progress > 0.01
			}
	}

	ai_strategy = {
		type = invade
		id = "ITA"
		value = -999
	}

	ai_strategy = {
		type = invade
		id = "GER"
		value = -999
	}

#	ai_strategy = { #TODO why does this crash
#		type = invade
#		id = "JAP"
#		value = -500
#	}

	ai_strategy = {
		type = area_priority
		id = scandinavia
		value = -6000
	}
	ai_strategy = {
		type = invade
		id = "NOR"
		value = -9999
	}
}

# AI gets trapped here and dies to germany, although this takes a big toll
# on germany as well leading to bad attack on soviet as well as no UK troops
# to invade them later when they are busy.
ENG_trying_to_save_benelux_is_deathtrap = {
	allowed = { original_tag = ENG }
	enable = {
		has_war_with = GER
		date < 1940.3.1
		OR = {
			HOL = { has_capitulated = no }
			BEL = { has_capitulated = no }
		}
	}

	abort = {
		OR = {
			date > 1940.3.1
			AND = {
				HOL = { has_capitulated = yes }
				BEL = { has_capitulated = yes }
			}
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "HOL"
		value = 70
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "BEL"
		value = 50
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "LUX"
		value = 50
	}
	ai_strategy = {
		type = put_unit_buffers
		# french states bordering benelux
		states = {
			29
			785
			18
		}
		ratio = 0.1
		area = europe
		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}
}

ENG_naval_role_ratios_historical = {
	allowed = {
		has_dlc = "Man the Guns"
		original_tag = ENG
	}
	enable = { always = yes }
	abort_when_not_enabled = yes

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = 20
	}
	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 20  #aim for a 2-1 ratio on naval factories
	}
	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -10
	}

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

	ai_strategy = {
		type = role_ratio
		id = naval_carrier_light
		value = 15
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = -150
	}

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

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

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

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

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

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

ENG_naval_role_ratios_anti_submarines = {
	allowed = {
		has_dlc = "Man the Guns"
		original_tag = ENG
	}
	enable = {
		anti_submarine_strategy_required_trigger = yes
	}
	abort = {
		not = { anti_submarine_strategy_required_trigger = yes }
	}
	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = 10
	}
	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 20  #aim for a 2-1 ratio on naval factories
	}
	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -10
	}

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

	ai_strategy = {
		type = role_ratio
		id = naval_carrier_light
		value = -25
	}

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = -150
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = -70
	}

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

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = -25
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = -10
	}
}


ENG_the_channel_is_dangerous = {
	allowed = { original_tag = ENG }
	enable = {
		has_war_with = GER
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 18 #english channel
		value = 75
	}
}

ENG_baltic_is_a_trap = {
	allowed = { original_tag = ENG }
	enable = {
		has_war_with = GER
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 9 #northern baltic
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 206 #central baltic
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 207 #danish belts
		value = 100
	}
}

ENG_lifeline_of_the_empire = {
	allowed = { original_tag = ENG }
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = area_priority
		id = suez
		value = 80 # this is extra on top of 50 base (now equal to other territory)
	}
}

ENG_USA_focus_on_europe = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
			tag = FRA
		}
	}

	enable = {
			date > 1945.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = GER
		value = 100
	}

	ai_strategy = {
		type = front_unit_request
		area = italy
		value = 100
	}
}

ENG_USA_focus_on_europe_loads_more = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
			tag = FRA
		}
	}

	enable = {
		is_historical_focus_on = yes
		date > 1943.6.1
		has_global_flag = FRA_already_surrendered
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = 400
	}
}

ENG_gang_up_GER_with_USA = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
			tag = FRA
		}
	}
	enable = {
		date > 1945.1.1
	}

	abort_when_not_enabled = yes

	# after FRA falls, both ENG and USA will try to help in europe and africa
	ai_strategy = {
		type = force_defend_ally_borders
		value = 500
		target = europe
	}
}

ENG_accept_USA_access = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		tag = ENG
		date > 1940.9.9
		USA = {
			is_ai = yes
			NOT = {
				OR = {
					is_in_faction_with = ENG
					has_military_access_to = ENG
				}
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_acceptance
		id = USA
		target = military_access
		value = 1000
	}
}


ENG_in_for_the_long_haul_bruv = {
	allowed = { original_tag = ENG }
	enable = {
		has_government = democratic
		date < 1937.10.1
		has_war = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 49
	}
	ai_strategy = {
		type = air_factory_balance
		value = 20
	}
}

ENG_industry_we_on_an_island_bruv = {
	allowed = { original_tag = ENG }
	enable = {
		has_government = democratic
		has_war = no
		date > 1937.10.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = -60
	}
	ai_strategy = {
		type = air_factory_balance
		value = 55
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 9 #northern baltic
		value = 600
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 206 #central baltic
		value = 600
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 207 #danish belts
		value = 600
	}
}

ENG_if_the_best_arrangements_are_made_as_they_are_being_made = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		date > 1940.1.1
		has_war_with = GER
		num_of_military_factories < 150
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
}

ENG_the_best_arrangements_are_made = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		date > 1940.1.1
		has_war_with = GER
		num_of_military_factories > 150
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 20
	}
}

ENG_growing_confidence_in_the_air = {
	allowed = { original_tag = ENG }
	enable = {
		has_war = yes
		has_government = democratic
		date > 1938.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 120
	}
}

ENG_allies_dont_ask_for_diplo_access_to_SOV = {
	enable = {
		ENG = {
			has_government = democratic
		}
		SOV = {
			has_government = communism
		}
		is_in_faction_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_desire
		id = SOV
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = TAN
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = MON
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = SOV
		target = docking_rights
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = TAN
		target = docking_rights
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = MON
		target = docking_rights
		value = -5000
	}
}


ENG_convoy_raids_german_italian_convoys = {
	allowed = {
		tag = ENG
	}

	enable = {
		OR = {
			has_war_with = GER
			has_war_with = ITA
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 61 # cape verde plain
		value = 100
	}

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 45 # norwegian sea
		value = 100
	}
}

ENG_norway_is_not_THAT_important = {
	allowed = {
		OR = {
			tag = ENG
			tag = FRA
			tag = USA
		}
	}
	enable = {
		date < 1945.6.1

		OR = {
			is_in_faction_with = ENG # anyone in allies
			tag = FRA
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = scandinavia
		value = -2000
	}
}

ENG_super_boost_armor_div = { #lets make sure the uk upgrades rtr to divs
	allowed = {
		original_tag = ENG
	}
	enable = {
		OR = {
			has_tech = basic_medium_tank
			has_tech = basic_medium_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = medium_armor }
		has_war = no
		date > 1937.1.1

	}

	abort = {
		has_template_ai_majority_unit = medium_armor
		date > 1940.1.1
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 100
	}
}

ENG_super_boost_armor_div_med = { #lets make sure the uk upgrades armor divs to mediums
	allowed = {
		original_tag = ENG
	}
	enable = {
		OR = {
			has_tech = basic_medium_tank
			has_tech = basic_medium_tank_chassis
		}
		NOT = { has_template_ai_majority_unit = medium_armor }

		date > 1940.1.1
	}

	abort = {
		has_template_ai_majority_unit = medium_armor
	}

	# lets do changes more often during this period too
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

	# this is gateway
	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 100
	}

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

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

ENG_take_italys_spaghetti = {
	allowed = {
		OR = {
			original_tag = USA
			original_tag = ENG
		}
	}
	enable = {
		date > 1943.1.1
	#	ITA = {
	#			surrender_progress < 0.2
	#		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = italy
		value = 150
	}

	ai_strategy = {
		type = area_priority
		id = normandy_landing_zone
		value = -100
	}
}

ENG_RAJ_the_hot_gates = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = RAJ
		}
	}
	enable = {
		OR = {
			671 = { is_controlled_by = JAP }
			670 = { is_controlled_by = JAP }
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = burma
		value = 150
	}

	ai_strategy = {
		type = front_unit_request
		area = burma
		value = 100
	}

	ai_strategy = {
		type = put_unit_buffers
		# burmese states
		states = {
			288
			640
			430
		}
		ratio = 0.05
		area = burma
		subtract_invasions_from_need = no
		subtract_fronts_from_need = yes
	}

}

#ENG_we_hate_fighting_in_the_balkans = {
#
#	allowed = {
#		original_tag = ENG
#	}
#	enable = {
#		date < 1942.1.1
#	}
#
#	ai_strategy = {
#		type = dont_defend_ally_borders #Just a bit, we wait for greece
#		id = YUG
#		value = 30
#	}
#}

ENG_dont_kick_russia_out_from_triple_entente_due_to_gobbling_up_breakaway_states = {
		allowed = {
			original_tag = ENG
		}

		enable = {
			is_in_faction_with = SOV
			SOV = { has_completed_focus = SOV_the_triple_entente }
		}

		abort = {
			NOT = { is_in_faction_with = SOV }
		}

		ai_strategy = {
			type =  alliance
			id = SOV
			value = 200
		}

		ai_strategy = {
			type =  befriend
			id = SOV
			value = 200
		}
}