

GER_you_should_be_prepared_for_war = {
	allowed = { 
		tag = GER
	}
	enable = {
		has_army_manpower = { size < 700000 }
	}
	abort = {
		has_army_manpower = { size > 700000 }
	}
	
	ai_strategy = {
        	type = force_build_armies
        	value = 100
    	}
}
anti_soviet_pact_initiator = {
	allowed = {
		tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_idea = anti_soviet_pact
		NOT = { is_in_faction_with = SOV }
		has_wargoal_against = SOV
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = antagonize
		id = SOV
		value = 2500
	}
	ai_strategy = {
		type = declare_war
		id = SOV
		value = 500
	}
}
anti_soviet_pact_collective_action = {
	enable = {
		is_historical_focus_on = yes
		has_global_flag = SOV_has_early_war
		has_idea = anti_soviet_pact
		NOT = { has_government = communism }
		GER = { has_war_with = SOV }
		OR = {
			has_war = no
			has_war_with = SOV
		}
		GER = { has_idea = anti_soviet_pact }
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = diplo_action_acceptance
		id = "GER"
		target = military_access
		value = 1000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "GER"
		target = military_access
		value = 1000
	}
}

anti_soviet_pact_collective_action_reverse = {
	reversed = yes
	enable = {
		is_historical_focus_on = yes
		has_global_flag = SOV_has_early_war
		has_idea = anti_soviet_pact
		NOT = { has_government = communism }
		OR = {
			has_war_with = SOV
			has_war = no
		}
		GER = { has_idea = anti_soviet_pact }
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = diplo_action_acceptance
		id = "GER"
		target = military_access
		value = 1000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "GER"
		target = military_access
		value = 1000
	}
}

anti_soviet_pact_collective_action_fight_soviet = {
	enable = {
		GER = { has_idea = anti_soviet_pact }
		is_historical_focus_on = yes
		has_idea = anti_soviet_pact
		NOT = { has_government = communism }
		GER = { has_war_with = SOV }
		OR = {
			is_faction_leader = yes
			is_in_faction = no 
		}
		OR = {
			has_war = no
			has_war_with = SOV
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = antagonize
		id = SOV
		value = 2500
	}
	ai_strategy = {
		type = declare_war
		id = SOV
		value = 500
	}

}

the_push_into_the_union = {
	enable = {
		GER = { has_idea = anti_soviet_pact }
		OR = {
			has_equipment = { infantry_equipment > 15000 }
			has_equipment = { medium_tank_chassis > 1000 }
		}
		set_temp_variable = { days = global.num_days }
		modulo_temp_variable = { days = 60 }
		check_variable = { days < 30 }
		
		OR = {
			AND = {
				is_major = no
				has_manpower > 50000
			}
			AND = {
				is_major = yes
				has_manpower > 500000
			}
		}
		has_war_with = SOV
		has_idea = anti_soviet_pact
		OR = {
			SOV = { surrender_progress > 0.3 }
			date < 1941.1.1
		}
		has_equipment = { infantry_equipment > 10000 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = SOV

		ratio = 0.3

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

}
invading_britain_is_fun = {
	enable = {
		has_war_with = ENG
		OR = {
			ENG = { is_ai = no }
			SOV = { is_ai = no }
			USA = { is_ai = no }
			is_historical_focus_on = no
		}
		maybe_england_is_eligible_target = yes
		NOT = { 
			any_country = {
				is_neighbor_of = ROOT
				has_war_with = ROOT
				is_major = yes
				surrender_progress < 0.5
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_invasion_focus
		value = 10
	}

	ai_strategy = {
		type = invasion_unit_request
		area = UK
		value = 24
	}
	
	ai_strategy = {
		type = invade
		id = "ENG"
		value = 500 #counterbalances...
	}

	ai_strategy = {
		type = strike_force_home_base
		id = 16 # north sea
	}
}
fascist_has_wargoal = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_government = fascism
		NOT = { has_completed_focus = GER_around_maginot }
	}

	abort = {
		OR = {
			is_historical_focus_on = no
			date > 1940.5.1
			has_completed_focus = GER_around_maginot
			has_war_with = HOL
			has_war_with = BEL
			has_war_with = LUX
			has_global_flag = SOV_has_early_war
		}
	}

	ai_strategy = {
		type = declare_war
		id = "LUX"
		value = -99999
	}

	ai_strategy = {
		type = declare_war
		id = "BEL"
		value = -99999
	}

	ai_strategy = {
		type = declare_war
		id = "HOL"
		value = -99999
	}

	ai_strategy = {
		type = conquer
		id = "LUX"
		value = -99999
	}

	ai_strategy = {
		type = conquer
		id = "BEL"
		value = -99999
	}

	ai_strategy = {
		type = conquer
		id = "HOL"
		value = -99999
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "BEL"
		target = declare_war
		value = -50000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "LUX"
		target = declare_war
		value = -50000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "HOL"
		target = declare_war
		value = -50000
	}
}
is_it_time_for_war_benelux = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_government = fascism
		is_faction_leader = yes
		has_global_flag = vanilla_history
		NOT = { has_completed_focus = GER_around_maginot }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "LUX"
		value = -9999
	}

	ai_strategy = {
		type = declare_war
		id = "BEL"
		value = -9999
	}

	ai_strategy = {
		type = declare_war
		id = "HOL"
		value = -9999
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "BEL"
		target = declare_war
		value = -50000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "LUX"
		target = declare_war
		value = -50000
	}

	ai_strategy = {
		type = conquer
		id = "LUX"
		value = -9999
	}

	ai_strategy = {
		type = conquer
		id = "BEL"
		value = -9999
	}

	ai_strategy = {
		type = conquer
		id = "HOL"
		value = -9999
	}
}
is_it_time_for_war_polen = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_completed_focus = GER_danzig_or_war
		AND = {
			date < 1939.9.1
			has_global_flag = {
				flag = danzig_or_war_flag
				days < 16 
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "POL"
		value = -9999
	}
}

is_it_time_for_war_soviet = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes	
		has_completed_focus = GER_war_with_the_ussr
		AND = {
			date < 1941.6.22
			has_global_flag = {
				flag = operation_barbarossa
				days < 180 
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = declare_war
		id = "SOV"
		value = -9999
	}
}

GER_stay_on_heavy_1 = {
	enable = {
		tag = GER
		GER = { has_equipment = { heavy_tank_destroyer_chassis < 4000 } }
		has_country_flag = spacemarine_gbp
	}

	abort_when_not_enabled = yes

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

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

	ai_strategy = {
		type = production_upgrade_desire_offset
		id = heavy_tank_destroyer_chassis_3
		value = -100
	}
}
axis_gun3_is_bad = {
	enable = {
		OR = {
			tag = GER
			is_in_faction_with = GER
		}
		is_historical_focus_on = yes
		GER = { has_equipment = { infantry_equipment < 80000 } }
		NOT = { 
			AND = {
				tag = GER
				has_country_flag = mass_infantry_flag 
			}
		}
	}

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

GER_FRA_is_always_enemy = {
	enable = {
		is_in_faction_with = GER
		is_historical_focus_on = yes
		SOV = { has_idea = SOV_molotov_ribbentrop_pact }
		GER = { can_declare_war_on = FRA }
		has_war = no
		NOT = {
			GER = {
				OR = {
					focus_progress = {
						focus = GER_around_maginot
						progress > 0
					}
					has_completed_focus = GER_around_maginot
					has_war_with = FRA
				}
			}
		}
	}

	abort_when_not_enabled = yes

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


axis_minor_stack_vs_maginot = {
	enable = {
		is_in_faction_with = GER
		is_historical_focus_on = yes
		is_major = no
		GER = { can_declare_war_on = FRA }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state = 28
		value = 15
	}

	ai_strategy = {
		type = antagonize
		id = FRA
		value = 500
	}
}
GER_dont_try_to_blitz = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_war_with = FRA
		FRA = { has_capitulated = yes }
	}
	abort = {
		OR = {
			AND = {
				has_war_with = SOV
				has_global_flag = d_day_happened
			}
			SOV = { has_country_flag = LSM_eligibility_nation }
			ENG = { surrender_progress > 0 }
		}
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 1 #Strategic Region ID - Southern England
		value = -5000 #value of stocked main front in active combat is usually around 35,000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 18 #Strategic Region ID - English Channel
		value = -5000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 2 #Strategic Region ID - English Channel
		value = -5000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 3 #Strategic Region ID - English Channel
		value = -5000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 16 #Strategic Region ID - English Channel
		value = -5000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 43 #Strategic Region ID - English Channel
		value = -5000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 4 #Strategic Region ID - English Channel
		value = -50000 #Too easy to lose planes here
	}
}
ITA_try_to_blitz_to_help = {
	allowed = {
		tag = ITA
	}
	enable = {
		is_in_faction_with = GER
		GER = { is_ai = no }
		is_historical_focus_on = yes
		has_war_with = FRA
		has_war_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 1
		value = 50000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 2
		value = 50000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 18
		value = 50000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 208
		value = 50000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 5
		value = 50000
	}

	ai_strategy = {
		type = strategic_air_importance
		id = 6
		value = 50000
	}
}

GER_balkan_focus_YUG = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_war_with = YUG
		YUG = { has_capitulated = no }
		FRA = { has_capitulated = yes }
		NOT = { has_war_with = SOV }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 24 
		value = 35000 #value of stocked main front in active combat is usually around 35,000
	}
}

ENG_balkan_dont_focus_YUG = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		is_historical_focus_on = yes
		has_war_with = GER
		YUG = { has_capitulated = yes }
		YUG = { surrender_progress > 0.90 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 24 
		value = -35000 #value of stocked main front in active combat is usually around 35,000
	}
}


