######################################################################
# Valid arguments:
#
# area = [nation/culture/nation_culture/nation_religion/religion/all]
# government = [monarchy/republic/theocracy/anti/any]
# defection = [culture/culture_group/religion/any/none]
# independence = [culture/culture_group/religion/colonial/any/none]
# gfx_type = [culture_province/culture_owner]
#
######################################################################

# All rebels in province scope

# For siege_won_trigger, siege_won_effect
# FROM = owner
# ROOT = province

# For Other
# FROM = owner
# ROOT = Homecountry


######################################################################
# Celtic reformed rebels. Disgruntled fanatics.
######################################################################
celtic_pagan_reformed_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = celtic_pagan_reformed
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = yes
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = celtic_pagan_reformed }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = celtic_pagan_reformed
			owner = { religion = celtic_pagan_reformed }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = celtic_pagan_reformed }
			any_neighbor_province = {
	 			religion = celtic_pagan_reformed
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				NOT = { religion = celtic_pagan_reformed }
				OR = {
					any_neighbor_province = {
						religion = celtic_pagan_reformed
						NOT = { has_province_modifier = "forced_conversion" }
					}
					owner = {
						NOT = {
							any_owned_province = {
								religion = celtic_pagan_reformed
							}
						}
					}
				}
			}
			change_religion = celtic_pagan_reformed
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = celtic_pagan_reformed }
				NOT = {
					OR = {
						any_neighbor_province = {
							religion = celtic_pagan_reformed
							NOT = { has_province_modifier = "forced_conversion" }
						}
						owner = {
							NOT = {
								any_owned_province = {
									religion = celtic_pagan_reformed
								}
							}
						}
					}
				}
			}
			add_province_modifier = {
				name = "religious_massacre"
				duration = 730
			}
		}
		if = {
			limit = {
				religion = celtic_pagan_reformed
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion = celtic_pagan_reformed }
			}
			change_religion = celtic_pagan_reformed
			force_converted = yes
		}
		if = {
			limit = {
				religion = celtic_pagan_reformed
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Kemetic reformed rebels. Disgruntled fanatics.
######################################################################
egyptian_pagan_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = egyptian_pagan
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = yes
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = egyptian_pagan }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = egyptian_pagan
			owner = { religion = egyptian_pagan }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = egyptian_pagan }
			any_neighbor_province = {
	 			religion = egyptian_pagan
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				NOT = { religion = egyptian_pagan }
				OR = {
					any_neighbor_province = {
						religion = egyptian_pagan
						NOT = { has_province_modifier = "forced_conversion" }
					}
					owner = {
						NOT = {
							any_owned_province = {
								religion = egyptian_pagan
							}
						}
					}
				}
			}
			change_religion = egyptian_pagan
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = egyptian_pagan }
				NOT = {
					OR = {
						any_neighbor_province = {
							religion = egyptian_pagan
							NOT = { has_province_modifier = "forced_conversion" }
						}
						owner = {
							NOT = {
								any_owned_province = {
									religion = egyptian_pagan
								}
							}
						}
					}
				}
			}
			add_province_modifier = {
				name = "religious_massacre"
				duration = 730
			}
		}
		if = {
			limit = {
				religion = egyptian_pagan
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion = egyptian_pagan }
			}
			change_religion = egyptian_pagan
			force_converted = yes
		}
		if = {
			limit = {
				religion = egyptian_pagan
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Urglaawe rebels. Disgruntled fanatics.
######################################################################
german_pagan_reformed_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = german_pagan_reformed
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = german_pagan_reformed }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = german_pagan_reformed
			owner = { religion = german_pagan_reformed }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = german_pagan_reformed }
			any_neighbor_province = {
	 			religion = german_pagan_reformed
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = german_pagan_reformed
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = german_pagan_reformed }
			}
			change_religion = german_pagan_reformed
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = german_pagan_reformed
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = german_pagan_reformed }
				dominant_religion = german_pagan_reformed
				NOT = { tag = PAP }
			}
			change_religion = german_pagan_reformed
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = german_pagan_reformed }
				NOT = { dominant_religion = german_pagan_reformed }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Mandaean rebels. Disgruntled fanatics.
######################################################################
mandaean_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = mandaean
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = mandaean }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = mandaean
			owner = { religion = mandaean }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = mandaean }
			any_neighbor_province = {
	 			religion = mandaean
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = mandaean
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = mandaean }
			}
			change_religion = mandaean
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = mandaean
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = mandaean }
				dominant_religion = mandaean
				NOT = { tag = PAP }
			}
			change_religion = mandaean
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = mandaean }
				NOT = { dominant_religion = mandaean }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Zurvanist rebels. Disgruntled fanatics.
######################################################################
zurvanist_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = zurvanist
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = zurvanist }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = zurvanist
			owner = { religion = zurvanist }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = zurvanist }
			any_neighbor_province = {
	 			religion = zurvanist
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = zurvanist
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = zurvanist }
			}
			change_religion = zurvanist
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = zurvanist
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = zurvanist }
				dominant_religion = zurvanist
				NOT = { tag = PAP }
			}
			change_religion = zurvanist
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = zurvanist }
				NOT = { dominant_religion = zurvanist }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Apostolic rebels. Disgruntled fanatics.
