this_one_came_from_here = {
	enable = {
		OR = {
			threat > 0.80
			has_war = yes
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
}

ENG_nuke_please = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		date > 1941.9.1
		surrender_progress < 0.1
		num_of_civilian_factories > 100
		has_deployed_air_force_size = {
			type = fighter
			size > 4999
		}
	}

	abort = {
		has_tech = atomic_research
	}

	ai_strategy = {
		type = research_weight_factor
		id = atomic_research
		value = 100
	}
}

ENG_nuke2_please = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 4999
		}
		SOV_is_deplaned = no
		date > 1943.1.1
		surrender_progress < 0.1
		num_of_civilian_factories > 100
	}

	abort = {
		has_tech = nuclear_reactor 
	}

	ai_strategy = {
		type = research_weight_factor
		id = nuclear_reactor 
		value = 100
	}
}

ENG_nuke3_please = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 4999
		}
		date > 1944.1.1
		surrender_progress < 0.1
		num_of_civilian_factories > 100
	}

	abort = {
		has_tech = nukes
	}

	ai_strategy = {
		type = research_weight_factor
		id = nukes
		value = 100
	}
}

get_yourself_some_nuke_yo = {
	enable = {
		has_tech = nuclear_reactor
		NOT = { surrender_progress > 0.05 }
		num_of_civilian_factories > 30
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = nuclear_reactor 
		value = 1
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 1
	}
}
get_yourself_some_nuke_yeah = {
	enable = {
		has_tech = nuclear_reactor
		NOT = { surrender_progress > 0.05 }
		num_of_civilian_factories > 100
		has_deployed_air_force_size = {
			type = fighter
			size > 4999
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = nuclear_reactor 
		value = 10
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 5
	}
}
get_yourself_some_strat_yeah = {
	enable = {
		has_tech = nuclear_reactor
		NOT = { surrender_progress > 0.05 }
		has_deployed_air_force_size = {
			type = fighter
			size > 4999
		}
		has_deployed_air_force_size = {
			type = strategic_bomber
			size < 1000
		}
	}

	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 15
	}
}
the_taxing_nature_of_nonhistorical_early_war = {
	enable = {
		is_historical_focus_on = no
		date < 1939.1.1
	}
	abort_when_not_enabled = yes

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

scout_plane_cuz_why_not = {
	enable = {
		has_deployed_air_force_size = {
			size > 1000
			type = fighter
		}
	}
	abort_when_not_enabled = yes

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

allied_combined_air_force = {
	allowed = {
		OR = {
			original_tag = USA
			original_tag = ENG
		}
	}
	enable = {
		has_deployed_air_force_size = {
			size < 10000
			type = fighter
		}
		OR = {
			is_in_faction_with = FRA
			is_in_faction_with = GER
			is_in_faction_with = SOV
		}
		NOT = {
			OR = {
				AND = {
					tag = ENG
					is_in_faction_with = USA
				}
				AND = {
					tag = USA
					is_in_faction_with = ENG
				}
			}
		}	
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 65
	}

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

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

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

allied_combined_army = {
	allowed = {
		OR = {
			original_tag = FRA
			original_tag = ITA
			original_tag = SOV
		}
	}
	enable = {
		is_historical_focus_on = yes
		OR = {
			is_in_faction_with = ENG
			is_in_faction_with = USA
			AND = {
				tag = FRA
				can_rely_on_allies = yes
			}
		}
		check_variable = {
			num_divisions < 175
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -999 
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = tactical_bomber
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = strategic_bomber
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = naval_bomber
		value = -10
	}
}
AI_less_stupid_air = {
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = tactical_bomber
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = strategic_bomber
		value = -10
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = naval_bomber
		value = -10
	}
}
starting_market_purchases = {
	enable = {
		OR = {
			tag = SOV
			tag = USA
			tag = GER
			tag = ENG
			tag = FRA
		}
		date < 1939.1.1
		has_war = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_spend_factories
		value = -200 #just dont buy
	}

	ai_strategy = {
		type = equipment_market_buying_threshold
		id = infantry_equipment
		value = -50000
	}

	ai_strategy = {
		type = equipment_market_buying_threshold
		id = support_equipment
		value = -50000
	}

	ai_strategy = {
		type = equipment_market_buying_threshold
		id = artillery_equipment
		value = -50000
	}

	ai_strategy = {
		type = equipment_market_buying_threshold
		id = anti_air_equipment
		value = -50000
	}

	ai_strategy = {
		type = equipment_market_buying_threshold
		id = light_tank_chassis
		value = -50000
	}
}


new_market_stockpile_management = {
	enable = {
		is_major = yes
		date < 1945.1.1
	}
	abort_when_not_enabled = yes

	# Don't sell stuff that we need for the war
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = infantry
		value = 100000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = support
		value = 20000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = artillery
		value = 20000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = motorized
		value = 10000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = train
		value = 500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = armor
		value = 5000
	}
}

FRA_french_empire_avenge_waterloo = {
	enable = {
		OR = {
			focus_progress = {
				focus = FRA_avenge_waterloo
				progress > 0
			}
			has_completed_focus = FRA_avenge_waterloo
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			is_on_continent = europe
			OR = {
				is_core_of = FRA
				is_core_of = BEL
				is_core_of = GER
			}
		}
		value = 25
	}
}


marines_are_love = {
	enable = {
		is_ai_marine = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = role_ratio
		id = marines
		value = 50
	}
	ai_strategy = {
		type = template_prio
		id = marines
		value = 50
	}
}
mountaineers_are_love = {
	enable = {
		is_ai_mountaineer = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 25
	}
	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = 50
	}
}

mountaineers_are_love2 = {
	enable = {
		is_ai_mountaineer_only = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = unit_ratio
		id = mountaineers
		value = 100
	}
	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = 100
	}
}

global_defense_memecil = {
	allowed = {
		original_tag = SPR
	}
	reversed = yes
	enable = {
		SPR = { has_completed_focus = SPR_global_defense_council }
		is_neighbor_of = SPR
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = "SPR"
		value = 1000
	}

	ai_strategy = {
		type = declare_war
		id = "SPR"
		value = 1000
	}

	ai_strategy = {
		type = antagonize
		id = "SPR"
		value = 1000
	}
}
wakey_wakey_stupid_dead_AI = {
	enable = {
		OR = {
			tag = CAN
		}	
		num_of_military_factories > 20
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 20
	}
}
wakey_wakey_stupid_dead_AI_2 = {
	enable = {
		OR = {
			tag = CAN
		}	
		num_of_civilian_factories > 40
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 40
	}
}
wakey_wakey_stupid_dead_AI_3 = {
	enable = {
		OR = {
			tag = CAN
		}	
		num_of_civilian_factories > 25	
		num_of_military_factories > 25
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = dockyard
		value = 25
	}
}

oh_god_we_need_rubber = {
	enable = {
		is_historical_focus_on = yes
		NOT = { tag = GER }
		has_tech = synth_oil_experiments
		AND = {
			OR = { 
				has_war_with = MAL
				has_war_with = INS
				has_war_with = ENG
				has_war_with = USA
			}
			has_resources_in_country = {
				resource = rubber
				amount < -20
			}
			OR = {
				num_of_civilian_factories > 100
				num_of_military_factories > 100
			}
		}	
	}
	
	abort = { 
		has_resources_in_country = {
			resource = rubber
			amount > 0
		}
	}

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 12
	}

	ai_strategy = {
		type = research_weight_factor
		id = rubber_processing  
		value = 100
	}
	ai_strategy = {
		type = research_weight_factor
		id = improved_rubber_processing
		value = 100
	}

	ai_strategy = {
		type = research_weight_factor
		id = advanced_rubber_processing
		value = 100
	}
}
oh_god_we_need_rubber_2 = {
	enable = {
		has_tech = synth_oil_experiments
		is_historical_focus_on = yes
		NOT = { tag = GER }
		AND = {
			OR = { 
				has_war_with = MAL
				has_war_with = INS
				has_war_with = ENG
				has_war_with = USA
			}
			has_resources_in_country = {
				resource = rubber
				amount < -40
			}
			OR = {
				num_of_civilian_factories > 150
				num_of_military_factories > 150
			}
		}	
	}
	
	abort = { 
		has_resources_in_country = {
			resource = rubber
			amount > 0
		}
	}

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 12
	}

	ai_strategy = {
		type = research_weight_factor
		id = rubber_processing  
		value = 100
	}
	ai_strategy = {
		type = research_weight_factor
		id = improved_rubber_processing
		value = 100
	}

	ai_strategy = {
		type = research_weight_factor
		id = advanced_rubber_processing
		value = 100
	}
}
historical_allies_dont_retaliate_japan_until_europe_is_done = {
	enable = {
		is_historical_focus_on = yes
		has_war_with = JAP
		any_country = {
			capital_scope = { is_on_continent = europe }
			has_capitulated = no
			has_government = fascism
			has_war_with = ROOT
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		country_trigger = {
			is_in_faction_with = JAP
			capital_scope = { is_on_continent = asia }
		}

		ratio = 0.3

		priority = 100
		ordertype = front
		execution_type = careful
	}	
}
there_is_no_place_for_coward_in_a_civil_war = {
	enable = {
		has_civil_war = yes
		NOT = { original_tag = SPR }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control
		country_trigger = {
			has_war_with = FROM
			original_tag = FROM
		}

		ratio = 0.3

		priority = 1000
		ordertype = front
		execution_type = rush
		execute_order = yes
	}
}
only_use_SH_railway_gun = {
	allowed = {
		OR = {
			tag = GER
			tag = SOV
			tag = USA
		}
	}
	enable = {
		has_country_flag = sh_rg_flag
		has_tech = railway_gun
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = railway_gun
		value = -5
	}
}
why_dont_we_have_some_railguns = {
	allowed = {
		OR = {
			tag = GER
			tag = USA
			tag = SOV
		}
	}
	enable = {
		date < 1942.1.1
		has_tech = railway_gun	
		num_of_military_factories > 50
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = railway_gun
		value = 5
	}
}
why_dont_we_have_some_railguns2 = {
	allowed = {
		OR = {
			tag = GER
			tag = USA
		}
	}
	enable = {
		date < 1945.1.1
		has_tech = railway_gun	
		num_of_military_factories > 100
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = railway_gun
		value = 5
	}
}
why_dont_we_have_some_railguns3 = {
	allowed = {
		OR = {
			tag = GER
			tag = USA
		}
	}
	enable = {
		has_tech = railway_gun	
		num_of_military_factories > 200
		has_country_flag = sh_rg_flag
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = railway_gun
		value = 5
	}
}
standard_CAS_production_for_AI_1 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 2500
		}
	}

	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3
	}
}
standard_CAS_production_for_AI_2 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 5000
		}
	}

	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3
	}
}
standard_CAS_production_for_AI_3 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 7500
		}
	}

	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3
	}
}
standard_CAS_production_for_AI_4 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 10000
		}
	}

	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3
	}
}
standard_CAS_production_for_AI_5 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 15000
		}
	}

	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 10
	}
}
standard_CAS_production_for_GER_AI_5 = {
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 10000
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -15
	}
}
TOA_join_the_allies = {
	allowed = {
		OR = {
			original_tag = ARG
			original_tag = URG
			original_tag = BRA
			original_tag = CHL
		}
	}
		
	enable = {
		has_government = democratic
		is_historical_focus_on = yes
		NOT = { has_global_flag = vanilla_history }
		any_country = {
			OR = {
				original_tag = ARG
				original_tag = URG
				original_tag = BRA
				original_tag = CHL
			}
			is_in_faction_with = ENG
		}	
		OR = {
			date > 1943.1.1
			NOT = { has_global_flag = LSM_remove_allied_welfare }
		}
	}	
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = 4000
	}

}
TOA_join_the_allies_ENG = {
	allowed = {
		tag = ENG
	}
		
	enable = {
		has_government = democratic
		is_historical_focus_on = yes
		NOT = { has_global_flag = vanilla_history }
		any_country = {
			OR = {
				original_tag = ARG
				original_tag = URG
				original_tag = BRA
				original_tag = CHL
			}
			is_in_faction_with = ENG
		}		
	}	
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = alliance
		id = "ARG"
		value = 4000
	}

	ai_strategy = {
		type = alliance
		id = "BRA"
		value = 4000
	}

	ai_strategy = {
		type = alliance
		id = "URG"
		value = 4000
	}

	ai_strategy = {
		type = alliance
		id = "CHL"
		value = 4000
	}

}
axis_convoy_raid_the_UK_is_fun = {
	enable = {
		has_war_with = ENG
		is_in_faction_with = GER
		OR = {
			ENG = { is_ai = no }
			USA = { is_ai = no }
			any_country = {
				has_war_with = GER
				is_major = yes
				is_ai = no
			}
		}
	}	

	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 49
		value = 3000
	}

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 47
		value = 3000
	}

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 44
		value = 3000
	}

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 58
		value = 3000
	}

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 51
		value = 3000
	}
}
superboosted_navy_role_ratios_axis_countries = {
	enable = {
		has_dlc = "Man the Guns"
		is_in_faction_with = GER
		is_historical_focus_on = yes
		OR = {
			ENG = { is_ai = no }
			any_country = {
				has_war_with = GER
				is_major = yes
				is_ai = no
			}
			USA = { is_ai = no }
		}
		NOT = { has_idea = crossing_the_atlantic_idea }
		NOT = { has_idea = crossing_the_pacific_idea }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = submarine
		value = 20
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = -100
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_escort
		value = -100
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 25
	}
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = -100
	}

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

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = -100
	}

}
basic_mil_fulfillment = {
	enable = {
		num_of_military_factories < 5
		NOT = {
			AND = {
				OR = {
					tag = HUN
					tag = AUS
				}
				date < 1938.1.1
			}
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 5
	}
}
basic_production_FIN = {
	enable = {
		tag = FIN
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 1
	}
}
basic_production_POL = {
	enable = {
		tag = POL
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 25
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 2
	}
}
basic_production_POL_wartime = {
	enable = {
		tag = POL
		date > 1939.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 3
	}
}
basic_production_non_asia_train = {
	enable = {
		capital_scope = { 
			OR = {
				is_on_continent = europe
				is_on_continent = south_america
				is_on_continent = north_america
			}
		}
		num_of_military_factories > 20
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 1
	}
}
basic_production_non_asia = {
	enable = {
		capital_scope = { 
			OR = {
				is_on_continent = europe
				is_on_continent = south_america
				is_on_continent = north_america
			}
		}
		num_of_military_factories > 4
		NOT = { tag = FIN }
		NOT = { tag = POL }
		NOT = { tag = AOI }
		is_ai_mass_mob_ex = no
		is_literally_china = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 1
	}
}
basic_production_asia = {
	enable = {
		capital_scope = { 
			NOT = {
				OR = {
					is_on_continent = europe
					is_on_continent = south_america
					is_on_continent = north_america
				}
			}
		}
		NOT = { tag = AOI }
		num_of_military_factories > 4
		is_ai_mass_mob_ex = no
		is_literally_china = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = -1
	}
}
basic_production_meat = {
	enable = {
		is_ai_mass_mob_ex = yes
		num_of_military_factories < 20
		is_historical_focus_on = yes
		has_equipment = { infantry_equipment < 100000 }
		stockpile_ratio = { 
			archetype = infantry_equipment
			ratio < 2
		}
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = -999
	}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = -999
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = -999
	}

	ai_strategy = {
		type = air_factory_balance
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -999 
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = air_transport
		value = -999
	}
}
basic_production_china_main = {
	enable = {
		is_literally_china = yes
		is_historical_focus_on = yes
		num_of_military_factories > 12
		NOT = { has_global_flag = china_giga }
		has_equipment = { infantry_equipment < 100000 }
		stockpile_ratio = { 
			archetype = infantry_equipment
			ratio < 2
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = -1
	}
}

basic_production_china = {
	enable = {
		is_literally_china = yes
		is_historical_focus_on = yes
		num_of_military_factories > 10
		NOT = { has_global_flag = china_giga }
		has_equipment = { infantry_equipment < 100000 }
		stockpile_ratio = { 
			archetype = infantry_equipment
			ratio < 2
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = -1
	}
}


basic_production_super_china = {
	enable = {
		is_literally_china = yes
		has_global_flag = china_giga
		OR = {
			tag = CHI
			is_major = yes
		}
		date < 1940.1.1
		has_equipment = { infantry_equipment < 100000 }
		stockpile_ratio = { 
			archetype = infantry_equipment
			ratio < 2
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = ai_wanted_divisions_factor
		value = 200
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = -3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = -3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = -3
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 999
	}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = -999
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = -999
	}

	ai_strategy = {
		type = air_factory_balance
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -999 
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = air_transport
		value = -999
	}
}
basic_production_super_china_minor = {
	enable = {
		is_literally_china = yes
		has_global_flag = china_giga
		is_major = no
		has_equipment = { infantry_equipment < 100000 }
		stockpile_ratio = { 
			archetype = infantry_equipment
			ratio < 2
		}
		date < 1940.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = ai_wanted_divisions_factor
		value = 200
	}

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

	ai_strategy = {
		type = air_factory_balance
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -999 
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = air_transport
		value = -999
	}
}

SOV_min_factory_production1 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		always = yes
	}
	abort = {
		always = no
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 5
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment_1
		value = 30
	}

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 25
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 3
	}
}

