arm_first_branch = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = MLK
			tag = ARM
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
	}
	has_country_shield = yes
	
	arm_avenge_seljuk_conquest = {
		icon = mission_crush_eyalet_rebellion
		required_missions = { arm_breaking_the_chains }
		position = 2
		
		provinces_to_highlight = {
			area = tabriz_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			tabriz_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		
		effect = {
			persia_region = {
				discover_country = ROOT
			}
			custom_tooltip = arm_lose_ae_tt
			add_country_modifier = {
				name = "arm_dethrone_turkomans"
				duration = 5475
			}
			shahrizor_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			iraq_arabi_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			luristan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			azerbaijan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				every_neighbor_country = {
					add_aggressive_expansion = {
						who = ROOT
						value = -15
						apply_calc = no
					}
				}
				4172 = {
					discover_country = ROOT
				}
				4170 = {
					discover_country = ROOT
				}
			}
		}
	}
	
	arm_church_of_the_east = {
		icon = mission_cradle_of_civilization
		required_missions = { arm_avenge_seljuk_conquest }
		position = 4
		
		provinces_to_highlight = {
			area = iraq_arabi_area
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = { religion = ROOT }
			}
		}
		
		trigger = {
			iraq_arabi_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			iraq_arabi_area = {
				type = all
				religion = ROOT
			}
		}
		
		effect = {
			if = {
				limit = {
					religion = coptic
				}
				country_event = { id = flavor_arm.2 }
				custom_tooltip = arm_church_east_insight_tt
			}
			else = {
				add_country_modifier = {
					name = "arm_church_east"
					duration = 10950
				}
			}
		}
	}
	
	arm_national_awakening = {
		icon = mission_handle_the_streltsy
		required_missions = { }
		position = 5
		
		provinces_to_highlight = {
			culture = ROOT
		}
		
		trigger = {
			development_in_provinces = {
				value = 80
				culture = ROOT
			}
		}
		
		effect = {
			change_government_reform_progress = 50
			add_country_modifier = {
				name = "arm_national_awakening"
				duration = 7300
			}
			if = {
				limit = {
					capital_scope = {
						development = 20
					}
				}
				custom_tooltip = arm_capital_cot_tt_yes
			}
			else = {
				custom_tooltip = arm_capital_cot_tt_no
			}
			hidden_effect = {
				if = {
					limit = {
						capital_scope = {
							development = 20
						}
					}
					if = {
						limit = {
							capital_scope = {
								NOT = {
									OR = {
										province_has_center_of_trade_of_level = 1
										province_has_center_of_trade_of_level = 2
										province_has_center_of_trade_of_level = 3
									}
								}
							}
						}
						capital_scope = {
							center_of_trade = 1
						}
					}
					else_if = {
						limit = {
							capital_scope = {
								OR = {
									province_has_center_of_trade_of_level = 1
									province_has_center_of_trade_of_level = 2
								}
							}
						}
						capital_scope = {
							add_center_of_trade_level = 1
						}
					}
					else = {
						capital_scope = {
							add_base_production = 3
						}
					}
				}
			}
		}
	}
	
	arm_wool_industry = {
		icon = mission_serfdom
		required_missions = { arm_national_awakening }
		position = 6
		
		provinces_to_highlight = {
			trade_goods = wool
			OR = {
				NOT = { has_production_building_trigger = yes }
				NOT = {	base_production = 3 }
			}
			owned_by = ROOT
		}
		
		trigger = {
			calc_true_if = {
				all_owned_province = {
					trade_goods = wool
					base_production = 3
					has_production_building_trigger = yes
				}
				amount = 8
			}
		}
		
		effect = {
			custom_tooltip = arm_wool_dev_tt
			tooltip = {
				add_province_modifier = {
					name = "arm_booming_wool_industry"
					duration = 7300
				}
			}
			define_advisor = {
				type = natural_scientist
				skill = 3
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.25
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						trade_goods = wool
						base_production = 3
						has_production_building_trigger = yes
					}
					add_base_production = 1
					add_province_modifier = {
						name = "arm_booming_wool_industry"
						duration = 7300
					}
				}
			}
		}
	}
	
	arm_resettle_ancestral_homeland = {
		icon = mission_expel_the_moriscos
		required_missions = { arm_wool_industry arm_rebuild_tigranakert }
		position = 7
		
		provinces_to_highlight = {
			owned_by = ROOT
			NOT = {
				culture = ROOT
			}
		}
		
		trigger = {
			calc_true_if = {
				all_owned_province = {
					culture = ROOT
				}
				amount = 15
			}
		}
		
		effect = {
			custom_tooltip = arm_converting_culture_tt
			add_country_modifier = {
				name = "arm_resettle_ancestral"
				duration = -1
			}
			set_country_flag = arm_coversion_bonus
		}
	}
	
}