GER_balkan_focus_GRE = {
	allowed = {
		original_tag = GER
		has_dlc = "Battle for the Bosporus"
	}
	enable = {
		is_historical_focus_on = yes
		has_war_with = GRE
		GRE = { has_capitulated = no }
		date < 1941.4.4
		FRA = { has_capitulated = yes }
		NOT = { has_war_with = SOV }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 25 
		value = 35000 #value of stocked main front in active combat is usually around 35,000
	}

	ai_strategy = {
		type = force_defend_ally_borders
		value = 9999
		id = "ITA"
	}
}
BUL_wait_for_historical_date = {
	allowed = {
		original_tag = BUL
		has_dlc = "Battle for the Bosporus"
	}
	enable = {
		is_historical_focus_on = yes
		country_exists = GER
		is_in_faction_with = GER
		GER = { is_ai = yes }
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1941.04.01
			GER = { has_war_with = YUG }
			GER = { has_war_with = SOV }
			GER = { has_war_with = GRE }
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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

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


ROM_wait_for_historical_date = {
	allowed = {
		original_tag = ROM
		has_dlc = "Battle for the Bosporus"
	}
	enable = {
		is_historical_focus_on = yes
		country_exists = GER
		is_in_faction_with = GER
		GER = { is_ai = yes }
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			GER = { has_war_with = YUG }
			date > 1940.11.23
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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

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


HUN_wait_for_historical_date = {
	allowed = {
		original_tag = HUN
		has_dlc = "Battle for the Bosporus"
	}
	enable = {
		is_historical_focus_on = yes
		country_exists = GER
		is_in_faction_with = GER
		GER = { is_ai = yes }
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1940.11.20
			GER = { has_war_with = SOV }
			GER = { has_war_with = YUG }
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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

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


axis_do_not_pressure_BUL = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = BUL
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1941.04.01
			GER = { has_war_with = YUG }
			BUL = { has_war = yes }
			has_war_with = SOV
			GER = { has_war_with = GRE }
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = BUL
		target = call_allies
		value = -99999
	}
}

axis_do_not_pressure_BUL_2 = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = BUL
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1941.04.01
			GER = { has_war_with = YUG }
			BUL = { has_war = yes }
			has_war_with = SOV
			GER = { has_war_with = GRE }
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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


axis_do_not_pressure_HUN = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = HUN
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1940.11.20
			HUN = { has_war = yes }
			GER = { has_war_with = YUG }
			has_war_with = SOV
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = HUN
		target = call_allies
		value = -99999
	}
}

axis_do_not_pressure_HUN_2 = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = HUN
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			HUN = { has_war = yes }
			GER = { has_war_with = YUG }
			date > 1940.11.20
			has_war_with = SOV
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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


axis_do_not_pressure_ROM = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = ROM
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			date > 1940.11.23
			ROM = { has_war = yes }
			has_war_with = SOV
			GER = { has_war_with = YUG }
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

	ai_strategy = {
		type = diplo_action_desire
		id = ROM
		target = call_allies
		value = -99999
	}
}

axis_do_not_pressure_ROM_2 = {
	allowed = {
		is_axis_ai = yes
	}
	enable = {
		is_in_faction_with = ROM
		has_war = yes	
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			NOT = { country_exists = GER }
			ROM = { has_war = yes }
			date > 1940.11.23
			GER = { has_war_with = YUG }
			has_war_with = SOV
			GER = { surrender_progress > 0.03 }
			ITA = { surrender_progress > 0.1 }
			any_country = {
				is_in_faction_with = ROOT
				has_war_with = SOV
			}
			AND = {
				NOT = { has_global_flag = vanilla_history }
				any_country = {
					has_war_with = GER
					is_major = yes
					is_ai = no
				}
			}
			has_global_flag = mp_difficulty
		}
	}

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

hungarian_germany_friendship = {
	allowed = { original_tag = GER }

	enable = {
		NOT = { has_global_flag = vanilla_history }
		has_government = fascism
		OR = {
			HUN = { has_government = fascism }
			HUN = { has_completed_focus = wuw_HUN_spur_on_the_trianon_trauma }
		}
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = HUN
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "HUN"
		value = 200
	}
}


hungarian_germany_friendship_2 = {
	allowed = { original_tag = HUN }

	enable = {
		NOT = { has_global_flag = vanilla_history }
		has_government = fascism
		OR = {
			HUN = { has_government = fascism }
			HUN = { has_completed_focus = wuw_HUN_spur_on_the_trianon_trauma }
		}
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = GER
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "GER"
		value = 200
	}
}
bulgarian_balkan_friend_GER = {
	allowed = { original_tag = GER }

	enable = {
		has_government = fascism
		NOT = { has_global_flag = vanilla_history }
		BUL = { has_government = fascism }
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = BUL
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "BUL"
		value = 200
	}
}


bulgarian_balkan_friend_BUL = {
	allowed = { original_tag = BUL }

	enable = {
		has_government = fascism
		NOT = { has_global_flag = vanilla_history }
		BUL = { has_government = fascism }
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = GER
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "GER"
		value = 200
	}
}
romanian_balkan_friend_GER = {
	allowed = { original_tag = GER }

	enable = {
		has_government = fascism
		NOT = { has_global_flag = vanilla_history }
		OR = {
			ROM = { has_government = fascism }	
			AND = {
				is_historical_focus_on = yes
				ROM = { 
					fascism > 0.30 
					is_ai = yes
				}
			}
		}
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = ROM
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "ROM"
		value = 200
	}
}


romanian_balkan_friend_ROM = {
	allowed = { original_tag = ROM }

	enable = {	
		has_government = fascism
		NOT = { has_global_flag = vanilla_history }
		OR = {
			ROM = { has_government = fascism }	
			AND = {
				is_historical_focus_on = yes
				ROM = { 
					fascism > 0.30 
					is_ai = yes
				}
			}
		}
	}
	abort = {
		OR = {
			has_global_flag = vanilla_history
			is_in_faction_with = GER
			GER_is_oppose_hitler = yes
		}
	}
	ai_strategy = {
		type = alliance
		id = "GER"
		value = 200
	}
}
GER_do_not_train_too_much = {
	allowed = { original_tag = GER }
	enable = { 
		has_government = fascism
		has_war = yes
		NOT = { has_war_with = SOV }
		date > 1941.1.1
		has_global_flag = FRA_already_surrendered
		OR = {
			has_equipment = { infantry_equipment < 30000 } 
			has_equipment = { medium_tank_chassis < 500 } 
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ai_wanted_divisions_factor
		value = -30 #override dictator trait
	}
}

GER_barbarossa_gun_prep = {
	allowed = {
		original_tag = GER
	}
	enable = { 
		has_war = yes
		NOT = { has_war_with = SOV }
		has_global_flag = FRA_already_surrendered
		has_equipment = { infantry_equipment < 60000 } 
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 160
	}
}
GER_supermarine = {
	allowed = { 
		original_tag = GER
	}
	enable = { 
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = role_ratio
		id = mountaineer
		value = 20
	}
}

GER_get_more_infantry_out_ahist = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = no
		check_variable = { num_divisions < 170 }
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = ai_wanted_divisions_factor
		value = 200
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = armor
		value = -15
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 100
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 50
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 50
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = armor
		value = -25
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 15
	}
}

GER_unit_production = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort = {
		always = no
	}

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

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

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

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

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

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

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

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

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

	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 15
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = -50 #because doctrine this = 50
	}

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 35 #30 to 50
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 10
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 5 #20 to 40
	}

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 25
	}
	ai_strategy = {
		type = equipment_production_min_factories_archetype #Build these up over time, don't stall
		id = infantry_equipment
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories_archetype #Build these up over time, don't stall
		id = support_equipment
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories #Build these up over time, don't stall
		id = anti_air
		value = 2
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 1
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment
		value = 5
	}

	ai_strategy = { #added to railway gun define (set to 0 by default, increased in default strategies)
		type = railway_gun_divisions_ratio
		value = 1
	}

}
GER_td_prod_mw = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.1.1
		has_country_flag = mobile_warfare_flag
	}
	abort = {
		always = no
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = medium_tank_destroyer_chassis
		value = 20
	}
}
GER_armored_production_axis_mass_mob = {
	allowed = {
		original_tag = GER
	}
	enable = { #count trigger does not work here
		OR = {
			AND = {
				is_in_faction_with = HUN
				is_in_faction_with = ROM
			}
			AND = {
				is_in_faction_with = BUL
				is_in_faction_with = ITA
			}
			AND = {
				is_in_faction_with = BUL
				is_in_faction_with = ROM
			}
			AND = {
				is_in_faction_with = BUL
				is_in_faction_with = HUN
			}
			AND = {
				is_in_faction_with = ROM
				is_in_faction_with = ITA
			}
			AND = {
				is_in_faction_with = HUN
				is_in_faction_with = ITA
			}
		}
		GER_is_spacemarine = no
		NOT = { has_country_flag = mech_god }
		NOT = { has_country_flag = mass_mob_flag }
		OR = {
			NOT = { has_country_flag = mass_infantry_flag }
			GER_europe_is_ours = yes
		}
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = 10
	}

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

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 45
	}

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

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

	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment
		value = 12
	}

	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = 3
	}

	ai_strategy = {
		type = equipment_production_factor
		id = mechanized
		value = 20
	}
}
GER_armored_production_axis_human_wave = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = mass_infantry_flag
		GER_europe_is_ours = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = air_factory_balance
		value = 50
	}
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = -100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = marines
		value = -100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = mountaineers
		value = -100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = infantry
		value = 600
	}
	ai_strategy = {
		type = force_build_armies
		value = 100
	}
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 25
	}
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 25
	}
	ai_strategy = {
		type = equipment_production_factor
		id = motorized
		value = 25
	}
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = -10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 20
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = 10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = flame
		value = 7
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = medium_tank_flame_chassis
		value = 5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = flame
		value = 5
	}

	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = armored_support_vehicle
		value = 5
	}
	ai_strategy = {
		type = equipment_variant_production_factor
		id = support_equipment
		value = 5
	}
}

GER_armored_production_spacemarine_gbp = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = spacemarine_gbp
		GER_europe_is_ours = no
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = -100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = mountaineer
		value = -100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = infantry
		value = 100
	}
	ai_strategy = {
		type = role_ratio #even more tanks
		id = marines
		value = 100
	}
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = mechanized_equipment
		value = -10
	}
}

GER_the_love_for_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.9.1
		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 = 30
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = flame
		value = 10
	}
}
GER_land_boost_early_game = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1937.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = air_factory_balance
		value = -200
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = -20
	}

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = naval_bomber
		value = -20
	}
}
GER_land_boost_early_game_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1938.1.1
	}
	abort_when_not_enabled = yes	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = -20
	}	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -200
	}
}
GER_armored_production_axis_human_wave_rich = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = mass_infantry_flag
		GER_europe_is_ours = no
		num_of_military_factories > 100
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = air_factory_balance
		value = 25
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 2  # Germany needs a minimum production of CAS planes
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = motorized
		value = 3
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = -10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 10
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = -3
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 10
	}
}
GER_armored_production_axis_human_wave_rich2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = mass_infantry_flag
		GER_europe_is_ours = no
		num_of_military_factories > 200
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = air_factory_balance
		value = 25
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 2  # Germany needs a minimum production of CAS planes
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = motorized
		value = 2
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_air
		value = -10
	}
	ai_strategy = {
		type = equipment_production_factor
		id = anti_tank
		value = 20
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_air
		value = -5
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = anti_tank
		value = 15
	}
}
GER_armored_production_axis_mass_mob_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1940.3.1
		GER_is_spacemarine = no
		NOT = { has_country_flag = mech_god }
		NOT = { has_country_flag = mass_mob_flag }
		OR = {
			NOT = { has_country_flag = mass_infantry_flag }
			GER_europe_is_ours = yes
		}
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = 10
	}

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

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 15
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 7
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = mechanized
		value = 13
	}
}

