estate_cossacks =
{
	icon = 4
	
	color = { 200 150 150 }
	
	# Used for when declaring independence
	independence_government = steppe_horde
	independence_tech_group = nomad_group
	independence_trigger = {
		OR = { 		
			has_terrain = steppe
			has_estate = estate_cossacks
		}
	}
	
	# Is estate kept in control of province on conquest?
	keep_on_conquest = no
	
	# If true, country will get estate
	
	trigger = {	
		NOT = { government = merchant_republic }
		NOT = { government = trading_city }
		NOT = { government = revolutionary_republic }
		NOT = { government = native_council }
		NOT = { government = siberian_native_council }
		NOT = { government = veche_republic }
		NOT = { government = parliamentary_republic }
		NOT = { government = presidental_republic }
		NOT = { government = parliamentary_monarchy }
		NOT = { government = communist_dictatorship }
		NOT = { government = socialist_republic }
		NOT = { government = fascist_dictatorship }
		NOT = { government = military_junta }
		NOT = { government = imperial_roman_republic }
		NOT = { government = plutocratic_republic }
		is_nomad = no
		is_colonial_nation = no
		NOT = { government = celestial_empire }
		unit_type = eastern
		religion_group = christian
	}
	
	# If true, province can be granted to estate
	province_trigger = {
		has_terrain = steppe
	}	
	
	# Min autonomy in estate provinces
	min_autonomy = 25
	
	# Estate cancels out the following multiplicative local autonomy effects:
	autonomy_does_not_affect = local_manpower_modifier
	autonomy_does_not_affect = land_forcelimit

	# These scale with loyalty & power
	country_modifier_happy = {
		cavalry_cost = -0.2
		cavalry_power = 0.2
		cav_to_inf_ratio = 0.10
	}
	country_modifier_neutral = {
		cavalry_power = 0.2
	}	
	country_modifier_angry = {
		cavalry_cost = 0.2
		cavalry_power = -0.1
	}
	
	# These do not scale, but only applied in provinces owned by the estate
	province_modifier_happy = {	
		local_hostile_attrition = 1
		local_manpower_modifier = 0.2
	}
	province_modifier_neutral = {
		local_hostile_attrition = 1
	}	
	province_modifier_angry = {
		local_unrest = 5
	}
	
	# Influence modifiers
	base_influence = 0
	influence_modifier = {
		desc = EST_STEPPE_PROVINCES
		trigger = {
			any_owned_province = {
				has_terrain = steppe
			}
			num_of_cities = 10
		}
		influence = 10
	}
	influence_modifier = {
		desc = EST_VAL_OTHER_ESTATE_IN_POWER
		trigger = {
			OR = {
				has_disaster = estate_nobility_disaster
				has_disaster = estate_church_disaster
				has_disaster = estate_burghers_disaster
			}
		}
		influence = -40
	}
	
	loyalty_modifier = {
		desc = EST_VAL_OTHER_ESTATE_IN_POWER_LOY
		trigger = {
			OR = {
				has_disaster = estate_nobility_disaster
				has_disaster = estate_church_disaster
				has_disaster = estate_burghers_disaster
			}
		}
		loyalty = -20
	}
	
	# For province assignment
	ai_grant_province = {
		factor = 10		
	}	
	
	# Does the AI want to give any extra territory beyond the minimum?
	ai_territory_modifier = {
		trigger = {
			always = yes
		}	
		value = 100	# Code has a sanity check against pushing influence too high
	}

	#Interactions
	interaction = {
		name = "EXPAND_COSSACK_REGISTRY"
		icon = 17
		
		years_between_use = 20
		
		trigger = {
			any_owned_province = {
				has_terrain = steppe
			}
		}
		
		effect = {
			add_prestige = -5
			add_estate_loyalty = {
				estate = estate_cossacks
				loyalty = 15
			}
			add_estate_influence_modifier = {
				estate = estate_cossacks
				desc = EST_VAL_COSSACK_REGISTER_EXPANDED
				influence = 10
				duration = 7300
			}
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				estate_influence = {
					estate = estate_cossacks
					influence = 60
				}				
			}
			modifier = {
				factor = 0
				estate_loyalty = {
					estate = estate_cossacks
					loyalty = 30
				}				
			}			
		}
	}
	
	interaction = {
		name = "RAISE_COSSACK_HOST"
		icon = 13
		
		years_between_use = 30
		
		potential = {
			NOT = { has_disaster = estate_burghers_disaster }
			NOT = { has_disaster = estate_church_disaster }
			NOT = { has_disaster = estate_nobility_disaster }
		}
		
		trigger = {
			estate_loyalty = {
				estate = estate_cossacks
				loyalty = 50
			}
			estate_influence = {
				estate = estate_cossacks
				influence = 40
			}
			num_of_owned_provinces_with = {
				value = 4
				has_estate = estate_cossacks
			}
		}
		
		effect = {
			if = {
				limit = {
					NOT = {
						num_of_owned_provinces_with = {
							value = 6
							has_estate = estate_cossacks
						}
					}
				}
				random_owned_province = {
					limit = { has_estate = estate_cossacks }
					add_unit_construction = {
						type = cavalry
						amount = 2
						speed = 0.5
						cost = 0
					}
					add_unit_construction = {
						type = infantry
						amount = 2
						speed = 0.5
						cost = 0
					}
				}
			}
			if = {
				limit = {
					num_of_owned_provinces_with = {
						value = 6
						has_estate = estate_cossacks
					}
					NOT = {
						num_of_owned_provinces_with = {
							value = 8
							has_estate = estate_cossacks
						}
					}
				}
				random_owned_province = {
					limit = { has_estate = estate_cossacks }
					add_unit_construction = {
						type = cavalry
						amount = 3
						speed = 0.5
						cost = 0
					}
					add_unit_construction = {
						type = infantry
						amount = 2
						speed = 0.5
						cost = 0
					}
				}
			}
			if = {
				limit = {
					num_of_owned_provinces_with = {
						value = 8
						has_estate = estate_cossacks
					}
					NOT = {
						num_of_owned_provinces_with = {
							value = 10
							has_estate = estate_cossacks
						}
					}
				}
				random_owned_province = {
					limit = { has_estate = estate_cossacks }
					add_unit_construction = {
						type = cavalry
						amount = 3
						speed = 0.5
						cost = 0
					}
					add_unit_construction = {
						type = infantry
						amount = 3
						speed = 0.5
						cost = 0
					}
				}
			}
			if = {
				limit = {
					num_of_owned_provinces_with = {
						value = 10
						has_estate = estate_cossacks
					}
				}
				random_owned_province = {
					limit = { has_estate = estate_cossacks }
					add_unit_construction = {
						type = cavalry
						amount = 3
						speed = 0.5
						cost = 0
					}
					add_unit_construction = {
						type = infantry
						amount = 4
						speed = 0.5
						cost = 0
					}
				}
			}
			
			add_estate_influence_modifier = {
				estate = estate_cossacks
				desc = EST_VAL_RAISED_COSSACK_HOST
				influence = 15
				duration = 10950
			}
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				estate_influence = {
					estate = estate_cossacks
					influence = 60
				}				
			}
			modifier = {
				factor = 0
				army_size_percentage = 0.5				
			}	
			modifier = {
				factor = 0
				is_at_war = no		
			}				
		}
	}
	interaction = {
		name = "COSSACK_CONQUISTADOR" #Led important exploration expeditions into Siberia
		icon = 19
		
		years_between_use = 30
		
		potential = {
			NOT = { has_disaster = estate_burghers_disaster }
			NOT = { has_disaster = estate_church_disaster }
			NOT = { has_disaster = estate_nobility_disaster }
		}
		
		potential = {
			OR = {
				has_idea_group = exploration_ideas
				has_idea = siberian_frontier
			}
		}
		
		trigger = {
			estate_loyalty = {
				estate = estate_cossacks
				loyalty = 50
			}
			estate_influence = {
				estate = estate_cossacks
				influence = 40
			}
		}
		effect = {
			create_conquistador = 40		
			add_estate_influence_modifier = {
				estate = estate_cossacks
				desc = EST_VAL_COSSACK_CONQUISTADOR
				influence = 15
				duration = 10950
			}
		}
		
		ai_will_do = {
			factor = 0			
		}
	}
	interaction = {
		name = "RECRUIT_MINISTER"
		icon = 10
		
		years_between_use = 30
		
		potential = {
			NOT = { has_disaster = estate_burghers_disaster }
			NOT = { has_disaster = estate_church_disaster }
			NOT = { has_disaster = estate_nobility_disaster }
		}
		
		trigger = {
			estate_influence = {
				estate = estate_cossacks
				influence = 40
			}
		}
		
		effect = {
			if = {
				limit = {
					monthly_income = 25
				}
				define_advisor = {
					type = army_reformer
					skill = 3
					discount = yes
				}
			}
			if = {
				limit = { NOT = { monthly_income = 25 } }
				define_advisor = {
					type = army_reformer
					skill = 2
					discount = yes
				}
			}
			add_estate_influence_modifier = {
				estate = estate_cossacks
				desc = EST_VAL_COSSACKS_MINISTER
				influence = 15
				duration = 10950
			}
			add_estate_loyalty = {
				estate = estate_nobles
				loyalty = -15 #Taking offense to a cossack being used in government
			}
		}
		
		ai_will_do = {
			factor = 0			
		}
	}
}