arm_second_branch = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = MLK
			tag = ARM
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
	}
	has_country_shield = yes
	
	arm_artaxiad_legacy = {
		icon = arm_artaxiad_legacy
		required_missions = { arm_avenge_seljuk_conquest }
		position = 3
		
		provinces_to_highlight = {
			region = persia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = persia_region
				value = 10
			}
		}
		
		effect = {
			add_prestige_or_monarch_power = { amount = 25 } 
			add_country_modifier = {
				name = "arm_artaxiad_legacy"
				duration = 7300
			}
			persia_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	
	arm_rebuild_tigranakert = {
		icon = mission_renovate_kannauj
		required_missions = { }
		position = 6
		
		provinces_to_highlight = {
			province_id = 418
		}
		
		trigger = {
			owns = 418
			418 = {
				religion = ROOT
			}
			418 = {
				culture = ROOT
			}
			418 = {
				development = 15
			}
			418 = {
				has_tax_building_trigger = yes
			}
			418 = {
				has_trade_building_trigger = yes
			}
			418 = {
				has_production_building_trigger = yes
			}
		}
		
		effect = {
			set_country_flag = arm_capital_tigranakert
			418 = {
				change_province_name = "Tigranakert"
				rename_capital = "Tigranakert"
			}
			418 = {
				change_trade_goods = cloth
			}
			418 = {
				add_province_modifier = {
					name = "arm_great_city_tigranes"
					duration = -1
				}
			}
			custom_tooltip = arm_tigranakert_capital_tt
		}
	}
	
}

