ig_rural_folk = {
	color = hsv{ 0.32 0.45 0.47 }
	texture = "gfx/interface/icons/ig_icons/rural_folk.dds"
	layer = "revolution_dynamic_rural_folk"
	index = 6

	ideologies = {
		ideology_agrarian
		ideology_particularist
		ideology_isolationist
	}
	
	character_ideologies = {
		ideology_moderate
		ideology_pacifist
		ideology_bonapartist
		ideology_legitimist
	}

	enable = {
		always = yes
	}

	# Deprecated; use on_enable effect to assign traits instead
	traits = {
		ig_trait_farmers_markets
		ig_trait_honest_work
		ig_trait_old_ways
	}

	on_enable = {
		ig:ig_rural_folk = {
			if = {
				limit = {
					has_dlc_feature = rp1_content
					owner = { c:BRZ ?= this }
				}
				set_ig_trait = ig_trait:ig_trait_old_ways
				set_ig_trait = ig_trait:ig_trait_plantation_work
				set_ig_trait = ig_trait:ig_trait_nucleos_coloniais
			}
			else_if = {
				limit = {
					owner = { c:RUS ?= this }
				}
				set_ig_trait = ig_trait:ig_trait_old_ways
				set_ig_trait = ig_trait:ig_trait_farmers_markets
				set_ig_trait = ig_trait:ig_trait_obshchina
			}
			else_if = {
				limit = {
					owner = { c:EGY ?= this }
				}
				set_interest_group_name = ig_fellahin
				set_ig_trait = ig_trait:ig_trait_old_ways
				set_ig_trait = ig_trait:ig_trait_fellahin
				set_ig_trait = ig_trait:ig_trait_farmers_markets
			}
			else_if = {
				limit = {
					owner = { 
						OR = {
							c:BIC ?= this
							any_primary_culture = {
								has_discrimination_trait = south_asian_heritage
								NOT = {
									has_discrimination_trait = himalayan
								}
							}
						}
					}
				}
				set_interest_group_name = ig_ryots
				set_ig_trait = ig_trait:ig_trait_of_the_sovereign_alone
				set_ig_trait = ig_trait:ig_trait_imandari
				set_ig_trait = ig_trait:ig_trait_bazaar_bargains
			}
			else_if = {
				limit = {
					owner = { c:PAN ?= this }
				}
				set_interest_group_name = ig_jats
				set_ig_trait = ig_trait:ig_trait_old_ways
				set_ig_trait = ig_trait:ig_trait_honest_work
				set_ig_trait = ig_trait:ig_trait_khalsa_panth
			}
			else = {
				set_ig_trait = ig_trait:ig_trait_old_ways
				set_ig_trait = ig_trait:ig_trait_honest_work
				set_ig_trait = ig_trait:ig_trait_farmers_markets
			}
		}
	
		# Jeffersonian Ideology
		if = {
			limit = {
				OR = {
					country_has_primary_culture = cu:yankee
					country_has_primary_culture = cu:dixie
				}
			}
			ig:ig_rural_folk = {
				remove_ideology = ideology_agrarian
				add_ideology = ideology_agrarian_jeffersonian
				set_interest_group_name = ig_yeoman_farmers
			}
		}

		# Heimin
		if = {
			limit = {
				country_has_primary_culture = cu:japanese
			}
			ig:ig_rural_folk = {
				set_interest_group_name = ig_peasants
			}
		}
		# Maka'āinana
		if = {
			limit = {
				country_has_primary_culture = cu:hawaiian
			}
			ig:ig_rural_folk = {
				set_interest_group_name = ig_maka_ainana
			}
		}
		# Sikh Empire
		if = {
			limit = {
				c:PAN ?= this
			}
			ig:ig_rural_folk = {
				set_interest_group_name = ig_jats
			}
		}
		# India
		else_if = {
			limit = {
				OR = {
					c:BIC ?= this
					any_primary_culture = {
						has_discrimination_trait = south_asian_heritage
						NOT = {
							has_discrimination_trait = himalayan
						}
					}
				}
			}
			ig:ig_rural_folk = {
				set_interest_group_name = ig_ryots
			}
		}
		# Nepal
		else_if = {
			limit = {
				any_primary_culture = {
					has_discrimination_trait = south_asian_heritage
					has_discrimination_trait = himalayan
				}
			}
			ig:ig_rural_folk = {
				set_interest_group_name = ig_kisanharu
			}
		}
	}
	on_disable = {}
	priority_cultures = { #Country scope
		rule = {
			trigger = {
				c:BIC ?= this
				any_primary_culture = { 
					cu:british = this
				}
			}
			cultures = {
				assamese avadhi baluchi bengali bihari gujarati kannada malayalam marathi oriya panjabi pathan rajput sindi tamil telegu hindustani bundeli pahari gondi bageli chhattisgarhi deccani
			}
		}
	}
	on_character_ig_membership = {}

	pop_potential = {
		NOR = {
			is_pop_type = aristocrats
			is_pop_type = capitalists
			is_pop_type = shopkeepers
		}
		OR = {
			pop_employment_building_group = bg_owner_buildings
			pop_employment_building_group = bg_subsistence_agriculture
			pop_employment_building_group = bg_subsistence_ranching
			pop_employment_building_group = bg_agriculture
			pop_employment_building_group = bg_ranching
			pop_employment_building_group = bg_plantations
			pop_employment_building_group = bg_logging
			pop_employment_building_group = bg_fishing
			pop_employment_building_group = bg_whaling
		}
	}

	pop_weight = {
		value = 0

		add = {
			desc = "RURAL_POP"
			if = {
				limit = {
					OR = {
						pop_employment_building_group = bg_owner_buildings
						pop_employment_building_group = bg_subsistence_agriculture
						pop_employment_building_group = bg_subsistence_ranching
						pop_employment_building_group = bg_agriculture
						pop_employment_building_group = bg_ranching
						pop_employment_building_group = bg_plantations
						pop_employment_building_group = bg_logging
						pop_employment_building_group = bg_fishing
						pop_employment_building_group = bg_whaling
					}
				}
				if = {
					limit = {
						is_pop_type = clergymen
					}
					value = 25
				}
				else = {
					value = 100
				}
			}
		}

		add = {
			desc = "POP_FARMERS"
			if = {
				limit = {
					is_pop_type = farmers
				}
				value = 200
			}
		}

		add = {
			desc = "POP_PEASANTS"
			if = {
				limit = {
					is_pop_type = peasants
				}
				value = 200
			}
		}

		add = {
			desc = "POP_CLERGYMEN"
			if = {
				limit = {
					is_pop_type = clergymen
				}
				value = 75
			}
		}
		
		if = {
			limit = {
				c:BIC ?= owner
				culture = {
					has_discrimination_trait = european_heritage
				}
			}
			multiply = {
				desc = "POP_INDIA_COLONIAL_RULE"
				value = 0.1
			}
		}
	
		multiply = {
			desc = "LEADER_POPULARITY"
			scope:interest_group = {
				leader ?= {
					value = popularity
					multiply = 0.0025
					add = 1
					max = 1.25
					min = 0.75
				}
			}
		}
		if = {
			limit = {
				scope:interest_group = {
					is_in_government = yes
				}
			}
			multiply = {
				desc = "IN_GOVERNMENT_ATTRACTION"
				value = 1
				add = scope:interest_group.modifier:interest_group_in_government_attraction_mult
				min = 0
			}
		}
		
		if = {
			limit = {
				scope:interest_group = {
					is_in_government = yes
				}
			}
			multiply = { # Multiplied by 1.25x max
				desc = "POP_LOYALISTS"
				value = pop_loyalist_fraction
				divide = 4
				add = 1
			}
		}
		if = {
			limit = {
				scope:interest_group = {
					is_in_government = no
				}
			}
			multiply = { # Multiplied by 1.25x max
				desc = "POP_RADICALS"
				value = pop_radical_fraction
				divide = 4
				add = 1
			}
		}
	}

	monarch_weight = {
		value = 0.25 # this is just inherently unlikely
		# Monarch is not likely to adopt a marginal IG
		if = {
			limit = {
				is_marginal = yes
			}
			multiply = {
				value = 0.1
			}
		}
		# Monarch is more likely to adopt a Powerful IG
		if = {
			limit = {
				is_powerful = yes
			}
			multiply = {
				value = 2
			}
		}
		# More likely with Homesteading
		if = {
			limit = {
				owner = {
					has_law = law_type:law_homesteading
				}
			}
			multiply = {
				value = 2
			}
		}
		# Impossible with Serfdom
		if = {
			limit = {
				owner = {
					has_law = law_type:law_serfdom
				}
			}
			multiply = {
				value = 0
			}
		}
	}

	agitator_weight = {
		# Agitators more likely to come from populist IG's rather than elitist
		value = 1.0
		# Agitators will never be part of a marginalized IG
		if = {
			limit = {
				owner.ig:ig_rural_folk = {
					is_marginal = yes
				}
			}
			multiply = {
				value = 0
			}
		}
	}

	commander_weight = {
		value = 1.0
	}

	noble_chance = {
		value = 0.2
	}

	female_commander_chance = {
		value = 0.0
	}

	female_politician_chance = {
		value = 0.0

		if = {
			limit = {
				owner = {
					has_law = law_type:law_womens_suffrage
				}

			}
			add = {
				value = 0.025
			}
		}
	}

	female_agitator_chance = {
		value = 0.025
		
		if = {
			limit = {
				owner = {
					has_law = law_type:law_women_own_property
				}

			}
			add = {
				value = 0.025
			}
		}	
		
		if = {
			limit = {
				owner = {
					has_law = law_type:law_women_in_the_workplace
				}

			}
			add = {
				value = 0.025
			}
		}

		if = {
			limit = {
				owner = {
					has_law = law_type:law_womens_suffrage
				}

			}
			add = {
				value = 0.025
			}
		}		
	}

	# The chance that a commander belonging to this IG takes over leadership when it changes
	# scope:character is the most popular commander in the IG
	commander_leader_chance = {
		value = 0.5
		multiply = ig_commander_leader_chance_mult
	}
}