SOV_min_factory_production2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1938.8.1
			num_of_military_factories > 80
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = infantry
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 8
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 5
	}
}

SOV_min_factory_production3 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		num_of_military_factories > 150
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 3
	}
}
SOV_min_factory_production4 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_country_flag = pure_infantry
		num_of_military_factories > 100
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = support_equipment
		value = 10
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = 10
	}
}
SOV_min_factory_production4 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_country_flag = pure_infantry_no_air
		num_of_military_factories > 100
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 10
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = -5
	}
}
SOV_dont_send_volunteer_to_enemies_of_germany_with_mr = {
	reversed = yes
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV = { has_idea = SOV_molotov_ribbentrop_pact }
		has_war_with = GER
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "SOV"
		value = -500
	}
}
intervention_in_italy = {
	enable = {
		is_historical_focus_on = no
		ITA = { 
			has_civil_war = yes 
			NOT = { 
				any_enemy_country = {
					is_in_faction = yes
				}
			}
		}
		NOT = { has_government = fascism }
		fascism < 0.25
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "ITA"
		value = 500
	}
}
intervention_in_japan = {
	enable = {
		is_historical_focus_on = no
		JAP = { 
			has_civil_war = yes 
			NOT = { 
				any_enemy_country = {
					is_in_faction = yes
				}
			}
		}
		OR = {
			AND = { 
				JAP = { has_government = communism }
				has_government = communism
			}
			AND = { 
				JAP = { has_government = democratic }
				has_government = democratic
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "JAP"
		value = 500
	}
}
division_template_is_really_cool = {
	enable = {
		always = yes
	}

	abort = {
		always = no
	}
	ai_strategy = {
		type = land_xp_spend_priority
		id = division_template
		value = 100
	}

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

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = marines
		value = 100
	}

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = 100
	}

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

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

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = 100
	}

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

AI_1940_plane_is_slightly_better = {
	enable = {
		has_tech = improved_small_airframe
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = fighter_equipment_2
		value = 50
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = fighter_equipment_1
		value = -50
	}
}

