FRA_vichy_france = {

	FRA_scuttle_the_fleet = {

		icon = generic_ignite_civil_war

		available = {
			has_government = fascism
			NOT = {
				GER = { divisions_in_state = { state = 851 size > 0 } } #BBA: Replaced state 21 (Provence - Bouches-du-Rhone) by stat 851 (Provence - Var), where Toulon is
			}
			has_country_flag = {
				flag = case_anton
				days > 2
			}
		}

		cost = 0

		ai_will_do = {
			factor = 200
		}

		visible = {
			has_government = fascism
			has_country_flag = case_anton
		}

		complete_effect = {
			set_country_flag = scuttled_fleet
			destroy_ships = {
				type = ship_hull_light
				count = all
			}
			destroy_ships = {
				type = ship_hull_cruiser
				count = all
			}
			destroy_ships = {
				type = ship_hull_heavy
				count = all
			}
			destroy_ships = {
				type = ship_hull_carrier 
				count = all
			}
			destroy_ships = {
				type = ship_hull_submarine
				count = all
			}
		}
	}
	
	FRA_demand_unification_with_vichy = {
		available = {
country_exists = VIC
			VIC = {
								NOT = {
					has_war_with = ROOT
				}
			}
			controls_state = 16 #Paris
		}

		visible = {
			NOT = {
				tag = VIC
			}
			country_exists = VIC
		}
		ai_will_do = {
			factor = 200
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			random_other_country = {
				limit = {
					tag = VIC
				}
				country_event = lar_france_vichy_reunification.1
			}
		}
	}
	FRA_failsafe_join_axis = {
		available = {
			tag = VIC
			NOT = {
				has_war_with = GER
				is_in_faction_with = GER
			}
			date > 1942.6.1
			FRA = {
				any_controlled_state = {
					NOT = { #algeria
						state = 459
						state = 460
						state = 513
					}
					is_core_of = FRA
				}
			}
		}
		visible = {
			is_ai = yes #if you are not a member of the dev team - avert thy eyes, traveller, for thou hath gazed upon my shame
		}
		ai_will_do = {
			factor = 10
		}
		cost = 0
		fire_only_once = yes
		complete_effect = {
			set_rule = { can_join_factions = yes }
			GER = { add_to_faction = ROOT }
		}
	}
}
category_test_decisions = {
	test_free_france = {
		allowed = { original_tag = FRA }
		cost = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			load_focus_tree = free_french_focus
		}
	}
	test_vichy_france = {
		allowed = { original_tag = FRA }
		cost = 0
		ai_will_do = {
			factor = 0
		}
		complete_effect = {
			create_dynamic_country = {
				original_tag = FRA
				save_event_target_as = france_vichy
				every_state = {
					limit = {
						is_controlled_by = ROOT
						OR = {
							is_on_continent = africa
							is_core_of = VIN
							is_core_of = CAM
							is_core_of = LAO
							is_core_of = LEB
							is_core_of = SYR
						}
					}
					event_target:france_vichy = { transfer_state = PREV }
				}
				every_state = {
					limit = {
						is_controlled_by = ROOT
						OR = {
							state = 735
							state = 21
							state = 851
							state = 32
							state = 20
							state = 26
							state = 22
							state = 31
							state = 25
							state = 33
						}
					}
					add_core_of = PREV
					event_target:france_vichy = { transfer_state = PREV }
				}
				every_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						NOT = {
							is_controlled_by = event_target:france_vichy
						}
					}
					add_core_of = PREV
				}
				set_capital = { state = 26 }
				set_politics = {
					ruling_party = fascism
					elections_allowed = no
				}
				set_popularities = {
					democratic = 0
					neutrality = 20
					fascism = 80
					communism = 0
				}
				FRA = {
					FRA_philippe_petain= {
						set_nationality = event_target:france_vichy	
					}
				}
				FRA_philippe_petain= {
					add_country_leader_role = {
						country_leader = {
							expire = "1965.1.1"
							ideology = fascism_ideology
							traits = {
								
							}
						}
						promote_leader = yes
					}
				}
				set_cosmetic_tag = FRA_VICHY
				add_ideas = FRA_occupation_costs_4
				load_focus_tree = vichy_french_focus
				FRA = {
					transfer_units_fraction = {
						target = event_target:france_vichy
						size = 0.9
						stockpile_ratio = 0.7
						army_ratio = 0.5
						navy_ratio = 0.85
						air_ratio = 1.0
					}
				}
				event_target:france_vichy = {set_country_flag  = vichy_france}
				
				change_tag_from = FRA
			}
		}
	}
}