arm_third_branch = {
	slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = MLK
			tag = ARM
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
	}
	has_country_shield = yes
	
	arm_breaking_the_chains = {
		icon = mission_the_hakkapeliitta
		required_missions = { }
		position = 1
		
		trigger = {
			OR = {
				is_free_or_tributary_trigger = yes
				AND = {
					is_subject = yes
					NOT = {
						is_subject_of = QAR
					}
					overlord = {
						reverse_has_opinion = {
							who = ROOT
							value = 190
						}
					}
				}
			}
		}
		
		effect = {
			armenia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			shirvan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			tabriz_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					is_free_or_tributary_trigger = yes
				}
				custom_tooltip = arm_breaking_chains_indep_tt_yes
				tooltip = {
					add_stability_or_adm_power = yes
					add_adm_power = 100
					add_dip_power = 100
					add_mil_power = 100
					add_country_modifier = {
						name = "arm_resurgence"
						duration = 7300
					}
				}
			}
			else = {
				custom_tooltip = arm_breaking_chains_indep_tt_no
				tooltip = {
					add_stability_or_adm_power = yes
					add_adm_power = 100
					add_dip_power = 100
					add_mil_power = 100
					add_country_modifier = {
						name = "arm_resurgence"
						duration = 7300
					}
				}
			}
			if = {
				limit = {
					is_subject = yes
					NOT = {
						is_subject_of = QAR
					}
					overlord = {
						has_opinion = {
							who = ROOT
							value = 190
						}
					}
				}
				custom_tooltip = arm_breaking_chains_vassal_tt_yes
				tooltip = {
					add_liberty_desire = -50
				}
			}
			else = {
				custom_tooltip = arm_breaking_chains_vassal_tt_no
				tooltip = {
					add_liberty_desire = -50
				}
			}
			hidden_effect = {
				if = {
					limit = {
						is_free_or_tributary_trigger = yes
					}
					add_stability_or_adm_power = yes
					add_adm_power = 100
					add_dip_power = 100
					add_mil_power = 100
					add_country_modifier = {
						name = "arm_resurgence"
						duration = 7300
					}
				}
				else_if = {
					limit = {
						is_subject = yes
						NOT = {
							is_subject_of = QAR
						}
						overlord = {
							has_opinion = {
								who = ROOT
								value = 190
							}
						}
					}
					add_liberty_desire = -50
				}
			}
		}
	}
	
	arm_caspian_riches = {
		icon = mission_arabian_sea_trade
		required_missions = { arm_breaking_the_chains }
		position = 2
		
		provinces_to_highlight = {
			area = shirvan_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			shirvan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		
		effect = {
			421 = {
				center_of_trade = 1
			}
			add_country_modifier = {
				name = "arm_caspian_riches"
				duration = 5475
			}
			if = {
				limit = {
					4341 = { 
						trade_share = {
							country = ROOT
							share = 15
						}
					}
				}
				custom_tooltip = arm_caspian_riches_tt_yes
			}
			else = {
				custom_tooltip = arm_caspian_riches_tt_no
			}
			hidden_effect = {
				if = {
					limit = {
						4341 = { 
							trade_share = {
								country = ROOT
								share = 15
							}
						}
					}
					remove_country_modifier = arm_caspian_riches
					add_country_modifier = {
						name = "arm_caspian_riches"
						duration = 10950
					}
				}
			}
		}
	}
	
	arm_ecclesiastical_revival = {
		icon = mission_most_holy_synod
		required_missions = { }
		position = 3
		
		provinces_to_highlight = {
			country_or_non_sovereign_subject_holds = ROOT
			NOT = {
				religion = ROOT
			}
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				religion = ROOT
				value = 12
			}
			if = {
				limit = {
					has_estate = estate_church
				}
				estate_loyalty = {
					estate = estate_church
					loyalty = 60
				}
				num_of_estate_agendas_completed = {
					estate = estate_church
					value = 3
				}
			}
		}
		
		effect = {
			custom_tooltip = arm_true_faith_tax_tt
			add_country_modifier = {
				name = "arm_ecclesiastical_revival"
				duration = 7300
			}
			hidden_effect = {
				for = {
					amount = 5
					effect = "
						random_owned_province = {
							limit = {
								religion = ROOT
							}
							add_base_tax = 1
						}
					"
				}
			}
		}
	}
	
	arm_etchmiadzin_cathedral = {
		icon = arm_etchmiadzin_cathedral
		required_missions = { arm_ecclesiastical_revival }
		position = 4
		
		provinces_to_highlight = {
			if = {
				limit = { 
					has_dlc = "Leviathan"
				}
				OR = {
					province_id = 419
					AND = {
						NOT = {
							has_tax_building_trigger = yes
						}
						owned_by = ROOT
					}
				}
			}
			else = {
				owned_by = ROOT
				NOT = {
					has_tax_building_trigger = yes
				}
			}
		}
		
		trigger = {
			if = {
				limit = { 
					has_dlc = "Leviathan"
				}
				owns = 419
				419 = {
					has_great_project = {
						type = etchimiadzin_cathedral
						tier = 1
					}
				}
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					has_tax_building_trigger = yes
					value = 5
				}
			}
			else = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					has_tax_building_trigger = yes
					value = 10
				}
			}
		}
		
		effect = {
			custom_tooltip = arm_upgrade_church_tt
			add_country_modifier = {
				name = arm_cathedral
				duration = 3650
			}
			define_advisor = {
				type = inquisitor
				skill = 3
				culture = ROOT
				religion = ROOT
				cost_multiplier = 0.25
			}
			hidden_effect = {
				for = {
					amount = 5
					effect = "
						random_owned_province = {
							limit = {
								has_building = temple
							}
							remove_building = temple
							add_building = cathedral
						}
					"
				}
			}
		}
	}
	
	arm_holy_sites = {
		icon = arm_holy_sites
		required_missions = { arm_etchmiadzin_cathedral }
		position = 5
		
		provinces_to_highlight = {
			if = {
				limit = {
					ROOT = {
						religion = coptic
					}
				}
				OR = {
					province_id = 358
					province_id = 1227
					province_id = 2313
					province_id = 1234
					province_id = 419
				}
				NOT = {
					owner = {
						religion = coptic
					}
				}
			}
			else = {
				owned_by = ROOT
				has_tax_building_trigger = yes
				NOT = {
					base_tax = 10
				}
			}
		}
		
		trigger = {
			if = {
				limit = {
					religion = coptic
				}
				calc_true_if = {
					desc = arm_own_coptic_holy_site_tt
					all_province = {
						OR = {
							province_id = 358
							province_id = 1227
							province_id = 2313
							province_id = 1234
							province_id = 419
						}
						owner = {
							religion = coptic
						}
					}
					amount = 3
				}
			}
			else = {
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					has_tax_building_trigger = yes
					base_tax = 10
					value = 10
				}
			}
		}
		
		effect = {
			if = {
				limit = {
					religion = coptic
				}
				custom_tooltip = arm_all_coptic_tt
				if = {
					limit = {
						owns = 358
						owns = 1227
						owns = 2313
						owns = 1234
						owns = 419
					}
					custom_tooltip = arm_own_holy_sites_tt_yes
				}
				else = {
					custom_tooltip = arm_own_holy_sites_tt_no
				}
			}
			else = {
				add_country_modifier = {
					name = arm_sword_of_true_faith
					duration = 9125
				}
			}
			hidden_effect = {
				if = {
					limit = {
						religion = coptic
					}
					every_country = {
						limit = {
							religion = coptic
						}
						add_country_modifier = {
							name = arm_holy_sites_protector
							duration = 9125
						}
					}
					if = {
						limit = {
							owns = 358
							owns = 1227
							owns = 2313
							owns = 1234
							owns = 419
						}
						remove_country_modifier = arm_holy_sites_protector
						add_country_modifier = {
							name = arm_holy_sites_protector
							duration = -1
						}
					}
				}
			}
		}
	}
	
	arm_refine_the_nakharar = {
		icon = mission_early_russian_army
		required_missions = { }
		position = 6
		
		trigger = {
			if = {
				limit = {
					has_estate = estate_nobles
				}
				OR = {
					estate_loyalty = {
						estate = estate_nobles
						loyalty = 60
					}
					num_of_estate_privileges = {
						estate = estate_nobles
						value = 4
					}
				}
				num_of_estate_agendas_completed = {
					estate = estate_nobles
					value = 3
				}
			}
			else = {
				OR = {
					MIL = 5
					monthly_mil = 10
				}
			}
		}
		
		effect = {
			custom_tooltip = arm_gain_mil_per_privileges
			set_country_flag = arm_unlocked_nakharar
			unlock_government_reform = {
				government_reform = nakharar_title
			}
			hidden_effect = {
				if = {
					limit = {
						num_of_estate_privileges = {
							estate = estate_nobles
							value = 4
						}
					}
					add_mil_power = 100
				}
				else_if = {
					limit = {
						num_of_estate_privileges = {
							estate = estate_nobles
							value = 3
						}
					}
					add_mil_power = 75
				}
				else_if = {
					limit = {
						num_of_estate_privileges = {
							estate = estate_nobles
							value = 2
						}
					}
					add_mil_power = 50
				}
				else_if = {
					limit = {
						num_of_estate_privileges = {
							estate = estate_nobles
							value = 1
						}
					}
					add_mil_power = 25
				}
			}
		}
	}
	
	arm_office_of_sparapet = {
		icon = shift_the_balance
		required_missions = { arm_refine_the_nakharar }
		position = 7
		
		trigger = {
			OR = {
				army_tradition = 60
				army_professionalism = 60
			}
			monthly_mil = 10
			has_mil_advisor_3 = yes
		}
		
		effect = {
			set_country_flag = arm_unlocked_sparapet
			unlock_government_reform = {
				government_reform = sparapet_office
			}
		}
	}
	
}

