AFG_oil_concessions_category = {
	
	AFG_propose_oil_concession_deal = {

		icon = GFX_decision_oil

		ai_will_do = {
			base = 40
			modifier = {
				FROM = { is_ai = no }
				difficulty > 2
				factor = 0
			}
			modifier = {
				FROM = { tag = ENG }
				any_country = {
					is_axis_ai = yes
					is_ai = no
				}
				NOT = {
					any_country = {
						is_allied_ai = yes
						is_ai = no
					}
				}
				factor = 20
			}
			modifier = {
				FROM = { tag = GER }
				any_country = {
					is_allied_ai = yes
					is_ai = no
				}
				NOT = {
					any_country = {
						is_axis_ai = yes
						is_ai = no
					}
				}
				factor = 20
			}
			modifier = {
				AND = {
					AND = {
						FROM = {
							tag = ENG
						}
						NOT = {
							any_country = {
								is_axis_ai = yes
								is_ai = no	
							}
						}
						NOT = {
							any_country = {
								is_allied_ai = yes
								is_ai = no	
							}
						}
					}
				}
				factor = 20
			}
			modifier = {
				add = 5000
				FROM = { is_ai = no } #if a player has befriended iran, always prioritized the player
				has_opinion = {
					target = FROM
					value > 89
				}
			}
		}

		target_trigger = {
		    FROM = { 
		    	is_major = yes
		    	NOT = {
		    		has_war_with = ROOT
		    		original_tag = SOU
		    	}
		    }
		}
	
		allowed = {
			original_tag = AFG
		}

		available = {
			has_completed_focus = AFG_75_year_oil_concessions
			NOT = {
				has_country_flag = AFG_oil_deal_negotiation_in_progress
			}
		} 

		visible = { 
			has_completed_focus = AFG_75_year_oil_concessions
			NOT = {
				has_country_flag = AFG_signed_oil_deal_flag
			}
			NOT = { has_global_flag = LSM_oil_trade_banned }
		}

		cost = 0
		
		days_remove = 30

		modifier = {
			political_power_factor = -0.1
		}

		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_oil_deal_negotiation_in_progress
			}
		}

		remove_effect = {
			FROM = {
				country_event = {
					id = AFG_industrial_events.10
					days = 1
				}
			}
			custom_effect_tooltip = if_they_accept_tt
			effect_tooltip = {
				267 = {
					add_resource = {
						type = oil
						amount = 10
					}
					set_state_flag = AFG_oil_concession_here_flag
				}
				415 = {
					add_resource = {
						type = oil
						amount = 10
					}
				}
				give_resource_rights = {
					receiver = FROM
					state = 267
					resources = { oil }
				}
			}
		}
	}

	AFG_nationalize_oil = {

		icon = GFX_decision_oil

		ai_will_do = {
			base = 0
		}

		target_trigger = {
		    FROM = { 
		    	has_country_flag = made_oil_deal_with_afg_flag
		    }
		}
	
		allowed = {
			original_tag = AFG
		}

		available = {
			has_completed_focus = AFG_75_year_oil_concessions
			has_country_flag = AFG_signed_oil_deal_flag
		} 

		visible = { 
			any_owned_state = {
				is_controlled_by = ROOT
				has_state_flag = AFG_oil_concession_here_flag
			}
		}

		cost = 0
		
		days_remove = 14

		modifier = {
			political_power_factor = -0.1
		}

		remove_effect = {
			FROM = {
				remove_resource_rights = 267
				country_event = {
					id = AFG_industrial_events.13
					days = 1
				}
			}
			hidden_effect = {
				random_state = {
					limit = {
						has_state_flag = AFG_oil_concession_here_flag
					}
					clr_state_flag = AFG_oil_concession_here_flag
				}
			}
		}
	}

}