######################################################################
apostolic_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = apostolic
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = apostolic }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = apostolic
			owner = { religion = apostolic }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = apostolic }
			any_neighbor_province = {
	 			religion = apostolic
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = apostolic
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = apostolic }
			}
			change_religion = apostolic
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = apostolic
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = apostolic
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = apostolic }
				dominant_religion = apostolic
				NOT = { tag = PAP }
			}
			change_religion = apostolic
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = apostolic }
				NOT = { dominant_religion = apostolic }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Tamazight rebels. Disgruntled fanatics.
######################################################################
berber_pagan_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = berber_pagan
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = berber_pagan }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = berber_pagan
			owner = { religion = berber_pagan }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = berber_pagan }
			any_neighbor_province = {
	 			religion = berber_pagan
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = berber_pagan
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = berber_pagan }
			}
			change_religion = berber_pagan
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = berber_pagan
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = berber_pagan
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = berber_pagan }
				dominant_religion = berber_pagan
				NOT = { tag = PAP }
			}
			change_religion = berber_pagan
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = berber_pagan }
				NOT = { dominant_religion = berber_pagan }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Meccan rebels. Disgruntled fanatics.
######################################################################
arab_pagan_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = arab_pagan
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = arab_pagan }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = arab_pagan
			owner = { religion = arab_pagan }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = arab_pagan }
			any_neighbor_province = {
	 			religion = arab_pagan
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = arab_pagan
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = arab_pagan }
			}
			change_religion = arab_pagan
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = arab_pagan
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = arab_pagan
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = arab_pagan }
				dominant_religion = arab_pagan
				NOT = { tag = PAP }
			}
			change_religion = arab_pagan
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = arab_pagan }
				NOT = { dominant_religion = arab_pagan }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Canaanite rebels. Disgruntled fanatics.
######################################################################
jewish_pagan_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = jewish_pagan
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = jewish_pagan }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = jewish_pagan
			owner = { religion = jewish_pagan }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = jewish_pagan }
			any_neighbor_province = {
	 			religion = jewish_pagan
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = jewish_pagan
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = jewish_pagan }
			}
			change_religion = jewish_pagan
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = jewish_pagan
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = jewish_pagan
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = jewish_pagan }
				dominant_religion = jewish_pagan
				NOT = { tag = PAP }
			}
			change_religion = jewish_pagan
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = jewish_pagan }
				NOT = { dominant_religion = jewish_pagan }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

nestorian_mod_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = nestorian_mod
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = nestorian_mod }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = nestorian_mod
			owner = { religion = nestorian_mod }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = nestorian_mod }
			any_neighbor_province = {
	 			religion = nestorian_mod
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = nestorian_mod
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = nestorian_mod }
			}
			change_religion = nestorian_mod
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = christian
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
			every_owned_province = {
				limit = {
					has_rebel_faction = REB
				}
				add_local_autonomy = 20
			}
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = nestorian_mod
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				religion_group = christian
				NOT = { religion = nestorian_mod }
			}
			change_religion = nestorian_mod
			force_converted = yes
		}
	}
}

messalian_mod_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = messalian_mod
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = messalian_mod }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = messalian_mod
			owner = { religion = messalian_mod }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = messalian_mod }
			any_neighbor_province = {
	 			religion = messalian_mod
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = messalian_mod
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = messalian_mod }
			}
			change_religion = messalian_mod
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = christian
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
			every_owned_province = {
				limit = {
					has_rebel_faction = REB
				}
				add_local_autonomy = 20
			}
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = messalian_mod
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				religion_group = christian
				NOT = { religion = messalian_mod }
			}
			change_religion = messalian_mod
			force_converted = yes
		}
	}
}

######################################################################
# Atenic reformed rebels. Disgruntled fanatics.
######################################################################
egyptian_pagan_heresy_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = egyptian_pagan_heresy
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = yes
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = egyptian_pagan_heresy }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = egyptian_pagan_heresy
			owner = { religion = egyptian_pagan_heresy }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = egyptian_pagan_heresy }
			any_neighbor_province = {
	 			religion = egyptian_pagan_heresy
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				NOT = { religion = egyptian_pagan_heresy }
				OR = {
					any_neighbor_province = {
						religion = egyptian_pagan_heresy
						NOT = { has_province_modifier = "forced_conversion" }
					}
					owner = {
						NOT = {
							any_owned_province = {
								religion = egyptian_pagan_heresy
							}
						}
					}
				}
			}
			change_religion = egyptian_pagan_heresy
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = egyptian_pagan_heresy }
				NOT = {
					OR = {
						any_neighbor_province = {
							religion = egyptian_pagan_heresy
							NOT = { has_province_modifier = "forced_conversion" }
						}
						owner = {
							NOT = {
								any_owned_province = {
									religion = egyptian_pagan_heresy
								}
							}
						}
					}
				}
			}
			add_province_modifier = {
				name = "religious_massacre"
				duration = 730
			}
		}
		if = {
			limit = {
				religion = egyptian_pagan_heresy
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		religion_group = pagan
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion = egyptian_pagan_heresy }
			}
			change_religion = egyptian_pagan_heresy
			force_converted = yes
		}
		if = {
			limit = {
				religion = egyptian_pagan_heresy
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Apostolic Heresy rebels. Disgruntled fanatics.
######################################################################
apostolic_heresy_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = apostolic_heresy
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = apostolic_heresy }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = apostolic_heresy
			owner = { religion = apostolic_heresy }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = apostolic_heresy }
			any_neighbor_province = {
	 			religion = apostolic_heresy
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = apostolic_heresy
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = apostolic_heresy }
			}
			change_religion = apostolic_heresy
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = apostolic_heresy
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = apostolic_heresy
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = apostolic_heresy }
				dominant_religion = apostolic_heresy
				NOT = { tag = PAP }
			}
			change_religion = apostolic_heresy
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = apostolic_heresy }
				NOT = { dominant_religion = apostolic_heresy }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}