GER_armored_production_prebarb = {
	allowed = {
		original_tag = GER
	}
	enable = {
		FRA = { has_capitulated = yes }
		OR = {
			is_in_faction_with = ITA
			ITA = { has_capitulated = yes }
		}
		GER_is_spacemarine = no
		NOT = { has_country_flag = mass_mob_flag }
		NOT = { has_country_flag = mech_god }
		OR = {
			NOT = { has_country_flag = mass_infantry_flag }
			GER_europe_is_ours = yes
		}
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio #even more tanks
		id = armor
		value = 10
	}

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

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = support
		value = 15
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = support
		value = 10
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = mechanized
		value = 23
	}
}

GER_armored_production_axis_spacemarine = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			AND = {
				GER_is_spacemarine = yes
				NOT = { has_country_flag = mech_god }
				has_army_manpower = { size < 1200000 }
				FRA = { has_capitulated = no }
			}
			has_country_flag = mass_mob_flag
		}
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 20
	}
	
	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 80
	}
	
	ai_strategy = {
		type = role_ratio 
		id = armor
		value = -25
	}

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

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

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

GER_armored_production_axis_spacemarine2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		GER_is_spacemarine = yes
		NOT = { has_country_flag = mech_god }
		OR = {
			has_army_manpower = { size > 1200000 }
			FRA = { has_capitulated = yes }
		}
	}
	abort_when_not_enabled = yes

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

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

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

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

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

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

GER_armored_production_axis_mech_god = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = mech_god
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 100
	}
	
	ai_strategy = {
		type = role_ratio 
		id = armor
		value = -25
	}

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

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

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

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

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

GER_halt_light_armor_production_in_transitioning = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_template_majority_unit = medium_armor
		NOT = { has_country_flag = mass_mob_flag }
		NOT = { has_country_flag = mass_infantry_flag }
		NOT = { has_country_flag = mobile_warfare }
		OR = {
			has_equipment = { light_tank_chassis > 600 }
			date > 1938.8.1
		}
	}
	abort = {
		always = no  # once we start we never go back to light armor
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = light_tank_chassis
		value = -100
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = -20 #downprio this for some more tanks
	}
	
}

GER_stockpile_less_early_game = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_stockpile_surplus_ratio
		value = -20 # reduce while we build up in case of CZE or Austria issues
	}
}

GER_dont_waste_xp_until_medium_armor = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort = {
		has_template_majority_unit = medium_armor
	}

	ai_strategy = {
		type = template_prio
		id = paratrooper
		value = -100
	}
}
GER_template_design = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1940.1.1
	}
	abort = {
		date > 1940.1.1
	}

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

	ai_strategy = {
		type = template_prio
		id = artillery
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -50
	}

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

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 30
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}
}

war_with_poland = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_reassert_eastern_claims
		country_exists = POL
		NOT = { has_war_with = POL }
		has_war = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = antagonize
		id = "POL"
		value = 1000
	}

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

	ai_strategy = {
	 	type = prepare_for_war
		id = POL
		value = 200
	}
}

we_stab_poland_in_the_ass = {
	allowed = {
		original_tag = GER
	}
	enable = {
			tag = GER
			has_government = fascism
			NOT = { POL = { is_in_faction_with = GER } }
			OR = {
				POL = { is_faction_leader = yes } 
				POL = { is_in_faction = no }
			}
			NOT = { has_war_with = POL }
			POL = { is_ai = no }
			POL = { has_war_with = SOV }
			85 = { owner = { tag = GER } }
			NOT = {
				any_country = {
					is_neighbor_of = GER
					is_major = yes
					has_war_with = GER
					num_of_military_factories > 24
					has_capitulated = no
				}
			}
	}

	abort = {
		OR = {
			NOT = { country_exists = POL }
			has_war_with = POL
			is_in_faction_with = POL
		}
	}

	ai_strategy = {
		type = conquer
		id = "POL"
		value = 9999
	}

	ai_strategy = {
		type = declare_war
		id = "POL"
		value = 9999
	}
}

# Make sure we deploy our breakthrough units against Poland
GER_blitzkrieg_poland = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		OR = {
			focus_progress = {
				focus = GER_danzig_or_war
				progress > 0.01
			}
			has_war_with = POL
			has_completed_focus = GER_danzig_or_war
		}	
		NOT = {
			OR = {
				POL = { has_capitulated = yes }
				has_war_with = HOL
				surrender_progress > 0.05
			}	
		}
	}

	abort_when_not_enabled = yes 
	
	ai_strategy = {
		type = consider_weak
		id = POL
		value = 100
	}
	ai_strategy = {
		type = front_armor_score
		id = POL
		value = 200
	}
	ai_strategy = {
		type = front_armor_score
		id = HOL
		value = -200
	}
	ai_strategy = {
		type = front_armor_score
		id = BEL
		value = -200
	}
	ai_strategy = {
		type = front_armor_score
		id = LUX
		value = -200
	}
	ai_strategy = {
		type = conquer
		id = HOL
		value = -200
	}
	ai_strategy = {
		type = conquer
		id = BEL
		value = -200
	}
	ai_strategy = {
		type = conquer
		id = LUX
		value = -200
	}

	ai_strategy = {
		type = force_concentration_target_weight
		state = 762
		state = 584
		state = 10

		value = 100
   
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		value = 500
		id = "HUN"
	}

	ai_strategy = {
		type = dont_defend_ally_borders
		value = 500
		id = "ROM"
	}
}
danzig_of_war_preparation = {
	allowed = {
		original_tag = GER
	}
	enable = {
		focus_progress = {
			focus = GER_danzig_or_war
			progress > 0.01
		}
		NOT = {
			has_completed_focus = GER_danzig_or_war
			owns_state = 85
		}
		country_exists = POL
	}

	abort = {
		OR = {
			NOT = { country_exists = POL }

			AND = {
				has_completed_focus = GER_danzig_or_war
				GER = { has_war_with = POL }
			}

			owns_state = 85
		}
	}

	ai_strategy = {
		type = conquer
		id = "POL"
		value = 100
	}
}

dont_die_in_mountains = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1942.5.1
		country_exists = SWI
		is_historical_focus_on = yes
	}
	abort = {
		OR = {
			AND = {
				NOT = { country_exists = FRA }
				date > 1942.5.1
			}
			SWI = {	
				NOt = {has_idea = SWI_swiss_neutrality}
			}
		}
	}

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

war_with_soviets = {
	allowed = {
		original_tag = GER
	}
	enable = {
		can_declare_war_on = SOV
		is_historical_focus_on = yes
		country_exists = SOV
	}
	abort = {
		NOT = { country_exists = SOV }
	}


	ai_strategy = {
		type = antagonize
		id = "SOU" # Yes, SOU is deliberate
		value = 200
	}
}

soviet_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_alliance_with_the_ussr
		country_exists = SOV
	}
	abort = {
		NOT = { country_exists = SOV }
	}

	ai_strategy = {
		type = befriend
		id = "SOV"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "SOV"
		value = 200
	}
}


italy_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_form_rome_berlin_axis
		country_exists = ITA
	}
	abort = {
		NOT = { country_exists = ITA }
	}

	ai_strategy = {
		type = befriend
		id = "ITA"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "ITA"
		value = 200
	}
}

iron_pact_italy = {
	allowed = {
		original_tag = GER
	}
	enable = {
		ITA = {
			has_completed_focus = ITA_pact_of_steel
			exists = yes
		}
	}
	abort = {
		NOT = { country_exists = ITA }
	}

	ai_strategy = {
		type = befriend
		id = "ITA"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "ITA"
		value = 100
	}
}

dont_join_gie_wars_early = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_in_faction_with = ITA
		ITA = {
			all_enemy_country = {
				is_government_in_exile = yes
			}
		}
	}
	abort = {
		OR = {
			GER = {
				any_enemy_country = {
					is_government_in_exile = no
				}
			}
			ITA = {
				any_enemy_country = {
					is_government_in_exile = no
				}
			}
		}
	}

	ai_strategy = {
	    type = diplo_action_desire
	    id = ITA
	    value = -9999
	    target = join_allies
	}

	ai_strategy = {
	    type = diplo_action_acceptance
	    id = ITA
	    value = -9999
	    target = call_allies
	}
}

japan_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_japan
		country_exists = JAP
	}
	abort = {
		NOT = { country_exists = JAP }
	}

	ai_strategy = {
		type = befriend
		id = "JAP"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "JAP"
		value = 200
	}
}

china_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_china
		country_exists = CHI
	}
	abort = {
		NOT = { country_exists = CHI }
	}

	ai_strategy = {
		type = befriend
		id = "CHI"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "CHI"
		value = 200
	}
}

poland_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_poland
		country_exists = POL
	}
	abort = {
		NOT = { country_exists = POL }
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 9999
	}
}

poland_allyd = {
	allowed = {
		original_tag = POL
	}
	enable = {
		GER = { has_completed_focus = GER_befriend_poland }
		country_exists = GER
	}
	abort = {
		NOT = { country_exists = GER }
	}
	ai_strategy = {
		type = alliance
		id = "GER"
		value = 9999
	}
}
turkey_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_turkey
		country_exists = TUR
	}
	abort = {
		NOT = { country_exists = TUR }
	}

	ai_strategy = {
		type = befriend
		id = "TUR"
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = "TUR"
		value = 100
	}
}

