bah_indigenization = {
	slot = 1
	generic = no
	ai = yes
	
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	brahman_administrators = {
		icon = mission_brahmin_administrators
		required_missions = {  } #None
		trigger = {
			if = {
				limit = {
					has_estate = estate_brahmins
				}
				estate_influence = {
					estate = estate_brahmins
					influence = 50
				}
				estate_loyalty = {
					estate = estate_brahmins
					loyalty = 60
				}
				num_of_estate_privileges = {
					estate = estate_brahmins
					value = 1
				}
			}
			if = {
				limit = {
					has_estate = estate_church
				}
				estate_loyalty = {
					estate = estate_church
					loyalty = 60
				}
			}
		}
		effect = {
			define_advisor = {
				type = treasurer
				religion = hinduism
				discount = yes
				skill = 2
			}
			add_country_modifier = {
				name = "brahmin_administrators_modifier"
				duration = 7300
			}
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
	empower_deccani_nobles = {
		icon = mission_deccanis
		position = 3
		required_missions = { brahman_administrators }
		provinces_to_highlight = {
			OR = {
				province_id = 544
				province_id = 569
			}
		}
		trigger = {
			estate_influence = {
				estate = estate_maratha
				influence = 15
			}
			544 = {
				owned_by = ROOT
				has_building = workshop
			}
			569 = {
				owned_by = ROOT
				has_building = workshop
			}
		}
		effect = {
			create_general = {
				tradition = 75
			}
			544 = { add_base_manpower = 1 }
			569 = { add_base_manpower = 1 }
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
	marathi_fiefs = {
		icon = mission_marathi_fiefs
		required_missions = { empower_deccani_nobles }
		position = 4
		trigger = {
			estate_loyalty = {
				estate = estate_maratha
				loyalty = 60
			}
			estate_influence = {
				estate = estate_maratha
				influence = 50
			}
		}
		effect = {
			add_country_modifier = {
				name = "marathi_fiefs_modifier"
				duration = 7300
			}
			define_advisor = {
				type = commandant
				discount = yes
				culture = marathi
				religion = hinduism
				skill = 3
			}
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
	metropolis_of_the_deccan = {
		icon = mission_metropolis_of_the_deccan
		required_missions = {
			marathi_fiefs
			mahmud_gawans_madrassah
		}
		provinces_to_highlight = {
			is_capital = yes
			owned_by = ROOT
		}
		trigger = {
			capital_scope = {
				development = 20 #7 more than at start
				province_has_center_of_trade_of_level = 3
				if = {
					limit = {
						OR = {
							trade_goods = silk
							trade_goods = wool
							trade_goods = cotton
							trade_goods = cloth
						}
					}
					has_building = textile
				}
				else = { has_building = cathedral }
			}
		}
		effect = {
			add_adm_power = 100
			capital_scope = {
				add_province_modifier = {
					name = "metropolis_of_the_deccan_modifier"
					duration = 10950
				}
			}
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
}

bah_gharbians = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	recover_konkan_coast = {
		icon = mission_recover_konkan_ports
		required_missions = {  }
		provinces_to_highlight = {
			OR = {
				province_id = 530
				province_id = 2089
				province_id = 4429
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			owns = 530
			owns = 2089
			owns = 4429
		}
		effect = {
			add_country_modifier = {
				name = "bah_access_to_the_sea"
				duration = 7300
			}
		}
		ai_weight = {
			factor = 500	#Reconquest
		}
	}

	gharbians_mission = {
		icon = mission_gharbianss
		position = 3
		required_missions = { recover_konkan_coast }
		provinces_to_highlight = {
			province_id = 2089
		}
		trigger = {
			2089 = {
				owned_by = ROOT
				has_building = marketplace
				province_has_center_of_trade_of_level = 2
			}
		}
		effect = {
			set_country_flag = mahmud_gawan_flag
			hidden_effect = {
				country_event = { id = flavor_bah.3 }
			}
			add_estate_loyalty_modifier = {
				estate = estate_nobles
				desc = EST_VAL_GHARBIAN_PORT
				loyalty = 10
				duration = 10950
			}
			tooltip = {
				add_adm_power = 25
				add_dip_power = 25
				add_meritocracy_effect = yes
				add_reform_progress_small_effect = yes
				define_advisor = {
					type = trader
					name = "00000000000"
					culture = persian
					religion = shiite
					skill = 3
					discount = yes
				}
			}
		}
		ai_weight = {
			factor = 500	#Reconquest
		}
	}
	mahmud_gawans_madrassah = {
		icon = mission_gawans_madrasar
		required_missions = { gharbians_mission }
		position = 4
		provinces_to_highlight = {
			is_capital = yes
			owned_by = ROOT
		}
		trigger = {
			capital_scope = {
				development = 17 #4 more than at start
				has_building = temple
			}
		}
		effect = {
			capital_scope = {
				add_province_modifier = {
					name = "mahmud_gawans_madrassah_modifier"
					duration = -1
				}
			}
			add_estate_loyalty = {
				estate = estate_church
				loyalty = 15
			}
			define_advisor = {
				type = theologian
				culture = persian
				religion = shiite
				skill = 4
				discount = yes
			}
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
	persianate_empire = {
		icon = mission_persianate_empire
		required_missions = {
			mahmud_gawans_madrassah
			persian_gulf
		}
		position = 7
		provinces_to_highlight = {
			OR = {
				province_id = 409
				province_id = 410
				province_id = 429
				province_id = 432
				province_id = 446
				province_id = 2218
				province_id = 2221
			}
			NOT = {
				AND = {
					owned_by = ROOT
					NOT = { devastation = 1 }
				}
			}
		}
		trigger = {
			if = {
				limit = { has_dlc = "Common Sense" }
				government_rank = 3
			}
			else = {
				total_development = 1000
			}
			estate_influence = {
				estate = estate_church
				influence = 50
			}
			num_of_estate_privileges = {
				estate = estate_church
				value = 2
				
			}
			409 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			410 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			429 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			432 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			446 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			2218 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}
			2221 = {
				owned_by = ROOT
				NOT = { devastation = 1 }
			}

		}
		effect = {
			add_prestige = 20
			capital_scope = {
				add_base_tax = 2
				add_base_production = 2
				add_base_manpower = 2
			}
			add_estate_loyalty_modifier = {
				estate = estate_church
				desc = EST_VAL_PERSIANATE_EMPIRE
				loyalty = 10
				duration = 10950
			}
			add_country_modifier = {
				name = "bah_persianate_empire"
				duration = -1
			}
		}
		ai_weight = {
			factor = 0	#Way too far fetched
		}
	}
}

bah_persian_branch = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	secure_khandesh = {
		icon = mission_secure_khandesh
		required_missions = {  }
		provinces_to_highlight = {
			area = khandesh_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			khandesh_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			ahmedabad_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			patan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			tapti_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			saurashtra_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			malwa_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			gird_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Plausible
		}
	}

	conquer_gujarat = {
		icon = mission_conquer_gujarat_bah
		position = 4
		required_missions = { secure_khandesh }
		provinces_to_highlight = {
			OR = {
				area = ahmedabad_area
				area = patan_area
				area = tapti_area
				area = saurashtra_area
				province_id = 529
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			ahmedabad_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			patan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			tapti_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			saurashtra_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			529 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "bah_conquest_of_gujarat"
				duration = 10950
			}
			400 = { add_permanent_claim = ROOT }
			431 = { add_permanent_claim = ROOT }
			504 = { add_permanent_claim = ROOT }
			2999 = { add_permanent_claim = ROOT }
		}
		ai_weight = {
			factor = 100	#Nice to have
		}
	}
	arabian_sea_trade_ports = {
		icon = mission_arabian_sea_trade
		required_missions = { conquer_gujarat }
		provinces_to_highlight = {
			OR = {
				province_id = 400
				province_id = 431
				province_id = 504
				province_id = 2999
			}
			NOT = { owned_by = ROOT }
		}
		trigger = {
			owns = 400
			owns = 431
			owns = 504
			owns = 2999
		}
		effect = {
			add_country_modifier = {
				name = "direct_link_with_iran"
				duration = 10950
			}
			basra_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			khuzestan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			persian_gulf_coast = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 25	#Leaving India now, which is... well, in that case it is okay
		}
	}
	persian_gulf = {
		icon = mission_dominate_persian_gulf
		required_missions = { arabian_sea_trade_ports }
		provinces_to_highlight = {
			OR = {
				area = basra_area
				area = khuzestan_area
				area = persian_gulf_coast
			}
		}
		trigger = {
			basra_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			khuzestan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			persian_gulf_coast = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			408 = {
				add_trade_modifier = {
					who = root
					duration = 7300
					power = 20
					key = persian_gulf_domination
				}
			}
			409 = {
				add_permanent_claim = ROOT
			}
			410 = {
				add_permanent_claim = ROOT
			}
			429 = {
				add_permanent_claim = ROOT
			}
			432 = {
				add_permanent_claim = ROOT
			}
			446 = {
				add_permanent_claim = ROOT
			}
			2218 = {
				add_permanent_claim = ROOT
			}
			2221 = {
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 0	#But this one goes a little bit too far for the AI
		}
	}
}

bah_vijayanagari_branch = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	city_of_victory = {
		icon = mission_city_of_victory_bah
		required_missions = {  }
		provinces_to_highlight = {
			province_id = 541
		}
		trigger = {
			owns = 541
		}
		effect = {
			if = {
				limit = {
					NOT = { capital = 541 }
				}
				country_event = { id = bah_mission_events.1 }
				541 = {
					add_loot_from_rich_province_general_effect = {
						LOOTER = ROOT
					}
				}
				tooltip = {
					541 = {
						add_base_tax = -2
						add_base_production = -2
						add_base_manpower = -2
					}
					capital_scope = {
						add_base_tax = 2
						add_base_production = 2
						add_base_manpower = 2
					}
				}
			}
			add_country_modifier = {
				name = "spoils_of_vijayanagar"
				duration = 7300
			}
			rayalaseema_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Historical Rival basically
		}
	}


	southern_frontier = {
		icon = mission_southern_frontier_dharma
		required_missions = { city_of_victory }
		provinces_to_highlight = {
			area = rayalaseema_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			rayalaseema_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			mysore_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			kongu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			malabar_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			kanara_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Historical Rival conquest
		}
	}

	bijapur_karnatak = {
		icon = mission_bijapur_karnatak
		position = 4
		required_missions = { southern_frontier }
		provinces_to_highlight = {
			OR = {
				area = mysore_area
				area = kongu_area
				area = malabar_area
				area = kanara_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			if = {
				limit = {
					NOT = { owns = 569 }
				}
				owns = 569 #Bijapur
			}
			mysore_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			kongu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			malabar_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			kanara_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			569 = {
				add_base_tax = 2
				add_base_production = 2
				add_base_manpower = 2
			}
			add_country_modifier = {
				name = "bijapur_karnatak_modifier"
				duration = 7300
			}
		}
		ai_weight = {
			factor = 500	#Historical Rival conquest
		}
	}
}

bah_delhi_branch = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	conquer_malwa = {
		icon = mission_conquer_malwa_bah
		position = 5
		required_missions = { conquer_gujarat }
		provinces_to_highlight = {
			OR = {
				area = malwa_area
				area = gird_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			malwa_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			gird_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "bah_conquest_of_malwa"
				duration = 7300
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}

	crush_delhi = {
		icon = mission_crush_delhi
		position = 7
		required_missions = { conquer_malwa }
		provinces_to_highlight = {
			province_id = 522
		}
		trigger = {
			522 = {
				OR = {
					country_or_non_sovereign_subject_holds = ROOT
					AND = {
						controlled_by = ROOT
						owner = { NOT = { army_size = ROOT } }
					}
				}
			}
		}
		effect = {
			country_event = { id = bah_mission_events.3 }
			tooltip = { add_prestige = 20 }
			522 = {
				add_loot_from_rich_province_general_effect = {
					LOOTER = ROOT
				}
				add_base_tax = -3
				add_base_production = -3
				add_base_manpower = -3
			}
			capital_scope = {
				add_base_tax = 3
				add_base_production = 3
				add_base_manpower = 3
				add_province_modifier = {
					name = "monuments_of_delhi"
					duration = -1
				}
			}
		}
		ai_weight = {
			factor = 50	#Little too ambitious
		}
	}
}


bah_coromandel_branch = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Dharma"
	}
	potential = {
		OR = {
			tag = BAH
			tag = DEC
		}
		has_dlc = "Dharma"
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	rein_in_the_velamas = {
		icon = mission_rein_in_the_velamas
		required_missions = {  }
		provinces_to_highlight = {
			area = golconda_area
			OR = {
				NOT = { owned_by = ROOT }
				local_autonomy = 30
			}
		}
		trigger = {
			golconda_area = {
				type = all
				owned_by = ROOT
				NOT = { local_autonomy = 30 }
			}
		}
		effect = {
			andhra_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Integrate vassal
		}
	}

	conquer_andhra = {
		icon = mission_conquer_andhra_bah
		required_missions = { rein_in_the_velamas }
		provinces_to_highlight = {
			area = andhra_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			andhra_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			542 = {
				add_base_tax = 2
				add_base_production = 2
				add_province_modifier = {
					name = "growing_importance_of_golconda"
					duration = 7300
				}
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
	growth_of_golconda = {
		icon = mission_growth_of_golcond
		required_missions = { conquer_andhra }
		provinces_to_highlight = {
			province_id = 542
			NOT = { province_has_center_of_trade_of_level = 3 }
		}
		trigger = {
			542 = {
				province_has_center_of_trade_of_level = 3
				owned_by = ROOT
			}
			if = {
				limit = {
					NOT = {
						andhra_area = {
							type = all
							country_or_non_sovereign_subject_holds = ROOT
						}
					}
				}
				andhra_area = {
					type = all
					country_or_non_sovereign_subject_holds = ROOT
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "coromandel_exports"
				duration = 10950
			}
			542 = {
				rename_capital = "Hyderabad"
				change_province_name = "Hyderabad"
			}
			north_carnatic_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			south_carnatic_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			tanjore_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			madura_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
		ai_weight = {
			factor = 500	#Tall
		}
	}
	golconda_karnatak = {
		icon = mission_coromandel_expansion
		required_missions = { growth_of_golconda }
		provinces_to_highlight = {
			OR = {
				area = north_carnatic_area
				area = south_carnatic_area
				area = tanjore_area
				area = madura_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		trigger = {
			north_carnatic_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			south_carnatic_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			tanjore_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			madura_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_estate_loyalty_modifier = {
				estate = estate_jains
				desc = EST_VAL_COROMANDEL_EXPANSION
				loyalty = 10
				duration = 10950
			}
			add_country_modifier = {
				name = "coromandel_trade"
				duration = 7300
			}
		}
		ai_weight = {
			factor = 500	#Historical Rival conquest
		}
	}
	coromandel_entrepot = {
		icon = mission_entrepot_of_india
		required_missions = {
			golconda_karnatak
			bijapur_karnatak
		}
		provinces_to_highlight = {
			province_id = 1340
		}
		trigger = {
			1340 = {
				is_strongest_trade_power = ROOT
			}
			calc_true_if = {
				all_owned_province = {
					province_has_center_of_trade_of_level = 3
				}
				amount = 3
			}
		}
		effect = {
			add_country_modifier = {
				name = "master_of_southern_india"
				duration = -1
			}
			lanka_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_claim = ROOT }
				}
				add_claim = ROOT
			}
			south_lanka_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_claim = ROOT }
				}
				add_claim = ROOT
			}
			indian_ocean_islands_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_claim = ROOT }
				}
				add_claim = ROOT
			}
		}
		ai_weight = {
			factor = 75	#Default
		}
	}
}