AFG_radical_students_category = {
	AFG_radical_students_countdown = {
		icon = GFX_decision_revolt
		allowed = {
			original_tag = AFG
		}	
		available = {
			has_completed_focus = AFG_expand_kabul_university
			industrial_complex > 19
		}
		days_mission_timeout = 365
		activation = {
			AND = {
				has_completed_focus = AFG_expand_kabul_university
				industrial_complex < 19
			}
		}
		#cancel_trigger = {
		#	industrial_complex > 19
		#}
		fire_only_once = no
		is_good = no
		timeout_effect = {
			country_event = {
				id = AFG_industrial_events.40
				hours = 1
			}
			effect_tooltip = {
				ROOT = {
					random_list = {
						25 = { add_timed_idea = { idea = AFG_communist_graduates days = 365 } } 
						25 = { add_timed_idea = { idea = AFG_democratic_graduates days = 365 } }
						25 = { add_timed_idea = { idea = AFG_fascist_graduates days = 365 } }
						25 = { add_timed_idea = { idea = AFG_neutrality_graduates days = 365 } }
					}
				}
			}
			hidden_effect = {
				random_list = {
					25 = { 
						modifier = {
							factor = 0
							has_government = communism
						}
						set_country_flag = AFG_communist_students 
					}
					25 = { 
						modifier = {
							factor = 0
							has_government = democratic
						}
						set_country_flag = AFG_democratic_students 
					}
					25 = { 
						modifier = {
							factor = 0
							has_government = fascism
						}
						set_country_flag = AFG_fascist_students 
					}
					25 = { 
						modifier = {
							factor = 0
							has_government = neutrality
						}
						set_country_flag = AFG_neutral_students 
					}
				}
			}
		}
	}

	AFG_placate_the_graduates = {
		icon = GFX_decision_generic_political_address
		allowed = {
			original_tag = AFG
		}
		available = {
			NOT = {
				OR = { 
					has_idea = AFG_placated_graduates
					has_country_flag = AFG_construct_mio_in_progress
				}
			}
		}
		
		visible = {
			has_completed_focus = AFG_expand_kabul_university
			industrial_complex < 19
		}

		ai_will_do = {
			base = 100
			modifier = {
				factor = 10
				has_stability < 0.4
			}
		}
		cost = 50
		fire_only_once = no
		days_remove = 7
		complete_effect = {
			set_country_flag = AFG_construct_mio_in_progress
		}
		remove_effect = {
			add_days_mission_timeout = {
				mission = AFG_radical_students_countdown
				days = 180
			}
			add_timed_idea = {
				idea = AFG_placated_graduates
				days = 365
			}
			clr_country_flag = AFG_construct_mio_in_progress	
		}
	}

	AFG_expand_education_facilities = {
		icon = GFX_decision_generic_political_address
		allowed = {
			original_tag = AFG
		}
		available = {
			NOT = {
				OR = { 
					has_idea = AFG_expanded_education
					has_country_flag = AFG_construct_mio_in_progress
				}
			}
		}
		
		visible = {
			has_completed_focus = AFG_expand_kabul_university
		}

		ai_will_do = {
			base = 100
			modifier = {
				factor = 10
				has_stability < 0.4
			}
		}
		cost = 50
		fire_only_once = no
		days_remove = 7
		complete_effect = {
			set_country_flag = AFG_expanding_education
		}
		remove_effect = {
			add_days_mission_timeout = {
				mission = AFG_radical_students_countdown
				days = 180
			}
			add_timed_idea = {
				idea = AFG_expanded_education
				days = 365
			}	
		}
	}

	AFG_setup_tank_mio = {
		icon = GFX_decision_generic_merge_plant_tank
		allowed = {
			original_tag = AFG
		}
		available = {
			NOT = {
				has_country_flag = AFG_construct_mio_in_progress
			}
		}
		
		visible = {
			has_completed_focus = AFG_state_industries
		}

		ai_will_do = {
			base = 100
			modifier = {
				factor = 10
				has_stability < 0.4
			}
		}
		cost = 50
		fire_only_once = yes
		days_remove = 14
		complete_effect = {
			set_country_flag = AFG_construct_mio_in_progress
		}
		remove_effect = {
			set_country_flag = afg_tank_factory_mio
			add_days_mission_timeout = {
				mission = AFG_radical_students_countdown
				days = 180
			}
			if = {
				limit = { has_dlc = "Arms Against Tyranny"}
				custom_effect_tooltip = AFG_shipyards_tt_2
				show_mio_tooltip = AFG_tanks_organization
				mio:AFG_tanks_organization = {
					add_mio_size = 1
				}
			}
			else = {
				army_experience = 50
			}
			clr_country_flag = AFG_construct_mio_in_progress
		}
	}

	AFG_setup_aircraft_mio = {
		icon = GFX_decision_SWE_set_air_budget
		allowed = {
			original_tag = AFG
		}
		available = {
			NOT = {
				has_country_flag = AFG_construct_mio_in_progress
			}
		}
		
		visible = {
			has_completed_focus = AFG_state_industries
		}

		ai_will_do = {
			base = 100
			modifier = {
				factor = 10
				has_stability < 0.4
			}
		}
		cost = 50
		fire_only_once = yes
		days_remove = 14
		complete_effect = {
			set_country_flag = AFG_construct_mio_in_progress
		}
		remove_effect = {
			set_country_flag = afg_aircraft_factory_mio
			add_days_mission_timeout = {
				mission = AFG_radical_students_countdown
				days = 180
			}
			if = {
				limit = { has_dlc = "Arms Against Tyranny" }
				custom_effect_tooltip = AFG_shipyards_tt_2
				show_mio_tooltip = AFG_aircraft_organization
				mio:AFG_aircraft_organization = {
					add_mio_size = 1
				}
			}
			else = {
				air_experience = 50
			}
			clr_country_flag = AFG_construct_mio_in_progress
		}
	}

	AFG_setup_artillery_mio = {
		icon = GFX_decision_generic_fortification
		allowed = {
			original_tag = AFG
		}
		available = {
			NOT = {
				has_country_flag = AFG_construct_mio_in_progress
			}
		}
		
		visible = {
			has_completed_focus = AFG_state_industries
		}

		ai_will_do = {
			base = 100
			modifier = {
				factor = 10
				has_stability < 0.4
			}
		}
		cost = 50
		fire_only_once = yes
		days_remove = 14
		complete_effect = {
			set_country_flag = AFG_construct_mio_in_progress
		}
		remove_effect = {
			set_country_flag = afg_artillery_factory_mio
			add_days_mission_timeout = {
				mission = AFG_radical_students_countdown
				days = 180
			}
			if = {
				limit = { has_dlc = "Arms Against Tyranny" }
				custom_effect_tooltip = AFG_shipyards_tt_2
				show_mio_tooltip = AFG_artillery_organization
				mio:AFG_artillery_organization = {
					add_mio_size = 1
				}
			}
			else = {
				add_tech_bonus = {
					name = AFG_setup_artillery_mio
					bonus = 0.75
					uses = 1
					category = artillery
				}
			}
			clr_country_flag = AFG_construct_mio_in_progress
		}
	}
}