BENELUX_join_with_allies = {
	allowed = {
		OR = {
			original_tag = HOL
			original_tag = BEL
			original_tag = LUX
		}
	}
	enable = {
		has_global_flag = SOV_one_step_forward
		FRA = { has_war_with = GER }
		ENG = { has_war_with = GER }
		has_government = democratic
		ENG = { has_government = democratic }
		is_historical_focus_on = yes
	}
	abort = {
		has_war = yes
	}

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = 5000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = ENG
		target = join_allies
		value = 500000
	}
}
BEL_join_with_allies = {
	allowed = {
		original_tag = BEL
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		has_war = no
		HOL = { has_war_with = GER }
		HOL = { surrender_progress > 0.3 }
		is_historical_focus_on = yes
	}
	abort = {
		is_in_faction = yes
	}

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = 5000
	}
}
LUX_join_with_allies = {
	allowed = {
		original_tag = LUX
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		has_war = no
		BEL = { has_war_with = GER }
		OR = {
			BEL = { surrender_progress > 0.1 }
			HOL = { has_capitulated = yes }
		}
	}
	abort = {
		is_in_faction = yes
	}

	ai_strategy = {
		type = alliance
		id = "ENG"
		value = 5000
	}
}
BEL_join_with_allies2 = {
	allowed = {
		is_allied_ai = yes
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		OR = {
			is_in_faction_with = ENG
			is_in_faction_with = USA
			is_in_faction_with = FRA
		}
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		BEL = { has_war = no }
		HOL = { has_war_with = GER }
		HOL = { surrender_progress > 0.5 }
		is_faction_leader = yes
	}
	abort = {
		BEL = { is_in_faction = yes }
	}

	ai_strategy = {
		type = alliance
		id = "BEL"
		value = 5000
	}
}
LUX_join_with_allies2 = {
	allowed = {
		is_allied_ai = yes
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		is_faction_leader = yes
		OR = {
			is_in_faction_with = ENG
			is_in_faction_with = USA
			is_in_faction_with = FRA
		}
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		LUX = { has_war = no }
		BEL = { has_war_with = GER }
		BEL = { surrender_progress > 0.1 }
	}
	abort = {
		LUX = { is_in_faction = yes }
	}

	ai_strategy = {
		type = alliance
		id = "LUX"
		value = 5000
	}
}
HOL_dont_join_war_with_allies_rev = {
	allowed = {
		original_tag = HOL
	}
	reversed = yes
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		is_in_faction_with = ENG
	}
	abort = {
		OR = {
			has_war = yes
			date > 1941.1.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = HOL
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = HOL
		target = call_allies
		value = -99999
	}
}
HOL_dont_join_war_with_allies = {
	allowed = {
		original_tag = HOL
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		has_war = no
		is_in_faction_with = ENG
	}
	abort = {
		OR = {
			has_war = yes
			date > 1941.1.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = ENG
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = ENG
		target = call_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_desire
		id = FRA
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = FRA
		target = call_allies
		value = -99999
	}
}
BEL_dont_join_war_with_allies_rev = {
	allowed = {
		original_tag = BEL
	}
	reversed = yes
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		is_in_faction_with = ENG
	}
	abort = {
		OR = {
			has_war = yes
			date > 1941.1.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = BEL
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = BEL
		target = call_allies
		value = -99999
	}
}
BEL_dont_join_war_with_allies = {
	allowed = {
		original_tag = BEL
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		has_war = no
		is_in_faction_with = ENG
	}
	abort = {
		OR = {
			has_war = yes
			date > 1941.1.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = ENG
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = ENG
		target = call_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_desire
		id = FRA
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = FRA
		target = call_allies
		value = -99999
	}
}
LUX_dont_join_war_with_allies = {
	allowed = {
		original_tag = LUX
	}
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		has_war = no
		is_in_faction_with = ENG
	}
	abort = {
		OR = {
			has_war = yes
			date > 1941.1.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = ENG
		target = join_allies
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = ENG
		target = call_allies
		value = -99999
	}
}
HOL_dont_pressure_hollander_yet = {
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		BEL = { has_war = no }
		is_in_faction_with = HOL
		OR = {
			tag = FRA
			is_in_faction_with = FRA
			tag = ENG
			is_in_faction_with = ENG
		}
		has_war = yes
	}
	abort = {
		OR = {
			HOL = { has_war = yes }
			NOT = { is_in_faction_with = HOL }
			date > 1940.6.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = HOL
		target = call_allies
		value = -99999
	}
}
BEL_dont_pressure_belgians_yet = {
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		BEL = { has_war = no }
		is_in_faction_with = BEL
		OR = {
			tag = FRA
			is_in_faction_with = FRA
			tag = ENG
			is_in_faction_with = ENG
		}
		has_war = yes
	}
	abort = {
		OR = {
			BEL = { has_war = yes }
			NOT = { is_in_faction_with = BEL }
			date > 1940.6.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = BEL
		target = call_allies
		value = -99999
	}
}
LUX_dont_pressure_luxembourg_yet = {
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		LUX = { has_war = no }
		is_in_faction_with = LUX
		OR = {
			tag = FRA
			is_in_faction_with = FRA
			tag = ENG
			is_in_faction_with = ENG
		}
		has_war = yes
	}
	abort = {
		OR = {
			LUX = { has_war = yes }
			NOT = { is_in_faction_with = LUX }
			date > 1940.6.1
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = LUX
		target = call_allies
		value = -99999
	}
}
BEL_reject_belgian_aggressive_ai = {
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		BEL = { has_war = no }
		is_in_faction_with = BEL
		OR = {
			tag = FRA
			is_in_faction_with = FRA
			tag = ENG
			is_in_faction_with = ENG
		}
		has_war = yes
	}
	abort = {
		OR = {
			BEL = {
				has_war = yes
			}
			date > 1940.6.1
		}
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = BEL
		target = join_allies
		value = -99999
	}
}
LUX_reject_luxem_aggressive_ai = {
	enable = {
		GER = { is_ai = no }
		NOT = { has_global_flag = vanilla_history }
		GER = { has_completed_focus = GER_around_maginot }
		is_historical_focus_on = yes
		LUX = { has_war = no }
		is_in_faction_with = LUX
		OR = {
			tag = FRA
			is_in_faction_with = FRA
			tag = ENG
			is_in_faction_with = ENG
		}
		has_war = yes
	}
	abort = {
		OR = {
			LUX = {
				has_war = yes
			}
			date > 1940.6.1
		}
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = LUX
		target = join_allies
		value = -99999
	}
}
civil_war_no_garrison = {

	enable = {
		has_civil_war = yes
		NOT = {
			any_enemy_country = {
				has_civil_war = no
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}
}

inland_dont_need_garrison = {

	enable = {
		NOT = {
			any_owned_state = {
				is_coastal = yes
			}
		}
		is_in_faction = yes
		is_faction_leader = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -200
	}
}
garrison_is_meme_at_low_world_tension = {
	enable = {
		threat < 0.15
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}
}

no_garrison_in_minor_war = {
	enable = {
		NOT = {
			any_country = {
				has_war_with = ROOT
				is_major = yes
				has_navy_size = {
					size > 10
				}
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}
}

some_countries_do_not_need_garrison = {

	enable = {
		capital_scope = { 
			OR = {
				is_on_continent = africa
				is_on_continent = north_america
				is_on_continent = south_america
			}
		}
		is_in_faction_with = ENG
		ENG = { has_capitulated = no }	
		NOT = { 
			any_country = {
				is_ai = no
				is_neighbor_of = ROOT
				NOT = { is_in_faction_with = ROOT }
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}
}

france_does_not_need_garrison = {

	allowed = {
		original_tag = FRA
	}

	enable = {
		OR = {
			ENG = { has_government = democratic }
			is_in_faction_with = ENG 
		}
		NOT = { has_war_with = ENG }
		any_country = {
			is_neighbor_of = FRA
			OR = { 
				has_government = fascism
				has_government = communism
			}
			is_major = yes
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}

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

germany_does_not_need_garrison = {

	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1941.1.1
		NOT = { surrender_progress > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = garrison
		value = -9999
	}

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



AI_flameo_1 = {
	enable = {
		is_major = yes
		OR = {
			original_tag = ENG
			original_tag = SOV
			original_tag = USA
			original_tag = FRA
			original_tag = GER
		}
		has_tech = tech_engineers2
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_variant_production_factor
		id = medium_tank_flame_chassis
		value = 20
	}

	ai_strategy = {
		type = equipment_production_factor
		id = flame
		value = 20
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = flame
		value = 3
	}
}

respect_swiss_neutrality = {
	enable = {
		is_historical_focus_on = yes
		NOT = { has_war_with = SWI }
	}
	abort = {
		OR = {
			is_historical_focus_on = no
			has_war_with = SWI
		}
	}

	ai_strategy = {
		type = ignore
		id = "SWI"
		value = 9999
	}

	ai_strategy = {
		type = declare_war
		id = "SWI"
		value = -9999
	}
}
MON_TAN_serious = {
	enable = {
		is_cavalry_nation = yes
		is_in_faction_with = SOV
		OR = {
			AND = {
				SOV = { is_ai = yes }
				SOV = { surrender_progress > 0.1 }
			}
			SOV = { surrender_progress > 0.25 }
			has_global_flag = mp_difficulty
		}
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "SOV"
	}
}

raj_no_gun2 = {
	allowed = {
		original_tag = RAJ
	}
	enable = {
		has_equipment = { infantry_equipment < 150000 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = 100
	}
}

chi_no_gun1_vsa = {
	enable = {
		is_literally_china = yes
		has_equipment = { infantry_equipment < 150000 }
		date < 1941.1.1
		has_global_flag = china_giga
		JAP = { is_ai = yes }
		
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_0
		value = 100
	}
}
chi_no_gun1 = {
	enable = {
		is_literally_china = yes
		has_equipment = { infantry_equipment < 150000 }
		date < 1941.1.1
		has_global_flag = china_giga
		JAP = { is_ai = no }
		
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -1000
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -1000
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = -1000
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_0
		value = 1000
	}
}

chi_no_gun2 = {
	enable = {
		is_literally_china = yes
		has_equipment = { infantry_equipment < 50000 }
		date < 1941.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = 100
	}
}

JAP_no_gun2 = {
	enable = {
		OR = {
			is_in_faction_with = JAP
			tag = JAP
		}
		NOT = { has_tech = improved_infantry_weapons }
		date < 1941.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = 100
	}
}
everyone_no_gun3 = {
	enable = {
		has_equipment = { infantry_equipment < 1000 }
		NOT = { has_tech = advanced_infantry_weapons }
		has_tech = improved_infantry_weapons
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = 100
	}
}

SOV_gun3_is_bad = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV = { has_equipment = { infantry_equipment < 150000 } }
		NOT = { has_country_flag = switch_time }
		NOT = { has_tech = advanced_infantry_weapons }
		has_tech = improved_infantry_weapons
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = 100
	}
}
SOV_gun2_license_is_bad = { 
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV = { has_equipment = { infantry_equipment < 150000 } }
		NOT = { has_country_flag = switch_time }
		NOT = { has_tech = improved_infantry_weapons }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_2
		value = -200
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = infantry_equipment_1
		value = 100
	}
}

doodoodoo_dont_join_axis = {
	enable = {
		has_government = fascism
		NOT = { capital_scope = { is_on_continent = south_america } }
		NOT = { capital_scope = { is_on_continent = north_america } }
		is_historical_focus_on = yes
		any_enemy_country = {
			is_major = yes
			capital_scope = { is_on_continent = europe }
		}
	}
	abort_when_not_enabled = yes
 	ai_strategy = {
		type = alliance
		id = "PRU"
		value = -2000
	}
 	ai_strategy = {
		type = alliance
		id = "VEN"
		value = -2000
	}
}
doodoodoo_dont_join_axis = {
	enable = {
		has_government = fascism
		OR = {
			capital_scope = { is_on_continent = south_america }
			capital_scope = { is_on_continent = north_america }
		}
		is_historical_focus_on = yes
		GER = {
			any_enemy_country = {
				is_major = yes
				capital_scope = { is_on_continent = europe }
			}
		}
	}
	abort_when_not_enabled = yes
 	ai_strategy = {
		type = alliance
		id = "GER"
		value = -2000
	}
}

USA_do_not_interfere_in_americas_unless_themseles_are_at_war = {
	allowed = {
		original_tag = USA
	}
	enable = {
		USA = {
			has_government = democratic
			OR = {
				has_army_manpower = { size < 1200000 }
				has_completed_focus = USA_america_first
				has_completed_focus = USA_suspend_the_presecution
			}
		}
		is_major = no #only defend majors
	}
	abort_when_not_enabled = yes
  	ai_strategy = {
		type = protect
		id = "USA"
		value = -2000
	}
}


do_not_interfere_in_americas_unless_US_is_at_war = {
	enable = {
		NOT = { capital_scope = { is_on_continent = south_america } }
		NOT = { capital_scope = { is_on_continent = north_america } }
		any_country = { has_idea = USA_monroe_doctrine_idea } 
		USA = { has_war = no }
	}
	abort_when_not_enabled = yes
  	 ai_strategy = {
		type = protect
		id = "GUA"
		value = -2000
	 }
 	 ai_strategy = {
		type = protect
		id = "COS"
		value = -2000
	 }
	 ai_strategy = {
		type = protect
		id = "ELS"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "NIC"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "HON"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "CUB"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "HAI"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "DOM"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "PAN"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "VEN"
		value = -2000
	 }

 	 ai_strategy = {
		type = protect
		id = "COL"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "ECU"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "PRU"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "BRA"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "PAR"
		value = -2000
	 }

	 ai_strategy = {
		type = protect
		id = "BOL"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "CHL"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "ARG"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "URG"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "GYA"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "TRI"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "SUR"
		value = -2000
	 }

  	 ai_strategy = {
		type = protect
		id = "CAY"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "GUA"
		value = -2000
	 }
 	 ai_strategy = {
		type = alliance
		id = "COS"
		value = -2000
	 }
	 ai_strategy = {
		type = alliance
		id = "ELS"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "NIC"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "HON"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "CUB"
		value = -2000
	 }

	 ai_strategy = {
		type = alliance
		id = "HAI"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "DOM"
		value = -2000
	 }

	 ai_strategy = {
		type = alliance
		id = "PAN"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "VEN"
		value = -2000
	 }

 	 ai_strategy = {
		type = alliance
		id = "COL"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "ECU"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "PRU"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "BRA"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "PAR"
		value = -2000
	 }

	 ai_strategy = {
		type = alliance
		id = "BOL"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "CHL"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "ARG"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "URG"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "GYA"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "SUR"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "CAY"
		value = -2000
	 }

  	 ai_strategy = {
		type = alliance
		id = "TRI"
		value = -2000
	 }

}

nobody_ever_upgrade_mech_unless_stockpile_is_giga = {
	enable = {
		has_tech = mechanised_infantry
		has_equipment = { mechanized_equipment < 80000 }
		has_dlc = "No Step Back"
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_3
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_2
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = mechanized_equipment_1
		value = 100
	}
}

KCW_KOR_support = {

	enable = {
		OR = {
			is_in_faction = yes
			is_major = yes
		}
		has_government = communism
		OR = {
			any_country = {
				original_tag = KOR
				surrender_progress > 0.5
			}
			capital_scope = { is_on_continent = asia }
		}	
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "KOR"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "KOR"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "KOR"
		value = 500
	}
}

KOR_garrison = {
	allowed = {
		original_tag = KOR
	}

	enable = {
		has_government = communism
	}
	abort_when_not_enabled = yes

	ai_strategy = {
  		type = garrison
   		value = 60
   	}

	ai_strategy = {
		type = put_unit_buffers

		order_id = 1
	
		states = {
			527
		}

		ratio = 0.2

		area = asia

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}

}
please_save_turkey = {
	enable = {
		is_historical_focus_on = yes
		TUR = { has_war_with = SOV }
		TUR = { has_country_flag = save_turkey_flag }
		capital_scope = {
			is_on_continent = europe
		}
		NOT = { has_government = communism }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "TUR"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "TUR"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "TUR"
		value = 500
	}
}

anti_soviet_beha = {
	enable = {
		is_historical_focus_on = yes
		has_global_flag = SOV_has_early_war
		capital_scope = {
			is_on_continent = europe
		}
		NOT = { has_government = communism }
		OR = {
			has_war_with = SOV
			has_war = no
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "ROM"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "ROM"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "ROM"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "POL"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "POL"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "POL"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "EST"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "EST"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "EST"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "LIT"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "LIT"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "LIT"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "LAT"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "LAT"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "LAT"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "TUR"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "TUR"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "TUR"
		value = 500
	}
}

CCW_CHI_support = {

	enable = {
		OR = {
			is_in_faction = yes
			is_major = yes
		}
		has_government = democratic
		OR = {
			AND = {
				CHI = { has_idea = LSM_chinese_civil_war }
				CHI = { surrender_progress > 0.6 }
			}
			CHI = { has_war_with = SOV }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "CHI"
		value = 500
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "CHI"
		value = 500
	}
	ai_strategy = {
		type = support
		id = "CHI"
		value = 500
	}
}

CCW_CHI_only_materiel_support = {

	enable = {
		has_government = democratic
		OR = {
			CHI = { has_idea = LSM_chinese_civil_war }
			CHI = { has_war_with = PRC }
		}
		CHI = { surrender_progress < 0.6 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_lend_lease_desire
		id = "CHI"
		value = 500
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "CHI"
		value = -99999
	}
}


CCW_PRC_supportA = {

	enable = {
		OR = {
			is_in_faction = yes
			is_major = yes
			is_faction_leader = yes
		}
		has_government = communism
		PRC = { has_idea = LSM_chinese_civil_war }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = support
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = support
		id = "CHI"
		value = -5000
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "CHI"
		value = -5000
	}
}
SOV_PRC_supportA = {

	allowed = {
		original_tag = SOV
	}

	enable = {
		has_government = communism
		PRC = { has_idea = LSM_chinese_civil_war }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = support
		id = "PRC"
		value = 50000
	}
	ai_strategy = {
		type = support
		id = "CHI"
		value = -5000
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = "CHI"
		value = -5000
	}
}


CHI_SOV_vs_JAP = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		has_war_with = JAP
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_desire
		id = CHI
		target = military_access
		value = -5000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = SHX
		target = military_access
		value = -5000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = XSM
		target = military_access
		value = -5000
	}
}
china_no_train_until_1940 = {

	enable = {
		is_literally_china = yes
		is_historical_focus_on = yes
		date < 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = -200
	}

	ai_strategy = {
		type = equipment_production_factor
		id = train
		value = -999
	}
}

major_train = {

	enable = {
		has_war = yes
		is_major = yes
		num_of_military_factories > 100
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = min_wanted_supply_trains
		value = 200
	}
}
major_train_base = {

	enable = {
		is_major = yes
		NOT = {
			is_literally_china = yes
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = min_wanted_supply_trains
		value = 100
	}
}
minor_train_base = {

	enable = {
		is_major = no
		NOT = {
			is_literally_china = yes
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = min_wanted_supply_trains
		value = 15
	}
}

SOV_barbarossa_is_dangerous = {
	allowed = {
		original_tag = SOV
	}

	enable = {
		has_global_flag = is_active
		has_idea = SOV_prepare_for_barbarossa
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "GER"
		value = -2000
	}

	ai_strategy = {
		type = declare_war
		id = "ROM"
		value = -2000
	}

	ai_strategy = {
		type = declare_war
		id = "JAP"
		value = -2000
	}
}
default_navy_role_ratios_allied_major = {
	allowed = {
		OR = {
			tag = USA
			tag = ENG
		}
	}
	enable = {
		has_dlc = "Man the Guns"
		is_major = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = submarine
		value = 3
	}

}
default_navy_role_ratios_allied_minor = {
	enable = {
		has_dlc = "Man the Guns"
		is_major = no
		is_allied_ai = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bc
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_carrier
		value = -100
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_escort
		value = -100
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_mine_sweeper
		value = -100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 25
	}
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 0
	}

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

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

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = submarine
		value = 2
	}

}

LSM_we_dont_believe_in_mountain_tank = {
	allowed = {
		always = yes
	}
	enable = {
		has_war = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_armor_score
		id = "GRE"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "HUN"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "SLO"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "TUR"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "GXC"
		value = -100
	}

	ai_strategy = {
		type = front_armor_score
		id = "AFG"
		value = -100
	}
}

africa_is_dangerous = {
	enable = { 
		is_in_faction_with = GER
		NOT = {
			OR = {
				GER = { is_ai = no }
				ITA = { is_ai = no }
			}
		}
		NOT = { 
			452 = { 
				OR = {
					is_fully_controlled_by = GER 
					is_fully_controlled_by = ITA 
				} 
			}
		}
		NOT = { tag = ITA }
		NOT = { capital_scope = { is_on_continent = africa } }
		is_historical_focus_on = yes
		date < 1943.4.1
		OR = {
			AND = {
				has_war_with = ENG 
				ENG = {
					has_navy_size = {
						size > 200
					}
				}
			}
			AND = {
				has_war_with = USA 
				USA = {
					has_navy_size = {
						size > 200
					}
				}
			}
		}
		NOT = { has_idea = crossing_the_atlantic_idea }
		NOT = { has_global_flag = allied_victory_in_africa }
	}

	abort_when_not_enabled = yes
	
	ai_strategy = {
       		type = area_priority
		id = africa
        	value = -300
    	}
	
	ai_strategy = {
       		type = area_priority
		id = LSM_africa
        	value = -300
    	}
	
	ai_strategy = {
       		type = area_priority
		id = europe
        	value = 500
    	}

	ai_strategy = {
		type = invasion_unit_request
		area = LSM_africa
		value = -200
	}

	ai_strategy = {
		type = front_unit_request
		area = LSM_africa
		value = -300
	}

	ai_strategy = {
		type = front_unit_request
		area = africa
		value = -300
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		value = 1000
		target = africa
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		value = 1000
		target = middle_east
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 69
		value = 75
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 29
		value = 75
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 61
		value = 75
	}
}
maybe_africa_is_good = {
	enable = { 
		OR = {
			is_in_faction_with = GER
			is_axis_ai = yes
		}
		AND = { 
			452 = { 
				OR = {
					is_fully_controlled_by = GER 
					is_fully_controlled_by = ITA 
				} 
			}
		}
		NOT = { has_idea = crossing_the_atlantic_idea }
	}

	abort_when_not_enabled = yes
	
	ai_strategy = {
       		type = area_priority
		id = horn_of_africa
        	value = -50
    	}

	ai_strategy = {
		type = front_unit_request
		area = horn_of_africa
		value = -50
	}
}


you_need_to_get_iw_artillery_please = {
	allowed = {
		is_ai_mass_mob = yes
	}
	enable = {
		date > 1936.3.1
	}

	abort = {
		has_tech = gw_artillery
	}

	ai_strategy = {
		type = research_weight_factor
		id = gw_artillery
		value = 300
	}
}

you_need_to_get_antitank_please = {
	allowed = {
		is_ai_mass_mob = yes
	}
	enable = {
		date > 1936.3.1
	}

	abort = {
		has_tech = interwar_antitank
	}

	ai_strategy = {
		type = research_weight_factor
		id = interwar_antitank
		value = 300
	}
}

you_need_to_get_aa_please = {
	allowed = {
		is_ai_mass_mob = yes
	}
	enable = {
		date > 1936.3.1
	}

	abort = {
		has_tech = interwar_antiair
	}

	ai_strategy = {
		type = research_weight_factor
		id = interwar_antiair
		value = 300
	}
}

axis_minor_to_war = {
	allowed = { 
		is_ai_mass_mob = yes
		is_axis_ai = yes
	}
	enable = {
		has_war = yes
		date > 1942.6.1 #do it later, support Germany first
		date < 1944.4.1
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
       		type = force_build_armies
        	value = 100
    	}
}

SOV_need_more_meat = {
	allowed = { 
		original_tag = SOV
	}
	enable = {
		has_war = no
		OR = {
			has_country_flag = mass_assault_meatwall
			has_country_flag = superior_firepower_low
		}
		date < 1940.5.1
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
       		type = force_build_armies
        	value = 100
    	}
}

allies_dont_interfere_in_adriatic = {
	enable = {
		has_war_with = ITA
		GRE = { has_capitulated = no }
		is_historical_focus_on = yes
		date < 1943.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 168 #english channel
		value = 600 # avoid doing missions as well
	}
}

GER_cultural_tank_enthusiast = {
	allowed = {
		original_tag = GER
	}
	enable = {
		GER_AI_is_infantry_based = yes		
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = research_tech
		id = infantry_weapons2
		value = 100
	}

	ai_strategy = {
		type = research_tech
		id = improved_infantry_weapons
		value = 100
	}
}

GER_cultural_tank_enthusiast2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.11.7
		GER_AI_is_mass_mob = no
	}

	abort = {
		has_tech = improved_heavy_tank_chassis 
	}

	ai_strategy = {
		type = research_tech
		id = improved_heavy_tank_chassis 
		value = 500
	}
}
SOV_cultural_tank_enthusiast2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1939.5.1
		SOV_is_tank_build = yes
	}

	abort = {
		has_tech = improved_heavy_tank_chassis 
	}

	ai_strategy = {
		type = research_tech
		id = improved_heavy_tank_chassis 
		value = 500
	}
}
military_factory_ramping = {
	enable = {
		OR = {
			threat > 0.25
			has_war = yes
		}
		NOT = {
			AND = {
				OR = {
					has_idea = undisturbed_isolation
					has_idea = isolation
				}
				has_war = no
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 25
	}
}
military_factory_ramping_2 = {
	enable = {
		OR = {
			threat > 0.80
			has_war = yes
		}
		OR = {
			num_of_civilian_factories > 200
			surrender_progress > 0
		}
		NOT = {
			AND = {
				OR = {
					has_idea = undisturbed_isolation
					has_idea = isolation
				}
				has_war = no
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 25
	}
}
SOV_cultural_air_enthusiast = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			SOV_is_deplaned = yes
			human_is_observer = yes
			has_idea = SOV_elite_difficulty
		}
		NOT = { GER = { has_country_flag = LSM_eligibility_nation } }	
		AND = {
			num_of_military_factories < 300
			surrender_progress > 0
		}	
		has_dlc = "By Blood Alone"
	}

	abort = {
		AND = {
			OR = {
				GER_is_deplaned = yes
				GER_is_not_relevant = yes
				AND = {
					has_global_flag = d_day_crisis
					num_of_military_factories > 150
				}
				AND = {
					num_of_military_factories > 300
					NOT = { surrender_progress > 0 } 
				}
			}
			human_is_observer = no
		}
		NOT = { has_idea = SOV_elite_difficulty }
	}

	ai_strategy = {
		type = air_factory_balance
		value = 0
	}

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = -999 
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = tactical_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_cas
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = cv_naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = naval_bomber
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = heavy_fighter
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = scout_plane 
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = maritime_patrol_plane
		value = -999
	}

	ai_strategy = {
		type = unit_ratio
		id = air_transport
		value = -999
	}

	ai_strategy = {
		type = equipment_production_factor
		id = air_transport
		value = -999
	}
}

SOV_build_state_AA = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			GER_is_human_yes_air = yes
			SOV_is_deplaned = yes
			human_is_observer = yes
		}
		OR = {
			AND = {
				SOV_is_deplaned = yes
				any_country = {
					has_war_with = SOV
					is_major = yes
				}
			}
			has_war_with = GER
			GER = { is_justifying_wargoal_against = SOV }
		}
	}

	abort = {
		OR = {
			AND = {
				GER_is_deplaned = yes
				human_is_observer = no
			}
			GER_is_not_relevant = yes
			SOV_is_deplaned = no
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 200 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 221 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 227 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 225 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 259 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 224 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 241 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 193 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 137 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 243 
		value = 1
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 242 
		value = 1
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 207 
		value = 1
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 808 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 812 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 810 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 12 
		value = 3
	}
}


SOV_build_state_AA_backup = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			GER_is_human_yes_air = yes
			SOV_is_deplaned = yes
			human_is_observer = yes
		}
		OR = {
			AND = {
				SOV_is_deplaned = yes
				any_country = {
					has_war_with = SOV
					is_major = yes
				}
			}
			has_war_with = GER
			GER = { is_justifying_wargoal_against = SOV }
		}		
	}

	abort = {
		OR = {
			AND = {
				GER_is_deplaned = yes
				human_is_observer = no
			}
			GER_is_not_relevant = yes
			SOV_is_deplaned = no
		}
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 219 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 252 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 254 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 253 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 255 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 224 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 247 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 248 
		value = 1
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 264 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 244 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 255 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 207 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 260 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 217 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 407 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 401 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 251 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 652 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 232 
		value = 3
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 235 
		value = 3
	}
}