nazi_always_dislike_poland_if_they_hold_danzig = {
	allowed = {
		original_tag = GER
	}
	enable = {
		GER = { has_government = fascism }
		POL = { controls_state = 85 }
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = alliance
		id = "POL"
		value = -5000
	}
	ai_strategy = {
		type = befriend
		id = "POL"
		value = -5000
	}
}
dislike_poland_GER = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			AND = {
				GER = { has_war = no }		
				POL = { is_ai = yes }
			}
			AND = {
				NOT = { POL = { has_government = fascism } }
				GER = { has_government = fascism }
			}
			AND = {
				POL = { 
					OR = {
						has_government = fascism 
						fascism > 0.50
					}
				}
				NOT = { GER = { has_government = fascism } }
			}
			AND = {
				POL = { 
					OR = {
						has_government = communism 
						communism > 0.50
					}
				}
				NOT = { GER = { has_government = communism } }
			}
			AND = {
				GER = { has_government = communism }
				NOT = { POL = { has_government = communism } }
			}
			POL = { 
				is_in_faction = yes 
				NOT = { is_in_faction_with = GER }
			}
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = alliance
		id = "POL"
		value = -5000
	}
	ai_strategy = {
		type = befriend
		id = "POL"
		value = -5000
	}
}
dislike_france = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			AND = {
				GER = { has_government = fascism }
				FRA = { 
					OR = { 
						has_government = democratic
						has_government = communism
					}
				}
			}
			AND = {
				GER = { has_government = neutrality }
				FRA = { 
					OR = { 
						has_government = fascism
						has_government = communism
					}
				}
			}
			AND = {
				GER = { has_government = communism }
				FRA = { 
					OR = { 
						has_government = fascism
						has_government = neutrality
					}
				}
			}
			AND = {
				GER = { has_government = democratic }
				FRA = { 
					OR = { 
						has_government = fascism
						has_government = communism
					}
				}
			}
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = alliance
		id = "FRA"
		value = -5000
	}
	ai_strategy = {
		type = befriend
		id = "FRA"
		value = -5000
	}
}
dislike_poland_POL = {
	allowed = {
		original_tag = POL
	}
	enable = {
		OR = {
			AND = {
				NOT = { POL = { has_government = fascism } }
				GER = { has_government = fascism }
			}
			AND = {
				POL = { 
					OR = {
						has_government = fascism 
						fascism > 0.5
					}
				}
				NOT = { GER = { has_government = fascism } }
			}
			AND = {
				POL = { 
					OR = {
						has_government = communism 
						communism > 0.5
					}
				}
				NOT = { GER = { has_government = communism } }
			}
			AND = {
				GER = { has_government = communism }
				NOT = { POL = { has_government = communism } }
			}
			POL = { 
				is_in_faction = yes 
				NOT = { is_in_faction_with = GER }
			}
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = alliance
		id = "GER"
		value = -2000
	}
	ai_strategy = {
		type = befriend
		id = "GER"
		value = -2000
	}
	ai_strategy = {
		type = declare_war
		id = "GER"
		value = 200
	}
}


GER_japan_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_japan
		country_exists = JAP
	}
	abort = {
		NOT = { country_exists = JAP }
	}

	ai_strategy = {
		type = befriend
		id = JAP
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = JAP
		value = 200
	}
}

GER_china_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		
		OR = {
			has_completed_focus = GER_befriend_china
			has_completed_focus = GER_closer_sino_germanic_relations
		}
		country_exists = CHI
	}
	abort = {
		NOT = { country_exists = CHI }
	}

	ai_strategy = {
		type = befriend
		id = CHI
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = CHI
		value = 200
	}
}

GER_turkey_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_befriend_turkey
		country_exists = TUR
	}
	abort = {
		NOT = { country_exists = TUR }
	}

	ai_strategy = {
		type = befriend
		id = TUR
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = TUR
		value = 100
	}
}

GER_spain_ally = {
	allowed = {
		NOT = { has_dlc = "La Resistance" }
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_alliance_with_spain
		country_exists = SPR
		SPR = { has_government = fascism } # TODO Find way to detect dynamic revolter tag
	}
	abort = {
		NOT = { country_exists = SPR }
	}

	ai_strategy = {
		type = befriend
		id = SPR
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = SPR
		value = 100
	}
}

GER_spain_ally_la_resistance = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_completed_focus = GER_alliance_with_spain
		country_exists = SPA
	}
	abort = {
		OR = {
			NOT = { country_exists = SPA }
			SPA = { has_completed_focus = SPA_join_the_allies }
		}
	}

	ai_strategy = {
		type = befriend
		id = SPA
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = SPA
		value = 100
	}
}

GER_denmark_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_utilize_the_nordliche_gesellschaft
		country_exists = DEN
	}
	abort = {
		NOT = { country_exists = DEN }
	}

	ai_strategy = {
		type = befriend
		id = DEN
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = DEN
		value = 100
	}
}

GER_sweden_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_utilize_the_nordliche_gesellschaft
		country_exists = SWE
	}
	abort = {
		NOT = { country_exists = SWE }
	}

	ai_strategy = {
		type = befriend
		id = SWE
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = SWE
		value = 100
	}
}

GER_dutch_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_influence_the_benelux
		country_exists = HOL
	}
	abort = {
		NOT = { country_exists = HOL }
	}

	ai_strategy = {
		type = befriend
		id = HOL
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = HOL
		value = 100
	}
}
GER_norway_ally = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_utilize_the_nordliche_gesellschaft
		country_exists = NOR
	}
	abort = {
		NOT = { country_exists = NOR }
	}

	ai_strategy = {
		type = befriend
		id = NOR
		value = 100
	}
	ai_strategy = {
		type = alliance
		id = NOR
		value = 100
	}
}
anschluss_rejected = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_anschluss
		country_exists = AUS
	}
	abort = {
		NOT = {
			country_exists = AUS
		}
	}

	ai_strategy = {
		type = antagonize
		id = "AUS"
		value = 300
	}
}

CZE_is_idiot = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_global_flag = CZE_refused_sudetenland
		country_exists = CZE
	}
	abort = {
		NOT = {
			country_exists = CZE
		}
	}

	ai_strategy = {
		type = antagonize
		id = "CZE"
		value = 300
	}
}

play_nice_with_ribbentrop_pact = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_global_flag = sov_yes_pact
	}
	abort = {
		OR ={
			GER = { has_war_with = SOV }
			date > 1941.5.1
			AND = {
				LIT = { is_in_faction_with = SOV }
				LAT = { is_in_faction_with = SOV }
				EST = { is_in_faction_with = SOV }
			}
		}
	}

	# leave britney alone!
	ai_strategy = {
		type = ignore
		id = "LIT"
		value = 100
	}
	ai_strategy = {
		type = ignore
		id = "LAT"
		value = 100
	}
	ai_strategy = {
		type = ignore
		id = "EST"
		value = 100
	}
}

GER_prepare_against_czechoslovakia_again = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1940.6.1
		focus_progress = {
			focus = GER_fate_of_czechoslovakia
			progress > 0.01
		}
		country_exists = CZE
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = force_concentration_front_factor
		tag = CZE
		value = 200
	}
}

GER_prepare_against_czechoslovakia = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1940.1.1
		focus_progress = {
			focus = GER_demand_sudetenland
			progress > 0.01
		}
		country_exists = CZE
		NOT = { has_country_flag = sudetenland_acquired }

		# TODO This enable trigger should be made a bit more robust. Right now, if CZE is puppeted by Germany or just half-conquered by them, this strat would still be active.
	}
	abort_when_not_enabled = yes

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

	ai_strategy = {
		type = force_concentration_front_factor
		tag = CZE
		value = 200
	}
}
tfv_protect_fascist_south_africa = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = saf_fascist_uprising # Set from the national focus
	}
	abort = {
		surrender_progress > 0.8
		SAF = { has_civil_war = no }
	}

	ai_strategy = {
		type = protect
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = send_volunteers_desire
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = support
		id = "SAF"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "SAF"
		value = 200
	}
}

less_naval_focused_nation = {
	allowed = {
		original_tag = GER
		not = {
			has_dlc = "Man the Guns"
		}
	}
	enable = {
		date > "1936.1.1" #Don't Germany, just dont
	}
	abort = {
		date > "1943.1.1" #Don't Germany, just dont, if you haven't already won
	}

	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = -3
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = -3
	}

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

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = -3
	}
}

GER_naval_role_ratios_historical = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		GER_naval_interest_trigger = no
	}
	abort_when_not_enabled = yes

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

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 200
	}
	ai_strategy = {
		type = role_ratio
		id = submarine
		value = 200
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 5
	}

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

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

GER_naval_role_ratios_ahistorical = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		GER_naval_interest_trigger = yes
	}
	abort_when_not_enabled = yes

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

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

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

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

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = 5
	}

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

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

GER_naval_role_ratios_maximum_kaiser = {
	allowed = {
		original_tag = GER
		has_dlc = "Man the Guns"
	}
	enable = {
		OR = {
			has_completed_focus = GER_rebuild_the_high_seas_fleet_ww
			has_completed_focus = GER_rebuild_the_high_seas_fleet
		}
	}
	abort_when_not_enabled = yes

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

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

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

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

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

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

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

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

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

GER_area_priority = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes

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

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

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

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

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

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = 50
	}
	ai_strategy = {
		type = area_priority
		id = suez
		value = 30
	}

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

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

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

invading_france_is_pointless_because_we_go_through_benelux_soon = {
	allowed = {
		original_tag = GER
	}
	enable = {
		if = {
			limit = { NOT = { has_dlc = "Man the Guns" } }
			NOT = { has_tech = landing_craft }
		}
		else = {
			NOT = { has_tech = mtg_landing_craft }
		}
		date < 1940.1.1
	}
	abort = {
		OR = {
			has_tech = landing_craft
			has_tech = mtg_landing_craft
			date > 1940.1.1
		}
	}

	ai_strategy = {
		type = invade
		id = "FRA"
		value = -2000 # that low means not going for islands either
	}

	# danzig corridor is too small to be worth opening extra invasion front
	ai_strategy = {
		type = invade
		id = "POL"
		value = -500
	}
}

