mages_guild = {
	primary_attribute = learning
	society_ranks_gfx = secret_ranks
	opinion_to_other_members = +15
	opinion_per_rank_above = +5
	sound = hermetic_society_interface
	non_interference = {
		FROM = {
			same_realm = ROOT
		}
	}
	
	active = {
		has_game_rule = {
			name = supernatural_events
			value = unrestricted
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = mages_guild
					rank = 1
				}
			}
		}
		OR = {
			learning = 20
			trait = wizard
			trait = sorcerer
		}
		OR = {
			learning = 10
			age = 30
		}
		hidden_trigger = {
			OR = {
				has_global_flag = magical_age_restored
				AND = {
					OR = {
						any_demesne_title = { title = k_britain }
						any_liege = {
							any_demesne_title = { title = k_britain }
						}
					}
					has_global_flag = merlin_appeared
					NOT = { has_global_flag = merlin_killed }
				}
				culture_group = elven
			}
		}
		OR = {
			culture_group = elven
			religion_group = mythical_religion_group
			religion_group = christian
			religion_group = jewish_group
			AND = {
				trait = cynical
				custom_tooltip = {
					text = hellenic_pagan_join_society_tooltip
					hidden_trigger = {
						OR = {
							religion = hellenic_pagan
							religion = hellenic_pagan_reformed
						}
					}
				}
			}
			custom_tooltip = {
				text = zunist_join_society_tooltip
				hidden_trigger = {
					OR = {
						religion = zun_pagan					
						religion = zun_pagan_reformed
					}
				}
			}
		}
		NOT = { culture_group = ork }
		NOT = { is_nomadic = yes }
		hidden_trigger = {
			NOT = { has_character_flag = society_join_block }
		}
	}

	show_society = {
		NOT = { culture_group = ork }
		OR = {
			has_law = status_of_magic_3
			has_law = status_of_magic_4
		}
		OR = {
			AND = {
				OR = {
					any_demesne_title = { title = k_britain }
					any_liege = {
						any_demesne_title = { title = k_britain }
					}
				}
				has_global_flag = merlin_appeared
				NOT = { has_global_flag = merlin_killed }
			}
			culture_group = elven
		}
		# OR = {
			# culture_group = elven
			# religion_group = christian
			# religion_group = jewish_group
			# religion = zun_pagan					
			# religion = zun_pagan_reformed
			# religion = hellenic_pagan
			# religion = hellenic_pagan_reformed
		# }
	}
	
	potential = {
		OR = {
			trait = wizard
			trait = sorcerer
		}
		NOT = { is_nomadic = yes }
		age = 16
	}
	
	society_rank = {
		level = 1
		limit = 200
		startup_limit = 10
		modifier = {
			church_opinion = -10
			#economy_techpoints = 0.05
		}
		decisions = {
			mages_guild_practice_magic # Enables you to practice magical skills within guild halls
		}
	}
	
	society_rank = {
		level = 2
		limit = 100
		startup_limit = 6
		modifier = { 
			learning = 1
			church_opinion = -10
		}
		decisions = {
			#hermetics_perform_scrying # Enables you to perform a scrying and gain an omen
			#brew_happiness_potion # Enables you to brew a potion
			mages_guild_invite_mage # Enables you to invite a mage to court
		}
	}
	
	society_rank = {
		level = 3
		limit = 50
		startup_limit = 2
		modifier = {
			learning = 2
			church_opinion = -15
		}
		decisions = {
			#hermetics_make_horoscope # Enables you to "predict" your children's future
			mages_guild_enchant_equipment # Enables you to enchant your common equipment
		}
	}

	society_rank = {
		level = 4
		limit = 20
		startup_limit = 2
		modifier = { 
			learning = 3
			church_opinion = -20
		}
		decisions = {
			#choose_hermetic_art # Enables you to pick/change your lifestyle trait
			#hermetics_write_magnum_opus # Write an enciphered book of lore (artifact)
			show_me_spells_archmage # Enables you to use more a powerful spellbook
			mages_guild_hire_battlemages # Enables you to hire powerful battlemages
		}
	}
	
	plots = {
	}
	
	monthly_currency_gain = {
		name = currency_name_mages_guild
		
		per_attribute = {
    		name = learning
    		value = 0.5
    	}
		has_trait = {
			value = 2
			trait = diligent
		}
		has_trait = {
			value = 1
			trait = scholar
		}
		has_trait = {
			value = 1
			trait = ambitious
		}
		has_trait = {
			value = 1
			trait = erudite
		}
		has_trait = {
			value = 1
			trait = stubborn
		}
		has_trait = {
			value = 1
			trait = patient
		}
		has_trait = {
			value = 1
			trait = genius
		}
		has_trait = {
			value = 1
			trait = quick
		}
		has_trait = {
			value = 1
			trait = shrewd
		}
		has_trait = {
			value = 1
			trait = just
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 1.5
			trait = scholar
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = erudite
		}
		modifier = {
			factor = 1.5
			trait = stubborn
		}
		modifier = {
			factor = 1.5
			trait = patient
		}
		modifier = {
			factor = 1.5
			OR = {
				trait = genius
				trait = quick
				trait = shrewd
			}
		}
		modifier = {
			factor = 1.5
			trait = just
		}
	}
	
	startup_populate = {
	    trigger = {
			ai = yes
	    	controls_religion = no
			age = 16
			is_in_society = no
			is_dumb_trigger = no
			OR = {
				trait = wizard
				trait = sorcerer
			}
			OR = {
				culture_group = elven
				religion_group = christian
				religion_group = jewish_group
				religion = zun_pagan					
				religion = zun_pagan_reformed
				religion = hellenic_pagan
				religion = hellenic_pagan_reformed
			}
		}
	}
}

