estate_qizilbash_land_rights = {
	icon = privilege_grant_autonomy
	land_share = 5
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	loyalty = 0.05
	influence = 0.05
	can_select = {
		not = { has_estate_privilege = estate_ghulams_land_rights }
		not = { has_estate_privilege = estate_nobles_land_rights }
	}
	on_granted = {
	}
	penalties = {
	}
	benefits = {
		governing_capacity = 100
	}
	ai_will_do = {
		factor = 5
		modifier = {
			factor = 1.4
			num_of_territories = 5
		}
		modifier = {
			factor = 1.5
			num_of_territories = 10
		}
		modifier = {
			factor = 1.5
			num_of_territories = 15
		}
		modifier = {
			factor = 0
			OR = {
				NOT = { crown_land_share = 25 }
				estate_influence = {
					estate = estate_qizilbash
					influence = 75
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_land_rights }
		}
		modifier = {
			factor = 3
			OR = {
				AND = {
					governing_capacity_percentage = 0.9
					NOT = { has_estate_privilege = estate_qizilbash_land_rights }
				}
				#The trigger below should make sure that the AI actually keeps this privilege when enacting it early game
				AND = {
					governing_capacity_percentage = 0.6
					has_estate_privilege = estate_qizilbash_land_rights
				}
			}
		}
		modifier = {
			factor = 0
			NOT = { governing_capacity_percentage = 0.5 }
		}
		modifier = {
			factor = 0.8
			OR = {
				NOT = { crown_land_share = 40 }
				AND = {
					is_absolutism_active = yes
					NOT = { crown_land_share = 60 }
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_land_rights }
		}
		modifier = {
			factor = 0.8
			OR = {
				NOT = { crown_land_share = 30 }
				AND = {
					is_absolutism_active = yes
					NOT = { crown_land_share = 50 }
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_land_rights }
		}
		modifier = {
			factor = 0.8
			is_absolutism_active = yes
		}
		modifier = {
			factor = 2
			governing_capacity_percentage = 0.9
		}
		modifier = {
			factor = 3
			governing_capacity_percentage = 1
		}
		modifier = {
			factor = 10
			governing_capacity_percentage = 1.2
		}
		modifier = {
			factor = 8
			NOT = { adm_tech = 12 }
			governing_capacity_percentage = 0.8
		}
		modifier = {
			factor = 5
			NOT = { adm_tech = 12 }
			NOT = { government_rank = 1 }
			governing_capacity_percentage = 0.65
		}
		#Tag specific convincement - after tech 17 (+250 governing capacity) it should not play a role anymore
		modifier = {
			factor = 1.25
			tag = MOS
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = RUS
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = TUR
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = MNG
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = FRA
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = SPA
			NOT = { adm_tech = 17 }
		}
		modifier = {
			factor = 1.25
			tag = PLC
			NOT = { adm_tech = 17 }
		}
		#Has already a similar privilege active
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_brahmins_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_nobles_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_church_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_burghers_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_vaisyas_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_qizilbash_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_nomadic_tribes_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_dhimmi_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_jains_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_rajput_land_rights
		}
		modifier = {
			factor = 0.75
			has_estate_privilege = estate_maratha_land_rights
		}
	}
}

estate_qizilbash_military = {
	icon = privilege_military_power
	land_share = 10
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	loyalty = -0.05
	is_valid = {
	}
	can_select = {
		can_select_monarch_power_privilege = {
			estate = estate_qizilbash
			type = mil
		}
	}
	on_granted = {
	}
	penalties = {
	}
	benefits = {
		country_military_power = 1
	}
	ai_will_do = {
		factor = 13
		modifier = {
			factor = 0
			OR = {
				NOT = { crown_land_share = 30 }
				estate_influence = {
					estate = estate_qizilbash
					influence = 75
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_military }
		}
		modifier = {
			factor = 0.8
			OR = {
				NOT = { crown_land_share = 35 }
				AND = {
					is_absolutism_active = yes
					NOT = { crown_land_share = 55 }
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_military }
		}
		modifier = {
			factor = 0.8
			is_absolutism_active = yes
		}
		modifier = {
			factor = 1.25
			NOT = { mil = 2 }
		}
		modifier = {
			factor = 0.8
			mil = 5
		}
	}
}

estate_qizilbash_loyalty_privilege = {
	icon = privilege_royal_authority
	max_absolutism = -10
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 2 } }
	loyalty = 0.15
	influence = 0.1
	penalties = {
	}
	benefits = {
	}
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 0
			is_absolutism_active = yes
		}
	}
}