worry_about_barbarossa_before_africa_and_greece = {

	abort_when_not_enabled = yes

	enable = {
		is_historical_focus_on = yes
		is_in_faction_with = GER 
		NOT = { original_tag = ITA }
		NOT = { original_tag = BUL }
		capital_scope = { is_on_continent = europe } 
		country_exists = SOV
		NOT = {	is_in_faction_with = SOV }
		GER = {
			OR = {
				has_war_with = SOV
				date > 1941.4.1
			}
		}
		has_war_with = ENG
		FRA = { has_capitulated = yes }
		is_historical_focus_on = yes
		219 = { owner = { tag = SOV } }
		ITA = { surrender_progress < 0.2 }
	}

	ai_strategy = {
	 	type = front_unit_request
		tag = SOV
		value = 30
	}

	ai_strategy = {
	 	type = front_unit_request
		tag = GRE
		value = -50
	}

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = -100
	}
	ai_strategy = {
		type = area_priority
		id = suez
		value = -100
	}

	ai_strategy = {
		type = area_priority
		id = horn_of_africa
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		area = horn_of_africa
		value = -100
	}
	ai_strategy = {
		type = area_priority
		id = belgian_congo
		value = -100
	}
	ai_strategy = {
		type = invasion_unit_request
		area = belgian_congo
		value = -100
	}
}
GER_force_concentration_through_maginot_hurts_too_much = {
	allowed = {
		original_tag = GER
	}
	enable = {
		FRA = { surrender_progress < 0.20 }
		28 = { # Alsace-Lorraine
			NOT = { is_controlled_by = GER }

			any_province_building_level = {  # Only if Maginot is actually fortified
				province = {
					all_provinces = yes
					limit_to_border = yes
				}
				building = bunker
				level > 5
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = force_concentration_front_factor
		state = 28  # Alsace-Lorraine
		ratio = 0.60     # Only if > 50 % of the front consists of Alsace-Lorraine. This should make it deactivate if the frontline extends around the maginot
		value = -100
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 28 # Alsace-Lorraine
		value = -100 # -100 % / Don't even consider targets here. Infantry and Artillery are better at dealing with the Maginot than tank formations are
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 18 # Champagne
		value = -100 # -50 % / Let's try to avoid the areas behind the Maginot. It is risky, as we might end up trying to go through it anyways then
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 17 # Franche Comte
		value = -100 # -75 % / Let's try to avoid the areas behind the Maginot. It is risky, as we might end up trying to go through it anyways then
	}
}
worry_about_barbarossa_before_africa_and_greece2 = {

	abort_when_not_enabled = yes

	enable = {
		is_in_faction_with = GER 
		NOT = { original_tag = ITA }
		NOT = { original_tag = BUL }
		has_war_with = SOV
	}

	ai_strategy = {
		type = front_control

		tag = GRE

		ratio = 0.5

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


GER_want_to_invade_FRA_without_ITA = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		date < 1940.1.1
		FRA = {
			is_ai = yes
		}
		HOL = {	has_capitulated = no }
		BEL = {	has_capitulated = no }
	}

	abort = {
		OR = {
			date > 1940.1.1
			FRA = {
				is_ai = no
			}
			AND = {
				HOL = {	has_capitulated = yes }
				BEL = {	has_capitulated = yes }
			}
		}
	}

	ai_strategy = {
		type = dont_join_wars_with  # TODO seems bugged
		id = ITA
		target_country = FRA
		value = 500
	}
}

axis_stay_away_from_the_royal_navy = {
	enable = {
		has_war_with = ENG
		date < 1942.1.1

		OR = {
			GER = {
				naval_strength_ratio = {
					tag = ENG
  					ratio < 0.5
  				}
  			}

			# if we manage to get a foothold in UK we must do what we can to exploit it! (checks coastal states)
			divisions_in_state = { state = 127 size < 1 }
			divisions_in_state = { state = 126 size < 1 }
			divisions_in_state = { state = 125 size < 1 }
			divisions_in_state = { state = 129 size < 1 }
			divisions_in_state = { state = 130 size < 1 }
			divisions_in_state = { state = 131 size < 1 }
			divisions_in_state = { state = 123 size < 1 }
			divisions_in_state = { state = 122 size < 1 }
			divisions_in_state = { state = 132 size < 1 }
			divisions_in_state = { state = 121 size < 1 }
			divisions_in_state = { state = 136 size < 1 }
			divisions_in_state = { state = 120 size < 1 }
			divisions_in_state = { state = 133 size < 1 }
		}
		OR = {
			maybe_england_is_eligible_target = no
			any_country = {
				is_in_faction_with = ENG
				is_major = yes
				is_neighbor_of = GER
				has_capitulated = no
			}
		}
		NOT = {
			any_state = {
				is_core_of = ENG
				controller = { 
					has_war_with = ENG 
					is_in_faction_with = ROOT
				}
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 18 #english channel
		value = 600 # avoid doing missions as well
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 16 #around UK
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 43 #around UK
		value = 100
	}
}

dont_take_claims_on_POL_we_got_focus = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = POL
		has_war = no
		has_completed_focus = GER_reassert_eastern_claims
	}

	abort = {
		OR = {
			NOT = { country_exists = POL }
			date > 1940.1.1
			has_war = yes
		}
	}

	ai_strategy = {
		type = ignore_claim
		id = "POL"
		value = 1
	}
}

GER_dont_mess_with_volunteers = {
	reversed = yes
	allowed = {
		original_tag = GER
	}
	enable = {
		is_literally_china = yes
		is_historical_focus_on = yes
		date < 1941.6.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = GER
		value = -500
	}
}
GER_ITA_support_japan = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = JAP
		}
	}
	enable = {
		is_historical_focus_on = yes
		JAP = { has_war_with = CHI }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_volunteers_desire
		id = JAP
		value = 500
	}
}

GER_industry_we_are_the_baddies = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.8.1
	}
	abort = {
		date > 1940.5.1
	}

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 50
	}
	ai_strategy = {
		type = air_factory_balance
		value = 25
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 2  # Germany needs a minimum production of CAS planes
	}
}

GER_industry_plane_vs_sov_ai = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = SOV
		SOV = { is_ai = yes }
		OR = {
			is_in_faction_with = FRA
			NOT = { country_exists = FRA }
			FRA = { has_capitulated = yes }
		}
		NOT = {
			any_home_area_neighbor_country = {
				NOT = { tag = SOV }
				has_war_with = ROOT
				num_of_military_factories > 39
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 25
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 2  # Germany needs a minimum production of CAS planes
	}
}


GER_industry_we_are_the_baddies_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 20
	}
}

GER_industry_we_are_the_baddies_but_not_yet = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1936.8.1
	}
	abort = {
		date > 1937.8.1
	}
	ai_strategy = {
		type = role_ratio
		id = armor
		value = -50 #because doctrine this = 3
	}
}

Axis_care_less_about_making_friends = {

	enable = {
		has_government = fascism
		is_in_faction = yes
		manpower_per_military_factory < 3000
		has_war = yes
	}
	abort = {
		OR = {
			NOT = { has_government = fascism }
			is_in_faction = no
			manpower_per_military_factory > 3000
			has_war = no
		}
	}

	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -9999
	}
}

Axis_care_a_lot_less_about_making_friends = {

	enable = {
		has_government = fascism
		is_in_faction = yes
		is_historical_focus_on = yes
		has_political_power < 300
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -9999
	}
}
GER_wants_dock = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			has_war_with = ENG
			has_war_with = USA
		}
		OR = {
			NOT = { country_exists = SOV }
			SOV = { has_capitulated = yes }
			SOV = { is_subject_of = GER }
			SOV = { is_in_faction_with = GER }
		}
		NOT = { 
			any_country = {
				has_war_with = GER
				is_major = yes
				is_neighbor_of = GER
				capital_scope = { is_on_continent = europe }
				has_capitulated = no
				NOT = { tag = ENG }
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 20  #aim for a 2-1 ratio on naval factories
	}
}

allies_of_GER_wants_dock = {
	enable = {
		is_in_faction_with = GER
		OR = {
			has_war_with = ENG
			has_war_with = USA
		}
		OR = {
			NOT = { country_exists = SOV }
			SOV = { has_capitulated = yes }
			SOV = { is_subject_of = GER }
			SOV = { is_in_faction_with = GER }
		}
		NOT = { 
			any_country = {
				has_war_with = GER
				is_major = yes
				is_neighbor_of = ROOT
				capital_scope = { is_on_continent = europe }
				has_capitulated = no
				NOT = { tag = ENG }
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 20  #aim for a 2-1 ratio on naval factories
	}
}

GER_infra_prep = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_idea = civilian_economy		
	}

	abort = {
		always = no
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 978 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 42
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 51 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 50 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 55 
		value = 2000
	}
}
GER_infra_prep_lower_civ_mil_priority = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_idea = civilian_economy		
	}

	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = -100
	}
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = -100
	}
}
GER_wants_mil36 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1936.4.1
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 30
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 978 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 42
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 51 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 50 
		value = 2000
	}

	ai_strategy = {
		type = build_building
		id = infrastructure
		target = 55 
		value = 2000
	}
}
GER_wants_civ = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date < 1937.1.1
		date > 1936.4.1
		is_historical_focus_on = yes
		has_war = no
		NOT = {
			any_country = {
				is_allied_ai = yes
				NOT = { tag = SOV }
				is_ai = no
			}
		}
		OR = {
			NOT = { has_idea = civilian_economy }
			date > 1936.6.1
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 65
	}
}

GER_wants_civ2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date > 1936.3.1
		date < 1937.1.1
		is_historical_focus_on = yes
		has_war = no
		any_country = {
			is_allied_ai = yes
			NOT = { tag = SOV }
			is_ai = no
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 55
	}
}

