#################
### Diplomacy ###
#################
GER_hates_socialists = {
	reversed = yes

	enable_reverse = {
		GER = {
			is_subject = no
			has_socialist_government = no
		}
	}
	enable = {
		has_socialist_government = yes
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = antagonize
		id = GER
		value = 1000
	}
	ai_strategy = {
		type = diplo_action_acceptance
		target = market_access_rights
		id = GER
		value = -1000
	}
}
GER_hates_japan = {
	reversed = yes

	enable_reverse = {
		GER = {
			is_subject = no
			has_socialist_government = no
		}
		JAP = { is_faction_leader = yes }
	}
	enable = {
		is_in_faction_with = JAP
	}
	abort_when_not_enabled = yes

	target_array = JAP.faction_members

	ai_strategy = {
		type = antagonize
		id = JAP
		value = 1000
	}
	ai_strategy = {
		type = diplo_action_acceptance
		target = market_access_rights
		id = JAP
		value = -1000
	}
}
reichspakt_hates_russia = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = POL
			original_tag = BAT
			original_tag = EST
			original_tag = LIT
			original_tag = BLR
			original_tag = UKR
		}
	}
	enable = {
		is_in_faction_with = GER
		RUS = { is_subject = no }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = antagonize
		id = RUS
		value = 1000
	}
	ai_strategy = {
		type = diplo_action_acceptance
		target = market_access_rights
		id = RUS
		value = -1000
	}
}
GER_dislikes_entente = {
	reversed = yes

	enable_reverse = {
		GER = { is_faction_leader = yes }
		NOT = { has_global_flag = GER_stay_out_france_uk }
	}
	enable = {
		is_in_faction_with = ENT
	}
	abort_when_not_enabled = yes

	target_array = ENT.faction_members

	ai_strategy = {
		type = ignore
		id = GER
		value = 300
	}
	ai_strategy = {
		type = alliance
		id = GER
		value = -300
	}
	ai_strategy = {
		type = befriend
		id = GER
		value = -300
	}
	ai_strategy = {
		type = support
		id = GER
		value = -1000
	}
}
reichspakt_dislikes_canada = {
	enable = {
		is_in_faction_with = GER
		GER = { is_faction_leader = yes }
		IMP = { is_in_faction_with = ENT }
		NOT = { is_in_faction_with = IMP }
		NOT = { has_global_flag = GER_stay_out_france_uk }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = IMP #CAN/GBR
		value = 300
	}
	ai_strategy = {
		type = alliance
		id = IMP #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = befriend
		id = IMP #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = support
		id = IMP #CAN/GBR
		value = -1000
	}
}
reichspakt_dislikes_natfrance = {
	enable = {
		is_in_faction_with = GER
		GER = { is_faction_leader = yes }
		NOT = { is_in_faction_with = NFA }
		NOT = { has_global_flag = GER_stay_out_france_uk }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = NFA #CAN/GBR
		value = 300
	}
	ai_strategy = {
		type = alliance
		id = NFA #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = befriend
		id = NFA #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = support
		id = NFA #CAN/GBR
		value = -1000
	}
}
reichspakt_dislikes_sardinia = {
	enable = {
		is_in_faction_with = GER
		GER = { is_faction_leader = yes }
		NOT = { is_in_faction_with = SRD }
		NOT = { has_global_flag = GER_stay_out_france_uk }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = SRD #CAN/GBR
		value = 300
	}
	ai_strategy = {
		type = alliance
		id = SRD #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = befriend
		id = SRD #CAN/GBR
		value = -300
	}
	ai_strategy = {
		type = support
		id = SRD #CAN/GBR
		value = -1000
	}
}