estate_qizilbash_establish_the_qizilbash_regiments = {
	icon = qizilbash
	land_share = 5
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	influence = 0.05
	can_select = {
	}
	on_granted = {
	}
	modifier_by_land_ownership = {
		allowed_qizilbash_fraction = 0.25
	}
	penalties = {
	}
	benefits = {
		has_qizilbash = yes
		amount_of_qizilbash = 6
	}
	mechanics = {
	}
	ai_will_do = {
		factor = 10
	}
}

estate_qizilbash_expand_the_qizilbash_regiments = {
	icon = qizlbash_cavalry
	land_share = 5
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	influence = 0.05
	is_valid = {
		has_estate_privilege = estate_qizilbash_establish_the_qizilbash_regiments
	}
	can_select = {
	}
	on_granted = {
	}
	on_invalid = {
	}
	on_revoked = {
	}
	modifier_by_land_ownership = {
		allowed_qizilbash_fraction = 0.5
	}
	penalties = {
	}
	benefits = {
	}
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 0
			OR = {
				NOT = { crown_land_share = 25 }
				estate_influence = {
					estate = estate_qizilbash
					influence = 75
				}
			}
			NOT = { has_estate_privilege = estate_qizilbash_establish_the_qizilbash_regiments }
		}
	}
}

estate_qizilbash_horse_responsibilities = {
	icon = horse
	land_share = 0
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	influence = 0.05
	loyalty = 0.1
	is_valid = {
		has_estate_privilege = estate_qizilbash_expand_the_qizilbash_regiments
	}
	can_select = {
	}
	on_granted = {
		if = {
			limit = { NOT = { has_country_flag = bred_a_new_war_steed } }
			unlock_decision = {
				type = horse_breeding_decision
				custom_tooltip = horse_breeding_decision_at
			}
		}
		enable_estate_action = {
			estate_action = GRANT_QIZILBASH_HORSES
		}
	}
	on_revoked = {
		if = {
			limit = { NOT = { has_country_flag = bred_a_new_war_steed } }
			lock_decision = { type = horse_breeding_decision }
		}
		disable_estate_action = {
			estate_action = GRANT_QIZILBASH_HORSES
		}
	}
	on_invalid = {
		if = {
			limit = { NOT = { has_country_flag = bred_a_new_war_steed } }
			lock_decision = { type = horse_breeding_decision }
		}
		disable_estate_action = {
			estate_action = GRANT_QIZILBASH_HORSES
		}
	}
	modifier_by_land_ownership = {
	}
	penalties = {
	}
	benefits = {
		cavalry_cost = -0.1
	}
	mechanics = {
	}
	ai_will_do = {
		factor = 10
	}
}

estate_qizilbash_protected_communities = {
	icon = privilege_autonomy
	loyalty = 0.1
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	influence = 0.1
	is_valid = {
		any_owned_province = {
			OR = {
				culture = turkmeni
				culture = azerbaijani
				culture = turco_iranian
				culture = turkish
			}
		}
	}
	can_select = {
	}
	on_granted = {
		custom_tooltip = estate_qizilbash_protected_communities_gt
		tooltip = {
			add_province_modifier = {
				name = estate_qizilbash_protected_communities_mod
				duration = -1
				desc = UNTIL_REVOKED
			}
		}
	}
	on_revoked = {
		custom_tooltip = estate_qizilbash_protected_communities_rt
	}
	on_invalid = {
		custom_tooltip = estate_qizilbash_protected_communities_rt
	}
	on_granted_province = {
		if = {
			limit = {
				OR = {
					culture = turkmeni
					culture = azerbaijani
					culture = turco_iranian
					culture = turkish
				}
			}
			add_province_modifier = {
				name = estate_qizilbash_protected_communities_mod
				duration = -1
				desc = UNTIL_REVOKED
			}
		}
	}
	on_revoked_province = {
		remove_province_modifier = estate_qizilbash_protected_communities_mod
	}
	on_invalid_province = {
		remove_province_modifier = estate_qizilbash_protected_communities_mod
	}
	modifier_by_land_ownership = {
	}
	penalties = {
	}
	benefits = {
		amount_of_qizilbash = 4
	}
	mechanics = {
	}
	ai_will_do = {
		factor = 10
	}
}