GER_wants_mil = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1938.1.1
		is_historical_focus_on = no
		has_war = no
		num_of_military_factories < 60
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 60
	}
}
GER_wants_mil1 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1937.8.1
		is_historical_focus_on = yes
		num_of_military_factories < 90
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 90
	}
}
GER_wants_mil2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1939.1.1
		date < 1941.1.1
		is_historical_focus_on = yes
		num_of_civilian_factories > 120
		num_of_military_factories < 210
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = arms_factory
		value = 210
	}
}
GER_ww2_airforce = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war = yes
		GER_is_going_to_fight_SOV = no
		GER_is_not_relevant = no
		NOT = { has_global_flag = FRA_already_surrendered }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 25 #we gonna beat the shit out of the Royal Airforce and the Reds
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}
}
GER_prepare_for_barbarossa_airforce = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war = yes
		GER_is_going_to_fight_SOV = no
		GER_is_not_relevant = no
		has_global_flag = FRA_already_surrendered
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = air_factory_balance
		value = 50 #we gonna beat the shit out of the Royal Airforce and the Reds
	}	
	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 2  # Germany needs a minimum production of fighters
	}
	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 4  # Germany needs a minimum production of CAS planes
	}
}
GER_low_civ_cut_on_refineries = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		has_global_flag = banned_trade_coordination
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = -4
	}
}
GER_low_civ_cut_on_refineries_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		has_global_flag = banned_trade_coordination
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = -4
	}
}
GER_low_mil_cut_on_refineries = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		OR = {
			has_global_flag = swiss_gold_banned
			NOT = { has_dynamic_modifier = { modifier = SWI_gold_trade_with_switzerland } }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = -4
	}
}
GER_low_mil_cut_on_refineries_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		OR = {
			has_global_flag = swiss_gold_banned
			NOT = { has_dynamic_modifier = { modifier = SWI_gold_trade_with_switzerland } }
		}
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = -4
	}
}
GER_low_mil_cut_on_refineries_3 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		OR = {
			has_global_flag = swiss_gold_banned
			NOT = { has_dynamic_modifier = { modifier = SWI_gold_trade_with_switzerland } }
		}
		date > 1941.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = -4
	}
}
GER_need_rubber_process = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		has_country_flag = FYP_preferred
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = research_tech
		id = rubber_processing
		value = 100
	}
}
GER_wants_synth = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		date > 1938.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 4
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5
	}
}
GER_wants_synthcc = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		date > 1939.1.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 4
	}

	ai_strategy = {
		type = research_tech
		id = improved_rubber_processing
		value = 100
	}
}
GER_wants_synthb = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = no
		date > 1937.5.1
	}
	abort = {
		OR = {
			focus_progress = {
				focus = GER_demand_sudetenland
				progress > 0
			}
			has_completed_focus = GER_demand_sudetenland
		}	
	}
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 8
	}

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5
	}
}
GER_wants_synth_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		date > 1939.1.1
		has_completed_focus = GER_industrial_expansion
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 8
	}

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

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

	ai_strategy = {
		type = air_factory_balance
		value = 50 #barbarossa ramp up
	}

 	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5 #we control the sky sooooo...
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 6
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5
	}
}
GER_wants_synth_2b = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		is_historical_focus_on = yes
		date > 1938.5.1
		has_completed_focus = GER_establish_buna_werke
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 3
	}

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

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

	ai_strategy = {
		type = air_factory_balance
		value = 50 #barbarossa ramp up
	}

 	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5 #we control the sky sooooo...
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 6
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5
	}
}
GER_wants_synth_3a = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date > 1940.1.1
		has_completed_focus = GER_industrial_expansion
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 5
	}

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 5
	}
}
GER_wants_synth_3 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date > 1940.7.1	
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 8
	}

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 10
	}
}
GER_wants_synth_4 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		date > 1941.1.1 
		has_resources_in_country = {
			resource = rubber
			amount < 10
		}
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = building_target
		id = synthetic_refinery
		value = 15
	}

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

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

GER_we_dont_fight_pathetic_sweden = { # :O
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = no
		has_government = fascism
		SWE = {
			has_idea = neutrality_idea
		}
	}
	abort = {
		SWE = {
			not = { has_idea = neutrality_idea }
		}
	}
	ai_strategy = {
		type = antagonize
		id = SWE
		value = -200 #keep the iron coming and no one gets hurt
	}
	ai_strategy = {
		type = protect
		id = SWE
		value = 100 #keep the iron coming and no one gets hurt
	}
}

GER_we_dont_fight_pathetic_sweden_on_historical = { # :O
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_government = fascism
		SWE = {
			has_idea = neutrality_idea
		}
	}
	abort = {
		SWE = {
			not = { has_idea = neutrality_idea }
		}
	}
	ai_strategy = {
		type = antagonize
		id = SWE
		value = -50 #keep the iron coming and no one gets hurt
	}
	ai_strategy = {
		type = protect
		id = SWE
		value = 50 #keep the iron coming and no one gets hurt
	}
}

GER_trade_with_sweden = {
	allowed = {
		original_tag = GER
	}
	enable = {
		# if we're not communist and they're not communist
		NOT = { has_government = communism }
		NOT = { SWE = { has_government = communism } }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = SWE
		value = 60
	}
}

GER_trade_with_italy = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		ITA = { has_government = fascism }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = ITA
		value = 40
	}
}

GER_market_management_after_anschluss = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		has_completed_focus = GER_anschluss
	}
	abort_when_not_enabled = yes

	# Time to start buffer for war
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = infantry
		value = 10000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = support
		value = 500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = artillery
		value = 500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = armor
		value = 500
	}
}

GER_market_management_after_sudetenland = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_government = fascism
		has_completed_focus = GER_demand_sudetenland
	}
	abort_when_not_enabled = yes

	# Oh nein, we're not gonna sell this, we're... "saving" it...
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = infantry
		value = 20000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = support
		value = 1500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = artillery
		value = 1500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = anti_air
		value = 1500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = anti_tank
		value = 1500
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = armor
		value = 1000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = motorized
		value = 2000
	}
	ai_strategy = {
		type = equipment_market_for_sale_threshold
		id = train
		value = 200
	}
}

spain_scw_support_GER_resistance = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_government = fascism
		country_exists = SPA
	}
	abort = {
		OR = {
			NOT = { country_exists = SPA }
			SPA = { has_completed_focus = SPA_join_the_allies }
		}
	}

	ai_strategy = {
		type = support
		id = SPA
		value = 100
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = CHI
		value = -100 #Complicated
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = SPA
		value = 100
	}
}

GER_we_are_bad_at_espionage_because_it_is_expensive_and_not_tanks = {
	allowed = {
		original_tag = GER
		has_dlc = "La Resistance"
	}
	enable = {
		has_intelligence_agency = yes
		has_government = fascism
		num_of_civilian_factories < 70
		num_of_civilian_factories > 30
	}
	abort = {
		num_of_civilian_factories > 70
	}

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = -20
	}
}

GER_my_precisioussss = {
	allowed = {
		original_tag = GER
	}

	enable = {
		OR = {
			date < 1944.6.1
			has_war = yes
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = send_lend_lease_desire
		id = SLO
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = MAN
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = CHI
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = YUN
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SHX
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = XSM
		value = -999
	}
	ai_strategy = {
		type = send_lend_lease_desire
		id = SIK
		value = -999
	}
}

GER_let_italy_handle_french_front_alone = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_in_faction_with = ITA
		OR = {
			AND = {
				has_war_together_with = ITA
				has_war_with = FRA
			}
			focus_progress = {
				focus = GER_danzig_or_war
				progress > 0.01
			}
		}
		FRA = { has_capitulated = no } # Abort when France is out of the equation
		date < 1940.4.1 #might need a new trick
		ITA = { surrender_progress < 0.05 }
		is_historical_focus_on = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "ITA"
		value = 100
	}
}


GER_ITA_close_up_maginot_line_after_FRA_falls  = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = FRA
			original_tag = ITA
		}
	}

	enable = {
		NOT = { has_war_with = SOV }
		has_war_with = FRA
		FRA = {
			has_capitulated = yes
			days_since_capitulated > 7 # let's give a week before things settle
			days_since_capitulated < 90
		}
		NOT = { has_full_control_of_state = 28 }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		state = 28 # close up maginot line

		ratio = 0.3

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

	ai_strategy = {
		type = strategic_air_importance
		id = 5 #Strategic Region ID - English Channel
		value = 25000 #Too easy to lose planes here
	}

	ai_strategy = {
		type = front_unit_request

		state = 28

		value = 150 # lets put more units, should be safe
	}
}


# AI are not willing to invade if it is at war at its home against another country's home location
# lets force invade NOR for GER & ITA
GER_enable_invasion_of_NOR = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = ITA
		}
	}
	enable = {
		# try to invade NOR if things are looking not so bad
		OR = {
			date < 1940.4.4
			FRA = { has_capitulated = yes } # uh oh, maybe we need more units against FRA
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "NOR"
		value = 20
	}

	ai_strategy = {
		type = invade
		id = "DEN"
		value = 20
	}
}

GER_prepare_for_weserubung = {
	allowed = {
		original_tag = GER
	}
	enable = {
		focus_progress = {
			focus = GER_operation_weserubung
			progress > 0
		}
	}
	abort = {
		has_completed_focus = GER_operation_weserubung
		# Norway and Denmark are either defeated or have joined us (or at least not our enemies anymore)
		NOR = {
			OR = {
				has_capitulated = yes
				NOT = { has_war_with = ROOT }
			}
		}
		DEN = {
			OR = {
				has_capitulated = yes
				NOT = { has_war_with = ROOT }
			}
		}
	}

	ai_strategy = {
		type = invade
		id = NOR
		value = 100
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = NOR
		value = 100
	}
	ai_strategy = {
		type = area_priority
		id = just_norway
		value = 50
	}
}

GER_no_no_definitely_not_planning_to_invade_norway = {
	# This strategy is only to make the AI understand that it needs to prepare naval invasion of Norway before starting the Weserubung focus, because invasion takes longer time to prepare than the focus takes to complete.
	allowed = {
		original_tag = GER
	}
	enable = {
		has_completed_focus = GER_danzig_or_war
		POL = { has_capitulated = yes }
	}
	abort = {
		OR = {
			has_completed_focus = GER_operation_weserubung  # already at war so no need to prepare anymore
			has_completed_focus = GER_utilize_the_nordliche_gesellschaft  # decided to befriend them instead
			date > 1940.9.1  # just for safety, if things really go south
		}
	}
	ai_strategy = {
		type = prepare_for_war
		id = NOR
		value = 100
	}
}
# focus armor units on low countries
# and ignore mighty lux until they fall
GER_around_the_maginot = {
	allowed = {
		original_tag = GER
	}

	enable = {
		is_historical_focus_on = yes
		date < 1941.4.1
		FRA = {
			is_ai = yes
		}
		OR = {
			42 = {
				is_controlled_by = GER
			}
			50 = {
				is_controlled_by = GER
			}
			focus_progress = {
				focus = GER_around_maginot
				progress > 0.1
			}
			has_completed_focus = GER_around_maginot
		}
		OR = {
			AND = {
				is_in_array = { potential_and_current_enemies = BEL }
				BEL = {
					has_capitulated = no
				
				}
			}
			AND = {
				is_in_array = { potential_and_current_enemies = HOL }
				HOL = {
					has_capitulated = no
				}
			}
		}
		OR = {
			focus_progress = {
				focus = GER_around_maginot
				progress > 0.1
			}
			has_completed_focus = GER_around_maginot
		}
		OR = {
			NOT = { is_in_array = { potential_and_current_enemies = POL } }
			POL = { has_capitulated = yes }
			POL = { exists = no }
		}
		is_in_array = { potential_and_current_enemies = FRA }
	}

	abort_when_not_enabled = yes

	# leave LUX for later
	ai_strategy = {
		type = declare_war
		id = "LUX"
		value = -5000
	}

	ai_strategy = {
		type = diplo_action_desire
		id = "LUX"
		target = declare_war
		value = -5000
	}

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

	ai_strategy = {
		type = front_armor_score
		id = "HOL"
		value = 300
	}

	ai_strategy = {
		type = front_armor_score
		id = "BEL"
		value = 300
	}

	ai_strategy = {
		type = prepare_for_war
		id = HOL
		value = 200
	}

	ai_strategy = {
		type = prepare_for_war
		id = BEL
		value = 200
	}

}


