decisions = {

	vushmgir_brothers_legacy = {
		is_high_prio = yes

		ai = no

		potential = {
			has_character_flag = is_vushmgir
			independent = yes
			year < 950

			NOR = {
				religion = zoroastrian

				any_owned_bloodline = {
					has_bloodline_flag = bloodline_mardavij
				}
			}
		}

		allow = {
			year < 950
			higher_real_tier_than = COUNT
			piety >= 300
			war = no
			is_incapable = no
		}

		effect = {
			piety = -300

			if = {
				limit = {
					NOT = { completely_controls = d_gilan }
				}

				add_claim = d_gilan

				hidden_effect = {
					add_claim = c_gilan
					add_claim = c_daylam
					add_claim = c_qazwin
				}
			}

			if = {
				limit = {
					NOT = { completely_controls = d_jibal }
				}

				add_claim = d_jibal

				hidden_effect = {
					add_claim = c_qom
					add_claim = c_hamadan
					add_claim = c_rayy
					add_claim = c_zanjan-abhar
					add_claim = c_luristan
					add_claim = c_esfahan
				}
			}

			if = {
				limit = {
					NOT = { completely_controls = d_fars }
				}

				add_claim = d_fars

				hidden_effect = {
					add_claim = c_dashtestan
					add_claim = c_arrajan
					add_claim = c_darabjerd
					add_claim = c_istakhr
					add_claim = c_shiraz
				}
			}

			if = {
				limit = {
					NOT = { completely_controls = d_mafaza }
				}

				add_claim = d_mafaza

				hidden_effect = {
					add_claim = c_yazd
					add_claim = c_mafaza
				}
			}

			if = {
				limit = {
					NOT = { completely_controls = d_khozistan }
				}

				add_claim = d_khozistan

				hidden_effect = {
					add_claim = c_khozistan
					add_claim = c_ahvaz
					add_claim = c_sus
				}
			}

			tooltip = {
				religion = zoroastrian
			}

			religion_authority = {
				name = ruler_converted_from
			}

			hidden_effect = {
				religion = zoroastrian

				religion_authority = {
					name = ruler_converted_to
				}
			}

			any_bloodline = {
				limit = { has_bloodline_flag = bloodline_mardavij }

				add_bloodline_member = ROOT
			}

			any_child_even_if_dead = {
				show_scope_change = no

				if = {
					limit = {
						NOT = { religion = zoroastrian }
					}

					if = {
						limit = { higher_real_tier_than = BARON }

						tooltip = {
							religion = zoroastrian
						}

						religion_authority = {
							name = ruler_converted_from
						}

						hidden_effect = {
							# Workaround for automatic usurption of theocratic characters
							ROOT = {
								religion_scope = {
									save_event_target_as = target_religion
								}
							}

							convert_religion_failsafe_effect = yes

							religion_authority = {
								name = ruler_converted_to
							}
						}
					}
					else = {
						tooltip = {
							religion = zoroastrian
						}

						hidden_effect = {
							# Workaround for automatic usurption of theocratic characters
							ROOT = {
								religion_scope = {
									save_event_target_as = target_religion
								}
							}

							convert_religion_failsafe_effect = yes
						}
					}
				}

				hidden_effect = {
					if = {
						limit = {
							NOT = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_mardavij
								}
							}
						}

						any_bloodline = {
							limit = { has_bloodline_flag = bloodline_mardavij }
							add_bloodline_member = PREV
						}
					}
				}

				any_child_even_if_dead = {
					# Workaround for automatic usurption of theocratic characters
					ROOT = {
						religion_scope = {
							save_event_target_as = target_religion
						}
					}

					convert_religion_failsafe_effect = yes

					hidden_effect = {
						if = {
							limit = {
								NOT = {
									any_owned_bloodline = {
										has_bloodline_flag = bloodline_mardavij
									}
								}
							}

							any_bloodline = {
								limit = { has_bloodline_flag = bloodline_mardavij }
								add_bloodline_member = PREV
							}
						}
					}
				}
			}
		}
	}

	kievan_rus_local_traditions = {
		ai_check_interval = 60

		is_high_prio = yes

		only_independent = yes

		potential = {
			dynasty = 705 # Rurikid
			has_landed_title = k_ruthenia
			has_landed_title = c_kiev
			independent = yes

			OR = {
				religion = norse_pagan
				culture = norse
			}

			year < 1000
			start_date == 936.8.7
			is_alternate_start = no
		}

		allow = {
			war = no
			is_incapable = no
			year < 1000
			prestige >= 300

			capital_scope = {
				province_id = c_kiev
			}
		}

		effect = {
			prestige = -300

			if = {
				limit = { religion = norse_pagan }

				tooltip = {
					religion = slavic_pagan
				}

				hidden_effect = {
					# Workaround for automatic usurption of theocratic characters
					slavic_pagan = {
						save_event_target_as = target_religion
					}

					convert_religion_failsafe_effect = yes
				}
			}

			if = {
				limit = { culture = norse }
				culture = russian
			}

			any_close_relative = {
				show_scope_change = no

				if = {
					limit = { religion = norse_pagan }

					tooltip = {
						religion = slavic_pagan
					}

					hidden_effect = {
						# Workaround for automatic usurption of theocratic characters
						slavic_pagan = {
							save_event_target_as = target_religion
						}

						convert_religion_failsafe_effect = yes
					}
				}

				if = {
					limit = { culture = norse }
					culture = russian
				}
			}
		}
	}

	empire_of_bulgaria_decision = {
		ai_check_interval = 60

		is_high_prio = yes

		only_independent = yes

		potential = {
			has_landed_title = k_bulgaria
			lower_real_tier_than = EMPEROR

			e_bulgaria = {
				has_holder = no
			}

			OR = {
				culture = bulgarian
				culture = bolghar
			}

			NOT = {
				has_alternate_start_setting = {
					setting = dejure
					option = random
				}
			}
		}

		allow = {
			has_landed_title = k_bulgaria
			independent = yes
			war = no
			is_incapable = no

			custom_tooltip = {
				text = empire_bulgaria_TT

				any_demesne_title = {
					real_tier = KING
					NOT = { title = k_bulgaria }
				}
			}

			prestige >= 1000
			realm_size >= 100
		}

		effect = {
			prestige = 500

			hidden_effect = {
				primary_title = {
					e_bulgaria = {
						set_title_flag = non_manual_law_change # No prestige loss
						copy_title_laws = PREV
						copy_title_history = PREV
						clr_title_flag = non_manual_law_change # No prestige loss
					}
				}
			}

			grant_title = e_bulgaria

			any_demesne_title = {
				limit = { real_tier = KING }

				de_jure_liege = e_bulgaria
				destroy_landed_title = THIS
			}

			if = {
				limit = { has_nickname = no }
				give_nickname = nick_the_great
			}
		}
	}

	shiite_caliphate_cairo_decision = {
		ai_check_interval = 60

		is_high_prio = yes

		only_independent = yes

		potential = {
			has_landed_title = d_shiite
			has_landed_title = k_egypt
			independent = yes

			c_cairo = {
				holder_scope = {
					OR = {
						character = ROOT
						is_vassal_or_below_of = ROOT
					}
				}
			}

			b_cairo = { has_holder = no }

			c_cairo = {
				location = {
					num_of_max_settlements < 7
				}
			}

			is_alternate_start = no
			NOT = { has_global_flag = established_cairo }
		}

		allow = {
			prestige >= 500
			wealth >= 500
			has_landed_title = d_shiite
			has_landed_title = k_egypt

			c_cairo = {
				holder_scope = {
					OR = {
						character = ROOT
						is_vassal_or_below_of = ROOT
					}
				}
			}
		}

		effect = {
			set_global_flag = established_cairo
			wealth = -500

			if = {
				limit = {
					capital_scope = {
						NOT = { province = c_cairo }
					}
				}

				custom_tooltip = { text = cairo_decision_TT }
			}

			c_cairo = {
				show_scope_change = no

				if = {
					limit = { NOT = { holder = ROOT } }
					grant_title_no_opinion = ROOT
				}

				set_name = PROV796

				location = {
					if = {
						limit = { num_of_max_settlements < 6 }
						add_holding_slot = 2
					}
					else_if = {
						limit = { num_of_max_settlements < 7 }
						add_holding_slot = 1
					}

					build_holding = {
						title = b_cairo
						type = castle
						holder = ROOT
					}

					hidden_effect = {
						b_cairo = {
							province_capital = yes
							ROOT = { capital = PREV }
							# add_building = ca_wall_q_1
							# add_building = ca_wall_q_2
							add_building = ca_wall_1
							add_building = ca_wall_2
							add_building = ca_keep_1
							add_building = ca_keep_2
							add_building = ca_militia_1
							add_building = ca_militia_2
							add_building = ca_training_grounds_1
							add_building = ca_barracks_1
							add_building = ca_barracks_2
							add_building = ca_stable_1
							add_building = ca_town_market_1
							add_building = ca_town_market_2
						}
					}
				}
			}
		}
	}

	establishing_habsburg = {
		ai_check_interval = 60

		is_high_prio = yes

		only_playable = yes

		potential = {
			dynasty = 664 # Etichonen
			has_landed_title = c_saarbrucken
			culture_group = central_germanic

			c_saarbrucken = {
				location = {
					num_of_max_settlements < 7
				}
			}

			is_alternate_start = no
			NOT = { has_global_flag = established_habsburg }
		}

		allow = {
			wealth >= 500
		}

		effect = {
			wealth  = -500
			prestige = 500

			c_saarbrucken = {
				show_scope_change = no

				location = {
					show_scope_change = no

					build_holding = {
						title = b_habsburg
						type = castle
						holder = ROOT
					}
				}
			}

			custom_tooltip = {
				text = establishing_habsburg_family

				dynasty = 51 # von Habsburg

				any_child_even_if_dead = {
					dynasty = 51

					any_child_even_if_dead = {
						dynasty = 51

						any_child_even_if_dead = {
							dynasty = 51
						}
					}
				}

				b_habsburg = {
					# add_building = ca_wall_q_1
					# add_building = ca_wall_q_2
					add_building = ca_wall_1
					add_building = ca_wall_2
					add_building = ca_keep_1
					add_building = ca_keep_2
					add_building = ca_housing_1
					add_building = ca_housing_2
					add_building = ca_training_grounds_1
					add_building = ca_barracks_1
					add_building = ca_barracks_2
					add_building = ca_stable_1
					add_building = ca_town_market_1
					add_building = ca_town_market_2
				}
			}
		}
	}
}