﻿ig_devout = {
	color = hsv{ 0.50 0.30 0.67 }
	texture = "gfx/interface/icons/ig_icons/devout.dds"
	layer = "revolution_dynamic_devout"
	index = 1

	ideologies = {
		ideology_pious
		ideology_moralist
		ideology_patriarchal
	}

	character_ideologies = {
		ideology_moderate
		ideology_traditionalist
	}

	enable = {
		always = yes
	}

	# Deprecated; use on_enable effect to assign traits instead
	traits = {
		ig_trait_be_fruitful_and_multiply
		ig_trait_divine_right
		ig_trait_pious_fiction
	}

	on_enable = {
		ig:ig_devout ?= {
			if = {
				limit = {
					owner = {
						country_has_state_religion = rel:protestant
						NOT = {
							c:BIC ?= this
						}
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_divine_right
				set_ig_trait = ig_trait:ig_trait_work_ethic
			}
			else_if = {
				limit = {
					owner = {
						OR = {
							country_has_state_religion = rel:hindu
							country_has_state_religion = rel:mahayana
							country_has_state_religion = rel:theravada
							country_has_state_religion = rel:confucian
						}
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_divine_right
				set_ig_trait = ig_trait:ig_trait_asceticism
			}
			else_if = {
				limit = {
					owner = {
						country_has_state_religion = rel:sikh
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_rehat
				set_ig_trait = ig_trait:ig_trait_kar_seva
			}
			else_if = {
				limit = {
					owner = {
						country_has_state_religion = rel:gelugpa
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_divine_right
				set_ig_trait = ig_trait:ig_trait_temporal_mandate
			}
			else_if = {
				limit = {
					owner = {
						country_has_state_religion = rel:jewish
					}
				}
				set_ig_trait = ig_trait:ig_trait_traditsye
				set_ig_trait = ig_trait:ig_trait_yeshivot
				set_ig_trait = ig_trait:ig_trait_the_best_revenge
			}
			else_if = {
				limit = {
					owner = {
						country_has_state_religion = rel:shinto
					}
				}
				set_ig_trait = ig_trait:ig_trait_haibutsu_kishaku
				set_ig_trait = ig_trait:ig_trait_secular_shrine_theory
				set_ig_trait = ig_trait:ig_trait_heavenly_sovereign
			}
			else_if = {
				limit = {
					owner = {
						OR = {
							country_has_state_religion = rel:sunni
							country_has_state_religion = rel:shiite
							country_has_state_religion = rel:ibadi
						}
						NOT = { c:TUR ?= this }
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_sharia
				set_ig_trait = ig_trait:ig_trait_da_wat
			}
			else_if = {
				limit = {
					owner = { c:TUR ?= this }
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_mecelle
				set_ig_trait = ig_trait:ig_trait_da_wat
			}
			else_if = {
				limit = {
					owner = {
						c:BIC ?= this
					}
				}
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_divine_right
				set_ig_trait = ig_trait:ig_trait_asceticism
			}
			else = {
				set_ig_trait = ig_trait:ig_trait_pious_fiction
				set_ig_trait = ig_trait:ig_trait_divine_right
				set_ig_trait = ig_trait:ig_trait_be_fruitful_and_multiply
			}
		}

		### Specific

		# Buddhist Monks (Japan)
		if = {
			limit = {
				country_has_state_religion = rel:mahayana
				country_has_primary_culture = cu:japanese
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_jisha
				remove_ideology = ideology_moralist
				add_ideology = ideology_buddhist_moralist
			}
		}
		# Shinto Monks (Japan)
		else_if = {
			limit = {
				country_has_state_religion = rel:shinto
				country_has_primary_culture = cu:japanese
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_shinto_monks
				remove_ideology = ideology_moralist
				add_ideology = ideology_shinto_moralist
			}
		}
		# Christian Missionaries (Hawaii)
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				country_has_primary_culture = cu:hawaiian
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_christian_missionaries
				add_ideology = ideology_laissez_faire
			}
		}
		# London Missionary Society (in South Africa)
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				OR = {
					c:WBL ?= this
					c:PHL ?= this
				}
			}
			ig:ig_devout = {
				set_interest_group_name = ig_london_missionary_society
				add_ideology = ideology_laissez_faire
			}
		}
		# Anglicans
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				OR = {
					country_has_primary_culture = cu:maori
					country_has_primary_culture = cu:australian
					country_has_primary_culture = cu:anglo_canadian
					country_has_primary_culture = cu:british
					country_has_primary_culture = cu:irish
					c:NRU ?= this
				}
				NOT = {
					c:BIC ?= this
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_anglican_church
			}
		}
		# Russian Orthodox Church
		else_if = {
			limit = {
				country_has_state_religion = rel:orthodox
				OR = {
					country_has_primary_culture = cu:russian
					country_has_primary_culture = cu:byelorussian
					country_has_primary_culture = cu:ukrainian
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_orthodox_church
				remove_ideology = ideology_patriarchal
				add_ideology = ideology_russian_patriarch
			}
		}
		# Church of Denmark
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				country_has_primary_culture = cu:danish
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_church_of_denmark
			}
		}
		# Church of Norway
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				country_has_primary_culture = cu:norwegian
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_church_of_norway
			}
		}
		# Church of Finland
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				country_has_primary_culture = cu:finnish
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_church_of_finland
			}
		}
		# Church of Sweden
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				country_has_primary_culture = cu:swedish
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_church_of_sweden
			}
		}
		# Confucian Scholars
		else_if = {
			limit = {
				country_has_state_religion = rel:confucian
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_confucian
				remove_ideology = ideology_pious
				remove_ideology = ideology_moralist
				add_ideology = ideology_confucian
			}
		}
		# Evangelicals
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				OR = {
					country_has_primary_culture = cu:yankee
					country_has_primary_culture = cu:dixie
					country_has_primary_culture = cu:afro_american
					country_has_primary_culture = cu:cherokee
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_evangelicals
			}
		}
		# Roman Curia
		else_if = {
			limit = {
				c:PAP ?= this
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_roman_curia
				remove_ideology = ideology_moralist
				add_ideology = ideology_papal_moralist
			}
		}


		### Generic

		# Catholic Church
		else_if = {
			limit = { country_has_state_religion = rel:catholic }
			ig:ig_devout ?= {
				set_interest_group_name = ig_catholic_church
			}
		}
		# Evangelical Church
		else_if = {
			limit = {
				country_has_state_religion = rel:protestant
				NOT = {
					c:BIC ?= this
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_evangelical_church
			}
		}
		# Sunni Ulema
		else_if = {
			limit = {
				OR = {
					country_has_state_religion = rel:sunni
					# Ibadi Arab Zanzibar still gets a Sunni Devout IG to represent the non-Ibadi majority
					c:ZAN ?= this
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_sunni_madrasahs
			}
		}
		# Shi'a Ulema
		else_if = {
			limit = {
				country_has_state_religion = rel:shiite
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_shia_madrasahs
			}
		}
		# Ibadi Ulema
		else_if = {
			limit = {
				country_has_state_religion = rel:ibadi
				NOT = { c:ZAN ?= this }
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_ibadi_madrasahs
				remove_ideology = ideology_moralist
				remove_ideology = ideology_patriarchal
				add_ideology = ideology_ibadi_shura
				add_ideology = ideology_ibadi_imamate
			}
		}
		# Oriental Orthodox Church
		else_if = {
			limit = { country_has_state_religion = rel:oriental_orthodox }
			ig:ig_devout ?= {
				set_interest_group_name = ig_oriental_orthodox_church
				remove_ideology = ideology_patriarchal
				add_ideology = ideology_oriental_orthodox_patriarch
			}
		}
		# Orthodox Church
		else_if = {
			limit = {
				country_has_state_religion = rel:orthodox
				NOR = {
					country_has_primary_culture = cu:russian
					country_has_primary_culture = cu:byelorussian
					country_has_primary_culture = cu:ukrainian
					c:MON ?= ROOT
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_orthodox_church
				remove_ideology = ideology_patriarchal
				add_ideology = ideology_orthodox_patriarch
			}
		}
		else_if = {
			limit = {
				c:MON ?= ROOT
				country_has_state_religion = rel:orthodox
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_orthodox_church
				remove_ideology = ideology_patriarchal
				add_ideology = ideology_orthodox_patriarch
				remove_ideology = ideology_moralist
				add_ideology = ideology_montenegrin_moralist
			}
		}
		# Hindu Priesthood
		else_if = {
			limit = {
				OR = {
					country_has_state_religion = rel:hindu
					c:BIC ?= this
				}
			}
			ig:ig_devout ?= {
				set_interest_group_name = ig_hindu_priesthood
				if = {
					limit = {
						owner = {
							c:BIC ?= this
						}
					}
					remove_ideology = ideology_moralist
					add_ideology = ideology_hindu_moralist_british_india
				}
				else = {
					remove_ideology = ideology_moralist
					add_ideology = ideology_hindu_moralist
				}
			}
		}
		# Vajrayana Monks
		else_if = {
			limit = { country_has_state_religion = rel:gelugpa }
			ig:ig_devout ?= {
				set_interest_group_name = ig_vajrayana_monks
				remove_ideology = ideology_moralist
				add_ideology = ideology_buddhist_moralist
			}
		}
		# Vajrayana Monks
		else_if = {
			limit = { country_has_state_religion = rel:theravada }
			ig:ig_devout ?= {
				set_interest_group_name = ig_theravada_monks
				remove_ideology = ideology_moralist
				add_ideology = ideology_buddhist_moralist
			}
		}
		# Mahayana Monks
		else_if = {
			limit = { country_has_state_religion = rel:mahayana }
			ig:ig_devout ?= {
				set_interest_group_name = ig_mahayana_monks
				remove_ideology = ideology_moralist
				add_ideology = ideology_buddhist_moralist
			}
		}
		# Sikh Granthis
		else_if = {
			limit = { country_has_state_religion = rel:sikh }
			ig:ig_devout ?= {
				set_interest_group_name = ig_granthis
				remove_ideology = ideology_moralist
				add_ideology = ideology_sikh_moralist
			}
		}

		### Corporatism
		if = {
			limit = {
				has_technology_researched = corporatism
			}
			ig:ig_devout ?= {
				remove_ideology = ideology_pious
				add_ideology = ideology_corporatist
			}
		}
	}
	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
			}
		}
		rule = {
			trigger = {
				c:ZAN ?= this
				any_primary_culture = {
					cu:bedouin = this
				}
			}
			cultures = {
				swahili
			}
		}
		rule = {
			trigger = {
				c:HAW ?= this
				NOT = { has_variable = deported_americans }
			}
			cultures = {
				yankee dixie british hawaiian
			}
		}
		rule = {
			trigger = {
				country_has_state_religion = rel:protestant
				OR = {
					c:WBL ?= this
					c:PHL ?= this
				}
				c:GBR ?= {
					country_rank >= rank_value:major_power
				}
			}
			cultures = {
				british scottish
			}
		}
		rule = {
			trigger = {
				c:PHI ?= this
				NOT = { has_variable = je_philippines_main_reliance_happened }
				NOT = { any_primary_culture = { cu:filipino = this } }
				NOT = { any_primary_culture = { cu:filipino_hispanophone = this } }
				any_primary_culture = { cu:spanish = this }
			}
			cultures = {
				spanish filipino_mestizo
			}
		}
		rule = {
			trigger = {
				c:PHI ?= this
				any_primary_culture = {
					AND = {
						cu:spanish = this
						cu:filipino_hispanophone = this
					}
				}
			}
			cultures = {
				spanish filipino_hispanophone
			}
		}
	}

	on_character_ig_membership = {
		if = {
			limit = {
				owner = {
					c:BIC ?= this
				}
			}
			change_character_religion = rel:hindu
		}
		else_if = {
			limit = {
				owner = {
					c:ZAN ?= this
				}
			}
			change_character_religion = rel:sunni
		}
		else_if = {
			limit = {
				NOT = {
					owner = {
						has_law_or_variant = law_type:law_state_atheism
					}
				}
			}
			change_character_religion = scope:interest_group.owner.religion
		}
		else = {
			change_character_religion = scope:interest_group.owner.country_definition.religion
		}
	}


	pop_potential = {
		OR = {
			has_state_religion = yes
			AND = {
				exists = c:BIC
				owner ?= c:BIC
				has_pop_religion = hindu
			}
			AND = {
				exists = c:ZAN
				owner ?= c:ZAN
				has_pop_religion = sunni
			}
		}
		NOT = {
			has_pop_religion = atheist
		}
	}

	pop_weight = {
		add = {
			desc = "POP_BASE_ATTRACTION"
			value = 25
		}

		add = {
			desc = "RURAL_POP"
			if = {
				limit = { 
					rural_employment = yes
					NOT = { is_pop_type = aristocrats }
					NOT = {
						owner = {
							NOT = { has_law = law_type:law_monarchy }
							ig:ig_petty_bourgeoisie = {
								leader = {
									has_ideology = ideology:ideology_bonapartist
								}
							}
						}
					}
					NOT = {
						owner = {
							ig:ig_devout = {
								leader = {
									has_ideology = ideology:ideology_legitimist
								}
							}
						}
					}
					owner = {
						ig:ig_rural_folk = {
							leader = {
								NOT = {has_ideology = ideology:ideology_jacksonian_democrat}
							}
						}
					}
				}
				value = 25
				if = {
					limit = {
						has_state_religion = yes
					}
					add = 25
				}
			}
		}

		multiply = {
			desc = "SMALL_URBAN_CENTER"
			value = 1.0
			if = {
				limit = {
					NOT = { is_pop_type = aristocrats }
					state = {
						any_scope_building = {
							is_building_type = building_urban_center
							level < 5
						}
					}
					owner = {
						ig:ig_rural_folk = {
							leader = {
								NOT = {has_ideology = ideology:ideology_jacksonian_democrat}
							}
						}
					}
				}
				value = 1.25
			}
		}	

		multiply = {
			desc = "NO_URBAN_CENTER"
			value = 1.0
			if = {
				limit = {
					NOT = { is_pop_type = aristocrats }
					state = {
						NOT = {
							any_scope_building = {
								is_building_type = building_urban_center
							}
						}
					}
					owner = {
						ig:ig_rural_folk = {
							leader = {
								NOT = {has_ideology = ideology:ideology_jacksonian_democrat}
							}
						}
					}
				}
				value = 1.5
			}
		}

		add = {
			desc = "POP_CLERGYMEN"
			if = {
				limit = {
					is_pop_type = clergymen
				}
				value = 250
			}
		}
		
		add = {
			desc = "POP_ARISTOCRATS"
			if = {
				limit = { 
					is_pop_type = aristocrats
				}
				value = 10
				if = {
					limit = {
						has_state_religion = yes
					}
					add = 10
				}
			}
		}

		add = {
			desc = "POP_FARMERS"
			if = {
				limit = {
					is_pop_type = farmers
				}
				value = 50
				if = {
					limit = {
						has_state_religion = yes
					}
					add = 25
				}
			}
		}

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

		multiply = {
			desc = "ideology_bonapartist"
			value = 1.0

			if = {
				limit = {
					rural_employment = yes
					NOT = { is_pop_type = aristocrats }
					NOT = { is_pop_type = clergymen }
					owner = {
						has_law = law_type:law_monarchy
						ig:ig_petty_bourgeoisie = {
							leader = {
								has_ideology = ideology:ideology_bonapartist
							}
						}
					}
					pop_acceptance >= acceptance_status_3
				}
				value = 0.75
			}
		}		
		
		multiply = {
			desc = "ideology_bonapartist"
			value = 1.0

			if = {
				limit = {
					rural_employment = yes
					NOT = { is_pop_type = aristocrats }
					NOT = { is_pop_type = clergymen }
					owner = {
						NOT = { has_law = law_type:law_monarchy }
						ig:ig_petty_bourgeoisie = {
							leader = {
								has_ideology = ideology:ideology_bonapartist
							}
						}
					}
					pop_acceptance >= acceptance_status_3
				}
				value = 0.5
			}
		}

		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_state_atheism
				}
			}
			multiply = {
				desc = "STATE_ATHEISM_LAW"
				value = 1.25
			}
		}

		add = {
			desc = "STATE_ATHEISM_LAW"
			if = {
				limit = {
					NOT = {
						has_pop_religion = atheist
					}
					owner = {
						country_has_state_religion = rel:atheist
					}
				}
				value = 100
			}
		}

		add = { #WTF french peasants supports legitimists that much?
			desc = "ideology_legitimist"
			if = {
				limit = { 
					OR = {
						is_pop_type = farmers
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							leader = {
								has_ideology = ideology:ideology_legitimist
							}
						}
					}
				}
				value = -25
			}
		}

		add = {
			desc = "ideology_legitimist"
			if = {
				limit = { 
					is_pop_type = aristocrats
					owner = {
						ig:ig_devout = {
							leader = {
								has_ideology = ideology:ideology_legitimist
							}
						}
					}
				}
				value = 40
			}
		}

		add = { #clergymen are not necessary absolutists lovers
			desc = "ideology_legitimist"
			if = {
				limit = { 
					is_pop_type = clergymen
					owner = {
						ig:ig_devout = {
							leader = {
								has_ideology = ideology:ideology_legitimist
							}
						}
					}
				}
				value = -100
			}
		}

		add = {
			desc = "ideology_confucian"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_confucian
						}
					}
				}
				value = 50
			}
		}

		add = {
			desc = "ideology_russian_patriarch"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_russian_patriarch
						}
					}
				}
				value = 25
			}
		}

		add = {
			desc = "ideology_orthodox_patriarch"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_orthodox_patriarch
						}
					}
				}
				value = 25
			}
		}

		add = {
			desc = "ideology_hindu_moralist"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_hindu_moralist
						}
					}
				}
				value = 50
			}
		}

		add = {
			desc = "ideology_sikh_moralist"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_sikh_moralist
						}
					}
				}
				value = 50
			}
		}

		add = {
			desc = "ideology_oriental_orthodox_patriarch"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_oriental_orthodox_patriarch
						}
					}
				}
				value = 50
			}
		}

		add = {
			desc = "ideology_heavenly_kingdom_theocratic"
			if = {
				limit = { 
					OR = {
						is_pop_type = aristocrats
						is_pop_type = clergymen
						is_pop_type = peasants
					}
					owner = {
						ig:ig_devout = {
							has_ideology = ideology:ideology_heavenly_kingdom_theocratic
						}
					}
				}
				value = 100
			}
		}

		add = {
			desc = "ideology_abolitionist"
			if = {
				limit = {
					state = { 
						is_slave_state = yes
					}
					is_pop_type = aristocrats
					owner = {
						ig:ig_devout = {
							leader = {
								has_ideology = ideology:ideology_abolitionist
							}
						}
					}
				}
				value = -50
			}
		}
		
		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_state_religion
				}
			}
			multiply = {
				desc = "STATE_RELIGION_LAW"
				value = 1.5
			}
		}

		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_freedom_of_conscience
				}
			}
			multiply = {
				desc = "FREEDOM_OF_CONSCIENCE_LAW"
				value = 1.25
			}
		}

		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_religious_schools
				}
			}
			multiply = {
				desc = "RELIGIOUS_SCHOOLS_LAW"
				value = owner.institution:institution_schools.investment
				divide = 10
				add = 1
			}
		}

		if = {
			limit = {
				owner = {
					has_technology_researched = corporatism
					NOT = {
						has_law_or_variant = law_type:law_total_separation
						has_law_or_variant = law_type:law_state_atheism
					}
				}
			}
			multiply = {
				desc = "CORPORATISM_TECH"
				value = 1.25
			}
		}
		
		add = {
			desc = "POP_LITERACY"
			
			if = {
				limit = { 
					literacy_rate >= 0.50
					NOR = { 
						is_pop_type = clergymen
						is_pop_type = aristocrats
						is_pop_type = capitalists
						rural_employment = yes
					}
				}
				value = literacy_rate
				subtract = 0.5
				multiply = -50
				min = -25
			}
		}
		

		add = {
			desc = "POP_LITERACY"
			
			if = {
				limit = { 
					rural_employment = yes
					NOT = {
						is_pop_type = clergymen
						is_pop_type = aristocrats
						is_pop_type = capitalists
					}
				}
				this = {
				value = literacy_rate
				multiply = -25
				min = -25
			}
			}
		}

		multiply = {
			desc = "law_womens_suffrage"
			value = 1.0
			if = {
				limit = {
					owner = {
						has_law = law_type:law_womens_suffrage
					}
				}
				value = 1.1
			}
		}		

		multiply = {
			desc = "law_total_separation"
			value = 1.0
			if = {
				limit = {
					owner = {
						has_law = law_type:law_total_separation
					}
				}
				value = 1.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
			}
		}
		
		multiply = {
			desc = "IG_IS_MARGINALIZED"
			value = 1.0
			
			scope:interest_group ?= {
				if = {
					limit = {
						ig_counts_as_marginal = yes
					}
					value = 0.75
				}
			}
		}					
	}

	monarch_weight = {
		value = 1.0
		# Monarch is not likely to adopt a marginal IG
		if = {
			limit = {
				ig_counts_as_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 State Religion
		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_state_religion
				}
			}
			multiply = {
				value = 2
			}
		}
		# Less likely without State Religion
		if = {
			limit = {
				owner = {
					NOT = { has_law_or_variant = law_type:law_state_religion }
				}
			}
			multiply = {
				value = 0.25
			}
		}
		# Basically impossible with State Atheism
		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_state_atheism
				}
			}
			multiply = {
				value = 0
			}
		}
		# Muslims and Theravada more likely to adopt Devout
		if = {
			limit = {
				OR = {
					owner.religion = rel:sunni
					owner.religion = rel:shiite
					owner.religion = rel:ibadi
					owner.religion = rel:theravada
				}
			}
			multiply = 2
		}
	}

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

	commander_weight = {
		value = 1.0
	}
	
	magnate_weight = {
		value = 1.0
	}

	executive_weight = {
		value = 1.0

		# The company owning BIC should not get non-industrialist executives
		if = {
			limit = {
				exists = scope:company
				exists = c:BIC
				c:BIC ?= {
					exists = owning_company
					owning_company = scope:company
				}
			}
			multiply = {
				value = 0
			}
		}
	}

	noble_chance = {
		value = 0.5
	}

	female_commander_chance = {
		value = 0.0
	}

	female_executive_chance = {
		value = 0.0
	}

	female_monarch_chance = {
		value = 0.05
	}

	female_politician_chance = {
		value = 0.0

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

			}
			add = {
				value = 0.01
			}
		}
	}

	female_agitator_chance = {
		value = 0.01

		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_women_own_property
				}

			}
			add = {
				value = 0.01
			}
		}

		if = {
			limit = {
				owner = {
					has_law_or_variant = law_type:law_women_in_the_workplace
				}

			}
			add = {
				value = 0.01
			}
		}

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

			}
			add = {
				value = 0.01
			}
		}
	}

	# Multiplier applied to the weight for an appropriate commander will be selected from the character pool to lead the IG
	# root = interest group
	commander_leader_weight = {
		value = 0.5
	}

	# Multiplier applied to the weight for an appropriate magnate will be selected from the character pool to lead the IG
	# root = interest group
	magnate_leader_weight = {
		value = 1.0
		if = {
			limit = {
				c:JAP ?= owner
				NOT = {
					has_variable = japan_restoration_complete
				}
			}
			add = 5
		}
	}

	# Multiplier applied to the weight for an appropriate executive will be selected from the character pool to lead the IG
	# root = interest group
	executive_leader_weight = {
		value = 0.25
	}
}