# lets not invade until we have europe
GER_dont_invade_until_FRA_falls = {
	allowed = {
		original_tag = GER
		is_historical_focus_on = yes
	}

	enable = {
		date < 1941.3.1
		FRA = {
			has_capitulated = no
		}
	}

	abort_when_not_enabled = yes

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

		value = -100
	}

	ai_strategy = {
		type = front_unit_request

		# norway
		state = 110
		state = 142
		state = 143
		state = 144

		value = -100
	}
}

GER_have_some_train_production = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date > 1936.7.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 1  # Always have some production of trains
	}
}

GER_stock_up_on_trains_before_barbarossa = {
	allowed = {
		original_tag = GER
	}

	enable = {
		is_historical_focus_on = yes
		date > 1940.7.1
		date < 1943.1.1
		has_war = yes
		# always = no
	}
	abort = {
		has_war_with = SOV # Barbarossa has started, let wartime prioritization do its thing
		date > 1943.1.1
	}

	#ai_strategy = {
	#	type = min_wanted_supply_trains  # Causes large spike, not optimal
	#	value = 300
	#}

	ai_strategy = {
		type = equipment_production_min_factories
		id = train
		value = 4  # Boost train production before Barbarossa
	}
}

GER_ignore_vichy_we_will_annex_them_later = {
	allowed = {
		original_tag = GER
	}

	enable = {
		country_exists = VIC
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = "VIC"
		value = 100
	}
}

GER_vichy_has_served_its_purpose = {
	allowed = {
		original_tag = GER
	}

	enable = {
		country_exists = VIC
		VIC = {
			OR = {
				has_country_flag = case_anton # Germany has activated the decision

				count_triggers = { # Conditions for decision GER_case_anton
					amount = 3 # lost control of ca half french north africa
					458 = { CONTROLLER = { has_war_with = ROOT } }
					459 = { CONTROLLER = { has_war_with = ROOT } }
					460 = { CONTROLLER = { has_war_with = ROOT } }
					461 = { CONTROLLER = { has_war_with = ROOT } }
					462 = { CONTROLLER = { has_war_with = ROOT } }
					513 = { CONTROLLER = { has_war_with = ROOT } }
					665 = { CONTROLLER = { has_war_with = ROOT } }
				}
			}
		}
	}
	abort_when_not_enabled = yes

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

GER_dont_upgrade_to_weapons_3_too_early = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		has_equipment = { infantry_equipment < 60000 }
	}

	abort_when_not_enabled = yes

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

GER_blitzkrieg_benelux  = {
	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1940.4.1
		OR = {
			AND = {
				focus_progress = {
					focus = GER_around_maginot
					progress > 0.1
				}
				NOT = { has_war_with = HOL  }
			}
			AND = {
				has_war_with = HOL
				HOL = { has_capitulated = no }
			}
			AND = {
				has_war_with = BEL
				BEL = { has_capitulated = no }
			}
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = HOL

		ratio = 0.25

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

	ai_strategy = {
		type = front_control

		tag = BEL

		ratio = 0.25

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

GER_blitz_france = {

	allowed = {
		original_tag = GER
	}

	enable = {
		date < 1940.6.1
		HOL = { has_capitulated = yes }
		is_historical_focus_on = yes
		has_war_with = FRA
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = consider_weak
		id = "FRA"
		value = 25
	}

	ai_strategy = {
		type = force_concentration_target_weight
		state = 29 # Nord-Pas_de_Calais
		state = 785 # Picardy
		state = 16 # Ile de France
		state = 15 # Normandy
		# include Belgium as well even though we hopefully have already taken it
		state = 6 # Vlaanderen
		state = 34 # Wallonie
		state = 977 # Antwerpen

		value = 80 # +80%
	}

	ai_strategy = {
		# Avoid the areas behind the Maginot line
		type = force_concentration_target_weight
		state = 18 # Champagne
		state = 17 # Franche-Comte
		state = 28 # Alsace-Lorraine
		state = 27 # Bourgogne

		value = -60 # -60%
	}

	ai_strategy = {
		type = front_control

		tag = FRA

		ratio = 0.5

		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			OR = {
				state = 28
				state = 17
			}
		}
		value = -25
	}

	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			OR = {
				is_core_of = BEL
				is_core_of = HOL
			}
		}
		value = 25
	}

}

GER_tanks_in_the_snow = {
	allowed = {
		original_tag = GER
	}

	enable = {
		has_war_with = SOV
	}

	abort = {
		surrender_progress > 0.15 #Bring our metal bawkses home
	}

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

	ai_strategy = {
		type = front_unit_request

		tag = SOV

		value = 40
	}

}

GER_tanks_against_france = {
	allowed = {
		original_tag = GER
	}

	enable = {
		is_historical_focus_on = yes
		HOL = { has_capitulated = yes }
		BEL = { has_capitulated = yes }
		FRA = { has_capitulated = no }
	}

	abort = {
		surrender_progress > 0.15 #Bring our metal bawkses home
	}

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

	ai_strategy = {
		type = front_unit_request

		tag = FRA

		value = 10
	}

	ai_strategy = {
		type = front_unit_request

		state = 28

		value = -25 # lets put less units, should be safe
	}

}

GER_abandon_ship = {
	allowed = {
		original_tag = GER
	}

	enable = {
		surrender_progress > 0.25 #Bring our metal bawkses home
	}

	abort = {
		surrender_progress < 0.25 #Bring our metal bawkses home
	}

	ai_strategy = {
		type = front_unit_request

		tag = SOV

		value = -10
	}

}

GER_normandy_buffer = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		FRA = {
			has_capitulated = yes
		}
		date < 1943.1.1
		SOV = { is_ai = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers
		states = {
			14
			15
			16
			24
			29
			36
			7
			35
		}
		ratio = 0.15
		area = europe
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = no
	}

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

GER_invasion_buffer = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		FRA = {
			has_capitulated = yes
		}
		date > 1943.1.1
		SOV = { is_ai = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers
		states = {
			14
			15
			16
			24
			29
			36
			7
			35
		}
		ratio = 0.25
		area = europe
		subtract_invasions_from_need = yes
		subtract_fronts_from_need = no
	}
	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 10
	}
}

GER_build_more_cas_to_invade_russia = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
		FRA = {
			has_capitulated = yes
		}
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

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

GER_push_back_our_coasts_until_overlord  = {
	allowed = {
		original_tag = GER
	}

	enable = {
		has_global_flag = event_completed
		date < 1943.6.6
		is_historical_focus_on = yes
		FRA = { has_capitulated = yes }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = HOL

		ratio = 0.25

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

	ai_strategy = {
		type = front_control

		tag = BEL

		ratio = 0.25

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

	ai_strategy = {
		type = front_control

		tag = FRA

		ratio = 0.25

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

	ai_strategy = {
		type = front_unit_request

		tag = BEL

		value = 25
	}

	ai_strategy = {
		type = front_unit_request

		tag = HOL

		value = 25 # lets put more units, should be safe
	}

	ai_strategy = {
		type = front_unit_request

		tag = FRA

		value = 25
	}
}

GER_pause_in_SOV = { #We got this far but our home is under siege
	allowed = {
		original_tag = GER
	}

	enable = {
		is_historical_focus_on = yes
		has_war_with = SOV
		SOV = { has_capitulated = no }
		OR = {
			surrender_progress > 0.25
			16 = {
				controller = {
					has_war_with = GER
				}
			}
		}
		date > 1942.1.1
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control

		tag = SOV

		ratio = 0.60

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

	ai_strategy = {
		type = front_unit_request

		tag = FRA

		value = 10 # omg no, the french
	}

	ai_strategy = {
		type = front_unit_request

		tag = SOV

		value = -5 # FLEE
	}

}

GER_make_some_radar_1 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with_major = yes  # Oy, we need some radar tech!
	}

	abort = {
		has_tech = radio_detection
	}

	ai_strategy = {
		type = research_weight_factor
		id = radio_detection
		value = 2000
	}
}

GER_make_some_radar_2 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = radio_detection
		has_war_with_major = yes  # Oy, we need some radar tech!
	}

	abort = {
		has_tech = cavity_magnatron
	}

	ai_strategy = {
		type = research_weight_factor
		id = cavity_magnatron
		value = 2000
	}
}

GER_make_some_radar_3 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = cavity_magnatron
		has_war_with_major = yes  # Oy, we need some radar tech!
	}

	abort = {
		has_tech = centimetric_radar 
	}

	ai_strategy = {
		type = research_weight_factor
		id = centimetric_radar 
		value = 200
	}
} # After this, you're on your own chaps

GER_make_some_radar_4 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = radio_detection
		90 = {
			is_controlled_by = FROM
			free_building_slots = {
				building = radar_station
				size > 0
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 90 #Kielce
		value = 2000
	}
}

GER_make_some_radar_5 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = radio_detection
		763 = {
			is_controlled_by = FROM
			free_building_slots = {
				building = radar_station
				size > 0
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 763 #Konigsberg
		value = 2000
	}
}

GER_make_some_radar_6 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = radio_detection
		36 = {
			is_controlled_by = FROM
			free_building_slots = {
				building = radar_station
				size > 0
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 36 #Holland
		value = 2000
	}
}

GER_make_some_radar_7 = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_tech = radio_detection
		42 = {
			is_controlled_by = FROM
			free_building_slots = {
				building = radar_station
				size > 0
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 42 #Moselland
		value = 2000
	}
}

GER_focus_yugo = {
	allowed = { original_tag = GER }
	enable = {
		has_war_with = YUG
		YUG = { has_capitulated = no }
		is_historical_focus_on = yes
		NOT = { has_global_flag = d_day_happened }
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = strategic_air_importance
		id = 24 #Strategic Region ID - Western Balkans
		value = 30000
	}
}

