capital = 267

if = {
	limit = {
		NOT = {
			has_dlc = "No Step Back"
		}
	}
	set_oob = "AFG_1936"
}
if = {
	limit = {
		has_dlc = "No Step Back"
	}
	set_oob = "AFG_1936_nsb"
}

set_technology = {
	infantry_weapons = 1
}
if = {
	limit = {
		NOT = { has_dlc = "No Step Back" }
	}
	set_technology = { #vanilla keeps the old system, nsb afghanistan will no longer produce some of the most advanced tanks in the world
		gwtank = 1
		basic_light_tank = 1
	}
}

if = {
	limit = {
		has_dlc = "No Step Back"
	}
	set_technology = { 
		gwtank_chassis = 1
		
	}
}

IF = {
	limit = {
		has_dlc = "Graveyard of Empires"
	}
	recruit_character = AFG_mohammed_zahir_shah
	recruit_character = AFG_mohammad_hashim_khan
	recruit_character = AFG_sardar_shah_wali_khan
	recruit_character = AFG_abdur_rahim_khan
	recruit_character = AFG_mahmud_tarzi
	recruit_character = AFG_mohammed_daoud_khan
	recruit_character = AFG_abdul_majid_zabuli
	recruit_character = AFG_abdul_hai_habibi
	recruit_character = AFG_qiamuddin_khadim
	recruit_character = AFG_ghulam_yahya_khan_tarzi
	recruit_character = AFG_ghulam_muhammad_ghobar
	recruit_character = AFG_turbaz_khan
	recruit_character = AFG_mohammad_gul_khan_momand
	recruit_character = AFG_shah_mahmud_khan
	recruit_character = AFG_amunullah_khan
	recruit_character = AFG_soraya_tarzi
	recruit_character = AFG_provisional_government
	recruit_character = AFG_muhammad_ibrahim_khan

	# Generics
	recruit_character = AFG_generic_army_1
	recruit_character = AFG_generic_army_2
	recruit_character = AFG_generic_army_3
	recruit_character = AFG_generic_army_4
	recruit_character = AFG_generic_navy_1
	recruit_character = AFG_generic_navy_2
	recruit_character = AFG_placeholder_fascist
	recruit_character = AFG_generic_american_1
	recruit_character = AFG_generic_american_2
	recruit_character = AFG_generic_american_3
	
	#add_stability = -0.7
	
	set_variable = { AFG_electrification_cooldown = 0 }
	### Techs ###

	set_technology = {
		gw_artillery = 1
	}

	#### Ideas/Modifiers/Variables ####

	add_ideas = AFG_mohammad_zahir_shah_ns
	add_ideas = AFG_pashtunwali
	add_ideas = AFG_turkish_military_mission
	# Variables for subsistence economy modifier
	set_variable = { AFG_economy_production_efficiency_gain_factor = -0.5 }
	set_variable = { AFG_economy_production_max_efficiency_factor = -0.35 }
	set_variable = { AFG_economy_industrial_capacity_factor = -0.5 }
	set_variable = { AFG_stability_factor_dm = 0.2 }
	add_dynamic_modifier = { modifier = AFG_subsistence_economy_modifier }

	#Variables for Quami modifier
	set_variable = { AFG_modifier_army_sub_unit_irregular_infantry_defence_factor = 0.05 }
	set_variable = { AFG_modifier_army_sub_unit_irregular_infantry_speed_factor = 0.05 }
	set_variable = { AFG_modifier_army_sub_unit_irregular_infantry_max_org_factor = 0.05 }
	set_variable = { AFG_modifier_army_sub_unit_irregular_infantry_attack_factor = 0 }
	#set_variable = { AFG_MODIFIER_CAVALRY_ATTACK_FACTOR = 0 }
	#set_variable = { AFG_MODIFIER_CAVALRY_DEFENCE_FACTOR = 0}
	set_variable = { AFG_modifier_army_sub_unit_cavalry_attack_factor = 0 }
	set_variable = { AFG_modifier_army_sub_unit_cavalry_defence_factor = 0 }
	set_variable = { AFG_modifier_army_sub_unit_cavalry_speed_factor = 0 }
	set_variable = { AFG_army_core_defence_factor = 0 }
	set_variable = { AFG_acclimatization_cold_climate_gain_factor = 0 }
	set_variable = { AFG_acclimatization_hot_climate_gain_factor = 0 }
	set_variable = { AFG_conscription_factor = 0.2 }
	set_variable = { AFG_experience_gain_army_factor = 0 }
	set_variable = { AFG_training_time_factor = 0 }
	set_variable = { AFG_max_planning_factor = 0 }
	set_variable = { AFG_planning_speed = 0 }


	add_dynamic_modifier = {
		modifier = AFG_quami_modifier
	}

	#variables for Nufus modifier

	set_variable = { AFG_experience_gain_army_factor = 0.02 }
	set_variable = { AFG_army_org_factor = 0 }
	set_variable = { AFG_army_core_defence_factor = 0.03 }
	set_variable = { AFG_army_armor_defence_factor = 0 }
	set_variable = { AFG_army_armor_attack_factor = 0 }
	set_variable = { AFG_army_artillery_attack_factor = 0 }
	set_variable = { AFG_army_artillery_defence_factor = 0 }
	set_variable = { AFG_conscription_factor = 0 }
	set_variable = { AFG_training_time_factor = 0 }
	set_variable = { AFG_conscription = 0 }
	set_variable = { AFG_army_defence_factor = 0 }
	set_variable = { AFG_army_attack_factor = 0 }
	set_variable = { AFG_special_forces_cap = 0 }
	set_variable = { AFG_special_forces_out_of_supply_factor = 0 }
	set_variable = { AFG_extra_marine_supply_grace = 0 }
	set_variable = { AFG_max_planning_factor = 0 }
	set_variable = { AFG_planning_speed = 0 }
	set_variable = { AFG_max_command_power_mult = 0 }
	set_variable = { AFG_command_power_gain_mult = 0 }
	set_variable = { AFG_acclimatization_cold_climate_gain_factor = 0 }
	set_variable = { AFG_acclimatization_hot_climate_gain_factor = 0 }

	# Varaibles for Amanullah modifier

	set_variable = { AFG_amanullah_modifier_stability_factor = -0.05 }
	set_variable = { AFG_amanullah_modifier_fascism_drift = 0.01 }
	set_variable = { AFG_amanullah_modifier_core_defense_factor = 0 }
	set_variable = { AFG_amanullah_modifier_core_attack_factor = 0 }

	# Variables for 1923 constitution modifier 

	set_variable = { AFG_1923_const_modifier_stability_factor = -0.1 }
	set_variable = { AFG_1923_const_modifier_mobilization_laws_cost_factor = -0.25 }
	set_variable = { AFG_1923_const_modifier_political_advisor_cost_factor = -0.25 }
	set_variable = { AFG_1923_const_modifier_production_speed_industrial_complex_factor = 0.1 }
	set_variable = { AFG_1923_const_modifier_research_speed_factor = 0 }
	set_variable = { AFG_1923_const_modifier_production_factory_efficiency_gain_factor = 0 }
	set_variable = { AFG_1923_const_modifier_production_factory_max_efficiency_factor = 0 }

	every_owned_state = {
		limit = {
			is_owned_by = AFG
		}
		set_variable = { AFG_state_development_production_speed = -0.2 }
		set_variable = { AFG_state_development_state_resources_factor = -0.2 }
		set_variable = { AFG_state_production_speed_infrastructure_factor = -0.2 }

		add_dynamic_modifier = {
			modifier = AFG_economic_regionalism
		}
	}

	every_owned_state = {
		limit = {
			OR = { 
				state = 1005
				state = 1007
			}
		}
		add_dynamic_modifier = { 
			modifier = AFG_disgruntled_minority
		}
	}

	set_politics = {
		ruling_party = neutrality
		last_election = "1936.1.1"
		election_frequency = 48
		elections_allowed = no
	}
	
	set_popularities = {
		fascism = 10
		communism = 0
		democratic = 15
		neutrality = 75
	}
	set_war_support = 0.1

	set_stability = 0.0

	set_variable = { AFG_levy_cap_max = 24 }
	set_variable = { AFG_levy_cap_min = 0 }
	set_variable = { AFG_levy_cap = 6 }
	set_variable = { AFG_levy_deployed = 0 }
	clamp_variable = {
		var = AFG_levy_cap
		min = AFG_levy_cap_min
		max = AFG_levy_cap_max
	}

	division_template = {
		name = "Pashtun Levy"		
		#division_names_group = 
		is_locked = yes
		force_allow_recruiting = no
		regiments = {
			irregular_infantry = { x = 0 y = 0 }
			irregular_infantry = { x = 0 y = 1 }
			irregular_infantry = { x = 1 y = 0 }
			irregular_infantry = { x = 1 y = 1 }
			irregular_infantry = { x = 2 y = 0 }
			irregular_infantry = { x = 2 y = 1 }
		}
		override_model = AFG_militia_entity
	}

	set_country_flag = AFG_quami_is_active

}
IF = {
	limit = {
		NOT = { has_dlc = "Graveyard of Empires"}
	}
	recruit_character = AFG_mohammed_zahir_shah
	recruit_character = AFG_akram_sattari
	recruit_character = AFG_yaqub_khan
	recruit_character = AFG_mihrdil_shahnawaz
	recruit_character = AFG_sardar_shah_wali_khan
	recruit_character = AFG_hares_muzafar
	recruit_character = AFG_asadullah_seraj_khan
	recruit_character = AFG_gholam_wali
	recruit_character = AFG_nasirullah_husain
	recruit_character = AFG_muhammad_amin_bughra
	recruit_character = AFG_azam_ataullah
	recruit_character = AFG_mohammed_daoud_khan
	recruit_character = AFG_renato_bardolucci
	recruit_character = AFG_ali_muhammed_khan
	recruit_character = AFG_mohammed_etemadi_khan
	recruit_character = AFG_aalem_daana
	recruit_character = AFG_wazir_akbar_khan
	recruit_character = AFG_mahmud_khan
	recruit_character = AFG_haji_faiz_muhammed_zikeria
	recruit_character = AFG_mohammad_hashim_khan
	recruit_character = AFG_muhammed_nowroz
	
	set_politics = {
		ruling_party = neutrality
		last_election = "1936.1.1"
		election_frequency = 48
		elections_allowed = no
	}
	
	set_popularities = {
		fascism = 15
		communism = 10
		neutrality = 75
	}

	### Techs ###
	set_technology = {
		gw_artillery = 1
	}
}