################
### Military ###
################
GER_eyes_on_france = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = FRA
		FRA = { has_capitulated = no }
		surrender_progress < 0.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 28 #Alsace-Lorraine
		value = 10
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 17 #Pas-de-Calais
		state = 980 #Lille
		state = 24 #Picardy
		state = 15 #Normandy
		state = 16 #Paris

		value = 500
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 18 #Champagne
		state = 27 #Burgundy
		state = 760 #Romandy
		state = 785 #Lorraine
		state = 3 #Switzerland
		state = 33 #Orleans

		value = -500
	}
	ai_strategy = {
		type = force_concentration_front_factor
		state = 17 #Pas-de-Calais
		state = 980 #Lille
		state = 24 #Picardy
		state = 15 #Normandy
		state = 16 #Paris

		value = 500
	}
	ai_strategy = {
		type = force_concentration_front_factor
		state = 18 #Champagne
		state = 27 #Burgundy
		state = 760 #Romandy
		state = 785 #Lorraine
		state = 3 #Switzerland
		state = 33 #Orleans

		value = -500
	}

	#less focus on other fronts
	ai_strategy = {
		type = front_unit_request
		tag = SER
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		tag = ROM
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		tag = RUS
		value = -25
	}
}

GER_eyes_on_netherlands = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = HOL
		HOL = {
			OR = {
				has_socialist_government = yes
				is_in_faction_with = BEL
			}
			has_capitulated = no
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = HOL
		value = 200
	}
	ai_strategy = {
		type = force_concentration_front_factor
		state = 866 #Guelders
		state = 36 #Frisia

		value = 500
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 866 #Guelders
		state = 36 #Frisia

		value = 500
	}
	ai_strategy = {
		type = force_concentration_target_weight
		state = 17 #Pas-de-Calais
		state = 980 #Lille
		state = 24 #Picardy
		state = 15 #Normandy
		state = 16 #Paris

		value = -500
	}
	ai_strategy = {
		type = force_concentration_front_factor
		state = 17 #Pas-de-Calais
		state = 980 #Lille
		state = 24 #Picardy
		state = 15 #Normandy
		state = 16 #Paris

		value = -500
	}
	ai_strategy = {
		type = force_concentration_front_factor
		state = 18 #Champagne
		state = 27 #Burgundy
		state = 760 #Romandy
		state = 785 #Lorraine
		state = 3 #Switzerland
		state = 33 #Orleans

		value = -500
	}
}

GER_crush_netherlands = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = HOL
		HOL = { has_capitulated = no }
		OR = {
			FRA = {
				has_war_with = ROOT
				has_capitulated = no
			}
			var:global.russia = {
				has_war_with = ROOT
				has_capitulated = no
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = FRA
		value = -20
	}
	ai_strategy = {
		type = front_unit_request
		tag = HOL
		value = 100
	}
	ai_strategy = {
		type = front_control
		tag = HOL
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_eyes_on_belgium = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = BEL
		BEL = {
			OR = {
				has_socialist_government = yes
				is_in_faction = no
				is_faction_leader = yes
			}
			has_capitulated = no
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = BEL
		value = 600
	}
}

GER_eyes_on_switzerland = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = SWI
		SWI = {
			has_socialist_government = yes
			has_capitulated = no
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = SWI
		value = 600
	}
}

GER_eyes_on_italy = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { country_exists = AUS }
		is_owner_neighbor_of = SRI
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = SRI
		value = 400
	}
}

