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

	# Ragnarok added
	#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 = 35
	}

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

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

FRA_armored_production = {
	allowed = { original_tag = FRA }
	enable = {
		ai_wants_divisions > 12 #Decreasing the amount of tanks the AI wants
	}
	abort = {
		ai_wants_divisions < 13 #Decreasing the amount of tanks the AI wants
	}

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

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 = {
		OR = {
			has_war_with = GER # Ragnarok added
			has_global_flag = ragnarok_party # Ragnarok added
			has_global_flag = ragnarok_early_war # Ragnarok added
		}
	}

	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_why_push_into_germany_their_food_is_horrible = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		GER = { has_capitulated = yes } # Ragnarok added
		date < 1941.1.1  # Deactivate after some time
		surrender_progress < 0.01 # We haven't lost territories 
		
		# Once Germany launches some kind of attack on the low countries, or if they go somewhere dangerous, we can try if we want to
		GER = { NOT = { has_war_with = BEL } }
		GER = { NOT = { has_war_with = HOL } }
		GER = { NOT = { has_war_with = CZE } }
		GER = { NOT = { has_war_with = AUS } }
		GER = { NOT = { has_war_with = SOV } }
		GER = { NOT = { has_war_with = ITA } }


		28 = { # Alsace-Lorraine
			is_fully_controlled_by = ROOT
		}

		42 = { # Moselland
			is_controlled_by = GER
		}
		978 = { # Baden
			is_controlled_by = GER
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_concentration_front_factor
		state = 42  # Moselland
		state = 978  # Baden
		ratio = 0.95  # Only if > 95 % of the front consists of these states. This should make it deactivate if the frontline extends around the maginot
		value = -100
	}

	ai_strategy = {
		type = front_control

		state = 42 # Moselland
		state = 978 # Baden

		ratio = 0.8

		priority = 100
		ordertype = front
		execution_type = careful
		execute_order = no  # This should block France from attacking, It's a bit digital, but as the strategy should cancel if they do something weird, it should be fine
		manual_attack = no
	}
}

FRA_benelux_will_surely_not_fall = {
	allowed = { original_tag = FRA }
	enable = {
		has_war_with = GER
		GER = { has_capitulated = yes } # Ragnarok added
		date < 1940.8.1
		OR = {
			HOL = { has_capitulated = no }
			BEL = { has_capitulated = no }
		}
	}

	abort = {
		OR = {
			date > 1940.8.1
			AND = {
				HOL = { surrender_progress > 0.30 }
				BEL = { surrender_progress > 0.30 }
			}
		}
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "HOL"
		value = 50
	}
	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
	}
}

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