estate_qizilbash_military_leadership = {
	icon = privilege_army_tradition
	loyalty = 0.05
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	influence = 0.05
	can_select = {
		army_tradition = 30
	}
	on_granted = {
		add_army_tradition = -5
	}
	penalties = {
	}
	benefits = {
		general_cost = -0.1
		army_tradition_decay = -0.005
	}
	ai_will_do = {
		factor = 10
	}
}

estate_qizilbash_supremacy_over_the_aristocracy = {
	icon = privilege_coup_detat
	loyalty = 0.1
	influence = 0.1
	max_absolutism = -10
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 2 } }
	can_select = {
	}
	on_granted = {
	}
	modifier_by_land_ownership = {
	}
	penalties = {
		nobles_loyalty_modifier = -0.1
	}
	benefits = {
		nobles_influence_modifier = -0.2
	}
	mechanics = {
		exempt_from_seize_land
	}
	ai_will_do = {
		factor = 10
	}
}

#Unlockable
estate_qizilbash_defensive_policy = {
	icon = privilege_fort
	loyalty = 0.05
	influence = 0.1
	max_absolutism = 0
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_defensive_policy
		}
	}
	can_select = {
		NOT = { has_estate_privilege = estate_nobles_defensive_policy }
		NOT = { has_estate_privilege = estate_ghulams_defensive_policy }
	}
	on_granted = {
		
	}
	on_revoked = {
		
	}
	benefits = {
		garrison_size = 0.25
		fort_maintenance_modifier = -0.33
	}
	ai_will_do = {
		factor = 0
	}
}

estate_qizilbash_regimental_discipline = {
	icon = qizilbash_shock
	loyalty = 0.05
	influence = 0.1
	max_absolutism = -10
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 2 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_regimental_discipline
		}
	}
	can_select = {
	}
	on_granted = {
		add_country_modifier = {
			name = estate_qizilbash_regimental_discipline_qizilbash
			duration = -1
			hidden = yes
		}
		scaling_with_influence_privilege_tooltip = {
			estate_privilege = estate_qizilbash_regimental_discipline
		}
	}
	on_revoked = {
		remove_country_modifier = estate_qizilbash_regimental_discipline_qizilbash
		scaling_with_influence_privilege_tooltip = {
			estate_privilege = estate_qizilbash_regimental_discipline
		}
	}
	on_invalid = {
		remove_country_modifier = estate_qizilbash_regimental_discipline_qizilbash
	}
	benefits = {
	}
	influence_scaled_conditional_modifier = {
		trigger = {
			estate_loyalty = { estate = estate_qizilbash loyalty = 60 }
		}
		modifier = {
			discipline = 0.05
		}
	}
	influence_scaled_conditional_modifier = {
		trigger = {
			estate_loyalty = { estate = estate_qizilbash loyalty = 30 }
			NOT = { estate_loyalty = { estate = estate_qizilbash loyalty = 60 } }
		}
		modifier = {
			discipline = 0.025
		}
	}
	influence_scaled_conditional_modifier = {
		trigger = {
			NOT = { estate_loyalty = { estate = estate_qizilbash loyalty = 30 } }
		}
		modifier = {
			discipline = -0.025
		}
	}
	modifier_by_land_ownership = {
	}
	#conditional_modifier = {
	#	trigger = { }
	#	modifier = { }
	#}
	ai_will_do = {
		factor = 10
	}
}

