# MAF

KR_keep_MAF_units_home = {
	reversed = yes

	enable_reverse = {
		MAF = { is_in_faction_with = GER }
	}
	enable = {
		is_in_faction_with = MAF
		NOT = {
			tag = MAF
			has_war_with = NFA
		}
	}
	target_array = GER.faction_members

	abort_when_not_enabled = yes

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

KR_keep_MAF_units_home_2 = {
	enable = {
		is_in_faction_with = MAF
		NOT = {
			tag = MAF
			has_war_with = NFA
		}
		MAF = { is_subject_of = GER }
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "MAF"
		value = 0
	}
}

KR_keep_MAF_units_home_3 = {
	enable = {
		is_subject_of = MAF
	}

	abort_when_not_enabled = yes

	targets = { POR PAF CEA CIV RWA BRD UGA KTG ZZB ZAM KBR BRT BSC CMR COG DAH GHA HAU KEN SIE SUD TKE ORT KAS LPD KIK CCO KIV MSF UMN MLW ADW NMB NBL }
	
	ai_strategy = {
		type = dont_defend_ally_borders
		value = 0
	}
}
germany_ignore_MAF_revolts = {
	reversed = yes
	allowed = {
		tag = GER
	}
	enable = {
		has_war_with = MAF
	}
	targets = { POR PAF CEA CIV RWA BRD UGA KTG ZZB ZAM KBR BRT BSC CMR COG DAH GHA HAU KEN SIE SUD TKE ORT KAS LPD KIK CCO KIV MSF UMN MLW ADW NMB NBL }
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = ignore
		id = "GER"
		value = 200
	}
}

germany_ignore_MAF_revolts_two = {
	allowed = {
		OR = {
			tag = GER
			tag = BEL
			tag = HOL
			tag = DEN
			tag = UKR
			tag = LIT
			tag = LAT
			tag = EST
			tag = BAT
			tag = FIN
			tag = AOG
			tag = GEA
			tag = POL
			tag = OMA
			tag = SOM
			tag = ETH
		}
	}
	enable = {
	OR = {
		tag = GER
		is_in_faction_with = GER
		}
	}

	
	abort_when_not_enabled = yes

ai_strategy = {
		type = area_priority
		id = east_africa
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = south_africa
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = middle_africa
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = west_africa
		value = -500
	}
}

KR_MAF_prewar_strategy = {
	allowed = {
		tag = MAF
	}
	enable = {
		is_subject_of = GER
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = area_priority
		id = benelux
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = germany
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = africa
		value = 500
	}
}

# Keep GEA units in East Indies/SE Asia
KR_keep_GEA_units_home = {
	reversed = yes
	
	enable_reverse = {
		GEA = { is_in_faction_with = GER }
	}
	enable = {
		is_in_faction_with = GEA
		NOT = {
			tag = GEA
			has_war_with = JAP
		}
	}
	target_array = GER.faction_members

	abort_when_not_enabled = yes

	ai_strategy = {
		type = dont_defend_ally_borders
		id = "GEA"
		value = 100
	}
}
KR_keep_GEA_units_home_2 = {
	enable = {
		is_in_faction_with = GEA
		NOT = {
			tag = GEA
			has_war_with = JAP
			has_war_with = INC
		}
		GEA = { is_subject_of = GER }
	}

	abort_when_not_enabled = yes

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

KR_GEA_prewar_strategy = {
	allowed = {
		tag = GEA
	}
	enable = {
		is_subject_of = GER
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = naval_avoid_region
		id = 9 #Baltic Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 30 #Black Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 241 #Azov Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 69 #East Med
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 168 #Adriatic Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 29 #Central Med
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 169 #Tyrrhenian Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 68 #West Med
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 100 #Red Sea
		value = 100
	}
	ai_strategy = {
		type = area_priority
		id = benelux
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = germany
		value = -500
	}
	ai_strategy = {
		type = area_priority
		id = east_indies
		value = 500
	}
	ai_strategy = {
		type = area_priority
		id = se_asia
		value = 500
	}
}

vietnam_war_ally = {
	allowed = {
		original_tag = GEA
	}
	enable = {
		country_exists = VIN
	}
	abort = {
		NOT = { country_exists = INC }
	}

	ai_strategy = {
		type = befriend
		id = "VIN"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "VIN"
		value = 200
	}
	
	ai_strategy = {
		type = protect
		id = "VIN"
		value = 200
	}
	
	ai_strategy = {
		type = force_defend_ally_borders
		id = VIN
		value = 200
	}
}

bush_war_ally = {
	allowed = {
		original_tag = MAF
	}
	enable = {
		country_exists = COG
	}
	abort = {
		NOT = { 
			country_exists = ORT 
			country_exists = KAS 
		}
	}

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

	ai_strategy = {
		type = protect
		id = "COG"
		value = 200
	}

	ai_strategy = {
		type = force_defend_ally_borders
		id = COG
		value = 200
	}
}

# Navy won't die easily to Japan
KR_GEA_war_strategy = {
	allowed = {
		tag = GEA
	}
	enable = {
		has_war_with = JAP
		OR = {
			naval_strength_ratio = { tag = JAP ratio < 0.75 }
			country_exists = FRA #France is not defeated
		}
	}

	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade #Not even try islands
		id = "JAP"
		value = -1500
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 79 #Sea of Japan
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 90 #Coast of Japan
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 76 #East China Sea
		value = 100
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 77 #Yellow Sea
		value = 100
	}
	ai_strategy = {
		type = area_priority
		id = east_indies
		value = 1000
	}
	ai_strategy = {
		type = area_priority
		id = se_asia
		value = 1000
	}
}

GEA_naval_focus = {
	allowed = {
		original_tag = GEA
	}
	enable = {
		has_navy_size = { size > 0 }
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 20
	}
	ai_strategy = {
		type = naval_invasion_focus
		value = 55
	}
}