frontline_decision = {
	
	clear_all_border_strategies = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			OR = {
				any_country = {
					is_in_faction_with = ROOT
					has_country_flag = help_player 
				}
				any_country = { 
					is_in_faction_with = ROOT
					has_country_flag = avoid_player_like_a_plague
				}
			}
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Remove all AI frontline strategies"
			hidden_effect = {
				every_country = {
					limit = {
						is_in_faction_with = ROOT
						OR = {
							has_country_flag = help_player
							has_country_flag = avoid_player_like_a_plague
						}
					}
					clr_country_flag = help_player
					clr_country_flag = avoid_player_like_a_plague
				}
				every_country = {
					limit = {
						has_war_with = ROOT		
						OR = {
							has_country_flag = LSM_designated_target
						}
					}
					clr_country_flag = LSM_designated_target
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	clear_all_state_border_strategies = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			OR = {
				any_state = { 
					has_state_flag = LSM_designated_state_target
					is_in_array = {
						array = ROOT.designated_state_target
						value = THIS
					}
				}
			}
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Remove all AI frontline strategies for state"
			hidden_effect = {
				every_state = {
					limit = {
						has_state_flag = LSM_designated_state_target
						is_in_array = {
							array = ROOT.designated_state_target
							value = THIS
						}
					}
					remove_from_array = {
						array = ROOT.designated_state_target
						value = THIS
					}
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	enable_set_designated_target = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
			NOT = { any_country = { has_country_flag = LSM_designated_target } }
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Enable selection of a designated target. Clear designated target flag to return AI strategy to normal."
			hidden_effect = {
				set_country_flag = LSM_designated_target_enabled
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	disable_set_designated_target = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
			NOT = { any_country = { has_country_flag = LSM_designated_target } }
			has_country_flag = LSM_designated_target_enabled
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Disable selection of a designated target. Clear designated target flag to return AI strategy to normal."
			hidden_effect = {
				clr_country_flag = LSM_designated_target_enabled
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	
	set_designated_target = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		target_trigger = {
			OR = {
				FROM.OWNER = { has_war_with = ROOT }	
				FROM.OWNER = { is_major = yes }
			}
		}

		visible = {
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
			NOT = { any_country = { has_country_flag = LSM_designated_target } }
			has_country_flag = LSM_designated_target_enabled
		}

		allowed = {
			always = yes
		}
		on_map_mode = map_only
		state_target = yes
		target_trigger = {
			FROM = {
				OR = {
					AND = {
						has_variable = historical_capital_for_country
						var:historical_capital_for_country = {
							exists = yes
							has_capitulated = yes
							NOT = { tag = ROOT }
						}
					}
					AND = {
						is_capital = yes
						CONTROLLER = {
							NOT = {
								tag = ROOT
							}
						}
					}
				}
			}
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Selected country will be designated to be coordinated with faction members for frontline strategy diplomatic actions. Only one country can be designated for now for bug testing."
			hidden_effect = {
				FROM.owner = { set_country_flag = LSM_designated_target }
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	clear_designated_target = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		target_trigger = {
			FROM = { has_war_with = ROOT }
			FROM = { has_country_flag = LSM_designated_target }
		}

		visible = {
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
			any_country = { has_country_flag = LSM_designated_target }
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Selected country will no longer be designated to be coordinated with faction members for frontline strategy diplomatic actions. Only one country can be designated for now."
			hidden_effect = {
				FROM = { clr_country_flag = LSM_designated_target }
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	enable_set_designated_target_state = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			NOT = { any_state = { has_state_flag = LSM_designated_state_target } }
			NOT = { has_country_flag = LSM_designated_state_target_enabled }
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Enable selection of a designated target for specific states. Clear designated target flag to return AI strategy to normal."
			hidden_effect = {
				set_country_flag = LSM_designated_state_target_enabled
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	disable_set_designated_target_state = {

		icon = GFX_decision_generic_decision

		available = {
			is_in_faction = yes
		}

		visible = {
			NOT = { any_state = { has_state_flag = LSM_designated_state_target } }
			has_country_flag = LSM_designated_state_target_enabled
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Disable selection of a designated target. Clear designated target flag to return AI strategy to normal."
			hidden_effect = {
				clr_country_flag = LSM_designated_state_target_enabled
			}
		}
		ai_will_do = {
			factor = 0
		}
	}

	
	set_designated_target_state = {

		icon = GFX_decision_generic_protection

		available = {
			is_in_faction = yes
		}

		target_trigger = {
			OR = {
				FROM.OWNER = { has_war_with = ROOT }	
				FROM.OWNER = { is_major = yes }
			}
		}

		visible = {
			has_country_flag = LSM_designated_state_target_enabled
			if = {
				limit = { has_global_flag = mp_difficulty }
				is_faction_leader = yes
			}
			
		}

		allowed = {
			always = yes
		}
		on_map_mode = map_only
		state_target = yes
		target_trigger = {
			FROM = {
				controller = { has_war_with = ROOT }
				any_neighbor_state = {
					controller = {
						OR = {
							tag = ROOT
							is_in_faction_with = ROOT
							is_subject_of = ROOT
						}
					}
				}
				NOT = { has_state_flag = LSM_designated_state_target }
			}
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Selected state will be designated to be coordinated with faction members for frontline strategy diplomatic actions. Only one country can be designated for now for bug testing."
			hidden_effect = {
				FROM = { set_state_flag = LSM_designated_state_target }
				FROM = {
					ROOT = {
						add_to_array = {
							array = ROOT.designated_state_target
							value = PREV
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
	
	clear_designated_target_state = {

		icon = GFX_decision_FIN_stop_motti_tactics

		available = {
			is_in_faction = yes
		}
		on_map_mode = map_only
		state_target = yes
		target_trigger = {
			FROM = {
				has_state_flag = LSM_designated_state_target
			}
		}

		visible = {
			any_state = { has_state_flag = LSM_designated_state_target }
		}

		allowed = {
			always = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			custom_effect_tooltip = "Selected state will no longer be designated to be coordinated with faction members for frontline strategy diplomatic actions. Only one country can be designated for now."
			hidden_effect = {
				FROM = { clr_state_flag = LSM_designated_state_target }
				FROM = {
					ROOT = {
						remove_from_array = {
							array = ROOT.designated_state_target
							value = PREV
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
}

war_measures = {

	JAP_demand_puppet_manpower = {
	
		icon = GFX_decision_generic_military

		fire_only_once = yes

		allowed = {
			tag = JAP
		}

		available = {
			has_war = yes
		}

		visible = {
			any_country = { is_subject_of = JAP }
		}

		target_trigger = {
			FROM = {
				is_in_faction_with = JAP
				is_subject_of = JAP
				has_manpower > 20000
			}
		}		


		days_remove = 30

		complete_effect = {
			hidden_effect = {
				if = {
					limit = {
						FROM = {
							NOT = { has_country_flag = first_time_check }
						}
					}
					FROM = {
						set_country_flag = first_time_check
						set_variable = { japan_has_demanded_our_conscription = 0 }
						add_to_variable = { japan_has_demanded_our_conscription = 1 }
					}
				}
				else_if = {
					limit = {
						FROM = {
							has_country_flag = first_time_check
						}
					}
					FROM = {
						add_to_variable = { japan_has_demanded_our_conscription = 1 }
					}
				}
			}
			FROM = { 
				country_event = { id = LSM_equipment.29 } 
			}
			effect_tooltip = {
				FROM = { 
					add_manpower = -20000
				}
				JAP = { 
					add_manpower = 20000
				}
			}
		}

		ai_will_do = {
			factor = 100
			modifier = {
				factor = 0
				has_manpower > 500000
			}
			modifier = {
				factor = 0
				FROM = { check_variable = { japan_has_demanded_our_conscription > 8 } }
			}
		}
	}
	
	d_day_preparation_state_decision = {

		icon = GFX_decision_generic_protection

		available = {
			has_idea = d_day_preparation_1
			custom_trigger_tooltip = {
				tooltip = "Not any other countries are making preparation in this statee"
				NOT = { FROM = { has_state_flag = d_day_preparation_being_upgraded } }
			}
		}

		target_trigger = {
			OR = {
				FROM.CONTROLLER = { is_in_faction_with = ROOT }
				FROM.CONTROLLER = { tag = ROOT }
			}
			FROM = { can_upgrade_d_day_state_modifier = yes }
		}

		visible = {
			has_idea = d_day_preparation_1
			is_in_faction = yes
		}

		allowed = {
			always = yes
		}
		on_map_mode = map_only
		state_target = yes

		fire_only_once = no

		custom_cost_text = decision_cost_d_day_convoy_cp

		custom_cost_trigger = {
			command_power > 9
			has_equipment = {
				convoy > 49
			}
		}

		days_remove = 30

		modifier = {
			consumer_goods_factor = 0.05
		}

		complete_effect = {
			add_command_power = -10
			add_equipment_to_stockpile = { 
				type = convoy_1
				amount = -50
			}
			hidden_effect = { FROM = { set_state_flag = d_day_preparation_being_upgraded } }
		}


		remove_effect = {
			add_equipment_to_stockpile = { 
				type = convoy_1
				amount = 40
			}
			FROM = { upgrade_d_day_state_modifier = yes }
			hidden_effect = { FROM = { clr_state_flag = d_day_preparation_being_upgraded } }
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 200
				FROM = { is_core_of = LBA }
			}
			modifier = {
				factor = 30
				FROM = { is_core_of = ENG }
			}
			modifier = {
				factor = 50
				FROM = { is_core_of = TUN }
			}
			modifier = {
				factor = 50
				FROM = { is_core_of = EGY }
			}
			modifier = {
				factor = 20
				FROM = { is_core_of = ALG }
			}
			modifier = {
				factor = 500
				FROM = { 
					OR = {
						state = 1
						state = 114
						state = 116
					}
				}
			}
		}
	}

	SOV_doomsday_anti_air = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "Industry can readily handle the burden"
				OR = {
					human_is_bombing_us_without_attacking = yes
					is_ai = no
				}
			}
		}

		visible = {
			original_tag = SOV
			has_war = yes
			OR = {
				GER_is_human_yes_air = yes
				GER_is_super_ai_yes_air = yes
				human_is_observer = yes
			}
		}

		modifier = { 
			consumer_goods_factor = 0.2
		}

		remove_effect = {
			every_state = {
				limit = {
					is_core_of = SOV
					any_neighbor_state = {
						controller = { has_war_with = SOV }
					}
					free_building_slots = {
						building = anti_air_building 
						size > 0 
					}
				}
				add_building_construction = {
					type = anti_air_building
					level = 1
					instant_build = yes
				}
			}
		}

		days_re_enable = 150 #mark twice a year

		days_remove = 30

		ai_will_do = {
			factor = 50
		}
	}

	GER_doomsday_air_base = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "Industry can readily handle the burden"
				OR = { 
					is_ai = no
					SOV = { divisions_in_state = { state = 202 size > 10 } }
					SOV = { divisions_in_state = { state = 207 size > 10 } }
					SOV = { divisions_in_state = { state = 241 size > 10 } }
				}
			}
		}

		visible = {
			202 = {
				controller = {
					NOT = { is_in_faction_with = GER }
				}
			}
			original_tag = GER
			OR = {
				has_war_with = SOV
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_strike_at_the_source
						progress > 0
					}
				}
			}
			any_state = {
				controller = { is_in_faction_with = GER }
				any_neighbor_state = {
					controller = { is_in_faction_with = SOV }
				}
				free_building_slots = {
					building = air_base 
					size > 2 
				}
			}
			has_deployed_air_force_size = {
				type = fighter
				size > 3999 #we are in the fight
			}	
		}

		modifier = { 
			civilian_factory_use = 45
		}

		remove_effect = {
			random_state = {
				limit = {
					controller = { is_in_faction_with = GER }
					any_neighbor_state = {
						controller = { is_in_faction_with = SOV }
					}
					free_building_slots = {
						building = air_base 
						size > 2 
					}
				}
				add_building_construction = {
					type = air_base
					level = 3
					instant_build = yes
				}
			}
		}

		days_re_enable = 14

		days_remove = 5

		ai_will_do = {
			factor = 50
		}
	}

	GER_doomsday_air_base_3 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "Industry can readily handle the burden"
				OR = { 
					is_ai = no
					202 = { is_fully_controlled_by = GER }
				}
			}
		}

		visible = {
			202 = { is_fully_controlled_by = GER }
			original_tag = GER
			has_war_with = SOV
			any_state = {
				controller = { is_in_faction_with = GER }
				any_neighbor_state = {
					controller = { is_in_faction_with = SOV }
				}
				free_building_slots = {
					building = air_base 
					size > 0 
				}
			}
			has_deployed_air_force_size = {
				type = fighter
				size > 3999 #we are in the fight
			}	
		}

		modifier = { 
			civilian_factory_use = 15
		}

		remove_effect = {
			random_state = {
				limit = {
					controller = { is_in_faction_with = GER }
					any_neighbor_state = {
						controller = { is_in_faction_with = SOV }
					}
					free_building_slots = {
						building = air_base 
						size > 0 
					}
				}
				add_building_construction = {
					type = air_base
					level = 1
					instant_build = yes
				}
			}
		}

		days_re_enable = 6

		days_remove = 6

		ai_will_do = {
			factor = 50
		}
	}
	
	GER_negotiate_peace = {

		icon = GFX_decision_generic_decision

		available = {
			has_war = yes
		}

		visible = {
			OR = {
				AND = {
 					has_war_with = SOV
					ENG = { has_capitulated = yes }
				}
				all_state = {
					OR = {
						NOT = { is_core_of = SOV }
						owner = { is_in_faction_with = GER }
					}
				}
			}
			has_global_flag = a1_done
		}

		fire_only_once = yes

		cost = 0

		complete_effect = {
			custom_effect_tooltip = GER_negotiate_peace_tooltip_tt
		}
		ai_will_do = {
			factor = 201
		}
	}
	
	FRA_a_better_capital_state = {

		icon = GFX_decision_generic_military

		available = {
			has_war = yes
		}

		visible = {
			controls_state = 459
			NOT = {
				capital_scope = {
					OR = {
						is_on_continent = europe
						is_on_continent = africa
					}
				}
			}
			is_ai = yes
		}

		fire_only_once = no

		cost = 0

		complete_effect = {
			hidden_effect = {
				set_capital = { state = 459 }
			}
		}
		ai_will_do = {
			factor = 201
		}
	}
	
	SOV_diversify_special_forces = {

		icon = GFX_decision_generic_military

		available = {
			date > 1940.1.1
		}

		visible = {
			AND = {
				is_major = yes
				has_dlc = "Arms Against Tyranny"
				tag = SOV
			}
		}

		fire_only_once = yes

		cost = 50

		complete_effect = {
			add_potential_special_forces_tree = yes
		}
		ai_will_do = {
			factor = 201
		}
	}

	organise_legion_volunteer = {
	
		icon = generic_military.

		fire_only_once = no

		target_array = ROOT.allies

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
			custom_trigger_tooltip = {
				tooltip = "Fuel may be transported to [FROM.GetNameDef]"
			}
		}

		visible = { 
			has_manpower > 1000000
			is_faction_leader = no
		}

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_major = yes
				is_neighbor_of = ROOT
				has_manpower < 1000000
			}
		}		


		days_remove = 30

		days_re_enable = 90

		complete_effect = {
			add_manpower = -50000
		}

		remove_effect = {
			FROM = { 
				add_manpower = 50000
				country_event = { id = LSM_equipment.9 } 
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}


	fuel_sharing = {
	
		icon = oil

		fire_only_once = no

		target_array = ROOT.allies

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
			custom_trigger_tooltip = {
				tooltip = "Fuel may be transported to [FROM.GetNameDef]"
			}
		}

		visible = { 
			has_fuel > 50000
			fuel_ratio > 0.5
			if = {
				limit = { 
					FROM = { tag = ENG }  
					ROOT = { NOT = { tag = FRA } }
				}
				ROOT = { has_equipment =  { convoy > 49 } }
				FROM = { has_equipment =  { convoy > 49 } }
			}
			if = {
				limit = { 
					FROM = { tag = ENG }  
					ROOT = { tag = FRA }
				}
				ROOT = { has_equipment =  { convoy > 19 } }
				FROM = { has_equipment =  { convoy > 19 } }
			}
			if = {
				limit = { 
					FROM = { tag = JAP } 
					ROOT = { NOT = { tag = MAN } }
				}
				ROOT = { has_equipment = { convoy > 49 } }
				FROM = { has_equipment =  { convoy > 49 } }
			}
			if = {
				limit = { 
					FROM = { tag = JAP } 
					ROOT = { tag = MAN }
				}
				ROOT = { has_equipment = { convoy > 19 } }
				FROM = { has_equipment =  { convoy > 19 } }
			}
			if = {
				limit = { 
					FROM = { capital_scope = { is_on_continent = europe } } 
					NOT = { FROM = { capital_scope = { is_on_continent = europe } } }
				}
				ROOT = { has_equipment = { convoy > 74 } }
				FROM = { has_equipment =  { convoy > 74 } }
			}
			if = {
				limit = { 
					OR = {
						FROM = { capital_scope = { is_on_continent = north_america } } 
						FROM = { capital_scope = { is_on_continent = south_america } }
					} 
					NOT = { FROM = { capital_scope = { is_on_continent = north_america } } } 
					NOT = { FROM = { capital_scope = { is_on_continent = south_america } } }
				}
				ROOT = { has_equipment = { convoy > 74 } }
				FROM = { has_equipment =  { convoy > 74 } }
			}
		}

		target_trigger = {
			FROM = {
				is_in_faction_with = ROOT
				is_major = yes
				fuel_ratio < 0.5
			}
		}		


		days_remove = 14

		complete_effect = {
			add_fuel = -50000
		}

		remove_effect = {
			random_list = {
				20 = {
					FROM = {
						add_fuel = 50000
					}
				}
				30 = {
					FROM = {
						add_fuel = 48000
					}
				}
				30 = {
					FROM = {
						add_fuel = 45000
					}
				}
				20 = {
					FROM = {
						add_fuel = 43000
					}
				}
			}
		}

		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				is_faction_leader = yes
			}
		}
	}

	GER_ally_border_defense = {
	
		icon = generic_military

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			tag = GER
			NOT = { has_global_flag = GER_ally_support }
			is_ai = no
		}

		complete_effect = {
			custom_effect_tooltip = GER_ally_border_defense_tt
			set_global_flag = GER_ally_support
			clr_global_flag = GER_ally_ignore
		}

		ai_will_do = {
			factor = 1000
		}
	}

	GER_ally_border_ignore = {
	
		icon = generic_military

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			tag = GER
			has_global_flag = GER_ally_support
			is_ai = no
		}

		complete_effect = {
			clr_global_flag = GER_ally_support
		}

		ai_will_do = {
			factor = 0
		}
	}

	SOV_convert_paratrooper_to_elite_guard = {
	
		icon = generic_military

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			surrender_progress > 0
		}

		visible = {
			tag = SOV
			has_war = yes
			NOT = { has_country_flag = the_paratrooper_fumble }
		}

		days_re_enable = 365

		complete_effect = {
			set_country_flag = the_paratrooper_fumble
			custom_effect_tooltip = "Paratroopers will be converted to Elite Guard divisions and will be DISASTROUS at their original role. At least six months must have passed before paratroopers can be retrained."
			hidden_effect = { set_technology = { elite_infantry_paratrooper = 1 popup = no } }
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_retrain_paratrooper = {
	
		icon = generic_military

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		visible = {
			tag = SOV
			has_war = yes
			has_country_flag = {
				flag = the_paratrooper_fumble
				days > 180
			}
		}

		days_re_enable = 365

		complete_effect = {
			clr_country_flag = the_paratrooper_fumble
			custom_effect_tooltip = "Paratroopers will be retrained for their original role"
			hidden_effect = { set_technology = { elite_infantry_paratrooper = 0 popup = no } }
		}

		ai_will_do = {
			factor = 0
		}
	}

	JAP_emergency_training_program = {
	
		icon = generic_military

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			surrender_progress > 0.03
		}

		visible = {
			tag = JAP
			JAP = { has_war = yes }
		}

		complete_effect = {
			custom_effect_tooltip = "The people of Japan brace themselves..."
			add_timed_idea = { idea = JAP_for_the_emperor_ns days = 120 }
			hidden_effect = {
				set_technology = { JAP_for_the_emperor_tech = 1 popup = no }
				division_template = {
					name = "Peasant Militia"
					priority = 1
					is_locked = yes
					division_names_group = JAP_INF_01
					regiments = {
						militia = { x = 0 y = 0 }
						militia = { x = 0 y = 1 }
						militia = { x = 0 y = 2 }
						militia = { x = 1 y = 0 }
						militia = { x = 1 y = 1 }
						militia = { x = 1 y = 2 }
					}
					support = {
						artillery = { x = 0 y = 0 }
					}
				}
			}
		}

		ai_will_do = {
			base = 0
			modifier = {
				add = 10
				OR = {
					surrender_progress > 0.03
					NOT = {
						any_state = {
							is_core_of = CHI
							is_controlled_by = JAP
						}
					}
				}
			}
		}
	}

	MAN_backstab_Japan = {
	
		icon = generic_ignite_civil_war

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			JAP = { has_war = yes }
			any_state = {
				is_owned_by = JAP
				is_core_of = CHI
			}
		}

		visible = {
			tag = MAN
			OR = {
				CHI = { is_subject_of = JAP }
				NOT = { country_exists = CHI }
			}
			is_in_faction_with = JAP
			any_country = {
				is_major = yes
				has_war_with = JAP
			}
		}
	
		days_remove = 120

		war_with_on_remove = JAP

		remove_effect = {
			every_country = {
				limit = {
					has_war_with = JAP
				}
				add_ai_strategy = {
					type = alliance
					id = "MAN"
					value = 500
				}
				if = { 
					limit = { 
						has_war_with = MAN
					}
					white_peace = MAN
				}
			}
			JAP = { set_autonomy = { target = MAN autonomy_state = autonomy_free } }
			every_country = { 
				limit = { 
					is_in_faction_with = MAN 
					is_faction_leader = yes 
				}
				remove_from_faction = MAN 
			}
			MAN = { declare_war_on = { target = JAP type = annex_everything } }
		}

		ai_will_do = {
			factor = 0
		}
	}

	UK_US_invade_vichy_france = {
	
		icon = generic_ignite_civil_war

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		visible = {
			any_country = {
				original_tag = FRA
				has_government = fascism
				NOT = { has_war_with = ENG }
				OR = {
					is_in_faction_with = GER
					16 = { is_controlled_by = GER }
				}
				ROOT = { can_declare_war_on = PREV }
			}
			original_tag = ENG
			ENG = { is_in_faction_with = USA }
			is_historical_focus_on = yes
		}
	
		days_remove = 30
		
		complete_effect = {
			custom_effect_tooltip = "Invading Vichy France yeah bro"
			set_global_flag = allied_invasion_of_vichy_france
		}

		remove_effect = {
			hidden_effect = {
				clr_global_flag = allied_invasion_of_vichy_france
				every_country = {
					limit = { 
						original_tag = FRA
						has_government = fascism
						NOT = { has_war_with = ENG }
					}
					ROOT = { create_wargoal = { target = PREV type = take_state } }
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	allies_in_asia = {
	
		icon = generic_merge_plant_ship

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		visible = {
			OR = {
				is_in_faction_with = ENG
				tag = ENG
				tag = USA
			}
			has_war_with = JAP
			has_idea = ENG_victor_of_world_war_ii
		}

		complete_effect = {
			custom_effect_tooltip = "Home Island Landing Preparation"
			hidden_effect = {
				add_ideas = landing_in_asia
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	allies_naval_landing_preparation = {
	
		icon = generic_merge_plant_ship

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		days_re_enable = 365

		visible = {
			if = {
				limit = { is_ai_mech_mob = yes }
				is_ai = no
			}
			OR = {
				is_in_faction_with = ENG
				tag = ENG
				tag = USA
			}
			has_war_with = GER
			OR = {
				has_global_flag = allied_victory_in_africa
				date > 1943.1.1
				ENG = { is_in_faction_with = USA }
				is_ai = no
				any_country = {
					is_in_faction_with = ROOT
					OR = {
						has_idea = d_day_preparation_1
						has_idea = d_day_preparation_2
						has_idea = d_day_preparation_3
					}
				}
			}
			OR = {
				date > 1943.1.1
				AND = {
					date > 1941.6.1
					ENG = { is_in_faction_with = FRA }
					ENG = { is_in_faction_with = USA }
					FRA = { surrender_progress < 0.3 }
				}
				FRA = { has_country_flag = LSM_eligibility_nation }
			}
			date > 1940.3.1
			NOT = { has_idea = d_day_preparation_1 }
			NOT = { has_idea = d_day_preparation_2 }
			NOT = { has_idea = d_day_preparation_3 }
		}

		complete_effect = {
			custom_effect_tooltip = d_day_preparation_tt
			add_ideas = d_day_preparation_1
			add_equipment_to_stockpile = { 
				type = convoy_1
				amount = 250
				producer = ROOT
			}
			hidden_effect = {
				set_country_flag = d_day_prep_flag
				if = {
					limit = { 
						OR = {
							tag = BRA 
							tag = ARG 
							tag = CHL 
							tag = URG
						}
					}
					add_equipment_to_stockpile = { 
						type = convoy_1
						amount = 75
						producer = ENG
					}
					add_equipment_to_stockpile = { 
						type = convoy_1
						amount = 200
						producer = USA
					}
				}
				hidden_effect = {
					add_tech_bonus = {
						name = UK_secret_focus
						bonus = 3.0
						technology = mtg_transport
					}
					add_tech_bonus = {
						name = UK_secret_focus
						bonus = 3.0
						technology = mtg_landing_craft
					}
					add_tech_bonus = {
						name = UK_secret_focus
						bonus = 3.0
						technology = mtg_tank_landing_craft
					}
				}	
			}
		}

		ai_will_do = {
			factor = 1000
			modifier = {
				factor = 0
				date < 1941.12.1 
			}
		}
	}

	allies_naval_landing_d_day_launch = {
	
		icon = generic_merge_plant_ship

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_war_with = GER
			has_idea = d_day_preparation_1	
			OR = {
				is_ai = no
				if = {
					limit = {
						OR = {
							is_in_faction_with = ENG
							is_in_faction_with = USA
						}
					}
					custom_trigger_tooltip = {
						tooltip = d_day_launch_trigger_tt_a
						OR = {
							AND = {
								OR = {
									ENG = { has_idea = d_day_preparation_2 }
									ENG = { has_idea = d_day_preparation_3 }
								}
								is_in_faction_with = ENG
							}
							AND = {
								OR = {
									USA = { has_idea = d_day_preparation_2 }
									USA = { has_idea = d_day_preparation_3 }
								}
								is_in_faction_with = USA
							}
						}
					}
				}
				AND = {
					if = {
						limit = {
							OR = {
								is_ai = yes
								AND = {
									NOT = { tag = ENG }
									NOT = { tag = USA }
								}
							}
						}
						custom_trigger_tooltip = {
							tooltip = d_day_launch_trigger_tt_b
							has_country_flag = {
								flag = d_day_prep_flag
								days > 240 #give time to draw order
							}
						}
					}
					if = {
						limit = {
							OR = {
								tag = ENG
								tag = USA
							}
							is_ai = no
						}
						custom_trigger_tooltip = {
							tooltip = d_day_launch_trigger_tt_c
							has_country_flag = {
								flag = d_day_prep_flag
								days > 120 #give time to draw order
							}
						}
					}
					if = {
						limit = {
							is_ai = yes
						}
						custom_trigger_tooltip = {
							tooltip = "Check the date and the weather"
							OR = {
								NOT = { has_global_flag = vanilla_history }
								date > 1943.7.1
							}
							OR = {
								has_country_flag = {
									flag = d_day_prep_flag
									days > 720 #give time to draw order
								}
								OR = {
									AND = {
										date > 1942.6.1 #we give up
										SOV = { is_ai = yes }
									}
									AND = {
										date > 1943.1.1 #we give up
										SOV = { is_ai = no }
									}
									AND = {
										date > 1942.6.1 #we give up
										SOV = { is_ai = no }
										SOV = { surrender_progress > 0.35 }
									}
								}
								SOV = { surrender_progress > 0.25 }
								GER = { surrender_progress > 0.05 }
							}
						}
					}
				}	
			}
		}

		visible = {
			has_idea = d_day_preparation_1
			OR = {
				is_in_faction_with = ENG
				tag = ENG
				tag = USA
			}
		}

		days_re_enable = 420

		complete_effect = {
			if = {
				limit = {
					has_country_flag = {
						flag = d_day_prep_flag
						days < 240
					}
				}
				custom_effect_tooltip = d_day_launch_tt_a
				add_timed_idea = { idea = d_day_preparation_2 days = 210 }
			}
			else_if = {
				limit = {
					has_country_flag = {
						flag = d_day_prep_flag
						days > 240
					}
				}
				add_timed_idea = { idea = d_day_preparation_2 days = 365 }
				if = {
					limit = { 
						NOT = { has_global_flag = mp_difficulty } 
					}
					hidden_effect = {
						set_global_flag = tremor_of_d_day
					}
				}
			}
			remove_ideas = d_day_preparation_1
		}

		ai_will_do = {
			factor = 9999
			modifier = {
				factor = 0
				date < 1942.12.1
				NOT = { 
					any_other_country = { has_idea = d_day_preparation_2 }
				}
			}
		}
	}

}

political_actions = {

	VIN_update_exploitation_cd = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = VIN
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			is_subject = yes
		}

		cancel_trigger = {
			is_subject = no
		}

		is_good = no

		days_mission_timeout = 730

		timeout_effect = {
			activate_mission = VIN_update_exploitation_cd
			update_exploitation = yes
		}
	}

	VIN_update_apathetic_people_cd = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = VIN
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			NOT = {
				OR = {
					has_idea = VIN_apathetic_people_1
					has_idea = VIN_apathetic_people_2
					has_idea = VIN_apathetic_people_3
				}
			}
		}

		is_good = yes

		days_mission_timeout = 365

		timeout_effect = {
			activate_mission = VIN_update_apathetic_people_cd
			update_apathetic_people = yes
		}
	}

	VIN_update_army_cd = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = VIN
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			OR = {
				has_idea = VIN_colonial_army_4f
				has_idea = VIN_imperial_army_4f
				has_idea = VIN_independent_army_4f
			}
		}

		is_good = yes

		days_mission_timeout = 180

		timeout_effect = {
			activate_mission = VIN_update_army_cd
			update_indochinese_army = yes
		}
	}
	GER_to_war_with_target_country = {

		icon = generic_prepare_civil_war

		available = {
			custom_trigger_tooltip = {
				tooltip = "The Kaiserin of Germany has succeeded the throne of the Empire"
				has_global_flag = GER_HRE_is_inevitable
			}
			NOT = { GER = { has_country_flag = GER_HRE_mark_cooldown } }
		}

		target_trigger = {
			FROM.OWNER = { 
				NOT = { has_war_with = GER } 
				NOT = { has_country_flag = GER_HRE_target_marked }
				NOT = { is_in_faction_with = GER }
				is_neighbor_of = GER
				any_controlled_state = {
					is_claimed_by = GER
				}
			}
			FROM = {
				is_on_continent = europe
				OR = {
					AND = {
						has_variable = historical_capital_for_country
						var:historical_capital_for_country = {
							exists = yes
							NOT = { tag = ROOT }
						}
					}
					AND = {
						is_capital = yes
						CONTROLLER = {
							NOT = {
								tag = ROOT
							}
						}
					}
				}
			}
		}

		visible = {
			has_global_flag = GER_HRE_is_inevitable
			is_in_faction_with = ENG
		}

		allowed = {
			always = yes
		}
		days_remove = 30
		on_map_mode = map_only
		state_target = yes

		fire_only_once = no

		cost = 0

		complete_effect = {
			hidden_effect = { 
				GER = { 
					set_country_flag = {
						flag = GER_HRE_mark_cooldown 
						days = 60
					}
				} 
			}
			FROM.OWNER = {
				GER = {
					add_ai_strategy = {
						type = prepare_for_war
						value = 100
						id = PREV
					}
					add_ai_strategy = {
						type = antagonize
						value = 100
						id = PREV
					}
					add_ai_strategy = {
						type = declare_war
						value = 500
						id = PREV
					}
					add_ai_strategy = {
						type = alliance
						value = -500
						id = PREV
					}
					add_ai_strategy = {
						type = befriend
						value = -500
						id = PREV
					}
				}
				ENG = {
					add_ai_strategy = {
						type = prepare_for_war
						value = 100
						id = PREV
					}
					add_ai_strategy = {
						type = antagonize
						value = 100
						id = PREV
					}
					add_ai_strategy = {
						type = alliance
						value = -500
						id = PREV
					}
					add_ai_strategy = {
						type = befriend
						value = -500
						id = PREV
					}
				}
			}
		}

		remove_effect = {
			hidden_effect = { GER = { clr_country_flag = GER_HRE_mark_cooldown } }
			FROM.OWNER = {
				set_country_flag = GER_HRE_target_marked
				GER = {
					create_wargoal = {
						target = PREV
						type = annex_everything
					}
					add_ai_strategy = {
						type = prepare_for_war
						value = -100
						id = PREV
					}
					add_ai_strategy = {
						type = declare_war
						value = 200
						id = PREV
					}
				}
				ENG = {
					add_ai_strategy = {
						type = prepare_for_war
						value = -100
						id = PREV
					}
					add_ai_strategy = {
						type = declare_war
						value = 200
						id = PREV
					}
				}
			}
		}
		ai_will_do = {
			base = 0
			modifier = {
				add = 300
				FROM.OWNER = {
					is_in_faction = no
					has_war = yes
					NOT = {
						any_country = {
							is_major = yes
							has_guaranteed = PREV
						}
					}
				}
			}
			modifier = {
				add = 100
				FROM.OWNER = {
					is_in_faction = no
					has_war = no
					NOT = {
						any_country = {
							is_major = yes
							has_guaranteed = PREV
						}
					}
				}
			}
			modifier = {
				add = 80
				FROM.OWNER = {
					is_major = no
				}
			}
			modifier = {
				add = 1
				FROM.OWNER = {
					is_major = yes
				}
			}
			modifier = {
				add = -999
				surrender_progress > 0
			}
			modifier = {
				add = -999
				any_country = {
					has_war_with = GER
					has_country_flag = GER_HRE_target_marked
					surrender_progress < 0.5
					NOT = { 
						AND = {
							tag = FRA
							FROM.OWNER = { 
								NOT = {
									OR = {
										original_tag = LUX
										original_tag = BEL
										original_tag = HOL
									}
								}
							} 
						}
					}
				}
			}
		}
	}

	LSM_SOV_molotov_ribbentrop_is_important_3 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			POL = { has_war_with = GER }
			has_idea = SOV_molotov_ribbentrop_pact
			custom_trigger_tooltip = {
				tooltip = LSM_SOV_molotov_ribbentrop_is_important_3_tt
				has_global_flag = {
					flag = molotov_ribbentrop_fulfillment_demand
					days < 15
				}
			}	
		}

		visible = {
			has_idea = SOV_molotov_ribbentrop_pact
			OR = {
				SOV = { is_ai = no }
				POL = { is_ai = no }
			}
			POL = { has_war = yes }
			OR = {
				POL = { is_in_faction = yes }
				NOT = {
					any_country = {
						is_major = yes
						has_guaranteed = POL
					}
				}
			}
			tag = SOV
			POL = { surrender_progress < 0.8 }
			has_global_flag = {
				flag = molotov_ribbentrop_fulfillment_demand
				days < 60
			}
		}

		complete_effect = {
			if = {
				limit = {
					POL = { is_in_faction = yes }
				}
				custom_effect_tooltip = mol_rib_warning_1_tt
			}
			complete_national_focus = SOV_demand_eastern_poland
		}

		ai_will_do = {
			factor = 9999
		}
	}

	speed_optimization = {
		available = { 
			is_ai = no 
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = speed_optimization_flag }
			is_historical_focus_on = yes
			date < 1936.2.1
		}

		complete_effect = {
			custom_effect_tooltip = "Will also limit the maximum collab subjects a country can make"
			hidden_effect = {
				set_global_flag = limited_number_of_collab
				set_global_flag = speed_optimization_flag
			}
			every_country = {
				limit = {
					tag = VIN
				}
				FRA = {
					annex_country = { target = PREV transfer_troops = no }
				}
			}
			every_country = {
				limit = {
					OR = {
						tag = ELS
						tag = HON
						tag = GUA
						tag = NIC
						tag = COS
						tag = CUB
						tag = HAI
						tag = DOM
						tag = COL
						tag = ECU
						tag = PRU
						tag = PAN
					}
				}
				GUA = {
					annex_country = { target = PREV transfer_troops = no }
					every_owned_state = { 
						add_core_of = GUA
					}
					add_ideas = dead_country
				}
			}
			every_country = {
				limit = {
					OR = {
						tag = SAU
						tag = OMA
						tag = YEM
					}
				}
				SAU = {
					annex_country = { target = PREV transfer_troops = no }
					every_owned_state = { 
						add_core_of = SAU
					}
					add_ideas = dead_country
				}
			}
			every_country = {
				limit = {
					OR = {
						tag = TIB
						tag = BHU
					}
				}
				TIB = {
					annex_country = { target = PREV transfer_troops = no }
					every_owned_state = { 
						add_core_of = TIB
					}
					add_ideas = dead_country
				}
			}
		}

		cost = 0
		ai_will_do = {
			factor = 0
		}
		
	}

	limit_collab_number = {
		available = { 
			is_ai = no 
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = limited_number_of_collab }
			NOT = { has_global_flag = speed_optimization_flag }
			date < 1936.2.1
		}

		complete_effect = {
			custom_effect_tooltip = "Limit the maximum collab a country can make"
			custom_effect_tooltip = "Will also prevent AI from creating too many new puppets on nonhistorical"
			set_global_flag = limited_number_of_collab
		}

		cost = 0
		ai_will_do = {
			factor = 0
		}
		
	}

	delete_indochina = {
		available = { 
			is_ai = no 
		}

		visible = {
			is_ai = no
			date < 1936.2.1
		}

		complete_effect = {
			FRA = { annex_country = { target = VIN transfer_troops = yes } }
			hidden_effect = {
				every_state = {
					limit = { 
						is_core_of = VIN
						is_owned_by = FRA
					}
					set_compliance = 80
				}
			}
		}

		cost = 0
		ai_will_do = {
			factor = 0
		}
		
	}

	USA_adding_the_nudge = {
		available = { 
			tag = USA 
		}

		visible = {
			is_ai = yes
			tag = USA
			OR = {
				AND = {
					has_completed_focus = USA_america_first
					OR = {
						has_country_flag = USA_AI_RANDOM_FASCIST
						has_game_rule = {
							rule = USA_ai_behavior
							option = FASCIST
						}
					}
				}
				AND = {
					has_completed_focus =USA_suspend_the_presecution
					OR = {
						has_country_flag = USA_AI_RANDOM_COMMUNIST
						has_game_rule = {
							rule = USA_ai_behavior
							option = COMMUNIST
						}
					}
				}
			}	
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = { has_completed_focus = USA_america_first }
					activate_advisor = USA_charles_coughlin
				}
				if = {
					limit = { has_completed_focus = USA_suspend_the_presecution }
					activate_advisor = USA_earl_browder
				}
			}
		}

		cost = 0
		ai_will_do = {
			factor = 9999
		}
		
	}

	formation_of_the_reichspakt = {
		available = { 
			OR = {
				has_government = democratic
				has_government = neutrality
			}
		}

		visible = {
			tag = GER 
			OR = {
				has_government = democratic
				has_government = neutrality
			}
			OR = {
				is_faction_leader = yes
				is_in_faction = no
			}
			FRA = { has_government = communism }
			ENG = { has_government = communism }
			SOV = { has_government = communism }
			ENG = { is_in_faction_with = FRA }
		}

		complete_effect = {
			if = {
				limit = { is_in_faction = no }
				if = {
					limit = { has_government = neutrality }
					create_faction = "Reichspakt"
				}
				if = {
					limit = { has_government = democratic }
					create_faction = "Mitteleuropa"
				}
			}
			else_if  = {
				limit = { is_faction_leader = yes }
				if = {
					limit = { has_government = neutrality }
					set_faction_name = "Reichspakt"
				}
				if = {
					limit = { has_government = democratic }
					set_faction_name = "Mitteleuropa"
				}
			}
			every_country = {
				limit = {
					capital_scope = { is_on_continent = europe }
					has_war = no 
					OR = {
						is_in_faction = no
						NOT = {
							any_other_country = { is_in_faction_with = PREV }
						}
					}
					OR = {
						has_government = democratic
						has_government = neutrality
					}
					communism < 0.15
					OR = {
						fascism < 0.3
						NOT = {
							any_country = {
								capital_scope = { is_on_continent = europe }
								is_faction_leader = yes
								has_government = fascism
							}
						}
					}
				}
				country_event = { id = generic.5 hours = 8 random_hours = 4 }
			}
		}

		cost = 0
		ai_will_do = {
			factor = 9999
		}
		
	}

	ENG_formation_of_the_empire = {

		fire_only_once = yes

		available = { 
			has_government = neutrality
			is_in_faction = no
			has_completed_focus = ENG_the_kings_party
		}

		visible = {
			tag = ENG
			is_in_faction = no
			has_civil_war = no
		}

		complete_effect = {
			create_faction = "Pact of Empires"
		}

		cost = 0
		ai_will_do = {
			factor = 9999
		}
		
	}

	SOV_formation_of_the_moscow_accords = {

		fire_only_once = yes

		available = { 
			NOT = { has_government = communism }
			OR = {
				AND = {
					has_government = fascism
					NOT = { GER = { has_government = fascism } }
				}
				NOT = { 
					any_country = {
						OR = {
							original_tag = GER
							original_tag = ENG
							original_tag = FRA
							original_tag = USA
							original_tag = POL 
						}
					}
					is_faction_leader = yes	
					has_government = ROOT
					NOT = { has_war_with = ROOT }
				}
				custom_trigger_tooltip = {
					tooltip = "Mikhail Tomsky is the current leader of Russia"
					has_country_flag = tomsky_leader
				}
			}
		}

		visible = {
			tag = SOV
			is_in_faction = no
			has_civil_war = no
			is_subject = no
			NOT = { has_government = communism }
		}

		complete_effect = {
			create_faction = "Moscow Accords"
			every_country = {
				limit = {
					OR = {
						capital_scope = { is_on_continent = europe }
						capital_scope = { is_on_continent = asia }
						capital_scope = { is_on_continent = middle_east }
						AND = {
							SOV = { has_country_flag = tomsky_leader }
							tag = SWE
							tag = NOR
							tag = DEN
							tag = JAP
						}
					}
					has_war = no 
					is_in_faction = no
					is_neighbor_of = SOV
					OR = {
						communism < 0.25
						SOV = { has_country_flag = tomsky_leader }
					}
					fascism < 0.25
				}
				country_event = { id = generic.5 hours = 8 random_hours = 4 }
			}
		}

		cost = 0
		ai_will_do = {
			factor = 500
			modifier = {
				factor = 0
				OR = {
					AND = {
						has_country_flag = kerensky_leader
						GER = {
							OR = {
								has_government = democratic
								has_government = neutrality
							}
							is_faction_leader = yes
						}
						NOT = { has_war_with = GER }
					}
					AND = {
						has_country_flag = tsar_leader
						ENG = {
							OR = {
								has_government = democratic
								has_government = neutrality
							}
							is_faction_leader = yes
						}
						NOT = { has_war_with = ENG }
					}
				}
			}
		}
		
	}

	FRA_intervene_in_spain = {
		available = { has_war_support > 0.25 }

		allowed = {
			tag = FRA
		}

		fire_only_once = yes

		visible = {
			any_country = {
				is_in_faction_with = FRA
				original_tag = SPR
			}
		}

		targets = { SPD SPA SPB SPR }

		target_trigger = { 
			FROM = {
				original_tag = SPR
				is_in_faction_with = FRA
			}
		}

		complete_effect = {
			#This is not optimal, but it generates a beautiful tooltip
			add_war_support = 0.10
			add_stability = 0.10
			if = {
				limit = { FROM = { tag = SPD } }
				set_country_flag = supports_SPD_flag
				if = {
					limit = { country_exists = SPA }
					add_to_war = { targeted_alliance = SPD enemy = SPA hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPC }
					add_to_war = { targeted_alliance = SPD enemy = SPC hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPB }
					add_to_war = { targeted_alliance = SPD enemy = SPB hostility_reason = asked_to_join }
				}
			}
			else_if = {
				limit = { FROM = { tag = SPA } }
				set_country_flag = supports_SPA_flag
				if = {
					limit = { country_exists = SPD }
					add_to_war = { targeted_alliance = SPA enemy = SPD hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPC }
					add_to_war = { targeted_alliance = SPA enemy = SPC hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPB }
					add_to_war = { targeted_alliance = SPA enemy = SPB hostility_reason = asked_to_join }
				}
			}
			else_if = {
				limit = { FROM = { tag = SPB } }
				set_country_flag = supports_SPB_flag
				if = {
					limit = { country_exists = SPD }
					add_to_war = { targeted_alliance = SPB enemy = SPD hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPC }
					add_to_war = { targeted_alliance = SPB enemy = SPC hostility_reason = asked_to_join }
				}
				if = {
					limit = { country_exists = SPA }
					add_to_war = { targeted_alliance = SPB enemy = SPA hostility_reason = asked_to_join }
				}
			}
			clr_country_flag = FRA_non_intervention
			if = {
				limit = {
					has_country_flag = FRA_covert_intervention_allowed
				}
				clr_country_flag = FRA_covert_intervention_allowed 
			}
			if = {
				limit = {
					has_country_flag = FRA_volunteer_work_allowed
				}
				clr_country_flag = FRA_volunteer_work_allowed 
			}
			if = {
				limit = {
					has_country_flag = FRA_sending_weapons_allowed
				}
				clr_country_flag = FRA_sending_weapons_allowed 
			}
			if = { 
				limit = { has_country_flag = FRA_non_military_aid_allowed }
				clr_country_flag = FRA_non_military_aid_allowed
			}
			if = { 
				limit = { has_country_flag = FRA_arms_purchases_allowed }
				clr_country_flag = FRA_arms_purchases_allowed
			}
			
		}

		cost = 0
		ai_will_do = {
			factor = 20
		}
		
	}
	
	AST_demand_islands = {

		icon = generic_form_nation

		allowed = {
			original_tag = AST
		}

		available = {
			OR = {
				is_subject = no
				has_autonomy_state = autonomy_dominion #New Zealand should be able to do it
			}
			hidden_trigger = {
				has_country_flag = AST_australasian_formed
				NOT = { has_country_flag = AST_is_demanding_flag }
				any_country = {
					NOT = { tag = ROOT }
					is_in_faction_with = ROOT
					OR = {
						controls_state = 635
						controls_state = 734
						controls_state = 636
						controls_state = 726
						controls_state = 641
						controls_state = 643
						controls_state = 642
						controls_state = 639
						controls_state = 725
						controls_state = 711
						controls_state = 712
					}
					NOT = { has_country_flag = AST_has_been_asked_for_islands_flag }
				}
			}
		}

		visible = {
			original_tag = AST
			OR = {
				is_subject = no
				has_autonomy_state = autonomy_dominion #New Zealand should be able to do it
			}
			has_country_flag = AST_australasian_formed
			hidden_trigger = {
				NOT = { has_country_flag = AST_is_demanding_flag }
				any_country = {
					NOT = { tag = ROOT }
					is_in_faction_with = ROOT
					OR = {
						controls_state = 635
						controls_state = 734
						controls_state = 636
						controls_state = 726
						controls_state = 641
						controls_state = 643
						controls_state = 642
						controls_state = 639
						controls_state = 725
						controls_state = 711
						controls_state = 712
					}
					NOT = { has_country_flag = AST_has_been_asked_for_islands_flag }
				}
			}
		}

		complete_effect = {
			random_country = {
				limit = {
					NOT = { tag = ROOT }
					is_in_faction_with = ROOT
					OR = {
						controls_state = 635
						controls_state = 734
						controls_state = 636
						controls_state = 726
						controls_state = 641
						controls_state = 643
						controls_state = 642
						controls_state = 639
						controls_state = 725
						controls_state = 711
						controls_state = 712
					}
					hidden_trigger = { NOT = { has_country_flag = AST_has_been_asked_for_islands_flag } }
				}
				save_event_target_as = australia_island_demand_target
			}
			event_target:australia_island_demand_target = {
				country_event = { id = LSM_ENG_churchill.804 days = 3 }
				set_country_flag = AST_has_been_asked_for_islands_flag
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	LSM_patriotic_war_one_step_forward = {
	
		icon = generic_political_address

		fire_only_once = yes

		allowed = {
			always = yes
		}

		war_with_on_remove = GER

		available = {
			custom_trigger_tooltip =  {
				tooltip = "Has either not signed Molotov-Ribbentrop or at least 365 days have passed since the treaty"
				OR = {
					NOT = { has_global_flag = mol_rib_pact }
					has_global_flag = {
						flag = mol_rib_pact
						days > 365
					}
				}
			}
			GER = { 
				exists = yes 
				is_subject = no
				OR = {
					has_war_with = USA
					AND = {
						has_war_with = FRA
						NOT = { has_completed_focus = GER_mol_rib_pact }
					}
					AND = {
						has_war_with = FRA
						FRA = { has_capitulated = no }
					}
				}
				has_war_with = ENG
			}
			NOT = { GER = { is_in_faction_with = SOV } }
		}

		visible = {
			country_exists = GER
			is_historical_focus_on = yes
			NOT = { has_global_flag = vanilla_history }
			NOT = { has_idea = SOV_molotov_ribbentrop_pact }
			OR = {
				date > 1942.4.1 #well lets start it
				AND = {
					date > 1941.6.07
					OR = {
						FRA = { has_capitulated = no }
						AND = {
							FRA = { has_capitulated = yes }
							ENG = { surrender_progress > 0.05 }
							ENG = { surrender_progress < 0.2 }
							any_state = { 
								is_core_of = ENG
								GER = { divisions_in_state = { state = PREV size > 10 } }
							}
							NOT = {
								any_state = { 
									is_core_of = GER
									any_neighbor_state = { is_core_of = SOV }
									GER = { divisions_in_state = { state = PREV size > 3 } }
								}
							}
						}
					}
					GER = { has_war_with = FRA }
				}
				AND = {
					GER = { 
						NOT = { has_completed_focus = GER_mol_rib_pact }
						NOT = {
							focus_progress = {
								focus = GER_mol_rib_pact
								progress > 0
							}
						}
						has_war = yes
						is_neighbor_of = SOV
					}
					OR = {
						GER = { has_war_with = ENG }
						GER = { has_war_with = FRA }
					}
					date > 1940.1.1
					OR = {
						has_completed_focus = SOV_industrial_modernization
						is_ai = no
					}
					has_idea = GER_soviet_protect_our_sphere_LSM #you have ignored 3 warnings, it is time to die
				}
			}
			NOT = { has_war_with = GER }
			GER = { has_war = yes }
			GER = { is_subject = no }
			NOT = { GER = { is_in_faction_with = SOV } }
			SOV = { is_subject = no }
			SOV = { has_government = communism }
			SOV = { NOT = { has_idea = GER_SOV_hitler_stalin_pact } }
			tag = SOV
		}

		complete_effect = {
			add_war_support = 0.25
			every_country = {
				limit = {
					OR = {
						AND = {
							is_neighbor_of = SOV
							OR = {
								is_in_faction_with = GER
								is_subject_of = GER 
							}
						}
						has_guaranteed = GER
					}
				}
				SOV = {
					add_ai_strategy = {
						type = antagonize
						id = PREV
						value = 999
					}
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 999
					}		
				}
			}
			hidden_effect = {
				if = {
					limit = { 
						NOT = { has_completed_focus = SOV_claims_on_poland }
					}
					unlock_national_focus = SOV_claims_on_poland
					add_state_core = 96
					add_state_core = 95
					add_state_core = 94
					add_state_core = 93
					add_state_core = 91
					add_state_core = 89
					add_state_core = 784
				}
				if = {
					limit = { 
						NOT = { has_completed_focus = SOV_nkvd_primacy }
					}
					unlock_national_focus = SOV_nkvd_primacy
					add_ideas = SOV_nkvd_nsb
				}
			}
			add_ideas = SOV_prepare_for_barbarossa
			if = {
				limit = {
					GER = { has_idea = GER_SOV_hitler_stalin_pact }
				}
				GER = { country_event = { id = LSM_GER_SOV.27 hours = 12 } }
			}	
			add_timed_idea = {
				idea = SOV_unprepared_offensive
				days = 60
			}
			hidden_effect = {
				FRA = { remove_country_leader_trait = stout_defender }
			}
			if = {
				limit = {
					NOT = { has_completed_focus = SOV_policy_of_collective_security }
				}
				complete_national_focus = SOV_policy_of_collective_security
			}
			if = {
				limit = {
					NOT = { has_completed_focus = SOV_anti_fascist_policies }
				}
				complete_national_focus = SOV_anti_fascist_policies
			}
		}

		remove_effect = {
			SOV = { news_event = { id = lsm_news.1114 } }
			every_country = {
				limit = {
					is_neighbor_of = SOV
					OR = {
						is_in_faction_with = GER
						is_subject_of = GER 
					}
				}
				SOV = {
					add_ai_strategy = {
						type = antagonize
						id = PREV
						value = -999
					}
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = -999
					}
					declare_war_on = {
						target = PREV
						type = puppet_wargoal_focus
					}
				}
			}
			every_country = {
				limit = {
					has_guaranteed = GER
				}
				SOV = {
					add_ai_strategy = {
						type = antagonize
						id = PREV
						value = -999
					}
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = -999
					}		
				}
			}
			set_global_flag = SOV_one_step_forward
			if = {
				limit = {
					JAP = {
						has_guaranteed = GER
					}
				}
				set_global_flag = kwantung_intervention
			}
			if = {
				limit = {
					NOT = { has_completed_focus = SOV_seek_a_defense_pact_with_the_allies }
				}
				complete_national_focus = SOV_seek_a_defense_pact_with_the_allies
			}
			if = {
				limit = {
					NOT = { has_completed_focus = SOV_eradicate_western_fascism }
				}
				complete_national_focus = SOV_eradicate_western_fascism
			}
			hidden_effect = {
				FRA = { remove_country_leader_trait = stout_defender }
			}
		}

		days_remove = 15 #extremely sudden

		ai_will_do = {
			base = 0
			modifier = {
				add = -9999
				NOT = { is_neighbor_of = GER }
				NOT = {
					any_country = {
						is_in_faction_with = SOV
						is_neighbor_of = GER
					}
				}
				NOT = {
					any_country = {
						is_neighbor_of = SOV
						is_in_faction_with = GER
					}
				}
			}
			modifier = {
				add = -9999
				NOT = {
					any_country = {
						is_neighbor_of = GER
						is_major = yes
						has_army_manpower = { size > 1000000 }
						surrender_progress < 0.1
					}
				}
			}
			modifier = {
				add = -9999
				OR = {
					NOT = { country_exists = FRA }
					FRA = { is_in_faction_with = GER }
					FRA = { surrender_progress > 0.6 }
					FRA = { has_capitulated = yes }
				}
				GER = { 
					OR = {
						is_guaranteed_by = JAP 
						is_in_faction_with = JAP
					}
				}
				CHI = { has_country_flag = LSM_eligibility_nation }
			}
			modifier = {
				add = 1500
				AND = {
					OR = {
						AND = {
							GER = { has_manpower < 1000000 }
							SOV = { has_manpower > 5000000 }
						}
						SOV = { has_army_manpower = { size > 6999999 } }
						SOV = { has_manpower > 8000000 }
					}
					date > 1942.4.1
				}
			}
			modifier = {
				add = 1500
				AND = {
					GER = { has_war_with = USA }
					ENG = { NOT = { surrender_progress > 0.2 } } #sealion never happened or stalled
					date > 1942.4.1
				}
			}
			modifier = {
				add = 3000
				OR = {
					GER = { surrender_progress > 0.1 }
					HOL = { is_in_faction_with = FRA }
					BEL = { is_in_faction_with = FRA }
					HOL = { 
						focus_progress = {
							focus = HOL_go_with_britain
							progress > 0
						}
					}
				}
			}
			modifier = {
				add = -9999
				OR = {
					AND = {
						any_country = {
							is_major = yes
							has_capitulated = no
							is_neighbor_of = SOV
							has_war_with = SOV
							capital_scope = { is_on_continent = europe }
						}	
						SOV = { 
							OR = {
								surrender_progress > 0.01
								has_army_manpower = { size < 4000000 }
							}
						}
					}
					AND = {
						GER = { has_war_with = BEL }
						GER = { has_war_with = HOL }
						AND = {
							BEL = { has_capitulated = yes }
							HOL = { has_capitulated = yes }
							any_state = {
								is_core_of = FRA
								is_on_continent = europe
								NOT = { state = 1 }
								controller = { 
									OR = {
										tag = GER
										is_in_faction_with = GER 
									}
								}
							}
						}
					}
					AND = {
						OR = {
							AND = {
								NOT = { country_exists = BEL }
								BEL = { is_in_faction_with = GER }
							}
							AND = {
								NOT = { country_exists = HOL }
								HOL = { is_in_faction_with = GER }
								BEL = { has_capitulated = yes }
							}
						}
						any_state = {
							is_core_of = FRA
							is_on_continent = europe
							NOT = { state = 1 }
							controller = { 
								OR = {
									tag = GER
									is_in_faction_with = GER 
								}
							}
						}
					}
				}
			}
		}
	}

	peace_time_prosperity = {
	
		icon = generic_political_address

		fire_only_once = no

		days_re_enable = 365 #annual review

		allowed = {
			always = yes
		}

		available = {
			date > 1945.1.1
			custom_trigger_tooltip =  {
				tooltip = "Are we at peace now?"
				NOT = { 
					any_country = { 
						has_war = yes
					}
				}
			}	
		}

		visible = {
			date > 1945.1.1
			NOT = { has_idea = peace_time_prosperity }
			NOT = { has_idea = population_boom_minor }
		}

		complete_effect = {
			custom_effect_tooltip = "I think peace has returned, maybe"
			hidden_effect = { 
				if = { 
					limit = { 
						NOT = { has_idea = peace_time_prosperity_neutral }
					}
					add_ideas = peace_time_prosperity
				} 
				if = { 
					limit = {
						OR = {
							is_major = no
							AND = { 
								is_major = yes
								num_of_controlled_factories < 51
							}
						}
					}
					add_timed_idea = { idea = population_boom_minor days = 3650 }
				}
				delete_units = {
					division_template = "Militia Cope Division"
					disband = yes
				}
				delete_units = {
					division_template = "Wheelchair Division"
					disband = yes
				}
				if = { 
					limit = { 
						has_country_flag = template_given_lsm
					}
					clr_country_flag = template_given_lsm
				}
				if = { 
					limit = { 
						has_country_flag = wheelchair_template_given_lsm
					}
					clr_country_flag = wheelchair_template_given_lsm
				}
			}
		}

		ai_will_do = {
			factor = 100000
		}
	}

	LSM_prepare_for_WW2 = {
	
		icon = generic_industry

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "The looming threat of another World War has reached us"
				OR = {
					AND = {
						is_ai = no
						threat > 0.8
					}
					AND = {
						is_ai = yes
						threat > 0.5
					}
					GER = {
						OR = {
							focus_progress = {
								focus = GER_danzig_or_war
								progress > 0
							}
							focus_progress = {
								focus = GER_break_the_anglo_french_colonial_hegemony
								progress > 0
							}
							focus_progress = {
								focus = GER_strike_at_the_source
								progress > 0
							}
						}
					}
					any_country = {
						OR = {
							tag = ENG
							tag = FRA
							tag = GER
							tag = SOV
						}
						any_other_country = {
							has_war_with = PREV
							OR = {
								tag = ENG
								tag = FRA
								tag = GER
								tag = SOV
							}
							NOT = { original_tag = PREV }
						}
					}
				}
			}
		}

		visible = {
			has_war = no
			OR = {
				GER = {
					OR = {
						AND = {
							focus_progress = {
								focus = GER_danzig_or_war
								progress > 0
							}
							OR = {
								tag = FRA
								tag = ENG
								tag = POL
							}
						}
						AND = {
							focus_progress = {
								focus = GER_break_the_anglo_french_colonial_hegemony
								progress > 0
							}
							OR = {
								tag = FRA
								tag = ENG
							}
						}
						AND = {
							focus_progress = {
								focus = GER_strike_at_the_source
								progress > 0
							}
							tag = SOV
						}
					}
				}
				threat > 0.5
			}
			OR = {
				is_ai = yes
				threat > 0.8
			}
			capital_scope = { is_on_continent = europe }
		}

		complete_effect = {
			add_timed_idea = { idea = LSM_prepare_for_war days = 180 }
		}

		ai_will_do = {
			factor = 9999
			modifier = {
				factor = 0
				OR = {
					tag = SWE
					tag = DEN
					tag = ICE
					tag = IRE
				}
			}
		}
	}

	USA_emergency_training_program = {
	
		icon = generic_industry

		fire_only_once = yes

		allowed = {
			tag = USA
		}

		available = {
			has_defensive_war = yes
			has_offensive_war = no
		}

		visible = {
			has_war = yes
			has_defensive_war = yes
			has_offensive_war = no
			tag = USA
		}

		complete_effect = {
			add_timed_idea = { idea = LSM_prepare_for_war_2 days = 365 }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_rebuild_the_home_of_santa = {

		icon = generic_industry

		allowed = {
			original_tag = SOV
		}
		available = {
			controls_state = 148
		}
		visible = {
			has_completed_focus = SOV_santa_2
		}
		cost = 0
		fire_only_once = yes
		ai_will_do = {
			factor = 9999
		}
		complete_effect = {
			set_victory_points = {
				province = 6087
				value = 25
			}
			148 = {
				set_state_category = megalopolis 
			}
			if = {
				limit = { SOV_third_five_year_plan_available = yes }
				add_ideas = SOV_tourism
				custom_effect_tooltip = SOV_tourism_tt
			}
		}
	}

	ITA_negotiate_with_ethiopia = {

		icon = generic_industry

		allowed = {
			original_tag = ITA
		}
		available = {
			OR = {
				controls_state = 844
				controls_state = 559
				controls_state = 550
				any_state = {
					is_owned_by = ITA
					is_core_of = ETH
				}
			}
		}
		visible = {
			has_country_flag = ITA_defeat_in_ethiopia_flag
			country_exists = ETH
			ETH = { has_war = no }
		}
		cost = 0
		fire_only_once = yes
		ai_will_do = {
			factor = 9999
		}
		complete_effect = {
			ETH = { 
				country_event = { days = 1 id = LSM_ITA_defeat.10 }
			}
		}
	}

	ETH_join_the_allies = {

		icon = generic_industry

		allowed = {
			original_tag = ETH
		}
		available = {
			has_war = no
		}
		visible = {
			has_war = no
			is_subject = no
			is_in_faction = no
			has_completed_focus = ETH_rally_around_the_emperor
		}
		cost = 0
		fire_only_once = yes
		ai_will_do = {
			factor = 9999
		}
		complete_effect = {
			ENG = { country_event = { id = generic.2 hours = 6 } }
			hidden_effect = {
				ENG = { 
					add_ai_strategy = {
						value = 500
						type = alliance
						id = "ETH"
					}
				}
				ETH = { 
					add_ai_strategy = {
						value = 500
						type = alliance
						id = "ENG"
					}
				}
				if = {
					limit = {
						ENG = { is_ai = yes }
						ETH = { is_ai = yes }
					}
					ENG = { add_to_faction = ETH }
				}
			}
		}
	}

	SWE_cut_the_trade = {

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = SWE
		}
		available = {
			controls_state = 918
		}
		visible = {
			OR = {
				has_global_flag = d_day_crisis
				GER = { surrender_progress > 0.5 }
			}
			GER = { has_completed_focus = GER_swedish_trade_agreement }
			NOT = { is_in_faction_with = GER }
			is_subject = no
		}
		cost = 0
		fire_only_once = yes
		ai_will_do = {
			factor = 9999
		}
		complete_effect = {
			add_war_support = 0.1
			GER = { 
				remove_resource_rights = 918
				hidden_effect = { country_event = { days = 1 id = LSM_new_world_diplomacy.7 } }
			}
		}
	}

	war_time_infrastructure = {
	
		icon = generic_motorized

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "No longer has space for industrial expansion"
				NOT = {
					any_state = {
						OR = {
							is_in_home_area = yes
							is_core_of = ROOT
						}
						OR = {
							free_building_slots = {
								building = industrial_complex
								size > 1 
							}
							free_building_slots = {
								building = arms_factory
								size > 1 
							}
							free_building_slots = {
								building = dockyard
								size > 1 
							}
						}	
					}
				}
				any_state = {	
					is_owned_by = ROOT
					is_fully_controlled_by = ROOT		
					free_building_slots = {
						building = infrastructure
						size > 0
					}
				}
			}
		}

		visible = {
			custom_trigger_tooltip = {
				tooltip = "No longer has space for industrial expansion"
				num_of_civilian_factories_available_for_projects > 49
				NOT = {
					any_state = {
						is_core_of = ROOT
						OR = {
							free_building_slots = {
								building = industrial_complex
								size > 1 
							}
							free_building_slots = {
								building = arms_factory
								size > 1 
							}
							free_building_slots = {
								building = dockyard
								size > 1 
							}
						}	
					}
				}
				any_state = {	
					is_owned_by = ROOT
					is_fully_controlled_by = ROOT		
					free_building_slots = {
						building = infrastructure
						size > 0
					}
				}
			}
		}

		modifier = { 
			civilian_factory_use = 30
		}

		remove_effect = {
			custom_effect_tooltip = "Randomly build infrastructure"
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {		
						free_building_slots = {
							building = infrastructure
							size > 0
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				random_owned_controlled_state = {
					limit = {		
						free_building_slots = {
							building = infrastructure
							size > 0
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
		}

		days_re_enable = 5

		days_remove = 5

		ai_will_do = {
			factor = 50
		}
	}

	peacetime_infrastructure = {
	
		icon = generic_motorized

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "The Era of Transition has begun"
				has_war = no
				OR = {
					has_country_flag = era_of_transition
					any_country = { 
						is_major = yes
						has_country_flag = era_of_transition
					}
				}
				any_state = {	
					OR = {
						AND = {
							is_owned_by = ROOT
							is_fully_controlled_by = ROOT	
						}
						AND = {
							owner = { is_in_faction_with = ROOT }
							controller = { is_in_faction_with = ROOT }
						}
					}	
					free_building_slots = {
						building = infrastructure
						size > 0
					}
				}
			}
		}

		visible = {
			custom_trigger_tooltip = {
				tooltip = "The Era of Transition has begun"
				has_war = no
				num_of_civilian_factories_available_for_projects > 29
				OR = {
					has_country_flag = era_of_transition
					any_country = { 
						is_major = yes
						has_country_flag = era_of_transition
					}
				}
				any_state = {	
					OR = {
						AND = {
							is_owned_by = ROOT
							is_fully_controlled_by = ROOT	
						}
						AND = {
							owner = { is_in_faction_with = ROOT }
							controller = { is_in_faction_with = ROOT }
						}
					}	
					free_building_slots = {
						building = infrastructure
						size > 0
					}
					OR = {
						has_resources_amount = {
							resource = steel 
							amount > 0
						}
						has_resources_amount = {
							resource = oil 
							amount > 0
						}
						has_resources_amount = {
							resource = aluminium 
							amount > 0
						}
						has_resources_amount = {
							resource = tungsten 
							amount > 0
						}
						has_resources_amount = {
							resource = chromium 
							amount > 0
						}
						has_resources_amount = {
							resource = rubber 
							amount > 0
						}
					}	
				}
			}
		}

		modifier = { 
			civilian_factory_use = 30
		}

		remove_effect = {
			custom_effect_tooltip = "Randomly build infrastructure"
			hidden_effect = {
				random_state = {
					limit = {	
						OR = {
							AND = {
								is_owned_by = ROOT
								is_fully_controlled_by = ROOT	
							}
							AND = {
								owner = { is_in_faction_with = ROOT }
								controller = { is_in_faction_with = ROOT }
							}
						}		
						free_building_slots = {
							building = infrastructure
							size > 0
						}
						OR = {
							has_resources_amount = {
								resource = steel 
								amount > 0
							}
							has_resources_amount = {
								resource = oil 
								amount > 0
							}
							has_resources_amount = {
								resource = aluminium 
								amount > 0
							}
							has_resources_amount = {
								resource = tungsten 
								amount > 0
							}
							has_resources_amount = {
								resource = chromium 
								amount > 0
							}
							has_resources_amount = {
								resource = rubber 
								amount > 0
							}
						}	
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
		}

		days_re_enable = 5

		days_remove = 5

		ai_will_do = {
			factor = 1000
		}
	}
	ENG_imperial_federation_is_real = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = no
		}

		visible = {
			tag = ENG
			controls_state = 126
			has_government = democratic
			has_completed_focus = uk_empire_focus
			has_country_flag = era_of_transition
			is_subject = no
			NOT = {
				any_country = {
					OR = {
						tag = CAN
						tag = SAF
						tag = AST
						tag = RAJ
						tag = NZL
						tag = MAL
					}
					is_ai = no
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = "Skip to Imperial Federation"
			hidden_effect = {
				complete_national_focus = ENG_imperial_federation
				RAJ = {
					every_owned_state = { add_core_of = RAJ }
					set_country_flag = RAJ_civil_war
				}
				set_global_flag = UK_is_donea
			}
		}

		ai_will_do = {
			factor = 50
		}
	}
	HOL_forming_the_benelux = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = no
		}

		visible = {
			OR = {
				AND = {
					original_tag = BEL
					controls_state = 6
				}
				AND = {
					original_tag = HOL
					controls_state = 7
				}
				AND = {
					original_tag = LUX
					controls_state = 8
				}
			}
			has_country_flag = era_of_transition
			is_subject = no
			has_government = democratic
		}

		complete_effect = {
			custom_effect_tooltip = "Formation of the Benelux"
			hidden_effect = {
				every_country = {
					limit = {
						OR = {
							original_tag = BEL
							original_tag = HOL
							original_tag = LUX
						}
						OR = {
							is_in_faction_with = ROOT
							is_subject_of = ROOT
							has_government = democratic
						}
						is_ai = yes
						NOT = { tag = ROOT }
					}
					ROOT = { annex_country = { target = PREV transfer_troops = yes } }
				}
				activate_decision = form_united_netherlands
			}
		}

		ai_will_do = {
			factor = 150
			modifier = {
				factor = 0
				NOT = { tag = HOL }
				HOL = { controls_state = 7 }
			}
			modifier = {
				factor = 0
				NOT = { HOL = { controls_state = 7 } }
				BEL = { controls_state = 6 }
				NOT = { tag = BEL }
			}
		}
	}
	EU_formation_of_european_union = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = no
		}

		visible = {
			OR = {
				AND = {
					original_tag = FRA
					controls_state = 16
				}
				AND = {
					original_tag = ITA
					controls_state = 2
				}
				AND = {
					original_tag = BEL
					controls_state = 6
				}
				AND = {
					original_tag = HOL
					controls_state = 7
				}
				AND = {
					original_tag = LUX
					controls_state = 8
				}
			}
			has_country_flag = era_of_transition
			is_subject = no
			has_government = democratic
		}

		complete_effect = {
			custom_effect_tooltip = "Formation of the European Union"
			hidden_effect = {
				every_country = {
					limit = {
						OR = {
							original_tag = FRA
							original_tag = ITA
							original_tag = BEL
							original_tag = HOL
							original_tag = LUX
						}
						OR = {
							is_in_faction_with = ROOT
							is_subject_of = ROOT
							has_government = democratic
						}
						is_ai = yes
						NOT = { tag = ROOT }
					}
					ROOT = { annex_country = { target = PREV transfer_troops = no } }
				}
				activate_decision = form_european_union
				if = {
					limit = { tag = FRA }
					set_global_flag = FRA_is_donea
				}
			}
		}

		ai_will_do = {
			factor = 0
			modifier = {
				factor = 0
				NOT = { tag = FRA }
				FRA = { controls_state = 16 }
			}
			modifier = {
				factor = 0
				NOT = { FRA = { controls_state = 16 } }
				ITA = { controls_state = 2 }
				NOT = { tag = ITA }
			}
		}
	}
	ENG_FRA_negotiate_post_war_border = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = no
		}

		visible = {
			has_global_flag = FRA_is_done
			has_global_flag = UK_is_done
			tag = ENG
			country_exists = ENG
			country_exists = FRA
			ENG = { is_in_faction_with = FRA }
			is_historical_focus_on = yes
		}

		complete_effect = {
			custom_effect_tooltip = "Border adjustment"
			hidden_effect = {
				every_state = {
					limit = { is_core_of = MAD }
					ENG = { transfer_state = PREV }
				}
				every_state = {
					limit = { is_core_of = SYR }
					ENG = { transfer_state = PREV }
				}
				every_state = {
					limit = { is_core_of = LEB }
					ENG = { transfer_state = PREV }
				}
				every_state = {
					limit = { is_core_of = LBA }
					FRA = { transfer_state = PREV }
				}
				ENG = { transfer_state = 309 }
				ENG = { transfer_state = 310 }
				FRA = { transfer_state = 274 }
				FRA = { transfer_state = 700 }
				FRA = { transfer_state = 701 }
				FRA = { transfer_state = 558 }
				FRA = { transfer_state = 902 }
				FRA = { transfer_state = 900 }
				FRA = { transfer_state = 901 }
			}
		}

		ai_will_do = {
			factor = 150
		}
	}
	LSM_demand_bessarabia = {
	
		icon = generic_nationalism

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_idea = SOV_molotov_ribbentrop_pact 
			ROM = { is_in_faction_with = GER }
		}

		visible = {
			tag = SOV
			ROM = { is_ai = yes }
			NOT = { has_completed_focus = SOV_claim_on_bessarabia }
			NOT = { is_in_faction_with = ROM }
			ROM = { is_in_faction_with = GER }
			NOT = { has_war_with = GER }
			NOT = { has_war_with = ROM }
			date > 1940.6.26 #historical date
			has_completed_focus = SOV_claims_on_poland
		}

		complete_effect = {
			custom_effect_tooltip = "Let's ask for it"
			hidden_effect = {
				SOV = { 
					transfer_state = 766
					transfer_state = 78
					transfer_state = 80
				}
				ROM = { set_country_flag = bessarabia_ceded }
				SOV = {
					country_event = { days = 1 id = news.10 }
				}
				news_event = { id = news.199 }
			}
		}

		ai_will_do = {
			factor = 50
		}
	}

	LSM_the_scramble_for_africa = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			ENG = { has_completed_focus = ENG_decolonization }
		}

		visible = {
			OR = {
				tag = GER
				tag = FRA
				tag = ITA
				tag = BEL
				tag = POR
				tag = HOL
			}
			ENG = { has_completed_focus = ENG_decolonization }
			is_ai = yes
			NOT = { has_government = communism }
			ENG = { is_ai = no }
		}

		complete_effect = {
			add_timed_idea = {
				idea = LSM_alone_idea
				days = 365
			}
			every_country = {
				limit = {
					OR = {
						capital_scope = { is_on_continent = africa }
						tag = MLT
						tag = CYP
					}
					NOT = { tag = LIB }
					is_in_faction = no
				}
				every_owned_state = { 
					add_claim_by = ROOT 
				}
				add_ideas = LSM_on_our_own_idea
				ROOT = { 
					create_wargoal = { 
						target = PREV
						type = annex_everything
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_the_scramble_for_middle_east = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			ENG = { has_completed_focus = ENG_decolonization }
		}

		visible = {
			OR = {
				tag = FRA
				tag = ITA
				tag = TUR
				tag = IRQ
				tag = SAU
				tag = PER
			}
			ENG = { has_completed_focus = ENG_decolonization }
			is_ai = yes
			NOT = { has_government = communism }
			ENG = { is_ai = no }
		}

		complete_effect = {
			add_timed_idea = {
				idea = LSM_alone_idea
				days = 365
			}
			every_country = {
				limit = {
					OR = {
						tag = KUW
						tag = QAR
						tag = UAE
						tag = JOR
						tag = PAL
						tag = ISR
					}
					is_in_faction = no
				}
				every_owned_state = { 
					add_claim_by = ROOT 
				}
				add_ideas = LSM_on_our_own_idea
				ROOT = { 
					create_wargoal = { 
						target = PREV
						type = annex_everything
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_the_scramble_for_south_asia = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			ENG = { has_completed_focus = ENG_decolonization }
		}

		visible = {
			OR = {
				tag = AFG
				tag = RAJ
				tag = PER
				tag = SIA
			}
			ENG = { has_completed_focus = ENG_decolonization }
			is_ai = yes
			NOT = { has_government = communism }
			ENG = { is_ai = no }
		}

		complete_effect = {
			add_timed_idea = {
				idea = LSM_alone_idea
				days = 365
			}
			every_country = {
				limit = {
					OR = {
						tag = PAK
						tag = BRM
						tag = BAN
						tag = SRI
						tag = MLD
						tag = MAL
					}
					is_in_faction = no
				}
				every_owned_state = { 
					add_claim_by = ROOT 
				}
				add_ideas = LSM_on_our_own_idea
				ROOT = { 
					create_wargoal = { 
						target = PREV
						type = annex_everything
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_the_scramble_for_america = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			ENG = { has_completed_focus = ENG_decolonization }
		}

		visible = {
			OR = {
				capital_scope = { is_on_continent = south_america }
				capital_scope = { is_on_continent = north_america }
			}
			ENG = { has_completed_focus = ENG_decolonization }
			NOT = { has_government = communism }
			OR = {
				NOT = { tag = USA }
				AND = {
					tag = USA
					NOT = { has_government = democratic }
				}
			}	
			ENG = { is_ai = no }	
		}

		complete_effect = {
			add_timed_idea = {
				idea = LSM_alone_idea
				days = 365
			}
			every_country = {
				limit = {
					OR = {
						tag = BLZ
						tag = GYA
						tag = TRI
						tag = BAS
						tag = JAM
						tag = BAH
					}
					is_in_faction = no
				}
				every_owned_state = { 
					add_claim_by = ROOT 
				}
				add_ideas = LSM_on_our_own_idea
				ROOT = { 
					create_wargoal = { 
						target = PREV
						type = annex_everything
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_POR_friendship = { #we have killed the Allies, so join us, Spain
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			POR = {
				OR = {
					has_government = fascism
					has_government = neutrality
				}
			}
		}

		visible = {
			tag = GER
			has_idea = crossing_the_atlantic_idea #the Soviets aren't a threat either, so lemme help your issue
			POR = { 
				is_ai = yes 
				is_in_faction = no
			}
			NOT = { 
				any_country = { 
					is_in_faction_with = GER 
					has_war_with = POR 
				}
			}
		}

		complete_effect = {
			GER = {
				add_to_faction = POR #you don't get to refuse
			}
			POR = { 
				every_owned_state = {
					ETH_upgrade_state_category = yes
					ETH_upgrade_state_category = yes #we can't fix your economy but we will expand your stuffs a little
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_SPR_friendship = { #we have killed the Allies, so join us, Spain
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			SPR = {
				OR = {
					has_government = fascism
					has_government = neutrality
				}
			}
		}

		visible = {
			tag = GER
			has_idea = crossing_the_atlantic_idea #the Soviets aren't a threat either, so lemme help your issue
			SPR = { 
				is_ai = yes 
				is_in_faction = no
			}
			NOT = { 
				any_country = { 
					is_in_faction_with = GER 
					has_war_with = SPR 
				}
			}
		}

		complete_effect = {
			GER = {
				add_to_faction = SPR #you don't get to refuse
			}
			SPR = { 
				every_owned_state = {
					ETH_upgrade_state_category = yes
					ETH_upgrade_state_category = yes #we can't fix your economy but we will expand your stuffs a little
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_GER_TUR_friendship = { #we have killed the Allies, so join us, Turkey
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			SPR = {
				OR = {
					has_government = fascism
					has_government = neutrality
				}
			}
		}

		visible = {
			tag = GER
			has_idea = crossing_the_atlantic_idea #the Soviets aren't a threat either, so lemme help your issue
			TUR = { 
				is_ai = yes 
				is_in_faction = no
			}
			NOT = { 
				any_country = { 
					is_in_faction_with = GER 
					has_war_with = TUR 
				}
			}
		}

		complete_effect = {
			GER = {
				add_to_faction = TUR #you don't get to refuse
			}
			TUR = { 
				every_owned_state = {
					ETH_upgrade_state_category = yes
					ETH_upgrade_state_category = yes #we can't fix your economy but we will expand your stuffs a little
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

}

last_stand_decision = {

	
	for_some_dead_ai = {

		icon = GFX_decision_generic_decision

		available = {
			has_capitulated = no
		}

		visible = {
			date > 1940.1.1
			any_owned_state = {
				OR = {
					free_building_slots = {
						building = synthetic_refinery
						size > 0
						include_locked = no
					}
					free_building_slots = {
						building = industrial_complex
						size > 0
						include_locked = no
					}
					free_building_slots = {
						building = arms_factory
						size > 0
						include_locked = no
					}
				}
			}
			is_ai = yes
			OR = {
				tag = CAN
				tag = SOV
				tag = JAP
			}
		}

		fire_only_once = no
	
		days_re_enable = 365

		cost = 0

		complete_effect = {	
			if = {
				limit = {
					is_major = no
				}
				add_ai_strategy = {
					type = building_target
					id = industrial_complex
					value = 5
				}	
				add_ai_strategy = {
					type = building_target
					id = arms_factory
					value = 5
				}	
			}	
			if = {
				limit = {
					is_major = yes
				}
				add_ai_strategy = {
					type = building_target
					id = industrial_complex
					value = 10
				}	
				add_ai_strategy = {
					type = building_target
					id = arms_factory
					value = 15
				}	
			}
			if = {
				limit = {
					is_major = yes
					has_resources_in_country = {
						resource = rubber
						amount < 1
					}
					NOT = {
						any_country = {
							is_in_faction_with = ROOT
							has_resources_in_country = {
								resource = rubber
								amount > 100
							}
						}
					}
				}
				add_ai_strategy = {
					type = building_target
					id = synthetic_refinery
					value = 3
				}
			}	
		}
		ai_will_do = {
			factor = 9999
			modifier = {
				factor = 0
				tag = SOV
				is_historical_focus_on = yes
			}
		}
	}
	
	disable_churchill = {

		icon = GFX_decision_generic_decision

		available = {
			ENG = { has_capitulated = no }
		}

		visible = {
			has_war_with = ENG
			ENG = { has_government = democratic }
			is_ai = no
		}

		fire_only_once = yes

		cost = 0

		complete_effect = {
			set_global_flag = no_more_churchill
		}
		ai_will_do = {
			factor = 0
		}
	}

	anti_exploit_revolutionary_brigade = {
		
		icon = generic_research
	
		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
			has_country_flag = anti_exploit_deployment
		}

		visible = {
			original_tag = FRA
			is_ai = yes
			any_state = {
				is_core_of = FRA
				any_other_country = {
					has_war_with = FRA
					divisions_in_state = {
						unit = paratrooper
						size > 0
						state = 16 #Paris
					}
					has_country_flag = has_paradropped_flag
				}
			}		
		}

		complete_effect = {
			FRA = {
				add_country_leader_role = {
					character = FRA_charles_de_gaulle
					country_leader = {
						expire = "1965.1.1"
						ideology = conservatism
						traits = {
							destroyer_of_world
						}	
					}
					promote_leader = yes				
				}
				remove_country_leader_trait = stout_defender
				set_technology = { destroyer_of_exploiter = 1 }
				division_template = {
					name = "Anti-Exploit Legion"			
					division_names_group = FRA_ARM_01
					is_locked = yes
					priority = 2

					regiments = {
						camelry = { x = 0 y = 0 }
						camelry = { x = 0 y = 1 }
						camelry = { x = 0 y = 2 }
						camelry = { x = 0 y = 3 }
						camelry = { x = 0 y = 4 }
						camelry = { x = 1 y = 0 }
						camelry = { x = 1 y = 1 }
						camelry = { x = 1 y = 2 }

						heavy_tank_destroyer_brigade = { x = 2 y = 0 }
						heavy_tank_destroyer_brigade = { x = 2 y = 1 }
						heavy_tank_destroyer_brigade = { x = 2 y = 2 }
						heavy_tank_destroyer_brigade = { x = 2 y = 3 }
						heavy_tank_destroyer_brigade = { x = 2 y = 4 }

						heavy_tank_destroyer_brigade = { x = 3 y = 0 }
						heavy_tank_destroyer_brigade = { x = 3 y = 1 }
						heavy_tank_destroyer_brigade = { x = 3 y = 2 }
						heavy_tank_destroyer_brigade = { x = 3 y = 3 }
						heavy_tank_destroyer_brigade = { x = 3 y = 4 }
					}
					support = { 		
						engineer = { x = 0 y = 0 } 		
						artillery = { x = 0 y = 1 } 		
						field_hospital = { x = 0 y = 2 } 		
						anti_air = { x = 0 y = 3 } 		
						medium_flame_tank = { x = 0 y = 4 }
					}
				}
				create_corps_commander = {
					name = "Saviour of France"
					gfx = GFX_idea_charles_de_gaulle
					traits={ brilliant_strategist war_hero armor_officer }
					attack_skill = 10
					defense_skill = 10
					planning_skill = 10
					logistics_skill = 10
					id = 9999
					skill = 9
				}
				retire_character = FRA_maurice_gamelin
				16 = {
					every_neighbor_state = {
						create_unit = {
							division = "name = \"Anti-Exploit Legion\" division_template = \"Anti-Exploit Legion\" start_experience_factor = 1"  
							owner = FRA
							allow_spawning_on_enemy_provs = yes  
							count = 4
						}
					}
				}
			}
		}
		
		ai_will_do = {
			factor = 9999
		}
	}

	korean_civil_war_democratic_side = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			surrender_progress > 0.3
		}

		visible = {
			original_tag = KOR
			any_country = {
				has_war_with = ROOT
				has_government = communism
				original_tag = KOR
			}
			NOT = { any_other_country = { is_in_faction_with = ROOT } }
		}

		complete_effect = {
			custom_effect_tooltip = "We will seek help from the Allies"
			if = {
				limit = {
					ENG = { is_ai = yes }
					NOT = { has_war_with = SOV }
				}
				ENG = { add_to_faction = ROOT }
			}
			if = {
				limit = {
					USA = { is_ai = yes }
					NOT = { has_war_with = SOV }
				}
				every_country = {
					limit = {
						has_war_with = ROOT
					}
					USA = { declare_war_on = { target = PREV type = topple_government } }
					news_event = { hours = 12 id = lsm_news.124 }
					add_named_threat = { threat = 20 name = "U.S. Intervention in Korean Civil war" }
				}
				division_template = {
					name = "Anti-Communist Volunteer"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
					}
				}
				division_template = {
					name = "US Marine Expeditionary Force"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						marine = { x = 0 y = 0 }
						marine = { x = 0 y = 1 }
						marine = { x = 0 y = 2 }
						marine = { x = 0 y = 3 }
						marine = { x = 0 y = 4 }
						marine = { x = 1 y = 0 }
					}
				}
				division_template = {
					name = "Allied Expeditionary Force"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						artillery_brigade = { x = 2 y = 0 }
						artillery_brigade = { x = 2 y = 1 }
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"Anti-Communist Volunteer\" start_experience_factor = 0.05" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 6
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"US Marine Expeditionary Force\" start_experience_factor = 0.35" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 2
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"Allied Expeditionary Force\" start_experience_factor = 0.35" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 3
					}
				}
			}
			if = {
				limit = {
					has_war_with = SOV
				}
				division_template = {
					name = "Anti-Communist Volunteer"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
					}
				}
				division_template = {
					name = "US Marine Expeditionary Force"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						marine = { x = 0 y = 0 }
						marine = { x = 0 y = 1 }
						marine = { x = 0 y = 2 }
						marine = { x = 0 y = 3 }
						marine = { x = 0 y = 4 }
						marine = { x = 1 y = 0 }
					}
				}
				division_template = {
					name = "Allied Expeditionary Force"
					priority = 1
					is_locked = yes
					division_names_group = KOR_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						artillery_brigade = { x = 2 y = 0 }
						artillery_brigade = { x = 2 y = 1 }
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"Anti-Communist Volunteer\" start_experience_factor = 0.05" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 15
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"US Marine Expeditionary Force\" start_experience_factor = 0.35" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 5
					}
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Volunteer Division\" division_template = \"Allied Expeditionary Force\" start_experience_factor = 0.35" 
						owner = ROOT 
						allow_spawning_on_enemy_provs = yes  
						count = 6
					}
				}
				every_other_country = { 
					limit = { is_in_faction_with = ENG }
					add_ai_strategy = {
						type = send_volunteers_desire
						id = PREV
						value = 5000
					}
					add_ai_strategy = {
						type = send_lend_lease_desire
						id = PREV
						value = 5000
					}

				}
			}
		}
		ai_will_do = {
			factor = 1000
		}
	}

	korean_civil_war_communist_side = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			surrender_progress > 0.3
		}

		visible = {
			original_tag = KOR
			any_country = {
				has_war_with = ROOT
				NOT = { has_government = communism }
				original_tag = KOR
			}
			NOT = { any_other_country = { is_in_faction_with = ROOT } }
		}

		complete_effect = {
			custom_effect_tooltip = "We will seek help from the Communist powers"
			PRC = { add_ideas = LSM_korean_civil_war_intervention }
			if = { 
				limit = {
					PRC = { has_war = no }
				}
				PRC = { 
					news_event = { hours = 12 id = lsm_news.125 }
					add_named_threat = { threat = 10 name = "Chinese Intervention in Korean Civil war" }
				}
				division_template = {
					name = "Chinese Volunteer"
					priority = 1
					division_names_group = CHI_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
						infantry = { x = 1 y = 4 }
					}
					support = {
						artillery = { x = 0 y = 0 }
					}
				}
				527 = {
					create_unit = {
						division = "name = \"Chinese Volunteer\" division_template = \"Chinese Volunteer\" start_experience_factor = 0.15" 
						owner = KOR 
						allow_spawning_on_enemy_provs = yes  
						count = 35
					}
				}
			}
			if = { 
				limit = {
					PRC = { has_war = yes }
				}
				division_template = {
					name = "Chinese Volunteer"
					priority = 1
					division_names_group = CHI_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
						infantry = { x = 1 y = 4 }
					}
					support = {
						artillery = { x = 0 y = 0 }
					}
				}
				527 = {
					create_unit = {
						division = "name = \"Chinese Volunteer\" division_template = \"Chinese Volunteer\" start_experience_factor = 0.15" 
						owner = KOR 
						allow_spawning_on_enemy_provs = yes  
						count = 15
					}
				}
			}
			if = { 
				limit = {
					SOV = { has_war = no }
				}
				division_template = {
					name = "Soviet Volunteer"
					priority = 1
					division_names_group = SOV_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
						infantry = { x = 1 y = 4 }
					}
					support = {
						artillery = { x = 0 y = 0 }
					}
				}
				527 = {
					create_unit = {
						division = "name = \"Soviet Volunteer\" division_template = \"Soviet Volunteer\" start_experience_factor = 0.25" 
						owner = KOR 
						allow_spawning_on_enemy_provs = yes  
						count = 20
					}
				}
			}
			if = { 
				limit = {
					SOV = { has_war = yes }
				}
				division_template = {
					name = "Soviet Volunteer"
					priority = 1
					division_names_group = SOV_INF_01
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
						infantry = { x = 1 y = 4 }
					}
					support = {
						artillery = { x = 0 y = 0 }
					}
				}
				527 = {
					create_unit = {
						division = "name = \"Soviet Volunteer\" division_template = \"Soviet Volunteer\" start_experience_factor = 0.25" 
						owner = KOR 
						allow_spawning_on_enemy_provs = yes  
						count = 10
					}
				}
			}
		}
		ai_will_do = {
			factor = 1000
		}
	}

	france_our_destiny_is_here = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_in_faction_with = POL
		}

		visible = {
			has_war = yes
			GER = { has_war_with = POL }
			original_tag = FRA
			is_ai = yes
			has_global_flag = enclave_enabled
		}

		complete_effect = {
			custom_effect_tooltip = "Fastgame Germany yeah bro"
			FRA = {
				set_country_flag = FRA_aggressive
				add_country_leader_role = {
					character = FRA_charles_de_gaulle
					country_leader = {
						expire = "1965.1.1"
						ideology = conservatism
						traits = {
						}	
					}
					promote_leader = yes				
				}	
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	GER_barbarossa_offensive_mission = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = GER
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			NOT = { has_idea = GER_barbarossa_offensive_1 }
			NOT = { has_idea = GER_barbarossa_offensive_2 }
			NOT = { has_idea = GER_barbarossa_offensive_3 }
			NOT = { has_idea = GER_barbarossa_offensive_4 }
			NOT = { has_idea = GER_barbarossa_offensive_5 }
		}

		is_good = no

		days_mission_timeout = 45

		timeout_effect = {
			activate_mission = GER_barbarossa_offensive_mission
		}

		cancel_effect = {
			clr_country_flag = GER_barbarossa_offensive_enabled
		}
	}

	GER_barbarossa_offensive = { #opposite of Soviet counteroffensive, the General Staffs prefer it more methodological
	
		icon = generic_research

		fire_only_once = no

		days_re_enable = 60 #we only do summer offensive and one before winter

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_country_flag = GER_barbarossa_offensive_enabled }
			NOT = { has_idea = last_offensive_was_shit }
		}

		visible = {
			tag = GER
			is_ai = yes
			NOT = {
				AND = {
					has_country_flag = western_front_stalemate
					FRA = { surrender_progress < 0.5 }
				}
			}
			OR = {
				AND = {
					has_war_with = SOV
					SOV = { has_capitulated = no }
				}
				AND = {
					has_war_with = POL
					POL = { has_capitulated = no }
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = "Initiate Large Scale Offensive if possible"
			hidden_effect = {
				activate_mission = GER_barbarossa_offensive_mission
				set_country_flag = GER_barbarossa_offensive_enabled
				add_timed_idea = { idea = GER_barbarossa_offensive_1 days = 25 }
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
			}
		}

		ai_will_do = {
			factor = 1000
			modifier = {
				has_country_flag = mech_god
				has_equipment = { mechanized_equipment < 1000 }
				add = -3000
			}
			modifier = {
				has_country_flag = mass_mob_flag
				has_equipment = { light_tank_chassis < 1000 }
				has_equipment = { infantry_equipment < 10000 }
				add = -3000
			}
			modifier = {
				has_equipment = { medium_tank_chassis < 2000 } #cant
				NOT = { has_country_flag = mech_god }
				NOT = { has_country_flag = mass_mob_flag }
				date < 1941.10.1
				has_war_with = SOV
				add = -3000
			}
			modifier = {
				has_war_with = POL
				POL = { is_ai = yes }
				POL = { has_capitulated = no }
				has_equipment = { medium_tank_chassis > 1000 }
				NOT = { has_country_flag = mech_god }
				NOT = { has_country_flag = mass_mob_flag }
				add = 1000
			}
			modifier = {
				has_war_with = POL
				POL = { is_ai = no }
				POL = { has_capitulated = no }
				has_equipment = { medium_tank_chassis > 200 }
				NOT = { has_country_flag = mech_god }
				NOT = { has_country_flag = mass_mob_flag }
				add = 1000
			}
			modifier = {
				has_war_with = GRE
				NOT = { has_war_with = SOV }
				GRE = { is_ai = no }
				has_equipment = { medium_tank_chassis < 1000 }
				NOT = { has_country_flag = mech_god }
				NOT = { has_country_flag = mass_mob_flag }
				add = -3000
			}
			modifier = {
				has_manpower < 300000
				date < 1955.1.1
				add = -9999
			}
			modifier = {
				OR = {
					AND = {
						has_equipment = { medium_tank_chassis < -2000 }
						NOT = { has_country_flag = mech_god }
						NOT = { has_country_flag = mass_mob_flag }
					}
					AND = {
						has_equipment = { light_tank_chassis < -1000 }
						has_country_flag = mass_mob_flag
					}
					AND = {
						has_global_flag = d_day_crisis	
						has_global_flag = d_day_happened 
					}	
					AND = {
						GER = { has_manpower < 600000 }
						date > 1940.6.1
						date < 1949.12.1
					}
					GER = { surrender_progress > 0.3 }
					GER_is_not_relevant = yes
					AND = { #bro its winter, but hey, we like attacking in winter, right? just a little though
						date > 1941.10.30
						date < 1942.5.18
					}
					AND = { #bro its winter
						date > 1942.10.30
						date < 1943.5.18
					}
					AND = { #bro its winter
						date > 1943.10.30
						date < 1944.5.18
					}
					AND = { #bro its winter
						date > 1944.10.30
						date < 1945.5.18
					}
					AND = { #bro its winter
						date > 1945.10.30
						date < 1946.5.18
					}
					AND = { #bro its winter
						date > 1947.10.30
						date < 1948.5.18
					}
					AND = { #bro its winter
						date > 1948.10.30
						date < 1949.5.18
					}
					AND = { #bro its winter
						date > 1949.10.30
						date < 1950.5.18
					}
					AND = { #bro its winter
						date > 1950.10.30
						date < 1951.5.18
					}
					AND = { #bro its winter
						date > 1952.10.30
						date < 1953.5.18 
					}
					AND = { #bro its winter
						date > 1953.10.30
						date < 1954.5.18
					}
				}
				add = -2000	
			}
		}
	}

	GER_western_front_offensive_mission = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = GER
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			NOT = { has_idea = GER_western_front_offensive_1 }
			NOT = { has_idea = GER_western_front_offensive_2 }
			NOT = { has_idea = GER_western_front_offensive_3 }
			NOT = { has_idea = GER_western_front_offensive_4 }
			NOT = { has_idea = GER_western_front_offensive_5 }
		}

		is_good = no

		days_mission_timeout = 45

		timeout_effect = {
			activate_mission = GER_western_front_offensive_mission
		}

		cancel_effect = {
			clr_country_flag = GER_western_front_offensive_enabled
		}
	}

	GER_western_front_offensive = { #opposite of Soviet counteroffensive, the General Staffs prefer it more methodological
	
		icon = generic_research

		fire_only_once = no

		days_re_enable = 60 #we only do summer offensive and one before winter

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_country_flag = GER_western_front_offensive_enabled }
		}

		visible = {
			has_global_flag = stalemate_on_western_front
			tag = GER
			is_ai = yes
			has_war_with = FRA
			FRA = { has_capitulated = no }
			OR = {
				AND = {
					date > 1940.5.1	
					NOT = { has_global_flag = vanilla_history }
				}
				AND = {
					date > 1941.1.1	
					has_global_flag = vanilla_history
				}

			}
			NOT = { has_war_with = SOV }
		}

		complete_effect = {
			custom_effect_tooltip = "Initiate Large Scale Offensive if possible"
			hidden_effect = {
				activate_mission = GER_western_front_offensive_mission
				set_country_flag = GER_western_front_offensive_enabled
				add_timed_idea = { idea = GER_western_front_offensive_1 days = 14 }
			}
		}

		ai_will_do = {
			factor = 1000
			modifier = {
				has_equipment = { medium_tank_chassis < 200 } #cant
				FRA = { has_manpower > 50000 }
				add = -3000
			}
		}
	}

	GER_d_day_crisis = { 
		priority = 50

		icon = hol_draw_up_staff_plans

		allowed = {
			original_tag = GER
		}

		available =  {
			hidden_trigger = { always = no }
		}

		activation = {
			always = no
		}

		cancel_trigger = {
			NOT = { has_idea = GER_dday_counteroffensive }
		}

		is_good = no

		days_mission_timeout = 90

		timeout_effect = {
			clr_country_flag = GER_dday_counteroffensive_mission_flag
		}

		cancel_effect = {
			clr_country_flag = GER_dday_counteroffensive_mission_flag
		}
	}

	GER_dday_counteroffensive = { #opposite of Soviet counteroffensive, the General Staffs prefer it more methodological
	
		icon = generic_research

		fire_only_once = no #if we fail, we are kinda doomed

		days_re_enable = 365 

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_country_flag = GER_dday_counteroffensive_mission_flag }
		}

		visible = {
			tag = GER
			is_ai = yes
			any_country = {
				original_tag = FRA
				has_government = fascism
				is_in_faction_with = GER
				surrender_progress > 0.3
			}
			has_global_flag = d_day_crisis
		}

		complete_effect = {
			custom_effect_tooltip = "Initiate Large Scale Offensive if possible"
			hidden_effect = {
				activate_mission = GER_d_day_crisis
				set_country_flag = GER_dday_counteroffensive_mission_flag
				add_timed_idea = { idea = GER_dday_counteroffensive days = 120 }
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
				blitzkrieg_up = yes
			}
		}

		ai_will_do = {
			factor = 9999
			modifier = {
				has_equipment = { infantry_equipment < 0 }
				factor = 0
			}
		}
	}

	LSM_ROM_BUL_border_agreement = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = ROM
			is_in_faction_with = BUL
			is_historical_focus_on = yes
		}

		complete_effect = {
			BUL = { 
				transfer_state = 77
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_ITA_BUL_trade_agreement = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = BUL
			is_in_faction_with = ITA
			has_war = yes
			ITA = { 
				is_ai = yes 
				has_war = yes
			}
			is_historical_focus_on = yes
		}

		complete_effect = {
			BUL = { add_ideas = BUL_due_compensation }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_BUL_trade_agreement_105 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			controls_state = 105
			is_in_faction_with = GER
			105 = { is_owned_by = ROOT }
		}

		complete_effect = {
			ROOT = { 
				give_resource_rights = { receiver = GER state = 105 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_BUL_trade_agreement_106 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			controls_state = 106
			is_in_faction_with = GER
			106 = { is_owned_by = ROOT }
		}

		complete_effect = {
			ROOT = { 
				give_resource_rights = { receiver = GER state = 106 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_BUL_trade_agreement_free = { #sometimes they get other trade policies from elsewhere for some reasons; will be deleted and moved to economic idea AI desire once clean.
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = BUL
			is_in_faction_with = GER
			NOT = { has_idea = free_trade }
		}

		complete_effect = {
			BUL = { 
				add_political_power = -75 #adjusted
				if = { 
					limit = { has_government = fascism }
					add_political_power = -75
				}
				add_ideas = free_trade
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	USA_lets_go_down_on_trade_law = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = USA
			threat > 0.8
			NOT = { has_idea = export_focus }
			has_idea = free_trade
		}
	
		cost = 75

		complete_effect = {
			USA = { 
				add_political_power = -75
				add_ideas = export_focus
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	USA_we_believe_in_general_motors = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = USA
			has_completed_focus = USA_wartime_industry
			NOT = { has_idea = USA_general_motors }
		}
	
		cost = 75

		complete_effect = {
			USA = { 
				add_political_power = -75
				add_ideas = USA_general_motors
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	LSM_sweden_seize_northern_norway = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_war = no
		}

		visible = {
			NOT = { has_global_flag = vanilla_history }
			is_ai = yes
			tag = SWE
			OR = {
				NOR = { has_civil_war = yes }
				NOR = { surrender_progress > 0.5 }
			}
			NOR = { is_ai = yes }
			NOT = { has_global_flag = sweden_seized_finnmark }
			is_historical_focus_on = yes
		}

		complete_effect = {
			set_global_flag = sweden_seized_finnmark
			SWE = { 
				transfer_state = 924
				transfer_state = 925
			}
		}

		ai_will_do = {
			factor = 100
		}
	}

	LSM_norway_return_northern_norway = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			original_tag = NOR
			AND = {
				has_civil_war = no
				NOT = { surrender_progress > 0 }
			}
			has_global_flag = sweden_seized_finnmark
		}

		complete_effect = {
			transfer_state = 924
			transfer_state = 925
			clr_global_flag = sweden_seized_finnmark
		}

		ai_will_do = {
			factor = 150
		}
	}

	sweden_norway_is_dead = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			original_tag = SWE
			924 = { is_owned_by = SWE }
			925 = { is_owned_by = SWE }
			NOT = {
				any_country = {
					original_tag = NOR
					exists = yes
				}
			}
			NOT = {
				any_state = {
					is_core_of = NOR
					owner = { is_ai = no }
				}
			}
			is_historical_focus_on = yes
		}

		complete_effect = {
			set_global_flag = dead_norway
			every_state = {
				limit = { is_core_of = NOR }
				SWE = { transfer_state = PREV }
				add_core_of = SWE
				remove_core_of = NOR
			}
		}

		ai_will_do = {
			factor = 150
		}
	}

	GER_stuffs1 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			original_tag = GER
			has_idea = LSM_the_final_push_failure_GER
		}

		complete_effect = {
			hidden_effect = {
				load_focus_tree = generic_focus
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SWI_stuffs1 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			date > 1937.8.1
			is_ai = yes
			original_tag = SWI
			has_dlc = "By Blood Alone"
		}

		complete_effect = {
			hidden_effect = {
				every_other_country = {
					limit = {
						SWI_is_country_to_balance = yes
					}
					add_opinion_modifier = {
						target = ROOT 
						modifier = huge_increase				
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SWI_stuffs5 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_global_flag = d_day_happened
			original_tag = SWI
			has_dlc = "By Blood Alone"
			OR = {
				GER = { surrender_progress > 0.05 }
				ITA = { surrender_progress > 0.5 }
				any_country = {
					original_tag = FRA
					is_in_faction_with = GER 
					surrender_progress > 0.5
				}
				AND = {
					BEL = { has_capitulated = no }
					HOL = { has_capitulated = no }
				}
				SOV = { has_idea = SOV_patriotic_offensive_5 }
			}
		}

		complete_effect = {
			hidden_effect = {
				complete_national_focus = SWI_freeze_german_assets
				if = {
					limit = {
						GER = { has_idea = SWI_trading_with_switzerland_military }
					}
					GER = { remove_ideas = SWI_trading_with_switzerland_military }
				}
			}
		}

		ai_will_do = {
			factor = 9999
			modifier = {
				any_country = {
					is_allied_ai = yes
					is_ai = no 
				}
				GER = { surrender_progress < 0.1 }
				factor = 0
			}
		}
	}

	AI_marine_template = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai_marine = yes
			is_ai = yes
			date > 1936.1.4
		}

		complete_effect = {
			hidden_effect = {
				division_template = {
					name = "Marine template 2"			# Rifle Division
					division_names_group = ENG_MAR_01
					is_locked = no
					priority = 2

					regiments = {
						marine = { x = 0 y = 0 }
						marine = { x = 0 y = 1 }
						marine = { x = 0 y = 2 }
						marine = { x = 0 y = 3 }
						marine = { x = 0 y = 4 }

						marine = { x = 1 y = 0 }
						marine = { x = 1 y = 1 }
						marine = { x = 1 y = 2 }
						marine = { x = 1 y = 3 }
						marine = { x = 1 y = 4 }

						marine = { x = 2 y = 0 }
						marine = { x = 2 y = 1 }
						marine = { x = 2 y = 2 }
						marine = { x = 2 y = 3 }
						marine = { x = 2 y = 4 }

						marine = { x = 3 y = 0 }
						marine = { x = 3 y = 1 }
						marine = { x = 3 y = 2 }
					}
					support = {		
						artillery = { x = 0 y = 0 }		
						anti_air = { x = 0 y = 0 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	JAP_free_template_because_it_is_cheaper_than_their_historical_template = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = JAP
			is_ai = yes
			date > 1936.1.4
		}

		complete_effect = {
			hidden_effect = {
				if = { 
					limit = { 
						has_tech = trench_warfare
					}
					set_technology = { trench_warfare = 0 }
					set_technology = { superior_firepower = 1 }
				}
				division_template = {
					name = "Infantry template 2"			# Rifle Division
					division_names_group = JAP_INF_01
					is_locked = no
					priority = 1

					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }

						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
					}
					support = {		
						artillery = { x = 0 y = 0 }
					}
				}
				division_template = {
					name = "Marine template 2"			# Rifle Division
					division_names_group = JAP_MAR_01
					is_locked = no
					priority = 1

					regiments = {
						marine = { x = 0 y = 0 }
						marine = { x = 0 y = 1 }
						marine = { x = 0 y = 2 }
						marine = { x = 0 y = 3 }
						marine = { x = 1 y = 0 }
						marine = { x = 2 y = 0 }
					}
					support = {		
						artillery = { x = 0 y = 0 }
						engineer = { x = 0 y = 1 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry  
							division_has_majority_template = motorized   
							division_has_majority_template = mountaineers
						}
					}
					change_division_template = {
						division_template = "Infantry template 2" 
					}
				}
				every_country_division = {
					limit = { 
						OR = {  
							division_has_majority_template = light_armor 
						}
					}
					change_division_template = {
						division_template = "Marine template 2" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	GER_free_template = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = GER
			is_ai = yes
			date > 1936.5.1
			has_army_experience > 14
		}

		complete_effect = {
			hidden_effect = {
				division_template = {
					name = "Infantry template 6"			
					division_names_group = GER_INF_01
					is_locked = no
					priority = 1

					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
					}
					support = {		
						artillery = { x = 0 y = 0 }
						anti_tank = { x = 0 y = 1 }
						anti_air = { x = 0 y = 2 }
						engineer = { x = 0 y = 3 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	ENG_free_template = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = ENG
			is_ai = yes
			has_army_experience > 14
		}

		complete_effect = {
			hidden_effect = {
				division_template = {
					name = "Infantry template 2"			
					division_names_group = ENG_INF_01
					is_locked = no
					priority = 1

					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						anti_air_brigade = { x = 2 y = 0 }
					}
					support = {		
						artillery = { x = 0 y = 0 }
						anti_tank = { x = 0 y = 1 }
						engineer = { x = 0 y = 2 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_mass_mob_preparation = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_tech = mass_assault
			is_ai = yes
			NOT = { tag = SOV } #you do your stuffs
			is_ai_mass_mob = yes
			has_army_experience > 5
		}

		complete_effect = {
			hidden_effect = {
				set_country_flag = ready_for_refreshment
				division_template = {
					name = "Infantry template 2"  
					division_names_group = AST_INF_01
					force_allow_recruiting = yes
					is_locked = no
					priority = 1

					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }

						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
					}
					support = {		
						artillery = { x = 0 y = 0 }		
						anti_air = { x = 0 y = 1 }
					}
				}
				division_template = {
					name = "Infantry template 3"  
					division_names_group = AST_INF_01
					force_allow_recruiting = yes
					is_locked = no
					priority = 1

					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }

						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
					}
					support = {		
						artillery = { x = 0 y = 0 }		
						anti_air = { x = 0 y = 1 }
						engineer = { x = 0 y = 2 }
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}
	LSM_ENG_USA_add_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				tag = ENG
				tag = USA
				tag = FRA
			}
			has_tech = interwar_antitank
			is_ai = yes
			has_army_experience > 4
		}

		complete_effect = {
			hidden_effect = {
				division_template = { 
					name = "Infantry Template 4" 
					force_allow_recruiting = yes
					division_names_group = ENG_INF_01
					priority = 1
					is_locked = no
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						anti_air = { x = 0 y = 1 }
						engineer = { x = 0 y = 2 }
						anti_tank = { x = 0 y = 3 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry  
							division_has_majority_template = motorized   
							division_has_majority_template = light_armor    
							division_has_majority_template = mountaineers
						}
					}
					change_division_template = {
						division_template = "Infantry Template 4" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_refresh_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_tech = mass_assault
			is_ai_mass_mob = yes
			is_ai = yes
			NOT = { tag = SOV } #you do your stuffs
			has_country_flag = ready_for_refreshment
			NOT = { tag = ITA } #you do your stuffs
			NOT = { tag = SWI } #you do your stuffs
			NOT = { original_tag = FRA } #you do your stuffs
			has_army_experience > 14
		}

		complete_effect = {
			hidden_effect = {
				division_template = { 
					name = "Infantry Template 3" 
					force_allow_recruiting = yes
					division_names_group = AST_INF_01
					priority = 1
					is_locked = no
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						anti_air = { x = 0 y = 1 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry  
							division_has_majority_template = motorized   
							division_has_majority_template = light_armor    
							division_has_majority_template = mountaineers
						}
					}
					change_division_template = {
						division_template = "Infantry Template 3" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_BRA_in_the_allies = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			date > 1944.6.31
		}

		visible = {
			original_tag = BRA
			is_historical_focus_on = yes
			is_in_faction = no
			is_ai = yes
			OR = { 
				AND = { 
					ENG = { is_faction_leader = yes }
					ENG = { is_ai = yes }
					ENG = { has_government = democratic }
				} 
				AND = { 
					USA = { is_faction_leader = yes }
					USA = { is_ai = yes }
					USA = { has_government = democratic }
				} 
				AND = { 
					CAN = { is_faction_leader = yes }
					CAN = { is_ai = yes }
					CAN = { has_government = democratic }
				}
			}
		}

		complete_effect = {
			if = { 
				limit = { 
					ENG = { is_faction_leader = yes }
					ENG = { has_government = democratic }
				}
				ENG = { add_to_faction = BRA }
			}
			if = { 
				limit = { 
					USA = { is_faction_leader = yes }
					USA = { has_government = democratic }
				}
				USA = { add_to_faction = BRA }
			}
			if = { 
				limit = { 
					CAN = { is_faction_leader = yes }
					CAN = { has_government = democratic }
				}
				CAN = { add_to_faction = BRA }
			}
			
		}

		ai_will_do = {
			factor = 0
			modifier = {
				add = 200
				check_variable = { GER.GER_blitzkrieg < 0 } #they started losing
			}
			modifier = {
				add = 200
				date > 1944.7.1
			}
		}
	}

	everyone_likes_greece = { #actual cheat
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
		}

		visible = {
			original_tag = GRE
			is_ai = yes
			has_completed_focus = GRE_open_foreign_subsidized_factories
		}

		complete_effect = {
			random_owned_controlled_state = {
				limit = {
					free_building_slots = {
						building = arms_factory
						size > 1
						include_locked = yes
					}
				}
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = arms_factory
					level = 2
					instant_build = yes
				}
			}
			random_owned_controlled_state = {
				limit = {
					free_building_slots = {
						building = industrial_complex
						size > 1	
						include_locked = yes
					}
				}
				add_extra_state_shared_building_slots = 2
					add_building_construction = {
					type = industrial_complex
					level = 2
					instant_build = yes
				}
			}
			random_owned_controlled_state = {
				limit = {
					free_building_slots = {
						building = arms_factory
						size > 1
						include_locked = yes
					}
				}
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = arms_factory
					level = 2
					instant_build = yes
				}
			}
			random_owned_controlled_state = {
				limit = {
					free_building_slots = {
						building = industrial_complex
						size > 1	
						include_locked = yes
					}
				}
				add_extra_state_shared_building_slots = 2
					add_building_construction = {
					type = industrial_complex
					level = 2
					instant_build = yes
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_OI_is_good = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
			has_tech = formation_flying
		}

		visible = {
			original_tag = SOV
			has_tech = formation_flying
			is_ai = yes
		}

		complete_effect = {
			set_technology = { formation_flying = 0 }
			set_technology = { force_rotation = 1 }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	GER_SD_is_necessary = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
			has_tech = formation_flying
		}

		visible = {
			original_tag = GER
			has_tech = formation_flying
			is_ai = yes
			any_country = {
				is_allied_ai = yes
				is_ai = no
			}
		}

		complete_effect = {
			set_technology = { formation_flying = 0 }
			set_technology = { air_superiority = 1 }
		}

		ai_will_do = {
			factor = 9999
		}
	}


	VIC_minor_mass_mob_nation = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = FRA
			has_focus_tree = vichy_french_focus
			is_ai = yes
		}

		complete_effect = {
			if = { 
				limit = { 	
					has_tech = grand_mechanized_offensive 
				}
				set_technology = { grand_mechanized_offensive = 0 }
			}
			if = { 
				limit = { 	
					has_tech = grand_mechanized_offensive 
				}
				set_technology = { infantry_offensive = 0 }
			}
			if = { 
				limit = { 
					has_tech = grand_assault
				}
				set_technology = { grand_assault = 0 }
				set_technology = { peoples_army = 1 }
				set_technology = { human_infantry_offensive = 1 }
			}
			if = { 
				limit = { 
					has_tech = prepared_defense
				}
				set_technology = { prepared_defense = 0 }
				set_technology = { defence_in_depth = 1 }
			}
			if = { 
				limit = { 
					has_tech = grand_battle_plan
				}
				set_technology = { grand_battle_plan = 0 }
				set_technology = { pocket_defence = 1 }
			}
			if = { 
				limit = { 
					has_tech = trench_warfare
				}
				set_technology = { trench_warfare = 0 }
				set_technology = { mass_assault = 1 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_minor_mass_mob_nation = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai_mass_mob = yes
			is_ai = yes
		}

		complete_effect = {
			if = { 
				limit = { 
					has_tech = trench_warfare
				}
				set_technology = { trench_warfare = 0 }
				set_technology = { mass_assault = 1 }
			}
			if = { 
				limit = { 
					has_tech = superior_firepower
				}
				set_technology = { superior_firepower = 0 }
				set_technology = { mass_assault = 1 }
			}
			if = { 
				limit = { 
					has_tech = mobile_warfare
				}
				set_technology = { prepared_defense = 0 }
				set_technology = { mass_assault = 1 }
			}
			if = { 
				limit = { 
					NOT = { has_tech = mobile_warfare } 
					NOT = { has_tech = superior_firepower } 
					NOT = { has_tech = trench_warfare }
				}
				set_technology = { mass_assault = 1 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_minor_mech_mob_nation = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai_mech_mob = yes
			is_ai = yes
		}

		complete_effect = {
			if = { 
				limit = { 
					has_tech = trench_warfare
				}
				set_technology = { trench_warfare = 0 }
				set_technology = { mobile_warfare = 1 }
			}
			if = { 
				limit = { 
					has_tech = superior_firepower
				}
				set_technology = { superior_firepower = 0 }
				set_technology = { mobile_warfare = 1 }
			}
			if = { 
				limit = { 
					has_tech = mass_assault
				}
				set_technology = { prepared_defense = 0 }
				set_technology = { mobile_warfare = 1 }
			}
			if = { 
				limit = { 
					NOT = { has_tech = mass_assault } 
					NOT = { has_tech = superior_firepower } 
					NOT = { has_tech = trench_warfare }
				}
				set_technology = { mobile_warfare = 1 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_ITA_mass_mob_nation = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = ITA
			is_ai = yes
		}

		complete_effect = {
			if = { 
				limit = { 
					has_tech = trench_warfare
				}
				set_technology = { trench_warfare = 0 }
				set_technology = { mass_assault = 1 }
			}
			if = { 
				limit = { 
					has_tech = grand_battle_plan
				}
				set_technology = { grand_battle_plan = 0 }
				set_technology = { pocket_defence = 1 }
			}
			if = { 
				limit = { 
					has_tech = prepared_defense
				}
				set_technology = { prepared_defense = 0 }
				set_technology = { defence_in_depth = 1 }
			}
			if = { 
				limit = { 
					has_tech = grand_assault
				}
				set_technology = { grand_assault = 0 }
				set_technology = { peoples_army = 1 }
				set_technology = { human_infantry_offensive = 1 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_ITA_annex_ethiopia_for_plot_purpose = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
		}

		visible = {
			original_tag = ITA
			is_ai = yes
			ETH = { is_ai = yes }
			OR = { 
				has_country_flag = ITA_defeat_in_ethiopia_flag
				AND = {
					ENG = { is_ai = yes }
					ETH = { has_capitulated = yes }
				}
			}
			has_global_flag = this_is_acceptable
		}

		complete_effect = {
			annex_country = { target = ETH transfer_troops = yes }
			add_manpower = 200000
			add_popularity = {
				ideology = fascism 
				popularity = 0.3
			}
			add_equipment_to_stockpile = { 
				type = infantry_equipment_1
				amount = 30000
				producer = ITA
			}
			add_equipment_to_stockpile = { 
				type = artillery_equipment_1
				amount = 2000
				producer = ITA
			}
			add_equipment_to_stockpile = { 
				type = support_equipment_1
				amount = 2000
				producer = ITA
			}
			add_equipment_to_stockpile = { 
				type = anti_air_equipment_1
				amount = 2000
				producer = ITA
			}
			add_war_support = 0.5
			add_stability = 0.3
			add_political_power = 300
			SOV = { 
				add_manpower = 25000 
				army_experience = 50
			} 
			news_event = { hours = 12 id = lsm_news.1999 } 
			set_technology = { special_forces_mountaineers = 1 }
			set_technology = { rangers = 1 }
			every_owned_state = {
				limit = {
					is_on_continent = africa
					has_resistance = yes 
				}
				add_compliance = 20
				add_resistance_target = {
					amount = -20
					occupier = ITA 
					days = 730
				}
				
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_POR_kingdom = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = no
		}

		visible = {
			original_tag = POR
			is_ai = yes
		}

		days_remove = 730

		modifier = {
			stability_weekly = 0.02
			political_power_gain = 0.25
 		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_ITA_release_LBA = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
		}

		visible = {
			OR = {
				ENG = { is_ai = no }
				SOV = { is_ai = no }
				USA = { is_ai = no }
			}
			has_global_flag = AI_is_balanced
			NOT = { has_global_flag = vanilla_history }
			original_tag = ITA
			is_ai = yes
			is_historical_focus_on = yes
			NOT = { has_global_flag = ITA_decolonisation_historical }
			date < 1936.3.1
		}

		complete_effect = {
			set_global_flag = ITA_decolonisation_historical
			hidden_effect = {
				release = LBA
				ITA = { set_autonomy = { target = LBA autonomy_state = autonomy_reichskommissariat } }
				every_country = {
					limit = {
						OR = { 
							original_tag = ITA
							is_subject_of = ITA
							AND = {
								original_tag = ALB
								is_ai = yes
							}
						}
					}
					add_to_tech_sharing_group = ITA_italian_hegemony_program
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_test_historical_semi_decolonization = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
		}

		visible = {
			NOT = { has_global_flag = vanilla_history }
			NOT = { has_global_flag = france_nerf }
			original_tag = FRA
			is_ai = yes
			is_historical_focus_on = yes
			NOT = { has_global_flag = FRA_decolonisation_historical }
			GER = { is_ai = no }
			has_war = no
			date < 1936.3.1
			has_global_flag = france_giga
		}

		complete_effect = {
			set_global_flag = FRA_decolonisation_historical
			release = TUN
			release = MOR
			release = SEN
			release = MRT
			release = GNA
			release = MLI
			release = IVO
			release = VOL
			release = NGR
			release = DAH
			release = TOG

			release = CHA
			release = CMR
			release = CAR
			release = RCG
			release = GAB

			release = SYR
			release = LEB
			release = LAO
			release = CAM
			release = VIN
			release = ALG
			TUR = { transfer_state = 799 }
			FRA = { set_autonomy = { target = ALG autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = TUN autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = MOR autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = SEN autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = MRT autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = GNA autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = MLI autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = IVO autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = VOL autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = NGR autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = DAH autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = TOG autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = CHA autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = CMR autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = CAR autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = RCG autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = GAB autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = SYR autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = LEB autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = LAO autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = CAM autonomy_state = autonomy_puppet } }
			FRA = { set_autonomy = { target = VIN autonomy_state = autonomy_puppet } }
			every_country = {
				limit = {
					OR = { 
						original_tag = FRA
						is_subject_of = FRA
					}
				}
				add_to_tech_sharing_group = FRA_french_union_tech_sharing
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_test_historical_panic_annex = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
		}

		visible = {
			NOT = { has_global_flag = vanilla_history }
			original_tag = FRA
			is_ai = yes
			is_historical_focus_on = yes
			has_global_flag = FRA_decolonisation_historical
			has_war = yes
			NOT = { has_completed_focus = FRA_french_union }
		}

		complete_effect = {
			FRA = { annex_country = { target = ALG transfer_troops = yes } }
			FRA = { annex_country = { target = TUN transfer_troops = yes } }
			FRA = { annex_country = { target = MOR transfer_troops = yes } }
			FRA = { annex_country = { target = SEN transfer_troops = yes } }
			FRA = { annex_country = { target = MRT transfer_troops = yes } }
			FRA = { annex_country = { target = GNA transfer_troops = yes } }
			FRA = { annex_country = { target = MLI transfer_troops = yes } }
			FRA = { annex_country = { target = IVO transfer_troops = yes } }
			FRA = { annex_country = { target = VOL transfer_troops = yes } }
			FRA = { annex_country = { target = NGR transfer_troops = yes } }
			FRA = { annex_country = { target = DAH transfer_troops = yes } }
			FRA = { annex_country = { target = TOG transfer_troops = yes } }
			FRA = { annex_country = { target = CHA transfer_troops = yes } }
			FRA = { annex_country = { target = CMR transfer_troops = yes } }
			FRA = { annex_country = { target = CAR transfer_troops = yes } }
			FRA = { annex_country = { target = RCG transfer_troops = yes } }
			FRA = { annex_country = { target = GAB transfer_troops = yes } }
			FRA = { annex_country = { target = SYR transfer_troops = yes } }
			FRA = { annex_country = { target = LEB transfer_troops = yes } }
			FRA = { annex_country = { target = LAO transfer_troops = yes } }
			FRA = { annex_country = { target = CAM transfer_troops = yes } }
			FRA = { annex_country = { target = VIN transfer_troops = yes } }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_the_final_push_decision = {
	
		icon = generic_merge_plant_tank

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip = {
				tooltip = "Endsieg has begun"
				GER = { has_country_flag = LSM_endsieg_has_begun }
				GER = { has_idea = endsieg_idea }
			}
			custom_trigger_tooltip = {
				tooltip = "We have troops near Germany"
				any_state = {
					OR = {
						is_core_of = GER
						is_core_of = FRA
						is_core_of = HOL
						is_core_of = BLR
						is_core_of = UKR
						is_core_of = LAT
						is_core_of = LIT
						is_core_of = EST
						is_core_of = ROM
						is_core_of = HUN
						is_core_of = CZE
						is_core_of = YUG
						is_core_of = BEL
						is_core_of = LUX
						is_core_of = SWI
						is_core_of = POL
						is_core_of = LIT
						is_core_of = CZE
						is_core_of = AUS
						is_core_of = ITA
						is_core_of = DEN
					}
					ROOT = { 
						divisions_in_state = { state = PREV size > 0 }
					}
				}
			}
		}

		visible = {
			has_war_with = GER
			GER = { surrender_progress > 0.03 }
		}

		complete_effect = {
			add_timed_idea = { idea = LSM_the_final_push days = 365 }
			add_war_support = 0.25
			add_stability = 0.25
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_yalta_border_fix_moselland = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_historical_focus_on = yes
			is_ai = yes
			NOT = { original_tag = GER }
			NOT = { original_tag = FRA } #you are allowed to keep this
			controls_state = 42 #moselland
			42 = { is_owned_by = ROOT }
			any_country = {
				original_tag = GER
				NOT = { has_war_with = ROOT }
			}
		}

		complete_effect = {
			random_country = {
				limit = {
					original_tag = GER
					has_government = democratic
				}
				transfer_state = 42
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	SOV_elite_difficulty_moment = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = no
		}

		visible = {
			is_major = no
			is_ai = no
			OR = {
				tag = DNZ
			}
		}

		complete_effect = {
			SOV = { add_ideas = SOV_elite_difficulty }
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_debug_SOV_dockyard_is_shit_and_useless = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_global_flag = activate_flag
			tag = SOV
			is_ai = yes
			num_of_naval_factories > 7 #it has begun, the unstoppable desire for AI to build dockyards
		}

		complete_effect = {
			add_ideas = shit_soviet_dockyard_1 #adjusted
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_debug_SOV_dockyard_is_shit_and_useless_2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_global_flag = activate_flag
			tag = SOV
			is_ai = yes
			num_of_naval_factories > 15 #it has begun, the unstoppable desire for AI to build dockyards
		}

		complete_effect = {
			add_ideas = shit_soviet_dockyard_2 #adjusted
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_debug_SOV_unfunny_stuffs = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = SOV
			OR = {
				AND = {
					has_global_flag = LSM_resource_upgrade
					has_global_flag = LSM_land_upgrade
				}
				has_completed_focus = SOV_the_left_opposition
				has_completed_focus = SOV_the_right_opposition
				has_completed_focus = SOV_beaten_but_not_defeated
			}
			has_global_flag = AI_is_balanced
		}

		complete_effect = {
			custom_effect_tooltip = "SOV is now eligible for buff"
			set_global_flag = let_SOV_reign 
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_new_border = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			any_owned_state = { 
				is_claimed_by = SOV
				NOT = { is_core_of = SOV }
			}
		}

		visible = {
			has_global_flag = POL_border_solved
			original_tag = SOV
			is_historical_focus_on = yes
		}

		complete_effect = {
			every_state = {
				limit = {
					is_claimed_by = SOV
					NOT = { is_owned_by = POL }
				}
				add_core_of = SOV
			}
			if = {
				limit = {
					LIT = { is_subject_of = SOV }
				}
				SOV = { annex_country = { target = LIT transfer_troops = yes } }
			}
			if = {
				limit = {
					LAT = { is_subject_of = SOV }
				}
				SOV = { annex_country = { target = LAT transfer_troops = yes } }
			}
			if = {
				limit = {
					EST = { is_subject_of = SOV }
				}
				SOV = { annex_country = { target = EST transfer_troops = yes } }
			}
			if = {
				limit = {
					FIN = { is_subject_of = SOV }
				}
				SOV = { annex_country = { target = FIN transfer_troops = yes } }
				every_state = { 
					limit = { 
						is_core_of = FIN 
						OR = {
							is_owned_by = FIN
							is_owned_by = SOV
						}
					}
					add_core_of = SOV
				}
			}
			every_state = {
				limit = {
					OR = {
						is_core_of = SOV
						is_claimed_by = SOV
					}
					NOT = { is_owned_by = POL }
					controller = { is_in_faction_with = SOV }
					NOT = { is_controlled_by = SOV }
				}
				SOV = { transfer_state = PREV }
			}
			if = { 
				limit = {
					763 = { 
						controller = { 
							is_in_faction_with = SOV 
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 763 }
				763 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					763 = { 
						is_controlled_by = SOV
					}
				}
				763 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					188 = { 
						controller = { 
							is_in_faction_with = SOV  
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 188 }
				188 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					188 = { 
						is_controlled_by = SOV
					}
				}
				188 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					73 = { 
						controller = { 
							is_in_faction_with = SOV  
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 73 }
				73 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					73 = { 
						is_controlled_by = SOV
					}
				}
				73 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					80 = { 
						controller = { 
							is_in_faction_with = SOV  
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 80 }
				80 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					80 = { 
						is_controlled_by = SOV
					}
				}
				80 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					766 = { 
						controller = { 
							is_in_faction_with = SOV  
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 766 }
				766 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					766 = { 
						is_controlled_by = SOV
					}
				}
				766 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					78 = { 
						controller = { 
							is_in_faction_with = SOV  
							NOT = { 
								tag = POL
								is_ai = no
							}
						}
						NOT = { is_controlled_by = SOV }
					}
				}
				SOV = { transfer_state = 73 }
				78 = { add_core_of = SOV }
			}
			if = { 
				limit = {
					78 = { 
						is_controlled_by = SOV
					}
				}
				78 = { add_core_of = SOV }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_baltic_friendship = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_in_faction_with = LIT
			is_in_faction_with = LAT
			is_in_faction_with = EST
			LIT = { has_war = no }
			LAT = { has_war = no }
			EST = { has_war = no }
		}

		visible = {
			OR = {
				focus_progress = {
					focus = SOV_baltic_security
					progress > 0
				}
				AND = {
					has_global_flag = SOV_no_purge_collaboration
					date > 1937.1.1
				}
			}
			is_historical_focus_on = yes
			tag = SOV
			is_ai = yes
		}

		complete_effect = {
			if = {
				limit = { 
					NOT = { has_global_flag = SOV_no_purge_collaboration }
				}
				complete_national_focus = SOV_respect_baltic_self_determination
			}
			if = {
				limit = {
					LIT = { is_ai = yes }
				}
				SOV = { 
					set_autonomy = {
						target = LIT
						autonomy_state = autonomy_integrated_puppet
					}
				}
			}
			if = {
				limit = {
					LAT = { is_ai = yes }
				}
				SOV = { 
					set_autonomy = {
						target = LAT
						autonomy_state = autonomy_integrated_puppet
					}
				}
			}
			if = {
				limit = {
					EST = { is_ai = yes }
				}
				SOV = { 
					set_autonomy = {
						target = EST
						autonomy_state = autonomy_integrated_puppet
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_baltic_friendship1b = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			any_country = {
				OR = { 
					tag = LIT
					tag = LAT
					tag = EST
				}
				has_government = communism
				OR = {
					is_in_faction_with = SOV
					is_subject_of = SOV
				}
			}
		}

		visible = {
			focus_progress = {
				focus = SOV_baltic_security
				progress > 0
			}
			tag = SOV
			is_ai = yes
		}

		complete_effect = {
			complete_national_focus = SOV_respect_baltic_self_determination
			if = {
				limit = {
					any_country = {
						OR = { 
							tag = LIT
							tag = LAT
							tag = EST
						}
						is_ai = no
						has_government = communism
						OR = {
							is_in_faction_with = SOV
							is_subject_of = SOV
						}
					}
				}
				random_country = {
					limit = {
						OR = { 
							tag = LIT
							tag = LAT
							tag = EST
						}
						is_ai = no
						has_government = communism
						OR = {
							is_in_faction_with = SOV
							is_subject_of = SOV
						}
					}
					complete_national_focus = BALTIC_united_baltic_ssr
				}
			}
			if = {
				limit = {
					any_country = {
						OR = { 
							tag = LIT
							tag = LAT
							tag = EST
						}
						has_government = communism
						OR = {
							is_in_faction_with = SOV
							is_subject_of = SOV
						}
					}
					NOT = {
						any_country = {
							OR = { 
								tag = LIT
								tag = LAT
								tag = EST
							}
							is_ai = no
							has_government = communism
							OR = {
								is_in_faction_with = SOV
								is_subject_of = SOV
							}
						}
					}
				}
				random_country = {
					limit = {
						OR = { 
							tag = LIT
							tag = LAT
							tag = EST
						}
						has_government = communism
						OR = {
							is_in_faction_with = SOV
							is_subject_of = SOV
						}
					}
					complete_national_focus = BALTIC_united_baltic_ssr
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_baltic_friendship2 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			always = yes
		}

		visible = {
			focus_progress = {
				focus = SOV_baltic_security
				progress > 0
			}
			any_state = {
				owner = {
					OR = {
						tag = SOV
						is_subject_of = SOV
					}
					is_ai = yes
				}
				controller = {
					OR = {
						tag = SOV
						is_subject_of = SOV
					}
					is_ai = yes
				}
				NOT = { is_core_of = SOV }
				OR = {
					is_core_of = LIT
					is_core_of = LAT
					is_core_of = EST
				}
			}
			any_country = {
				is_in_faction_with = SOV
				has_completed_focus = BALTIC_united_baltic_ssr
				any_state = {
					OR = {
						is_core_of = LIT
						is_core_of = LAT
						is_core_of = EST
					}
					NOT = { is_owned_by = PREV }
					owner = {
						OR = {
							tag = SOV
							is_subject_of = SOV
						}
					}
				}
			}
			tag = SOV
			is_ai = yes
		}

		complete_effect = {
			every_state = {
				limit = {
					owner = {
						OR = {
							tag = SOV
							is_subject_of = SOV
						}
						is_ai = yes
					}
					NOT = { is_core_of = SOV }
					OR = {
						is_core_of = LIT
						is_core_of = LAT
						is_core_of = EST
					}
				}
				random_country = {
					limit = {
						is_in_faction_with = SOV
						has_completed_focus = BALTIC_united_baltic_ssr
					}
					transfer_state = PREV
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_DEN_friendship = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction_with = DEN
		}

		visible = {
			is_historical_focus_on = yes
			DEN = { is_subject_of = ROOT }
			is_ai = yes
		}

		complete_effect = {
			ROOT = { 
				set_autonomy = {
					target = DEN
					autonomy_state = autonomy_free
				}
			}
			DEN = { clr_country_flag = DEN_has_occupation_flag }
			DEN = { #lmao - ws
				DEN_bop_low_increase_effect = yes #why
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes
				DEN_bop_low_increase_effect = yes #for the giggle lol - ws
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}
	LSM_prepare_for_barbarossa_GER = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = SOV }
		}

		visible = {
			GER = {
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_strike_at_the_source
						progress > 0
					}
				}
			}
			has_global_flag = enclave_enabled
			tag = GER
			is_ai = yes
			OR = {
				ROM = { is_in_faction_with = GER }
				HUN = { is_in_faction_with = GER }
			}
		}

		complete_effect = {
			complete_national_focus = GER_integrate_war_economies
			add_ideas = GER_prepare_for_barbarossa
			army_experience = 50
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_prepare_for_barbarossa_SOV = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = GER }
		}

		visible = {
			GER = {
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_strike_at_the_source
						progress > 0
					}
				}
			}
			OR = {
				has_global_flag = vanilla_history
				NOT = { country_exists = ENG }
				has_global_flag = enclave_enabled
			}
			has_global_flag = AI_is_balanced
			tag = SOV
			is_ai = yes
		}

		complete_effect = {
			add_ideas = SOV_prepare_for_barbarossa
			army_experience = 50
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_SOV_molotov_ribbentrop_is_important = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = GER }
		}

		visible = {
			has_idea = SOV_molotov_ribbentrop_pact
			tag = SOV
			is_ai = yes
			is_historical_focus_on = yes
			GER = { is_ai = no }
		}

		complete_effect = {
			if = {
				limit = {
					GER = { is_ai = no }
				}
				add_timed_idea = { idea = SOV_no_war_on_poland days = 180 } #give it some time before we justify
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_SOV_molotov_ribbentrop_is_important_2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			POL = { has_war_with = GER }
			POL = { is_ai = yes }
			NOT = { has_idea = SOV_no_war_on_poland }
			POL = { is_in_faction = yes }
			OR = {
				POL = { surrender_progress > 0.45 }
				has_global_flag = {
					flag = molotov_ribbentrop_fulfillment_demand
					days > 120
				}
			}
		}

		visible = {
			has_idea = SOV_molotov_ribbentrop_pact
			tag = SOV
			is_ai = yes
			is_historical_focus_on = yes
		}

		complete_effect = {
			create_wargoal = { 
				target = POL
				type = take_state
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_everyone_gets_ww2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			date > 1939.1.1
		}

		visible = {
			date > 1939.1.1
			is_ai = yes
			NOT = { has_global_flag = AI_is_balanced }
			has_war = no
			NOT = { original_tag = SOV }
		}

		complete_effect = {
			add_timed_idea = { idea = SOV_prepare_for_barbarossa days = 90 }
		}

		ai_will_do = {
			factor = 9999
		}
	}
	LSM_axis_prepare_for_WW2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			NOT = { 
				GER = { has_war_with = POL }
			}
		}

		visible = {
			GER = {
				OR = {
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					focus_progress = {
						focus = GER_break_the_anglo_french_colonial_hegemony
						progress > 0
					}
				}
			}
			is_historical_focus_on = yes
			is_in_faction_with = GER
			is_ai = yes
			has_global_flag = enclave_enabled
		}

		complete_effect = {
			add_timed_idea = { idea = GER_prepare_for_barbarossa days = 60 }
			if = {
				limit = {
					tag = GER 
				}
				add_political_power = 200
			}
			army_experience = 25
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_allies_prepare_for_WW2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = GER }
		}

		visible = {
			GER = {
				OR = {
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					focus_progress = {
						focus = GER_break_the_anglo_french_colonial_hegemony
						progress > 0
					}
				}
			}
			is_historical_focus_on = yes
			OR = {
				AND = { 
					is_in_faction_with = ENG
					NOT = { is_in_faction_with = GER }
				}
				AND = { 
					is_in_faction_with = FRA
					NOT = { is_in_faction_with = GER }
				}
				AND = { 
					OR = { 
						tag = POL
						tag = BEL
						tag = HOL
						tag = LUX
						tag = DEN
						tag = NOR
					}
					NOT = { is_in_faction_with = GER }
				}
			}
			has_global_flag = enclave_enabled
			is_ai = yes
		}

		complete_effect = {
			add_timed_idea = { idea = SOV_prepare_for_barbarossa days = 60 }
			army_experience = 25
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_SOV_fubar = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			tag = SOV
			any_country = {
				is_ai = no
				NOT = { has_government = democratic }
				is_major = yes
			}
			has_global_flag = AI_is_balanced
		}

		complete_effect = {
			add_ideas = SOV_terra_formar
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_kill_FIN = { #SOV AI as a side effect of a very strange, weird, bad coding from PDX, is very incompetent against FIN and I cannot fix it yet, so here it goes
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			FIN = { is_ai = yes }
			NOT = { 
				any_country = {
					NOT = { tag = FIN }
					NOT = { is_in_faction_with = FIN }
					is_major = yes
					has_war_with = SOV
				}
			}
		}

		visible = {
			has_global_flag = is_allowed
			date > 1940.2.1
			tag = SOV
			is_ai = yes
			has_war_with = FIN
		}

		complete_effect = {
			add_ideas = SOV_kill_FIN
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_FIN_SOV_friendship = { #SOV AI as a side effect of a very strange, weird, bad coding from PDX, is very incompetent against FIN and I cannot fix it yet, so here it goes
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			FIN = { is_subject_of = SOV }
			any_state = {
				is_core_of = FIN
				is_owned_by = SOV
			}
		}

		visible = {
			is_historical_focus_on = yes
			tag = SOV
			is_ai = yes
		}

		complete_effect = {
			every_state = {
				limit = {
					is_core_of = FIN
					is_owned_by = SOV
				}
				FIN = { transfer_state = PREV }
			}
			SOV = { 
				set_autonomy = {
					target = FIN
					autonomy_state = autonomy_puppet
				}
				hidden_effect = {
					army_experience = 50
					add_political_power = 100
				}
			}
			hidden_effect = {
				SOV = { 
					add_offsite_building = { type = industrial_complex level = 5 }
				}
				every_state = {
					limit = {
						is_core_of = FIN
						is_owned_by = FIN
						OR = {
							has_resources_amount = {
								resource = steel 
								amount > 0
							}
							has_resources_amount = {
								resource = oil 
								amount > 0
							}
							has_resources_amount = {
								resource = aluminium 
								amount > 0
							}
							has_resources_amount = {
								resource = tungsten 
								amount > 0
							}
							has_resources_amount = {
								resource = chromium 
								amount > 0
							}
							has_resources_amount = {
								resource = rubber 
								amount > 0
							}
						}	
					}
					FIN = { 
						give_resource_rights = { receiver = SOV state = PREV } 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_ROM_SOV_friendship = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			766 = {
				controller = {
					is_subject_of = SOV
				}
			}
			78 = {
				controller = {
					is_subject_of = SOV
				}
			}
			80 = {
				controller = {
					is_subject_of = SOV
				}
			}
		}

		visible = {
			is_historical_focus_on = yes
			tag = SOV
			766 = {
				controller = {
					is_subject_of = SOV
				}
			}
			78 = {
				controller = {
					is_subject_of = SOV
				}
			}
			80 = {
				controller = {
					is_subject_of = SOV
				}
			}
			has_government = communism
			is_ai = yes
		}

		complete_effect = {
			SOV = {
				transfer_state = 78
				transfer_state = 80
				transfer_state = 766
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_CZE_SOV_friendship = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			73 = {
				controller = {
					is_subject_of = SOV
				}
			}
			89 = {
				controller = {
					tag = SOV
				}
			}
		}

		visible = {
			is_historical_focus_on = yes
			tag = SOV
			73 = {
				controller = {
					is_subject_of = SOV
				}
			}
			has_government = communism
			is_ai = yes
			POL = { is_ai = yes }
		}

		complete_effect = {
			SOV = {
				transfer_state = 73
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_POL_GER_SOV_friendship_9 = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_historical_focus_on = yes
			all_state = {
				OR = {
					NOT = { is_core_of = POL }
					owner = { is_in_faction_with = SOV }
					owner = { tag = SOV }
					owner = { is_subject_of = SOV }
				}
			}
			tag = SOV
		}

		visible = {
			tag = SOV
			is_ai = yes
			is_historical_focus_on = yes
		}

		complete_effect = {
			set_global_flag = POL_poland_is_full
			every_state = {
				limit = {
					is_core_of = POL
					NOT = { is_claimed_by = SOV }
					OR = {
						POL = { has_completed_focus = POL_greater_polish_SSR }
						NOT = { is_core_of = SOV }
					}
				}
				POL = { transfer_state = PREV }
			}
			if = { 
				limit = { POL = { is_ai = yes } }
				SOV = { set_autonomy = { target = POL autonomy_state = autonomy_integrated_puppet } }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_POL_GER_SOV_friendship = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			any_country = {
				original_tag = GER
				is_subject_of = SOV
			}
			any_country = {
				original_tag = POL
				is_subject_of = SOV
			}
		}

		visible = {
			tag = SOV
			any_country = {
				original_tag = GER
				is_subject_of = SOV
			}
			any_country = {
				original_tag = POL
				is_subject_of = SOV
			}
			has_global_flag = POL_poland_is_full
			is_ai = yes
			is_historical_focus_on = yes
		}

		complete_effect = {
			set_global_flag = POL_border_solved
			if = {
				limit = {
					NOT = { POL = { has_completed_focus = POL_greater_polish_SSR } }
				}
				every_state = {
					limit = {
						OR = {
							is_claimed_by = SOV
							is_core_of = SOV
						}
						owner = { tag = POL }
					}
					SOV = { transfer_state = PREV }
				}
			}	
			if = {
				limit = { POL = { is_ai = yes } }
				SOV = {
					transfer_state = 763
				}
			}	
			if = {
				limit = { POL = { is_ai = no } }
				POL = {
					transfer_state = 763
				}
			}
			POL = {
				transfer_state = 5
				transfer_state = 63
				transfer_state = 68
				transfer_state = 66
				transfer_state = 67
				transfer_state = 85
				transfer_state = 807
				transfer_state = 86
				transfer_state = 98
				transfer_state = 87
				transfer_state = 762
				transfer_state = 88
				transfer_state = 92
				transfer_state = 10
			}
			POL = { 
				every_owned_state = { 
					add_core_of = POL
					remove_claim_by = SOV
					remove_core_of = SOV
				} 
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	JAP_refresh_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = JAP
			is_ai = yes
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			create_equipment_variant = { 
				name = "Kido-Ha"
				type = light_tank_chassis_1
				modules = {
					main_armament_slot = tank_heavy_machine_gun
					turret_type_slot = tank_light_three_man_tank_turret
					suspension_type_slot = tank_wheeled_suspension
					armor_type_slot = tank_riveted_armor
					engine_type_slot = tank_diesel_engine
					special_type_slot_1 = empty
					special_type_slot_2 = empty
					special_type_slot_3 = empty
					special_type_slot_4 = empty
				}
				upgrades = {
					tank_nsb_engine_upgrade = 0
					tank_nsb_armor_upgrade = 0
				}
			}
			capital_scope = {
				create_unit = {
					division = "name = \"Chuton-chi Shidan\" division_template = \"Chuton-chi Shidan\" start_experience_factor = 0.3"  
					owner = ROOT 
					count = 4
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	POL_refresh_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = POL
			has_war = yes
			is_ai = yes
			has_equipment = { anti_tank_equipment > 1000 }
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			hidden_effect = {
				set_global_flag = POL_first_swap
				division_template = { 
					name = "Infantry Template 10" 
					force_allow_recruiting = yes
					division_names_group = POL_INF_01
					priority = 1
					is_locked = no
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						anti_air = { x = 0 y = 1 }
						anti_tank = { x = 0 y = 2 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry 
						}
					}
					change_division_template = {
						division_template = "Infantry Template 10" 
					}
				}
			}
		}
		ai_will_do = {
			factor = 9999
		}
	}

	POL_refresh_div1 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = POL
			has_war = yes
			is_ai = yes
			has_tech = special_forces_mountaineers
			has_army_experience > 14
			has_global_flag = POL_first_swap
			has_equipment = { support_equipment > 600 }
			has_equipment = { anti_tank_equipment > 1200 }
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			hidden_effect = {
				division_template = { 
					name = "Infantry Template 11" 
					force_allow_recruiting = yes
					division_names_group = POL_INF_01
					priority = 1
					is_locked = no
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						anti_air = { x = 0 y = 1 }
						anti_tank = { x = 0 y = 2 }
						rangers_support = { x = 0 y = 3 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry 
						}
					}
					change_division_template = {
						division_template = "Infantry Template 11" 
					}
				}
			}
		}
		ai_will_do = {
			factor = 9999
		}
	}

	SOV_refresh_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			date > 1936.1.3
			has_army_experience > 14
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			hidden_effect = {
				division_template = { 
					name = "Strelkovaya Diviziya A" 
					force_allow_recruiting = yes
					division_names_group = SOV_INF_01
					priority = 1
					is_locked = no
					regiments = {
						infantry = { x = 0 y = 0 }
						infantry = { x = 0 y = 1 }
						infantry = { x = 0 y = 2 }
						infantry = { x = 0 y = 3 }
						infantry = { x = 0 y = 4 }
						infantry = { x = 1 y = 0 }
						infantry = { x = 1 y = 1 }
						infantry = { x = 1 y = 2 }
						infantry = { x = 1 y = 3 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						anti_air = { x = 0 y = 1 }
						engineer = { x = 0 y = 2 }
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = infantry 
							division_has_majority_template = cavalry  
							division_has_majority_template = motorized 
							division_has_majority_template = light_armor
						}
					}
					change_division_template = {
						division_template = "Strelkovaya Diviziya A" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_refresh_div2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = no
			date > 1939.1.1
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_global_flag = AI_is_balanced
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			delete_units = {
				division_template = "Strelkovaya Diviziya"
				disband = yes
			}
			delete_units = {
				division_template = "NKVD Pogranichnaya Diviziya"
				disband = yes
			}
			add_timed_idea = { idea = training_idea days = 180 }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	GER_refresh_div = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = GER
			is_ai = yes
			FRA = { has_capitulated = yes }
			has_global_flag = AI_is_balanced
			has_country_flag = spacemarine
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			delete_units = {
				division_template = "Infantry template 1"
				disband = yes
			}
			delete_units = {
				division_template = "Infantry template 1"
				disband = yes
			}
			delete_units = {
				division_template = "Panzer-Division"
				disband = yes
			}
			delete_units = {
				division_template = "Infanterie-Division"
				disband = yes
			}
			delete_units = {
				division_template = "Infantry template 7"
				disband = yes
			}
			delete_units = {
				division_template = "Alpenjäger Division"
				disband = yes
			}
			capital_scope = {
				create_unit = {
					division = "name = \"Spacemarine\" division_template = \"Spacemarine\" start_experience_factor = 0.1 start_equipment_factor = 0.02"  
					owner = ROOT 
					count = 60
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	GER_refresh_diva = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = GER
			is_ai = yes
			OR = {
				date > 1937.8.1
				has_tech = basic_medium_tank_chassis
			}
			OR = {
				NOT = { has_country_flag = mech_god }
				has_tech = mechanised_infantry
			}
			has_army_experience > 14
		}

		complete_effect = {
			custom_effect_tooltip = "Get rid of those guys please"
			delete_units = {
				division_template = "Panzer-Division"
				disband = yes
			}
			if = {
				limit = { 
					NOT = { has_country_flag = mech_god } 
					NOT = { has_country_flag = mass_mob_flag } 
					NOT = { has_country_flag = mobile_warfare_flag }
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Panzer-Division\" division_template = \"Medium Tank template 3\" start_experience_factor = 0.2 start_equipment_factor = 0.02"  
						owner = ROOT 
						count = 5
					}
				}
			}
			if = {
				limit = { 
					has_country_flag = mech_god  
					NOT = { has_country_flag = mass_mob_flag }
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Mechanized Infantry\" division_template = \"Mechanized Infantry\" start_experience_factor = 0.2 start_equipment_factor = 0.02"  
						owner = ROOT 
						count = 9
					}
				}
			}
			if = {
				limit = { 
					has_country_flag = mobile_warfare_flag  
					NOT = { has_country_flag = mass_mob_flag }
				}
				capital_scope = {
					create_unit = {
						division = "name = \"Panzer-Division\" division_template = \"Panzer template 1\" start_experience_factor = 0.2 start_equipment_factor = 0.02"  
						owner = ROOT 
						count = 2
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_patriotic_war_sabotage_pact = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			GER = { 
				exists = yes 
				is_subject = no
				has_war_with = USA
				has_war_with = ENG
			}
			NOT = { GER = { is_in_faction_with = SOV } }
			OR = {
				has_war = no
				AND = {
					has_war = yes
					NOT = { any_enemy_country = { is_major = yes } }
				}
			}
			SOV = { has_idea = GER_SOV_hitler_stalin_pact }
		}

		visible = {
			date > 1943.4.1 #well lets start it
			NOT = { GER = { is_in_faction_with = SOV } }
			SOV = { is_subject = no }
			SOV = { has_idea = GER_SOV_hitler_stalin_pact }
			tag = SOV
		}

		complete_effect = {
			modify_timed_idea = { idea = GER_SOV_hitler_stalin_pact days = -730 }
		}

		ai_will_do = {
			factor = 9999
		}
	}

	POL_emergency_war_measures = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = POL
			is_ai = yes
			has_war = yes
		}

		complete_effect = {
			set_victory_points = {
				province = 11479
				value = 10
			}
			set_victory_points = {
				province = 3320
				value = 10
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_military_attache_to_ww2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
			OR = {
				tag = USA
				is_in_faction = yes
			}
		}

		cost = 99

		days_remove = 7

		visible = {
			is_ai = yes
			OR = {
				AND = {
					NOT = { tag = GER }
					is_in_faction_with = GER
					GER = { is_faction_leader = yes }
					GER = { 
						any_enemy_country = { is_major = yes }
						has_war = yes 
						is_ai = yes
					}
				}
				AND = {
					NOT = { tag = ENG }
					is_in_faction_with = ENG
					ENG = { 
						any_enemy_country = { is_major = yes }
						has_war = yes  
						is_ai = yes
					}
				}
				AND = {
					NOT = { tag = SOV }
					is_in_faction_with = SOV
					SOV = { 
						any_enemy_country = { is_major = yes }
						has_war = yes  
						is_ai = yes
					}
				}
				AND = {
					tag = USA
					has_government = democratic
					has_war = no
					ENG = {  
						is_ai = yes
					}
				}
			}
		}

		remove_effect = {
			add_political_power = -1
			if = {
				limit = {
					is_in_faction_with = GER
					GER = { is_faction_leader = yes }
				}
				diplomatic_relation = {
					country = GER
					relation = send_attache
					active = yes
				}
				GER = {
					army_experience = 20
					air_experience = 10
					navy_experience = 10
				}
			}
			if = {
				limit = {
					is_in_faction_with = ENG
					ENG = { is_faction_leader = yes }
				}
				diplomatic_relation = {
					country = ENG
					relation = send_attache
					active = yes
				}
				ENG = {
					army_experience = 10
					air_experience = 15
					navy_experience = 15
				}
			}
			if = {
				limit = {
					is_in_faction_with = SOV
					SOV = { is_faction_leader = yes }
				}
				diplomatic_relation = {
					country = SOV
					relation = send_attache
					active = yes
				}
				SOV = {
					army_experience = 15
					air_experience = 15
					navy_experience = 10
				}
			}
			if = {
				limit = {
					tag = USA
					has_government = democratic
					has_war = no
				}
				diplomatic_relation = {
					country = ENG
					relation = send_attache
					active = yes
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_military_attache_to_china = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 99

		days_remove = 7

		visible = {
			is_ai = yes
			OR = {
				is_allied_ai = yes
				is_axis_ai = yes
			}
			any_country = {
				original_tag = CHI	
				NOT = { surrender_progress > 0.3 }
				has_war_with = JAP
			}
			NOT = { 
				OR = {
					original_tag = CHI
					original_tag = JAP
					AND = {
						is_literally_china = yes
						NOT = { is_in_faction_with = CHI }
					}
				}
			}
		}

		remove_effect = {
			add_political_power = -1
			if = {
				limit = {
					OR = { 
						has_government = democratic
						has_government = communism
						has_government = neutrality
					}
				}
				CHI = { country_event = LSM_equipment.10 }
			}
			if = {
				limit = {
					OR = { 
						has_government = fascism
					}
				}
				JAP = { country_event = LSM_equipment.10 }
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				tag = FRA
				has_idea = FRA_disjointed_government
			}
			modifier = {
				factor = 0
				has_war = yes
			}
			modifier = {
				factor = 0
				tag = GER #just dont bother
			}
			modifier = {
				factor = 9999
				OR = {
					is_major = yes
					is_ai_mass_mob = yes
					tag = FIN
				}
			}
		}
	}

	LSM_military_attache_to_spain = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 99

		days_remove = 7

		visible = {
			is_historical_focus_on = yes
			OR = {
				tag = ENG
				tag = SOV
			}
			is_ai = yes
			any_country = {
				original_tag = SPR
				has_civil_war = yes
			}
		}

		remove_effect = {
			add_political_power = -1
			every_other_country = {
				limit = {
					original_tag = SPR
					has_civil_war = yes
					OR = {
						has_government = democratic
						has_government = communism
					}
				}
				ROOT = {
					diplomatic_relation = {
						country = PREV
						relation = send_attache
						active = yes
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_military_attache_to_spain2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 99

		days_remove = 7

		visible = {
			is_historical_focus_on = yes
			OR = {
				tag = GER
				tag = ITA
			}
			is_ai = yes
			any_country = {
				original_tag = SPR
				has_civil_war = yes
			}
		}

		remove_effect = {
			add_political_power = -1
			every_other_country = {
				limit = {
					original_tag = SPR
					has_civil_war = yes
					OR = {
						AND = {
							has_government = neutrality
							fascism > 0.30
						}
						has_government = fascism
					}
				}
				ROOT = {
					diplomatic_relation = {
						country = PREV
						relation = send_attache
						active = yes
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_free_trade_1936 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 75

		days_remove = 7

		visible = {
			tag = GER
			is_ai = yes
			date > 1936.3.1
			is_historical_focus_on = yes
		}

		remove_effect = {
			add_political_power = -76
			add_ideas = free_trade
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_back_up_check_date = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 50

		days_remove = 7

		visible = {
			tag = GER
			is_ai = yes
			date > 1939.5.1
			NOT = { has_idea = limited_exports }
			is_historical_focus_on = yes
		}

		remove_effect = {
			add_ideas = limited_exports
			hidden_effect = {
				add_command_power = 25
				add_political_power = 25
			}
 		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_bypass_a_hidden_vanilla_ai_check = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 150

		days_remove = 7

		visible = {
			NOT = { has_idea = HUN_treaty_of_triannon }
			NOT = { has_idea = HUN_treaty_of_triannon_aat }
			NOT = { has_idea = HUN_treaty_of_triannon_2 }
			NOT = { has_idea = HUN_treaty_of_triannon_3 }
			OR = {
				NOT = { tag = SOV }
				NOT = { has_dlc = "Battle for the Bosporus" }
				NOT = { has_dlc = "Man the Guns" }
			}
			NOT = { tag = JAP }
			OR = {
				has_war = yes
				NOT = { tag = SPR }
			}
			date > 1936.9.1
			is_ai = yes
			has_war_support > 0.25
			OR = {
				has_idea = civilian_economy
				has_idea = low_economic_mobilisation
			}
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = { 
						has_war_support > 0.5 
						OR = {
							has_government = communism
							has_government = fascism
						}
					}
					add_ideas = war_economy
				}
				else_if = {
					limit = { 
						NOT = { 
							AND = {
								has_war_support > 0.5 
								OR = {
									has_government = communism
									has_government = fascism
								}
							}
						}
					}
					add_ideas = partial_economic_mobilisation
				}
			}
		}

		ai_will_do = {
			factor = 500
			modifier = {
				factor = 0
				num_of_civilian_factories < 20
				date < 1937.1.1
			}
			modifier = {
				factor = 500
				tag = GER
				has_war_support > 0.5
			}
			modifier = {
				factor = 20 
				OR = {
					has_government = communism
					has_government = fascism
				}
				has_war_support > 0.5
			}
		}
	}

	AI_send_infantry_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			if = {
				limit = {
					GER = { has_tech = advanced_infantry_weapons }
					GER = { is_ai = no }
				}
				has_tech = advanced_infantry_weapons
			}
			if = {
				limit = {
					GER = { has_tech = improved_infantry_weapons }
					GER = { is_ai = no }
				}
				has_tech = improved_infantry_weapons
			}
			is_ai = yes
			NOT = { original_tag = GER }
			NOT = { GER = { has_country_flag = LSM_eligbility_nation } }
			has_equipment = { infantry_equipment > 10000 }
			OR = {
				is_major = no
				has_equipment = { infantry_equipment > 20000 }
			}
			GER = { has_equipment = { infantry_equipment < 100000 } }
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -10000
			}
			GER = {
				country_event = { id = LSM_equipment.1 }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 10000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_infantry_equipment_to_soviets = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = SOV
				is_subject_of = SOV
			}
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			OR = {
				AND = {
					SOV = {
						is_ai = yes
					}
					GER = { is_ai = no }
				}
				SOV = {
					is_ai = yes
					surrender_progress > 0.15
				}
				SOV = {
					is_ai = no
					surrender_progress > 0.25
				}
			}
			OR = {
				is_in_faction_with = SOV
				is_subject_of = SOV
			}
			is_ai = yes
			NOT = { original_tag = SOV }
			SOV = { has_war = yes }
			has_equipment = { infantry_equipment > 10000 }
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -10000
			}
			if = {
				limit = {
					has_tech = advanced_infantry_weapons
				}
				SOV = {
					country_event = { id = LSM_equipment.1 }
					add_equipment_to_stockpile = {
						type = infantry_equipment_3
						amount = 10000
						producer = ROOT
					}
				}
			}
			else_if = {
				limit = {
					NOT = { has_tech = advanced_infantry_weapons }
					has_tech = improved_infantry_weapons
				}
				SOV = {
					country_event = { id = LSM_equipment.1 }
					add_equipment_to_stockpile = {
						type = infantry_equipment_2
						amount = 10000
						producer = ROOT
					}
				}
			}
			else_if = {
				limit = {
					NOT = { has_tech = advanced_infantry_weapons }
					NOT = { has_tech = improved_infantry_weapons }
				}
				SOV = {
					country_event = { id = LSM_equipment.1 }
					add_equipment_to_stockpile = {
						type = infantry_equipment_1
						amount = 10000
						producer = ROOT
					}
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_infantry_equipment_to_china = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = CHI
				is_subject_of = CHI
			}
		}

		cost = 0

		days_re_enable = 7 #fake lendlease

		visible = {
			JAP = { is_ai = no }
			OR = {
				is_in_faction_with = CHI
				is_subject_of = CHI
			}
			is_ai = yes
			NOT = { original_tag = CHI }
			has_equipment = { infantry_equipment > 1000 }
			CHI = { has_equipment = { infantry_equipment < 30000 } }
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -500
			}
			CHI = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 500
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_artillery_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			if = {
				limit = {
					GER = { has_tech = artillery4 }
					GER = { is_ai = no }
				}
				has_tech = artillery4
			}
			is_ai = yes
			has_equipment = { artillery_equipment > 2000 }
			NOT = { original_tag = GER }
			OR = {
				is_major = no
				has_equipment = { artillery_equipment > 4000 }
			}
			GER = { has_equipment = { artillery_equipment < 10000 } }
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = artillery_equipment
				amount = -2000
			}
			GER = {
				country_event = { id = LSM_equipment.2 }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = 2000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_support_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 30 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			is_ai = yes
			NOT = { original_tag = GER }
			has_equipment = { support_equipment > 2000 }
			GER = { has_equipment = { support_equipment < 10000 } }
			OR = {
				is_major = no
				has_equipment = { support_equipment > 4000 }
			}
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = support_equipment
				amount = -2000
			}
			GER = {
				country_event = { id = LSM_equipment.3 }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = 2000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_anti_tank_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 30 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			if = {
				limit = {
					GER = { has_tech = antitank5 }
					GER = { is_ai = no }
				}
				has_tech = antitank5
			}
			if = {
				limit = {
					GER = { has_tech = antitank2 }
					GER = { is_ai = no }
				}
				has_tech = antitank2
			}
			is_ai = yes
			has_equipment = { anti_tank_equipment > 2000 }
			NOT = { original_tag = GER }
			GER = { has_equipment = { anti_tank_equipment < 10000 } }
			OR = {
				is_major = no
				has_equipment = { anti_tank_equipment > 4000 }
			}
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = anti_tank_equipment
				amount = -2000
			}
			GER = {
				country_event = { id = LSM_equipment.4 }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = 2000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_anti_air_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 30 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			if = {
				limit = {
					GER = { has_tech = antiair5 }
					GER = { is_ai = no }
				}
				has_tech = antiair5
			}
			if = {
				limit = {
					GER = { has_tech = antiair2 }
					GER = { is_ai = no }
				}
				has_tech = antiair2
			}
			is_ai = yes
			has_equipment = { anti_air_equipment > 2000 }
			NOT = { original_tag = GER }
			OR = {
				is_major = no
				has_equipment = { anti_air_equipment > 4000 }
			}
			GER = { has_equipment = { anti_air_equipment < 10000 } }
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = anti_air_equipment
				amount = -2000
			}
			GER = {
				country_event = { id = LSM_equipment.5 }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = 2000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_motorized_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 30 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			is_ai = yes
			has_equipment = { motorized_equipment > 1000 }
			NOT = { original_tag = GER }
			OR = {
				is_major = no
				has_equipment = { motorized_equipment > 2000 }
			}
			GER = { has_equipment = { motorized_equipment < 10000 } }
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = motorized_equipment
				amount = -1000
			}
			GER = {
				country_event = { id = LSM_equipment.6 }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = 1000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_mechanized_equipment_to_germany = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			NOT = { has_global_flag = disabled_equipment_funnelling }
			OR = {
				is_in_faction_with = GER
				is_subject_of = GER
				AND = {
					tag = SPR
					is_historical_focus_on = yes
					GER = { has_war_with = SOV }
				}
			}
			is_ai = yes
			has_equipment = { mechanized_equipment > 1000 }
			NOT = { original_tag = GER }
			OR = {
				is_major = no
				has_equipment = { mechanized_equipment > 1000 }
			}
			GER = { is_ai = yes }
			GER = { 
				OR = {
					focus_progress = {
						focus = GER_ussr_war_goal
						progress > 0
					}
					focus_progress = {
						focus = GER_danzig_or_war
						progress > 0
					}
					has_completed_focus = GER_ussr_war_goal
					has_completed_focus = GER_danzig_or_war
					has_war = yes
				}
			}
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = mechanized_equipment
				amount = -1000
			}
			GER = {
				country_event = { id = LSM_equipment.7 }
				add_equipment_to_stockpile = {
					type = mechanized_equipment
					amount = 1000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_send_mechanized_equipment_to_united_states = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				is_in_faction_with = USA
				is_subject_of = USA
			}
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			OR = {
				is_in_faction_with = USA
				is_subject_of = USA
			}
			is_ai = yes
			has_equipment = { mechanized_equipment > 2000 }
			NOT = { original_tag = USA }
			USA = { has_equipment = { mechanized_equipment < 15000 } }
		}

		complete_effect = {
			add_equipment_to_stockpile = {
				type = mechanized_equipment
				amount = -1000
			}
			USA = {
				country_event = { id = LSM_equipment.7 }
				add_equipment_to_stockpile = {
					type = mechanized_equipment
					amount = 1000
					producer = ROOT
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_USA_send_equipment_to_ussr = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = SOV }
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			tag = USA
			has_government = democratic
			GER_is_not_relevant = no #our support ends here
			NOT = { GER = { has_government = democratic } }
			NOT = { has_war_with = SOV }
			OR = {
				SOV = { has_war_with = GER }
				SOV = { has_idea = SOV_prepare_for_barbarossa }
				GER = { 
					OR = {
						focus_progress = {
							focus = GER_ussr_war_goal
							progress > 0
						}
						focus_progress = {
							focus = GER_strike_at_the_source
							progress > 0
						}
						has_completed_focus = GER_ussr_war_goal
						has_completed_focus = GER_strike_at_the_source
					}
					has_added_tension_amount > 0.3
				}
			}
			ENG = { has_war_with = GER }
			NOT = { has_idea = d_day_preparation_1 } #we have our own business to deal with now
			NOT = { has_idea = d_day_preparation_2 } #we have our own business to deal with now
			is_ai = yes
			OR = {
				has_equipment = { infantry_equipment > 60000 }
				has_equipment = { artillery_equipment > 8000 }
				has_equipment = { anti_air_equipment > 8000 }
				has_equipment = { anti_tank_equipment > 8000 }
				has_equipment = { support_equipment > 15000 }
				has_equipment = { motorized_equipment > 5000 }
			}
		}

		complete_effect = {
			SOV = {
				country_event = { id = LSM_equipment.8 }
			}
			if = {
				limit = { has_equipment = { infantry_equipment > 60000 } }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -10000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 10000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { artillery_equipment > 8000 } }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = -1000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 1000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_air_equipment > 8000 } }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = -1000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 1000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_tank_equipment > 8000 } }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = -1000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = anti_tank_equipment
						amount = 1000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { support_equipment > 15000 } }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = -1000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 1000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { motorized_equipment > 5000 } }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = -1000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 1000
						producer = ROOT
					}
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_USA_special_gift = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = SOV }
		}

		cost = 0

		days_re_enable = 60 #fake lendlease

		visible = {
			tag = USA
			is_ai = yes
			has_government = democratic
			has_war_with = GER
			NOT = { GER = { has_government = democratic } }
			NOT = { has_war_with = SOV }
			SOV = { has_war_with = GER }
			SOV = { has_equipment = { infantry_equipment < 5000 } }
			NOT = { has_global_flag = SOV_declined_US_support }
			OR = {
				SOV = { is_ai = no }
				SOV = { surrender_progress > 0.35 }
			}
		}

		complete_effect = {
			SOV = {
				country_event = { id = LSM_equipment.23 }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_allies_send_equipment_to_uk = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = ENG }
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			is_in_faction_with = ENG
			is_major = no
			ENG = { has_war = yes }
			is_ai = yes
			OR = {
				AND = {
					has_equipment = { infantry_equipment > 20000 }
					ENG = { has_equipment = { infantry_equipment < 40000 } }
				}
				AND = {
					has_equipment = { artillery_equipment > 2000 }
					ENG = { has_equipment = { artillery_equipment < 4000 } }
				}
				AND = {
					has_equipment = { anti_air_equipment > 2000 }
					ENG = { has_equipment = { anti_air_equipment < 4000 } }
				}
				AND = {
					has_equipment = { anti_tank_equipment > 2000 }
					ENG = { has_equipment = { anti_tank_equipment < 4000 } }
				}
				AND = {
					has_equipment = { support_equipment > 2000 }
					ENG = { has_equipment = { support_equipment < 4000 } }
				}
				AND = {
					has_equipment = { motorized_equipment > 2000 }
					ENG = { has_equipment = { motorized_equipment < 4000 } }
				}
			}
		}

		complete_effect = {
			ENG = {
				country_event = { id = LSM_equipment.8 }
			}
			if = {
				limit = { has_equipment = { infantry_equipment > 20000 } }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -5000
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 5000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { artillery_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_air_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_tank_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = anti_tank_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { support_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { motorized_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 500
						producer = ROOT
					}
				}
			}	
		}

		ai_will_do = {
			factor = 1000
		}
	}

	AI_allies_send_equipment_to_us = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = USA }
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			is_in_faction_with = USA
			is_major = no
			USA = { has_war = yes }
			is_ai = yes
			OR = {
				AND = {
					has_equipment = { infantry_equipment > 20000 }
					USA = { has_equipment = { infantry_equipment < 40000 } }
				}
				AND = {
					has_equipment = { artillery_equipment > 2000 }
					USA = { has_equipment = { artillery_equipment < 4000 } }
				}
				AND = {
					has_equipment = { anti_air_equipment > 2000 }
					USA = { has_equipment = { anti_air_equipment < 4000 } }
				}
				AND = {
					has_equipment = { anti_tank_equipment > 2000 }
					USA = { has_equipment = { anti_tank_equipment < 4000 } }
				}
				AND = {
					has_equipment = { support_equipment > 2000 }
					USA = { has_equipment = { support_equipment < 4000 } }
				}
				AND = {
					has_equipment = { motorized_equipment > 2000 }
					USA = { has_equipment = { motorized_equipment < 4000 } }
				}
			}
		}

		complete_effect = {
			USA = {
				country_event = { id = LSM_equipment.8 }
			}
			if = {
				limit = { has_equipment = { infantry_equipment > 20000 } }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -5000
				}
				USA = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 5000
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { artillery_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = -500
				}
				USA = {
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_air_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = -500
				}
				USA = {
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_tank_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = -500
				}
				USA = {
					add_equipment_to_stockpile = {
						type = anti_tank_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { support_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = -500
				}
				USA = {
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { motorized_equipment > 2000 } }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = -500
				}
				USA = {
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 500
						producer = ROOT
					}
				}
			}	
		}

		ai_will_do = {
			factor = 2000
		}
	}

	AI_allies_send_equipment_to_uk_prewar = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = ENG }
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			is_in_faction_with = ENG
			is_major = no
			has_war = no
			has_manpower < 50000 #if you can do more troops, do more first
			is_ai = yes
			OR = {
				AND = {
					has_equipment = { infantry_equipment > 1000 }
					ENG = { has_equipment = { infantry_equipment < 50000 } }
				}
				AND = {
					has_equipment = { artillery_equipment > 200 }
					ENG = { has_equipment = { artillery_equipment < 5000 } }
				}
				AND = {
					has_equipment = { anti_air_equipment > 200 }
					ENG = { has_equipment = { anti_air_equipment < 5000 } }
				}
				AND = {
					has_equipment = { anti_tank_equipment > 200 }
					ENG = { has_equipment = { anti_tank_equipment < 5000 } }
				}
				AND = {
					has_equipment = { support_equipment > 200 }
					ENG = { has_equipment = { support_equipment < 5000 } }
				}
				AND = {
					has_equipment = { motorized_equipment > 200 }
					ENG = { has_equipment = { motorized_equipment < 5000 } }
				}
			}
		}

		complete_effect = {
			ENG = {
				country_event = { id = LSM_equipment.8 }
			}
			if = {
				limit = { has_equipment = { infantry_equipment > 1000 } }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -500
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 500
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { artillery_equipment > 200 } }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = -100
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 100
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_air_equipment > 200 } }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = -100
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 100
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_tank_equipment > 200 } }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = -100
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = anti_tank_equipment
						amount = 100
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { support_equipment > 200 } }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = -100
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 100
						producer = ROOT
					}
				}
			}
			if = {
				limit = { has_equipment = { motorized_equipment > 200 } }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = -100
				}
				ENG = {
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 100
						producer = ROOT
					}
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}


	AI_allies_send_equipment_to_ussr = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			NOT = { has_war_with = SOV }
		}

		cost = 0

		days_re_enable = 14 #fake lendlease

		visible = {
			NOT = { tag = USA }
			OR = {
				AND = {
					GER = { is_ai = no }
					tag = SWE
				}
				has_war_with = GER
			}
			OR = {
				AND = {
					SOV = {
						is_ai = yes
						OR = {
							surrender_progress > 0.15
							has_equipment = { infantry_equipment < 20000 }
						}
					}
					GER = { is_ai = no }
				}
				SOV = {
					is_ai = yes
					surrender_progress > 0.3
				}
				SOV = {
					is_ai = no
					surrender_progress > 0.35
				}
			}	
			GER_is_not_relevant = no #our support ends here
			is_major = no
			NOT = { GER = { has_government = democratic } }
			NOT = { has_war_with = SOV }
			SOV = { has_war_with = GER }
			ENG = { has_war_with = GER }
			NOT = { has_idea = d_day_preparation_2 } #we have our own business to deal with now
			is_ai = yes
			OR = {
				has_equipment = { infantry_equipment > 30000 }
				has_equipment = { artillery_equipment > 3000 }
				has_equipment = { anti_air_equipment > 3000 }
				has_equipment = { anti_tank_equipment > 3000 }
				has_equipment = { support_equipment > 3000 }
				has_equipment = { motorized_equipment > 2000 }
			}
		}

		complete_effect = {
			SOV = {
				country_event = { id = LSM_equipment.8 }
			}
			if = {
				limit = { has_equipment = { infantry_equipment > 30000 } }
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = -5000
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = infantry_equipment
						amount = 5000
					}
				}
			}
			if = {
				limit = { has_equipment = { artillery_equipment > 3000 } }
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = -500
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = artillery_equipment
						amount = 500
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_air_equipment > 3000 } }
				add_equipment_to_stockpile = {
					type = anti_air_equipment
					amount = -500
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = anti_air_equipment
						amount = 500
					}
				}
			}
			if = {
				limit = { has_equipment = { anti_tank_equipment > 3000 } }
				add_equipment_to_stockpile = {
					type = anti_tank_equipment
					amount = -500
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = anti_tank_equipment
						amount = 500
					}
				}
			}
			if = {
				limit = { has_equipment = { support_equipment > 3000 } }
				add_equipment_to_stockpile = {
					type = support_equipment
					amount = -500
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = support_equipment
						amount = 500
					}
				}
			}
			if = {
				limit = { has_equipment = { motorized_equipment > 1000 } }
				add_equipment_to_stockpile = {
					type = motorized_equipment
					amount = -400
				}
				SOV = {
					add_equipment_to_stockpile = {
						type = motorized_equipment
						amount = 400
					}
				}
			}	
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_vichy_free_trade = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 0

		visible = {
			original_tag = FRA
			is_ai = yes
			has_government = fascism
			has_focus_tree = vichy_french_focus
			has_war = no
			NOT = { has_idea = free_trade }
		}

		complete_effect = {
			add_ideas = free_trade
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_GER_bypass_hidden_vanilla_check = { #bypass a hidden vanilla check from devs that I cannot find where it is
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 150

		days_remove = 7

		visible = {
			tag = GER
			is_ai = yes
			has_war_support > 0.50
			NOT = { has_idea = war_economy }
			NOT = { has_idea = tot_economic_mobilisation }
			OR = {
				AND = {
					has_government = fascism
					date > 1938.1.1
				}
				has_war = yes
				is_historical_focus_on = no
			}
		}

		complete_effect = {
			hidden_effect = {
				add_ideas = war_economy
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_SOV_bypass_a_specific_check = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		cost = 149

		days_remove = 7

		visible = {
			tag = SOV
			is_ai = yes
			has_war_support > 0.50
			NOT = { has_idea = war_economy }
			OR = {
				has_government = fascism
				has_government = communism
				has_war = yes
			}
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = { 
						has_idea = partial_economic_mobilisation
					}
					add_political_power = 150
				}
				add_ideas = war_economy
			}
		}

		remove_effect = {
			add_political_power = -1
		}

		ai_will_do = {
			factor = 9999
		}
	}

	ENG_churchill_plan = { #TODO

		icon = generic_ignite_civil_war

		available = {
			hidden_trigger = { always = no }
		}

		days_mission_timeout = 7

		fire_only_once = yes

		activation = {
			has_global_flag = ENG_churchill_flee
			NOT = { has_global_flag = ENG_assassination_plot }
		}

		visible = {
			has_global_flag = ENG_churchill_flee
			NOT = { has_global_flag = ENG_assassination_plot }
			has_war_with = ENG
			126 = { is_controlled_by = ROOT }
		}

		cancel_if_not_visible = yes

		is_good = no

		cancel_effect = {
			set_global_flag = ENG_assassination_plot
		}

		timeout_effect = {
			set_global_flag = ENG_assassination_plot
		}
	}

	lsm_remove_militia = {
	
		icon = generic_consumer_goods

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			OR = {
				NOT = { surrender_progress > 0 }
				AND = {
					OR = {
						tag = FRA
						tag = ENG
					}
					surrender_progress < 0.2
					has_country_flag = {
						flag = london_uprising
						days > 365
					}
				}
			}	
		}

		days_re_enable = 365

		visible = {
			has_global_flag = enclave_enabled
			OR = {
				any_owned_state = { has_dynamic_modifier = { modifier = LSM_recency_modifier } }
				any_owned_state = { has_dynamic_modifier = { modifier = LSM_island_recency_modifier } }
				any_owned_state = { has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } }
				AND = {
					any_country_division = {
						division_has_majority_template = militia
					}
					NOT = { tag = SWI }
					NOT = { tag = ETH }
					NOT = { tag = ITA }
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = "Will remove militias and their corresponding modifier"
			hidden_effect = { 
				if = { 
					limit = { 
						has_country_flag = template_given_lsm
					}
					clr_country_flag = template_given_lsm
				}
				if = { 
					limit = { 
						has_country_flag = wheelchair_template_given_lsm
					}
					clr_country_flag = wheelchair_template_given_lsm
				}
				if = { 
					limit = { 
						has_country_flag = partisan_template_given_lsm
					}
					clr_country_flag = partisan_template_given_lsm
				}
				every_owned_state = {
					remove_dynamic_modifier = { modifier = LSM_recency_modifier }
					remove_dynamic_modifier = { modifier = LSM_island_recency_modifier }
					remove_dynamic_modifier = { modifier = LSM_enclave_recency_modifier }
				}
				delete_units = {
					division_template = "Militia Cope Division"
					disband = yes
				}
				delete_units = {
					division_template = "Wheelchair Division"
					disband = yes
				}
				delete_units = {
					division_template = "Partisan Volunteer"
					disband = yes
				}
				if = { 
					limit = {
						has_tech = JAP_for_the_emperor_tech
					}
					set_technology = { JAP_for_the_emperor_tech = 0 }
				}
			}
		}

		ai_will_do = {
			factor = 0
			modifier = {
				NOT = { 
					any_owned_state = {
						is_core_of = ROOT
						is_in_home_area = yes
						OR = {
							any_neighbor_state = {
								controller = { has_war_with = ROOT }
							}
							NOT = { is_fully_controlled_by = ROOT }
						}
					}
				}
				add = 200
			}
		}
	}

	britain_surrender = {
	
		icon = generic_political_rally

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			surrender_progress > 0.7
			original_tag = ENG	
		}

		visible = {
			NOT = { has_global_flag = vanilla_history }
			NOT = { has_global_flag = no_more_churchill }
			NOT = { is_in_faction_with = USA }
			surrender_progress > 0.4
			original_tag = ENG
			has_government = democratic
			OR = {
				has_war_support > 0.5
				is_historical_focus_on = yes
			}
			NOT = {
				any_country = {
					has_war_with = ENG
					has_government = democratic
					controls_state = 126
					is_faction_leader = yes
				}
			}
			NOT = { 
				any_country = {
					has_war_with = ENG
					has_government = democratic
					any_war_score > 49
					is_faction_leader = yes
				}
			}
		}

		complete_effect = {
			country_event = { id = LSM_ENG_churchill.1 days = 1 }
		}

		ai_will_do = {
			factor = 10000
		}
	}

	SOV_ai_get_manpower_please = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		cost = 100

		visible = {
			tag = SOV
			is_ai = yes
			date > 1939.1.1
			NOT = { has_idea = limited_conscription }
			NOT = { has_idea = extensive_conscription }
			NOT = { has_idea = service_by_requirement }
			NOT = { has_idea = all_adults_serve }
			NOT = { has_idea = scraping_the_barrel }
		}

		complete_effect = {
			custom_effect_tooltip = "so they get any manpower in 1936 start"
			hidden_effect = {
				add_ideas = limited_conscription
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_ai_get_manpower_please_2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		cost = 120 #20% cost reduction by now

		visible = {
			tag = SOV
			is_ai = yes
			date > 1940.4.1
			NOT = { has_idea = extensive_conscription }
			NOT = { has_idea = service_by_requirement }
			NOT = { has_idea = all_adults_serve }
			NOT = { has_idea = scraping_the_barrel }
		}

		complete_effect = {
			custom_effect_tooltip = "so they get any manpower in 1936 start"
			hidden_effect = {
				add_ideas = extensive_conscription
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	major_ai_marine_template = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		visible = {
			is_ai = yes
			has_war = yes
			OR = {
				tag = ENG
				tag = USA
			}
		}

		complete_effect = {
			custom_effect_tooltip = "marine preparation"
			hidden_effect = {
				navy_experience = -120 #pay the XP #they might actually research the tech already but let them pay anyway
				if = {
					limit = {
						NOT = { has_tech = special_forces_marines }
					}
					set_technology = { special_forces_marines = 1 }
				}
				if = {
					limit = {
						NOT = { has_tech = marines_shore_parties }
					}
					set_technology = { marines_shore_parties = 1 }
				}
				if = { 
					limit = { 
						tag = ENG 
					}
					division_template = {
						name = "Marines"			# Rifle Division
						division_names_group = ENG_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 0 y = 4 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 1 y = 4 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							marine = { x = 2 y = 3 }
							marine = { x = 2 y = 4 }
						}
						support = { 		
							pioneer_support = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 } 		
							signal_company = { x = 0 y = 3 }
							anti_tank = { x = 0 y = 4 }
						}
					}
				}
				if = { 
					limit = { 
						tag = USA 
					}
					division_template = {
						name = "Marine template 1"			# Rifle Division
						division_names_group = USA_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							marine = { x = 2 y = 3 }
							marine = { x = 3 y = 0 }
							marine = { x = 3 y = 1 }
							marine = { x = 3 y = 2 }
							marine = { x = 3 y = 3 }
							marine = { x = 4 y = 0 }
							marine = { x = 4 y = 1 }
						}
						support = { 		
							pioneer_support = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 } 		
							anti_tank = { x = 0 y = 3 }
							medium_flame_tank = { x = 0 y = 4 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_purge_stuffs = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			always = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			date > 1938.1.1 #only if they live for this long
		}

		complete_effect = {
			custom_effect_tooltip = "Purge"
			hidden_effect = {
				SOV_nikolay_voznesensky = {
					set_character_flag = SOV_safe_from_purge_flag
				}
				SOV_mikhail_kalinin = {
					set_character_flag = SOV_safe_from_purge_flag
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	allied_ai_marine_template2 = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_war = yes
		}

		visible = {
			is_ai = yes
			OR = {
				tag = CAN
				tag = CHL
				tag = URG
				tag = ENG
				tag = USA
			}
			has_tech = amphibious_mechanized_infantry
			OR = {
				AND = {
					NOT = { tag = USA }
					NOT = { tag = ENG }
				}
				has_tech = basic_medium_tank_chassis
			}
			has_army_experience > 14
		}

		complete_effect = {
			custom_effect_tooltip = "marine preparation"
			hidden_effect = {
				navy_experience = -120
				add_war_support = 0.02
				if = {
					limit = { 
						NOT = { has_tech = special_forces_marines }
					}
					set_technology = { special_forces_marines = 1 }
				}
				if = {
					limit = { 
						NOT = { has_tech = special_forces_mountaineers }
					}
					set_technology = { special_forces_mountaineers = 1 }
				}
				if = {
					limit = { 
						NOT = { has_tech = marines_shore_parties }
					}
					set_technology = { marines_shore_parties = 1 }
				}
				if = { 
					limit = { 
						OR = {
							tag = ARG 
							tag = URG 
							tag = CHL 
							tag = CAN
						} 
					}
					division_template = {
						name = "Marines template 2"			# Rifle Division
						division_names_group = USA_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 0 y = 4 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 1 y = 4 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							marine = { x = 2 y = 3 }
							marine = { x = 2 y = 4 }
							amphibious_mechanized = { x = 3 y = 0 }
							amphibious_mechanized = { x = 3 y = 1 }
							mot_anti_tank_brigade = { x = 4 y = 0 }
						}
						support = { 		
							pioneer_support = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							signal_company = { x = 0 y = 2 }
							anti_air = { x = 0 y = 3 }
						}
					}
				}
				if = { 
					limit = { 
						OR = {
							tag = ENG 
							tag = USA
						} 
					}
					division_template = {
						name = "Marines template 2"			# Rifle Division
						division_names_group = USA_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 0 y = 4 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 1 y = 4 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							marine = { x = 2 y = 3 }
							marine = { x = 2 y = 4 }
							amphibious_mechanized = { x = 3 y = 0 }
							amphibious_mechanized = { x = 3 y = 1 }
							mot_anti_tank_brigade = { x = 4 y = 0 }
						}
						support = { 		
							pioneer_support = { x = 0 y = 0 } 
							anti_air = { x = 0 y = 1 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	allied_ai_marine_template3 = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = amphibious_drive
			has_tech = basic_medium_tank_chassis
		}

		visible = {
			is_ai = yes
			tag = USA
			has_tech = amphibious_drive
			has_tech = basic_medium_tank_chassis
			has_army_experience > 15
		}

		complete_effect = {
			custom_effect_tooltip = "marine preparation"
			hidden_effect = {
				add_war_support = 0.02
				army_experience = -10
				if = {
					limit = { 
						NOT = { has_tech = special_forces_marines }
					}
					navy_experience = -60
					set_technology = { special_forces_marines = 1 }
				}
				if = {
					limit = { 
						NOT = { has_tech = special_forces_mountaineers }
					}
					set_technology = { special_forces_mountaineers = 1 }
				}
				if = {
					limit = { 
						NOT = { has_tech = marines_shore_parties }
					}
					navy_experience = -60
					set_technology = { marines_shore_parties = 1 }
				}
				if = { 
					limit = { 
						OR = {
							tag = USA
						} 
					}
					division_template = {
						name = "Marines template 3"			# Rifle Division
						division_names_group = USA_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 0 y = 4 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 1 y = 4 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							marine = { x = 2 y = 3 }
							marine = { x = 2 y = 4 }
							amphibious_medium_armor = { x = 3 y = 0 }
							amphibious_medium_armor = { x = 3 y = 1 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							pioneer_support = { x = 0 y = 0 } 
							anti_air = { x = 0 y = 1 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	GER_marine_logic_boost = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = GER
		}

		visible = {
			is_ai = yes
			tag = GER
			has_tech = basic_heavy_tank_chassis
			has_tech = basic_medium_tank_chassis
			has_tech = marines
			OR = {
				has_war = yes
				has_army_experience > 25
			}
		}

		complete_effect = {
			custom_effect_tooltip = "marine preparation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = { 
						tag = GER
					}
					division_template = {
						name = "Marines template 18"			# Rifle Division
						division_names_group = GER_MAR_01

						regiments = {
							marine = { x = 0 y = 0 }
							marine = { x = 0 y = 1 }
							marine = { x = 0 y = 2 }
							marine = { x = 0 y = 3 }
							marine = { x = 0 y = 4 }
							marine = { x = 1 y = 0 }
							marine = { x = 1 y = 1 }
							marine = { x = 1 y = 2 }
							marine = { x = 1 y = 3 }
							marine = { x = 1 y = 4 }
							marine = { x = 2 y = 0 }
							marine = { x = 2 y = 1 }
							marine = { x = 2 y = 2 }
							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							engineer = { x = 0 y = 0 } 
							anti_air = { x = 0 y = 1 } 
							logistics_company = { x = 0 y = 2 } 
						}
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = cavalry  
							division_has_majority_template = mountaineers  
							division_has_majority_template = motorized
						}
					}
					change_division_template = {
						division_template = "Marines template 18" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	GER_amphib_logic_boost = { 
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = GER
		}

		visible = {
			is_ai = yes
			tag = GER
			has_tech = basic_heavy_tank_chassis
			has_tech = basic_medium_tank_chassis
			has_tech = amphibious_mechanized_infantry
			has_tech = marines
			OR = {
				has_war = yes
				has_army_experience > 5
			}
		}

		complete_effect = {
			custom_effect_tooltip = "marine preparation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = { 
						tag = GER
					}
					division_template = {
						name = "Marines template 20"			# Rifle Division
						division_names_group = GER_MAR_01

						regiments = {
							amphibious_mechanized = { x = 0 y = 0 }
							amphibious_mechanized = { x = 0 y = 1 }
							amphibious_mechanized = { x = 0 y = 2 }
							amphibious_mechanized = { x = 0 y = 3 }
							amphibious_mechanized = { x = 0 y = 4 }
							amphibious_mechanized = { x = 1 y = 0 }
							amphibious_mechanized = { x = 1 y = 1 }
							amphibious_mechanized = { x = 1 y = 2 }
							amphibious_mechanized = { x = 1 y = 3 }
							amphibious_mechanized = { x = 1 y = 4 }
							amphibious_mechanized = { x = 2 y = 0 }
							amphibious_mechanized = { x = 2 y = 1 }
							amphibious_mechanized = { x = 2 y = 2 }
							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 
							anti_air = { x = 0 y = 0 } 
							logistics_company = { x = 0 y = 1 } 
							medium_flame_tank = { x = 0 y = 2 } 
						}
					}
				}
				every_country_division = {
					limit = { 
						OR = {
							division_has_majority_template = cavalry  
							division_has_majority_template = mountaineers
						}
					}
					change_division_template = {
						division_template = "Marines template 20" 
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_xp_spending_compensator = { #cuz they keep spending 4 air xp when this focus is done ffs
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_completed_focus = SOV_transpolar_flights
			has_global_flag = AI_is_allowed
		}

		complete_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				air_experience = 10
				add_war_support = 0.01 #very important for later cuz AI cannot time Anschluss and I don't want to mod Anschluss 
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_pp_spending_compensator_1 = { #it does nothing for the AI anyway
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			OR = {	
				has_idea_with_trait = navy_chief_decisive_battle_2 
				has_idea_with_trait = navy_chief_naval_aviation_1 
				has_idea_with_trait = navy_chief_commerce_raiding_1 
				has_idea_with_trait = navy_chief_reform_2
			}
			has_global_flag = AI_is_allowed
		}

		complete_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				add_command_power = 30
				add_political_power = 100
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_pp_spending_compensator_2 = { #no longer need it
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			OR = {
				has_idea = leningrad_polytechnical_institute
				has_idea = stalingrad_tractor_factory
			}
			has_completed_focus = SOV_foreign_experts
		}

		complete_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				if = {
					limit = {
						has_idea = leningrad_polytechnical_institute
					}
					remove_ideas = leningrad_polytechnical_institute
					add_political_power = 50
				}
				if = {
					limit = {
						has_idea = stalingrad_tractor_factory
					}
					remove_ideas = stalingrad_tractor_factory
					add_political_power = 50
				}
				if = {
					limit = {
						has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 }
						has_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 2 }
					}
					add_ideas = SOV_gosproyektstroy_2_usa_mil
				}
				if = {
					limit = {
						has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 }
						NOT = { has_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 2 } }
					}
					add_ideas = SOV_gosproyektstroy_2_usa
				}
				if = {
					limit = {
						NOT = { has_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } }
						NOT = { has_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 2 } }
					}
					add_ideas = SOV_gosproyektstroy_1
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_pp_spending_compensator_3 = { #replace the standard one so they don't have to choose
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		days_remove = 90

		cost = 50

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = SOV_gosproyektstroy_1
		}

		complete_effect = { 
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				set_country_flag = { flag = SOV_gosproyektstroy_level_2_flag value = 1 } #USA
				swap_ideas = {
					remove_idea = SOV_gosproyektstroy_1
					add_idea = SOV_gosproyektstroy_2_usa
				}
				clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_pp_spending_compensator_4 = { #replace the standard one
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		days_remove = 90

		cost = 50

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = SOV_gosproyektstroy_2_usa
		}

		complete_effect = { 
			set_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
		}

		remove_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				if = {
					limit = { 
						NOT = { has_country_flag = civ_3 }
					}
					set_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 2 }
					swap_ideas = {
						remove_idea = SOV_gosproyektstroy_2_usa
						add_idea = SOV_gosproyektstroy_3_usa_mil
					}
				}
				if = {
					limit = { 
						has_country_flag = civ_3
					}
					set_country_flag = { flag = SOV_gosproyektstroy_level_3_flag value = 1 }
					swap_ideas = {
						remove_idea = SOV_gosproyektstroy_2_usa
						add_idea = SOV_gosproyektstroy_3_usa_civ
					}
				}
				clr_country_flag = SOV_gosproyektstroy_upgrade_in_progress_flag
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	sov_ai_pp_spending_compensator_5 = { 
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		cost = 0

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = SOV_understaffed_bureaucracy
			has_global_flag = AI_is_allowed #deactivated
		}

		complete_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {	
				add_political_power = -25
				remove_ideas = SOV_understaffed_bureaucracy
				if = {
					limit = {
						NOT = { has_idea = SOV_shipyard_staff_purged }
					}
					add_timed_idea = { idea = SOV_shipyard_staff_purged days = 180 }
				}
				if = {
					limit = {
						has_idea = SOV_shipyard_staff_purged
					}
					add_timed_idea = { idea = SOV_anti_soviet_military_thinking_banned_navy days = 180 }
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	SOV_not_your_business_trotsky = { #make sure nothing goes wrong, ever
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		days_remove = 312 #longer duration to account for intel network time, though SOV AI already makes network in Mexico immediately as well 

		visible = {
			tag = SOV
			is_ai = yes
			has_completed_focus = SOV_behead_the_snake
			NOT = { has_global_flag = flag_trotsky_dead }
			has_global_flag = AI_is_allowed #deactivated
		}

		remove_effect = {
			custom_effect_tooltip = "manually tweaking some values for AI. Has no negative impact on players."
			hidden_effect = {
				ROOT = { set_country_flag = SOV_raided_trotskys_villa_flag }
				ROOT = { news_event = { id = nsb_news.100 } }
				set_global_flag = flag_trotsky_dead
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	soviet_union_we_are_out_of_manpower = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_manpower < 1
			date > 1946.1.1
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = scraping_the_barrel
		}

		complete_effect = {
			custom_effect_tooltip = "need more men"
			hidden_effect = {
				set_technology = { large_front_operations = 0 popup = no }
				set_technology = { deep_operations = 0 popup = no }
				set_technology = { operational_concentration = 0 popup = no }
				set_technology = { vast_offensives = 0 popup = no }
				set_technology = { mechanized_wave = 0 popup = no }
				set_technology = { breakthrough_priority  = 0 popup = no }
				set_technology = { continuous_offensive = 0 popup = no }
				set_technology = { peoples_army = 1 popup = no }
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	RAJ_investment_is_here = {  
	
		icon = generic_research  

		fire_only_once = no 

		allowed = {
			always = yes 
		} 

		available = {
			OR = {
				AND = {
					is_in_faction_with = ENG
					ENG = { num_of_controlled_factories > 250 }
				}
				is_in_faction_with = USA
			}
		}
	
		days_re_enable = 30

		visible = {
			tag = RAJ
			is_ai = yes
			any_state = {	
				is_owned_by = RAJ
				is_fully_controlled_by = RAJ		
				free_building_slots = {
					building = infrastructure
					size > 0
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				random_owned_controlled_state = {
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	derna_porta = {
	
		icon = generic_research  

		fire_only_once = yes 

		allowed = {
			always = yes 
		} 

		available = {
			has_war = yes
		}

		visible = {
			tag = ENG
			is_ai = yes
			OR = {
				USA = { is_in_faction_with = ENG }
				ENG = { divisions_in_state = { state = 451 size > 0 } }
			}
			452 = { 
				is_fully_controlled_by = ENG
			}
		}

		complete_effect = {
			hidden_effect = {
				452 = {
					add_building_construction = {
						type = naval_base
						level = 3
						instant_build = yes
						province = 7079
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	tripoli_porta = {
	
		icon = generic_research  

		fire_only_once = yes 

		allowed = {
			always = yes 
		} 

		available = {
			has_war = yes
		}

		visible = {
			tag = ENG
			is_ai = yes
			ENG = { divisions_in_state = { state = 448 size > 0 } }
			449 = { 
				is_fully_controlled_by = ENG
			}
		}

		complete_effect = {
			hidden_effect = {
				449 = {
					add_building_construction = {
						type = naval_base
						level = 2
						instant_build = yes
						province = 1041
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	the_d_day_port = {  #deactivated right now
	
		icon = generic_research  

		fire_only_once = no 

		allowed = {
			always = yes 
		} 

		available = {
			has_war = yes
		}
	
		days_re_enable = 7

		visible = {
			OR = {
				has_global_flag = d_day_happened
				has_idea = d_day_preparation_1
				has_idea = d_day_preparation_2
				has_idea = d_day_preparation_3
			}
			is_allied_ai = yes
			is_ai = yes
			any_state = {
				is_coastal = yes
				is_on_continent = europe
				OR = {
					is_core_of = FRA
					is_core_of = HOL
					is_core_of = BEL
					is_core_of = ITA
					is_core_of = GER
					is_core_of = YUG
				}
				OR = {
					controller = { is_in_faction_with = ENG }
					ROOT = { divisions_in_state = { state = PREV size > 0 } }
				}
				any_neighbor_state = {
					controller = { has_war_with = ROOT }
				}
				NOT = {
					has_state_flag = {
						flag = state_port_downtime
						days < 7
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				random_state = {
					limit = {
						is_coastal = yes
						OR = {
							controller = { is_in_faction_with = ENG }
							ROOT = { divisions_in_state = { state = PREV size > 0 } }
						}
						any_neighbor_state = {
							controller = { has_war_with = ROOT }
						}
						OR = {
							is_core_of = FRA
							is_core_of = HOL
							is_core_of = BEL
							is_core_of = ITA
							is_core_of = GER
							is_core_of = YUG
						}
						is_on_continent = europe
						NOT = {
							has_state_flag = {
								flag = state_port_downtime
								days < 30
							}
						}
					}
					add_building_construction = {
						type = naval_base
						level = 2
						instant_build = yes
						province = {
							all_provinces = yes
							limit_to_coastal = yes
							limit_to_naval_base = yes
						}
					}
					set_state_flag = state_port_downtime
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	the_japan_port = {  #deactivated right now
	
		icon = generic_research  

		fire_only_once = no 

		allowed = {
			always = yes 
		} 

		available = {
			has_war = yes
		}
	
		days_re_enable = 16

		visible = {
			OR = {
				tag = ENG
				tag = USA
			}
			has_global_flag = port_is_needed
			is_ai = yes
			any_state = {
				is_coastal = yes
				OR = {
					is_core_of = JAP
					is_core_of = KOR
				}
				OR = {
					controller = { is_in_faction_with = ENG }
					ROOT = { divisions_in_state = { state = PREV size > 4 } }
				}
				ROOT = { divisions_in_state = { state = PREV size > 0 } }
				any_neighbor_state = {
					controller = { has_war_with = ROOT }
				}
				NOT = {
					has_state_flag = {
						flag = state_port_downtime
						days < 45
					}
				}
			}
		}

		complete_effect = {
			hidden_effect = {
				random_state = {
					limit = {
						is_coastal = yes
						OR = {
							controller = { is_in_faction_with = ENG }
							ROOT = { divisions_in_state = { state = PREV size > 4 } }
						}
						ROOT = { divisions_in_state = { state = PREV size > 0 } }
						any_neighbor_state = {
							controller = { has_war_with = ROOT }
						}
						OR = {
							is_core_of = JAP
							is_core_of = KOR
						}
						NOT = {
							has_state_flag = {
								flag = state_port_downtime
								days < 45
							}
						}
					}
					add_building_construction = {
						type = naval_base
						level = 1
						instant_build = yes
						province = {
							all_provinces = yes
							limit_to_coastal = yes
						}
					}
					set_state_flag = state_port_downtime
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	SOV_ai_convert_mil_to_civ = {  #ND: isn't it a bit unfair though? #deactivated right now
	
		icon = generic_research  #we will make them convert it themselves later

		fire_only_once = no #so do we want any debuff for this? construction I meant

		allowed = {
			always = yes #no 
		} #ok ya right, it will be deactivated

		available = {
			tag = SOV
			is_ai = yes
			date < 1936.4.16
			date > 1936.1.16
		}
	
		days_re_enable = 7

		visible = {
			tag = SOV
			is_ai = yes
			has_global_flag = ready_for_this
		}

		complete_effect = { 
			custom_effect_tooltip = "let's start the great conversion"
			hidden_effect = {
				random_owned_controlled_state = {
					limit = {
						is_fully_controlled_by = ROOT
						arms_factory > 0
					}
					remove_building = {
						type = arms_factory
						level = 1
					}
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}
	faster_soviet_union = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			is_historical_focus_on = no #only for nonhis
			has_completed_focus = SOV_the_centre
		}

		complete_effect = {
			custom_effect_tooltip = "nothing big, really. nothing at all"
			add_war_support = 0.05
		}

		ai_will_do = {
			factor = 9999
		}
	}

	stronger_soviet_union = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			} 
		}

		visible = {
			tag = SOV
			is_ai = yes
				OR = {
					USA = { is_ai = no }
					ENG = { is_ai = no }
					GER = { is_ai = no }
					POL = { is_ai = no }
					FIN = { is_ai = no }
					ITA = { is_ai = no }
					JAP = { is_ai = no }
					FRA = { is_ai = no }
					ROM = { is_ai = no }
					TUR = { is_ai = no }
					NEP = { is_ai = no } #observer cuz lol
					has_completed_focus = SOV_the_left_opposition
					has_completed_focus = SOV_the_right_opposition
					has_completed_focus = SOV_beaten_but_not_defeated
				}
		}

		complete_effect = {
			custom_effect_tooltip = "nothing big, really. nothing at all"
			hidden_effect = {
				set_technology = { tech_field_hospital = 1 popup = no }
				set_technology = { tech_logistics_company = 1 popup = no }
				add_manpower = 1500000
				add_command_power = 50
				add_political_power = 25
				army_experience = 125
				air_experience = 25
				add_stability = 0.023
				add_ideas = human_wave_offensive_1
			}
		}

		ai_will_do = {
			factor = 0
			modifier = {
				OR = {
					USA = { is_ai = no }
					ENG = { is_ai = no }
					GER = { is_ai = no }
					POL = { is_ai = no }
					FIN = { is_ai = no }
					ITA = { is_ai = no }
					JAP = { is_ai = no }
					FRA = { is_ai = no }
					ROM = { is_ai = no }
					TUR = { is_ai = no }
					has_completed_focus = SOV_the_left_opposition
					has_completed_focus = SOV_the_right_opposition
					has_completed_focus = SOV_beaten_but_not_defeated
				}
				add = 99999 #the threat is imminent
			}
		}
	}

	uncheesable_machine_doll = { #wait lmao it is still here?
	
		icon = generic_research #i will remove half of the effects, we only need the first check in case US player acts funny

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			OR = {
				AND = {
					any_enemy_country = { is_ai = no } 
					SOV_third_five_year_plan_available = no
					has_completed_focus = SOV_third_five_year_plan
					OR = { 
						NOT = { has_completed_focus = SOV_reorganize_the_pc_of_heavy_industry }
						NOT = { has_completed_focus = SOV_industrial_modernization }
					}
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = "nothing big, really. nothing at all"
			hidden_effect = {
				if = { 
					limit = { 
						NOT = { has_completed_focus = SOV_reorganize_the_pc_of_heavy_industry }
					}
					complete_national_focus = SOV_reorganize_the_pc_of_heavy_industry 
				}
				if = { 
					limit = { 
						NOT = { has_completed_focus = SOV_industrial_modernization }
					}
					complete_national_focus = SOV_industrial_modernization
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	stronger_soviet_union_2 = {
	
		icon = generic_military

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}	
		}

		visible = {
			tag = SOV
			has_war = yes
			OR = { 
				any_country = { 
					AND = {
						has_war_with = ROOT
						is_major = yes
						OR = {
							is_ai = no
							num_of_controlled_factories > 300
						}	
					}
				}
				has_completed_focus = SOV_the_left_opposition
				has_completed_focus = SOV_the_right_opposition
				has_completed_focus = SOV_beaten_but_not_defeated
			}
			has_idea = human_wave_offensive_1
			surrender_progress > 0
			NOT = { has_idea = SOV_barbarossa_retreat }
			NOT = { has_idea = SOV_barbarossa_retreat_2 }
			NOT = { has_idea = SOV_barbarossa_retreat_3 }
			NOT = { has_idea = SOV_barbarossa_retreat_4 }
			NOT = { has_idea = SOV_barbarossa_retreat_5 }
			NOT = { has_idea = SOV_barbarossa_retreat_6 }
			NOT = { has_idea = SOV_barbarossa_retreat_7 }
			NOT = { has_idea = SOV_barbarossa_retreat_8 }
			NOT = { has_idea = SOV_barbarossa_retreat_9 }
			NOT = { has_idea = SOV_barbarossa_retreat_10 }
		}

		complete_effect = {
			custom_effect_tooltip = "Not one step back!!"
			hidden_effect = {
				add_manpower = 2000000
				add_command_power = 100
				add_political_power = 50
				add_stability = 0.05
				add_war_support = 0.05
				army_experience = 100
				air_experience = 100
				swap_ideas = {
					remove_idea = human_wave_offensive_1
					add_idea = human_wave_offensive_2
				}			
				every_state = { 
					limit = { 
						OR = { 
							is_core_of = UKR 
							is_core_of = BLR 
						}
						is_controlled_by = SOV
					}
					add_building_construction = {
						type = anti_air_building
						level = 2
						instant_build = yes
					}
				}			
				every_state = { 
					limit = { 
						is_core_of = SOV
						any_neighbor_state = {
							controller = { has_war_with = SOV }
						}
						is_controlled_by = SOV
					}
					add_building_construction = {
						type = anti_air_building
						level = 2
						instant_build = yes
					}
				}	
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	ita_iwandiabd = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = ITA
		}

		visible = {
			tag = ITA
			has_idea = vittoria_mutilata
			is_ai = yes
		}

		complete_effect = {
			custom_effect_tooltip = "Our war is over"
			hidden_effect = {
				remove_ideas = vittoria_mutilata
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}


	stronger_soviet_union_3 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = AI_is_balanced
			}	
		}

		visible = {
			tag = SOV
			has_war = no
			has_idea = human_wave_offensive_2
		}

		complete_effect = {
			custom_effect_tooltip = "Our war is over"
			hidden_effect = {
				swap_ideas = {
					remove_idea = human_wave_offensive_2
					add_idea = human_wave_offensive_1
				}
				every_owned_state = {
					ETH_upgrade_state_category = yes
				}
				add_research_slot = 1
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_0 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_war = no
			has_idea = SOV_production_front_1
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_1 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_global_flag = enclave_enabled
			has_idea = human_wave_offensive_2
			NOT = { has_idea = SOV_production_front_1 }
			surrender_progress > 0.10
			surrender_progress < 0.20
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_2 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_2 }
			surrender_progress > 0.20
			surrender_progress < 0.30
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_3 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_3 }
			surrender_progress > 0.30
			surrender_progress < 0.40
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_4 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_4 }
			surrender_progress > 0.40
			surrender_progress < 0.50
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_5 = {
	
		icon = ger_military_buildup

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_5 }
			surrender_progress > 0.50
			surrender_progress < 0.60
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_6 = {
	
		icon = generic_protection

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_6 }
			surrender_progress > 0.60
			surrender_progress < 0.70
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_7 = {
	
		icon = generic_protection

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_7 }
			surrender_progress > 0.70
			surrender_progress < 0.80
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_8 = {
	
		icon = generic_protection

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_8 }
			surrender_progress > 0.80
			surrender_progress < 0.90
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_9 = {
	
		icon = generic_protection

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes	
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_9 }
			surrender_progress > 0.90
			surrender_progress < 0.95
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_9
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_10
		}

		ai_will_do = {
			factor = 1000
		}
	}

	SOV_on_the_production_front_10 = {
	
		icon = generic_protection

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			tag = SOV
			is_ai = yes
		}

		visible = {
			tag = SOV
			is_ai = yes
			has_idea = human_wave_offensive_2
			has_global_flag = enclave_enabled
			NOT = { has_idea = SOV_production_front_10 }
			surrender_progress > 0.95
			custom_trigger_tooltip =  {
				tooltip = "AI is allowed to do this" 
				has_global_flag = let_SOV_reign 
			}
		}

		complete_effect = {
			add_ideas = SOV_production_front_10
			remove_ideas = SOV_production_front_1
			remove_ideas = SOV_production_front_2
			remove_ideas = SOV_production_front_3
			remove_ideas = SOV_production_front_4
			remove_ideas = SOV_production_front_5
			remove_ideas = SOV_production_front_6
			remove_ideas = SOV_production_front_7
			remove_ideas = SOV_production_front_8
			remove_ideas = SOV_production_front_9
		}

		ai_will_do = {
			factor = 1000
		}
	}

	superior_american_engineering = {
	
		icon = generic_protection

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_tech = basic_heavy_tank_chassis
			has_tech = basic_medium_tank_chassis
			is_ai = yes
			tag = USA
			has_dlc = "No Step Back"
			has_army_experience > 14
		}

		complete_effect = {
			hidden_effect = {
				if = {
					limit = {
						tag = USA #US tank template is bugged, need to be added directly
					} 
					army_experience = -12
					division_template = {
						name = "Medium Tank template 2"			
						division_names_group = USA_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							medium_armor = { x = 3 y = 4 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = {		
							light_tank_recon = { x = 0 y = 0 }		
							anti_air = { x = 0 y = 1 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	the_flame_in_my_heart = {
	
		icon = generic_protection

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_tech = basic_medium_tank_chassis
			has_tech = tech_engineers2
			is_ai = yes
			NOT = { tag = GER }
			NOT = { tag = FRA }
			has_dlc = "No Step Back"
		}

		complete_effect = {
			hidden_effect = {
				set_country_flag = flame_tank_is_ready
				if = {
					limit = {
						is_ai = yes
					}
					army_experience = -7 #pay up my friend
					create_equipment_variant = { 
						name = "Medium Flame Tank I"
						type = medium_tank_flame_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = flamethrower
							turret_type_slot = tank_medium_two_man_tank_turret
							suspension_type_slot = tank_bogie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = empty
							special_type_slot_2 = empty
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 8
							tank_nsb_armor_upgrade = 0
						}
						icon = "GFX_SOV_advanced_heavy_tank_medium"
					}
				}
				if = {
					limit = {
						tag = USA #US tank template is bugged, need to be added directly
					} 
					army_experience = -12
					division_template = {
						name = "Medium Tank template 16"			
						division_names_group = USA_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							mechanized = { x = 0 y = 0 }
							mechanized = { x = 0 y = 1 }
							mechanized = { x = 0 y = 2 }
							mechanized = { x = 0 y = 3 }
							mechanized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							medium_armor = { x = 3 y = 4 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 } 		
							light_tank_recon = { x = 0 y = 1 }		
							anti_air = { x = 0 y = 2 }
						}
					}
				}
				if = {
					limit = {
						tag = ENG #ENG tank template is bugged, need to be added directly
					} 
					army_experience = -12
					division_template = {
						name = "Medium Tank template 4"			
						division_names_group = ENG_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }
							motorized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 } 		
							anti_air = { x = 0 y = 1 } 		
							logistics_company = { x = 0 y = 2 } 		
							anti_tank = { x = 0 y = 3 } 		
							engineer = { x = 0 y = 4 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	the_flame_in_my_heart_license = {
	
		icon = generic_protection

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			has_tech = basic_medium_tank_chassis
			has_tech = tech_engineers2
			is_ai = yes
			has_country_flag = flame_tank_is_ready
			has_dlc = "No Step Back"
			is_in_faction = yes
			any_country = {
				is_in_faction_with = ROOT
				is_ai = yes
				NOT = { has_tech = tech_engineers2 }
				NOT = { has_country_flag = flame_licensed }
				NOT = { has_country_flag = flame_tank_is_ready }
			}
		}

		complete_effect = {
			hidden_effect = {
				every_country = {
					limit = {
						is_in_faction_with = ROOT
						is_ai = yes
						NOT = { has_tech = tech_engineers2 }
						NOT = { has_country_flag = flame_licensed }
						NOT = { has_country_flag = flame_tank_is_ready }
					}
					set_country_flag = flame_licensed
					ROOT = {
						create_production_license = {
							target = PREV
							equipment = {
								type = medium_tank_flame_chassis_1
							}
							cost_factor = 0
						}
						add_cic = 100
					}
				}
			}
		}

		ai_will_do = {
			factor = 1000
		}
	}

	LSM_production_licensing_idea = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			NOT = { has_idea = LSM_production_licensing_idea }
			is_in_faction = yes
		}

		complete_effect = {
			add_ideas = LSM_production_licensing_idea
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing_backlog = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = basic_small_airframe
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = basic_small_airframe }
				NOT = { has_country_flag = basic_plane_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = created_new_basic_design }
				}
				set_country_flag = created_new_basic_design
				create_equipment_variant = { 
					name = "Fighter 0"
					type = small_plane_airframe_0
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = light_mg_4x
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty
					}
				}
				create_equipment_variant = { 
					name = "Fighter 1"
					type = small_plane_airframe_1
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = light_mg_4x
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
					}
				}
				create_equipment_variant = { 
					name = "Naval Bomber I"
					type = small_plane_naval_bomber_airframe_1
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = torpedo_mounting
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty
					}
				}
				create_equipment_variant = { 
					name = "Naval Bomber 0"
					type = small_plane_naval_bomber_airframe_0
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = torpedo_mounting
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
					}
				}
			}			
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = basic_small_airframe }
					NOT = { has_country_flag = basic_plane_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_0
						}
						cost_factor = 0
					}
					add_cic = 100
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_naval_bomber_airframe_0
						}
						cost_factor = 0
					}
					add_cic = 100
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_naval_bomber_airframe_1
						}
						cost_factor = 0
					}
					add_cic = 100
				}
				set_country_flag = basic_plane_licensed
				set_country_flag = created_new_basic_design
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = improved_small_airframe
			OR = {
				has_tech = aa_lmg
				has_tech = air_torpedoe_1
			}
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = improved_small_airframe }
				NOT = { has_country_flag = plane_licensed }
				NOT = { has_country_flag = plane_licensed_ITA }
				NOT = { has_country_flag = plane_licensed_SOV }
				NOT = { has_country_flag = fully_equipped_plane }
			}
			if = {
				limit = {
					tag = ENG
					is_ai = yes
				}
				has_tech = aa_hmg
				has_tech = engines_3
				has_tech = survivability_studies
			}
			if = {
				limit = {
					tag = GER
					is_ai = yes
				}
				has_tech = aa_hmg
				has_tech = engines_3
				has_tech = survivability_studies
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = created_new_design }
					NOT = { has_tech = engines_3 }
				}
				set_country_flag = created_new_design
				create_equipment_variant = { 
					name = "Fighter II"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = light_mg_4x
						fixed_auxiliary_weapon_slot_1 = light_mg_4x
						fixed_auxiliary_weapon_slot_2 = empty
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
						special_type_slot_3 = empty
					}
				}
				create_equipment_variant = { 
					name = "Naval Bomber II"
					type = small_plane_naval_bomber_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = torpedo_mounting
						fixed_auxiliary_weapon_slot_1 = empty
						fixed_auxiliary_weapon_slot_2 = empty
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
						special_type_slot_3 = empty
					}
				}
			}
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						NOT = { has_war_with = ROOT }
						is_ai = no
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = plane_licensed }
						NOT = { has_tech = improved_small_airframe }
					}
					set_country_flag = plane_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = improved_small_airframe }
					NOT = { has_country_flag = plane_licensed }
					NOT = { has_country_flag = plane_licensed_ITA }
					NOT = { has_country_flag = plane_licensed_SOV }
					NOT = { has_country_flag = fully_equipped_plane }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_naval_bomber_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = plane_licensed
				hidden_effect = {
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							NOT = { has_country_flag = created_new_design }
							ROOT = { tag = ENG }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = fuel_tanks_small	
								special_type_slot_2 = armor_plate_small  
								special_type_slot_3 = self_sealing_fuel_tanks_small
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							NOT = { has_country_flag = created_new_design }
							ROOT = { tag = GER }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = fuel_tanks_small	
								special_type_slot_2 = armor_plate_small  
								special_type_slot_3 = self_sealing_fuel_tanks_small
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							has_tech = engines_3
							has_tech = aa_cannon_1
							NOT = { has_tech = survivability_studies }
							NOT = { has_country_flag = created_new_design }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = aircraft_cannon_1_2x
								fixed_auxiliary_weapon_slot_1 = aircraft_cannon_1_2x
								fixed_auxiliary_weapon_slot_2 = light_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							has_tech = engines_3
							has_tech = aa_hmg
							NOT = { has_tech = survivability_studies }
							NOT = { has_country_flag = created_new_design }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							has_tech = aa_cannon_1
							has_tech = engines_2
							NOT = { has_country_flag = created_new_design }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = aircraft_cannon_1_2x
								fixed_auxiliary_weapon_slot_1 = light_mg_4x
								fixed_auxiliary_weapon_slot_2 = light_mg_4x
								engine_type_slot = engine_2_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small CAS Airframe"
							type = small_plane_cas_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = bomb_locks
								fixed_auxiliary_weapon_slot_1 = bomb_locks
								engine_type_slot = engine_2_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							NOT = { has_tech = aa_cannon_1 }
							has_tech = engines_2
							NOT = { has_country_flag = created_new_design }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = light_mg_4x
								fixed_auxiliary_weapon_slot_1 = light_mg_4x
								fixed_auxiliary_weapon_slot_2 = light_mg_4x
								engine_type_slot = engine_2_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small CAS Airframe"
							type = small_plane_cas_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = bomb_locks
								fixed_auxiliary_weapon_slot_1 = bomb_locks
								engine_type_slot = engine_2_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							NOT = { has_tech = aa_cannon_1 }
							NOT = { has_tech = engines_2 }
							NOT = { has_country_flag = created_new_design }
						}
						set_country_flag = created_new_design
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = light_mg_4x
								fixed_auxiliary_weapon_slot_1 = light_mg_4x
								fixed_auxiliary_weapon_slot_2 = light_mg_4x
								engine_type_slot = engine_1_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small CAS Airframe"
							type = small_plane_cas_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = bomb_locks
								fixed_auxiliary_weapon_slot_1 = empty
								engine_type_slot = engine_1_1x
								special_type_slot_1 = empty	
								special_type_slot_2 = empty 
								special_type_slot_3 = empty
							}
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing_nd1 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = fighter1
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = fighter1 }
				NOT = { has_country_flag = plane_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						NOT = { has_war_with = ROOT }
						is_ai = no
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = aplane_licensed }
						NOT = { has_tech = fighter1 }
					}
					set_country_flag = aplane_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = fighter1 }
					NOT = { has_country_flag = aplane_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = fighter_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = aplane_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing_nd2 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = fighter2
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = fighter2 }
				NOT = { has_country_flag = plane_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						NOT = { has_war_with = ROOT }
						is_ai = no
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = plane_licensed }
						NOT = { has_tech = fighter2 }
					}
					set_country_flag = plane_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = fighter2 }
					NOT = { has_country_flag = plane_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = fighter_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = plane_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	AI_plane_licensing_CAN_US = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = improved_small_airframe
		}

		visible = {
			OR = {
				tag = CAN
				tag = AST
			}
			has_tech = improved_small_airframe
			any_other_country = {
				tag = USA
				is_ai = yes
				NOT = { has_tech = improved_small_airframe }
				NOT = { has_country_flag = plane_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = created_new_design }
				}
				set_country_flag = created_new_design
				create_equipment_variant = { 
					name = "Fighter License"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = light_mg_4x
						fixed_auxiliary_weapon_slot_1 = light_mg_4x
						fixed_auxiliary_weapon_slot_2 = light_mg_4x
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
						special_type_slot_3 = empty
					}
				}
			}
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						NOT = { has_war_with = ROOT }
						is_ai = no
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
							tag = SOV
						}
						NOT = { has_country_flag = plane_licensed }
						NOT = { has_tech = improved_small_airframe }
					}
					set_country_flag = plane_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					tag = USA
					is_ai = yes
					NOT = { has_tech = improved_small_airframe }
					NOT = { has_country_flag = plane_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 1500
				}
				set_country_flag = plane_licensed
				set_country_flag = created_new_design
				hidden_effect = {
				if = {
					limit = {
						NOT = { has_global_flag = vanilla_history }
					}
					create_equipment_variant = { #bug exploit, doable by player too if you know what that is
						name = "Improved Small Airframe"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = light_mg_4x
							fixed_auxiliary_weapon_slot_2 = light_mg_4x
							engine_type_slot = engine_2_1x
							special_type_slot_1 = empty	
							special_type_slot_2 = empty 
							special_type_slot_3 = empty
						}
					}
					create_equipment_variant = { #bug exploit, doable by player too if you know what that is
						name = "Improved Small CAS Airframe"
						type = small_plane_cas_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = bomb_locks
							fixed_auxiliary_weapon_slot_1 = bomb_locks
							engine_type_slot = engine_2_1x
							special_type_slot_1 = empty	
							special_type_slot_2 = empty 
							special_type_slot_3 = empty
						}
					}
				}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	AI_plane_licensing_ROM_GER = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = improved_small_airframe
		}

		visible = {
			tag = ROM
			has_tech = improved_small_airframe
			any_other_country = {
				OR = {
					tag = ITA
					tag = GER
				}
				is_ai = yes
				NOT = { has_tech = improved_small_airframe }
				NOT = { has_country_flag = plane_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = created_new_design }
				}
				set_country_flag = created_new_design
				create_equipment_variant = { 
					name = "Fighter License"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = light_mg_4x
						fixed_auxiliary_weapon_slot_1 = light_mg_4x
						fixed_auxiliary_weapon_slot_2 = light_mg_4x
						engine_type_slot = engine_1_1x
						special_type_slot_1 = empty	
						special_type_slot_2 = empty 
						special_type_slot_3 = empty
					}
				}
			}
			every_other_country = {
				limit = {
					OR = {
						tag = ITA
						tag = GER
					}
					is_ai = yes
					NOT = { has_tech = improved_small_airframe }
					NOT = { has_country_flag = plane_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 1500
				}
				set_country_flag = plane_licensed
				set_country_flag = created_new_design
				hidden_effect = {
				if = {
					limit = {
						NOT = { has_global_flag = vanilla_history }
						NOT = { has_country_flag = created_new_design }
					}
					create_equipment_variant = { #bug exploit, doable by player too if you know what that is
						name = "Improved Small Airframe"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = light_mg_4x
							fixed_auxiliary_weapon_slot_1 = light_mg_4x
							fixed_auxiliary_weapon_slot_2 = light_mg_4x
							engine_type_slot = engine_2_1x
							special_type_slot_1 = empty	
							special_type_slot_2 = empty 
							special_type_slot_3 = empty
						}
					}
					create_equipment_variant = { #bug exploit, doable by player too if you know what that is
						name = "Improved Small CAS Airframe"
						type = small_plane_cas_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = bomb_locks
							fixed_auxiliary_weapon_slot_1 = bomb_locks
							engine_type_slot = engine_2_1x
							special_type_slot_1 = empty	
							special_type_slot_2 = empty 
							special_type_slot_3 = empty
						}
					}
				}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	AI_plane_licensing_ENG_SOV = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			GER = { is_ai = no }
		}

		visible = {
			is_ai = yes
			is_historical_focus_on = yes
			GER = { is_ai = no }
			SOV = { is_ai = yes }
			OR = {
				tag = USA
				tag = ENG
			}
			has_tech = improved_small_airframe
			has_tech = aa_hmg
			has_tech = engines_3
			has_tech = range_improvements
			has_tech = survivability_studies
			any_other_country = {
				tag = SOV
				is_ai = yes
				NOT = { has_tech = improved_small_airframe }
				NOT = { has_country_flag = plane_licensed_SOV }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = SOV_created_new_design }
				}
				set_country_flag = SOV_created_new_design
				if = {
					limit = {
						tag = ENG 
					}
					create_equipment_variant = { 
						name = "Soviet Fighter License"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small
						}
						design_team = mio:ENG_supermarine_organization
					}
				}
				if = {
					limit = {
						tag = USA 
					}
					create_equipment_variant = { 
						name = "Soviet Fighter License"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small
						}
						design_team = mio:USA_north_american_aviation_organization
					}
				}
			}
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
							tag = SOV
						}
						NOT = { has_country_flag = plane_licensed_SOV }
						NOT = { has_tech = improved_small_airframe }
					}
					set_country_flag = plane_licensed_SOV
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					tag = SOV
					is_ai = yes
					NOT = { has_tech = improved_small_airframe }
					NOT = { has_country_flag = plane_licensed_SOV }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 1500
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_naval_bomber_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 1000
				}
				set_country_flag = plane_licensed_SOV
				set_country_flag = SOV_created_new_design
				hidden_effect = {
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = fuel_tanks_small	
								special_type_slot_2 = armor_plate_small 
								special_type_slot_3 = empty
							}
							design_team = mio:SOV_mig_design_bureau_organization
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing_ENG_Allies = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			is_ai = yes
			if = {
				limit = {
					NOT = { has_global_flag = mp_difficulty }
				}
				SOV = { is_ai = yes }
			}
			OR = {
				tag = USA
				tag = ENG
			}
			OR = {
				has_country_flag = plane_licensed
				has_tech = improved_small_airframe
			}
			has_tech = aa_hmg
			has_tech = engines_3
			has_tech = range_improvements
			has_tech = survivability_studies
			any_other_country = {
				is_in_faction_with = ROOT
				is_ai = yes
				NOT = { has_country_flag = fully_equipped_plane }
				OR = {
					NOT = { has_tech = engines_3 }
					NOT = { has_tech = aa_hmg }
					NOT = { has_tech = survivability_studies }
					NOT = { has_tech = range_improvements }
				}
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = allies_created_new_design }
				}
				set_country_flag = allies_created_new_design
				create_equipment_variant = { 
					name = "Allied Fighter License"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = heavy_mg_4x
						fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
						fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
						engine_type_slot = engine_3_1x
						special_type_slot_1 = armor_plate_small	
						special_type_slot_2 = fuel_tanks_small 
						special_type_slot_3 = self_sealing_fuel_tanks_small
					}
					design_team = mio:ENG_supermarine_organization
				}
				create_equipment_variant = { 
					name = "UK Fighter License"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = heavy_mg_4x
						fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
						fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
						engine_type_slot = engine_3_1x
						special_type_slot_1 = fuel_tanks_small 
						special_type_slot_2 = fuel_tanks_small 
						special_type_slot_3 = self_sealing_fuel_tanks_small
					}
					design_team = mio:ENG_supermarine_organization
				}
			}
			every_other_country = {
				limit = {
					is_in_faction_with = ROOT
					is_ai = yes
					NOT = { has_country_flag = fully_equipped_plane }
					OR = {
						NOT = { has_tech = engines_3 }
						NOT = { has_tech = aa_hmg }
						NOT = { has_tech = survivability_studies }
						NOT = { has_tech = range_improvements }
					}
					is_ai = yes
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 500
				}
				set_country_flag = fully_equipped_plane
				hidden_effect = {
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							NOT = { tag = FRA }
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = armor_plate_small	
								special_type_slot_2 = fuel_tanks_small 
								special_type_slot_3 = self_sealing_fuel_tanks_small
							}
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							tag = FRA
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = armor_plate_small	
								special_type_slot_2 = fuel_tanks_small 
								special_type_slot_3 = self_sealing_fuel_tanks_small
							}
							design_team = mio:FRA_morane_saulnier_organization
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_plane_licensing_GER_ITA = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = aa_hmg
			has_tech = engines_3
			has_tech = survivability_studies
			OR = {
				has_country_flag = plane_licensed
				has_tech = improved_small_airframe
			}
		}

		visible = {
			OR = {
				AND = {
					tag = GER
					ITA = { has_government = fascism }
					ITA = { is_ai = yes }
				}
				AND = {
					tag = ITA
					GER = { has_government = fascism }
					GER = { is_ai = yes }
				}
			}
			OR = {
				has_country_flag = plane_licensed
				has_tech = improved_small_airframe
			}
			has_tech = aa_hmg
			has_tech = engines_3
			has_tech = survivability_studies
			NOT = { has_country_flag = ITA_created_new_design }
			any_other_country = {
				OR = {
					tag = GER
					tag = ITA
				}
				is_ai = yes
				NOT = { has_tech = improved_small_airframe }
				NOT = { has_country_flag = plane_licensed_ITA }
			}
		}

		complete_effect = {
			if = {
				limit = {
					NOT = { has_country_flag = ITA_created_new_design }
				}
				set_country_flag = ITA_created_new_design
				set_country_flag = created_new_design
				create_equipment_variant = { 
					name = "Italian Fighter License"
					type = small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = heavy_mg_4x
						fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
						fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
						engine_type_slot = engine_3_1x
						special_type_slot_1 = self_sealing_fuel_tanks_small	
						special_type_slot_2 = armor_plate_small 
						special_type_slot_3 = fuel_tanks_small
					}
				}
				create_equipment_variant = { 
					name = "Italian Carrier Fighter License"
					type = cv_small_plane_airframe_2
					parent_version = 0
					allow_without_tech = yes # Tooltip purposes, tech is required anyways
					modules = {
						fixed_main_weapon_slot = heavy_mg_2x
						fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
						fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
						engine_type_slot = engine_3_1x
						special_type_slot_1 = self_sealing_fuel_tanks_small	
						special_type_slot_2 = fuel_tanks_small
						special_type_slot_3 = fuel_tanks_small
					}
				}
			}
			every_other_country = {
				limit = {
					OR = {
						tag = GER
						tag = ITA
					}
					is_ai = yes
					NOT = { has_tech = improved_small_airframe }
					NOT = { has_country_flag = plane_licensed_ITA }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_airframe_2
						}
						cost_factor = 0
					}
					create_production_license = {
						target = PREV
						equipment = {
							type = small_plane_naval_bomber_airframe_2
						}
						cost_factor = 0
					}
					add_cic = 2000
				}
				set_country_flag = plane_licensed_ITA
				set_country_flag = ITA_created_new_design
				set_country_flag = created_new_design
				hidden_effect = {
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							tag = ITA
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = self_sealing_fuel_tanks_small
								special_type_slot_2 = armor_plate_small 
								special_type_slot_3 = fuel_tanks_small
							}
							design_team = mio:ITA_macchi_organization
						}
					}
					if = {
						limit = {
							NOT = { has_global_flag = vanilla_history }
							tag = GER
						}
						create_equipment_variant = { #bug exploit, doable by player too if you know what that is
							name = "Improved Small Airframe"
							type = small_plane_airframe_2
							parent_version = 0
							allow_without_tech = yes # Tooltip purposes, tech is required anyways
							modules = {
								fixed_main_weapon_slot = heavy_mg_4x
								fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
								fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
								engine_type_slot = engine_3_1x
								special_type_slot_1 = self_sealing_fuel_tanks_small
								special_type_slot_2 = armor_plate_small 
								special_type_slot_3 = fuel_tanks_small
							}
							design_team = mio:GER_messerschmitt_organization
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_antitank_licensing_0 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = interwar_antitank
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = interwar_antitank }
				NOT = { has_country_flag = antitank_licensed_0 }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = antitank_licensed_0 }
						NOT = { has_tech = interwar_antitank }
					}
					set_country_flag = antitank_licensed_0
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = interwar_antitank }
					NOT = { has_country_flag = antitank_licensed_0 }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_tank_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = antitank_licensed_0
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_antitank_licensing_1 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = antitank2
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = antitank2 }
				NOT = { has_country_flag = antitank_licensed_1 }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = antitank_licensed_1 }
						NOT = { has_tech = antitank2 }
					}
					set_country_flag = antitank_licensed_1
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = antitank2 }
					NOT = { has_country_flag = antitank_licensed_1 }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_tank_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = antitank_licensed_1
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_antitank_licensing_2 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = antitank5
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = antitank5 }
				NOT = { has_country_flag = antitank_licensed_2 }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = antitank_licensed_2 }
						NOT = { has_tech = antitank5 }
					}
					set_country_flag = antitank_licensed_2
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = antitank5 }
					NOT = { has_country_flag = antitank_licensed_2 }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_tank_equipment_3
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = antitank_licensed_2
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_mech_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = mechanised_infantry
			has_country_flag = mech_upgrade_done
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = mechanised_infantry }
				NOT = { has_country_flag = mech_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = mech_licensed }
						NOT = { has_tech = mechanised_infantry }
					}
					set_country_flag = mech_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = mechanised_infantry }
					NOT = { has_country_flag = mech_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = mechanized_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = mech_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_mech_upgrade = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = mechanised_infantry
		}

		visible = {
			OR = {
				is_ai = yes
				tag = PAN
			}
			has_tech = mechanised_infantry
		}

		complete_effect = {
			if = { 
				limit = {
					tag = SOV
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
						design_team = mio:SOV_gaz_organization
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = no 
					NOT = { tag = SOV }
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = BRA
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
						design_team = mio:BRA_fnm_organization
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = ARG
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:ARG_hispano_argentina_organization
					}

				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = CHL
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:CHL_willys_famae_corvo_organization
					}

				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = URG
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_1
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:generic_motorized_mechanized_organization
					}

				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_mech_upgrade2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = mechanised_infantry2
		}

		visible = {
			OR = {
				is_ai = yes
				tag = PAN
			}
			has_tech = mechanised_infantry2
		}

		complete_effect = {
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk7"
				   	 	type = mechanized_equipment_2
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
					}
				}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_mech_upgrade3 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = mechanised_infantry3
		}

		visible = {
			OR = {
				is_ai = yes
				tag = PAN
			}
			has_tech = mechanised_infantry3
		}

		complete_effect = {
			if = { 
				limit = {
					tag = SOV
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
						design_team = mio:SOV_gaz_organization
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = no 
					NOT = { tag = SOV }
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk2"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = BRA
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk3"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}
						design_team = mio:BRA_fnm_organization
					}
				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = ARG
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk3"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:ARG_hispano_argentina_organization
					}

				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = CHL
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk3"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:CHL_willys_famae_corvo_organization
					}

				}
			}
			if = { 
				limit = { 
					is_ai_mech_mob = yes 
					tag = URG
				}
				ROOT = {
					set_country_flag = mech_upgrade_done
					create_equipment_variant = {
				   		name = "Mechanized Mk3"
				   	 	type = mechanized_equipment_3
				    		parent_version = 0
				   		upgrades = {
				        		mech_cost_upgrade = 5
				    		}					
						design_team = mio:generic_motorized_mechanized_organization
					}

				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_amphimech_upgrade = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = amphibious_mechanized_infantry
		}

		visible = {
			is_ai = yes
			has_tech = amphibious_mechanized_infantry
		}

		complete_effect = {
			ROOT = {
				create_equipment_variant = {
				   	name = "Amphibious Mechanized I"
				   	type = amphibious_mechanized_equipment_1
				    	parent_version = 0
				   	upgrades = {
				        	mech_cost_upgrade = 5
				    	}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_amphimech_upgrade2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			has_tech = amphibious_mechanized_infantry_2
		}

		visible = {
			is_ai = yes
			has_tech = amphibious_mechanized_infantry_2
		}

		complete_effect = {
			ROOT = {
				create_equipment_variant = {
				   	name = "Amphibious Mechanized II"
				   	type = amphibious_mechanized_equipment_2
				    	parent_version = 0
				   	upgrades = {
				        	mech_cost_upgrade = 5
				    	}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	AI_CAN_USA_mech_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			tag = CAN
			is_in_faction = yes
			has_country_flag = mech_upgrade_done
			has_tech = mechanised_infantry
			any_other_country = {
				is_ai = yes
				OR = {
					has_completed_focus = USA_neutrality_act
					has_completed_focus = USA_limited_intervention
					AND = {
						OR = {
							tag = ENG
							tag = FRA
						}
						has_government = democratic
						is_historical_focus_on = yes
					}
				}
				OR = {
					tag = USA
					tag = ENG
					tag = FRA
				}
				NOT = { has_tech = mechanised_infantry }
				NOT = { has_country_flag = mech_licensed }
			}
		}

		complete_effect = {
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						has_completed_focus = USA_neutrality_act
						has_completed_focus = USA_limited_intervention
						AND = {
							OR = {
								tag = ENG
								tag = FRA
							}
							has_government = democratic
							is_historical_focus_on = yes
						}
					}
					OR = {
						tag = USA
						tag = ENG
						tag = FRA
					}
					NOT = { has_tech = mechanised_infantry }
					NOT = { has_country_flag = mech_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = mechanized_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 300
				}
				set_country_flag = mech_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	allies_to_allies_gun2 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = improved_infantry_weapons
		}

		visible = {
			is_ai = yes
			is_allied_ai = yes
			is_historical_focus_on = yes
			OR = {
				ITA = { is_ai = no }
				GER = { is_ai = no }
			}
			has_tech = improved_infantry_weapons
			any_other_country = {
				is_ai = yes
				OR = {
					tag = POL
					tag = YUG
					tag = HOL
				}
				NOT = { has_tech = improved_infantry_weapons }
				NOT = { has_country_flag = gun2_licensed }
			}
		}

		complete_effect = {
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						tag = POL
						tag = YUG
						tag = HOL
					}
					NOT = { has_tech = improved_infantry_weapons }
					NOT = { has_country_flag = gun2_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = gun2_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	allies_to_allies_at = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = interwar_antitank
		}

		visible = {
			is_ai = yes
			is_allied_ai = yes
			is_historical_focus_on = yes
			OR = {
				ITA = { is_ai = no }
				GER = { is_ai = no }
			}
			has_tech = interwar_antitank
			any_other_country = {
				is_ai = yes
				OR = {
					tag = POL
					tag = YUG
					tag = HOL
				}
				NOT = { has_tech = interwar_antitank }
				NOT = { has_country_flag = antitank_licensed_0 }
			}
		}

		complete_effect = {
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						tag = POL
						tag = YUG
						tag = HOL
					}
					NOT = { has_tech = interwar_antitank }
					NOT = { has_country_flag = antitank_licensed_0 }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_tank_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = antitank_licensed_0
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	allies_to_allies_at2 = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = antitank2
		}

		visible = {
			is_ai = yes
			is_allied_ai = yes
			is_historical_focus_on = yes
			OR = {
				ITA = { is_ai = no }
				GER = { is_ai = no }
			}
			has_tech = antitank2
			any_other_country = {
				is_ai = yes
				OR = {
					tag = POL
					tag = YUG
					tag = HOL
				}
				NOT = { has_tech = antitank2 }
				NOT = { has_country_flag = antitank_licensed_1 }
			}
		}

		complete_effect = {
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						tag = POL
						tag = YUG
						tag = HOL
					}
					NOT = { has_tech = antitank2 }
					NOT = { has_country_flag = antitank_licensed_1 }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_tank_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = antitank_licensed_1
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_ARG_VEN_GER_gun2_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = improved_infantry_weapons
		}

		visible = {
			OR = {
				tag = VEN
				tag = PRU
			}
			has_tech = improved_infantry_weapons
			any_other_country = {
				is_ai = yes
				tag = GER
				NOT = { has_tech = improved_infantry_weapons }
				NOT = { has_country_flag = gun2_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = gun2_licensed }
						NOT = { has_tech = improved_infantry_weapons }
					}
					set_country_flag = gun2_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						tag = GER
					}
					NOT = { has_tech = improved_infantry_weapons }
					NOT = { has_country_flag = gun2_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = gun2_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_ARG_VEN_GER_gun3_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = advanced_infantry_weapons
		}

		visible = {
			has_global_flag = yes_gun3
			OR = {
				tag = VEN
				tag = PRU
			}
			has_tech = advanced_infantry_weapons
			any_other_country = {
				is_ai = yes
				tag = GER
				NOT = { has_tech = advanced_infantry_weapons }
				NOT = { has_country_flag = gun3_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = gun3_licensed }
						NOT = { has_tech = advanced_infantry_weapons }
					}
					set_country_flag = gun3_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					is_ai = yes
					OR = {
						tag = GER
					}
					NOT = { has_tech = advanced_infantry_weapons }
					NOT = { has_country_flag = gun3_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_3
						}
						cost_factor = 0
					}
					add_cic = 500
				}
				set_country_flag = gun3_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_arty1_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = gw_artillery
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = gw_artillery }
				NOT = { has_country_flag = arty1_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = arty1_licensed }
						NOT = { has_tech = gw_artillery }
					}
					set_country_flag = arty1_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = gw_artillery }
					NOT = { has_country_flag = arty1_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = artillery_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = arty1_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_arty2_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = artillery1
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = artillery1 }
				NOT = { has_country_flag = arty2_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = arty2_licensed }
						NOT = { has_tech = artillery1 }
					}
					set_country_flag = arty2_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = artillery1 }
					NOT = { has_country_flag = arty2_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = artillery_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 500
				}
				set_country_flag = arty2_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_arty3_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = artillery4
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = artillery4 }
				NOT = { has_country_flag = arty3_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = arty3_licensed }
						NOT = { has_tech = artillery4 }
					}
					set_country_flag = arty3_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = artillery4 }
					NOT = { has_country_flag = arty3_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = artillery_equipment_3
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = arty3_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_aa_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = interwar_antiair
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = interwar_antiair }
				NOT = { has_country_flag = aa_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = aa_licensed }
						NOT = { has_tech = interwar_antiair }
					}
					set_country_flag = aa_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = interwar_antiair }
					NOT = { has_country_flag = aa_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_air_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 1000
				}
				set_country_flag = aa_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_aa2_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = antiair2
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = antiair2 }
				NOT = { has_country_flag = aa2_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = aa2_licensed }
						NOT = { has_tech = antiair2 }
					}
					set_country_flag = aa2_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = antiair2 }
					NOT = { has_country_flag = aa2_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_air_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 500
				}
				set_country_flag = aa2_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	china_to_other_chinas = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			has_tech = interwar_antiair
			has_tech = gw_artillery
		}

		visible = {
			tag = CHI
			has_tech = interwar_antiair
			has_tech = gw_artillery
			any_other_country = {
				OR = {
					tag = GXC
					tag = SHX
					tag = XSM
					tag = YUN
					AND = {
						is_literally_china = yes
						is_in_faction_with = CHI
					}
				}
				is_ai = yes
				NOT = { has_tech = interwar_antiair }
				NOT = { has_tech = gw_artillery }
				NOT = { has_country_flag = china_licensed }
			}
		}

		complete_effect = {
			every_other_country = {
				limit = {
					OR = {
						tag = GXC
						tag = SHX
						tag = XSM
						tag = YUN
						AND = {
							is_literally_china = yes
							is_in_faction_with = CHI
						}
					}
					is_ai = yes
					NOT = { has_tech = interwar_antiair }
					NOT = { has_tech = gw_artillery }
					NOT = { has_country_flag = china_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = anti_air_equipment_1
						}
						cost_factor = 0
					}
					create_production_license = {
						target = PREV
						equipment = {
							type = artillery_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = china_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_gun1_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = infantry_weapons1
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = infantry_weapons1 }
				NOT = { has_country_flag = gun1_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = gun1_licensed }
						NOT = { has_tech = infantry_weapons1 }
					}
					set_country_flag = gun1_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = infantry_weapons1 }
					NOT = { has_country_flag = gun1_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_1
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = gun1_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_gun2_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			is_in_faction = yes
			has_tech = improved_infantry_weapons
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = improved_infantry_weapons }
				NOT = { has_country_flag = gun2_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = gun2_licensed }
						NOT = { has_tech = improved_infantry_weapons }
					}
					set_country_flag = gun2_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = improved_infantry_weapons }
					NOT = { has_country_flag = gun2_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_2
						}
						cost_factor = 0
					}
					add_cic = 200
				}
				set_country_flag = gun2_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	AI_gun3_licensing = {
	
		icon = generic_research

		fire_only_once = no

		allowed = {
			always = yes
		}

		available = {
			is_in_faction = yes
		}

		visible = {
			OR = {
				NOT = { is_in_faction_with = GER }
				GER = { has_equipment = { infantry_equipment > 60000 } }
			}
			is_in_faction = yes
			has_tech = advanced_infantry_weapons
			any_other_country = {
				OR = {
					is_in_faction_with = ROOT
					ROOT = { is_subject_of = PREV }
					is_subject_of = ROOT
				}
				is_ai = yes
				NOT = { has_tech = advanced_infantry_weapons }
				NOT = { has_country_flag = gun3_licensed }
			}
		}

		complete_effect = {
			if = {
				limit = { 
					is_ai = yes
					has_global_flag = mp_selected
				}
				every_other_country = {
					limit = {
						has_opinion = { target = ROOT value > 0 }
						ROOT = { has_opinion = { target = PREV value > 0 } }
						is_ai = no
						NOT = { has_war_with = ROOT }
						OR = {
							is_in_faction_with = ROOT
							AND = {
								is_major = yes
								has_same_ideology = yes
								NOT = { has_global_flag = mp_difficulty }
							}
						}
						NOT = { has_country_flag = gun3_licensed }
						NOT = { has_tech = advanced_infantry_weapons }
					}
					set_country_flag = gun3_licensed
					country_event = { id = LSM_equipment.11 }
				}
			}
			every_other_country = {
				limit = {
					OR = {
						is_in_faction_with = ROOT
						ROOT = { is_subject_of = PREV }
						is_subject_of = ROOT
					}
					is_ai = yes
					NOT = { has_tech = advanced_infantry_weapons }
					NOT = { has_country_flag = gun3_licensed }
				}
				ROOT = {
					create_production_license = {
						target = PREV
						equipment = {
							type = infantry_equipment_3
						}
						cost_factor = 0
					}
					add_cic = 500
				}
				set_country_flag = gun3_licensed
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}
	LSM_CHI_inf = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_literally_china = yes
		}

		visible = {
			is_literally_china = yes
			is_ai = yes
			has_army_experience > 5
			NOT = { has_global_flag = china_giga }
		}

		complete_effect = {
			hidden_effect = {
				ROOT = { 
					division_template = {
						name = "Infantry template 1"			# Rifle Division
						division_names_group = CHI_INF_01
						is_locked = no
						priority = 1

						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 0 y = 2 }
							infantry = { x = 0 y = 3 }
							infantry = { x = 0 y = 4 }

							infantry = { x = 1 y = 0 }
							infantry = { x = 1 y = 1 }
							infantry = { x = 1 y = 2 }
						}
						support = {		
							artillery = { x = 0 y = 0 }		
							anti_air = { x = 0 y = 1 }
						}
					}
					every_country_division = {
						limit = { 
							OR = {
								division_has_majority_template = infantry 
								division_has_majority_template = cavalry 
							}
						}
						change_division_template = {
							division_template = "Infantry template 1" 
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_CHI_inf2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_literally_china = yes
		}

		visible = {
			is_literally_china = yes
			is_ai = yes
			has_army_experience > 5
			has_global_flag = china_giga
		}

		complete_effect = {
			hidden_effect = {
				ROOT = { 
					division_template = {
						name = "Infantry template 2"			# Rifle Division
						division_names_group = CHI_INF_01
						is_locked = no
						priority = 1

						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 0 y = 2 }
							infantry = { x = 0 y = 3 }
							infantry = { x = 0 y = 4 }
						}
					}
					every_country_division = {
						limit = { 
							OR = {
								division_has_majority_template = infantry 
								division_has_majority_template = cavalry 
							}
						}
						change_division_template = {
							division_template = "Infantry template 2" 
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_TANK_reapply = {
	
		icon = generic_research

		fire_only_once = no

		days_re_enable = 180

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				original_tag = GER
				original_tag = USA
			}
			is_ai = yes
			date > 1941.1.1
			has_global_flag = decision_done
		}

		complete_effect = {
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_CAS_reapply = {
	
		icon = generic_research

		fire_only_once = no

		days_re_enable = 180

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				original_tag = GER
				original_tag = ENG
				original_tag = USA
			}
			is_ai = yes
			has_tech = heavy_bombs
			has_tech = improved_small_airframe
			has_tech = engines_3
			has_dlc = "By Blood Alone"
			NOT = { has_tech = advanced_small_airframe }
		}

		complete_effect = {
			hidden_effect = {
				air_experience = -5
				if = { 
					limit = { 
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "Ju-88 E"
						type = small_plane_cas_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_1 = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_2 = bomb_locks
							engine_type_slot = engine_3_1x		
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small
							special_type_slot_3 = empty
						}
						icon = "GFX_GER_CAS1_medium"
						design_team = mio:GER_junkers_organization
					}
				}
				if = { 
					limit = { 
						original_tag = USA
					}
					create_equipment_variant = { 
						name = "A-12"
						type = small_plane_cas_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_1 = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_2 = heavy_bomb_locks
							engine_type_slot = engine_3_1x		
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = empty
							special_type_slot_3 = empty
						}
						icon = "GFX_USA_CAS1_medium"
						design_team = mio:USA_douglas_aircraft_company_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ENG
					}
					create_equipment_variant = { 
						name = "Fairey Gordon"
						type = small_plane_cas_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_1 = heavy_bomb_locks
							fixed_auxiliary_weapon_slot_2 = heavy_bomb_locks
							engine_type_slot = engine_3_1x		
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = empty
							special_type_slot_3 = empty
						}
						icon = "GFX_DEN_basic_small_cas_2"
						design_team = mio:ENG_hawker_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FT_initiate = { #bug exploit, doable by player too if you know what that is
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				original_tag = GER
				original_tag = ENG
				original_tag = USA
				original_tag = SOV
				original_tag = FRA
				original_tag = ITA
			}
			has_capitulated = no
			is_ai = yes
			has_country_flag = plane_licensed
			has_tech = engines_3
			has_tech = aa_hmg
			has_tech = survivability_studies
			has_dlc = "By Blood Alone"
			NOT = { has_tech = advanced_small_airframe }
			NOT = { has_tech = improved_small_airframe }
			NOT = { has_global_flag = vanilla_history }
		}

		complete_effect = {
			hidden_effect = {
				air_experience = -5
				if = { 
					limit = { 
						original_tag = GER
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "Fw-190 A"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small	
						}
						design_team = mio:GER_messerschmitt_organization
					}
				}
				if = { 
					limit = { 
						original_tag = GER
						NOT = { has_tech = aa_hmg }
					}
					create_equipment_variant = { 
						name = "Fw-190 A"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_2 = aircraft_cannon_1_2x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:GER_messerschmitt_organization
					}
				}
				if = { 
					limit = { 
						original_tag = USA
						NOT = { has_tech = aa_hmg }
					}
					create_equipment_variant = { 
						name = "P-36 C"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = light_mg_4x
							fixed_auxiliary_weapon_slot_2 = light_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:USA_north_american_aviation_organization
					}
				}
				if = { 
					limit = { 
						original_tag = USA
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "P-36 C"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:USA_north_american_aviation_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ENG
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "Spitfire"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						icon = "GFX_ENG_fighter2_medium"
						design_team = mio:ENG_supermarine_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ENG
						NOT = { has_tech = aa_hmg }
					}
					create_equipment_variant = { 
						name = "Spitfire"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = light_mg_4x
							fixed_auxiliary_weapon_slot_2 = light_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						icon = "GFX_ENG_fighter2_medium"
						design_team = mio:ENG_supermarine_organization
					}
				}
				if = { 
					limit = { 
						original_tag = SOV
						NOT = { has_tech = aa_hmg }
					}
					create_equipment_variant = { 
						name = "LaGG-2"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_2 = aircraft_cannon_1_2x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:SOV_mig_design_bureau_organization
					}
				}
				if = { 
					limit = { 
						original_tag = SOV
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "LaGG-2"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small			
						}
						design_team = mio:SOV_mig_design_bureau_organization
					}
				}
				if = { 
					limit = { 
						original_tag = FRA
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "Dr. 504"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:FRA_morane_saulnier_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ITA
						has_tech = aa_hmg
					}
					create_equipment_variant = { 
						name = "Cr. 203 Cizzi Dottore A2"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:ITA_macchi_organization
					}
				}
				if = { 
					limit = { 
						original_tag = FRA
						NOT = { has_tech = aa_hmg }
					}
					create_equipment_variant = { 
						name = "Dr. 504"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_1 = aircraft_cannon_1_2x
							fixed_auxiliary_weapon_slot_2 = aircraft_cannon_1_2x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = armor_plate_small 
							special_type_slot_3 = self_sealing_fuel_tanks_small		
						}
						design_team = mio:FRA_morane_saulnier_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FT_reapply = {
	
		icon = generic_research

		fire_only_once = no

		days_re_enable = 240

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				original_tag = GER
				original_tag = ENG
				original_tag = USA
				original_tag = SOV
				original_tag = FRA
				original_tag = ITA
			}
			has_capitulated = no
			is_ai = yes
			OR = {
				AND = {
					has_tech = aa_hmg
					has_tech = improved_small_airframe
					has_tech = engines_3
					has_tech = survivability_studies
				}
				has_country_flag = plane_licensed_ITA
				has_country_flag = fully_equipped_plane
				has_country_flag = plane_licensed_SOV
			}
			date > 1940.1.1
			has_dlc = "By Blood Alone"
			NOT = { has_tech = advanced_small_airframe }
		}

		complete_effect = {
			hidden_effect = {
				air_experience = -5
				if = { 
					limit = { 
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "Fw-190 B"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = armor_plate_small
						}
						design_team = mio:GER_messerschmitt_organization
					}
				}
				if = { 
					limit = { 
						original_tag = USA
					}
					create_equipment_variant = { 
						name = "P-36D"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = fuel_tanks_small	
						}
						design_team = mio:USA_north_american_aviation_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ENG
					}
					create_equipment_variant = { 
						name = "Supermarine Spitfire"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = fuel_tanks_small	
						}
						icon = "GFX_ENG_fighter2_medium"
						design_team = mio:ENG_supermarine_organization
					}
				}
				if = { 
					limit = { 
						original_tag = SOV
					}
					create_equipment_variant = { 
						name = "LaGG-3"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = armor_plate_small	
						}
						design_team = mio:SOV_mig_design_bureau_organization
					}
				}
				if = { 
					limit = { 
						original_tag = FRA
					}
					create_equipment_variant = { 
						name = "Dr. 505"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = fuel_tanks_small	
						}
						design_team = mio:FRA_morane_saulnier_organization
					}
				}
				if = { 
					limit = { 
						original_tag = ITA
					}
					create_equipment_variant = { 
						name = "Cr.203 Cizzi Dottore"
						type = small_plane_airframe_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							fixed_main_weapon_slot = heavy_mg_4x
							fixed_auxiliary_weapon_slot_1 = heavy_mg_4x
							fixed_auxiliary_weapon_slot_2 = heavy_mg_4x
							engine_type_slot = engine_3_1x
							special_type_slot_1 = fuel_tanks_small	
							special_type_slot_2 = self_sealing_fuel_tanks_small 
							special_type_slot_3 = fuel_tanks_small	
						}
						design_team = mio:ITA_macchi_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_GER_the_tank_exists_opening = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			date > 1936.1.15
			NOT = { has_country_flag = mech_god }
			NOT = { has_country_flag = mass_mob_flag }
			NOT = { has_country_flag = mobile_warfare_flag }
			has_army_experience > 12
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				GER = { 
					army_experience = -12
					division_template = {
						name = "Medium Tank template 3"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }
							motorized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = {		
							anti_air = { x = 0 y = 0 }		
							engineer = { x = 0 y = 1 }		
							artillery = { x = 0 y = 2 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}

	}

	LSM_GER_the_tank_exists_opening_MW = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			date > 1936.1.15
			has_country_flag = mobile_warfare_flag
			has_army_experience > 15
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				GER = { 
					army_experience = -15
					division_template = {
						name = "Panzer template 1"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							medium_armor = { x = 3 y = 4 }
							medium_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = {		
							anti_air = { x = 0 y = 0 }		
							engineer = { x = 0 y = 1 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}

	}


	LSM_GER_the_tank_exists_mech = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			has_equipment = { mechanized_equipment > 9999 }
			NOT = { has_country_flag = mass_mob_flag }
			NOT = { has_country_flag = mobile_warfare_flag }
			has_army_experience > 15
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				GER = { 
					army_experience = -5
					division_template = {
						name = "Medium Tank template 9"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							mechanized = { x = 0 y = 0 }
							mechanized = { x = 0 y = 1 }
							mechanized = { x = 0 y = 2 }
							mechanized = { x = 0 y = 3 }
							mechanized = { x = 0 y = 4 }

							mechanized = { x = 1 y = 0 }
							mechanized = { x = 1 y = 1 }
							mechanized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = {		
							anti_air = { x = 0 y = 0 }		
							engineer = { x = 0 y = 1 }		
							logistics_company = { x = 0 y = 2 }
							medium_flame_tank = { x = 0 y = 3 }
							maintenance_company = { x = 0 y = 4 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}

	}


	LSM_GER_gimme_the_tonks = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			date > 1940.8.1
			has_dlc = "No Step Back"
			has_equipment = { medium_tank_chassis > 2000 }
			has_equipment = { mechanized_equipment > 2000 }
			NOT = { has_country_flag = mass_mob_flag }
			NOT = { has_country_flag = mobile_warfare_flag }
			has_army_experience > 35
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				GER = { 
					army_experience = -10
					division_template = {
						name = "Medium Tank template 15"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							mechanized = { x = 1 y = 0 }
							mechanized = { x = 1 y = 1 }
							mechanized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 } 		
							maintenance_company = { x = 0 y = 1 }		
							rangers_support = { x = 0 y = 2 } 		
							logistics_company = { x = 0 y = 3 }
						}
					}
					capital_scope = { #low equipment ratio
						create_unit = {
			division = "name = \"Panzer Division\" division_template = \"Medium Tank template 15\" start_experience_factor = 0.1 start_equipment_factor = 0.02"  
							owner = GER
							allow_spawning_on_enemy_provs = no  
							count = 6
						}
					}
				}
			}
		}
		
		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_the_tank_exists = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			has_tech = basic_medium_tank_chassis
			has_tech = tech_engineers2
			has_tech = antitank1
			has_tech = tech_maintenance_company2
			has_dlc = "No Step Back"
			has_army_experience > 12
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -12
				if = { 
					limit = { 
						original_tag = GER 
						NOT = { has_country_flag = mobile_warfare_flag }
					}
					set_country_flag = GER_P4_tank_is_real
					create_equipment_variant = { 
						name = "Panzer IV"
						type = medium_tank_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_medium_cannon
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_diesel_engine
							special_type_slot_1 = tank_radio_1
							special_type_slot_2 = secondary_turret_hmg
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = easy_maintenance
						}
						upgrades = {
							tank_nsb_engine_upgrade = 6
							tank_nsb_armor_upgrade = 10
						}
						icon = "GFX_GER_basic_medium_tank_medium"
						design_team = mio:GER_daimler_benz_organization
					}
				}
				if = { 
					limit = { 
						NOT = { has_country_flag = GER_flame_tank_is_real } 
						NOT = { has_country_flag = mobile_warfare_flag }
					}
					set_country_flag = GER_flame_tank_is_real
					create_equipment_variant = { 
						name = "Medium Flame Tank I"
						type = medium_tank_flame_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = flamethrower
							turret_type_slot = tank_medium_two_man_tank_turret
							suspension_type_slot = tank_bogie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = empty
							special_type_slot_2 = empty
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 8
							tank_nsb_armor_upgrade = 0
						}
						icon = "GFX_SOV_advanced_heavy_tank_medium"
						design_team = mio:GER_daimler_benz_organization
					}
				}
				if = { 
					limit = { 
						NOT = { has_country_flag = GER_flame_tank_is_real } 
						has_country_flag = mobile_warfare_flag
					}
					set_country_flag = GER_flame_tank_is_real
					create_equipment_variant = { 
						name = "Medium Flame Tank I"
						type = medium_tank_flame_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
			modules = {
				main_armament_slot = flamethrower
				turret_type_slot = tank_light_one_man_tank_turret
				suspension_type_slot = tank_christie_suspension
				armor_type_slot = tank_riveted_armor
				engine_type_slot = tank_gasoline_engine
				special_type_slot_1 = empty
				special_type_slot_2 = empty
				special_type_slot_3 = empty
				special_type_slot_4 = empty
			}
			upgrades = {
				tank_nsb_engine_upgrade = 11
				tank_nsb_armor_upgrade = 0
			}
						design_team = mio:GER_henschel_organization
					}
				}
				GER = {
					if = {
						limit = { 
							NOT = { has_country_flag = mass_mob_flag }  
							NOT = { has_country_flag = mobile_warfare_flag } 
						} 
					division_template = {
						name = "Medium Tank template 12"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }
							motorized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 }
						}
					}
						capital_scope = { #low equipment ratio
							create_unit = {
		division = "name = \"Panzer Divisions\" division_template = \"Medium Tank template 12\" start_experience_factor = 0.2 start_equipment_factor = 0.02"  
								owner = GER
								allow_spawning_on_enemy_provs = yes  
								count = 6
							}
						}
					}
				}
				GER = {
					if = {
						limit = { 
							NOT = { has_country_flag = mass_mob_flag }  
							has_country_flag = mobile_warfare_flag
						} 
					division_template = {
						name = "Medium Tank template 12"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							motorized = { x = 0 y = 0 }
							motorized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							medium_armor = { x = 3 y = 4 }
							medium_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 }		
							engineer = { x = 0 y = 0 }		
							anti_air = { x = 0 y = 0 }		
							mot_recon = { x = 0 y = 0 }
						}
					}
						capital_scope = { #low equipment ratio
							create_unit = {
		division = "name = \"Panzer Divisions\" division_template = \"Medium Tank template 12\" start_experience_factor = 0.2 start_equipment_factor = 0.02"  
								owner = GER
								allow_spawning_on_enemy_provs = yes  
								count = 6
							}
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}


	LSM_USA_the_tank_exists = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = USA
			is_ai = yes
			has_tech = basic_medium_tank_chassis
			has_tech = antitank1
			has_tech = tech_maintenance_company2
			has_dlc = "No Step Back"
			has_army_experience > 30
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -15
				if = { 
					limit = { 
						original_tag = USA
					}
					create_equipment_variant = { 
						name = "M3 Lee"
						type = medium_tank_chassis_1
						parent_version = 0
						allow_without_tech = yes
						modules = {
							main_armament_slot = tank_medium_cannon
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_diesel_engine
							special_type_slot_1 = tank_radio_1
							special_type_slot_2 = secondary_turret_hmg
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = easy_maintenance
						}
						upgrades = {
							tank_nsb_engine_upgrade = 4
							tank_nsb_armor_upgrade = 4
						}
						design_team = mio:USA_chrysler_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_the_tank_exists2 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			has_tech = improved_medium_tank_chassis
			has_tech = antitank3
			NOT = { has_country_flag = mobile_warfare_flag }
			has_dlc = "No Step Back"
			OR = {
				FRA = { has_capitulated = yes }
				date > 1940.3.1
			}
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "Panzer IV"
						type = medium_tank_chassis_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_medium_cannon_2
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_diesel_engine
							special_type_slot_1 = secondary_turret_hmg
							special_type_slot_2 = tank_radio_2
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = wet_ammo_storage
						}
						upgrades = {
							tank_nsb_engine_upgrade = 8
							tank_nsb_armor_upgrade = 14
						}
						icon = "GFX_GER_basic_medium_tank_medium"
						design_team = mio:GER_daimler_benz_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_starting_med_n_TD = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = GER
			has_country_flag = mobile_warfare_flag
			is_ai = yes
			has_tech = basic_medium_tank_chassis
			has_dlc = "No Step Back"
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "StuG I"
						type = medium_tank_destroyer_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon
							turret_type_slot = tank_medium_fixed_superstructure_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_welded_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = tank_radio_1
							special_type_slot_2 = empty
							special_type_slot_3 = sloped_armor
							special_type_slot_4 = wet_ammo_storage
						}
						upgrades = {
							tank_nsb_engine_upgrade = 4
							tank_nsb_armor_upgrade = 9
						}
						design_team = mio:GER_henschel_organization
					}
					create_equipment_variant = {  
						name = "Panzer III"
						type = medium_tank_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_small_cannon_2
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = tank_radio_1
							special_type_slot_2 = secondary_turret_hmg
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = wet_ammo_storage
						}
						upgrades = {
							tank_nsb_engine_upgrade = 0
							tank_nsb_armor_upgrade = 4
						}
						design_team = mio:GER_henschel_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_improv_med_n_TD = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			tag = GER
			has_country_flag = mobile_warfare_flag
			is_ai = yes
			has_tech = improved_medium_tank_chassis
			has_tech = antitank3
			has_tech = tech_maintenance_company2
			has_dlc = "No Step Back"
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "StuG IV"
						type = medium_tank_destroyer_chassis_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon_2
							turret_type_slot = tank_medium_fixed_superstructure_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_welded_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = tank_radio_2
							special_type_slot_2 = armor_skirts
							special_type_slot_3 = sloped_armor
							special_type_slot_4 = easy_maintenance
						}
						upgrades = {
							tank_nsb_engine_upgrade = 14
							tank_nsb_armor_upgrade = 9
						}
						design_team = mio:GER_henschel_organization
					}
					create_equipment_variant = { 
						name = "Panzer IV"
						type = medium_tank_chassis_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_medium_cannon_2
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = tank_radio_2
							special_type_slot_2 = secondary_turret_hmg
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = easy_maintenance
						}
						upgrades = {
							tank_nsb_engine_upgrade = 14
							tank_nsb_armor_upgrade = 9
						}
						design_team = mio:GER_henschel_organization
					}
					create_equipment_variant = { 
						name = "Flammenpanzer II"
						type = medium_tank_flame_chassis_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = flamethrower
							turret_type_slot = tank_light_one_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = easy_maintenance
							special_type_slot_2 = empty
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 1
							tank_nsb_armor_upgrade = 0
						}
						design_team = mio:GER_henschel_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_starting_TD = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			OR = {
				tag = GER
				tag = USA
			}
			is_ai = yes
			has_tech = basic_heavy_tank_chassis
			has_dlc = "No Step Back"
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "StuG I"
						type = heavy_tank_destroyer_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon
							turret_type_slot = tank_medium_fixed_superstructure_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = empty
							special_type_slot_2 = sloped_armor
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 0
							tank_nsb_armor_upgrade = 4
						}
						design_team = mio:GER_porsche_organization
					}
				}
				if = { 
					limit = {
						original_tag = USA
					}
					create_equipment_variant = { 
						name = "Experimental Anti-Armor Vehicle"
						type = heavy_tank_destroyer_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon
							turret_type_slot = tank_heavy_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = wet_ammo_storage
							special_type_slot_2 = sloped_armor
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 0
							tank_nsb_armor_upgrade = 4
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_GER_the_tank_exists_tiger = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			has_tech = improved_heavy_tank_chassis
			has_tech = tech_maintenance_company2
			has_tech = antitank2
			has_dlc = "No Step Back"
			OR = {
				FRA = { has_capitulated = yes }
				date > 1940.3.1
			}
			has_army_experience > 25
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -5
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "Tiger II"
						type = heavy_tank_destroyer_chassis_2
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon_2
							turret_type_slot = tank_medium_fixed_superstructure_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_welded_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = wet_ammo_storage
							special_type_slot_2 = sloped_armor
							special_type_slot_3 = easy_maintenance
							special_type_slot_4 = armor_skirts
						}
						upgrades = {
							tank_nsb_engine_upgrade = 2
							tank_nsb_armor_upgrade = 14
						}
						design_team = mio:GER_porsche_organization
					}
				}
				GER = { 
					division_template = {
						name = "Medium Tank template 16"			
						division_names_group = GER_ARM_01
						is_locked = no
						priority = 2

						regiments = {
							mechanized = { x = 0 y = 0 }
							mechanized = { x = 0 y = 1 }
							motorized = { x = 0 y = 2 }
							motorized = { x = 0 y = 3 }
							motorized = { x = 0 y = 4 }

							motorized = { x = 1 y = 0 }
							motorized = { x = 1 y = 1 }
							motorized = { x = 1 y = 2 }

							medium_armor = { x = 2 y = 0 }
							medium_armor = { x = 2 y = 1 }
							medium_armor = { x = 2 y = 2 }
							medium_armor = { x = 2 y = 3 }
							medium_armor = { x = 2 y = 4 }

							medium_armor = { x = 3 y = 0 }
							medium_armor = { x = 3 y = 1 }
							medium_armor = { x = 3 y = 2 }
							medium_armor = { x = 3 y = 3 }
							heavy_tank_destroyer_brigade = { x = 4 y = 0 }
						}
						support = { 		
							medium_flame_tank = { x = 0 y = 0 } 		
							maintenance_company = { x = 0 y = 1 } 		
							engineer = { x = 0 y = 2 } 		
							anti_air = { x = 0 y = 3 } 		
							logistics_company = { x = 0 y = 4 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_USA_the_tank_exists_m26a3 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = USA
			is_ai = yes
			has_tech = advanced_heavy_tank_chassis
			has_tech = engine_tech_2
			has_tech = armor_tech_4
			has_tech = antitank5
			has_tech = tech_maintenance_company2
			has_dlc = "No Step Back"
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -50
				if = { 
					limit = {
						original_tag = USA
					}
					create_equipment_variant = { 
						name = "M26A3 G1"
						type = heavy_tank_destroyer_chassis_3
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_high_velocity_cannon_3
							turret_type_slot = tank_heavy_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_welded_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = tank_radio_3
							special_type_slot_2 = easy_maintenance
							special_type_slot_3 = armor_skirts
							special_type_slot_4 = sloped_armor
						}
						upgrades = {
							tank_nsb_engine_upgrade = 14
							tank_nsb_armor_upgrade = 20
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}
	LSM_GER_the_tank_exists3 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = GER
			is_ai = yes
			date > 1943.4.1
			has_tech = advanced_medium_tank_chassis
			has_tech = tech_maintenance_company2
			OR = {
				TUR = { is_in_faction_with = GER }
				all_state = {
					OR = {
						NOT = { is_core_of = TUR }
						controller = { is_in_faction_with = GER }
					}
				}
			}
		}

		complete_effect = {
			custom_effect_tooltip = "We are a tank nation"
			hidden_effect = {
				army_experience = -15
				if = { 
					limit = {
						original_tag = GER
					}
					create_equipment_variant = { 
						name = "Panther"
						type = medium_tank_chassis_3
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_medium_cannon_2
							turret_type_slot = tank_medium_three_man_tank_turret
							suspension_type_slot = tank_christie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_diesel_engine
							special_type_slot_1 = tank_radio_3
							special_type_slot_2 = secondary_turret_hmg
							special_type_slot_3 = secondary_turret_hmg
							special_type_slot_4 = easy_maintenance
						}
						upgrades = {
							tank_nsb_engine_upgrade = 8
							tank_nsb_armor_upgrade = 20
						}
						icon = "GFX_GER_advanced_medium_tank_medium"
						design_team = mio:GER_daimler_benz_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_the_tank_exists = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = FRA
			is_ai = yes
			has_dlc = "No Step Back"
			has_army_experience > 12
		}

		complete_effect = {
			custom_effect_tooltip = "We ARE the real tank nation"
			hidden_effect = {
				delete_units = {
					division_template = "Division d'Infanterie Motorisée"
					disband = yes
				}
				delete_units = {
					division_template = "Division Légère Mécanique"
					disband = yes
				}
				delete_units = {
					division_template = "Brigade de Chars de Combat"
					disband = yes
				}
				if = { 
					limit = { 
						NOT = { has_country_flag = FRA_tank_is_real }
					}
					army_experience = -20
					set_country_flag = FRA_tank_is_real
					create_equipment_variant = { 
						name = "Char B2"
						type = heavy_tank_destroyer_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon
							turret_type_slot = tank_heavy_three_man_tank_turret
							suspension_type_slot = tank_bogie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = secondary_turret_small_cannon
							special_type_slot_2 = secondary_turret_small_cannon
							special_type_slot_3 = empty
							special_type_slot_4 = empty
						}
						upgrades = {
							tank_nsb_engine_upgrade = 0
							tank_nsb_armor_upgrade = 4
						}
						icon = "GFX_SOV_advanced_heavy_tank_medium"
						design_team = mio:FRA_renault_organization
					}
					division_template = {
						name = "Heavy Tank template 2"			# Rifle Division
						division_names_group = FRA_ARM_01
						is_locked = no
						priority = 1

						regiments = {
							camelry = { x = 0 y = 0 }
							camelry = { x = 0 y = 1 }
							camelry = { x = 0 y = 2 }
							camelry = { x = 0 y = 3 }
							camelry = { x = 0 y = 4 }

							camelry = { x = 1 y = 0 }
							camelry = { x = 1 y = 1 }

							heavy_tank_destroyer_brigade = { x = 2 y = 0 }
							heavy_tank_destroyer_brigade = { x = 2 y = 1 }
							heavy_tank_destroyer_brigade = { x = 2 y = 2 }
							heavy_tank_destroyer_brigade = { x = 2 y = 3 }
							heavy_tank_destroyer_brigade = { x = 2 y = 4 }

							heavy_tank_destroyer_brigade = { x = 3 y = 0 }
							heavy_tank_destroyer_brigade = { x = 3 y = 1 }
							heavy_tank_destroyer_brigade = { x = 3 y = 2 }
						}
						support = { 		
							engineer = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 }
						}
					}
					division_template = {
						name = "Infantry template 2"			# Rifle Division
						division_names_group = FRA_INF_01
						is_locked = no
						priority = 1

						regiments = {
							infantry = { x = 0 y = 0 }
							infantry = { x = 0 y = 1 }
							infantry = { x = 0 y = 2 }
							infantry = { x = 0 y = 3 }
							infantry = { x = 0 y = 4 }

							infantry = { x = 1 y = 0 }
							infantry = { x = 1 y = 1 }
						}
						support = { 		
							engineer = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 }
						}
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_the_tank_exists14 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = FRA
			is_ai = yes
			has_dlc = "No Step Back"
			has_tech = antitank2
		}

		complete_effect = {
			custom_effect_tooltip = "We ARE the real tank nation"
			hidden_effect = {				
				FRA = {
					create_equipment_variant = { 
						name = "Char B3"
						type = heavy_tank_destroyer_chassis_1
						parent_version = 0
						allow_without_tech = yes # Tooltip purposes, tech is required anyways
						modules = {
							main_armament_slot = tank_heavy_cannon_2
							turret_type_slot = tank_heavy_three_man_tank_turret
							suspension_type_slot = tank_bogie_suspension
							armor_type_slot = tank_riveted_armor
							engine_type_slot = tank_gasoline_engine
							special_type_slot_1 = secondary_turret_small_cannon
							special_type_slot_2 = secondary_turret_small_cannon
							special_type_slot_3 = secondary_turret_small_cannon
							special_type_slot_4 = secondary_turret_small_cannon
						}
						upgrades = {
							tank_nsb_engine_upgrade = 0
							tank_nsb_armor_upgrade = 9
						}
						design_team = mio:FRA_renault_organization
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_the_tank_exists33 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = FRA
			is_ai = yes
			has_dlc = "No Step Back"
			date > 1937.1.1
			has_army_experience > 10
		}

		complete_effect = {
			custom_effect_tooltip = "We ARE the real tank nation"
			hidden_effect = {
				if = {
					limit = { NOT = { has_country_flag = fastgaming } }
					division_template = {
						name = "Heavy Tank template 6"			# Rifle Division
						division_names_group = FRA_ARM_01
						is_locked = no
						priority = 1

						regiments = {
							camelry = { x = 0 y = 0 }
							camelry = { x = 0 y = 1 }
							camelry = { x = 0 y = 2 }
							camelry = { x = 0 y = 3 }
							camelry = { x = 0 y = 4 }

							camelry = { x = 1 y = 0 }
							camelry = { x = 1 y = 1 }

							heavy_tank_destroyer_brigade = { x = 2 y = 0 }
							heavy_tank_destroyer_brigade = { x = 2 y = 1 }
							heavy_tank_destroyer_brigade = { x = 2 y = 2 }
							heavy_tank_destroyer_brigade = { x = 2 y = 3 }
							heavy_tank_destroyer_brigade = { x = 2 y = 4 }

							heavy_tank_destroyer_brigade = { x = 3 y = 0 }
							heavy_tank_destroyer_brigade = { x = 3 y = 1 }
							heavy_tank_destroyer_brigade = { x = 3 y = 2 }
						}
						support = { 		
							engineer = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 }
						}
					}
				16 = {
					create_unit = {
				division = "name = \"Heavy Tank template\" division_template = \"Heavy Tank template 6\" start_experience_factor = 0.2 start_equipment_factor = 0.05"  
						owner = FRA 
						count = 6
					}
				}
				}
				if = {
					limit = { has_country_flag = fastgaming }
				16 = {
					create_unit = {
				division = "name = \"Medium Tank template\" division_template = \"Medium Tank template 2\" start_experience_factor = 0.2 start_equipment_factor = 0.1"  
						owner = FRA 
						count = 6
					}
				}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	LSM_FRA_the_tank_exists34 = {
	
		icon = generic_research

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = yes
		}

		visible = {
			original_tag = FRA
			is_ai = yes
			has_dlc = "No Step Back"
			date > 1938.11.1
			has_war = no
			has_global_flag = FRA_decolonisation_historical
			has_army_experience > 25
		}

		complete_effect = {
			custom_effect_tooltip = "We ARE the real tank nation"
			hidden_effect = {
				if = {
					limit = { NOT = { has_country_flag = fastgaming } }
					division_template = {
						name = "Heavy Tank template 6"			# Rifle Division
						division_names_group = FRA_ARM_01
						is_locked = no
						priority = 1

						regiments = {
							camelry = { x = 0 y = 0 }
							camelry = { x = 0 y = 1 }
							camelry = { x = 0 y = 2 }
							camelry = { x = 0 y = 3 }
							camelry = { x = 0 y = 4 }

							camelry = { x = 1 y = 0 }
							camelry = { x = 1 y = 1 }

							heavy_tank_destroyer_brigade = { x = 2 y = 0 }
							heavy_tank_destroyer_brigade = { x = 2 y = 1 }
							heavy_tank_destroyer_brigade = { x = 2 y = 2 }
							heavy_tank_destroyer_brigade = { x = 2 y = 3 }
							heavy_tank_destroyer_brigade = { x = 2 y = 4 }

							heavy_tank_destroyer_brigade = { x = 3 y = 0 }
							heavy_tank_destroyer_brigade = { x = 3 y = 1 }
							heavy_tank_destroyer_brigade = { x = 3 y = 2 }
						}
						support = { 		
							engineer = { x = 0 y = 0 } 		
							artillery = { x = 0 y = 1 } 		
							anti_air = { x = 0 y = 2 }
						}
					}

				16 = {
					create_unit = {
				division = "name = \"Heavy Tank template\" division_template = \"Heavy Tank template 6\" start_experience_factor = 0.2 start_equipment_factor = 0.05"  
						owner = FRA 
						count = 6
					}
				}
				}
				if = {
					limit = { has_country_flag = fastgaming }
				16 = {
					create_unit = {
				division = "name = \"Medium Tank template\" division_template = \"Medium Tank template 2\" start_experience_factor = 0.2 start_equipment_factor = 0.1"  
						owner = FRA 
						count = 6
					}
				}
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	crossing_the_pacific_decision = {
	
		icon = generic_merge_plant_ship

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
				AND = {
					custom_trigger_tooltip =  {
						tooltip = "China is ourselves, friendly, or not a threat"
						OR = {	
							NOT = { has_war_with = CHI }
							CHI = { has_capitulated = yes }
						}
						OR = {
							CHI = { exists = no }
							CHI = { is_subject = yes }
							CHI = { is_major = no }
							CHI = { has_capitulated = yes }
							CHI = { is_in_faction_with = ROOT }
							CHI = { has_non_aggression_pact_with = ROOT }
							tag = CHI
						}
					}
					custom_trigger_tooltip =  {
						tooltip = "Japan is ourselves, friendly, or not a threat"
						OR = {	
							NOT = { has_war_with = JAP }
							JAP = { has_capitulated = yes }
						}
						OR = {
							JAP = { exists = no }
							JAP = { is_subject = yes }
							JAP = { is_major = no }
							JAP = { has_capitulated = yes }
							JAP = { is_in_faction_with = ROOT }
							JAP = { has_non_aggression_pact_with = ROOT }	
							tag =JAP
						}
					}
					custom_trigger_tooltip =  {
						tooltip = "Indonesia is ourselves, friendly, or not a threat"
						OR = {	
							NOT = { has_war_with = INS }
							INS = { has_capitulated = yes }
						}
						OR = {
							INS = { exists = no }
							INS = { has_capitulated = yes }
							INS = { is_in_faction_with = ROOT }
							INS = { has_non_aggression_pact_with = ROOT }
							INS = { is_subject = no }
							tag = INS
						}
					}
					custom_trigger_tooltip =  {
						tooltip = "India is ourselves, friendly, or not a threat"
						OR = {	
							NOT = { has_war_with = RAJ }
							RAJ = { has_capitulated = yes }
						}
						OR = {
							RAJ = { exists = no }
							RAJ = { has_capitulated = yes }
							RAJ = { is_in_faction_with = ROOT }
							RAJ = { has_non_aggression_pact_with = ROOT }
							RAJ = { is_subject = no }
							tag = RAJ
						}
					}
				}					
		}

		visible = {
			world_war_is_active = yes
			custom_trigger_tooltip =  {
				tooltip = "The battle for the New World has begun" 	
				any_controlled_state = { is_coastal = yes }
				OR = {
					any_country = {
						AND = { 
							capital_scope = {
								is_on_continent = north_america
							}
							has_war_with = ROOT
							is_major = yes
						}
					}
					any_country = {
						AND = { 
							capital_scope = {
								is_on_continent = south_america
							}
							has_war_with = ROOT
							is_major = yes
						}
					}
				}
				NOT = { 
					capital_scope = {
						OR = { 
							is_on_continent = south_america
							is_on_continent = north_america
						}
					}
				}
				OR = { 
					capital_scope = {
						OR = { 
							is_on_continent = asia
							is_on_continent = oceania
						}
					}
					AND = { 
						tag = SOV
						GER = { has_idea = GER_SOV_hitler_stalin_pact }
					}
				}
			}	
		}

		days_remove = 365

		modifier = {
			consumer_goods_factor = 0.5
		}

		complete_effect = {
			add_timed_idea = { idea = crossing_the_pacific_idea days = 1825 }
			hidden_effect = {
				if = {
					limit = {
						ROOT = { is_faction_leader = yes }	
						NOT = { has_global_flag = cta_event_fired }
					}
					set_global_flag = cta_event_fired
					news_event = { hours = 12 id = lsm_news.5 }
				}
			}
		}

		remove_effect = {
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = asia
					is_coastal = yes
					arms_factory < 1
				}
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = dockyard
					level = 2
					instant_build = yes
				}
				hidden_effect = {
					random_state = {
						limit = {
							is_fully_controlled_by = ROOT
							is_on_continent = asia
							NOT = { is_coastal = yes }
							arms_factory > 1
						}
						remove_building = {
							type = arms_factory
							level = 2
						}
					}
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = asia
					is_coastal = yes
					AND = {
						arms_factory < 2
						arms_factory > 0
					}
				}
				add_extra_state_shared_building_slots = 3
				remove_building = {
						type = arms_factory
						level = 1
					}
				add_building_construction = {
					type = dockyard
					level = 2
					instant_build = yes
				}
				hidden_effect = {
					random_state = {
						limit = {
							is_fully_controlled_by = ROOT
							is_on_continent = asia
							NOT = { is_coastal = yes }
							arms_factory > 0
						}
						remove_building = {
							type = arms_factory
							level = 1
						}
					}
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = asia
					is_coastal = yes
					arms_factory > 1
				}
				remove_building = {
						type = arms_factory
						level = 2
					}
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}

		ai_will_do = {
			factor = 9999
		}
	}

	the_battle_for_the_new_world_decision = {
	
		icon = generic_merge_plant_ship

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip =  {
				tooltip = "Europe/Asia have fallen"
				OR = { 
					any_country = {
						has_idea = crossing_the_atlantic_idea
						is_major = yes
					} 
					any_country = { 
						has_idea = crossing_the_pacific_idea
						is_major = yes
					}
				}
				OR = { 
					capital_scope = { is_on_continent = south_america }
					capital_scope = { is_on_continent = north_america }
				}
			}					
		}

		visible = {
			is_historical_focus_on = yes
			AND = {
				is_subject = no
				OR = { 
					capital_scope = { is_on_continent = south_america }
					capital_scope = { is_on_continent = north_america }
				}
				any_country = {
					AND = {
						OR = { 
							has_idea = crossing_the_atlantic_idea 
							has_idea = crossing_the_pacific_idea
						}
						OR = {
							AND = {
								NOT = { is_in_faction_with = ROOT }
								NOT = { has_war_together_with = ROOT }
							}
							has_war_with = ROOT
						}
						is_major = yes
					}
				}		
			}	
		}

		complete_effect = {
			country_event = LSM_new_world_diplomacy.1
			set_country_flag = LSM_new_world_diplomacy
		}

		ai_will_do = {
			factor = 100000
		}
	}

	the_new_world_surrender = {
	
		icon = generic_political_discourse

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip =  {
				tooltip = "Years have gone by already, let's stop. Requires <5% surrender progress btw"	
				has_country_flag = {
					flag = american_summit_success
					days > 4000
				}
				surrender_progress < 0.01
				is_subject = no
			}					
		}

		visible = {
			has_country_flag = american_summit_success
			is_historical_focus_on = yes
		}

		complete_effect = {
			hidden_effect = {
				every_other_country = { 
					remove_from_faction = ROOT
					white_peace = ROOT
					set_truce = {
						target = ROOT
						days = 3650 #don't touch us please
					}
				}
				set_global_flag = treaty_of_america
				add_ideas = defeat_in_the_second_world_war_idea
				every_other_country = {
					ROOT = {
						add_ai_strategy = {
							type = alliance
							id = PREV
							value = -9999
						}
					}
					add_ai_strategy = {
						type = alliance
						id = ROOT
						value = -9999
					}
					add_ai_strategy = {
						type = conquer
						id = ROOT
						value = -1000
					}
					add_ai_strategy = {
						type = antagonize
						id = ROOT
						value = -1000
					}
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = -1000
					}
				}
			}
		}

		ai_will_do = {
			factor = 9999
			modifier = {
				OR = {
					AND = { 
						is_in_faction_with = ENG
						OR = {
							AND = {
								ENG = { has_capitulated = yes }	
								ENG = { surrender_progress < 0.4 } #we reclaimed the British Isles
							}
						}
					}
					any_country = {
						is_in_faction_with = ROOT
						any_owned_state = { 
							is_on_continent = europe
							controller = { is_in_faction_with = ROOT }
						}
					}
				}	
				factor = 0 
			}
			modifier = {
				NOT = { 
					any_country = {
						has_war_with = ROOT
						capital_scope = { is_on_continent = europe } #can still win this
					}
				}
				factor = 0 
			}
		}
	}

	the_summit_of_the_new_world_decision = {
	
		icon = generic_political_rally

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			custom_trigger_tooltip =  {
				tooltip = "Agreed to fight"
				has_country_flag = american_summit					
			}	
		}

		visible = {
			has_country_flag = american_summit	
		}

		days_remove = 30

		complete_effect = {
			add_ideas = the_final_bastion_idea
			set_country_flag = american_summit_success
		}

		remove_effect = {
			if = { 
				limit = {
					tag = USA
					is_faction_leader = yes	
				}
				every_country = { 
					limit = { has_country_flag = american_summit }
					USA = { add_to_faction = PREV }
				}
			}
			set_rule = { can_join_factions = yes }
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_coastal = yes
					arms_factory < 3
				}
				add_extra_state_shared_building_slots = 3
				add_building_construction = {
					type = dockyard
					level = 2
					instant_build = yes
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_coastal = yes
					AND = {
						arms_factory < 3
						arms_factory > 1
					}
				}
				add_extra_state_shared_building_slots = 3
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_coastal = yes
					arms_factory > 1
				}
				add_extra_state_shared_building_slots = 3
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}

		ai_will_do = {
			factor = 99999
		}
	}

	crossing_the_atlantic_decision = {
	
		icon = generic_naval

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			AND = {
					OR = {
						custom_trigger_tooltip =  {
							tooltip = "The Soviet Union is ourselves, friendly, or not a threat"	
							AND = {
								NOT = { has_war_with = SOV }
								OR = {
									SOV = { exists = no }
									SOV = { is_subject = yes }
									SOV = { is_major = no }
									SOV = { has_capitulated = yes }
									SOV = { is_in_faction_with = ROOT }
									tag = SOV
								}
							}
						}
						AND = {
							is_in_faction_with = GER
							SOV = { has_idea = GER_SOV_hitler_stalin_pact }
						}
					}	
					OR = {
						custom_trigger_tooltip =  {
							tooltip = "Britain is ourselves, friendly, or not a threat"	
							AND = {
								OR = {	
									NOT = { has_war_with = ENG }
									ENG = { has_capitulated = yes }
								}
								OR = {
									ENG = { exists = no }
									ENG = { is_subject = yes }
									ENG = { is_major = no }
									ENG = { has_capitulated = yes }
									ENG = { is_in_faction_with = ROOT }
									ENG = { has_non_aggression_pact_with = ROOT }
									tag = ENG
								}
							}
						}
						AND = {
							is_in_faction_with = GER
							ENG = { has_idea = ENG_defeat_in_world_war_ii }
						}
						AND = {
							has_war_with = ENG
							OR = {
								SOV = { has_country_flag = LSM_eligibility_nation }
								SOV = { is_in_faction_with = ROOT }
								tag = SOV
							}
						}
					}
					AND = {
						custom_trigger_tooltip =  {
							tooltip = "France is ourselves, friendly, or not a threat"
							OR = {	
								NOT = { has_war_with = FRA }
								FRA = { has_capitulated = yes }
							}
							OR = {
								FRA = { exists = no }
								FRA = { is_subject = yes }
								FRA = { is_major = no }
								FRA = { has_capitulated = yes }
								FRA = { is_in_faction_with = ROOT }
								FRA = { has_non_aggression_pact_with = ROOT }
								tag = FRA
							}
						}
					}
					OR = {
						custom_trigger_tooltip =  {
							tooltip = "Germany is ourselves, friendly, or not a threat"	
							AND = {
								OR = {	
									NOT = { has_war_with = GER }
									GER = { has_capitulated = yes }
								}
								OR = {
									GER = { exists = no }
									GER = { is_subject = yes }
									GER = { is_major = no }
									GER = { has_capitulated = yes }
									GER = { is_in_faction_with = ROOT }
									GER = { has_non_aggression_pact_with = ROOT }
									tag = GER
								}
							}
						}
						AND = {
							is_in_faction_with = SOV
							GER = { has_idea = GER_SOV_hitler_stalin_pact }
						}
					}
					AND = {
						custom_trigger_tooltip =  {
							tooltip = "Italy is ourselves, friendly, or not a threat"
							OR = {	
								NOT = { has_war_with = ITA }
								ITA = { has_capitulated = yes }
							}
							OR = {
								ITA = { exists = no }
								ITA = { is_subject = yes }
								ITA = { is_major = no }
								ITA = { has_capitulated = yes }
								ITA = { is_in_faction_with = ROOT }
								ITA = { has_non_aggression_pact_with = ROOT }
								tag = ITA
							}
						}
					}
			}					
		}

		visible = { 
				world_war_is_active = yes	
				any_controlled_state = { is_coastal = yes }
				OR = {
					any_country = {
						AND = { 
							capital_scope = {
								is_on_continent = north_america
							}
							has_war_with = ROOT
							is_major = yes
						}
					}
					any_country = {
						AND = { 
							capital_scope = {
								is_on_continent = south_america
							}
							has_war_with = ROOT
							is_major = yes
						}
					}
				}
				NOT = { 
					capital_scope = {
						OR = { 
							is_on_continent = south_america
							is_on_continent = north_america
						}
					}
				} 
				capital_scope = {
					OR = { 
						is_on_continent = europe
						is_on_continent = africa
					}
				}
		}

		complete_effect = {
			add_timed_idea = { idea = crossing_the_atlantic_idea days = 1825 }
			hidden_effect = {
				if = {
					limit = {
						ROOT = { is_faction_leader = yes }	
						NOT = { has_global_flag = cta_event_fired }
					}
					set_global_flag = cta_event_fired
					news_event = { hours = 12 id = lsm_news.4 }
				}
			}
		}

		days_remove = 365

		modifier = {
			consumer_goods_factor = 0.5
		}

		remove_effect = {
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = europe
					is_coastal = yes
					arms_factory < 1
				}
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = dockyard
					level = 2
					instant_build = yes
				}
				hidden_effect = {
					random_state = {
						limit = {
							is_fully_controlled_by = ROOT
							is_on_continent = europe
							NOT = { is_coastal = yes }
							arms_factory > 1
						}
						remove_building = {
							type = arms_factory
							level = 2
						}
					}
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = europe
					is_coastal = yes
					AND = {
						arms_factory < 2
						arms_factory > 0
					}
				}
				add_extra_state_shared_building_slots = 2
				remove_building = {
						type = arms_factory
						level = 1
					}
				add_building_construction = {
					type = dockyard
					level = 2
					instant_build = yes
				}
				hidden_effect = {
					random_state = {
						limit = {
							is_fully_controlled_by = ROOT
							is_on_continent = europe
							NOT = { is_coastal = yes }
							arms_factory > 0
						}
						remove_building = {
							type = arms_factory
							level = 1
						}
					}
				}
			}
			every_state = {
				limit = {
					is_fully_controlled_by = ROOT
					is_on_continent = europe
					is_coastal = yes
					arms_factory > 1
				}
				remove_building = {
						type = arms_factory
						level = 2
					}
				add_building_construction = {
					type = dockyard
					level = 1
					instant_build = yes
				}
			}
		}

		ai_will_do = {
			factor = 50
			modifier = {
				factor = 0
				any_country = {
					has_war_with = ROOT
					capital_scope = { is_on_continent = europe }
					is_faction_leader = yes
					num_of_military_factories > 75
				}
			}
		}
	}

	i_want_to_lag_like_ai_too = {
	
		icon = generic_military

		fire_only_once = yes

		allowed = {
			always = yes	
		}

		available = {
			surrender_progress > 0.1	
			tag = GER
		}

		visible = {
			is_ai = no
			has_war = yes	
		}
		
		fire_only_once = yes

		complete_effect = {
			custom_effect_tooltip = "Criminal Cheese State"
			hidden_effect = { 
				set_country_flag = i_want_cheese
			}
		}
	}

	Laststandecisionenablism = {
	
		icon = generic_ignite_civil_war

		fire_only_once = no

		allowed = {
			always = yes	
		}

		available = {
			is_ai = no
		}

		visible = {
			is_ai = no	
			NOT = { has_global_flag = enclave_enabled }
			NOT = { has_global_flag = never_ask_again }
			has_global_flag = this_is_allowed
			date < 1936.1.2
		}

		complete_effect = {
			custom_effect_tooltip = "It will enable the old buff system for AI. Will also enable various other settings in the game, including GER Blitzkrieg. Yours will appear when you start losing."
			custom_effect_tooltip = "Will also enable various other decisions for AIs and player where applicable. Disable it for the default experience. Note: Endsieg will still trigger for Germany whether or not it is enabled."
			hidden_effect = { 
				set_global_flag = enclave_enabled
				if = {
					limit = {
						NOT = { GER = { has_dynamic_modifier = { modifier = GER_blitzkrieg_modifier } } }
						GER = { has_war = yes }
					}
					GER = { add_dynamic_modifier = { modifier = GER_blitzkrieg_modifier } }
				}
			}
		}
	}

	Laststandecisiondisablism = {
	
		icon = generic_consumer_goods

		fire_only_once = no

		allowed = {
			always = yes	
		}

		available = {
			is_ai = no
		}

		visible = {
			is_ai = no
			has_global_flag = enclave_enabled	
		}

		complete_effect = {
			custom_effect_tooltip = "It will disable the militia stuffs for everyone"
			hidden_effect = { 
				clr_global_flag = enclave_enabled
				if = {
					limit = {
						GER = { has_dynamic_modifier = { modifier = GER_blitzkrieg_modifier } }
					}
					GER = { remove_dynamic_modifier = { modifier = GER_blitzkrieg_modifier } }
				}
			}
		}
	}

	LSM_war_support_enable = {
	
		icon = generic_reorganize_irregulars

		fire_only_once = no

		allowed = {
			always = yes	
		}

		available = {
			is_ai = no
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = LSM_war_support }	
			NOT = { has_global_flag = never_ask_again }
			has_global_flag = lmao_are_we_good_now
		}

		complete_effect = {
			custom_effect_tooltip = "Militia spawns will now ignore war support threshold"
			hidden_effect = { 
				set_global_flag = LSM_war_support
			}
		}
	}

	LSM_war_support_disable = {
	
		icon = generic_disband_irregulars

		fire_only_once = no

		allowed = {
			always = yes	
		}

		available = {
			is_ai = no
		}

		visible = {
			is_ai = no
			has_global_flag = LSM_war_support	
		}

		complete_effect = {
			custom_effect_tooltip = "Militia spawns will no longer ignore war support threshold"
			hidden_effect = { 
				clr_global_flag = LSM_war_support
			}
		}
	}

	i_hate_supply_problem = {
	
		icon = hol_draw_up_staff_plans

		fire_only_once = yes

		allowed = {
			always = yes	
		}

		available = {
			custom_trigger_tooltip =  {
				tooltip = "ok, you aren't fascist. maybe not yet at least"
				NOT = { has_government = fascism }
			}	
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = mp_difficulty }
			NOT = { has_global_flag = supply_hub_spawn }
			date < 1936.1.2	
		}

		complete_effect = {
			custom_effect_tooltip = "I hope this gonna help"
			hidden_effect = {
				set_global_flag = supply_hub_spawn	
				every_state = {
					add_building_construction = {
						type = supply_node
						level = 1
						instant_build = yes
						province = {
							all_provinces = yes
							limit_to_victory_point > 0
						}
					}
				}
			}
		}
	}
	
	last_stand_decision = {

		icon = generic_prepare_civil_war
		
		state_target = yes

		target_array = ROOT.controlled_states
		
		on_map_mode = map_and_decisions_view
		
		allowed = {
			always = yes
		}

		target_trigger = {
			custom_trigger_tooltip =  {
				tooltip = "State can be mobilised"
				FROM = {
					AND = { 
						eligible_for_last_stand = yes
						is_controlled_by = ROOT
						is_core_of = ROOT
						is_owned_by = ROOT
					}
				}
			}
		}

		available = {
			OR = { 
				custom_trigger_tooltip =  {
					tooltip = "Can ignore war support"
					has_global_flag = LSM_war_support
				}
				has_war_support > 0.49
				AND = { #fighting til the bitter end
					has_war_support > 0.24
					OR = { 
						has_idea = tot_economic_mobilisation
						has_idea = scraping_the_barrel
						has_idea = closed_economy
					}
				}
				AND = { #Ultimate Victory
					has_war_support > 0.09
					has_idea = tot_economic_mobilisation
					has_idea = scraping_the_barrel
				}
				AND = { #Ultimate Victory
					has_war_support > 0.09
					has_idea = tot_economic_mobilisation
					has_idea = closed_economy
				}
				AND = { #Ultimate Victory
					has_war_support > 0.09
					has_idea = closed_economy
					has_idea = scraping_the_barrel
				}
				AND = { #North Korea Simulation
					has_idea = closed_economy
					has_idea = scraping_the_barrel
					has_idea = tot_economic_mobilisation
				}
			}
			custom_trigger_tooltip = { 
				tooltip = "[FROM.GetName] can be mobilised"
				FROM = {
					AND = { 
						eligible_for_last_stand = yes
						is_controlled_by = ROOT
						is_core_of = ROOT
						is_owned_by = ROOT
					}
				}
			}
		}

		visible = {
			NOT = { has_country_flag = LSM_patriotic_war_allowed }
			NOT = { has_country_flag = LSM_endsieg_has_begun }
			has_global_flag = enclave_enabled
			threat > 0.5 #it worth the sacrifice
				ROOT = {
					AND = { 
						has_war = yes
						OR = { 
							is_ai = yes
							has_country_flag = i_want_cheese
						}
						OR = { 
							NOT = { 
								OR = { 
									original_tag = LUX 
									original_tag = BEL 
									original_tag = HOL 
									original_tag = FRA
									original_tag = DEN 
									original_tag = NOR
								}
							}
							has_country_flag = lsm_eligibility_nation
							date > 1940.7.1
							AND = {  
								OR = { 
									original_tag = LUX 
									original_tag = BEL  
									original_tag = HOL
									original_tag = FRA
									original_tag = DEN 
									original_tag = NOR
								}
								is_historical_focus_on = no
							}
						}			
					}
				}
		}

		days_re_enable = 1 

		fire_only_once = no

		ai_will_do = {
			factor = 100000
		}

		modifier = {
		}

		complete_effect = {
			custom_effect_tooltip = "state will be mobilised against the imminent invasion"
			hidden_effect = {
				ROOT = {
					add_manpower = 5000 #national volunteer
					if = { 
						limit = { 
							NOT = { has_country_flag = template_given_lsm }
						}
						set_country_flag = template_given_lsm
						division_template = {
							name = "Militia Cope Division"
							division_names_group = SWI_INF_01
							is_locked = yes
							priority = 0
							regiments = {
								militia = { x = 0 y = 0 }
								militia = { x = 0 y = 1 }
								militia = { x = 0 y = 2 }
								militia = { x = 1 y = 0 }
								militia = { x = 1 y = 1 }
								militia = { x = 1 y = 2 }
							}
							support = {
						
							}
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = megalopolis 
							AND = {
								is_core_of = FROM.controller
								is_core_of = ROOT
							}
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states 
									has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } 
								}
							}
						}
					}
					ROOT = {  
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 10000
							producer = ROOT
						}
						add_manpower = 100000 
					}
					FROM = {
						add_manpower = -100000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 720 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 360 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 1000 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 1000 } #no zombie spawning on island states
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0 
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = metropolis  
							AND = {
								is_core_of = FROM.controller
								is_core_of = ROOT
							}
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states 
									has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } 
								}
							}
						}
					}
					ROOT = {  
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 8000
							producer = ROOT
						}
						add_manpower = 60000 
					}
					FROM = {
						add_manpower = -60000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 360 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 180 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 450 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 450 } #no zombie spawning on island states
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = large_city 
							AND = {
								is_core_of = FROM.controller
								is_core_of = ROOT
							}
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states 
									has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } 
								}
							}
						}
					}
					ROOT = {  
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 6000
							producer = ROOT
						}
					add_manpower = 40000 }
					FROM = {
						add_manpower = -40000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 180 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 120 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 240 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 240 } #no zombie spawning on island states
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia Cope Division\" division_template = \"Militia Cope Division\" start_experience_factor = 0"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = city  
							is_core_of = FROM.controller
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states 
									has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } 
								}
							}
						}
					}
					ROOT = {  
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 4000
							producer = ROOT
						}
						add_manpower = 20000 
					}
					FROM = {
						add_manpower = -20000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 90 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 60 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 120 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 240 } #no zombie spawning on island states
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0 
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.9"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.9"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.9"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.9"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.7"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = large_town 
							AND = {
								is_core_of = FROM.controller
								is_core_of = ROOT
							}
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states
								}
							}
						}
					}
					ROOT = {  
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 2000
							producer = ROOT
						}
						add_manpower = 2000 
					}
					FROM = {
						add_manpower = -10000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 42 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 21 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 42 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 200 } #no zombie spawning on island states
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.8"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.8"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.8"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.7"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							has_state_category = town 
							AND = {
								is_core_of = FROM.controller
								is_core_of = ROOT
							}
							NOT = { 
								OR = { 
									has_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states 
									has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
									has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } 
								}
							}		
						}
					}
					ROOT = { add_manpower = 5000 }
					FROM = {
						add_manpower = -5000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_last_stand_modifier days = 21 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_dont_starve_modifier days = 7 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 21 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_recency_modifier days = 120 } #no zombie spawning on island states
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = { 
						AND = { 
							ROOT = { 
								num_of_controlled_states < 2
								OR = { 
									has_defensive_war = yes
									has_war_support > 0.79
								}		
							}
							FROM = { 
								AND = {
									is_core_of = FROM.controller
									is_core_of = ROOT
								}
								AND = {
									NOT = { 
										OR = { 
											has_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
											has_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }	
											has_dynamic_modifier = { modifier = LSM_enclave_recency_modifier } #no zombie spawning on island states
										}
									}
								}
							}
						}
					}
					ROOT = { 
						add_manpower = 100000 
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 15000
							producer = ROOT
						}
					}
					FROM = {
						add_manpower = -100000 #society of warrior
						remove_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
						remove_dynamic_modifier = { modifier = LSM_dont_starve_modifier }	
						remove_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier }	
						remove_dynamic_modifier = { modifier = LSM_recency_modifier } #no zombie spawning on island states
						add_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier days = 730 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier days = 730 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 1000 scope = FROM.controller }	
						add_dynamic_modifier = { modifier = LSM_enclave_recency_modifier days = 730 } #no zombie spawning on island states
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.9"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.8"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.7"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.7"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
					}
				}
				if = {
					limit = {  
						AND = { 
							ROOT = { 
								AND = { 
									OR = { 
										original_tag = ENG
										original_tag = JAP
										original_tag = VIN
									}
									is_ai = yes
									OR = { 
										has_civil_war = no
										any_enemy_country = {
											NOT = { 
												original_tag = FROM.controller
											}
										}
									}
								}
							}
							FROM = {
								is_core_of = ROOT
								is_core_of = FROM.controller
								is_in_home_area = yes
								NOT = {
									has_dynamic_modifier = { modifier = LSM_island_recency_modifier } #no zombie spawning on island states
								}
							}
						}
					}
					ROOT = { 
						add_manpower = 50000
						if = {
							limit = { original_tag = ENG }
							add_timed_idea = { idea = LSM_the_fight_for_the_home_island_ENG days = 120 } #can't quickcap them
						}
						if = {
							limit = { original_tag = JAP }
							add_timed_idea = { idea = LSM_the_fight_for_the_home_island_JAP days = 1825 } #can't quickcap them
						}
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 6000
							producer = ROOT
						}
						if = { 
							limit = { tag = ENG }
							hidden_effect = {
								set_technology = { 
									we_shall_fight_on_the_hill = 1
									popup = no
								}
							}
						}
						if = { 
							limit = { tag = JAP }
							hidden_effect = {
								set_technology = { 
									JAP_for_the_emperor_tech = 1
									popup = no
								}
							}
						}
					}
					FROM = {
						add_manpower = -50000 #might make zombie, but let's fk them now before they can fk us
						add_dynamic_modifier = { modifier = LSM_get_them_off_our_islands_modifier days = 60 scope = FROM.controller }
						add_dynamic_modifier = { modifier = LSM_island_recency_modifier days = 1000 } #more spamming to push enemies off but shitter divisions
						add_building_construction = {
							type = anti_air_building
							level = 1
							instant_build = yes
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.4"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = ROOT
						}
					}
					if = { 
						limit = { 
							ROOT = { tag = JAP } 
						}
						FROM = {
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
								create_unit = {
									division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
									owner = ROOT
								}
						}
					}
				}
				if = {
					limit = {  
						AND = { 
							ROOT = { 
								AND = {
									original_tag = USA
									any_enemy_country = {
										AND = {
											NOT = { capital_scope = { is_on_continent = south_america } }
											NOT = { capital_scope = { is_on_continent = north_america } }
											is_major = yes
										}
									}
								}
							}
							FROM = {
								is_core_of = USA
								is_core_of = USA
								is_in_home_area = yes
								NOT = {
									has_dynamic_modifier = { modifier = LSM_island_recency_modifier } #no zombie spawning on island states
								}
							}
						}
					}
					ROOT = { 
						add_manpower = 50000
						add_equipment_to_stockpile = { 
							type = infantry_equipment_0
							amount = 20000
							producer = ROOT
						}
						add_equipment_to_stockpile = { 
							type = infantry_equipment_1
							amount = 5000
							producer = ROOT
						}
					}
					FROM = {
						add_manpower = -50000 #might make zombie, but let's fk them now before they can fk us
						add_dynamic_modifier = { modifier = LSM_gunning_our_way_modifier days = 365 scope = USA }
						add_dynamic_modifier = { modifier = LSM_island_recency_modifier days = 730 } #more spamming to push enemies off but shitter divisions
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.6"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.5"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.8 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.6 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.6 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.4 start_equipment_factor = 0.3"  
							owner = ROOT
						}
						create_unit = {
							division = "name = \"Militia\" division_template = \"Militia Cope Division\" start_experience_factor = 0.4 start_equipment_factor = 0.3"  
							owner = ROOT
						}
					}
				}
			}
		}
	}
	
	endsieg_decision = {

		icon = generic_prepare_civil_war
		
		state_target = yes

		target_array = ROOT.controlled_states
		
		on_map_mode = map_only

		target_trigger = {
			custom_trigger_tooltip =  {
				tooltip = "State can be mobilised"
				FROM = {
					AND = { 
						eligible_for_endsieg = yes
						is_controlled_by = GER
						is_core_of = GER
						is_owned_by = GER
					}
				}
			}
		}

		visible = {
			has_war = yes
			original_tag = GER
			surrender_progress > 0.2
			threat > 0.7 #it worth the sacrifice
			has_government = fascism
			OR = {
				surrender_progress > 0.39
				NOT = { has_full_control_of_state = 64 }
				has_global_flag = d_day_happened #send the words, send the words send the words everywhere! THAT THE YANKS ARE COMING! THE YANKS ARE COMING!
			}
			OR = { 
				is_ai = yes
				has_country_flag = i_want_cheese
			}
		}

		available = {
			custom_trigger_tooltip = { 
				tooltip = "[FROM.GetName] can be mobilised"
				FROM = {
					AND = { 
						eligible_for_endsieg = yes
						is_controlled_by = GER
						is_core_of = GER
						is_owned_by = GER
					}
				}
			}
		}

		days_re_enable = 730
		fire_only_once = no
		cost = 1

		ai_will_do = {
			factor = 1000
		}
		
		modifier = {
		}

		complete_effect = {
			custom_effect_tooltip = "Endsieg is here Endsieg is here Endsieg is here"
			hidden_effect = {
				every_other_country = {
					limit = { is_in_faction_with = GER }
					GER = { 
						add_ai_strategy = {
							type = dont_defend_ally_borders
							id = PREV
							value = 100 #our home is more important
						}
					}
				}
				GER = {
					add_equipment_to_stockpile = { 
						type = infantry_equipment_0
						amount = 5000
						producer = PREV
					}
					if = { 
						limit = { 
							NOT = { has_country_flag = LSM_endsieg_has_begun }
						}
						set_country_flag = LSM_endsieg_has_begun
						news_event = { hours = 2 id = lsm_news.300 }
					}
					add_ideas = wheelchair_warfare
					add_manpower = 10000
					if = { 
						limit = { 
							NOT = { has_idea = endsieg_idea } 
							NOT = { has_idea = LSM_the_final_push_success_GER }
							NOT = { has_idea = LSM_the_final_push_failure_GER }
							has_capitulated = no
						} 
						add_timed_idea = { idea = endsieg_idea days = 365 }
						every_other_country = {
							limit = { 
								has_war_with = GER 
								OR = {
									is_major = yes
									capital_scope = { is_on_continent = europe }
								}
							}
							activate_decision = LSM_the_final_push_decision
						}
					}
					if = { 
						limit = { 
							NOT = { has_tech = LSM_infantry_anti_tank_GER }
						}
						set_technology = { LSM_infantry_anti_tank_GER = 1 popup = no }
					}
					if = { 
						limit = { 
							NOT = { has_country_flag = wheelchair_template_given_lsm }
						}
						set_country_flag = wheelchair_template_given_lsm
						division_template = {
							name = "Wheelchair Division"
							division_names_group = GER_INF_01
							is_locked = yes
							priority = 0
							regiments = {
								militia = { x = 0 y = 0 }
								militia = { x = 0 y = 1 }
								militia = { x = 0 y = 2 }
							}
							support = {
						
							}
						}
					}
				}
				if = {
					limit = { 
						FROM = { 
							AND = { 
								is_controlled_by = GER
								is_owned_by = GER
								is_core_of = GER
								NOT = { 
									has_dynamic_modifier = { modifier = LSM_endsieg_modifier }
								}
							}
						}
					}
					GER = { 
						add_manpower = 5000
					}
					FROM = {
						add_manpower = -250000 #might make zombie
						add_dynamic_modifier = { modifier = LSM_endsieg_modifier days = 365 scope = GER }	#every year just because	
						add_dynamic_modifier = { modifier = LSM_there_is_no_food_left_modifier days = 730 scope = FROM.controller }
						remove_dynamic_modifier = { modifier = LSM_last_stand_modifier }	
						remove_dynamic_modifier = { modifier = LSM_dont_starve_modifier }
						remove_dynamic_modifier = { modifier = LSM_enclave_last_stand_modifier }	
						remove_dynamic_modifier = { modifier = LSM_enclave_dont_starve_modifier }
						if = {
							limit = {
								free_building_slots = {
									building = anti_air_building 
									size > 0 
								}
							}			
							add_building_construction = {
								type = anti_air_building
								level = 1
								instant_build = yes
							}
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.8"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.5"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.5"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = GER
						}
						create_unit = {
							division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
							owner = GER
						}
						if = { 
							limit = { has_global_flag = enclave_enabled }
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
							create_unit = {
								division = "name = \"Wheelchair\" division_template = \"Wheelchair Division\" start_experience_factor = 0 start_equipment_factor = 0.3"  
								owner = GER
							}
						}
					}
				}
			}
		}
	}
	
	recovery_decision = {

		icon = SWI_support_humanitarian_efforts
		
		state_target = yes

		target_array = ROOT.controlled_states
		
		on_map_mode = map_only

		target_trigger = {
			custom_trigger_tooltip =  {
				tooltip = "Recovery effort will be concentrated in this state"
				FROM = {
					AND = {
						is_controlled_by = ROOT
						OR = {
							has_dynamic_modifier = { modifier = ENG_unimaginable_destruction }
							has_dynamic_modifier = { modifier = ENG_unimaginable_destruction_vengeance }
						}
						OR = {
							is_owned_by = ROOT
							is_core_of = ROOT
						}
					}
				}
			}
		}

		visible = {
			any_state = {
				is_controlled_by = ROOT
				OR = {
					has_dynamic_modifier = { modifier = ENG_unimaginable_destruction }
					has_dynamic_modifier = { modifier = ENG_unimaginable_destruction_vengeance }
				}
				OR = {
					is_owned_by = ROOT
					is_core_of = ROOT
				}
			}
		}

		available = {
			has_war = no
		}

		days_remove = 365
		fire_only_once = no
		cost = 100

		ai_will_do = { #lmao you guys suck, just die already
			factor = 25
			modifier = {
				FROM = { has_dynamic_modifier = { modifier = ENG_unimaginable_destruction_vengeance } }
				ROOT = {
					OR = {
						tag = ENG
						tag = CAN
						tag = RAJ
						tag = SAF
						tag = AST
						tag = NZL
					}
				}
				add = -25
			}
			modifier = {
				has_political_power < 200 
				add = -25
			}
			modifier = {
				FROM = { NOT = { is_core_of = ROOT } }
				date < 1945.1.1 #let them suffer a little more
				add = -20
			}
		}
		
		modifier = {
			consumer_goods_factor = 0.5
		}

		complete_effect = {
			FROM = { add_dynamic_modifier = { modifier = recovery_from_annihilation_modifier } }
		}

		remove_effect = {
			FROM = { 
				remove_dynamic_modifier = { modifier = recovery_from_annihilation_modifier } 
				if = {
					limit = {
						has_dynamic_modifier = { modifier = ENG_unimaginable_destruction }
					}
					remove_dynamic_modifier = { modifier = ENG_unimaginable_destruction } 
				} 
				if = {
					limit = {
						has_dynamic_modifier = { modifier = ENG_unimaginable_destruction_vengeance }
					}
					remove_dynamic_modifier = { modifier = ENG_unimaginable_destruction_vengeance } 
				}
			}
		}
	}
}
	
the_more_flavour_stuffs_decision = {
	turn_on_the_flavour = {
	
		icon = generic_welfare

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			date < 1936.2.1	
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = flavour_enabled_flag }
			OR = {
				difficulty < 3
				difficulty > 3
			}
		}

		complete_effect = {
			custom_effect_tooltip = "Toggle extra menu for more building slots or to spawn free resources. This decision can not be toggled off, and is visible only til February 1936"
			hidden_effect = {
				set_global_flag = flavour_enabled_flag
			}
		}

		ai_will_do = {
			factor = 0
		}
	}
	santa_for_soviet_union = {
	
		icon = generic_welfare

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			date < 1936.2.1	
		}

		visible = {
			is_ai = no
			has_global_flag = flavour_enabled_flag
		}

		complete_effect = {
			custom_effect_tooltip = "Santa event will trigger in winter 39 for the Soviet Union. AI will however not pick the option that leads to Christmarx Union."
			hidden_effect = {
				set_global_flag = santa_for_soviet_enabled
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	more_building_slot = {
	
		icon = generic_welfare

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = no	
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = LSM_land_upgrade }
			has_global_flag = flavour_enabled_flag
		}

		complete_effect = {
			custom_effect_tooltip = "More building slot. You won't feel too poor for example, as China, anymore. Won't give you more resources though"
			hidden_effect = {
				set_global_flag = LSM_land_upgrade
				every_state = {
					ETH_upgrade_state_category = yes
				}
				every_state = {
					limit = { is_on_continent = africa }
					ETH_upgrade_state_category = yes
				}
				every_state = {
					limit = { is_on_continent = south_america }
					ETH_upgrade_state_category = yes
				}
				every_state = {
					limit = { is_on_continent = asia }
					ETH_upgrade_state_category = yes
				}
				every_state = {
					limit = { is_core_of = CAN }
					ETH_upgrade_state_category = yes
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}

	more_resource = {
	
		icon = generic_welfare

		fire_only_once = yes

		allowed = {
			always = yes
		}

		available = {
			is_ai = no	
		}

		visible = {
			is_ai = no
			NOT = { has_global_flag = LSM_resource_upgrade }
			has_global_flag = flavour_enabled_flag
		}

		complete_effect = {
			custom_effect_tooltip = "Well, I hope somebody goes rich from this"
			hidden_effect = {
				SOV = { add_ideas = SOV_terra_formar2 }
				set_global_flag = LSM_resource_upgrade
				set_temp_variable = { res_steel = 0 }
				set_temp_variable = { res_steel_2 = 0 }
				set_temp_variable = { res_steel_3 = 0 }
				set_temp_variable = { res_steel_4 = 0 }
				set_temp_variable = { res_oil = 0 }
				set_temp_variable = { res_oil_2 = 0 }
				set_temp_variable = { res_oil_3 = 0 }
				set_temp_variable = { res_tungsten = 0 }
				set_temp_variable = { res_aluminium = 0 }
				set_temp_variable = { res_chromium = 0 }
				set_temp_variable = { res_rubber = 0 }
				set_temp_variable = { res_rubber_1 = 0 }
				set_temp_variable = { res_aluminium_1 = 0 }
				while_loop_effect = {
					limit = {
						check_variable = { res_steel = 26 compare = less_than }
					}
					random_state = { add_resource = { type = steel amount = 10 } }
					add_to_temp_variable = { res_steel = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_steel_2 = 11 compare = less_than }
					}
					random_state = { add_resource = { type = steel amount = 20 } }
					add_to_temp_variable = { res_steel_2 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_steel_3 = 4 compare = less_than }
					}
					random_state = { add_resource = { type = steel amount = 50 } }
					add_to_temp_variable = { res_steel_3 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_steel_4 = 51 compare = less_than }
					}
					random_state = { add_resource = { type = steel amount = 5 } }
					add_to_temp_variable = { res_steel_4 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_oil = 26 compare = less_than }
					}
					random_state = { add_resource = { type = oil amount = 25 } }
					add_to_temp_variable = { res_oil = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_oil_2 = 11 compare = less_than }
					}
					random_state = { add_resource = { type = oil amount = 50 } }
					add_to_temp_variable = { res_oil_2 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_oil_3 = 4 compare = less_than }
					}
					random_state = { add_resource = { type = oil amount = 100 } }
					add_to_temp_variable = { res_oil_3 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_tungsten = 26 compare = less_than }
					}
					random_state = { add_resource = { type = tungsten amount = 10 } }
					add_to_temp_variable = { res_tungsten = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_aluminium = 12 compare = less_than }
					}
					random_state = { add_resource = { type = aluminium amount = 25 } }
					add_to_temp_variable = { res_aluminium = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_aluminium_1 = 26 compare = less_than }
					}
					random_state = { add_resource = { type = aluminium amount = 11 } }
					add_to_temp_variable = { res_aluminium_1 = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_chromium = 26 compare = less_than }
					}
					random_state = { add_resource = { type = chromium amount = 25 } }
					add_to_temp_variable = { res_chromium = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_rubber = 12 compare = less_than }
					}
					random_state = { add_resource = { type = rubber amount = 25 } }
					add_to_temp_variable = { res_rubber = 1 }
				}
				while_loop_effect = {
					limit = {
						check_variable = { res_rubber_1 = 26 compare = less_than }
					}
					random_state = { add_resource = { type = rubber amount = 5 } }
					add_to_temp_variable = { res_rubber_1 = 1 }
				}
			}
		}

		ai_will_do = {
			factor = 0
		}
	}
}