

low_stability_init = {

	every_neighbor_country = {
		log = "[GetDateText]: [From.GetName]: triggered low_stability.1 for [This.GetName]: "
		set_country_flag = { flag = LS_neighbor_count value = 0 }
		every_neighbor_country = { #Unstable neighbors
			limit = {
				or = { has_stability < 0.36 is_target_of_coup = yes has_civil_war = yes }
				any_owned_state = {
					is_core_of = this
					any_neighbor_state = {
						is_core_of = PREV
					}
				}
			}
			PREV = { modify_country_flag = { flag = LS_neighbor_count value = 1 } }
		}
		update_unstable_neighbors = yes
		clr_country_flag = LS_neighbor_count
	}

}

init_AI_strategy_1 = {

	IF = {
		limit = {
			OR = {
				any_other_country = {
					OR = {
						NOT = {
							is_justifying_wargoal_against = this
							has_wargoal_against = this
						}
					}
				}
				has_war = no
				threat < 0.30
				is_bad_salafist = no
			}
		}
		add_ai_strategy = { type = role_ratio id = L_Inf value = -500 }
		add_ai_strategy = { type = role_ratio id = infantry value = -500 }
		add_ai_strategy = { type = role_ratio id = garrison value = -500 }
		add_ai_strategy = { type = role_ratio id = mechanized value = -500 }
		add_ai_strategy = { type = role_ratio id = armor value = -500 }
		add_ai_strategy = { type = role_ratio id = marines value = -500 }
		add_ai_strategy = { type = role_ratio id = Air_assault value = -500 }
		add_ai_strategy = { type = role_ratio id = Air_Inf value = -500 }
		add_ai_strategy = { type = role_ratio id = Special_Forces value = -500 }
	}
}

init_AI_strategy_2 = {
	if = {
		limit = { is_african_nation = yes }
		log = "[GetDateText]: [This.GetName]: ai_strategy.1 imediate effect executed"
		add_ai_strategy = { type = befriend id = "HAM" value = 15 }
		add_ai_strategy = { type = befriend id = "GAH" value = 15 }
		add_ai_strategy = { type = befriend id = "SIE" value = 15 }
		add_ai_strategy = { type = befriend id = "MOR" value = 15 }
		add_ai_strategy = { type = befriend id = "ALG" value = 15 }
		add_ai_strategy = { type = befriend id = "TUN" value = 15 }
		add_ai_strategy = { type = befriend id = "MAU" value = 15 }
		add_ai_strategy = { type = befriend id = "MAL" value = 15 }
		add_ai_strategy = { type = befriend id = "SEN" value = 15 }
		add_ai_strategy = { type = befriend id = "GAM" value = 15 }
		add_ai_strategy = { type = befriend id = "GUB" value = 15 }
		add_ai_strategy = { type = befriend id = "GUI" value = 15 }
		add_ai_strategy = { type = befriend id = "CDI" value = 15 }
		add_ai_strategy = { type = befriend id = "BFA" value = 15 }
		add_ai_strategy = { type = befriend id = "BEN" value = 15 }
		add_ai_strategy = { type = befriend id = "TOG" value = 15 }
		add_ai_strategy = { type = befriend id = "NIG" value = 15 }
		add_ai_strategy = { type = befriend id = "NGR" value = 15 }
		add_ai_strategy = { type = befriend id = "CAM" value = 15 }
		add_ai_strategy = { type = befriend id = "CAR" value = 15 }
		add_ai_strategy = { type = befriend id = "CHA" value = 15 }
		add_ai_strategy = { type = befriend id = "SUD" value = 15 }
		add_ai_strategy = { type = befriend id = "SSU" value = 15 }
		add_ai_strategy = { type = befriend id = "ERI" value = 15 }
		add_ai_strategy = { type = befriend id = "DJI" value = 15 }
		add_ai_strategy = { type = befriend id = "SOM" value = 15 }
		add_ai_strategy = { type = befriend id = "EGU" value = 15 }
		add_ai_strategy = { type = befriend id = "SAO" value = 15 }
		add_ai_strategy = { type = befriend id = "KEN" value = 15 }
		add_ai_strategy = { type = befriend id = "UGA" value = 15 }
		add_ai_strategy = { type = befriend id = "TNZ" value = 15 }
		add_ai_strategy = { type = befriend id = "GAB" value = 15 }
		add_ai_strategy = { type = befriend id = "CNG" value = 15 }
		add_ai_strategy = { type = befriend id = "RWA" value = 15 }
		add_ai_strategy = { type = befriend id = "BUR" value = 15 }
		add_ai_strategy = { type = befriend id = "DRC" value = 15 }
		add_ai_strategy = { type = befriend id = "AGL" value = 15 }
		add_ai_strategy = { type = befriend id = "ZAM" value = 15 }
		add_ai_strategy = { type = befriend id = "MLW" value = 15 }
		add_ai_strategy = { type = befriend id = "MOZ" value = 15 }
		add_ai_strategy = { type = befriend id = "ZIM" value = 15 }
		add_ai_strategy = { type = befriend id = "BOT" value = 15 } 
		add_ai_strategy = { type = befriend id = "SWA" value = 15 }
		add_ai_strategy = { type = befriend id = "LES" value = 15 }
		add_ai_strategy = { type = befriend id = "SML" value = 15 }
		add_ai_strategy = { type = befriend id = "MAD" value = 15 }
		add_ai_strategy = { type = befriend id = "COM" value = 15 }
		add_ai_strategy = { type = befriend id = "MRT" value = 15 }
		add_ai_strategy = { type = befriend id = "SEY" value = 15 }
		add_ai_strategy = { type = befriend id = "STH" value = 15 }
		add_ai_strategy = { type = befriend id = "VER" value = 15 }
		add_ai_strategy = { type = befriend id = "CNR" value = 15 }
		add_ai_strategy = { type = befriend id = "NAM" value = 15 }
		add_ai_strategy = { type = befriend id = "SHA" value = 15 }
		add_ai_strategy = { type = befriend id = "ETH" value = 15 }
		add_ai_strategy = { type = befriend id = "SAF" value = 15 }
		add_ai_strategy = { type = befriend id = "LBA" value = 15 }
		add_ai_strategy = { type = befriend id = "EGY" value = 15 }
	}
}