GER_protect_hungary = {
	allowed = { original_tag = GER }
	enable = {
		is_historical_focus_on = yes
		HUN = {
			has_government = fascism
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = protect
		id = "HUN"
		value = 50
	}

}

GER_protect_romania = {
	allowed = { original_tag = GER }
	enable = {
		is_historical_focus_on = yes
		ROM = {
			OR = {
				has_government = fascism
				has_government = neutrality
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = protect
		id = "ROM"
		value = 50
	}
}

GER_avoid_war_with_SWI = {
	allowed = { original_tag = GER }
	enable = {
		is_historical_focus_on = yes
		SWI = {
			exists = yes
		}
	}
	abort = {
		OR = {
			is_historical_focus_on = no
			has_wargoal_against = SWI
			SWI = {
				NOT = { has_idea = SWI_swiss_neutrality }
			}
		}
	}

	ai_strategy = {
		type = conquer
		id = SWI
		value = -999
	}

	ai_strategy = {
		type = antagonize
		id = SWI
		value = -75
	}
}

bba_air_prod_1 = {
	# TODO BFW:
	allowed = { original_tag = GER }
	enable = {
		date < 1940.1.1
	}

	abort_when_not_enabled = yes

	# Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 200
	}

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 6  # Germany needs a minimum production of fighters
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 25 # because doctrine this = 15
	}

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = cas
		value = 3  # Germany needs a minimum production of CAS planes
	}

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

	ai_strategy = {
		type = equipment_variant_production_factor
		id = large_plane_airframe
		value = 0
	}

}

bba_air_prod_2 = {
	# TODO BFW:
	allowed = { original_tag = GER }
	enable = {
		date > 1940.1.1
	}
	abort_when_not_enabled = yes

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 300
	}

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

	ai_strategy = {
		type = equipment_production_min_factories
		id = fighter
		value = 8
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 25 #because doctrine this = 15
	}

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

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

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

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

	ai_strategy = {
		type = equipment_production_factor
		id = strategic_bomber
		value = 0
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = large_plane_airframe
		value = 0
	}

}

GER_dont_act_on_danzig_if_things_went_south = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = CZE
		CZE = { surrender_progress < 0.6 }
		date < 1940.6.1
	}
	abort_when_not_enabled = yes

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

GER_dont_send_half_the_army_to_finland_if_not_in_our_faction = {
	allowed = {
		original_tag = GER
	}
	enable = {
		FIN = { has_war_with = SOV }
		has_war_with = SOV
		NOT = { is_in_faction_with = FIN }
		has_military_access_to = FIN
		925 = { is_controlled_by = ROOT }  # Germany still controls Finnmark in Northern Norway

		# Safety measures, if Soviets have lost Leningrad or Novgorod the Finnish and German frontlines are probably close to becoming one, and then we need to disable the strategy
		195 = { is_controlled_by = SOV }  # Leningrad
		263 = { is_controlled_by = SOV }  # Novgorod
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = put_unit_buffers

		# ratio of total armies in country to be buffered
		ratio = 0.05

		# states to put garrison orders (if no state is friendly, strat is invalid)
		states = {
			925  # Finnmark
		}

		# ai areas that the orders will use these buffers in
		area = scandinavia
	}

	ai_strategy = {
		type = front_unit_request

		# As long as the front touches any of these regions. I hope this doesn't mess up the bigger Eastern Front if the Finnish and German frontlines merge...
		strategic_region = 13  # Eastern Finland
		strategic_region = 277  # Northern Finland
		strategic_region = 265  # East Karelia
		strategic_region = 12  # Kola

		value = -90
	}

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

GER_protect_swedish_ore = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { has_war_with = SWE }
		SWE = { has_capitulated = no }
		
 		142 = { is_fully_controlled_by = ROOT }
 		110 = { is_fully_controlled_by = ROOT }
 		143 = { is_fully_controlled_by = ROOT }
 		144 = { is_fully_controlled_by = ROOT }
	}
	abort_when_not_enabled = yes

	 ai_strategy = {
	 	type = put_unit_buffers

		# ratio of total armeis in country to be buffered
	 	ratio = 0.05

		# you can specify an order id. ratio of same orders ids will be share same ratio
	 	order_id = 1

	 	# states to put garrison orders (if no state is friendly, strat is invalid)
	 	states = {
	 		142
	 		110
	 		143
	 		144
	 	} 

		# ai areas that the orders will use these buffers in
	 	area = europe
	 }
	
}

TEMP_avoid_sweden = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = SWE
		is_historical_focus_on = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = "SWE"
		value = -999
	}
}

SWE_nils_flyg_is_in_charge_and_he_is_a_weird_communist_that_does_not_like_stalin_so_we_like_him = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = SWE
		SWE = {
			has_country_leader = {
				ruling_only = yes 
				character = SWE_nils_flyg 
			}
			has_government = communism
		}
		OR = {
			has_war = yes
			date > 1940.1.1
			SWE = { has_war = yes }
		}
	}
	abort = {
		SWE = {
			NOT = {
				has_government = communism
				has_country_leader = {
					ruling_only = yes 
					character = SWE_nils_flyg 
				}
			}
		}
	}	

	ai_strategy = {
		type = avoid_starting_wars
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = befriend
		id = "SWE"
		value = 200
	}

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 1000
	}
}

Sweden_was_a_puppet_and_broke_free_so_now_we_are_angry = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = sweden_was_a_puppet_and_has_broken_free
	}

	abort = {
		NOT = { has_country_flag = sweden_was_a_puppet_and_has_broken_free }
	}

	ai_strategy = {
		type = conquer
		id = "SWE"
		value = 200
	}
	ai_strategy = {
		type = antagonize
		id = "SWE"
		value = 200
	}
}

Sweden_joined_our_pact_so_we_are_kinda_happy = {
	allowed = {
		original_tag = GER
	}
	enable = {
		SWE = { has_completed_focus = SWE_join_the_anti_soviet_pact }
	}

	abort = {
		SWE = { has_war_with = GER }
	}

	ai_strategy = {
		type = alliance
		id = "SWE"
		value = 50
	}
	ai_strategy = {
		type = protect
		id = "SWE"
		value = 70
	}
}

GER_build_an_air_facility_in_penemunde = {
	allowed = {
		original_tag = GER
	}
	enable = {
		62 = { is_owned_and_controlled_by = GER }
		air_facility < 1 # one is enough
		date > 1940.1.1 # Was 1937.2.1 Moving it to later in order to let them focus on building their indurty
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = build_building
		id = air_facility
		target = 9388
		value = 1
	}
}

GER_build_an_air_facility_anywhere = {
	allowed = {
		original_tag = GER
	}
	enable = {
		62 = { NOT = { is_owned_and_controlled_by = GER } }
		air_facility < 1 # one is enough
		date > 1940.6.1 # Was 1937.2.1
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = build_building
		id = air_facility
		value = 1
	}
}
#Yo-ho-ho and a bottle of rum! We set sail for the North Sea aaaargh!
GER_raid_the_north_sea = {
	allowed = { original_tag = GER }
	enable = {
		has_war = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 45 #Norwegian Sea
		value = 100
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 174 #Norwegian coast
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 173 #Eastern North Sea
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 207 #Danish Belts
		value = 100
	}
}

#Yo-ho-ho and a bottle of rum! We set sail for the North Atlantic aaaargh!
GER_raid_the_atlantic = {
	allowed = { original_tag = GER }
	enable = {
		OR = {
			has_war_with = ENG
			has_war_with = USA
		}
		#Gotta control the Western coast of France
		any_controlled_state = {
			OR = {
				state = 14
				state = 30
				state = 23
				state = 19
			}
		}
		has_navy_size = {
		    type = submarine
		    size > 40
		}
	}
	abort = {
		has_war = no
		NOT = {
			any_controlled_state = {
				state = 14
				state = 30
				state = 23
				state = 19
			}
		}
		has_navy_size = {
		    type = submarine
		    size < 30
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_convoy_raid_region
		id = 42 #Bay of Biscay
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 47 #Iberian Coast
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 49 #North Atlantic Ridge
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 49 #North Atlantic Ridge
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 44 #Denmark Strait
		value = 250
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 56 #Mid Atlantic
		value = 100
	}
}


GER_base_faction_priorities = {
	allowed = {
		original_tag = GER
	}
	enable = {
		always = yes
	}
	abort_when_not_enabled = yes
	# Note these adds to the base, as defined in default
	ai_strategy = {
		type = spent_faction_initiative_priority
		id = program
		value = 15
	}
	ai_strategy = {
		type = spent_faction_initiative_priority
		id = unlock_faction_commander
		value = 5
	}
	ai_strategy = {
		type = spent_faction_initiative_priority
		id = unlock_doctrine_sharing
		value = 10
	}
}
GER_save_pp_vic = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = VIC
		OR = {
			has_war_with = SOV
			has_war_with = USA
			has_opinion = {
			    target = VIC
			    value > 70
			}
		}
	}
	abort = {
		NOT = { 
			country_exists = VIC
			has_war_with = SOV
			has_war_with = USA
		}
		has_opinion = {
		    target = VIC
		    value < 20
		}
	}

	ai_strategy = {
		type = befriend
		id = VIC
		value = -200
	}
}
GER_increase_submarine_ratio = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			AND = {
				NOT = {
					has_completed_focus = GER_plan_z
				}
				has_completed_focus = GER_trade_interdiction
			}
			AND = {
				is_historical_focus_on = yes
				date > 1940.1.1
				OR = {
					has_war_with = ENG
					has_war_with = USA
				}
			}
		}
	}
	abort = {
		has_completed_focus = GER_plan_z
	}

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

#Germany can't afford producing this many Destroyers
GER_screen_ratio = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			AND = {
				NOT = {
					has_completed_focus = GER_plan_z
				}
				has_completed_focus = GER_trade_interdiction
			}
			AND = {
				is_historical_focus_on = yes
				date > 1940.1.1
				OR = {
					has_war_with = ENG
					has_war_with = USA
				}
			}
		}
	}
	abort = {
		has_completed_focus = GER_plan_z
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = -25
	}
}
GER_avoid_carriers = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_historical_focus_on = yes
	}
	abort = {
		has_completed_focus = GER_plan_z
	}
	ai_strategy = {
		type = unit_ratio
		id = carrier
		value = -20
	}
}
#Don't spend pp trying to get friends - Germany don't need no stinking friends!
GER_save_pp_fin = {
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = FIN
		OR = {
			has_war_with = SOV
			has_war_with = USA
			has_opinion = {
			    target = FIN
			    value > 70
			}
		}
	}
	abort = {
		NOT = { 
			country_exists = FIN
			has_war_with = SOV
			has_war_with = USA
		}
		has_opinion = {
		    target = FIN
		    value < 20
		}
	}

	ai_strategy = {
		type = befriend
		id = FIN
		value = -200
	}
}
GER_gotta_have_enough_medium_tanks = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date > 1938.8.1
		has_tech = basic_medium_tank_chassis
		stockpile_ratio = {
			archetype = medium_tank_chassis
			ratio < 1.3
		}
	}
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = motorized_equipment
		value = 1
	}
	
	ai_strategy = {
		type = equipment_production_min_factories_archetype
		id = medium_tank_chassis
		value = 3  # Germany need medium tanks to crush the enemies!
	}
}