AFG_cross_border_ties_category = {
	AFG_cross_border_target_state = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			has_completed_focus = AFG_cross_border_ties
		}

		available = {
			FROM = {
				any_neighbor_state = {
					is_fully_controlled_by = ROOT
				}
			}
		}

		state_target = yes

		targets = { 442 987 988 445 444 }

	    target_trigger = {
	        FROM = {
	        	NOT = {
	        		is_controlled_by = ROOT
	        	}
	        	is_claimed_by = ROOT
	        }
	    }
	    on_map_mode = map_and_decisions_view 
		custom_cost_trigger = {
			command_power > 24.9
		}
		custom_cost_text = BRA_decision_cost_cangaceiro
		
		fire_only_once = yes
		days_remove = 30
		complete_effect = {
			hidden_effect = {
				add_command_power = -25
			}
		}
		remove_effect = {
			FROM = {
				hidden_effect = {
					set_state_flag = AFG_promoted_resistance_here
				}
				add_dynamic_modifier = {
					modifier = AFG_border_resistance_modifier
				}
				add_resistance = 10
				OWNER = {
					country_event = {
						id = AFG_industrial_events.51
						hours = 1
					}
				}
				hidden_effect = {
					ROOT = {
						country_event = {
							id = AFG_industrial_events.50
							hours = 1
						}
					}
				}
			}
		}
		cancel_trigger = {
			FROM = {
				OR = {
					is_fully_controlled_by = ROOT
					NOT = {
						is_claimed_by = ROOT
					}
				}
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_promoted_resistance_here
			}
		}
	}
	AFG_suggest_integrate_state = {
		icon = GFX_decision_eng_trade_unions_demand
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			has_completed_focus = AFG_cross_border_ties
		}

		available = {
			FROM = {
				any_neighbor_state = {
					is_fully_controlled_by = ROOT
				}
				owner = {
					NOT = {
						has_war_with = ROOT
					}
				}
			}
		}

		state_target = yes

		targets = { 442 987 988 445 444 }

	    target_trigger = {
	        FROM = {
	        	NOT = {
	        		is_owned_by = ROOT
	        	}
	        	# is_claimed_by = ROOT
	        	#has_resistance = yes
	        	has_state_flag = AFG_promoted_resistance_here
	        	#has_dynamic_modifier = {
	        	#	modifier = AFG_border_resistance_modifier
	        	#}
	        	#has_dynamic_modifier = { modifier = AFG_border_resistance_modifier }
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = yes
		days_remove = 30
		#cancel_trigger = {
		#	NOT = { is_fully_controlled_by = ROOT }
		#}
		complete_effect = {
		}
		remove_effect = {
			FROM = {
				set_state_flag = afg_crisis_for_state
				OWNER = {
					country_event = {
						id = AFG_industrial_events.52
						hours = 1
					}
				}
			}
		}
		cancel_trigger = {
			FROM = {
				OR = {
					owner = {
						has_war_with = ROOT
					}
				}
				is_fully_controlled_by = ROOT
			}
		}
	}

	AFG_propose_peace_for_state = {
		icon = GFX_decision_hol_exchange_intelligence_data
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				is_controlled_by = ROOT
			}
		}
		
		visible = {
			has_completed_focus = AFG_cross_border_ties
		}
		state_target = yes
		targets = { 442 987 988 445 444 }
	    target_trigger = {
	        FROM = {
	        	has_state_flag = afg_crisis_for_state
	        	OWNER = {
	        		has_war_with = ROOT
	        		has_defensive_war = yes
	        	}
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {
		}
		remove_effect = {
			FROM = {
				OWNER = {
					country_event = {
						id = AFG_industrial_events.58
						hours = 1
					}
				}
			}
		}
		cancel_trigger = {
			NOT = {
				FROM = {
					is_fully_controlled_by = ROOT
				}
			}
		}
	}

	AFG_propose_peace_for_tajikistan = {
		icon = GFX_decision_hol_exchange_intelligence_data
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				is_controlled_by = ROOT
			}
		}
		
		visible = {
			has_completed_focus = AFG_protector_of_the_tajiks
			742 = {
				OWNER = {
					has_war_with = AFG
				}
			}
		}
		state_target = yes
		targets = { 742 }
	    target_trigger = {
			always = yes
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {
			FROM = {
				set_state_flag = afg_crisis_for_state
			}
		}
		remove_effect = {
			FROM = {
				OWNER = {
					country_event = {
						id = AFG_industrial_events.58
						hours = 1
					}
				}
			}
		}
	}
}

