############################################################################################################
#	Expert AI mod - startup effects
############################################################################################################

EAI_startup_effects = {

	EAI_set_version = yes

	### Globals

	EAI_MAP_startup = yes
	EAI_FOCUS_CONFIG_types = yes
	EAI_advisor_types = yes
	EAI_ESP_operation_types = yes
	EAI_PC_set_global_variables = yes
	country_event = EAI_C.10002 # EAI_set_resource_variables
	EAI_TEMPLATE_set_variables = yes

	###

	every_country = { limit = { is_ai = no }

		EAI_check_game_version = yes
	}

	random_country = {

		EAI_startup_logging = yes
	}

	###

	random_country = { limit = { is_ai = no } 
	
		### Default historical startup settings

		set_global_flag = EAI_neutral_spr

		set_global_flag = EAI_lend_lease
		
		set_variable = { global.EAI_eastern_front = 1 }
		set_variable = { global.EAI_sino_japanese_war = 2 }

		### Show EAI config

		set_country_flag = EAI_config_STARTUP 
		set_country_flag = EAI_show_country_config_decisions 
	}

	every_country = { limit = { is_ai = yes }

		EAI_PC_startup = yes

		EAI_construction_monthly_update = yes

		set_country_flag = { flag = EAI_PR_block_research value = 1 days = 10 }
		EAI_PR_priority_research_update = yes
		EAI_PR_priority_research_update_daily = yes

		### Make ENG and JAP focus on range fighters

		if = {
			limit = {
				EAI_is_island_nation = yes
			}
			set_variable = {  EAI_fighter_variant = global.EAI_FIGHTER_VARIANT_E }
		}
	}

	###

	set_variable = { global.EAI_initialization_delay = 3 }

	### radar script
	
	every_state = { limit = { EAI_radar_location = yes }

		set_state_flag = EAI_radar_site
	}

	### Stop UK from taking all MAL divisions

	if = { limit = { ENG = { is_ai = yes } MAL = { is_ai = yes } }

		ENG ={
			set_autonomy = {
				target = MAL
				autonomy_state = autonomy_puppet
			}
		}
	}
}

EAI_delayed_startup_effects = { # Month from startup

	if = { limit = { EAI_MODE_challenging = yes }

		### Cheaty way to resolve trade issues
	
		every_country = { limit = { is_ai = yes }
			EAI_TRADE_allies_opinions = yes
		}

		### Stop UK from taking all MAL divisions

		if = { limit = { ENG = { is_ai = yes } MAL = { is_ai = yes } }

			ENG ={
				annex_country = {
					target = MAL
					transfer_troops = yes
				}
			}
		}
	}
}