SOV_build_state_AA_but_enemies_cant_take_Poland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		surrender_progress < 0.05
		date > 1942.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 95 
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 93
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 91
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 89
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 80
		value = 2
	}

	ai_strategy = {
		type = build_building
		id = anti_air_building
		target = 78
		value = 2
	}
}

SOV_figher_for_life = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date < 1945.1.1
		GER_is_deplaned = no
		GER_is_not_relevant = no
		OR = {
			is_neighbor_of = GER
			POL = { is_ai = yes }
		}
	}

	abort = {
		OR = {
			date > 1945.1.1
			GER_is_deplaned = yes
			GER_is_not_relevant = yes
			AND = {
				OR = {
					POL = { is_ai = no }
					NOT = { is_neighbor_of = GER }
				}
				NOT = { POL = { is_in_faction_with = GER } }
			}
		}
	}

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

SOV_extra_air_against_poland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		NOT = { has_war_with = GER }
		POL = { is_ai = no }
		NOT = { POL = { is_in_faction_with = GER } }
	}

	abort_when_not_enabled = yes
			

	ai_strategy = {
		type = air_factory_balance
		value = 30
	}
}

SOV_extra_cas_against_poland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_war_with = POL
		NOT = { has_war_with = GER }
		POL = { is_ai = no }
	}

	abort_when_not_enabled = yes
			

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

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -15
	}
}


SOV_we_can_do_a_bit_more_cas_maybe = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_deployed_air_force_size = {
			type = fighter
			size > 8999
		}
	}

	abort = {
		has_deployed_air_force_size = {
			type = fighter
			size < 2999 #let's stop with CAS
		}
	}

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

USA_printing_industry_research = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1937.4.1
	}

	abort = {
		has_tech = dispersed_industry3
	}

	ai_strategy = {
		type = research_tech
		id = dispersed_industry3
		value = 100
	}
}

USA_printing_industry_research2 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1939.4.1
	}

	abort = {
		always = no
	}

	ai_strategy = {
		type = research_tech
		id = dispersed_industry4
		value = 100
	}
}

USA_printing_industry_research3 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1941.4.1
	}

	abort = {
		always = no
	}

	ai_strategy = {
		type = research_tech
		id = dispersed_industry5
		value = 100
	}
}
USA_printing_tool_research = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1938.1.1
	}

	abort = {
		has_tech = advanced_machine_tools
	}

	ai_strategy = {
		type = research_tech
		id = advanced_machine_tools
		value = 100
	}
}

USA_printing_tool_research2 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1940.1.1
	}

	abort = {
		has_tech = assembly_line_production
	}

	ai_strategy = {
		type = research_tech
		id = assembly_line_production
		value = 100
	}
}

USA_printing_tool_research3 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		date > 1942.1.1
	}

	abort = {
		has_tech = streamlined_line
	}

	ai_strategy = {
		type = research_tech
		id = streamlined_line
		value = 100
	}
}
SOV_more_industry_research_is_good = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_reorganize_the_pc_of_heavy_industry
	}

	abort = {
		OR = {
			has_tech = dispersed_industry4
			has_tech = concentrated_industry4
		}
	}

	ai_strategy = {
		type = research_tech
		id = dispersed_industry4
		value = 500
	}

	ai_strategy = {
		type = research_tech
		id = concentrated_industry4
		value = 500
	}
}

SOV_more_industry_research_is_good_tech4_eff = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_reorganize_the_pc_of_heavy_industry
	}

	abort = {
		has_tech = assembly_line_production
	}

	ai_strategy = {
		type = research_tech
		id = assembly_line_production
		value = 500
	}
}

SOV_the_eastern_front = {
	
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date < 1945.1.1
			AND = {
				NOT = { has_war_with = JAP }
				NOT = { has_war_with = CHI }
			}
		}	
	}

	abort_when_not_enabled = yes

	ai_strategy = {
	 	type = front_unit_request
		area = important_area
		value = 60
	}
}

SOV_too_many_guns_is_not_good = {
	allowed = {
		original_tag = SOV
	}
	enable = { 
		NOT = { has_country_flag = mech_brick }
		has_equipment = { infantry_equipment > 100000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { infantry_equipment < 50000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = -20
	}
}


SOV_support_reserve_is_good = {
	allowed = {
		original_tag = SOV
	}
	enable = {   
		NOT = { has_country_flag = mech_brick }
		date > 1938.1.1
		has_equipment = { support_equipment < 5000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { support_equipment > 10000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 10
	}
}

SOV_truck_reserve_is_good = {
	allowed = {
		original_tag = SOV
	}
	enable = {   
		NOT = { has_country_flag = mech_brick }
		date > 1938.1.1
		has_equipment = { motorized_equipment < 2000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { motorized_equipment > 5000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = 30
	}
}

SOV_AA_is_good = {
	allowed = {
		original_tag = SOV
	}
	enable = {    
		NOT = { has_country_flag = mech_brick }
		date > 1938.1.1
		NOT = {
			any_country = {
				has_war_with = SOV
				is_ai = no
			}
		}
		has_equipment = { anti_air_equipment < 5000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { anti_air_equipment > 10000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 25
	}
}

SOV_AA_is_good_against_humans = {
	allowed = {
		original_tag = SOV
	}
	enable = {   
		NOT = { has_country_flag = mech_brick }
		date > 1938.1.1
		any_country = {
			has_war_with = SOV
			is_ai = no
		}
		has_equipment = { anti_air_equipment < 5000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { anti_air_equipment > 10000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 15
	}
}

SOV_AT_is_good_against_humans = {
	allowed = {
		original_tag = SOV
	}
	enable = {  
		NOT = { has_country_flag = mech_brick }
		date > 1938.1.1
		GER = { 
			is_ai = no
		}
		has_equipment = { anti_tank_equipment < 5000 }  #unlike generic AI, we attack a lot, so we want some healthy amount of reserve
	}
	abort = { 
		has_equipment = { anti_tank_equipment > 10000 }
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 25
	}
}
SOV_mech_need_brick = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_tech = mechanised_infantry
	}

	abort = {
		always = no
	}
	ai_strategy = {
		type = equipment_production_factor
		id = mechanized
		value = 10
	}

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = mechanized
		value = 10
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = amphibious_mechanized_equipment_1
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = amphibious_mechanized_equipment_2
		value = -100
	}
}
USA_mech_adjustment = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_tech = amphibious_drive
	}

	abort = {
		always = no
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = amphibious_mechanized_equipment_1
		value = -100
	}

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = amphibious_mechanized_equipment_2
		value = -100
	}
}
USA_tank_adjustment = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_tech = amphibious_drive
	}

	abort = {
		always = no
	}
	ai_strategy = {
		type = production_upgrade_desire_offset
		id = medium_tank_amphibious_chassis_2
		value = 25
	}
}
FRA_produce_mech_of_our_own = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
		is_in_faction_with = ENG
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 3
	}

}
FRA_produce_mech_of_our_own_2 = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		num_of_military_factories > 35
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
		is_in_faction_with = ENG
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 3
	}

}
GER_produce_mech_of_our_own = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
		NOT = { has_country_flag = mass_infantry_flag }
		NOT = { has_country_flag = mass_mob_flag }
		NOT = { has_country_flag = mobile_warfare_flag }
		GER_is_spacemarine = no
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}

}

GER_produce_mech_of_our_own_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
		NOT = { has_country_flag = mass_infantry_flag }
		NOT = { has_country_flag = mobile_warfare_flag }
		NOT = { has_country_flag = mass_mob_flag }
		GER_is_spacemarine = no
		num_of_military_factories > 100
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}
}

GER_produce_mech_of_our_own_3 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = mechanised_infantry
		num_of_military_factories > 200
		NOT = { has_country_flag = mobile_warfare_flag }
		GER_is_spacemarine = no
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}
}

ENG_USA_produce_mech_of_our_own = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 3
	}
}

ENG_USA_produce_mech_of_our_own_2 = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		OR = {
			has_tech = mechanised_infantry
			has_country_flag = mech_licensed
		}
		num_of_military_factories > 100
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 3
	}
}

ENG_USA_produce_mech_of_our_own_3 = {
	allowed = {
		OR = {
			original_tag = ENG
			original_tag = USA
		}
	}
	enable = {
		has_tech = mechanised_infantry
		num_of_military_factories > 200
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}
}

USA_produce_mech_of_our_own_3 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		has_tech = mechanised_infantry
		num_of_military_factories > 200
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}
}

BUL_we_carry_mech_production = {
	allowed = {
		original_tag = BUL
	}
	enable = {
		has_tech = mechanised_infantry
		is_in_faction_with = GER
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 5
	}
}
BUL_we_carry_mech_production2 = {
	allowed = {
		original_tag = BUL
	}
	enable = {
		is_in_faction_with = GER
		has_tech = mechanised_infantry
		num_of_military_factories > 50
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 8
	}
}
BUL_we_carry_mech_production3 = {
	allowed = {
		original_tag = BUL
	}
	enable = {
		is_in_faction_with = GER
		has_tech = mechanised_infantry
		num_of_military_factories > 100
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 15
	}
}
BUL_we_carry_mech_production4 = {
	allowed = {
		original_tag = BUL
	}
	enable = {
		is_in_faction_with = GER
		has_tech = mechanised_infantry
		num_of_military_factories > 200
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = 25
	}
}

SOV_air_force_is_real_but_so_is_human = {
	allowed = { original_tag = SOV }
	enable = {
		has_equipment = { anti_air_equipment > 3500 } 
		has_equipment = { anti_tank_equipment > 3500 } 
		has_equipment = { support_equipment > 3500 } 
		has_equipment = { infantry_equipment > 62000 } 
		has_equipment = { anti_tank_equipment > 3500 } 
		has_equipment = { motorized_equipment > 3000 }
	}
	abort = { 
		OR = {
			has_equipment = { anti_air_equipment < 800 } 
			has_equipment = { anti_tank_equipment < 800 } 
			has_equipment = { support_equipment < 800 } 
			has_equipment = { infantry_equipment < 39000 } 
			has_equipment = { anti_tank_equipment < 800 } 
			has_equipment = { motorized_equipment < 500 }
		}
	}

	ai_strategy = {
		type = air_factory_balance
		value = 25
	}

}
SOV_gun_brick = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_country_flag = mech_brick
	}

	abort = {
		has_tech = infantry_weapons2
	}

	ai_strategy = {
		type = research_tech
		id = infantry_weapons2
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}
}


SOV_gun_gun_gun_research = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1937.6.1
		NOT = { has_country_flag = mech_brick }
		NOT = { has_country_flag = grand_battleplan_15w }
	}

	abort = {
		has_tech = improved_infantry_weapons
	}

	ai_strategy = {
		type = research_tech
		id = improved_infantry_weapons
		value = 500 #get the gun, we need the gun cuz we need stacked infantry
	}

	ai_strategy = {
		type = research_tech
		id = infantry_weapons1
		value = 500 #get the gun, we need the gun cuz we need stacked infantry
	}

	ai_strategy = {
		type = research_tech
		id = infantry_weapons2
		value = 500 #get the gun, we need the gun cuz we need stacked infantry
	}
}

SOV_gun_gun_gun_research21d = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_country_flag = mech_brick
	}

	abort = {
		has_tech = improved_infantry_weapons
	}

	ai_strategy = {
		type = research_tech
		id = improved_infantry_weapons
		value = 500 #get the gun, we need the gun cuz we need stacked infantry
	}
}