AFG_quami_category = {
	AFG_expand_quami = {
		icon = GFX_decision_generic_reorganize_irregulars
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			#AFG_levy_cap_max < 24
			check_variable = { AFG_levy_cap < AFG_levy_cap_max }
			custom_trigger_tooltip = {
				tooltip = AFG_expand_quami_tt
				check_variable = { AFG_levy_cap < AFG_levy_cap_max }
			}
			has_war = no
			NOT = {
				has_country_flag = AFG_raise_quami_active
			}
		}
		
		visible = {
		}
	
	    custom_cost_trigger = {
	    	command_power > 14.9
	    }
	    custom_cost_text = AFG_decision_cost_quami
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {
			add_command_power = -15
		}
		remove_effect = {
			# add to variable
			# Preps succesful event
			#country_event = {
			#	id = AFG_industrial_events.58
			#	hours = 1
			#}

			custom_effect_tooltip = AFG_expand_quami_tt_2

			hidden_effect = {
				add_to_variable = { AFG_levy_cap = 1 }
				clamp_variable = {
					var = AFG_levy_cap
					min = AFG_levy_cap_min
					max = AFG_levy_cap_max
				}
				set_division_template_cap = { 
					division_template = "Pashtun Levy" 
					division_cap = AFG_levy_cap   
				}
			}
		}
		ai_will_do = {
			base = 9999
		}
	}

	AFG_raise_quami = {
		icon = GFX_decision_generic_prepare_civil_war
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			OR = {
				has_war = yes
				any_other_country = {
					AFG = { 
						OR = {
							is_justifying_wargoal_against = PREV
							has_wargoal_against = PREV
						}
					}
				}
			}
			NOT = { has_country_flag = AFG_raise_quami_active }
			if = {
				limit = {
					has_civil_war = yes
				}
				is_dynamic_country = no
			}
		}
		
		visible = {
		}
	
		cost = 25
		
		fire_only_once = no
		days_remove = 14
		remove_effect = {
			# Raising succesful event
			#country_event = {
			#	id = AFG_industrial_events.58
			#	hours = 1
			#}
			set_country_flag = AFG_raise_quami_active
			custom_effect_tooltip = AFG_raise_quami_tt
			add_stability = -0.1
			set_variable = { deployed_divs = 0 }
			while_loop_effect = {
				limit = {
					check_variable = { deployed_divs < AFG_levy_cap }
				}
				add_to_variable = { deployed_divs = 1 }
				capital_scope = {
					create_unit = {
						division = "division_template =\"Pashtun Levy\" start_experience_factor = 0.4 start_equipment_factor = 1.0"
						owner = AFG
						count = 1			
						prioritize_location = 10737
					}
				}
			}
		}
		ai_will_do = {
			base = 9999
		}
	}

	AFG_relieve_quami = {
		icon = GFX_decision_SWI_dismiss_council
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			has_country_flag = AFG_raise_quami_active
		}
		
		visible = {
		}
	
		cost = 0
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {
		}
		remove_effect = {
			custom_effect_tooltip = AFG_relieve_quami_tt
			add_stability = 0.1
			clr_country_flag = AFG_raise_quami_active
			set_variable = { deployed_divs = 0 }
			delete_units = {
				division_template = "Pashtun Levy"
				disband = no
			}
			# divs disbanded event
			#country_event = {
			#	id = AFG_industrial_events.58
			#	hours = 1
			#}
		}
	}
}

AFG_foreign_intervention_category = {
	AFG_demand_end_to_communist_influence = {
		icon = GFX_decision_SOV_secure_the_administration
	
		allowed = {
			OR = { 
				original_tag = ENG
				original_tag = GER
				original_tag = SOV
			}
		}
	
		available = {
			AFG = {
				NOT = {
					has_government = ROOT
				}
				communism > 0.4
			}
		}
		
		visible = {
			OR = { 
				has_government = democratic
				has_government = fascism
			}
			any_other_country = {
				has_country_flag = AFG_requested_our_aid
			}
		}
	   # on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {

		}
		remove_effect = {
			AFG = {
				country_event = {
					id = AFG_political_events.40
					days = 1
				}
			}
		}
	}

	AFG_demand_end_to_fascist_influence = {
		icon = GFX_decision_ger_reichskommissariats
	
		allowed = {
			OR = { 
				original_tag = ENG
				original_tag = GER
				original_tag = SOV
			}
		}
	
		available = {
			AFG = {
				NOT = {
					has_government = ROOT
				}
				fascism > 0.4
			}
		}
		
		visible = {
			OR = { 
				has_government = democratic
				has_government = communism
			}
			any_other_country = {
				has_country_flag = AFG_requested_our_aid
			}
		}
	   # on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {

		}
		remove_effect = {
			AFG = {
				country_event = {
					id = AFG_political_events.40
					days = 1
				}
			}
		}
	}

	AFG_demand_end_to_democratic_influence = {
		icon = GFX_decision_generic_form_nation
	
		allowed = {
			OR = { 
				original_tag = ENG
				original_tag = GER
				original_tag = SOV
			}
		}
	
		available = {
			AFG = {
				democratic > 0.4
			}
		}
		
		visible = {
			AFG = {
				NOT = {
					has_government = ROOT
				}
			}
			OR = { 
				has_government = communism
				has_government = fascism
			}
			any_other_country = {
				has_country_flag = AFG_requested_our_aid
			}
		}
	   # on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 7
		complete_effect = {

		}
		remove_effect = {
			AFG = {
				country_event = {
					id = AFG_political_events.40
					days = 1
				}
			}
		}
	}
}

