###MONASTIC ORDER###
monastic_order_apostolic = {
	primary_attribute = learning
	is_religious = yes
	opinion_to_other_members = +10
	opinion_per_rank_above = +5
	sound = monastic_orders_interface
	society_ranks_gfx = monk_ranks
	non_interference = {
		always = yes
	}
	
	active = {
		has_dlc = "Mystics"
	}
	indestructible = yes
    
	can_join_society = {
		hidden_trigger = {
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = monastic_order_apostolic
					rank = 1
				}
			}
		}
		age = 16
		OR = {
			is_female = no
			has_game_rule = {
				name = gender
				value = all
			}
			has_game_rule = {
				name = gender
				value = plus
			}
		}
		OR = {
			religion = apostolic
			AND = {
				is_heretic = no
				religion = paulician
			}
		}
		NOT = { trait = excommunicated }
		custom_tooltip = {
			text = did_not_betray_society
			NOT = { has_character_flag = betrayed_monastic_order_apostolic }
		}
	}

	show_society = {
		OR = {
			religion = apostolic
			AND = {
				is_heretic = no
				religion = paulician
			}
		}
		OR = {
			is_female = no
			has_game_rule = {
				name = gender
				value = all
			}
			has_game_rule = {
				name = gender
				value = plus
			}
		}
	}

	potential = {
		OR = {
			religion = apostolic
			AND = {
				religion = paulician
				is_heretic = no
			}
		}
		OR = {
			is_female = no
			has_game_rule = {
				name = gender
				value = all
			}
			has_game_rule = {
				name = gender
				value = plus
			}
		}
	}

	society_rank = {
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_piety = 0.05
			fertility = -0.15
		}
		custom_tooltip = monastic_order_education_power_tt
	}
	
	society_rank = {
		level = 2
		limit = 20
		startup_limit = 6
		modifier = { 
			monthly_character_piety = 0.1
			learning = 1
			fertility = -0.15
		}
		decisions = {
			monastic_orders_go_celibate #Power: toggle celibacy
			monastic_orders_stop_celibate
		}
	}
	
	society_rank = {
		level = 3
		limit = 10 
		startup_limit = 3
		modifier = {
			monthly_character_piety = 0.2
			learning = 2
			build_cost_temple_modifier = -0.25
			fertility = -0.15
		}
		decisions = {
			monastic_orders_invite_ascetic

		}
	}

	society_rank = { #todo add counselling power
		level = 4
		limit = 5
		startup_limit = 1
		modifier = { 
			monthly_character_piety = 0.5
			temple_vassal_tax_modifier = 0.1
			build_cost_temple_modifier = -0.5
			learning = 3
			fertility = -0.15
		}
	}

	monthly_currency_gain = {
		name = currency_name_monastic_order_apostolic
		
		per_attribute = {
    		name = learning
    		value = 0.5
    	}
    	
		has_trait = {
			trait = paragon
			value = 5
		}
    	has_trait = {
			trait = monk
			value = 5
		}
		has_trait = {
			trait = nun
			value = 5
		}
		has_trait = {
			trait = celibate
			value = 2
		}
		has_trait = {
			trait = diligent
			value = 1
		}
    	has_trait = {
			trait = chaste
			value = 1
		}
		has_trait = {
			trait = temperate
			value = 1
		}
		has_trait = {
			trait = charitable
			value = 1
		}
		has_trait = {
			trait = kind
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = honest
			value = 1
		}
		has_trait = {
			trait = erudite
			value = 1
		}
		has_trait = {
			trait = pilgrim
			value = 1
		}
		has_trait = {
			trait = scholar
			value = 1
		}
		has_trait = {
			trait = theologian
			value = 1
		}
		has_trait = {
			trait = zealous
			value = 1
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			is_priest = yes
			factor = 10
		}
		modifier = {
			trait = monk
			factor = 5
		}
		modifier = {
			trait = nun
			factor = 5
		}
		modifier = {
			trait = scholar
			factor = 1.3
		}
		modifier = {
			trait = theologian
			factor = 1.3
		}
		modifier = {
			trait = celibate
			factor = 1.2
		}
		modifier = {
			trait = diligent
			factor = 1.2
		}
    	modifier = {
			trait = chaste
			factor = 1.1
		}
		modifier = {
			trait = temperate
			factor = 1.1
		}
		modifier = {
			trait = charitable
			factor = 1.1
		}
		modifier = {
			trait = kind
			factor = 1.1
		}
		modifier = {
			trait = patient
			factor = 1.1
		}
		modifier = {
			trait = humble
			factor = 1.1
		}
		modifier = {
			trait = honest
			factor = 1.1
		}
		modifier = {
			trait = erudite
			factor = 1.1
		}
		modifier = {
			trait = pilgrim
			factor = 1.1
		}
		modifier = {
			trait = zealous
			factor = 1.1
		}
	}
	
	startup_populate = {
	    trigger = {
			ai = yes
			controls_religion = no
			religion = apostolic
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
			NOT = { trait = cynical }
			NOT = { trait = excommunicated }
			has_secret_religion_trait_trigger = no
			OR = {
				trait = zealous
				trait = scholar
				trait = theologian
				trait = monk
				trait = nun
				learning = 16
				is_priest = yes
			}
			OR = {
				is_female = no
				has_game_rule = {
					name = gender
					value = all
				}
				has_game_rule = {
					name = gender
					value = plus
				}
			}
		}
	}
}