SOV_mech_research_tank_build = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_pc_of_mechanical_engineering
		has_country_flag = grand_battleplan_15w
	}

	abort = {
		has_tech = mechanised_infantry
	}

	ai_strategy = {
		type = research_tech
		id = mechanised_infantry
		value = 100
	}
}


SOV_gun_gun_gun_1941_research = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_tech_bonus = {
				category = infantry_weapons
			}
			has_country_flag = rush_infantry_tech
		}
	}

	abort = {
		has_tech = advanced_infantry_weapons
	}

	ai_strategy = {
		type = research_tech
		id = advanced_infantry_weapons
		value = 500 #get the gun, we need the gun cuz we need stacked infantry
	}
}

SOV_gun_gun_gun_1941_sp_research = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.3.1
		has_tech = advanced_infantry_weapons
	}

	abort = {
		has_tech = infantry_at
		has_tech = support_weapons4
	}

	ai_strategy = {
		type = research_weight_factor
		id = infantry_at
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}

	ai_strategy = {
		type = research_weight_factor
		id = support_weapons4
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}
}

SOV_gun_gun_gun_1942_research = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1942.8.1
	}

	abort = {
		has_tech = advanced_infantry_weapons
	}

	ai_strategy = {
		type = research_weight_factor
		id = infantry_at2
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}

	ai_strategy = {
		type = research_weight_factor
		id = night_vision
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}
}

SOV_gun_gun_gun_1943_research = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1943.8.1
	}

	abort = {
		has_tech = advanced_infantry_weapons2
	}

	ai_strategy = {
		type = research_weight_factor
		id = advanced_infantry_weapons2
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}
}
GER_gun_gun_gun_1943_research = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = mass_infantry_flag
	}

	abort = {
		has_tech = advanced_infantry_weapons2
	}

	ai_strategy = {
		type = research_tech
		id = advanced_infantry_weapons
		value = 100 #get the gun, we need the gun cuz we need stacked infantry
	}
}
ahist_buuld_dockyard_when_needed = {
	enable = {
		is_historical_focus_on = no
		AND = {
			NOT = {
				any_country = {
					is_neighbor_of = ROOT
					has_capitulated = no
					has_war_with = ROOT
				}
			}
			any_owned_state = { is_coastal = yes }
			any_enemy_country = {
				num_of_naval_factories > ROOT.num_of_naval_factories
			}
		}
		num_of_military_factories > 35
		num_of_military_factories > num_of_naval_factories
		num_of_civilian_factories > 50
		num_of_civilian_factories > num_of_naval_factories
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 60
	}
}
crossing_the_ocean_dockyard = {
	enable = {
		OR = {
			has_idea = crossing_the_atlantic_idea
			has_idea = crossing_the_pacific_idea 
		}
		has_war = yes
		is_major = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 200
	}

	ai_strategy = {
		type = building_target
		id = dockyard
		value = 100
	}
}

SOV_lets_not_do_a_navy_yet = {
	allowed = { original_tag = SOV }
	enable = {
		date < 1945.1.1
		NOT = { is_in_faction_with = GER }
		NOT = { has_idea = crossing_the_atlantic_idea }
		NOT = { has_country_flag = era_of_transition }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = dockyard
		value = -100
	}

	ai_strategy = {
		type = dockyard_to_military_factory_ratio #how does this even works? 
		value = 0
	}

	ai_strategy = {
		type = build_building
		id = dockyard
		value = -300
	}
}

SOV_lets_do_a_navy_now = {
	allowed = { original_tag = SOV }
	enable = {
		has_country_flag = era_of_transition
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = dockyard
		value = 150
	}
}

GER_lets_not_do_a_navy_yet = {
	allowed = { original_tag = GER }
	enable = {
		NOT = { has_idea = crossing_the_atlantic_idea }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = dockyard
		value = -100
	}

	ai_strategy = {
		type = build_building
		id = dockyard
		value = -300
	}

	ai_strategy = {
		type = dockyard_to_military_factory_ratio #how does this even works? 
		value = 0
	}
}

FRA_lets_not_do_a_navy_yet = {
	allowed = { original_tag = FRA }
	enable = {
		NOT = { has_idea = crossing_the_atlantic_idea }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = dockyard
		value = -100
	}

	ai_strategy = {
		type = build_building
		id = dockyard
		value = -300
	}

	ai_strategy = {
		type = dockyard_to_military_factory_ratio #how does this even works? 
		value = 0
	}
}

FRA_military_factory_festival = {
	allowed = { original_tag = FRA }
	enable = {
		has_war = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 100
	}
}


SOV_volunteer_in_Ethiopia = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_global_flag = second_italo_ethiopian_war_flag
		ETH = { has_war_with = ITA }
		date > 1936.2.5
		date < 1936.4.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = "ETH"
		value = 9999 #let's help them
	}
}

SOV_axis_is_baaaad = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		GER = { 
			has_government = fascism #you know they are evil
			NOT = { is_in_faction_with = SOV }
			has_war = yes
		}
		NOT = { has_war_with = GER }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			OR = {
				tag = GER
				is_in_faction_with = GER 
				AND = {
					tag = FIN
					has_completed_focus = FIN_cooperation_with_germany
					NOT = { is_in_faction_with = SOV }
				}
			}
		}
		value = 25
	}
}

SOV_volunteer_in_WW2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		GER = { 
			AND = {
				has_war_with = ENG
				has_war_with = FRA
			}
			has_government = fascism #you know they are evil
		}
	}

	abort = {
		GER = { has_completed_focus = GER_molotov_ribbentrop_pact } #can't trust you until then
	}

	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			OR = {
				tag = GER
				is_in_faction_with = GER 
			}
		}
		value = 25
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "FRA"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "YUG"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "GRE"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "ITA"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "CZE"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "HOL"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "BEL"
		value = 999 #let's help them
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "LUX"
		value = 999 #let's help them
	}
}

be_bad_vs_player_on_very_easy_mode = {
	enable = {
		any_country = {
			has_war_with = ROOT
			is_ai = no
		}
		is_major = yes
		difficulty < 1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			OR = {
				is_ai = no
				any_country = {
					is_ai = no
					is_in_faction_with = ROOT
				}
			}
		}
		value = -20
	}
}

be_bad_vs_player_on_easy_mode = {
	enable = {
		any_country = {
			has_war_with = ROOT
			is_ai = no
		}
		is_major = yes
		difficulty < 2
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = front_unit_request
		country_trigger = { 
			OR = {
				is_ai = no
				any_country = {
					is_ai = no
					is_in_faction_with = ROOT
				}
			}
		}
		value = -5
	}
}

AI_ffs_stop_training_new_division = {
	enable = {
		set_temp_variable = { division_count = 50 }
		if = {
			limit = {
				OR = {
					NOT = {
						any_country = {
							is_in_faction_with = ROOT
							is_ai = no
						}
					}
					any_country = {
						has_war_with = ROOT
						is_ai = no
					}
				}
				is_ai = yes
				is_major = no
				difficulty < 2
			}
			multiply_temp_variable = {
				division_count = 0.7
			}
		}
		if = {
			limit = {
				OR = {
					NOT = {
						any_country = {
							is_in_faction_with = ROOT
							is_ai = no
						}
					}
					any_country = {
						has_war_with = ROOT
						is_ai = no
					}
				}
				is_ai = yes
				is_major = no
				difficulty < 1
			}
			multiply_temp_variable = {
				division_count = 0.7
			}
		}
		if = {
			limit = {
				any_country = {
					is_in_faction_with = ROOT
					is_ai = yes
				}
				has_global_flag = sheep_selected
			}
			divide_temp_variable = {
				division_count = 2
			}
		}
		if = {
			limit = {
				any_country = {
					is_in_faction_with = ROOT
					is_ai = yes
				}
				has_global_flag = saboteur_selected
			}
			multiply_temp_variable = {
				division_count = 0.8
			}
		}
		if = {
			limit = {
				OR = {
					has_country_flag = mech_god
					has_country_flag = london_uprising
					has_idea = endsieg_idea
					is_literally_china = yes
				}
			}
			multiply_temp_variable = {
				division_count = 2
			}
		}
		if = {
			limit = {
				is_japanese_endsieg = yes
				tag = JAP
			}
			multiply_temp_variable = {
				division_count = 2
			}
		}
		if = {
			limit = {
				surrender_progress > 0.2
			}
			multiply_temp_variable = {
				division_count = 1.2
			}
		}
		if = {
			limit = {
				surrender_progress > 0.4
			}
			multiply_temp_variable = {
				division_count = 1.2
			}
		}
		if = {
			limit = {
				surrender_progress > 0.6
			}
			multiply_temp_variable = {
				division_count = 1.2
			}
		}
		if = {
			limit = {
				is_literally_china = yes
				has_global_flag = china_giga
				has_war = yes
			}
			multiply_temp_variable = {
				division_count = 10
			}
		}
		if = {
			limit = {
				OR = {
					is_ai_mass_mob = yes
					is_ai_mech_mob = yes
				}
				is_major = no
			}
			multiply_temp_variable = {
				division_count = 2 #75 division limit
			}
		}
		if = {
			limit = {
				OR = {
					tag = POL
					tag = FIN
					tag = RAJ
				}
				is_historical_focus_on = yes
			}
			multiply_temp_variable = {
				division_count = 2.5
			}
		}
		if = {
			limit = {
				OR = {
					tag = POL
					tag = RAJ
				}
				has_manpower > 1000000 #print more men please
				has_war = yes
				any_enemy_country = {
					is_major = yes
				}
			}
			multiply_temp_variable = {
				division_count = 2
			}
		}
		if = {
			limit = {
				OR = {
					is_ai_mass_mob = yes
					is_ai_mech_mob = yes
				}
				is_major = yes
			}
			multiply_temp_variable = {
				division_count = 5 #250 division limit
			}
		}
		if = {
			limit = {
				AND = {
					is_ai_mass_mob = no
					is_ai_mech_mob = no
				}
				is_major = no
			}
			multiply_temp_variable = {
				division_count = 1.2
			}
		}
		if = {
			limit = {
				OR = {
					is_ai_mass_mob = yes
					is_ai_mech_mob = yes
				}
				OR = {
					tag = BRA
					tag = BUL
				}
			}
			multiply_temp_variable = {
				division_count = 2.0
			}
		}
		if = {
			limit = {
				tag = FRA
				has_completed_focus = FRA_french_union
			}
			multiply_temp_variable = {
				division_count = 2 
			}
		}
		if = {
			limit = {
				NOT = { tag = SOV } #superfaction AI
				AND = {
					is_ai_mass_mob = no
					is_ai_mech_mob = no
				}
				is_major = yes
				num_of_military_factories > 100
			}
			multiply_temp_variable = {
				division_count = 2 #350, need massive troops count for D-Day
			}
		}
		if = {
			limit = {
				NOT = { tag = SOV } #superfaction AI
				AND = {
					is_ai_mass_mob = no
					is_ai_mech_mob = no
				}
				is_major = yes
				num_of_military_factories > 50
			}
			multiply_temp_variable = {
				division_count = 5 #need massive troops count for D-Day
			}
		}
		if = {
			limit = {
				NOT = { tag = SOV } #superfaction AI
				AND = {
					is_ai_mass_mob = no
					is_ai_mech_mob = no
				}
				is_major = yes
				num_of_military_factories < 50
			}
			multiply_temp_variable = {
				division_count = 3 
			}
		}
		if = {
			limit = {
				tag = SOV
			}
			set_temp_variable = {
				division_count = 600 #only get 600 divisions  
			}
		}
		if = {
			limit = {
				tag = SOV
				OR = {
					has_country_flag = superior_firepower_low
					has_country_flag = mass_assault_meatwall
					has_country_flag = mech_brick
				}
			}
			multiply_temp_variable = {
				division_count = 1.25
			}
		}
		if = {
			limit = {
				NOT = { has_dlc = "No Step Back" }
				is_ai_mass_mob = yes
				is_major = no
				is_allied_ai = yes
				has_war = no
				date < 1940.1.1
				GER = { is_ai = yes }
				NOT = { has_global_flag = mp_difficulty }
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 10
			}
		}
		if = {
			limit = {
				OR = {
					tag = BEL
					tag = HOL
					tag = DEN
				}
				has_war = no
				date < 1940.1.1
				AND = {
					GER = { is_ai = yes }
					LIB = { is_ai = yes }
				}
				NOT = { has_global_flag = mp_difficulty }
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 5
			}
		}
		if = {
			limit = {
				OR = {
					tag = BEL
					tag = HOL
					tag = DEN
				}
				has_war = no
				difficulty < 2
				is_historical_focus_on = yes
				GER = { is_ai = no }
			}
			set_temp_variable = {
				division_count = 5
			}
		}
		if = {
			limit = {
				tag = RAJ
				has_war = no
				date < 1940.1.1
				GER = { is_ai = yes }
				NOT = { has_global_flag = mp_difficulty }
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 80
			}
		}
		if = {
			limit = {
				has_idea = dead_country
			}
			set_temp_variable = {
				division_count = 0
			}
		}
		if = {
			limit = {
				OR = {
					tag = CHI
					tag = GXC
				}
				JAP = { is_ai = no }
			}
			set_temp_variable = {
				division_count = 1000
			}
		}
		if = {
			limit = {
				OR = {
					tag = GXC
					tag = SHX
					tag = XSM
					tag = YUN
					tag = SIK
					tag = PRC
				}
				JAP = { is_ai = yes }
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 15
			}
		}
		if = {
			limit = {
				tag = FIN
				SOV = { is_ai = yes }
				NOT = { has_global_flag = mp_difficulty }
				OR = {
					GER = { is_ai = no }
					ITA = { is_ai = no }
				}
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 30
			}
		}
		if = {
			limit = {
				tag = VIC
				any_other_country = {
					tag = FRA
					has_government = democratic
					is_ai = yes
				}
				NOT = {
					any_country = {
						has_war_with = GER
						is_ai = no
					}
				}
				NOT = {
					any_country = {
						is_allied_ai = yes
						is_ai = no
					}
				}
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 45
			}
		}
		if = {
			limit = {
				tag = CAN
				num_of_military_factories > 20
			}
			set_temp_variable = {
				division_count = 100
			}
		}
		if = {
			limit = {
				OR = {
					tag = AOI
					tag = LBA
				}
				NOT = {
					OR = {
						any_country = {
							is_ai = no
							NOT = { is_in_faction_with = AOI }
							OR = {
								has_government = communism
								has_government = democratic
							}
							is_major = yes
						}
					}
				}
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 50
			}
		}
		if = {
			limit = {
				OR = {
					tag = AOI
					tag = LBA
				}
				OR = {
					any_country = {
						is_ai = no
						NOT = { is_in_faction_with = AOI }
						OR = {
							has_government = communism
							has_government = democratic
						}
						is_major = yes
					}
				}
				is_historical_focus_on = yes
			}
			set_temp_variable = {
				division_count = 200
			}
		}
		if = {
			limit = {
				is_historical_focus_on = no
				check_variable = { num_divisions < 500 }
			}
			multiply_temp_variable = {
				division_count = 1.5
			}
		}
		if = {
			limit = {
				OR = {
					original_tag = BEL
					original_tag = POL
					original_tag = HOL
					original_tag = FRA
				}
				has_global_flag = SOV_has_early_war
			}
			multiply_temp_variable = {
				division_count = 0.2
			}
		}
		if = {
			limit = {
				OR = {
					original_tag = POL
					original_tag = YUG
				}
				has_global_flag = allies_mainland_withdrawal
				has_war = no
				date < 1941.1.1 #anyway
			}
			multiply_temp_variable = {
				division_count = 0
			}
		}
		if = {
			limit = {
				original_tag = GER
				has_country_flag = mass_infantry_flag
			}
			set_temp_variable = {
				division_count = 600
			}
		}
		if = {
			limit = {
				original_tag = SOV
				has_country_flag = mobile_warfare_roach_2
			}
			set_temp_variable = {
				division_count = 10000
			}
		}
		if = {
			limit = {
				OR = {
					has_idea = GER_german_controlled_reichskommissariat
					has_idea = GER_local_controlled_reichskommissariat
				}
			}
			set_temp_variable = {
				division_count = 20
			}
		}
		if = {
			limit = {
				tag = POL
				POL = { is_ai = yes }
				GER = { is_ai = yes }
				is_historical_focus_on = yes
				NOT = {
					any_country = {
						OR = {
							is_in_faction_with = GER
							AND = {
								capital_scope = { is_on_continent = europe }
								has_government = fascism
							}	
						}
						is_ai = no 
					}
				}
			}
			set_temp_variable = {
				division_count = 20
			}
		}
		if = {
			limit = {
				is_historical_focus_on = no
			}
			set_temp_variable = {
				division_count = 700 #nobody is allowed to break this amount on ahistorical
			}	
		}
		check_variable = {
			num_divisions > division_count
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -500
	}

	ai_strategy = {
		type = build_army
		id = cavalry
		value = -500
	}

	ai_strategy = {
		type = build_army
		id = garrison
		value = -500
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -500
	}

}


SOV_ffs_stop_training_new_division = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		set_temp_variable = { division_count_SOV_a = 350 }
		if = {
			limit = {
				OR = { 
					has_tech = mobile_warfare
					has_country_flag = superior_firepower_low
					has_country_flag = mass_assault_meatwall
				}
			}
			multiply_temp_variable = {
				division_count_SOV_a = 1.7
			}
		}
		if = {
			limit = {
				NOT = { has_country_flag = pure_infantry }
				OR = {
					has_equipment = { medium_tank_chassis > 300 }
					has_equipment = { heavy_tank_chassis > 500 }
					has_equipment = { light_tank_destroyer_chassis > 500 }
					has_equipment = { heavy_tank_destroyer_chassis > 300 }
				}
			}
			multiply_temp_variable = {
				division_count_SOV_a = 1.5
			}
		}
		if = {
			limit = {
				has_country_flag = grand_battleplan_15w
			}
			set_temp_variable = { division_count_SOV_a = 380 }
		}
		if = {
			limit = {
				has_country_flag = grand_battleplan_15w
				has_equipment = { medium_tank_chassis > 3000 }
				has_equipment = { mechanized_equipment > 3000 }
			}
			multiply_temp_variable = { division_count_SOV_a = 1.2 }
		}
		if = {
			limit = {
				has_country_flag = pure_infantry
			}
			multiply_temp_variable = {
				division_count_SOV_a = 0.70
			}
		}
		if = {
			limit = {
				has_country_flag = pure_infantry
				has_equipment = { infantry_equipment > 100000 }
			}
			multiply_temp_variable = {
				division_count_SOV_a = 1.1
			}
		}
		if = {
			limit = {
				has_country_flag = pure_infantry
				has_equipment = { infantry_equipment > 200000 }
			}
			multiply_temp_variable = {
				division_count_SOV_a = 1.1
			}
		}
		if = {
			limit = {
				has_country_flag = pure_infantry
				has_equipment = { infantry_equipment > 300000 }
			}
			multiply_temp_variable = {
				division_count_SOV_a = 1.1
			}
		}
		if = {
			limit = {
				has_country_flag = mobile_warfare_roach_2
			}
			multiply_temp_variable = {
				division_count_SOV_a = 20
			}
		}
		check_variable = {
			num_divisions > division_count_SOV_a
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -500
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -500
	}

}