AFG_develop_central_asia_category = {

	AFG_core_central_asian_state = {
		icon = GFX_decision_hol_exchange_intelligence_data
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				is_owned_and_controlled_by = ROOT
			}
			IF = {
				limit = {
					FROM = {
						is_core_of = UZB
					}
				}
				has_completed_focus = AFG_development_in_uzb
			}
			ELSE_IF = {
				limit = {
					FROM = {
						is_core_of = TAJ
					}
				}
				has_completed_focus = AFG_development_in_taj
			}
			ELSE_IF = {
				limit = {
					FROM = {
						is_core_of = TMS
					}
				}
				has_completed_focus = AFG_development_in_tms
			}
			ROOT = { 
				NOT = { 
					has_country_flag = AFG_core_central_asian_state_in_progress
				}
			}
		}
		
		visible = {
			hidden_trigger = { #Otherwise this will show up in the cancel trigger tooltip
				has_completed_focus = AFG_central_asian_unification
			}
			FROM = { 
				NOT = { is_core_of = ROOT }
				is_fully_controlled_by = ROOT
			}
		}
		state_target = any_owned_state
	    target_trigger = {
	        FROM = {
	        	OR = {
	        		is_core_of = UZB
	        		is_core_of = TAJ
	        		is_core_of = TMS
	        	}
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 30

		cancel_if_not_visible = yes

		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_core_central_asian_state_in_progress
			}
		}
		remove_effect = {
			FROM = {
				add_core_of = ROOT
			}
			hidden_effect = {
				clr_country_flag = AFG_core_central_asian_state_in_progress
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_core_central_asian_state_in_progress
			}
		}
	}

}

AFG_shadows_of_the_emir_category = {
	AFG_crackdown_on_dissent = {
		icon = GFX_decision_generic_protection
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				is_owned_and_controlled_by = ROOT
			}
			NOT = {
				has_country_flag = AFG_shadow_operation_in_progress
			}
		}
		
		visible = {
			hidden_trigger = { #Otherwise this will show up in the cancel trigger tooltip
				has_completed_focus = AFG_reinforce_the_royal_guard
			}
			FROM = {
				is_fully_controlled_by = ROOT
			}
		}
		state_target = any_owned_state
	    target_trigger = {
	        FROM = {
	        	is_core_of = ROOT
	        	NOT = { has_state_flag = AFG_the_shadows_have_passed }
	        	is_capital = no
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    custom_cost_trigger = {
	    	command_power > 24.9
	    }
	    custom_cost_text = BRA_decision_cost_cangaceiro		
		fire_only_once = no
		days_remove = 30
		cancel_if_not_visible = yes
		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_shadow_operation_in_progress
			}
			add_command_power = -25
		}
		remove_effect = {
			add_stability = 0.05
			hidden_effect = {
				clr_country_flag = AFG_shadow_operation_in_progress
				FROM = { set_state_flag = AFG_the_shadows_have_passed }
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_shadow_operation_in_progress
			}
		}
	}	
}

AFG_turko_persian_heritage_category = {
	AFG_invite_to_turko_persian_faction = {
		icon = GFX_decision_generic_protection
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				OWNER = {
					is_in_faction = no
					is_subject = no
					NOT = { has_war_with = ROOT }			
				
					NOT = {
						has_country_flag = AFG_invite_to_faction_in_progress
					}
				}
			}
		}
		
		visible = {
			has_completed_focus = AFG_exploit_turko_persian_heritage
			has_government = fascism
			FROM = { OWNER = { exists = yes } } 
		}
	    target_trigger = {
	        FROM = {
	        	OR = {
	        		state = 49
	        		state = 266
	        	}
	        	OWNER = {
	        		OR = {
	        			original_tag = TUR
	        			original_tag = PER
	        		}
	        	}
	        }
	    }
	    state_target = yes
	    
	    on_map_mode = map_and_decisions_view 
		cost = 50	
		fire_only_once = yes
		target_non_existing = yes
		days_remove = 30
		complete_effect = {
			hidden_effect = {
				set_country_flag = { flag = AFG_invite_to_faction_in_progress value = 1 days = 30 }
			}
		}
		remove_effect = {
			#clr_country_flag = AFG_invite_to_faction_in_progress
			FROM = { 
				OWNER = {
					country_event = {
						id = AFG_political_events.60
						hours = 1
					}
				}
			}
		}

		cancel_trigger = {
			FROM = {
				OWNER = {
					OR = {
						has_war_with = ROOT
						exists = no
					}
				}
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_invite_to_faction_in_progress
			}
		}
	}	
}