arm_fourth_branch = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = MLK
			tag = ARM
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
	}
	has_country_shield = yes
	
	arm_bagrationi_union = {
		icon = mission_the_caucasus_rus
		required_missions = { arm_liberation_of_the_homeland }
		position = 3
		
		provinces_to_highlight = {
			OR = {
				area = kartli_kakheti_area
				area = samtskhe_area
				area = imereti_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = kartli_kakheti_area
					area = samtskhe_area
					area = imereti_area
				}
				value = 6
			}
		}
		
		effect = {
			if = {
				limit = {
					NOT = {
						accepted_culture = georgian
					}
				}
				add_accepted_culture = georgian
			}
			else = {
				add_dip_power = 100
			}
			custom_tooltip = arm_georgian_autonomy_tt
			add_country_modifier = {
				name = arm_georgian_union
				duration = -1
				desc = arm_geo_accepted_tt
			}
			caucasia_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						culture = georgian
					}
					add_local_autonomy = -50
				}
			}
		}
	}
	
	arm_secure_caucasia = {
		icon = mission_castle_construction
		required_missions = { arm_bagrationi_union }
		position = 4
		
		provinces_to_highlight = {
			region = caucasia_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			caucasia_region = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		
		effect = {
			custom_tooltip = arm_caucasian_dev_tt
			caucasia_region = {
				add_province_modifier = {
					name = "arm_caucasian_union"
					duration = 7300
				}
			}
			astrakhan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			azov_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			crimea_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				for = {
					amount = 10
					effect = "
						random_owned_province = {
							limit = {
								culture_group = caucasian
							}
							add_base_manpower = 1
						}
					"
				}
			}
		}
	}
	
	arm_break_osmans_legacy = {
		icon = mission_ottoman_diplomacy
		required_missions = { arm_proclaim_great_armenia }
		position = 5
		
		provinces_to_highlight = {
			OR = {
				area = dulkadir_area
				area = rum_area
				area = kastamonu_area
				area = karaman_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = dulkadir_area
					area = rum_area
					area = kastamonu_area
					area = karaman_area
				}
				value = 12
			}
		}
		
		effect = {
			custom_tooltip = arm_turkish_provinces_tt
			add_country_modifier = {
				name = "arm_new_anatolian_hegemon"
				duration = 7300
			}
			anatolia_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				every_owned_province = {
					limit = {
						culture = turkish
					}
					add_local_autonomy = -100
					add_nationalism = -20
				}
			}
			if = {
				limit = {
					OR = {
						TUR = {
							is_enemy = ROOT
						}
						TUR = {
							is_rival = ROOT
						}
					}
				}
				custom_tooltip = arm_ottoman_rival_tt_yes
				tooltip = {
					add_power_projection = {
						type = mission_rewards_power_projection
						amount = 25
					}
				}
			}
			else = {
				custom_tooltip = arm_ottoman_rival_tt_no
				tooltip = {
					add_power_projection = {
						type = mission_rewards_power_projection
						amount = 25
					}
				}
			}
			hidden_effect = {
				if = {
					limit = {
						OR = {
							TUR = {
								is_enemy = ROOT
							}
							TUR = {
								is_rival = ROOT
							}
						}
					}
					add_power_projection = {
						type = mission_rewards_power_projection
						amount = 25
					}
				}
			}
		}
	}
	
	arm_restore_armenian_cilicia = {
		icon = arm_restore_armenian_cilicia
		required_missions = { arm_break_osmans_legacy }
		position = 5
		
		provinces_to_highlight = {
			OR = {
				province_id = 327
				province_id = 332
				province_id = 4298
			}
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = { religion = ROOT }
				nationalism = 1
			}
		}
		
		trigger = {
			327 = {
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
				NOT = {
					nationalism = 1
				}
			}
			332 = {
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
				NOT = {
					nationalism = 1
				}
			}
			4298 = {
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
				NOT = {
					nationalism = 1
				}
			}
		}
		
		effect = {
			custom_tooltip = arm_cilicia_tt
			hidden_effect = {
				327 = {
					change_culture = ROOT
					if = {
						limit = {
							owner = {
								has_country_flag = arm_coversion_bonus
							}
							NOT = {
								has_province_flag = arm_converted_bonus
							}
						}
						add_base_tax = 1
						add_base_manpower = 1
						add_base_production = 1
						set_province_flag = arm_converted_bonus
					}
				}
				332 = {
					change_culture = ROOT
					if = {
						limit = {
							owner = {
								has_country_flag = arm_coversion_bonus
							}
							NOT = {
								has_province_flag = arm_converted_bonus
							}
						}
						add_base_tax = 1
						add_base_manpower = 1
						add_base_production = 1
						set_province_flag = arm_converted_bonus
					}
				}
				4298 = {
					change_culture = ROOT
					if = {
						limit = {
							owner = {
								has_country_flag = arm_coversion_bonus
							}
							NOT = {
								has_province_flag = arm_converted_bonus
							}
						}
						add_base_tax = 1
						add_base_manpower = 1
						add_base_production = 1
						set_province_flag = arm_converted_bonus
					}
				}
			}
			add_country_modifier = {
				name = "arm_reunite_diaspora"
				duration = -1
			}
		}
	}
	
}