init_neighbor_drift_1 = {
#clear_neighbor_count_ideas = yes
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = fascism 
				is_major = no
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}

	salafist_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = fascism 
				is_major = yes
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}
	
	salafist_major_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = democratic 
				is_major = no
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}

	western_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = democratic 
				is_major = yes
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}
	
	western_major_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
	every_neighbor_country = { 
			limit = { 
				has_government = communism 
				is_major = no
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}

	emerging_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = communism 
				is_major = yes
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}
	
	emerging_major_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
	every_neighbor_country = { 
			limit = { 
				has_government = neutrality 
				is_major = no
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}

	non_alligned_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = neutrality 
				is_major = yes
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}
	
	non_alligned_major_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
	every_neighbor_country = { 
			limit = { 
				has_government = nationalist 
				is_major = no
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}

	nationalist_count = yes
	clr_country_flag = neighbor_count
	set_country_flag = { flag = neighbor_count value = 0 }
	
		every_neighbor_country = { 
			limit = { 
				has_government = nationalist 
				is_major = yes
			}
			PREV = { modify_country_flag = { flag = neighbor_count value = 1 } }
		}
	
	nationalist_major_count = yes
	clr_country_flag = neighbor_count
	
	### Boost to ruling parties ###
	if = {
	  limit = {
		 has_government = fascism
			is_major = no
	  }
	  add_ideas = ruling_party_salafist
	}
	if = {
	  limit = {
			is_major = yes
		 has_government = fascism
			
	  }
	  add_ideas = major_ruling_party_salafist
	}
	if = {
	  limit = {
		 has_government = democratic
			is_major = no
	  }
	  add_ideas = ruling_party_western
	}
	if = {
	  limit = {
			is_major = yes
		 has_government = democratic
	  }
	  add_ideas = major_ruling_party_western
	}
	if = {
	  limit = {
		 has_government = communism
			is_major = no
	  }
	  add_ideas = ruling_party_emerging
	}
	if = {
	  limit = {
			is_major = yes
		 has_government = communism
	  }
	  add_ideas = major_ruling_party_emerging
	}
	if = {
	  limit = {
			has_government = neutrality
			is_major = no
	  }
	  add_ideas = ruling_party_non_alligned
	}
	if = {
	  limit = {
			is_major = yes
		 has_government = neutrality
	  }
	  add_ideas = major_ruling_party_non_alligned
	}
	if = {
	  limit = {
		 has_government = nationalist
			is_major = no
	  }
	  add_ideas = ruling_party_nationalist
	}
	if = {
	  limit = {
			is_major = yes
		 has_government = nationalist
	  }
	  add_ideas = major_ruling_party_nationalist
	}
}

init_neighbor_drift_2 = {

	if = {
	  limit = {
		 has_idea = economic_boom
	  }
	  update_drift_economic_boom = yes
	}
	if = {
	  limit = {
		 has_idea = fast_growth
	  }
	  update_drift_fast_growth = yes
	}
	if = {
	  limit = {
		 has_idea = stagnation
	  }
	  update_drift_stagnation = yes
	}
	if = {
	  limit = {
		 has_idea = recession
	  }
	  update_drift_recession = yes
	}
	if = {
	  limit = {
		 has_idea = depression
	  }
	  update_drift_depression = yes
	}

}