GER_ffs_stop_training_new_division = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1943.1.1
		NOT = { has_country_flag = mech_god }
		NOT = { has_country_flag = mass_mob_flag }
		NOT = { has_country_flag = mass_infantry_flag }
		set_temp_variable = { division_count_GER_a = 50 }
		if = {
			limit = {
				has_equipment = { medium_tank_chassis < 2000 }
			}
			multiply_temp_variable = {
				division_count_GER_a = 4
			}
		}
		if = {
			limit = {
				OR = {
					has_equipment = { medium_tank_chassis > 2000 }
					has_equipment = { heavy_tank_destroyer_chassis > 500 }
				}
			}
			multiply_temp_variable = {
				division_count_GER_a = 7
			}
		}
		if = {
			limit = {
				OR = {
					has_idea = endsieg_idea
					is_historical_focus_on = no
				}
			}
			multiply_temp_variable = {
				division_count_GER_a = 2
			}
		}
		if = {
			limit = {
				any_country = {
					has_war_with = GER
					is_ai = no
					is_major = yes
				}
			}
			multiply_temp_variable = {
				division_count_GER_a = 1.4
			}
		}
		check_variable = {
			num_divisions > division_count_GER_a
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -300
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -300
	}

}

USA_ffs_stop_training_new_division = {
	allowed = {
		original_tag = USA
	}
	enable = {
		set_temp_variable = { division_count_USA_a = 350 }
		if = {
			limit = {
				has_equipment = { medium_tank_destroyer_chassis > 2000 }
			}
			multiply_temp_variable = {
				division_count_USA_a = 2
			}
		}
		check_variable = {
			num_divisions > division_count_USA_a
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -300
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -300
	}

}
ENG_ffs_stop_training_new_division = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		set_temp_variable = { division_count_ENG_a = 350 }
		if = {
			limit = {
				has_equipment = { medium_tank_destroyer_chassis > 2000 }
			}
			multiply_temp_variable = {
				division_count_ENG_a = 1.5
			}
		}
		check_variable = {
			num_divisions > division_count_ENG_a
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -300
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -300
	}

}
GER_ffs_stop_training_new_division_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1943.1.1
		NOT = { has_country_flag = mech_god }
		NOT = { has_country_flag = mass_mob_flag }
		NOT = { has_country_flag = mass_infantry_flag }
		set_temp_variable = { division_count_GER_b = 50 }
		if = {
			limit = {
				has_equipment = { medium_tank_chassis < 2000 }
			}
			multiply_temp_variable = {
				division_count_GER_b = 4
			}
		}
		if = {
			limit = {
				has_equipment = { medium_tank_chassis > 2000 }
			}
			multiply_temp_variable = {
				division_count_GER_b = 10
			}
		}
		if = {
			limit = {
				OR = {
					is_historical_focus_on = no
					has_idea = endsieg_idea
				}
			}
			multiply_temp_variable = {
				division_count_GER_b = 2
			}
		}
		check_variable = {
			num_divisions > division_count_GER_b
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -300
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -300
	}

}
FRA_ffs_stop_training_new_division = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		set_temp_variable = { division_count_FRA_a = 150 }
		if = {
			limit = {
				has_equipment = { heavy_tank_destroyer_chassis > -500 }
			}
			multiply_temp_variable = {
				division_count_FRA_a = 2
			}
		}
		if = {
			limit = {
				date > 1940.6.1
			}
			multiply_temp_variable = {
				division_count_FRA_a = 1.25
			}
		}
		if = {
			limit = {
				date > 1941.6.1
			}
			multiply_temp_variable = {
				division_count_FRA_a = 1.25
			}
		}
		if = {
			limit = {
				is_historical_focus_on = no
			}
			multiply_temp_variable = {
				division_count_FRA_a = 2
			}
		}
		check_variable = {
			num_divisions > division_count_FRA_a
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_army
		id = infantry
		value = -300
	}

	ai_strategy = {
		type = build_army
		id = armor
		value = -300
	}

}

FRA_tank_is_meta = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		date < 1941.1.1
		NOT = { has_focus_tree = vichy_french_focus }
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = 150
	}
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = 50
	}

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

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

FRA_infantry_is_meta_ahist = {
	allowed = {
		original_tag = FRA
	}
	enable = {
		date < 1939.1.1
		NOT = { has_focus_tree = vichy_french_focus }
		is_historical_focus_on = no
	}
	abort_when_not_enabled = yes

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

allied_naval_invasion_issue = {
	enable = {
		date < 1941.1.1
		is_historical_focus_on = yes
		OR = {
			is_in_faction_with = ENG
			is_in_faction_with = FRA
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		area = mainland_europe
		value = -300
	}

	ai_strategy = {
		type = front_control
		area = mainland_europe
		ordertype = invasion
		execute_order = no
	}
}
allied_naval_invasion_avoid_blitzkriegging_africa_too_early = {
	enable = {
		date < 1941.1.1
		is_historical_focus_on = yes
		OR = {
			is_in_faction_with = ENG
			is_in_faction_with = FRA
		}
		NOT = {
			any_enemy_country = {
				is_ai = no
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control
		area = north_africa
		ordertype = invasion
		execute_order = no
	}
}
SOV_naval_invasion_issue = {
	allowed = { original_tag = SOV }

	enable = {
		has_war_with = GER
		GER_is_not_relevant = no
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		country_trigger = { always = yes }

		value = -100
	}
}

SOV_naval_invasion_issue_2 = {
	allowed = { original_tag = SOV }

	enable = {
		NOT = {
			any_country = {
				has_war_with = SOV
				is_ai = no
			}
		}
		NOT = { surrender_progress > 0 }
		has_global_flag = d_day_happened #let's join in the fun
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		tag = GER
		value = 150  #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = POL
		value = 150  #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = ROM
		value = 150  #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = BUL
		value = 200  #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = LIT
		value = 250 #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = LAT
		value = 250 #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = EST
		value = 250 #naval invade these poor soul
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = ITA
		value = 250 #naval invade these poor soul
	}
}

democratic_help_soviet_union = {
	allowed = {
		has_government = democratic
	}
	enable = {
		has_war_with = GER
		NOT = { has_war_with = SOV }
		SOV = { surrender_progress > 0.4 }
		NOT = { has_idea = d_day_preparation_1 }
		NOT = { has_idea = d_day_preparation_2 }
		NOT = { has_idea = d_day_preparation_3 }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = send_lend_lease_desire
		id = SOV
		value = 1000 #need to help them
	}

}

USA_we_are_rich_so_lets_help_FRA = {
	allowed = {
		original_tag = USA
	}
	enable = {
		OR = {
			num_of_military_factories > 200
			AND = {
				num_of_military_factories > 150
				has_war = no
			}
		}
		NOT = { has_idea = d_day_preparation_1 }
		NOT = { has_idea = d_day_preparation_2 }
		NOT = { has_idea = d_day_preparation_3 }
	}

	abort_when_not_enabled = yes	

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

}

USA_we_are_rich_so_lets_help_SOV = {
	allowed = {
		original_tag = USA
	}
	enable = {
		OR = {
			num_of_military_factories > 200
			AND = {
				num_of_military_factories > 150
				has_war = no
			}
		}
		NOT = { has_idea = d_day_preparation_1 }
		NOT = { has_idea = d_day_preparation_2 }
		NOT = { has_idea = d_day_preparation_3 }
		OR = {
			SOV = { is_ai = yes }
			SOV = { surrender_progress > 0.45 }
		}
	}

	abort_when_not_enabled = yes	

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

}

GER_we_are_poor_so_dont_fucking_help_useless_chinese = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_equipment = { infantry_equipment < 100000 }
		date < 1945.1.1
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = send_lend_lease_desire
		id = CHI
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = PRC
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = GXC
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = SIK
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = SHX
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = YUN
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = MAN
		value = -5000
	}

}

SOV_we_are_poor_so_dont_fucking_help_useless_chinese = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_equipment = { infantry_equipment < 150000 }
		date < 1945.1.1
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = send_lend_lease_desire
		id = CHI
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = PRC
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = GXC
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = SIK
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = SHX
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = YUN
		value = -5000
	}	

	ai_strategy = {
		type = send_lend_lease_desire
		id = MAN
		value = -5000
	}

}

GER_kill_Poland_is_good = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		OR = {
			has_war_with = POL
			focus_progress = {
				focus = GER_danzig_or_war
				progress > 0
			}
			has_completed_focus = GER_danzig_or_war
		}
		POL = { has_capitulated = no }
	}

	abort = {
		POL = { has_capitulated = yes }
	}

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

	ai_strategy = {
		type = front_armor_score
		id = "BEL"
		value = -50
	}

	ai_strategy = {
		type = front_armor_score
		id = "HOL"
		value = -50
	}

	ai_strategy = {
		type = front_armor_score
		id = "FRA"
		value = -100
	}

}

SOV_never_attack_first_if_about_to_be_attacked = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		NOT = { has_war_with = GER }
		GER = { has_government = fascism }
		NOT = { is_in_faction_with = GER }
		GER = { 
			OR = {
				is_justifying_wargoal_against = SOV 
				has_wargoal_against = SOV
			}
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {

		type = prepare_for_war

		id = GER

		value = 60

	}

	ai_strategy = {

	 	type = front_unit_request

		tag = GER

		value = 30
	}

	ai_strategy = {
		type = front_control
		country_trigger = {
			OR = {
				tag = GER
				is_in_faction_with = GER
			}
		}

		ratio = 0.3

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

}

axis_prepare_for_greece_and_yugoslavia = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = ITA
			original_tag = BUL
		}
	}
	enable = {
		is_in_faction_with = GER
		is_historical_focus_on = yes
		date > 1940.6.1
		date < 1941.6.1
		OR = {
			has_war_with = YUG
			has_war_with = GRE
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = front_control

		tag = GRE

		ratio = 0.7

		priority = 100
		ordertype = front
		execution_type = balanced
	}

}
SOV_kill_FIN_for_me2s = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			focus_progress = {
				focus = SOV_secure_leningrad
				progress > 0
			}
			has_completed_focus = SOV_secure_leningrad
		}
		OR = {
			has_war = yes 
			has_completed_focus = SOV_industrial_modernization
		}
		NOT = { surrender_progress > 0.05 }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {

		type = declare_war

		id = FIN

		value = 1000

	}

}