AFG_turkik_alliance_category = {
	AFG_support_resistance_in_state = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			NOT = { has_country_flag = AFG_supporting_resistance_in_state_in_progress }
		}
		
		visible = {
			OR = {
				has_completed_focus = AFG_alliance_with_turkik_peoples
				has_completed_focus = AFG_appraoch_anti_communist_theologians
				has_completed_focus = AFG_the_amu_darya_plan
			}
			NOT = { has_war_with = FROM.OWNER }
			FROM = { is_owned_and_controlled_by = SOU }
			FROM = {
				NOT = {
					has_dynamic_modifier = { modifier = AFG_resistance_active_here }
				}
			}
		}

		state_target = asia

	    target_trigger = {
	        FROM = {
	        	OR = {
	        		is_core_of = UZB
	        		is_core_of = TAJ
	        		is_core_of = TMS
	        		is_core_of = KYR
	        	}
	        }
	    }
	    on_map_mode = map_and_decisions_view 

	    cost = 30
		
		fire_only_once = no

		days_remove = 15

		complete_effect = {
			hidden_effect = {
				set_country_flag = { flag = AFG_supporting_resistance_in_state_in_progress value = 1 days = 15 }
			}
		}

		remove_effect = {
			FROM = {
				add_dynamic_modifier = {
					modifier = AFG_resistance_active_here
				}
			}
			hidden_effect = {
				clr_country_flag = AFG_supporting_resistance_in_state_in_progress
				IF = {
					limit = {
						FROM = {
							OWNER = {
								NOT = {
									has_country_flag = AFG_warning_event_fired
								}
							}
						}
					}
					FROM = {
						OWNER = {
							country_event = {
								id = AFG_political_events.90
								hours = 1
							}
						}
					}
				}
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = {
					is_owned_and_controlled_by = SOU
				}
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_supporting_resistance_in_state_in_progress
				clr_country_flag = SOV_afg_clamp_down_in_state_in_progress
			}
		}

	}

	AFG_support_resistance_in_state_middle_east = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				is_owned_and_controlled_by = SOV
				NOT = {
					has_dynamic_modifier = { modifier = AFG_resistance_active_here }
				}
			}
			NOT = { has_country_flag = AFG_supporting_resistance_in_state_in_progress }
		}
		
		visible = {
			OR = {
				has_completed_focus = AFG_alliance_with_turkik_peoples
				has_completed_focus = AFG_appraoch_anti_communist_theologians
				has_completed_focus = AFG_the_amu_darya_plan
			}
			FROM = { NOT = { has_dynamic_modifier = { modifier = AFG_resistance_active_here } } }
			NOT = { has_war_with = FROM.OWNER }
		}
		state_target = middle_east
	    target_trigger = {
	        FROM = {
	        	OR = {
	        		is_core_of = UZB
	        		is_core_of = TAJ
	        		is_core_of = TMS
	        		is_core_of = KYR
	        	}
	        	is_owned_and_controlled_by = SOU
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 30
		
		fire_only_once = no
		days_remove = 15
		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_supporting_resistance_in_state_in_progress
			}
		}
		remove_effect = {
			FROM = {
				add_dynamic_modifier = {
					modifier = AFG_resistance_active_here
				}
			}
			hidden_effect = {
				clr_country_flag = AFG_supporting_resistance_in_state_in_progress
				IF = {
					limit = {
						FROM = {
							OWNER = {
								NOT = {
									has_country_flag = AFG_warning_event_fired
								}
							}
						}
					}
					FROM = {
						OWNER = {
							country_event = {
								id = AFG_political_events.90
								hours = 1
							}
						}
					}
				}
			}
		}

		cancel_trigger = {
			NOT = {
				FROM = {
					is_fully_controlled_by = ROOT
				}
			} 
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = SOV_afg_clamp_down_in_state_in_progress
			}
		}
	}

	SOV_afg_crush_resistance_in_state = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = SOV
			has_dlc = "Graveyard of Empires"
		}
	
		available = {
			FROM = {
				is_owned_and_controlled_by = ROOT
				has_dynamic_modifier = { modifier = AFG_resistance_active_here }
			}
			NOT = { has_country_flag = SOV_afg_clamp_down_in_state_in_progress }
		}
		
		visible = {
			FROM = { has_dynamic_modifier = { modifier = AFG_resistance_active_here } } 
		}
		state_target = any_owned_state
	    target_trigger = {
	        FROM = {
	        	is_owned_and_controlled_by = ROOT
				has_dynamic_modifier = { modifier = AFG_resistance_active_here }
	        }
	    }
	    on_map_mode = map_and_decisions_view 
	    cost = 50
		
		fire_only_once = no
		days_remove = 30
		complete_effect = {
			hidden_effect = {
				set_country_flag = SOV_afg_clamp_down_in_state_in_progress
			}
		}
		remove_effect = {
			FROM = {
				remove_dynamic_modifier = {
					modifier = AFG_resistance_active_here
				}
			}
			hidden_effect = {
				clr_country_flag = SOV_afg_clamp_down_in_state_in_progress
			}
		}

		cancel_trigger = {
			NOT = {
				FROM = {
					is_fully_controlled_by = ROOT
				}
			} 
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = SOV_afg_clamp_down_in_state_in_progress
			}
		}
	}
}