GER_crush_poland = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
		}
	}
	enable = {
		has_war_with = POL
		POL = { has_capitulated = no }
		OR = {
			FRA = {
				has_war_with = ROOT
				has_capitulated = no
			}
			var:global.russia = {
				has_war_with = ROOT
				has_capitulated = no
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = FRA
		value = -20
	}
	ai_strategy = {
		type = front_unit_request
		tag = POL
		value = 100
	}

	ai_strategy = {
		type = front_control
		tag = POL
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_less_focus_on_russia = {
	allowed = {
		original_tag = GER
	}
	enable = {
		FRA = {
			has_capitulated = no
			is_faction_leader = yes
		}
		NOT = {
			UKR = {
				is_in_faction_with = ROOT
				surrender_progress > 0.40
			}
			BLR = {
				is_in_faction_with = ROOT
				surrender_progress > 0.40
			}
			BAT = {
				is_in_faction_with = ROOT
				surrender_progress > 0.40
			}
			LIT = {
				is_in_faction_with = ROOT
				surrender_progress > 0.40
			}
			POL = {
				is_in_faction_with = ROOT
				surrender_progress > 0.40
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = RUS
		value = -100
	}
}

GER_finish_off_serbia = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
		}
	}
	enable = {
		SER = {
			has_war_with = ROOT
			has_capitulated = no
		}
		FRA = {
			OR = {
				exists = no
				has_capitulated = yes
			}
		}
		NOT = { 202 = { is_controlled_by = RUS } } #Ukraine hasn't lost Kyiv yet
		surrender_progress < 0.05
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = SER
		value = 100
	}
	ai_strategy = {
		type = front_control
		tag = SER
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 24 #Central Balkans
		value = 15000
	}
}

GER_finish_off_romania = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
		}
	}
	enable = {
		ROM = {
			has_war_with = ROOT
			has_capitulated = no
		}
		FRA = {
			OR = {
				exists = no
				has_capitulated = yes
			}
		}
		NOT = { 202 = { is_controlled_by = RUS } } #Ukraine hasn't lost Kyiv yet
		surrender_progress < 0.05
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = ROM
		value = 100
	}
	ai_strategy = {
		type = front_control
		tag = ROM
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 15 #Romania
		value = 15000
	}
}

GER_finish_off_italy = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
		}
	}
	enable = {
		SRI = {
			has_war_with = ROOT
			has_capitulated = no
		}
		FRA = {
			OR = {
				exists = no
				has_capitulated = yes
			}
		}
		NOT = { 202 = { is_controlled_by = RUS } } #Ukraine hasn't lost Kyiv yet
		surrender_progress < 0.05
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = SRI
		value = 100
	}
	ai_strategy = {
		type = front_control
		tag = SRI
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 23 #Italy
		value = 15000
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 181 #Po Valley
		value = 15000
	}
}

GER_in_naval_war = {
	allowed = {
		original_tag = GER
	}
	enable = {
		GER_in_naval_war = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = dockyard # Type of building
		value = 100
	}
}