SOV_kill_FIN_for_me = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			focus_progress = {
				focus = SOV_secure_leningrad
				progress > 0
			}
			has_completed_focus = SOV_secure_leningrad
		}
		NOT = { has_idea = SOV_prepare_for_barbarossa }
		NOT = { has_war_with = GER }
		NOT = { FIN = { is_in_faction_with = SOV } }
		NOT = { 146 = { owner = { is_in_faction_with = SOV } } }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {

	 	type = front_unit_request

		tag = FIN

		value = 50
	}

	ai_strategy = {

	 	type = invasion_unit_request

		tag = FIN

		value = 15
	}

	ai_strategy = {
		type = front_control

		tag = FIN

		ratio = 0.8

		priority = 100
		ordertype = front
		execution_type = balanced
	}

}

SOV_kill_FIN_for_me_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_war_with = FIN
		NOT = { has_war_with = GER }
		has_equipment = { infantry_equipment > 2000 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {

	 	type = front_unit_request

		tag = FIN

		value = 25
	}

	ai_strategy = {
		type = front_control

		tag = FIN

		ratio = 0.7

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

}

SOV_care_FIN_for_me = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		NOT = { FIN = { is_in_faction_with = SOV } }
		FIN = { has_idea = FIN_the_lone_wolf }
		NOT = { has_war_with = GER }
		NOT = { has_war_with = FIN }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {

		type = prepare_for_war

		id = FIN

		value = 1000

	}

	ai_strategy = {

	 	type = front_unit_request

		tag = FIN

		value = 25
	}

	ai_strategy = {

	 	type = invasion_unit_request

		tag = FIN

		value = 15
	}

	ai_strategy = {
		type = front_control

		tag = FIN

		ratio = 0.8

		priority = 100
		ordertype = front
		execution_type = balanced
	}

}

SOV_praise_the_brick = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date < 1942.1.1
		OR = {
			has_country_flag = pure_infantry
			has_country_flag = mech_brick
		}
	}

	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = role_ratio
		id = armor
		value = -200
	}

	ai_strategy = {
		type = air_factory_balance
		value = 25
	}
}

SOV_praise_the_brick_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1942.1.1
		has_country_flag = mech_brick
	}

	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 100
	}
}

USA_marines_corp = {

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

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 30
	}
}
USA_combined_arms = {
	allowed = {
		original_tag = USA
	}
	enable = {
		num_of_military_factories > 100
		NOT = { has_global_flag = d_day_happened }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 50
	}
	
	ai_strategy = {
		type = role_ratio
		id = cas
		value = 15
	}

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

}
USA_combined_arms2 = {
	allowed = {
		original_tag = USA
	}
	enable = {
		num_of_military_factories > 100
		has_global_flag = d_day_happened
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 50
	}
	
	ai_strategy = {
		type = role_ratio
		id = cas
		value = 50
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 15
	}

}

ENG_even_more_planes = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		is_in_faction_with = USA
		NOT = { has_global_flag = d_day_happened }
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = air_factory_balance
		value = 35
	}

}
SOV_T34_1 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_idea = SOV_t34_mass_production_1 
			has_idea = SOV_t34_mass_production_2
			has_idea = SOV_t34_mass_production_3
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 2 #we wait for the second phase of Barbarossa
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 2
	}

	ai_strategy = {
		type = unit_ratio
		id = armor #tanks cannot live under red air
		value = 2
	}

}

SOV_T34_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_idea = SOV_t34_mass_production_4
			has_idea = SOV_t34_mass_production_5
			has_idea = SOV_t34_mass_production_6
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 5 #we wait for the second phase of Barbarossa
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = armor #tanks cannot live under red air
		value = 5
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 2
	}

}

SOV_T34_3 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_idea = SOV_t34_mass_production_7
			has_idea = SOV_t34_mass_production_8
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 10 #we wait for the second phase of Barbarossa
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 10
	}

	ai_strategy = {
		type = unit_ratio
		id = armor #tanks cannot live under red air
		value = 10
	}

}

SOV_T34_4 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			has_idea = SOV_t34_mass_production_9
			has_idea = SOV_t34_mass_production_10
		}
	}

	abort_when_not_enabled = yes	

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 20 #we wait for the second phase of Barbarossa
	}

	ai_strategy = {
		type = equipment_production_factor
		id = armor #tanks cannot live under red air
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = armor #tanks cannot live under red air
		value = 20
	}

}

SOV_befriend_USA_for_foreign_experts = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_foreign_experts
		has_idea = SOV_gosproyektstroy_1
		AND = {
			NOT = { has_idea = SOV_gosproyektstroy_2_usa }
			NOT = { has_idea = SOV_gosproyektstroy_3_usa_mil }
			NOT = { has_idea = SOV_gosproyektstroy_3_usa_civ }
			NOT = { has_idea = SOV_gosproyektstroy_3_usa_dock }
			NOT = { has_idea = SOV_gosproyektstroy_2_eng }
			NOT = { has_idea = SOV_gosproyektstroy_3_eng_mil }
			NOT = { has_idea = SOV_gosproyektstroy_3_eng_civ }
			NOT = { has_idea = SOV_gosproyektstroy_3_eng_dock }
			NOT = { has_idea = SOV_gosproyektstroy_2_ger }
			NOT = { has_idea = SOV_gosproyektstroy_3_ger_mil }
			NOT = { has_idea = SOV_gosproyektstroy_3_ger_civ }
			NOT = { has_idea = SOV_gosproyektstroy_3_ger_dock }
			NOT = { has_idea = SOV_gosproyektstroy_2_jap }
			NOT = { has_idea = SOV_gosproyektstroy_3_jap_mil }
			NOT = { has_idea = SOV_gosproyektstroy_3_jap_civ }
			NOT = { has_idea = SOV_gosproyektstroy_3_jap_dock }
		}
		country_exists = USA
		USA = {
			has_opinion = {
				target = ROOT
				value < 60
			}
			has_capitulated = no
			is_subject = no
		}
	}
	abort = {
		OR = {
			OR = {
				has_idea = SOV_gosproyektstroy_2_usa
				has_idea = SOV_gosproyektstroy_3_usa_mil
				has_idea = SOV_gosproyektstroy_3_usa_civ
				has_idea = SOV_gosproyektstroy_3_usa_dock
			}
			OR = {
				NOT = { country_exists = USA }
				has_war_with = USA
				USA = {
					has_opinion = {
						target = ROOT
						value > 80 
					}
				}
			}
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = USA
		target = improve_relation
		value = 9999
	}
}

JAP_retreat_from_the_colonies = {
	allowed = {
		original_tag = JAP
	}
	enable = {
		has_war = yes
		enemies_naval_strength_ratio > 3
		has_equipment = {
   			convoy < 400
	  	}	
	}

	abort = {	
		OR = {
			has_war = no
			AND = {
				enemies_naval_strength_ratio < 1.5
				has_equipment = {
   					convoy > 400
	  			}
			}
			enemies_naval_strength_ratio < 1
		}
	}

	ai_strategy = {
		type = put_unit_buffers
		# home island states
		states = {
			531
			282
			535
			534
			530
			528
			532
			533
			529
		}
		ratio = 1
		area = JAP_home_islands
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}

	ai_strategy = {
		type = area_priority
		id = JAP_home_islands
		value = 10000 #more focus here
	}

	ai_strategy = {
		type = area_priority
		id = asia
		value = -1000 #gotta retreat
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = -1000 
	}

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

SOV_get_antitank_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1936.10.1
	}

	abort = {
		has_tech = interwar_antitank
	}

	ai_strategy = {
		type = research_weight_factor
		id = interwar_antitank
		value = 300
	}
}

SOV_get_antitank2_please = {
	allowed = {
		OR = {
			original_tag = SOV
			is_ai_mass_mob = yes
		}
	}
	enable = {
		date > 1939.1.1
	}

	abort = {
		has_tech = antitank1
	}

	ai_strategy = {
		type = research_tech
		id = antitank1
		value = 100
	}
}

GER_get_antitank3_please = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = USA
		}
	}
	enable = {
		date > 1939.1.1
	}

	abort = {
		has_tech = antitank2
	}

	ai_strategy = {
		type = research_tech
		id = antitank2
		value = 500
	}
}
GER_get_antitank4_please = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = USA
		}
	}
	enable = {
		date > 1939.1.1
	}

	abort = {
		has_tech = antitank3
	}

	ai_strategy = {
		type = research_tech
		id = antitank3
		value = 500
	}
}
GER_get_antitank5_please = {
	allowed = {
		OR = {
			original_tag = USA
		}
	}
	enable = {
		date > 1940.1.1
	}

	abort = {
		has_tech = antitank4
	}

	ai_strategy = {
		type = research_tech
		id = antitank4
		value = 500
	}
}

SOV_get_antitank3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1939.4.1
	}

	abort = {
		has_tech = antitank2
	}

	ai_strategy = {
		type = research_tech
		id = antitank2
		value = 500
	}
}

SOV_get_antitank4_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.4.1
	}

	abort = {
		has_tech = antitank3
	}

	ai_strategy = {
		type = research_tech
		id = antitank3
		value = 100
	}
}

SOV_more_industry_research_is_good_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		has_completed_focus = SOV_industrial_modernization
	}

	abort = {
		OR = {
			has_tech = streamlined_line
		}
	}

	ai_strategy = {
		type = research_tech
		id = streamlined_line
		value = 1000
	}
}

SOV_get_antitank5_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			original_tag = SOV
			is_ai_mass_mob = yes
		}
	}

	abort = {
		has_tech = antitank4
	}

	ai_strategy = {
		type = research_weight_factor
		id = antitank4
		value = 200
	}
}

SOV_get_antitank6_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			original_tag = SOV
			is_ai_mass_mob = yes
		}
	}

	abort = {
		has_tech = antitank5
	}

	ai_strategy = {
		type = research_weight_factor
		id = antitank5
		value = 200
	}
}

SOV_get_field_hospital2_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.1.1
		has_tech = mass_assault
	}

	abort = {
		has_tech = tech_field_hospital2
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_field_hospital2
		value = 100
	}
}

SOV_get_field_hospital3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.4.1
		has_tech = mass_assault
	}

	abort = {
		has_tech = tech_field_hospital3
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_field_hospital3
		value = 100
	}
}
SOV_get_field_hospital2_please2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.6.1
		has_country_flag = pure_infantry
	}

	abort = {
		has_tech = tech_field_hospital2
	}

	ai_strategy = {
		type = research_tech
		id = tech_field_hospital2
		value = 100
	}
}

SOV_get_field_hospital3_please2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.4.1
		has_country_flag = pure_infantry
	}

	abort = {
		has_tech = tech_field_hospital3
	}

	ai_strategy = {
		type = research_tech
		id = tech_field_hospital3
		value = 100
	}
}

SOV_get_tech_logistics_company_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1939.1.1
		OR = {
			NOT = { has_country_flag = mech_brick }
			is_researching_technology = improved_infantry_weapons
			has_tech = improved_infantry_weapons
		}
	}

	abort = {
		has_tech = tech_logistics_company
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_logistics_company
		value = 100
	}
}

SOV_get_tech_logistics_company2_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.9.1
	}

	abort = {
		has_tech = tech_logistics_company2
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_logistics_company2
		value = 100
	}
}

SOV_get_tech_logistics_company3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.4.1
	}

	abort = {
		has_tech = tech_logistics_company3
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_logistics_company3
		value = 100
	}
}

SOV_get_engineer2_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.6.1
	}

	abort = {
		has_tech = tech_engineers2
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_engineers2
		value = 100
	}
}

SOV_get_engineer3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.4.1
	}

	abort = {
		has_tech = tech_engineers3
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_engineers3
		value = 100
	}
}

SOV_get_field_hospital4_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1945.1.1
	}

	abort = {
		has_tech = tech_field_hospital4
	}

	ai_strategy = {
		type = research_weight_factor
		id = tech_field_hospital4
		value = 100
	}
}

SOV_get_field_hospital_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1940.3.1
		OR = {
			NOT = { has_country_flag = mech_brick }
			is_researching_technology = improved_infantry_weapons
			has_tech = improved_infantry_weapons
		}
		has_tech = mass_assault
	}

	abort = {
		has_tech = tech_field_hospital
	}

	ai_strategy = {
		type = research_tech
		id = tech_field_hospital
		value = 100
	}
}
SOV_get_field_hospital_tank_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_tank_build = yes
		date > 1939.1.1
	}

	abort = {
		has_tech = tech_field_hospital
	}

	ai_strategy = {
		type = research_tech
		id = tech_field_hospital
		value = 100
	}
}
SOV_get_anti_air_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1939.6.1
			AND = {
				date > 1938.9.1
				OR = {
					GER_is_human_yes_air = yes
					GER_is_super_ai_yes_air = yes
					human_is_observer = yes
				}
			}
		}
	}

	abort = {
		has_tech = antiair1
	}

	ai_strategy = {
		type = research_tech
		id = antiair1
		value = 100
	}
}

SOV_get_anti_air2_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1940.1.1
			AND = {
				date > 1939.6.1
				OR = {
					GER_is_human_yes_air = yes
					GER_is_super_ai_yes_air = yes
					human_is_observer = yes
				}
			}
		}
	}

	abort = {
		has_tech = antiair2
	}

	ai_strategy = {
		type = research_tech
		id = antiair2
		value = 100
	}
}

SOV_get_anti_air3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1940.9.1
			AND = {
				date > 1940.1.1
				OR = {
					GER_is_human_yes_air = yes
					GER_is_super_ai_yes_air = yes
					human_is_observer = yes
				}
			}
		}
	}

	abort = {
		has_tech = antiair3
	}

	ai_strategy = {
		type = research_weight_factor
		id = antiair3
		value = 100
	}
}

SOV_get_anti_air4_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1941.9.1
			AND = {
				date > 1941.1.1
				OR = {
					GER_is_human_yes_air = yes
					GER_is_super_ai_yes_air = yes
					human_is_observer = yes
				}
			}
		}
	}

	abort = {
		has_tech = antiair4
	}

	ai_strategy = {
		type = research_weight_factor
		id = antiair4
		value = 100
	}
}

SOV_get_anti_air5_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1942.9.1
			AND = {
				date > 1942.1.1
				OR = {
					GER_is_human_yes_air = yes
					GER_is_super_ai_yes_air = yes
					human_is_observer = yes
				}
			}
		}
	}

	abort = {
		has_tech = antiair5
	}

	ai_strategy = {
		type = research_weight_factor
		id = antiair5
		value = 100
	}
}

SOV_get_aa_cannon_3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {	
			date > 1946.3.1
			AND = {	
				date > 1946.3.1
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = aa_cannon_3
	}

	ai_strategy = {
		type = research_weight_factor
		id = aa_cannon_3
		value = 100
	}
}

SOV_get_engine_3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1943.9.1 #about time
			has_global_flag = french_contact
			AND = {
				date > 1939.9.1 #about time
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = engines_3
	}

	ai_strategy = {
		type = research_weight_factor
		id = engines_3
		value = 100
	}
}

