FRA_focus_more_on_europe = {
	allowed = {
		original_tag = FRA
	}
	enable = { 
		is_historical_focus_on = yes
		is_in_faction_with = ENG
		has_capitulated = no
		OR = {
			surrender_progress > 0.1
			date < 1941.1.1
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
	 	type = front_unit_request
		country_trigger = {
			NOT = { is_in_faction_with = GER }
			NOT = { is_in_faction_with = ITA }
		}
		value = -50
	}

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

FRA_fastgaming = {
	allowed = {
		original_tag = FRA
	}
	enable = { 
		has_country_flag = fastgaming
		has_manpower > 5000
		is_historical_focus_on = yes
		has_equipment = { medium_tank_chassis > 300 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.3

		priority = 300
		ordertype = front
		execution_type = balanced
		execute_order = yes
	}

	ai_strategy = {
		type = front_armor_score
		id = "GER"
		value = 50
	}
}
FRA_fastgaming_prod = {
	allowed = {
		original_tag = FRA
	}
	enable = { 
		has_country_flag = fastgaming	
		date < 1939.6.1
		is_historical_focus_on = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = armor
		value = 100
	}
}

FRA_fastgaming_prod = {
	allowed = {
		original_tag = FRA
	}
	enable = { 
		is_historical_focus_on = yes
		has_capitulated = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = asia
		value = -120
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = -120
	}
}
FRA_the_peak_performance_its_time_to_flee = {
	enable = {
		OR = {
			original_tag = FRA
			AND = {
				is_in_faction_with = FRA
				OR = {
					tag = ENG
					capital_scope = { 
						NOT = { is_on_continent = europe }
					}
					AND = {
						has_capitulated = yes
						NOT = {
							any_country = {
								is_major = yes
								capital_scope = { is_on_continent = europe }
								NOT = { tag = ENG }
								NOT = { tag = FRA }
								has_capitulated = no
							}
						}
					}
				}
			}
		}
		is_historical_focus_on = yes
		FRA = { 
			surrender_progress > 0.4
			is_in_faction_with = ENG
			NOT = { has_country_flag = LSM_eligibility_nation }
			NOT = { has_country_flag = paradrop_grace }
		}
		NOT = {
			any_country = {
				is_in_faction_with = ENG
				is_ai = no
				is_major = yes
			}
		}
		NOT = {
			AND = {
				ENG = { is_in_faction_with = USA }
				FRA = { is_in_faction_with = USA }
				BEL = { has_capitulated = no }
				HOL = { has_capitulated = no }
				GER = { has_war_with = SOV }
			}
		}
		ENG = { surrender_progress < 0.05 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = -300
	}
}
FRA_the_peak_performance_its_time_to_flee_FRA_only = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		is_historical_focus_on = yes
		FRA = { 
			surrender_progress > 0.4
			NOT = { has_country_flag = paradrop_grace }
			is_in_faction_with = ENG
			NOT = { has_country_flag = LSM_eligibility_nation }
		}
		ENG = { surrender_progress < 0.05 }
		NOT = {
			AND = {
				ENG = { is_in_faction_with = USA }
				FRA = { is_in_faction_with = USA }
				BEL = { has_capitulated = no }
				HOL = { has_capitulated = no }
				GER = { has_war_with = SOV }
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers

		order_id = 3

		states = {
			127
			125
			126
			338
			123
		}

		ratio = 1

		area = europe

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}
FRA_benelux_will_surely_not_fall = {
	allowed = { original_tag = FRA }
	enable = {	
		is_historical_focus_on = yes
		has_war_with = GER
		date < 1940.8.1
		OR = {
			HOL = { has_capitulated = no }
			BEL = { has_capitulated = no }
		}
		OR = {
			has_global_flag = vanilla_history
			SOV = { is_ai = no }
			NOT = {
				any_country = {
					has_war_with = FRA
					is_ai = no
				}
			}
		}
		NOT = {
			AND = {
				OR = {
					GER = { is_ai = no }
					AND = {
						ITA = { is_ai = no }
						ITA = { has_government = fascism }
						NOT = { ITA = { is_in_faction_with = ENG } }
					}
				}
				is_historical_focus_on = yes
			}
		}
	}

	abort = {
		OR = {
			date > 1940.8.1
			AND = {
				HOL = { 
					OR = {
						surrender_progress > 0.7 	
						has_capitulated = yes
					}
				}
				BEL = { 
					OR = {
						surrender_progress > 0.7 	
						has_capitulated = yes
					}
				}
			}
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "HOL"
		value = 500
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "BEL"
		value = 500
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = "LUX"
		value = 500
	}
}

FRA_tank_is_meta_frfr = {
	allowed = {
		original_tag = FRA
	}
	enable = { 
		date < 1941.1.1	
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = 10
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = -10
	}

	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = -5
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 35
	}
}
FRA_SOV_cooperation = {
	enable = { 
		is_in_faction_with = FRA
		OR = {
			AND = {
				has_global_flag = SOV_one_step_forward
				NOT = { has_war_with = SOV }
				SOV = { has_war_with = GER }
			}
			AND = {
				is_in_faction_with = USA
				has_capitulated = no
				NOT = { surrender_progress > 0.1 }
			}
		}
		has_war_with = GER
		OR = {
			AND = {
				is_major = yes
				has_manpower > 500000
				OR = {
					has_equipment = { heavy_tank_destroyer_chassis > 1000 }
					has_equipment = { infantry_equipment > 9000 }
				}
			}
			AND = {
				is_major = no
				has_manpower > 80000
				has_equipment = { infantry_equipment > 3000 }
			}
		}
		OR = {
			GER = { has_manpower < 200000 }
			GER = { surrender_progress > 0.2 }
			SOV = { has_country_flag = SOV_patriotic_counterattack_enabled }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = ITA

		ratio = 0.1

		priority = 1200
		ordertype = front
		execution_type = careful
	}

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.1

		priority = 1200
		ordertype = front
		execution_type = balanced
	}
}

FRA_SOV_cooperation_2 = {
	enable = { 
		is_in_faction_with = FRA
		OR = {
			AND = {
				has_global_flag = SOV_one_step_forward
				NOT = { has_war_with = SOV }
				SOV = { has_war_with = GER }
			}
			AND = {
				is_in_faction_with = USA
				has_capitulated = no
				NOT = { surrender_progress > 0.1 }
			}
		}
		has_war_with = GER
		OR = {
			NOT = {
				OR = {
					GER = { has_manpower < 200000 }
					GER = { surrender_progress > 0.2 }
					SOV = { has_country_flag = SOV_patriotic_counterattack_enabled }
				}
			}
			has_equipment = { infantry_equipment < 2000 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = ITA

		ratio = 0.1

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

	ai_strategy = {
		type = front_control

		tag = GER

		ratio = 0.1

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

FRA_tanks_against_waterloo = {
	allowed = {
		original_tag = FRA
	}

	enable = {
		OR = {
			focus_progress = {
				focus = FRA_avenge_waterloo
				progress > 0
			}
			has_completed_focus = FRA_avenge_waterloo
		}
		OR = {
			country_exists = HOL
			country_exists = BEL
			country_exists = LUX
		}
	}

	abort_when_not_enabled = yes
	ai_strategy = {
		type = prepare_for_war
		id = BEL
		value = 200
	}
	ai_strategy = {
		type = prepare_for_war
		id = HOL
		value = 200 
	}

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

}


FRA_tanks_against_germany = {
	allowed = {
		original_tag = FRA
	}

	enable = {
		is_historical_focus_on = yes
	}

	abort = {
		OR = { 
			AND = {
				NOT = { has_country_flag = paradrop_grace }
				surrender_progress > 0.5
			}
			date > 1940.9.1
		}
	}
	ai_strategy = {
		type = prepare_for_war
		id = ITA
		value = 500
	}
	ai_strategy = {
		type = prepare_for_war
		id = GER
		value = 500 
	}

	ai_strategy = {
		type = front_armor_score
		id = "GER"
		value = 500
	}

	ai_strategy = {
		type = front_armor_score
		id = "ITA"
		value = -500
	}

	ai_strategy = {
		type = front_unit_request
		state = 34
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 735
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 851
		value = 6 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 6
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 29
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_control

		tag = ITA

		ratio = 0.3

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

}

ultimate_allies_against_axis = {

	allowed = {
		is_allied_ai = yes
	}

	enable = {
		is_in_faction_with = FRA
	}

	abort = {
		OR = {
			surrender_progress > 0
			AND = {
				FRA = { surrender_progress > 0.6 }
				NOT = { FRA = { has_country_flag = paradrop_grace } }
			}
		}	
	}

	ai_strategy = {
		type = force_defend_ally_borders
		value = 500
		target = europe
	}

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

	ai_strategy = {
		type = force_defend_ally_borders
		id = "FRA"
		value = 99999
	}

	ai_strategy = {
		type = prepare_for_war
		id = ITA
		value = 500
	}
	ai_strategy = {
		type = prepare_for_war
		id = GER
		value = 500 
	}

	ai_strategy = {
		type = front_armor_score
		id = "GER"
		value = 200
	}

	ai_strategy = {
		type = front_armor_score
		id = "ITA"
		value = -200
	}

	ai_strategy = {
		type = front_unit_request
		state = 34
		value = 25 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 735
		value = 25 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 851
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 6
		value = 10 # lets put less units, should be safe
	}

	ai_strategy = {
		type = front_unit_request
		state = 29
		value = 10 # lets put less units, should be safe
	}

}
FRA_unit_production = {
	allowed = { original_tag = FRA }
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

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


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

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

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

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

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 75 # From 70 to 75
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 10 # 15 to 10
	}

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

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

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


	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 20 # from 15 to 25
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 40 #from 50 to 40
	}

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

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 5 #we are a tank nation now
	}
}

FRA_highered_armored_production = {
	allowed = { original_tag = FRA }
	enable = {
		num_of_military_factories > 109
	}
	abort = {
		num_of_military_factories < 110
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 20 #Removed from original production so increased from a bit to a f*** ton (in this case 10 to 20)
	}
}
FRA_area_priority = {
	allowed = { original_tag = FRA }
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = europe
		value = 110 #more focus here
	}

	ai_strategy = {
		type = area_priority
		id = scandinavia
		value = 0
	}

	ai_strategy = {
		type = area_priority
		id = north_america
		value = 10
	}

	ai_strategy = {
		type = area_priority
		id = south_america
		value = 10
	}

	ai_strategy = {
		type = area_priority
		id = asia
		value = 75
	}

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = 10
	}

	ai_strategy = {
		type = area_priority
		id = africa
		value = -50
	}
	ai_strategy = {
        type = area_priority
        id = suez
        value = -50
    }

	ai_strategy = {
		type = area_priority
		id = pacific
		value = 10 #less focus here
	}

	ai_strategy = {
		type = area_priority
		id = oceania
		value = 10
	}
}

FRA_naval_role_ratios_historical = {
	allowed = {
		has_dlc = "Man the Guns"
		original_tag = FRA
	}

	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = 40
	}

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

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

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

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

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

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

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

FRA_accept_USA_access = {
	allowed = {
		tag = FRA # not original_tag to avoid Vichy weirdness
	}
	enable = {
		date > 1940.9.9
		USA = {
			is_ai = yes
			NOT = {
				OR = {
					is_in_faction_with = FRA
					has_military_access_to = FRA
				}
			}
		}
	}
	abort_when_not_enabled = yes

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


FRA_protect_vichy = {

	reversed = yes

	enable_reverse = {
		GER = {
			has_government = fascism
		}
	}

	enable = {
		has_focus_tree = vichy_french_focus
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = protect
		id = GER
		value = 200
	}

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

FRA_help_germany_if_vichy = {
	allowed = { original_tag = FRA }
	enable = {
		GER = {
			has_government = fascism
		}
		NOT = { has_war_with = GER }
		has_focus_tree = vichy_french_focus
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = support
		id = GER
		value = 200
	}
}

FRA_antagonize_vichy = {
	reversed = yes

	enable_reverse = {
		FRA = {
			has_government = democratic
		}
	}

	enable = {
		has_focus_tree = vichy_french_focus
		OR = {
			date > 1942.6.1
			448 = {
				CONTROLLER = {
					is_in_faction_with = FRA
				}
			}
		}
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = conquer
		id = FRA
		value = 200
	}
}

FRA_GER_will_probably_join_ITA = {
	# if ITA is going to war with us, consider GER as a threat as well

	allowed = {
		original_tag = FRA
	}

	enable = {
		GER = {
			has_government = fascism
			NOT = {
				has_war_with = FRA
			}
		}
		ITA = {
			has_government = fascism
			OR = {
				is_in_faction = no
				is_in_faction_with = GER
			}
			OR = {
				# check if we are declaring on FRA
				OR = {
					has_war_with = FRA
					is_justifying_wargoal_against = FRA
					has_wargoal_against = FRA
				}

				# check if we are declaring on any guarantee of FRA
				FRA = {
					any_guaranteed_country = {
						ITA = {
							OR = {
								has_war_with = PREV
								is_justifying_wargoal_against = PREV
								has_wargoal_against = PREV
							}
						}
					}
				}
			}
		}
	}

	abort_when_not_enabled = yes

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

FRA_benelux_race = {
	allowed = { original_tag = FRA }
	enable = {
		has_war_with = GER
		GER = { NOT = { has_war_with = BEL } }	
		is_historical_focus_on = yes
	}

	abort = {
		is_in_faction_with = BEL
		GER = { has_war_with = BEL }
	}
	ai_strategy = {
		type = put_unit_buffers
		# french states bordering benelux
		states = {
			29
			785
			18
		}
		ratio = 0.5
		area = europe
		subtract_invasions_from_need = no
	}

	ai_strategy = {
		type = front_control

		tag = ITA

		ratio = 0.3

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

VIC_avoid_joining_japan = {

	allowed = { original_tag = FRA }
	
	enable = {
		is_historical_focus_on = yes
		GER = { has_capitulated = no }
		tag = VIC
	}
	
	abort = {
		date > 1945.1.1
	}

	ai_strategy = {
		type = alliance
		id = "JAP"
		value = -400
	}
}

JAP_avoid_joining_vichy = { #This is required due to declare_war command executing a reverse check

	allowed = { original_tag = JAP }
	
	enable = {
		is_historical_focus_on = yes
		GER = { has_capitulated = no }
	}
	
	abort = {
		date > 1945.1.1
	}

	ai_strategy = {
		type = alliance
		id = "VIC"
		value = -400
	}
}


FRA_prepare_for_ww2_0 = {
	enable = {
		is_in_faction_with = FRA
		is_historical_focus_on = yes
		GER = { has_government = fascism }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = prepare_for_war
		id = GER
		value = 50
	}

	ai_strategy = {
		type = prepare_for_war
		id = ITA
		value = 50
	}

	ai_strategy = {
		type = front_unit_request
		id = GER
		value = 10
	}

	ai_strategy = {
		type = front_unit_request
		id = ITA
		value = 2s0
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 200 #more focus here
	}
}
FRA_prepare_for_ww2 = {
	allowed = { original_tag = FRA }
	enable = {
		is_historical_focus_on = yes
		GER = { has_government = fascism }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = prepare_for_war
		id = GER
		value = 50
	}

	ai_strategy = {
		type = prepare_for_war
		id = ITA
		value = 50
	}

	ai_strategy = {
		type = front_unit_request
		id = GER
		value = 30
	}

	ai_strategy = {
		type = front_unit_request
		id = ITA
		value = 20
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 200 #more focus here
	}

	ai_strategy = {
		type = put_unit_buffers
		# french states bordering benelux
		states = {
			29
			785
			18
		}
		ratio = 0.4
		area = europe
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}


FRA_prepare_for_ww2_area_priority = {
	allowed = { original_tag = FRA }
	enable = {
		OR = {
			GER = { 
				AND = {
					OR = {
						has_government = fascism
						has_government = neutrality
					}
					NOT = { is_in_faction_with = FRA }
					NOT = { has_country_flag = LSM_eligibility_nation }
				}
			}
			is_historical_focus_on = yes
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = europe
		value = 200 #more focus here
	}

	ai_strategy = {
		type = area_priority
		id = asia
		value = -75
	}

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = 10
	}

	ai_strategy = {
		type = area_priority
		id = africa
		value = 70
	}
	ai_strategy = {
        	type = area_priority
        	id = suez
       		value = 70
    	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = -10 #less focus here
	}

	ai_strategy = {
		type = area_priority
		id = oceania
		value = -10
	}
}