FRA_weapons_purchases_category = {
	FRA_order_weapons_in_USA = {
	icon = generic_prepare_civil_war
		available = {
			
		}
		visible = {
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		cost = 50
		ai_will_do = {
			factor = 10
			modifier = {
				has_equipment = {
					infantry_equipment < 1
				}
				factor = 50
			}
			modifier = {
				has_manpower < 10000 
				factor = 0 #need to up conscription laws
			}
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 2 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = 2500
			}
			if = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				add_equipment_subsidy = {
					cic = 500
					equipment_type = infantry_equipment
					seller_tags = { USA } 
				}
			}

			USA = {
				add_offsite_building = { type = industrial_complex level = -2 }
			}
		}
	}
	FRA_order_artillery_in_USA = {
		icon = ger_military_buildup
		available = {
			
		}
		visible = {
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		cost = 75
		ai_will_do = {
			factor = 5
			modifier = {
				has_equipment = {
					artillery_equipment < 1
				}
				factor = 50
			}
			modifier = {
				has_manpower < 10000 
				factor = 0 #need to up conscription laws
			}
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 3 }
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = artillery_equipment
				amount = 75
			}
			if = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				add_equipment_subsidy = {
					cic = 250
					equipment_type = artillery_equipment
					seller_tags = { USA } 
				}
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -3 }
			}
		}
	}
	FRA_order_tanks_in_USA = {
		icon = generic_air
		available = {
			
		}
		visible = {
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		cost = 100
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					light_tank_chassis < 50
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000 
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			if = {
				limit = {
					USA = { 
						OR = {
							has_tech = basic_light_tank 
							has_tech = basic_light_tank_chassis
						}
						NOT = { 
							OR = {
								has_tech = basic_medium_tank 
								has_tech = improved_medium_tank #needed because basic can be bypassed
								has_tech = basic_medium_tank_chassis
								has_tech = improved_medium_tank_chassis
							}
						}
					}
				}
				add_equipment_to_stockpile = {
					type = light_tank_chassis
					amount = 50
				}
				if = {
					limit = {
						has_dlc = "Arms Against Tyranny"
					}
					add_equipment_subsidy = {
						cic = 500
						equipment_type = light_tank_chassis
						seller_tags = { USA } 
					}
				}
			}
			else_if = {
				limit = {
					USA = {
						OR = {
							has_tech = basic_medium_tank 
							has_tech = improved_medium_tank #needed because basic can be bypassed
							has_tech = basic_medium_tank_chassis
							has_tech = improved_medium_tank_chassis
						}
					}
				}
				add_equipment_to_stockpile = {
					type = medium_tank_chassis
					amount = 50
				}
				if = {
					limit = {
						has_dlc = "Arms Against Tyranny"
					}
					add_equipment_subsidy = {
						cic = 500
						equipment_type = medium_tank_chassis
						seller_tags = { USA } 
					}
				}
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
	FRA_order_fighters_in_USA = {
		icon = generic_air
		available = {
			
		}
		visible = {
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		cost = 100
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					small_plane_airframe < 1
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000 
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			if = {
				limit = {
					NOT = { has_dlc = "By Blood Alone" }
				}
				add_equipment_to_stockpile = {
					type = fighter_equipment_1
					amount = 50
					producer = USA
				}
			}
			else = {
				add_equipment_to_stockpile = {
					type = small_plane_airframe_1
					amount = 50
					producer = USA
					variant_name = "P-36A"
				}	
			}
			if = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				add_equipment_subsidy = {
					cic = 500
					equipment_type = small_plane_airframe
					seller_tags = { USA } 
				}
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
	FRA_order_bombers_in_USA = {
		icon = generic_air
		available = {
			
		}
		visible = {
			USA_can_sell_weapons_trigger = yes
		}
		days_remove = 60
		cost = 100
		ai_will_do = {
			factor = 1
			modifier = {
				has_equipment = {
					medium_plane_airframe < 1
				}
				factor = 5
			}
			modifier = {
				has_manpower < 10000 
				factor = 0 #need to up conscription laws
			}
		}
		modifier = {
			
		}
		complete_effect = {
			USA = {
				add_offsite_building = { type = industrial_complex level = 5 }
			}
		}
		remove_effect = {
			if = {
				limit = {
					NOT = { has_dlc = "By Blood Alone" }
				}
				add_equipment_to_stockpile = {
					type = tac_bomber_equipment_1
					amount = 25
					producer = USA
				}
			}
			else = {
				add_equipment_to_stockpile = {
					type = medium_plane_airframe_1
					amount = 25
					producer = USA
					variant_name = "B-18"
				}
			}
			if = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				add_equipment_subsidy = {
					cic = 500
					equipment_type = medium_plane_airframe
					seller_tags = { USA } 
				}
			}
			USA = {
				add_offsite_building = { type = industrial_complex level = -5 }
			}
		}
	}
}

VIC_concessions_to_the_germans = {
	VIC_basing_rights = {
		available = {

		}
		visible = {
			has_any_occupation_cost_trigger = yes
		}

		cost = 25

		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				has_idea = FRA_occupation_costs_4
				factor = 5
			}
			modifier = {
				has_idea = FRA_occupation_costs_3
				factor = 2
			}
			modifier = {
				has_idea = FRA_occupation_costs_2
				factor = 1.5
			}
		}
		complete_effect = {
			give_military_access = GER
			reduce_occupation_cost_effect = yes
		}
	}

	VIC_produce_aircraft_parts = {
		available = {}

		visible = {
			has_any_occupation_cost_trigger = yes
		}

		cost = 25

		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				has_idea = FRA_occupation_costs_4
				factor = 5
			}
			modifier = {
				has_idea = FRA_occupation_costs_3
				factor = 2
			}
			modifier = {
				has_idea = FRA_occupation_costs_2
				factor = 1.5
			}
		}
		complete_effect = {
			add_ideas = VIC_produce_aircraft_parts
			GER = { add_ideas = VIC_aircraft_parts }
			reduce_occupation_cost_effect = yes
		}
	}
	VIC_send_guest_workers = {
		available = {
			
		}
		visible = { has_any_occupation_cost_trigger = yes }
		cancel_trigger = {
			not = { has_country_flag = VIC_send_guest_workers }
		}
		cost = 25
		ai_will_do = {
			factor = 1
			modifier = {
				has_idea = FRA_occupation_costs_4
				factor = 5
			}
			modifier = {
				has_idea = FRA_occupation_costs_3
				factor = 2
			}
			modifier = {
				has_idea = FRA_occupation_costs_2
				factor = 1.5
			}
		}
		fire_only_once = yes
		days_remove = -1
		modifier = {
			conscription_factor = -0.25
		}
		complete_effect = {
			GER = { add_ideas = VIC_guest_workers }
			reduce_occupation_cost_effect = yes
			set_country_flag = VIC_send_guest_workers
		}
	}
	VIC_recall_guest_workers = {
		available = {
			has_country_flag = VIC_send_guest_workers
		}
		visible = { 
		 	has_country_flag = VIC_send_guest_workers
		}
		cost = 0
		ai_will_do = {
			factor = 0
			modifier = {
				controls_state = 16
				add = 10
			}
		}
		fire_only_once = yes
		complete_effect = {
			GER = { remove_ideas = VIC_guest_workers }
			if = {
				limit = {
					NOT = {
						controls_state = 16
					}
				}
				increase_occupation_cost_effect = yes
			}
			if = {
				limit = {
					controls_state = 16
					has_idea = FRA_mandatory_work_service
				}
				remove_ideas = FRA_mandatory_work_service
			}
			clr_country_flag = VIC_send_guest_workers
		}
}	
}
FRA_decolonization = {
	FRA_independence_for_syria_mission = {
		available = {
			country_exists = LEB
			country_exists = SYR
		}

		activation = {
			has_country_flag = FRA_syria_promised_independence
			has_war = no
			NOT = {
				country_exists = SYR
				country_exists = LEB
			}
			680 = { is_controlled_by = ROOT }
			677 = { is_controlled_by = ROOT }
			554 = { is_controlled_by = ROOT }
			553 = { is_controlled_by = ROOT }
		}

		days_mission_timeout = 180

		timeout_effect = {
			every_state = {
				limit = {
					OR = {
						is_core_of = LEB
						is_core_of = SYR
					}
				}
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}
	FRA_independence_for_indochina_mission = {
		available = {
			country_exists = LAO
			country_exists = CAM
			country_exists = VIN
		}

		activation = {
			has_country_flag = FRA_indochina_promised_independence
			has_war = no
			NOT = {
				country_exists = CAM
				country_exists = LAO
				country_exists = VIN
			}
			671 = { is_controlled_by = ROOT }
			670 = { is_controlled_by = ROOT }
			286 = { is_controlled_by = ROOT }
			741 = { is_controlled_by = ROOT }	
		}

		days_mission_timeout = 180

		timeout_effect = {
			every_state = {
				limit = {
					OR = {
						is_core_of = LAO
						is_core_of = CAM
						is_core_of = VIN
					}
				}
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}
	FRA_independence_for_madagascar_mission = {
		available = {
			country_exists = MAD
		}

		activation = {
			has_country_flag = FRA_madagascar_promised_independence
			has_war = no
			NOT = {
				country_exists = MAD
			}
			543 = { is_controlled_by = ROOT }
		}

		days_mission_timeout = 180

		timeout_effect = {
			543 = {
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}
	FRA_independence_for_north_africa_mission = {
		available = {
			country_exists = ALG
			country_exists = MOR
			country_exists = TUN
		}

		activation = {
			has_country_flag = FRA_north_africa_promised_independence
			has_war = no
			NOT = {
				country_exists = MOR
				country_exists = ALG
				country_exists = TUN
			}
			461 = { is_controlled_by = ROOT }
			462 = { is_controlled_by = ROOT }
			459 = { is_controlled_by = ROOT }
			513 = { is_controlled_by = ROOT }
			460 = { is_controlled_by = ROOT }
			458 = { is_controlled_by = ROOT }
			665 = { is_controlled_by = ROOT }	
		}

		days_mission_timeout = 180

		timeout_effect = {
			every_state = {
				limit = {
					OR = {
						is_core_of = ALG
						is_core_of = MOR
						is_core_of = TUN
					}
				}
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}
	FRA_independence_for_west_africa_mission = {
		available = {
			country_exists = NGR
			country_exists = DAH
			country_exists = TOG
			country_exists = VOL
			country_exists = IVO
			country_exists = MLI
			country_exists = GNA
			country_exists = SEN
			country_exists = MRT
			
		}

		activation = {
			has_country_flag = FRA_west_africa_promised_independence
			has_war = no
			NOT = {
				country_exists = NGR
				country_exists = DAH
				country_exists = TOG
				country_exists = VOL
				country_exists = IVO
				country_exists = MLI
				country_exists = GNA
				country_exists = SEN
				country_exists = MRT
			}
			FRA_controls_west_africa = yes
		}

		days_mission_timeout = 180

		timeout_effect = {
			every_state = {
				limit = {
					OR = {
						is_core_of = NGR
						is_core_of = DAH
						is_core_of = TOG
						is_core_of = VOL
						is_core_of = IVO
						is_core_of = MLI
						is_core_of = GNA
						is_core_of = SEN
						is_core_of = MRT
					}
				}
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}
	FRA_independence_for_central_africa_mission = {
		available = {
			country_exists = RCG
			country_exists = GAB
			country_exists = CAR
			country_exists = CMR
			country_exists = CHA
			
		}

		activation = {
			has_country_flag = FRA_central_africa_promised_independence
			has_war = no
			NOT = {
				country_exists = RCG
				country_exists = GAB
				country_exists = CAR
				country_exists = CMR
				country_exists = CHA
			}
			FRA_controls_central_africa = yes
		}

		days_mission_timeout = 180

		timeout_effect = {
			every_state = {
				limit = {
					OR = {
						is_core_of = RCG
						is_core_of = GAB
						is_core_of = CAR
						is_core_of = CMR
						is_core_of = CHA
					}
				}
				add_resistance_target = {
					amount = 10
					tooltip = FRA_promised_independence_tt
				}
			}
		}
	}	
}