witchhunters = {
	primary_attribute = martial
	society_ranks_gfx = warriors_ranks
	opinion_to_other_members = +10
	opinion_per_rank_above = +10
	sound = warrior_lodge_ambient_01
	
	active = {
		has_game_rule = {
			name = supernatural_events
			value = unrestricted
		}
		OR = {
			has_game_rule = {
				name = magical_age
				value = restored
			}
			has_global_flag = magical_age_restored
			NOT = { year = 1187 }
		}
	}
	indestructible = yes
	
	can_join_society = {
		hidden_trigger = {
			NAND = {
				ai = yes
				is_society_rank_full = { 
					society = mages_guild
					rank = 1
				}
			}
		}
		age = 16
		OR = {
			martial > 12
			trait = monster_hunter
		}
		NOT = {
			custom_tooltip = {
				text = witchhunters_join_block_tooltip
				has_character_flag = witchhunters_join_block
			}
		}
		OR = {
			custom_tooltip = {
				text = magical_age_was_restored_tooltip
				has_global_flag = magical_age_restored
			}
			AND = {
				NOT = { trait = wizard }
				NOT = { trait = sorcerer }
			}
		}
		OR = {
			custom_tooltip = {
				text = magical_age_was_restored_tooltip
				has_global_flag = magical_age_restored
			}
			AND = {
				NOT = { culture_group = elven }
				NOT = { culture_group = draconian }
			}
		}
		OR = {
			religion_group = christian
			religion_group = jewish_group
			custom_tooltip = {
				text = hellenic_pagan_join_society_tooltip
				hidden_trigger = {
					OR = {
						religion = hellenic_pagan
						religion = hellenic_pagan_reformed
					}
				}
			}
			AND = {
				trait = cynical
				OR = {
					religion_group = pagan_group
					religion_group = mythical_religion_group
				}
			}
			religion_group = muslim
		}
		NOT = { culture_group = ork }
		NOT = { culture_group = undead }
		NOT = { is_nomadic = yes }
		hidden_trigger = {
			NOT = { has_character_flag = society_join_block }
		}
	}

	show_society = {
		NOT = { culture_group = ork }
		NOR = {
			has_law = status_of_magic_0
			has_law = status_of_magic_4
		}
		OR = {
			AND = {
				trait = wizard
				NOT = { is_nomadic = yes }
			}
			AND = {
				trait = sorcerer
				NOT = { is_nomadic = yes }
			}
			#trait = vampire
			culture_group = undead
			religion_group = christian
			religion_group = jewish_group
			religion = hellenic_pagan
			religion = hellenic_pagan_reformed
			religion_group = pagan_group
			religion_group = mythical_religion_group
			religion_group = muslim
		}
	}
	
	potential = {
		OR = {
			custom_tooltip = {
				text = magical_age_was_restored_tooltip
				has_global_flag = magical_age_restored
			}
			AND = {
				NOT = { trait = wizard }
				NOT = { trait = sorcerer }
			}
		}
		OR = {
			custom_tooltip = {
				text = magical_age_was_restored_tooltip
				has_global_flag = magical_age_restored
			}
			AND = {
				NOT = { culture_group = elven }
				NOT = { culture_group = draconian }
			}
		}
		NOT = { is_nomadic = yes }
		age = 16
	}
	
	society_rank = {
		level = 1
		limit = 200
		startup_limit = 12
		modifier = {
			culture_techpoints = -0.04
		}
		decisions = {
			witchhunters_train_wardog # Enables you to train a wardog
		}
	}
	
	society_rank = {
		level = 2
		limit = 100
		startup_limit = 4
		modifier = { 
			martial = 1
			culture_techpoints = -0.06
		}
		decisions = {
			witchhunters_purchase_crossbow # Enables you to purchase a crossbow and receive training on how to use it.
		}
	}
	
	society_rank = {
		level = 3
		limit = 50
		startup_limit = 4
		modifier = {
			martial = 2
			culture_techpoints = -0.08
		}
		decisions = {
			witchhunters_company_join_war # Enables you to request aid against the supernatual from the dawnguard company.
		}
	}

	society_rank = {
		level = 4
		limit = 20
		startup_limit = 1
		modifier = { 
			martial = 3
			culture_techpoints = -0.1
		}
		decisions = {
			supernatural_subjugation_decision # Enables you to attack supernatural characters
		}
	}
	
	plots = {
	}
	
	monthly_currency_gain = {
		name = currency_name_witchhunters
		
		per_attribute = {
    		name = martial
    		value = 0.5
    	}
		has_trait = {
			value = 0.5
			trait = zealous
		}
		has_trait = {
			value = 2
			trait = diligent
		}
		has_trait = {
			value = 2
			trait = brave
		}
		has_trait = {
			value = 1
			trait = ambitious
		}
		has_trait = {
			value = 1
			trait = crusader
		}
		has_trait = {
			value = 1
			trait = mujahid
		}
		has_trait = {
			value = 1
			trait = valhalla_bound
		}
		has_trait = {
			value = 1
			trait = eagle_warrior
		}
		has_trait = {
			value = 1
			trait = sun_warrior
		}
		has_trait = {
			value = 1
			trait = ukkos_shield
		}
		has_trait = {
			value = 1
			trait = nyames_shield
		}
		has_trait = {
			value = 1
			trait = peruns_chosen
		}
		has_trait = {
			value = 1
			trait = romuvas_own
		}
		has_trait = {
			value = 1
			trait = ares_own
		}
		has_trait = {
			value = 1
			trait = tengri_warrior
		}
		has_trait = {
			value = 1
			trait = shaddai
		}
		has_trait = {
			value = 1
			trait = gondi_shahansha
		}
		has_trait = {
			value = 1
			trait = stubborn
		}
		has_trait = {
			value = 1
			trait = patient
		}
		has_trait = {
			value = 1
			trait = genius
		}
		has_trait = {
			value = 1
			trait = quick
		}
		has_trait = {
			value = 1
			trait = wroth
		}
		has_trait = {
			value = 1
			trait = robust
		}
		society_rank = {
			rank = 4
			value = 10
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		modifier = {
			factor = 2.5
			has_character_modifier = rebuilt_fort_dawnguard
		}
		modifier = {
			factor = 2
			trait = diligent
		}
		modifier = {
			factor = 2
			trait = brave
		}
		modifier = {
			factor = 1.5
			trait = ambitious
		}
		modifier = {
			factor = 1.5
			trait = stubborn
		}
		modifier = {
			factor = 1.5
			trait = patient
		}
		modifier = {
			factor = 1.5
			OR = {
				trait = genius
				trait = quick
				trait = shrewd
			}
		}
		modifier = {
			factor = 1.5
			trait = wroth
		}
		modifier = {
			factor = 1.5
			trait = robust
		}
		modifier = {
			factor = 1
			OR = {
				trait = crusader
				trait = mujahid
				trait = valhalla_bound
				trait = eagle_warrior
				trait = sun_warrior
				trait = ukkos_shield
				trait = nyames_shield
				trait = peruns_chosen
				trait = romuvas_own
				trait = ares_own
				trait = tengri_warrior
				trait = shaddai
				trait = gondi_shahansha
			}
		}
	}
	
	startup_populate = {
	    trigger = {
			ai = yes
	    	controls_religion = no
			age = 18
			is_in_society = no
			NOT = { higher_tier_than = DUKE }
			trait = monster_hunter
			NOT = { trait = craven }
			NOT = { culture_group = elven }
			NOT = { culture_group = draconian }
			NOT = { culture_group = ork }
			OR = {
				religion_group = christian
				religion_group = jewish_group
				religion = hellenic_pagan
				religion = hellenic_pagan_reformed
				religion_group = muslim
			}
		}
	}
}