1939.1.1 = {

	add_political_power = 1198
	add_command_power = 100
	
	IF = {
		limit = {
			has_dlc = "Graveyard of Empires"
		}
		#1936
		complete_national_focus = AFG_support_king_zahir
		complete_national_focus = AFG_expand_telegraph_network
		complete_national_focus = AFG_placeholder_1
		complete_national_focus = AFG_fruit_packing
		complete_national_focus = AFG_implement_currency_controls
		complete_national_focus = AFG_sugar_processing
		complete_national_focus = AFG_clear_malarial_swamps
		 #1937
		complete_national_focus = AFG_clear_malarial_swamps
		complete_national_focus = AFG_infrastructure_construction
		complete_national_focus = AFG_electrification
		complete_national_focus = AFG_establish_radio_networks
		#1938
		complete_national_focus = AFG_expand_karakul_lambskin_industry
		complete_national_focus = AFG_reform_2
		complete_national_focus = AFG_secure_dynasty
		complete_national_focus = AFG_maintain_neutrality
		#1939
		complete_national_focus = AFG_qargha_dam
		complete_national_focus = AFG_adopt_nufus
		complete_national_focus = AFG_introduce_national_service
		complete_national_focus = AFG_new_army
	}
	IF = {
		limit = {
			NOT = { has_dlc = "Graveyard of Empires" }
		}
		# Generic focuses
		complete_national_focus = army_effort
		complete_national_focus = equipment_effort
		complete_national_focus = motorization_effort
		complete_national_focus = aviation_effort
		complete_national_focus = construction_effort_2
		complete_national_focus = production_effort_2
		complete_national_focus = infrastructure_effort
		complete_national_focus = industrial_effort
		complete_national_focus = construction_effort
		complete_national_focus = production_effort		
	}
	

	oob = "AFG_1939"
	if = {
		limit = { has_dlc = "By Blood Alone" }
			set_air_oob = "AFG_1939_air_bba"
		else = {
			set_air_oob = "AFG_1939_air_legacy"
			set_technology = {
				early_fighter = 1
				CAS1 = 1
			}
		}
	}
	set_technology = {
		
		gw_artillery = 1

		#doctrines
		air_superiority = 1
		grand_battle_plan = 1
		trench_warfare = 1
		fleet_in_being = 1
		battlefleet_concentration = 1
		convoy_sailing = 1


		#electronics
		electronic_mechanical_engineering = 1
		radio = 1
		mechanical_computing = 1

		#industry
		basic_machine_tools = 1
		improved_machine_tools = 1
		advanced_machine_tools = 1
		fuel_silos = 1
		construction1 = 1
		construction2 = 1
		dispersed_industry = 1
		dispersed_industry2 = 1
	}
	complete_special_project = {
		project = sp:sp_air_radar
	}
}

1939.1.1 = {
	set_politics = {
		ruling_party = neutrality
		last_election = "1936.1.1"
		election_frequency = 48
		elections_allowed = no
	}
	set_popularities = {
		fascism = 20
		communism = 10
		neutrality = 70
	}
}