arm_fifth_branch = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "King of Kings"
	}
	potential = {
		OR = {
			tag = MLK
			tag = ARM
		}
		NOT = { map_setup = map_setup_random }
		has_dlc = "King of Kings"
	}
	has_country_shield = yes
	
	arm_liberation_of_the_homeland = {
		icon = mission_unite_home_region
		required_missions = { arm_breaking_the_chains }
		position = 2
		
		provinces_to_highlight = {
			area = armenia_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			armenia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		
		effect = {
			change_ruler_stat = {
				type = mil
				amount = 2
			}
			add_ruler_modifier = {
				name = "arm_liberator"
				duration = -1
			}
			custom_tooltip = arm_cores_armenian_provinces_tt
			kartli_kakheti_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			samtskhe_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			imereti_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				every_province = {
					limit = {
						culture = armenian
						NOT = {
							OR = {
								is_core = ROOT
								country_or_non_sovereign_subject_holds = ROOT
							}
						}
					}
					add_core = ROOT
				}
			}
		}
	}
	
	arm_proclaim_great_armenia = {
		icon = arm_proclaim_great_armenia
		required_missions = { arm_liberation_of_the_homeland arm_bagrationi_union }
		position = 4
		
		provinces_to_highlight = {
			culture = armenian
			NOT = {
				owned_by = ROOT
			}
		}
		
		trigger = {
			tag = ARM
			owns_all_provinces = {
				culture = armenian
			}
		}
		
		effect = {
			country_event = { id = flavor_arm.1 }
			custom_tooltip = arm_great_armenia_insight
			tooltip = {
				add_country_modifier = {
					name = "arm_resurgent_armenia"
					duration = 7300
				}
			}
			dulkadir_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			erzurum_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			rum_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			kastamonu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			karaman_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			aleppo_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			syria_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			syrian_desert_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			al_jazira_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			north_kurdistan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					OR = {
						has_dlc = "Emperor"
						has_dlc = "Rights of Man"
					}
				}
				if = {
					limit = {
						is_great_power = yes
					}
					custom_tooltip = arm_great_power_tt_yes
					tooltip = {
						add_splendor = 200
					}
				}
				else = {
					custom_tooltip = arm_great_power_tt_no
					tooltip = {
						add_splendor = 200
					}
				}
				hidden_effect = {
					if = {
						limit = {
							is_great_power = yes
						}
						add_splendor = 200
					}
				}
			}
		}
	}
	
	arm_mamluks = {
		icon = mission_break_the_mamluks
		required_missions = { arm_proclaim_great_armenia }
		position = 5
		
		provinces_to_highlight = {
			OR = {
				area = syria_area
				area = aleppo_area
				area = syrian_desert_area
				area = al_jazira_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				OR = {
					area = aleppo_area
					area = syrian_desert_area
					area = syria_area
					area = al_jazira_area
				}
				value = 12
			}
		}
		
		effect = {
			if = {
				limit = {
					NOT = {
						army_tradition = 50
					}
				}
				create_general = { tradition = 50 }
			}
			else_if = {
				limit = {
					NOT = {
						army_tradition = 75
					}
				}
				create_general = { tradition = 75 }
			}
			else = {
				create_general = { tradition = 100 }
			}
			add_country_modifier = {
				name = "arm_renew_crusades"
				duration = 7300
			}
			palestine_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			trans_jordan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	
	arm_jerusalem = {
		icon = jerusalem
		required_missions = { arm_mamluks }
		position = 6
		
		provinces_to_highlight = {
			area = palestine_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}
		
		trigger = {
			palestine_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		
		effect = {
			if = {
				limit = { 
					has_dlc = "Leviathan"
				}
				379 = {
					add_great_project_tier = {
						type = holy_city_jerusalem
						tier = 1
					}
				}
			}
			else = {
				custom_tooltip = arm_empower_jerusalem_tt
				set_country_flag = arm_empower_jerusalem
			}
			egypt_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			if = {
				limit = {
					religion = coptic
					NOT = {
						any_country = {
							religion = coptic
							is_defender_of_faith = yes
						}
					}
				}
				custom_tooltip = arm_dotf_tt_yes
			}
			else = {
				custom_tooltip = arm_dotf_tt_no
			}
			hidden_effect = {
				if = {
					limit = {
						religion = coptic
						NOT = {
							any_country = {
								religion = coptic
								is_defender_of_faith = yes
							}
						}
					}
					set_defender_of_the_faith = { who = ROOT religion = ROOT }
				}
			}
		}
	}
	
	arm_egypt = {
		icon = prester_john
		required_missions = { arm_jerusalem }
		position = 6
		
		provinces_to_highlight = {
			region = egypt_region
			OR = {
				NOT = {
					country_or_non_sovereign_subject_holds = ROOT
				}
				NOT = {
					religion = ROOT
				}
				nationalism = 1
				local_autonomy = 10
			}
		}
		
		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = egypt_region
				religion = ROOT
				value = 12
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = egypt_region
				NOT = {
					nationalism = 1
				}
				value = 12
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				region = egypt_region
				NOT = {
					local_autonomy = 10
				}
				value = 12
			}
		}
		
		effect = {
			if = {
				limit = {
					religion = coptic
					has_dlc = "Origins"
				}
				country_event = { id = flavor_arm.4 }
				custom_tooltip = arm_coptic_restoration_insight_tt
				tooltip = {
					egypt_region = {
						add_province_modifier = {
							name = arm_coptic_restoration
							duration = -1
						}
					}
				}
			}
			else = {
				add_adm_power = 100
				add_dip_power = 100
				add_mil_power = 100
				egypt_region = {
					add_province_modifier = {
						name = arm_coptic_restoration
						duration = -1
					}
				}
			}
		}
	}
	
}