GER_finish_russia_off = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
			is_ally_with = GER
		}
		is_in_europe = yes
	}
	enable = {
		has_war_with = RUS
		OR = {
			NOT = { country_exists = FRA }
			FRA = { has_capitulated = yes }
		}
		OR = {
			NOT = { country_exists = SRI }
			SRI = { has_capitulated = yes }
		}
		NOT = { is_neighbor_of = WCA } #== being invaded
		has_equipment = { infantry_equipment > 0 }
		has_manpower > 0

		#activate during the non-winter months
		set_temp_variable = { frequency = global.num_days }
		modulo_temp_variable = { frequency = 365 }
		check_variable = { frequency > 90 } #early April
		check_variable = { frequency < 300 } #late October

		#activate every 25 days, then pause for another 25
		set_temp_variable = { frequency = global.num_days }
		modulo_temp_variable = { frequency = 50 }
		check_variable = { frequency > 25 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control
		tag = RUS
		priority = 100
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_finish_russia_off_air = {
	allowed = {
		OR = {
			original_tag = GER
			original_tag = AUS
			is_ally_with = GER
		}
		is_in_europe = yes
	}
	enable = {
		has_war_with = RUS
		OR = {
			NOT = { country_exists = FRA }
			FRA = { has_capitulated = yes }
		}
		OR = {
			NOT = { country_exists = SRI }
			SRI = { has_capitulated = yes }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strategic_air_importance
		id = 130 #Ukraine
		value = 15000
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 132 #Western Russia
		value = 15000
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 133 #Central Russia
		value = 15000
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 137 #Caspian Lowlands
		value = 15000
	}
}

GER_endsieg = { #Cease attacks if losing against France and has low equipment
	allowed = {
		original_tag = GER
	}
	enable = {
		surrender_progress > 0.25
		stockpile_ratio = { archetype = infantry_equipment ratio < 0.1 }
		FRA = {
			has_war_with = ROOT
			has_capitulated = no
			surrender_progress < 0.1
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control
		tag = FRA
		priority = 150
		ordertype = front
		execute_order = no
	}
	ai_strategy = {
		type = front_control
		tag = HOL
		priority = 150
		ordertype = front
		execute_order = no
	}
	ai_strategy = {
		type = front_control
		tag = RUS
		priority = 150
		ordertype = front
		execute_order = no
	}
}

GER_dont_naval_invade_if_fighting_in_two_fronts = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = var:global.russia
		has_war_with = FRA
		FRA = { has_capitulated = no }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invasion_unit_request
		area = globally
		value = -500
	}
}

GER_ignore_colonial_fronts_until_war_is_over = {
	allowed = {
		original_tag = GER
	}
	enable = {
		alliance_naval_strength_ratio < 2
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = MAF
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = GEA
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = PER
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = AFG
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = TUR
		value = 100
	}
}

GER_destroy_invasion_beachheads_oldenburg = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { has_full_control_of_state = 56 } #Oldenburg
		has_war_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state = 56 #Oldenburg
		value = 50
	}
	ai_strategy = {
		type = front_control
		state = 56 #Oldenburg
		priority = 200
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_destroy_invasion_beachheads_hanover = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { has_full_control_of_state = 59 } #Hanover
		has_war_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state = 59 #Hanover
		value = 50
	}
	ai_strategy = {
		type = front_control
		state = 59 #Hanover
		priority = 200
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_destroy_invasion_beachheads_schleswig = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { has_full_control_of_state = 58 } #Schleswig-Holstein
		has_war_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state = 58 #Schleswig-Holstein
		state = 782 #Northern Schleswig
		value = 50
	}
	ai_strategy = {
		type = front_control
		state = 58 #Schleswig-Holstein
		state = 782 #Northern Schleswig
		priority = 200
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_destroy_invasion_beachheads_mecklenburg = {
	allowed = {
		original_tag = GER
	}
	enable = {
		NOT = { has_full_control_of_state = 61 } #Mecklenburg
		has_war_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		state = 61 #Mecklenburg
		value = 50
	}
	ai_strategy = {
		type = front_control
		state = 61 #Mecklenburg
		priority = 200
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_destroy_invasion_beachheads_netherlands = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = ENG
		HOL = {
			is_ally_with = ROOT
			NOT = { is_neighbor_of = FRA }
			NOT = { BEL = { is_ally_with = INT } }
			any_home_area_neighbor_country = { has_war_with = ENG }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = ENG
		value = 50
	}
	ai_strategy = {
		type = front_control
		tag = ENG
		priority = 200
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

GER_be_careful_around_england = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_navy_size = { size > 0 }
		has_war_with = ENG
		ENG = { is_subject = no }
		if = {
			limit = { country_exists = FRA }
			ENG = { naval_strength_comparison = { other = ROOT ratio > 0.6 } }
		}
		else = {
			ENG = { naval_strength_comparison = { other = ROOT ratio > 0.8 } }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = strike_force_home_base
		id = 173 #Eastern North Sea
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 173 #Eastern North Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 18 #English Channel
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 42 #Bay of Biscay
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 43 #Western Approaches
		value = 100
	}
	ai_strategy = {
		type = naval_convoy_raid_region
		id = 42 #Don't raid in the English Channel
		value = -500
	}
}

GER_take_the_fight_to_england = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_war_with = ENG
		has_navy_size = { size > 0 }
		ENG = { naval_strength_comparison = { other = ROOT ratio < 0.6 } }
		surrender_progress < 0.05
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "ENG"
		value = 200
	}
	ai_strategy = {
		type = front_unit_request
		tag = ENG
		value = 100
	}
	ai_strategy = {
		type = invasion_unit_request
		tag = ENG
		value = 10
	}
}

GER_dont_defend_indian_ocean = { #GER loves sending huge portions of the navy to vacation in Reunion rather than defend Germany
	allowed = {
		original_tag = GER
	}
	enable = {
		country_exists = ENG
		naval_strength_comparison = { other = ENG ratio < 0.8 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 100 #Red Sea
		value = 75
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 101 #Bay of Bengal
		value = 75
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 102 #East African Coast
		value = 75
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 103 #Mozambique Channel
		value = 75
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 85 #South West Indian Ocean
		value = 75
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 60 #West Indian Ocean
		value = 75
	}
}

GER_dont_trust_national_france = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = NFA
		NOT = { has_war_with = FRA }
		NOT = { country_exists = FRA }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = conquer
		id = NFA
		value = 100
	}
	ai_strategy = {
		type = theatre_distribution_demand_increase
		id = 28 #Alsace-Lorraine
		value = 5
	}
}

GER_no_troops_in_caucasus = {
	allowed = {
		is_in_faction_with = GER
		NOT = {
			tag = GEO
			tag = AZR
			tag = RSA
			tag = FIN
		}
	}
	enable = {
		FRA = {
			has_capitulated = no
			is_faction_leader = yes
		}
		RUS = {
			OR = {
				has_war_with = GEO
				has_war_with = AZR
				has_war_with = RSA
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_unit_request
		tag = RSA
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		tag = GEO
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		tag = AZR
		value = -100
	}
	ai_strategy = {
		type = front_unit_request
		tag = FIN
		value = -100
	}
}

#############################
## Reichspakt Coordination ##
#############################

MIE_ignore_northern_oststaaten = { #Austrian and Balkans RP tags should focus on Ukraine
	allowed = {
		OR = {
			is_danubian_tag = yes
			is_balkan_tag = yes
			is_italian_tag = yes
			original_tag = UKR

			#Banned from Eastern Front in general
			is_belgian_tag = yes
			is_scandinavian_tag = yes
			original_tag = HOL
			original_tag = SWI
		}
	}
	enable = {
		is_ally_with = GER
		RUS = { is_faction_leader = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = BLR
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = BAT
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = LIT
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = EST
		value = 100
	}
}

MIE_ignore_southern_oststaaten = { #Rest of Reichspakt should focus on BLR/BAT front
	allowed = {
		OR = {
			original_tag = POL
			original_tag = BAT
			original_tag = BLR
			is_baltic_tag = yes

			#Banned from Eastern Front in general
			is_belgian_tag = yes
			is_scandinavian_tag = yes
			original_tag = HOL
			original_tag = SWI

		}
	}
	enable = {
		is_ally_with = GER
		RUS = { is_faction_leader = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = UKR
		value = 100
	}
}

MIE_ignore_western_front = {
	allowed = {
		OR = {
			is_polish_tag = yes
			original_tag = BAT
			original_tag = BLR
			original_tag = UKR
			is_baltic_tag = yes
			original_tag = CZE
			original_tag = HUN
			is_balkan_tag = yes
			is_scandinavian_tag = yes
		}
	}
	enable = {
		is_ally_with = GER
		FRA = { is_faction_leader = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = GER
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = BEL
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = HOL
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = SWI
		value = 100
	}
}

MIE_finish_off_russia = {
	allowed = {
		OR = {
			is_polish_tag = yes
			original_tag = BAT
			original_tag = BLR
			original_tag = UKR
			is_baltic_tag = yes
			original_tag = CZE
			original_tag = HUN
			is_balkan_tag = yes
			is_scandinavian_tag = yes
			tag = AUS
		}
	}
	enable = {
		has_war_with = RUS
		OR = {
			NOT = { country_exists = FRA }
			FRA = { has_capitulated = yes }
		}
		OR = {
			NOT = { country_exists = SRI }
			SRI = { has_capitulated = yes }
		}
		NOT = { is_neighbor_of = WCA } #== being invaded

		#activate during the non-winter months
		set_temp_variable = { frequency = global.num_days }
		modulo_temp_variable = { frequency = 365 }
		check_variable = { frequency > 90 } #early April
		check_variable = { frequency < 300 } #late October

		#activate every 25 days, then pause for another 25
		set_temp_variable = { frequency = global.num_days }
		modulo_temp_variable = { frequency = 50 }
		check_variable = { frequency > 25 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_control
		tag = RUS
		priority = 150
		ordertype = front
		execution_type = rush_weak
		execute_order = yes
	}
}

MIE_no_help_strategy = {
	allowed = {
		OR = {
			is_in_faction_with = GER
			is_in_faction_with = AUS
		}
		OR = {
			has_global_flag = MIE_east_no_help_ee
			is_possible_intermarium_country = no
		}
	}
	enable = {
		has_global_flag = MIE_east_no_help
		has_war_with = RUS
		has_war_with = FRA
		FRA = { has_capitulated = no }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = UKR
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = BLR
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = LIT
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = BAT
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = POL
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = FIN
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = GEO
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = AZR
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = EST
		value = 100
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		id = RSA
		value = 100
	}
}

GER_dont_call_allies_into_minor_wars_before_weltkrieg = {
	reversed = yes

	enable = {
		GER = { has_war_with_major = no }
		is_in_faction_with = GER
		NOT = { any_home_area_neighbor_country = { has_war_with = GER } }
	}
	abort_when_not_enabled = yes

	target_array = GER.faction_members

	ai_strategy = { type = diplo_action_desire id = GER target = call_allies value = -1000 }
	ai_strategy = { type = diplo_action_acceptance id = GER target = join_allies value = -1000 }

}
################
### Industry ###
################

GER_pp_spending = {
	allowed = {
		original_tag = GER
	}
	enable = {
		threat > 0.6
		has_political_power < 160
		OR = {
			has_idea = volunteer_only
			has_idea = limited_conscription
			has_idea = extensive_conscription
		}
		check_variable = { GER_completed_industrial_decisions > 4 }
		NOT = { has_country_flag = GER_hugenberg_ai }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = pp_spend_priority
		id = decision
		value = -100
	}
	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -200
	}
}

GER_pp_spending_hugenberg = {
	allowed = {
		original_tag = GER
	}
	enable = {
		has_country_flag = GER_hugenberg_ai
		GER_is_swr_path = yes
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = pp_spend_amount
		id = decision
		value = 200
	}
	ai_strategy = {
		type = pp_spend_priority
		id = idea
		value = -200
	}
	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -200
	}
}

GER_civilian_buildup = {
	allowed = {
		original_tag = GER
	}
	enable = {
		date < 1938.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = building_target
		id = industrial_complex
		value = 59
	}
}

GER_build_more_fighters = {
	allowed = {
		original_tag = GER
	}
	enable = {
		INT = { is_faction_leader = yes }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 120 #aim for 4:2 ratio of fighters to CAS
	}
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 100
	}
}

GER_less_naval_focus = {
	allowed = {
		original_tag = GER
	}
	enable = {
		OR = {
			FRA = { is_faction_leader = yes }
			var:global.russia = { is_faction_leader = yes }
		}
	}
	abort_when_not_enabled = yes

	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_build_tanks_if_france_is_aggressive = {
	allowed = {
		original_tag = GER
	}
	enable = {
		is_neighbor_of = FRA
		FRA = { has_capitulated = no }
		OR = {
			has_country_flag = GER_build_more_tanks # Set by the Treaty of Metz event chain
			FRA = { has_government = totalist }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_armor_score
		id = FRA
		value = 250 # GER already gets a 100 score on FRA, but maybe this will make them focus even more.
	}
	ai_strategy = {
		type = front_unit_request
		tag = FRA
		value = 100
	}
	ai_strategy = {
		type = strategic_air_importance
		id = 19 # Northern France
		value = 1000
	}
}

GER_total_war_against_russia = {
	allowed = {
		original_tag = GER
	}
	enable = {
		RUS = { is_faction_leader = yes }
		FRA = {
			OR = {
				has_capitulated = yes
				exists = no
			}
		}
		SRI = {
			OR = {
				has_capitulated = yes
				exists = no
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = front_armor_score
		id = RUS
		value = 250
	}
	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 60
	}
	ai_strategy = {
		type = equipment_production_factor
		id = cas
		value = 20
	}
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = -20
	}
	ai_strategy = {
		type = railway_gun_divisions_ratio
		value = 1
	}
}

GER_build_radars_brabant = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		925 = { #Brabant
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 925 #Brabant
		value = 2000
	}
}

GER_build_radars_alsace = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		28 = { #Alsace-Lorraine
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 28 #Alsace-Lorraine
		value = 2000
	}
}

GER_build_radars_holland = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		7 = { #Holland
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

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

GER_build_radars_rhineland = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		8 = { #Luxembourg
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 8 #Luxembourg
		value = 2000
	}
}

GER_build_radars_hesse = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		55 = { #Hesse
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 55 #Hesse
		value = 2000
	}
}

GER_build_radars_warsaw = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		10 = { #Warsaw
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 10 #Warsaw
		value = 2000
	}
}

GER_build_radars_riga = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		842 = { #Riga
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 842 #Riga
		value = 2000
	}
}

GER_build_radars_minsk = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		206 = { #Minsk
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 206 #Minsk
		value = 2000
	}
}