SOV_get_engine_4_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1943.6.1
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = engines_4
	}

	ai_strategy = {
		type = research_weight_factor
		id = engines_4
		value = 100
	}
}

SOV_be_careful_with_Poland = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			POL = { is_ai = no }
			POL = { is_major = yes }
		}
		OR = {
			any_country = {
				is_allied_ai = yes
				is_major = yes
				has_guaranteed = POL
			}
			POL = { is_in_faction_with = GER }
		}
		has_army_manpower = { size < 2499999 }
		date < 1941.4.1
		NOT = { POL = { has_war_with = GER } }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "POL"
		value = -2000
	}
}

SOV_declare_to_fulfill_molotov_ribbentrop = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		POL = { has_war_with = GER }
		NOT = { has_war_with = GER }
		POL = { has_capitulated = no }
		has_idea = SOV_molotov_ribbentrop_pact
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "POL"
		value = 5000
	}

	ai_strategy = {
		type = antagonize
		id = "POL"
		value = 5000
	}
}
poland_dont_ask_allies_vs_soviet_early = {
	allowed = {
		always = yes
	}
	enable = {
		POL = { has_war_with = SOV }
		POL = { has_war_with = GER }
		POL = { is_in_faction = yes }
		POL = { has_capitulated = no }
		POL = { is_faction_leader = no }
		is_in_faction_with = POL
		date < 1941.1.1
	}
	abort_when_not_enabled = yes
	reversed = yes 

	ai_strategy = {
		type = diplo_action_desire
		id = POL
		value = -99999
		target = call_allies
	} 

	ai_strategy = {
		type = diplo_action_acceptance
		id = POL
		value = -99999
		target = join_allies
	}
 
}
allies_dont_help_poland_vs_soviet_early = {
	enable = {
		POL = { has_war_with = SOV }
		POL = { has_war_with = GER }
		POL = { is_in_faction = yes }
		POL = { has_capitulated = no }
		is_in_faction_with = POL
		POL = { is_faction_leader = no }
		OR = {
			has_global_flag = {
				flag = molotov_ribbentrop_fulfillment_grace 
				days < 90
			}
			date < 1941.1.1
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_desire
		id = POL
		value = -99999
		target = join_allies
	}

	ai_strategy = {
		type = diplo_action_acceptance
		id = POL
		value = -99999
		target = call_allies
	}
 
}

SOV_heavy_bomb_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1943.8.1
			AND = {
				date > 1942.1.1
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = heavy_bombs
	}

	ai_strategy = {
		type = research_weight_factor
		id = heavy_bombs
		value = 100
	}
}

SOV_survivability_tech_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1943.1.1 #pushed up
			has_global_flag = french_contact
			AND = {
				date > 1939.1.1 #pushed up
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
		OR = {
			is_researching_technology = improved_small_airframe
			has_tech = improved_small_airframe
			has_global_flag = french_contact
		}
	}

	abort = {
		has_tech = survivability_studies
	}

	ai_strategy = {
		type = research_weight_factor
		id = survivability_studies
		value = 100
	}
}

deadline_for_improved_airframe = {
	enable = {
		OR = {
			is_major = yes
			is_ai_airforce = yes
		}
		amount_research_slots > 3
		date > 1939.6.1
		is_subject = no
		NOT = { has_tech = improved_small_airframe }
	}

	abort = {
		has_tech = improved_small_airframe
	}

	ai_strategy = {
		type = research_tech
		id = improved_small_airframe
		value = 100
	}
}

SOV_aa_hmg_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1943.3.1 #push up
			has_global_flag = french_contact
			AND = {
				date > 1939.3.1 #push up
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
		OR = {
			is_researching_technology = improved_small_airframe
			has_global_flag = french_contact
			has_tech = improved_small_airframe
		}
	}

	abort = {
		has_tech = aa_hmg
	}

	ai_strategy = {
		type = research_weight_factor
		id = aa_hmg
		value = 100
	}
}

SOV_nuke_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_deplaned = no
		date > 1941.9.1
		surrender_progress < 0.1
		num_of_civilian_factories > 200
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = atomic_research
	}

	ai_strategy = {
		type = research_weight_factor
		id = atomic_research
		value = 100
	}
}

SOV_nuke2_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_deplaned = no
		date > 1943.11.1
		surrender_progress < 0.1
		num_of_civilian_factories > 200
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = nuclear_reactor 
	}

	ai_strategy = {
		type = research_weight_factor
		id = nuclear_reactor 
		value = 100
	}
}

SOV_nuke3_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_deplaned = no
		date > 1946.1.1
		surrender_progress < 0.1
		num_of_civilian_factories > 200
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		has_tech = nukes
	}

	ai_strategy = {
		type = research_weight_factor
		id = nukes
		value = 100
	}
}

SOV_nuke4_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_deplaned = no
		has_tech = nukes
		surrender_progress < 0.1
		num_of_civilian_factories > 300
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		date > 1948.1.1
		surrender_progress > 0.1
	}

	ai_strategy = {
		type = building_target
		id = nuclear_reactor 
		value = 20
	}
}

SOV_nuke5_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		SOV_is_deplaned = no
		has_tech = nukes
		num_of_civilian_factories > 400
		NOT = { has_idea = SOV_elite_difficulty }
	}

	abort = {
		date > 1951.1.1
	}

	ai_strategy = {
		type = building_target
		id = nuclear_reactor 
		value = 80
	}
}

SOV_it_is_time_for_CAS_but_not_a_lot_of_planes_yet = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		date > 1941.7.1 #wait for Barbarossa fighters first and see
		has_deployed_air_force_size = {
			size > 8999 #we control the sky
			type = fighter
		}
		NOT = {
			any_country = {
				has_war_with = SOV
				has_deployed_air_force_size = {
					size > 9999 #but they don't
					type = fighter
				}
			}
		}
		OR = {
			surrender_progress < 0.1
			any_country = {
				has_war_with = SOV
				is_major = yes
				surrender_progress > 0.4 #they are in trouble anyway
			}
		}
	}

	abort_when_not_enabled = yes

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

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

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

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

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

 	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 15 #we control the sky sooooo...
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -15
	}
}

SOV_range_improvements_please = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		OR = {
			date > 1943.3.1 #push up
			has_global_flag = french_contact
			AND = {
				date > 1940.1.1 #probably about time
				GER_is_human_yes_air = no
				GER_is_super_ai_yes_air = no
				human_is_observer = no
			}
		}
		NOT = { has_idea = SOV_elite_difficulty }
		OR = {
			is_researching_technology = improved_small_airframe
			has_global_flag = french_contact
			has_tech = improved_small_airframe
		}
	}

	abort = {
		has_tech = range_improvements
	}

	ai_strategy = {
		type = research_weight_factor
		id = range_improvements
		value = 100
	}
}

SOV_really_wants_rubber = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		AND = { 
			SOV_is_deplaned = no
			OR = { 
				has_war_with = MAL
				has_war_with = INS
				has_war_with = ENG
				has_war_with = USA
				has_resources_in_country = {
					resource = rubber
					amount < 1
				}
			}
			date > 1943.1.1
			OR = {
				num_of_civilian_factories > 300
				num_of_military_factories > 300
			}
		}	
	}
	
	abort = { 
		has_resources_in_country = {
			resource = rubber
			amount > 80
		}
	}

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 20
	}

	ai_strategy = {
		type = research_weight_factor
		id = improved_rubber_processing
		value = 100
	}
}

SOV_really_wants_rubber_2 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		AND = { 
			SOV_is_deplaned = no
			OR = { 
				has_war_with = MAL
				has_war_with = INS
				has_war_with = ENG
				has_war_with = USA
				has_resources_in_country = {
					resource = rubber
					amount < 1
				}
			}
			date > 1944.1.1
			OR = {
				num_of_civilian_factories > 500
				num_of_military_factories > 500
			}
		}	
	}
	
	abort = { 
		has_resources_in_country = {
			resource = rubber
			amount > 200
		}
	}

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 20
	}

	ai_strategy = {
		type = research_weight_factor
		id = improved_rubber_processing
		value = 100
	}

	ai_strategy = {
		type = research_weight_factor
		id = advanced_rubber_processing
		value = 100
	}
}

SOV_really_wants_rubber_3 = {
	allowed = {
		original_tag = SOV
	}
	enable = {
		AND = { 
			SOV_is_deplaned = no
			OR = { 
				has_war_with = MAL
				has_war_with = INS
				has_war_with = ENG
				has_war_with = USA
				has_resources_in_country = {
					resource = rubber
					amount < 1
				}
			}
			date > 1944.1.1
			OR = {
				num_of_civilian_factories > 750
				num_of_military_factories > 750
			}
		}	
	}
	
	abort = { 
		has_resources_in_country = {
			resource = rubber
			amount > 300
		}
	}

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 50
	}

	ai_strategy = {
		type = research_weight_factor
		id = advanced_rubber_processing
		value = 100
	}

	ai_strategy = {
		type = research_weight_factor
		id = modern_rubber_processing
		value = 100
	}
}


allies_dislike_germany_soil = {
	allowed = {
		is_allied_ai = yes
	}
	enable = {
		is_historical_focus_on = yes
		is_in_faction_with = ENG
		NOT = { GER = { has_war_with = SOV } }
		NOT = { GER = { has_war_with = USA } }	
		date < 1941.1.1
		has_war_with = GER
		FRA = { has_capitulated = no }
		NOT = { GER = { surrender_progress > 0 } }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 7 
		value = -25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 39 
		value = -25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 6 
		value = -25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 8 
		value = -25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 21 
		value = -25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 18 
		value = 15000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 19 
		value = 15000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 20 
		value = 15000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 5 
		value = 25000 #Too easy to lose planes here
	}
}


axis_dislike_french_soil = {
	allowed = {
		tag = GER
	}
	enable = {
		NOT = {
			OR = {
				NOT = { country_exists = BEL }
				AND = {
					has_war_with = BEL
					BEL = { has_capitulated = yes }
				}
			}
		}
		has_war_with = ENG
		NOT = { FRA = { surrender_progress > 0 } }
		date < 1941.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 20 
		value = -15000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 208 
		value = -15000 #Too easy to lose planes here
	}
}


allies_mainland_withdrawal_frontline = {
	enable = {
		game_is_on_historical_course = yes
		is_in_faction_with = ENG
		NOT = { tag = FRA }
		NOT = { tag = POL }
		OR = {
			NOT = {
				FRA = { has_country_flag = LSM_eligbility_nation }
			}
			FRA = {
				has_country_flag = {
					flag = LSM_eligibility_nation 
					days < 90
				}
			}
		}
		has_global_flag = allies_mainland_withdrawal
		NOT = { is_in_faction_with = USA }
		is_historical_focus_on = yes
		date < 1941.1.1 #anyway
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		target = mainland_europe
		value = -9999
	}

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = -500
	}
}
allies_mainland_withdrawal_frontline_mainland_europe_evacuate_asap = {
	enable = {
		game_is_on_historical_course = yes
		is_in_faction_with = ENG
		AND = {
			OR = {
				tag = BEL
				tag = HOL
				tag = LUX
			}
			surrender_progress > 0.1
		}
		OR = {
			NOT = {
				FRA = { has_country_flag = LSM_eligbility_nation }
			}
			FRA = {
				has_country_flag = {
					flag = LSM_eligibility_nation 
					days < 90
				}
			}
		}
		has_global_flag = allies_mainland_withdrawal
		NOT = { is_in_faction_with = USA }
		is_historical_focus_on = yes
		date < 1941.1.1 #anyway
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		target = mainland_europe
		value = -9999
	}

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = -500
	}

	ai_strategy = {
		type = garrison
		value = -9999
	}

	ai_strategy = {
		type = put_unit_buffers
		order_id = 2
		# south england
		states = {
			125
			126
			127
			130
			123
			338
			131
			121
			119	
			932
			132
			122
			4
			12
			6
		}

		ratio = 2

		area = europe

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}

allies_mainland_withdrawal_frontline_mainland_europe_evacuate_by_default = {
	enable = {
		game_is_on_historical_course = yes
		is_in_faction_with = ENG
		OR = {
			tag = FRA
			tag = POL
		}
		NOT = { surrender_progress > 0 }
		OR = {
			NOT = { has_country_flag = LSM_eligibility_nation }
			has_country_flag = {
				flag = LSM_eligibility_nation
				days < 90
			}
		}
		has_global_flag = allies_mainland_withdrawal
		NOT = { is_in_faction_with = USA }
		is_historical_focus_on = yes
		date < 1941.1.1 #anyway
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers
		order_id = 2
		# south england
		states = {
			125
			126
			127
			130
			123
			338
			131
			121
			119	
			932
			132
			122
			4
			12
			6
		}

		ratio = 0.50

		area = europe

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}
allies_mainland_withdrawal_frontline_mainland_europe_evacuate_begin = {
	enable = {
		game_is_on_historical_course = yes
		is_in_faction_with = ENG
		OR = {
			tag = FRA
			tag = POL
		}
		surrender_progress > 0.01
		surrender_progress < 0.2
		OR = {
			NOT = { has_country_flag = LSM_eligibility_nation }
			has_country_flag = {
				flag = LSM_eligibility_nation
				days < 90
			}
		}
		has_global_flag = allies_mainland_withdrawal
		NOT = { is_in_faction_with = USA }
		is_historical_focus_on = yes
		date < 1941.1.1 #anyway
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		target = mainland_europe
		value = -9999
	}

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = -40
	}

	ai_strategy = {
		type = garrison
		value = -9999
	}

	ai_strategy = {
		type = put_unit_buffers
		order_id = 2
		# south england
		states = {
			125
			126
			127
			130
			123
			338
			131
			121
			119	
			932
			132
			122
			4
			12
			6
		}

		ratio = 0.50

		area = europe

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}
allies_mainland_withdrawal_frontline_mainland_europe_evacuate_slow = {
	enable = {
		game_is_on_historical_course = yes
		is_in_faction_with = ENG
		OR = {
			tag = FRA
			tag = POL
		}
		surrender_progress > 0.2
		OR = {
			NOT = { has_country_flag = LSM_eligibility_nation }
			has_country_flag = {
				flag = LSM_eligibility_nation
				days < 90
			}
		}
		has_global_flag = allies_mainland_withdrawal
		NOT = { is_in_faction_with = USA }
		is_historical_focus_on = yes
		date < 1941.1.1 #anyway
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		target = mainland_europe
		value = -9999
	}

	ai_strategy = {
		type = front_unit_request
		area = mainland_europe
		value = -100
	}

	ai_strategy = {
		type = garrison
		value = -9999
	}

	ai_strategy = {
		type = put_unit_buffers
		order_id = 2
		# south england
		states = {
			125
			126
			127
			130
			123
			338
			131
			121
			119	
			932
			132
			122
			4
			12
			6
		}

		ratio = 0.80

		area = europe

		subtract_invasions_from_need = yes
		subtract_fronts_from_need = yes
	}
}