AFG_kabul_conference_category = {
	AFG_claim_state = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				OWNER = { has_war_with = ROOT }
				NOT = {
					has_dynamic_modifier = { modifier = AFG_arranged_expansion_modifier }
				}
				
				is_controlled_by_ROOT_or_ally = yes
			}
			NOT = { has_country_flag = AFG_expansion_claim_in_progress }
		}
		
		visible = {
			has_completed_focus = AFG_kabul_conference
			FROM = { NOT = { has_dynamic_modifier = { modifier = AFG_arranged_expansion_modifier } } }
			
		}
		state_target = asia
	    target_trigger = {
	        FROM = {
	  			OWNER = { 
	  				has_war_with = ROOT 
	  			}
	  			OR = {
	  				region = 190
	  				region = 251
	  				region = 296
	  				region = 254
	  				region = 153
	  				region = 146
	  				region = 231
	  				region = 31
	  				region = 230
	  				region = 290
	  				region = 141
	  				region = 145
	  				region = 252
	  				region = 268
	  				region = 269
	  				region = 267
	  				region = 270
	  				region = 136
	  				region = 291
	  				region = 297
	  				region = 298
	  			}
	        }
	    }
	    on_map_mode = map_only
	    cost = 30
		
		fire_only_once = no
		days_remove = 30
		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_expansion_claim_in_progress
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = AFG_expansion_claim_in_progress
			}
			FROM = {
				add_dynamic_modifier = {
					modifier = AFG_arranged_expansion_modifier
				}
			}
		}

		cancel_trigger = {
			FROM = {
				is_not_controlled_by_ROOT_or_ally = yes
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_expansion_claim_in_progress
				
			}
		}
	}
	AFG_claim_state_middle_east = {
		icon = GFX_decision_revolt
	
		allowed = {
			original_tag = AFG
		}
	
		available = {
			FROM = {
				OWNER = { has_war_with = ROOT }
				NOT = {
					has_dynamic_modifier = { modifier = AFG_arranged_expansion_modifier }
				}
				
				is_controlled_by_ROOT_or_ally = yes
			}
			NOT = { has_country_flag = AFG_expansion_claim_in_progress }
		}
		
		visible = {
			has_completed_focus = AFG_kabul_conference
			FROM = { NOT = { has_dynamic_modifier = { modifier = AFG_arranged_expansion_modifier } } }
			
		}
		state_target = middle_east
	    target_trigger = {
	        FROM = {
	  			OWNER = { 
	  				has_war_with = ROOT 
	  			}
	  			OR = {	
	  				region = 291
	  				region = 241
	  				region = 116
	  				region = 240
	  				region = 239
	  				region = 28
	  				region = 196
	  				region = 237
	  				region = 236
	  				region = 238
	  				region = 297
	  				region = 298
	  			}
	        }
	    }
	    on_map_mode = map_only
	    cost = 30
		
		fire_only_once = no
		days_remove = 30
		complete_effect = {
			hidden_effect = {
				set_country_flag = AFG_expansion_claim_in_progress
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = AFG_expansion_claim_in_progress
			}
			FROM = {
				add_dynamic_modifier = {
					modifier = AFG_arranged_expansion_modifier
				}
			}
		}

		cancel_trigger = {
			FROM = {
				is_not_controlled_by_ROOT_or_ally = yes
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_expansion_claim_in_progress
			}
		}
	}
}

AFG_turkestan_legion_cat = {
	AFG_recruit_turkestan_legion = {
		icon = GFX_decision_generic_prepare_civil_war
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			hidden_trigger = { #Otherwise this will show up in the cancel trigger tooltip
				has_completed_focus = AFG_form_the_turkestan_legion
				OR = {
					has_government = fascism
					has_government = neutrality
				}
			}
			NOT = { 
				FROM = { has_state_flag = AFG_recruited_turkestan_legion_here }
				has_war_with = FROM.owner
			}

		}
		available = {
			FROM = {
				NOT = {
					has_state_flag = AFG_recruited_turkestan_legion_here
				}
			}
			NOT = { has_country_flag = AFG_recruiting_turkestan_legion }
			
			has_equipment = {
				infantry_equipment > 1999
			}	
		}

		target_root_trigger = {
			original_tag = AFG
		}
		state_target = yes
		targets = { 49 229 651 586 732 830 742 405 823 831 584 619 249 137 676 329 1000 }
	    target_trigger = {   
	    }
	    on_map_mode = map_and_decisions_view 
		
	    custom_cost_trigger = {
	    	command_power > 24.9
	    	has_equipment = { infantry_equipment > 1999 }
	    }
		
		custom_cost_text = decision_cost_cp_25_ie_2000
		
		fire_only_once = yes
		days_remove = 30
		cancel_if_not_visible = yes
		complete_effect = {
			add_command_power = -25
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -2000
			}
			hidden_effect = {
				set_country_flag = AFG_recruiting_turkestan_legion
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = AFG_recruiting_turkestan_legion
				FROM = {
					set_state_flag = AFG_recruited_turkestan_legion_here
				}
			}
			capital_scope = {
				AFG_create_turkestan_free_legion_div = yes
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = AFG_recruiting_turkestan_legion
			}
		}
	}
}