###DEVIL WORSHIPERS###
the_cult_of_balor = {
	primary_attribute = intrigue
	is_secret = yes
	criminal = yes
	devil_worshipper = yes
	opinion_to_other_members = +5
	opinion_to_pretenders = -40			#Pretenders is the opinion you have of people perceived/discovered to be in your society.
	opinion_to_perceived_members = -40	#Perceived is the opinion you have of people perceived/discovered to be of a society you're not part of
	opinion_per_rank_above = +10
	sound = devil_worshippers_interface
	society_ranks_gfx = devil_ranks
	
	active = {
		has_dlc = "Mystics"
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = the_cult_of_balor
					rank = 1
				}
			}
		}
		has_cult_of_balor_prerequisites = yes
	}
	
	show_society = {
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
		age = 16
		OR = {
			religion = celtic_pagan
			religion = celtic_pagan_reformed
			secret_religion = celtic_pagan
			secret_religion = celtic_pagan_reformed
			society_member_of = the_cult_of_balor
		}
	}
	
	society_rank = {
		level = 1
		limit = 30 
		startup_limit = 6
		decisions = {
			decision_abduct
			prisoner_dark_sacrifice #Available Decision: Sacrifice Prisoner
			#Over time, lose virtues, gain vices. A Soul Corruption-effect is on a yearly pulse (with a chance to do nothing)
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_2;
	}
	
	society_rank = { 
		level = 2
		limit = 15
		startup_limit = 4
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = the_cult_of_balor
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 1
		}
		decisions = {
			devil_worshipers_summon_familiar #Available Power: Summon Familiar
			the_devil_worshipers_tainted_touch #Available Power: Curse people with disease
			devil_worshipers_demonic_possession #Available Power: Possess someone to make fanatically loyal
			#Available Power: Abduction plot
			#unlock new options in Seduction and Spy On?
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_3;
	}
	
	society_rank = {
		level = 3
		limit = 5 
		startup_limit = 2
		modifier = {
			is_visible = {
				OR = {
					society_member_of = the_cult_of_balor
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 2
		}
		decisions = {
			devil_worshipers_dark_divorce #Available Power: Dark Divorce
			devil_worshipers_dark_healing #Available Power: Demonic Healing. Sacrifice a prisoner to heal a random illness or maiming.
			devil_worshipers_invite_disciple_of_devil #Available Decision: Invite a witch to court
			#Available Power: Love Potion
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_4;
	}

	society_rank = {
		level = 4
		limit = 1 
		startup_limit = 1
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = the_cult_of_balor
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 3
		}
		decisions = {
			DW_prolong_life #Available Power: Prolong Life
			DW_demonic_impregnation #Available power: Unholy Impregnation
		}
		obedience_tooltip = obedience_tooltip #this can be unique per rank/society 
		obedient = {
			ROOT = {
				always = yes
			}
		}
	}

	plots = {
		plot1_tag
		plot2_tag
	}
    
	ambitions = {
		ambition1_tag
		ambition2_tag
	}

	monthly_currency_gain = {
		name = currency_name_the_cult_of_balor
    
		per_attribute = {
			name = intrigue
			value = 0.5
		}
		has_trait = {
			trait = ambitious
			value = 5
		}
		has_trait = {
			trait = genius
			value = 4
		}
		has_trait = {
			trait = quick
			value = 3
		}
		has_trait = {
			trait = shrewd
			value = 3
		}
		has_trait = {
			trait = hedonist
			value = 3
		}
		has_trait = {
			trait = mystic
			value = 3
		}
		has_trait = {
			trait = seducer
			value = 3
		}
		has_trait = {
			trait = seductress
			value = 3
		}
		has_trait = {
			trait = schemer
			value = 3
		}
		has_trait = {
			trait = impaler
			value = 3
		}
		has_trait = {
			trait = lustful
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = greedy
			value = 1
		}
		has_trait = {
			trait = deceitful
			value = 1
		}
		has_trait = {
			trait = arbitrary
			value = 1
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			trait = ambitious
			factor = 1.5
		}
		modifier = {
			trait = genius
			factor = 1.3
		}
		modifier = {
			trait = quick
			factor = 1.3
		}
		modifier = {
			trait = shrewd
			factor = 1.3
		}
		modifier = {
			trait = hedonist
			factor = 1.3
		}
		modifier = {
			trait = mystic
			factor = 1.3
		}
		modifier = {
			trait = seducer
			factor = 1.3
		}
		modifier = {
			trait = seductress
			factor = 1.3
		}
		modifier = {
			trait = schemer
			factor = 1.3
		}
		modifier = {
			trait = impaler
			factor = 1.3
		}
		modifier = {
			trait = lustful
			factor = 1.1
		}
		modifier = {
			trait = proud
			factor = 1.1
		}
		modifier = {
			trait = greedy
			factor = 1.1
		}
		modifier = {
			trait = deceitful
			factor = 1.1
		}
		modifier = {
			trait = arbitrary
			factor = 1.1
		}
	}
	
	startup_populate = {
	    trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			ai = yes
	    	controls_religion = no 
	    	OR = {
		    	true_religion_celtic_pagan_trigger = yes
				true_religion_celtic_pagan_reformed_trigger = yes
	    	}
			OR = {
				has_impious_trait_trigger = yes
				has_vice_trigger = yes
				trait = drunkard
				trait = possessed
				trait = lunatic
			}
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
		}
	}
}

###DEVIL WORSHIPERS###
cult_of_angra_mainyu = { # Aka Cult of the Destroyer
	primary_attribute = intrigue
	is_secret = yes
	criminal = yes
	devil_worshipper = yes
	opinion_to_other_members = +5
	opinion_to_pretenders = -40			#Pretenders is the opinion you have of people perceived/discovered to be in your society.
	opinion_to_perceived_members = -40	#Perceived is the opinion you have of people perceived/discovered to be of a society you're not part of
	opinion_per_rank_above = +10
	sound = devil_worshippers_interface
	society_ranks_gfx = devil_ranks
	
	active = {
		has_dlc = "Mystics"
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = cult_of_angra_mainyu
					rank = 1
				}
			}
		}
		has_cult_of_angra_mainyu_prerequisites = yes
	}
	
	show_society = {
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
		age = 16
		OR = {
			AND = {
				true_religion_yazidi_trigger = no
				true_religion_group_zoroastrian_group_trigger = yes
			}
			society_member_of = cult_of_angra_mainyu
		}
	}
	
	society_rank = {
		level = 1
		limit = 30 
		startup_limit = 6
		decisions = {
			decision_abduct
			prisoner_dark_sacrifice #Available Decision: Sacrifice Prisoner
			#Over time, lose virtues, gain vices. A Soul Corruption-effect is on a yearly pulse (with a chance to do nothing)
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_2;
	}
	
	society_rank = { 
		level = 2
		limit = 15
		startup_limit = 4
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_angra_mainyu
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 1
		}
		decisions = {
			devil_worshipers_summon_familiar #Available Power: Summon Familiar
			the_devil_worshipers_tainted_touch #Available Power: Curse people with disease
			devil_worshipers_demonic_possession #Available Power: Possess someone to make fanatically loyal
			#Available Power: Abduction plot
			#unlock new options in Seduction and Spy On?
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_3;
	}
	
	society_rank = {
		level = 3
		limit = 5 
		startup_limit = 2
		modifier = {
			is_visible = {
				OR = {
					society_member_of = cult_of_angra_mainyu
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 2
		}
		decisions = {
			devil_worshipers_dark_divorce #Available Power: Dark Divorce
			devil_worshipers_dark_healing #Available Power: Demonic Healing. Sacrifice a prisoner to heal a random illness or maiming.
			devil_worshipers_invite_disciple_of_devil #Available Decision: Invite a witch to court
			#Available Power: Love Potion
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_4;
	}

	society_rank = {
		level = 4
		limit = 1 
		startup_limit = 1
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_angra_mainyu
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 3
		}
		decisions = {
			DW_prolong_life #Available Power: Prolong Life
			DW_demonic_impregnation #Available power: Unholy Impregnation
		}
		obedience_tooltip = obedience_tooltip #this can be unique per rank/society 
		obedient = {
			ROOT = {
				always = yes
			}
		}
	}

	plots = {
		plot1_tag
		plot2_tag
	}
    
	ambitions = {
		ambition1_tag
		ambition2_tag
	}

	monthly_currency_gain = {
		name = currency_name_cult_of_angra_mainyu
    
		per_attribute = {
			name = intrigue
			value = 0.5
		}
		has_trait = {
			trait = ambitious
			value = 5
		}
		has_trait = {
			trait = genius
			value = 4
		}
		has_trait = {
			trait = quick
			value = 3
		}
		has_trait = {
			trait = shrewd
			value = 3
		}
		has_trait = {
			trait = hedonist
			value = 3
		}
		has_trait = {
			trait = mystic
			value = 3
		}
		has_trait = {
			trait = seducer
			value = 3
		}
		has_trait = {
			trait = seductress
			value = 3
		}
		has_trait = {
			trait = schemer
			value = 3
		}
		has_trait = {
			trait = impaler
			value = 3
		}
		has_trait = {
			trait = lustful
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = greedy
			value = 1
		}
		has_trait = {
			trait = deceitful
			value = 1
		}
		has_trait = {
			trait = arbitrary
			value = 1
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			trait = ambitious
			factor = 1.5
		}
		modifier = {
			trait = genius
			factor = 1.3
		}
		modifier = {
			trait = quick
			factor = 1.3
		}
		modifier = {
			trait = shrewd
			factor = 1.3
		}
		modifier = {
			trait = hedonist
			factor = 1.3
		}
		modifier = {
			trait = mystic
			factor = 1.3
		}
		modifier = {
			trait = seducer
			factor = 1.3
		}
		modifier = {
			trait = seductress
			factor = 1.3
		}
		modifier = {
			trait = schemer
			factor = 1.3
		}
		modifier = {
			trait = impaler
			factor = 1.3
		}
		modifier = {
			trait = lustful
			factor = 1.1
		}
		modifier = {
			trait = proud
			factor = 1.1
		}
		modifier = {
			trait = greedy
			factor = 1.1
		}
		modifier = {
			trait = deceitful
			factor = 1.1
		}
		modifier = {
			trait = arbitrary
			factor = 1.1
		}
	}
	
	startup_populate = {
	    trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			ai = yes
	    	controls_religion = no 
			true_religion_yazidi_trigger = no
			true_religion_group_zoroastrian_group_trigger = yes
			OR = {
				has_impious_trait_trigger = yes
				has_vice_trigger = yes
				trait = drunkard
				trait = possessed
				trait = lunatic
				trait = arbitrary
			}
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
		}
	}
}

arab_jinn_sorcerers = {
	primary_attribute = intrigue
	is_secret = yes
	criminal = yes
	devil_worshipper = yes
	opinion_to_other_members = +5
	opinion_to_pretenders = -40			#Pretenders is the opinion you have of people perceived/discovered to be in your society.
	opinion_to_perceived_members = -40	#Perceived is the opinion you have of people perceived/discovered to be of a society you're not part of
	opinion_per_rank_above = +10
	sound = devil_worshippers_interface
	society_ranks_gfx = devil_ranks
	
	active = {
		has_dlc = "Mystics"
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = arab_jinn_sorcerers
					rank = 1
				}
			}
		}
		has_jinn_sorceror_prerequisites = yes
		hidden_trigger = {
			NOT = { has_character_flag = society_join_block }
		}
	}

	show_society = {
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
		age = 16
		OR = {
			religion_group = muslim
			religion = arab_pagan
			society_member_of = arab_jinn_sorcerers
		}
	}

	potential = { } #no rules

	society_rank = {
		level = 1
		limit = 30 
		startup_limit = 10
		decisions = {
			decision_abduct
			prisoner_dark_sacrifice #Available Decision: Sacrifice Prisoner
			#Over time, lose virtues, gain vices. A Soul Corruption-effect is on a yearly pulse (with a chance to do nothing)
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_2;
	}
	
	society_rank = {
		level = 2
		limit = 15
		startup_limit = 6
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = arab_jinn_sorcerers
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 1
		}
		decisions = {
			devil_worshipers_summon_familiar #Available Power: Summon Familiar
			the_devil_worshipers_tainted_touch #Available Power: Curse people with disease
			devil_worshipers_demonic_possession #Available Power: Possess someone to make fanatically loyal
			#Available Power: Abduction plot
			#unlock new options in Seduction and Spy On?
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_3;
	}
	
	society_rank = {
		level = 3
		limit = 5 
		startup_limit = 3
		modifier = {
			is_visible = {
				OR = {
					society_member_of = arab_jinn_sorcerers
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 2
		}
		decisions = {
			devil_worshipers_dark_divorce #Available Power: Dark Divorce
			devil_worshipers_dark_healing #Available Power: Demonic Healing. Sacrifice a prisoner to heal a random illness or maiming.
			devil_worshipers_invite_disciple_of_devil #Available Decision: Invite a witch to court
			#Available Power: Love Potion
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_4;
	}

	society_rank = {
		level = 4
		limit = 1 
		startup_limit = 1
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = arab_jinn_sorcerers
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 3
		}
		decisions = {
			
			DW_prolong_life #Available Power: Prolong Life
			DW_demonic_impregnation #Available power: Unholy Impregnation
		}
		obedience_tooltip = obedience_tooltip #this can be unique per rank/society 
		obedient = {
			ROOT = {
				always = yes
			}
		}
	}

	plots = {
		plot1_tag
		plot2_tag
	}
    
	ambitions = {
		ambition1_tag
		ambition2_tag
	}

	monthly_currency_gain = {
		name = currency_name_arab_jinn_sorcerers
    
		per_attribute = {
			name = intrigue
			value = 0.5
		}
		has_trait = {
			trait = ambitious
			value = 5
		}
		has_trait = {
			trait = genius
			value = 4
		}
		has_trait = {
			trait = quick
			value = 3
		}
		has_trait = {
			trait = shrewd
			value = 3
		}
		has_trait = {
			trait = hedonist
			value = 3
		}
		has_trait = {
			trait = mystic
			value = 3
		}
		has_trait = {
			trait = seducer
			value = 3
		}
		has_trait = {
			trait = seductress
			value = 3
		}
		has_trait = {
			trait = schemer
			value = 3
		}
		has_trait = {
			trait = impaler
			value = 3
		}
		has_trait = {
			trait = lustful
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = greedy
			value = 1
		}
		has_trait = {
			trait = deceitful
			value = 1
		}
		has_trait = {
			trait = arbitrary
			value = 1
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			trait = ambitious
			factor = 1.5
		}
		modifier = {
			trait = genius
			factor = 1.3
		}
		modifier = {
			trait = quick
			factor = 1.3
		}
		modifier = {
			trait = shrewd
			factor = 1.3
		}
		modifier = {
			trait = hedonist
			factor = 1.3
		}
		modifier = {
			trait = mystic
			factor = 1.3
		}
		modifier = {
			trait = seducer
			factor = 1.3
		}
		modifier = {
			trait = seductress
			factor = 1.3
		}
		modifier = {
			trait = schemer
			factor = 1.3
		}
		modifier = {
			trait = impaler
			factor = 1.3
		}
		modifier = {
			trait = lustful
			factor = 1.1
		}
		modifier = {
			trait = proud
			factor = 1.1
		}
		modifier = {
			trait = greedy
			factor = 1.1
		}
		modifier = {
			trait = deceitful
			factor = 1.1
		}
		modifier = {
			trait = arbitrary
			factor = 1.1
		}
	}
	
	startup_populate = {
		trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			ai = yes
			controls_religion = no
			OR = {
				true_religion_group_muslim_trigger = yes
				true_religion_arab_pagan_trigger = yes
			}
			OR = {
				has_impious_trait_trigger = yes
				has_vice_trigger = yes
				trait = drunkard
				trait = possessed
				trait = lunatic
			}
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
		}
	}
}

cult_of_titan = {
	primary_attribute = intrigue
	is_secret = yes
	criminal = yes
	devil_worshipper = yes
	opinion_to_other_members = +5
	opinion_to_pretenders = -40			#Pretenders is the opinion you have of people perceived/discovered to be in your society.
	opinion_to_perceived_members = -40	#Perceived is the opinion you have of people perceived/discovered to be of a society you're not part of
	opinion_per_rank_above = +10
	sound = devil_worshippers_interface
	society_ranks_gfx = devil_ranks
	
	active = {
		has_dlc = "Mystics"
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = cult_of_titan
					rank = 1
				}
			}
		}
		has_cult_of_titan_prerequisites = yes
		hidden_trigger = {
			NOT = { has_character_flag = society_join_block }
		}
	}

	show_society = {
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
		age = 16
		OR = {
			religion_group = hellenic_pagan_group
			society_member_of = cult_of_titan
		}
	}

	potential = { } #no rules

	society_rank = {
		level = 1
		limit = 30 
		startup_limit = 10
		decisions = {
			decision_abduct
			prisoner_dark_sacrifice #Available Decision: Sacrifice Prisoner
			#Over time, lose virtues, gain vices. A Soul Corruption-effect is on a yearly pulse (with a chance to do nothing)
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_2;
	}
	
	society_rank = {
		level = 2
		limit = 15
		startup_limit = 6
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_titan
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 1
		}
		decisions = {
			devil_worshipers_summon_familiar #Available Power: Summon Familiar
			the_devil_worshipers_tainted_touch #Available Power: Curse people with disease
			devil_worshipers_demonic_possession #Available Power: Possess someone to make fanatically loyal
			#Available Power: Abduction plot
			#unlock new options in Seduction and Spy On?
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_3;
	}
	
	society_rank = {
		level = 3
		limit = 5 
		startup_limit = 3
		modifier = {
			is_visible = {
				OR = {
					society_member_of = cult_of_titan
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 2
		}
		decisions = {
			devil_worshipers_dark_divorce #Available Power: Dark Divorce
			devil_worshipers_dark_healing #Available Power: Demonic Healing. Sacrifice a prisoner to heal a random illness or maiming.
			devil_worshipers_invite_disciple_of_devil #Available Decision: Invite a witch to court
			#Available Power: Love Potion
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_4;
	}

	society_rank = {
		level = 4
		limit = 1 
		startup_limit = 1
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_titan
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 3
		}
		decisions = {
			
			DW_prolong_life #Available Power: Prolong Life
			DW_demonic_impregnation #Available power: Unholy Impregnation
		}
		obedience_tooltip = obedience_tooltip #this can be unique per rank/society 
		obedient = {
			ROOT = {
				always = yes
			}
		}
	}

	plots = {
		plot1_tag
		plot2_tag
	}
    
	ambitions = {
		ambition1_tag
		ambition2_tag
	}

	monthly_currency_gain = {
		name = currency_name_cult_of_titan
    
		per_attribute = {
			name = intrigue
			value = 0.5
		}
		has_trait = {
			trait = ambitious
			value = 5
		}
		has_trait = {
			trait = genius
			value = 4
		}
		has_trait = {
			trait = quick
			value = 3
		}
		has_trait = {
			trait = shrewd
			value = 3
		}
		has_trait = {
			trait = hedonist
			value = 3
		}
		has_trait = {
			trait = mystic
			value = 3
		}
		has_trait = {
			trait = seducer
			value = 3
		}
		has_trait = {
			trait = seductress
			value = 3
		}
		has_trait = {
			trait = schemer
			value = 3
		}
		has_trait = {
			trait = impaler
			value = 3
		}
		has_trait = {
			trait = lustful
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = greedy
			value = 1
		}
		has_trait = {
			trait = deceitful
			value = 1
		}
		has_trait = {
			trait = arbitrary
			value = 1
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			trait = ambitious
			factor = 1.5
		}
		modifier = {
			trait = genius
			factor = 1.3
		}
		modifier = {
			trait = quick
			factor = 1.3
		}
		modifier = {
			trait = shrewd
			factor = 1.3
		}
		modifier = {
			trait = hedonist
			factor = 1.3
		}
		modifier = {
			trait = mystic
			factor = 1.3
		}
		modifier = {
			trait = seducer
			factor = 1.3
		}
		modifier = {
			trait = seductress
			factor = 1.3
		}
		modifier = {
			trait = schemer
			factor = 1.3
		}
		modifier = {
			trait = impaler
			factor = 1.3
		}
		modifier = {
			trait = lustful
			factor = 1.1
		}
		modifier = {
			trait = proud
			factor = 1.1
		}
		modifier = {
			trait = greedy
			factor = 1.1
		}
		modifier = {
			trait = deceitful
			factor = 1.1
		}
		modifier = {
			trait = arbitrary
			factor = 1.1
		}
	}
	
	startup_populate = {
		trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			ai = yes
			controls_religion = no
			true_religion_group_hellenic_pagan_trigger = yes
			OR = {
				has_impious_trait_trigger = yes
				has_vice_trigger = yes
				trait = drunkard
				trait = possessed
				trait = lunatic
			}
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
		}
	}
}

cult_of_apep = { #God of Chaos, tries to devour Ra.
	primary_attribute = intrigue
	is_secret = yes
	criminal = yes
	devil_worshipper = yes
	opinion_to_other_members = +5
	opinion_to_pretenders = -40			#Pretenders is the opinion you have of people perceived/discovered to be in your society.
	opinion_to_perceived_members = -40	#Perceived is the opinion you have of people perceived/discovered to be of a society you're not part of
	opinion_per_rank_above = +10
	sound = devil_worshippers_interface
	society_ranks_gfx = devil_ranks
	
	active = {
		#is this meant as a devil worshiper cult?
		has_dlc = "Mystics"
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = cult_of_apep
					rank = 1
				}
			}
		}
		has_cult_of_apep_prerequisites = yes
		hidden_trigger = {
			NOT = { has_character_flag = society_join_block }
		}
	}
	
	show_society = {
		NOT = {
			has_game_rule = {
				name = devil_worshipers
				value = none
			}
		}
		age = 16
		OR = {
			religion = egyptian_pagan
			secret_religion = egyptian_pagan
			society_member_of = cult_of_apep
		}
	}
	
	
	society_rank = {
		level = 1
		limit = 100 
		startup_limit = 6
		decisions = {
			prisoner_dark_sacrifice #Available Decision: Sacrifice Prisoner
			#Over time, lose virtues, gain vices. A Soul Corruption-effect is on a yearly pulse (with a chance to do nothing)
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_2;
	}
	
	society_rank = { 
		level = 2
		limit = 50
		startup_limit = 4
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_apep
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 1
		}
		decisions = {
			devil_worshipers_summon_familiar #Available Power: Summon Familiar
			the_devil_worshipers_tainted_touch #Available Power: Curse people with disease
			devil_worshipers_demonic_possession #Available Power: Possess someone to make fanatically loyal
			#Available Power: Abduction plot
			#unlock new options in Seduction and Spy On?
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_3;
	}
	
	society_rank = {
		level = 3
		limit = 25 
		startup_limit = 2
		modifier = {
			is_visible = {
				OR = {
					society_member_of = cult_of_apep
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 2
		}
		decisions = {
			devil_worshipers_dark_divorce #Available Power: Dark Divorce
			devil_worshipers_dark_healing #Available Power: Demonic Healing. Sacrifice a prisoner to heal a random illness or maiming.
			devil_worshipers_invite_disciple_of_devil #Available Decision: Invite a witch to court
			#Available Power: Love Potion
		}
		
		#custom_tooltip = unlockable_DW_powers_at_rank_4;
	}

	society_rank = {
		level = 4
		limit = 1 
		startup_limit = 1
		modifier = { 
			is_visible = {
				OR = {
					society_member_of = cult_of_apep
					FROM = { is_society_discovered = yes }
				}
			}
			intrigue = 3
		}
		decisions = {
			DW_prolong_life #Available Power: Prolong Life
			DW_demonic_impregnation #Available power: Unholy Impregnation
		}
		obedience_tooltip = obedience_tooltip #this can be unique per rank/society 
		obedient = {
			ROOT = {
				always = yes
			}
		}
	}

	plots = {
		plot1_tag
		plot2_tag
	}
    
	ambitions = {
		ambition1_tag
		ambition2_tag
	}

	monthly_currency_gain = {
		name = currency_name_cult_of_apep
    
		per_attribute = {
			name = intrigue
			value = 0.5
		}
		has_trait = {
			trait = ambitious
			value = 5
		}
		has_trait = {
			trait = genius
			value = 4
		}
		has_trait = {
			trait = quick
			value = 3
		}
		has_trait = {
			trait = shrewd
			value = 3
		}
		has_trait = {
			trait = hedonist
			value = 3
		}
		has_trait = {
			trait = mystic
			value = 3
		}
		has_trait = {
			trait = seducer
			value = 3
		}
		has_trait = {
			trait = seductress
			value = 3
		}
		has_trait = {
			trait = schemer
			value = 3
		}
		has_trait = {
			trait = impaler
			value = 3
		}
		has_trait = {
			trait = lustful
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = greedy
			value = 1
		}
		has_trait = {
			trait = deceitful
			value = 1
		}
		has_trait = {
			trait = arbitrary
			value = 1
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			trait = ambitious
			factor = 1.5
		}
		modifier = {
			trait = genius
			factor = 1.3
		}
		modifier = {
			trait = quick
			factor = 1.3
		}
		modifier = {
			trait = shrewd
			factor = 1.3
		}
		modifier = {
			trait = hedonist
			factor = 1.3
		}
		modifier = {
			trait = mystic
			factor = 1.3
		}
		modifier = {
			trait = seducer
			factor = 1.3
		}
		modifier = {
			trait = seductress
			factor = 1.3
		}
		modifier = {
			trait = schemer
			factor = 1.3
		}
		modifier = {
			trait = impaler
			factor = 1.3
		}
		modifier = {
			trait = lustful
			factor = 1.1
		}
		modifier = {
			trait = proud
			factor = 1.1
		}
		modifier = {
			trait = greedy
			factor = 1.1
		}
		modifier = {
			trait = deceitful
			factor = 1.1
		}
		modifier = {
			trait = arbitrary
			factor = 1.1
		}
	}
	
	startup_populate = {
	    trigger = {
			NOT = {
				has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
			ai = yes
	    	controls_religion = no 
			true_religion_egyptian_pagan_trigger = yes
			OR = {
				has_impious_trait_trigger = yes
				has_vice_trigger = yes
				trait = drunkard
				trait = possessed
				trait = lunatic
				trait = arbitrary
			}
			age = 16
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			NOR = {
				mercenary = yes
				holy_order = yes
			}
		}
	}
}