estate_qizilbash_tofangchi_regiment = {
	icon = privilege_infantry
	loyalty = 0.05
	influence = 0.1
	max_absolutism = 0
	#conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_tofangchi_regiment
		}
	}
	can_select = {
		NOT = { has_estate_privilege = estate_nobles_tofangchi_regiment }
		NOT = { has_estate_privilege = estate_ghulams_tofangchi_regiment }
	}
	on_granted = {
		
	}
	on_revoked = {
		
	}
	benefits = {
		infantry_power = 0.1
	}
	ai_will_do = {
		factor = 100
	}
}

estate_qizilbash_tupchi_artillery_corps = {
	icon = privilege_artillery
	loyalty = 0.05
	influence = 0.05
	max_absolutism = -5
	conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_tupchi_artillery_corps
		}
	}
	can_select = {
		NOT = { has_estate_privilege = estate_nobles_tupchi_artillery_corps }
		NOT = { has_estate_privilege = estate_ghulams_tupchi_artillery_corps }
	}
	on_granted = {
		custom_tooltip = tupchi_artillery_corps_tt
	}
	on_revoked = {
		
	}
	conditional_modifier = {
		trigger = {
			OR = {
				any_ally = {
					OR = {
						technology_group = western
						technology_group = eastern
						capital_scope = { continent = europe }
					}
				}
				any_subject_country = {
					OR = {
						technology_group = western
						technology_group = eastern
						capital_scope = { continent = europe }
					}
				}
			}
		}
		modifier = {
			artillery_cost = -0.33
		}
	}
	benefits = {
		artillery_power = 0.05
	}
	ai_will_do = {
		factor = 100
	}
}

estate_qizilbash_qurchi_service = {
	icon = privilege_legitimacy
	loyalty = 0.10
	max_absolutism = 0
	#conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_qurchi_service
		}
	}
	can_select = {
		NOT = { has_estate_privilege = estate_nobles_qurchi_service }
		NOT = { has_estate_privilege = estate_ghulams_qurchi_service }
	}
	on_granted = {
		scaling_with_loyalty_privilege_tooltip = {
			estate_privilege = estate_qizilbash_qurchi_service
		}
	}
	on_revoked = {
		scaling_with_loyalty_privilege_tooltip = {
			estate_privilege = estate_qizilbash_qurchi_service
		}
	}
	benefits = {
		morale_damage_received = -0.1
	}
	loyalty_scaled_conditional_modifier = {
		trigger = { always = yes }
		modifier = {
			monarch_lifespan = 0.5
			nobles_influence_modifier = -0.5
			ghulams_influence_modifier = -0.5
			qizilbash_influence_modifier = 0.5
		}
	}
	ai_will_do = {
		factor = 100
	}
}

estate_qizilbash_mamlukian_administration = {
	icon = privilege_land_rights
	loyalty = 0.05
	influence = 0.10
	max_absolutism = 0
	#conditional_modifier = { trigger = { has_absolutism_reduction_for_estate_privileges = yes } modifier = { max_absolutism = 1 } }
	is_valid = {
		has_unlocked_estate_privilege = {
			estate_privilege = estate_qizilbash_mamlukian_administration
		}
	}
	can_select = {
		NOT = { has_estate_privilege = estate_nobles_mamlukian_administration }
		NOT = { has_estate_privilege = estate_ghulams_mamlukian_administration }
	}
	benefits = {
		governing_capacity_modifier = 0.1
		qizilbash_privilege_slots = 1
	}
	on_granted = {
		custom_tooltip = mamlukian_administration_modifier_gt
		tooltip = {
			add_province_modifier = {
				name = mamlukian_administration_modifier
				duration = -1
			}
		}
	}
	on_revoked = {
		custom_tooltip = mamlukian_administration_modifier_rt
	}
	on_invalid = {
		custom_tooltip = mamlukian_administration_modifier_rt
	}
	on_granted_province = {
		if = {
			limit = { region = egypt_region }
			add_province_modifier = {
				name = mamlukian_administration_modifier
				duration = -1
			}
		}
	}
	on_revoked_province = {
		remove_province_modifier = mamlukian_administration_modifier
	}
	on_invalid_province = {
		remove_province_modifier = mamlukian_administration_modifier
	}
	ai_will_do = {
		factor = 100
	}
}