political_actions = {

	AFG_a_royal_successor_decision = {

		icon = GFX_decision_generic_monarchy

		allowed = {
			original_tag = AFG
		}

		priority = 100

		fire_only_once = yes

		cost = 150 

		visible = {
			has_completed_focus = AFG_secure_dynasty
			has_government = neutrality
		}

		available = {
			
			has_country_leader = {
				ruling_only = yes
				character = AFG_mohammad_hashim_khan
			}	

			OR = {
				has_war = yes
				has_completed_focus = AFG_expel_axis_nationals
				has_completed_focus = AFG_expel_allied_nationals
			}

		}

		complete_effect = {

			add_stability = 0.15

			custom_effect_tooltip = generic_skip_one_line_tt

			country_event = {
				id = AFG_royal_succession_events.01
			}	

		}

		ai_will_do = {
			base = 100 
			modifier = {
				factor = 0
				date < 1942.1.1 # Historically he was swapped out in 1946 but there should at least be no chance of it happening before 42 
			}
			modifier = {
				factor = 0.5
				date < 1946.1.1 # Historically he was swapped out in 1946 but there will be a smaller chance of it happening between 1942 and then 
			}
		}

	}
	
	AFG_caliphate_core_state = {
		icon = GFX_decision_infiltrate_state
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			has_completed_focus = AFG_proclaim_a_new_caliphate
		}
		available = {
			NOT = { has_country_flag = IRQ_coring_state_in_progress }
		}

		state_target = any_controlled_state
	    
	    target_trigger = {
	        FROM = {
	        	NOT = { is_core_of = ROOT }
	        	is_fully_controlled_by = ROOT
	        	OR = {
	        		is_claimed_by = ROOT
	        		has_state_flag = AFG_caliphate_can_integrate_flag
	        	}
	        }
	    }
	    on_map_mode = map_only
	    cost = 50		
		fire_only_once = yes
		days_remove = 7
		complete_effect = {
			hidden_effect = {
				set_country_flag = { flag = IRQ_coring_state_in_progress value = 1 days = 31 }
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
			FROM = {
				add_core_of = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_fully_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
		}
	}

	AFG_empire_core_state = {
		icon = GFX_decision_infiltrate_state
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			has_completed_focus = AFG_proclaim_the_second_afghan_empire
		}
		available = {
			NOT = { has_country_flag = IRQ_coring_state_in_progress }
		}

		state_target = any_controlled_state
	    
	    target_trigger = {
	        FROM = {
	        	NOT = { is_core_of = ROOT }
	        	is_fully_controlled_by = ROOT
	        	OR = {
	        		is_claimed_by = ROOT
	        		has_state_flag = AFG_empire_can_core_this_state_flag
	        	}
	        }
	    }
	    on_map_mode = map_only
	    cost = 35		
		fire_only_once = yes
		days_remove = 7
		complete_effect = {
			hidden_effect = {
				set_country_flag = { flag = IRQ_coring_state_in_progress value = 1 days = 31 }
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
			FROM = {
				add_core_of = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_fully_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
		}
	}

	AFG_mughal_core_state = {
		icon = GFX_decision_infiltrate_state
	
		allowed = {
			original_tag = AFG
		}
		
		visible = {
			has_completed_focus = AFG_return_to_delhi
		}
		available = {
			NOT = { has_country_flag = IRQ_coring_state_in_progress }
		}

		state_target = any_controlled_state
	    
	    target_trigger = {
	        FROM = {
	        	NOT = { is_core_of = ROOT }
	        	is_fully_controlled_by = ROOT
	        	OR = {
	        		is_claimed_by = ROOT
	        		has_state_flag = AFG_mughals_can_integrate_flag
	        	}
	        }
	    }
	    on_map_mode = map_only
	    cost = 35		
		fire_only_once = yes
		days_remove = 7
		complete_effect = {
			hidden_effect = {
				set_country_flag = { flag = IRQ_coring_state_in_progress value = 1 days = 31 }
			}
		}
		remove_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
			FROM = {
				add_core_of = ROOT
			}
		}

		cancel_trigger = {
			FROM = {
				NOT = { is_fully_controlled_by = ROOT }
			}
		}

		cancel_effect = {
			hidden_effect = {
				clr_country_flag = IRQ_coring_state_in_progress
			}
		}
	}

	AFG_move_the_capital_to_delhi_decision = {
		allowed = {
			original_tag = AFG
			has_dlc = "Graveyard of Empires"
		}
		available = {
			has_full_control_of_state = 439
			capital_scope = {
				NOT = {
					state = 439
				}
			}
		}
		visible = {

			has_completed_focus = AFG_return_to_delhi
			
			capital_scope = {
				NOT = {
					state = 439
				}
			}
			
		}
		cost = 50
		ai_will_do = {
			factor = 1
		}
		complete_effect = {
			set_capital = {
				state = 439
				remember_old_capital = no
			}
			IF = {
				limit = {
					439 = {
						NOT = {
							is_core_of = ROOT
						}
					}
				}
				439 = {
					add_core_of = ROOT
				}
			}
		}
	}

}

AFG_sikh_recruitment_cat = {
	
	AFG_sikh_recruitment = {

		icon = GFX_decision_generic_prepare_civil_war
		
		state_target = yes
		
		visible = {
			has_completed_focus = AFG_ally_the_sikhs
		}
		
		available = {
			FROM = { 
				controller = {
					OR = {
						original_tag = ROOT
						is_subject_of = ROOT
					}
				}
			}
			has_tech = gw_artillery
		}
		
		target_root_trigger = {
			original_tag = AFG
			has_completed_focus = AFG_ally_the_sikhs
		}
		target_trigger = {			
			OR = {
				FROM = { state = 440 }
				FROM = { state = 433 }
				FROM = { state = 1008 } # Can train one in Afghanistan in exile
			}
		}

		highlight_states = {
			highlight_state_targets = {
				state = 440
				state = 433
				state = 1008
			}
		}
		
		cost = 30
		
		fire_only_once = yes

		days_remove = 35

		ai_will_do = {
			base = 1
		}

		remove_effect = {
			IF = {
				limit = {
					NOT = { has_template = "Sikh Division" }
				}
				division_template = {
					name = "Sikh Division"
					is_locked = yes
					division_names_group = RAJ_SIKH_01 # optional
					priority = 2 # optional 
					
					regiments = {
						mountaineers = { x = 0 y = 0 }
						mountaineers = { x = 0 y = 1 }
						mountaineers = { x = 0 y = 2 }
						mountaineers = { x = 0 y = 3 }
						mountaineers = { x = 1 y = 0 }
						mountaineers = { x = 1 y = 1 }
						mountaineers = { x = 1 y = 2 }
						mountaineers = { x = 1 y = 3 }
					}
					support = {
						artillery = { x = 0 y = 0 }
						engineer = { x = 0 y = 1 }
					}
				}
			}
			FROM = {
				custom_effect_tooltip = AFG_sikh_recruitment_tt
				create_unit = {
					division = "name = \"Sikh Division\" division_template = \"Sikh Division\" start_experience_factor = 0.5 start_equipment_factor = 1 start_manpower_factor = 1"
					owner = ROOT
					allow_spawning_on_enemy_provs = no 
					count = 2
				}
			}
		}
	}
}