######################################################################
# Chalcedonian rebels. Disgruntled fanatics.
######################################################################
chalcedonian_rebels = {

	area = nation 					# Sticks to provinces of their nation
	government = theocracy 			# Desires Theocracy
	religion = chalcedonian
	defection = religion			# Defects to countries of their religion
	defect_delay = 120				# Held provinces will auto-defect after 18 months, regardless of accept/enforce demands.
	independence = none				# Does not strive for independence
	unit_transfer = yes
	gfx_type = culture_province
	
	resilient = no
	reinforcing = yes
	general = yes
	smart = yes
	
	artillery = 0.0
	infantry = 0.7
	cavalry = 0.3
	
	morale = 1.1

	# Possible handle actions
	handle_action_negotiate = yes
	handle_action_stability = yes
	handle_action_build_core = yes
	handle_action_send_missionary = yes		
	
	# The rebel type with the highest modifier for this province gets picked
	spawn_chance = {
		factor = 1
		modifier = {
			factor = 0.5
			is_overseas = yes
		}
		modifier = {
			factor = 0.0
			owner = { religion = ROOT }
		}
		modifier = {
			factor = 0.0
			NOT = { religion = chalcedonian }
		}
		modifier = {
			factor = 0.001
			tolerance_to_this = 5
		}
		modifier = {
			factor = 0.5
			tolerance_to_this = 2
		}
		modifier = {
			factor = 5.0
			owner = { has_country_flag = religious_turmoil }
		}		
		modifier = {
			factor = 2000
			has_missionary = yes
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = 1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -1 }
		}
		modifier = {
			factor = 2
			NOT = { tolerance_to_this = -2 }
		}
	}
 
 	# This is checked for EACH province in the Area of Operations
	movement_evaluation = {
		factor = 1
		modifier = {
			factor = 0.5
			units_in_province = 1
		}
		modifier = {
			factor = 0.001
			controlled_by = REB
		}
		modifier = {
			factor = 0.0
			religion = chalcedonian
			owner = { religion = chalcedonian }
		}
		modifier = {
			factor = 2.0
			NOT = { religion = chalcedonian }
			any_neighbor_province = {
	 			religion = chalcedonian
	 			NOT = { has_province_modifier = "forced_conversion" }
	 		}
	 	}
		modifier = {
			factor = 1.5
			unrest = 2
		}
		modifier = {
			factor = 1.5
			unrest = 4
		}
		modifier = {
			factor = 1.5
			unrest = 6
		}
	}
 
 	# Province Scope
 	siege_won_trigger = {
		NOT = {
			AND = {
				owned_by = PAP
				is_capital = yes
			}
		}
 	}
	siege_won_effect = {
		if = {
			limit = {
				religion = chalcedonian
			}
			add_province_modifier = {
				name = "religious_violence"
				duration = 730
			}
		}
		if = {
			limit = {
				NOT = { religion = chalcedonian }
			}
			change_religion = chalcedonian
			add_province_modifier = {
				name = "forced_conversion"
				duration = 730
			}
		}
	}
	
	# Country scope
	can_negotiate_trigger = {
		
		OR = {
			religion_group = christian
			dominant_religion = chalcedonian
		}
	}
	
	# Country scope
	can_enforce_trigger = {
		always = yes
	}	
	
	# Localisation for their demands
	demands_description = "generic_religious_rebels_demand"
	
	# Country Scope	
	demands_enforced_effect = {
		if = {
			limit = {
				NOT = { religion_group = christian }
			}
			add_prestige = -50
		}
		if = {
			limit = {
				tag = PAP
			}
			add_stability = -1
		}
		if = {
			limit = {
				religion = chalcedonian
			}
			add_country_modifier = {
				name = "religious_intolerance"
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { religion = chalcedonian }
				dominant_religion = chalcedonian
				NOT = { tag = PAP }
			}
			change_religion = chalcedonian
			force_converted = yes
		}
		if = {
			limit = {
				NOT = { religion = chalcedonian }
				NOT = { dominant_religion = chalcedonian }
				NOT = { tag = PAP }
				religion_group = christian
			}
			add_country_modifier = {
				name = "heretic_tolerance"
				duration = 3650
			}
		}
	}
}