GER_build_radars_kiev = {
	allowed = {
		original_tag = GER
		threat > 0.6
		is_special_project_completed = sp:sp_air_radar
	}
	enable = {
		202 = { #Kiev
			controller = { is_ally_with = FROM }
			free_building_slots = { building = radar_station size > 0 }
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = build_building
		id = radar_station
		target = 202 #Kiev
		value = 2000
	}
}

###############
### Special ###
###############

GER_FRP_military_occupation_request_garrison_support = {
	allowed = {
		original_tag = FRP
	}
	enable = {
		is_subject_of = GER
		has_cosmetic_tag = FRP_military_governorate
		garrison_manpower_need > 0
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = asking_foreign_garrison
		id = GER
		value = 1000
	}
}
GER_GBP_military_occupation_request_garrison_support = {
	allowed = {
		original_tag = GBP
	}
	enable = {
		is_subject_of = GER
		OR = {
			has_cosmetic_tag = GBP_military_governorate
			has_cosmetic_tag = GBP_england_military_governorate
		}
		garrison_manpower_need > 0
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = asking_foreign_garrison
		id = GER
		value = 1000
	}
}

GER_FRP_military_occupation_use_intel_agency = {
	allowed = {
		original_tag = FRP
		has_dlc_lar = yes
	}
	enable = {
		is_subject_of = GER
		has_cosmetic_tag = FRP_military_governorate
		garrison_manpower_need > 0
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 5
	}

	ai_strategy = {
		type = agency_ai_base_num_factories_factor
		value = -50
	}
	ai_strategy = {
		type = agency_ai_per_upgrade_factories_factor
		value = -25
	}

	ai_strategy = {
		type = operative_mission
		mission = root_out_resistance
		value = 1000
	}

	ai_strategy = {
		type = intelligence_agency_branch_desire_factor
		id = branch_defense
		value = 2000 # this + add_intelligence_agency_normal_upgrade_prio = 3000
	}
}
GER_GBP_military_occupation_use_intel_agency = {
	allowed = {
		original_tag = GBP
		has_dlc_lar = yes
	}
	enable = {
		is_subject_of = GER
		OR = {
			has_cosmetic_tag = GBP_military_governorate
			has_cosmetic_tag = GBP_england_military_governorate
		}
		garrison_manpower_need > 0
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = intelligence_agency_usable_factories
		value = 5
	}

	ai_strategy = {
		type = agency_ai_base_num_factories_factor
		value = -50
	}
	ai_strategy = {
		type = agency_ai_per_upgrade_factories_factor
		value = -25
	}

	ai_strategy = {
		type = operative_mission
		mission = root_out_resistance
		value = 1000
	}

	ai_strategy = {
		type = intelligence_agency_branch_desire_factor
		id = branch_defense
		value = 2000 # this + add_intelligence_agency_normal_upgrade_prio = 3000
	}
}


