#CWS Warrior Lodge
warrior_lodge_cws_christian = {
	primary_attribute = martial
	opinion_to_other_members = +10
	opinion_per_rank_above = +5
	sound = warrior_lodge_ambient_01
	society_ranks_gfx = ws_warriors_ranks
	# society_rank_up_decision = request_to_rank_up_cws_society
	society_influence = no
	
	non_interference = {
		always = yes
	}
	
	active = {
		has_dlc = "Holy Fury"
		OR = {
			has_global_flag = flag_started_warrior_lodge_cws_christian # Must either be formed by decision.
			has_game_rule = { name = ws_christian_rule value = ws_exists } # Or by having game rule for it that enables the society from the start.
		}
	}
	indestructible = yes
	
	show_society = {
		trigger_if = {
			limit = { NOT = { society_member_of = warrior_lodge_cws_christian } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_group = christian
					custom_tooltip = {
						text = legendary_warrior_bloodline_trigger_tt
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_legendary_warrior
						}
					}
				}
			}
			trigger_else = {
				OR = {
					# You have neighbors, etc, of the correct religion...
					any_vassal = { religion_group = christian }
					any_liege = { religion_group = christian }
					any_neighbor_independent_ruler = { religion_group = christian }
				}
			}
		}
	}
	
	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_cws_christian
					rank = 1
				}
			}
		}

		trigger_if = {
			limit = { has_character_modifier = warrior_lodge_failed_joining_cd }

			custom_tooltip = {
				text = has_not_angered_society_tt
				always = no
			}
		}
		trigger_else_if = {
			limit = { has_character_flag = society_join_block }
			always = no
		}
		trigger_else = {
			is_adult = yes
			prisoner = no

			trigger_if = {
				limit = {
					OR = {
						NOT = { religion_group = christian }
						AND = {
							religion_group = christian
							is_heretic = yes # Cannot be a Christian heretic anymore
						}
					}
					#NAND = {
					#	religion_group = christian
					#	is_heretic = yes # Cannot be a Christian heretic anymore
					#}
				}

				NOT = { trait = zealous }
				OR = {
					has_tribal_or_nomadic_government_trigger = yes
					custom_tooltip = {
						text = legendary_warrior_bloodline_trigger_tt
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_legendary_warrior
						}
					}
				}

				custom_tooltip = {
					text = society_has_at_least_10_members_tt
					FROM = { num_of_society_members >= 10 }
				}

				custom_tooltip = {
					text = special_join_warrior_lodge_trigger_tt
					special_join_warrior_lodge_trigger = yes
				}
			}
			trigger_else = {
				# Just here for the tooltip
				religion_group = christian
				is_heretic = no # Cannot be a Christian heretic anymore
			}
		}
	}

	potential = { # If you change religion or become zealous while NOT Christian, you are kicked out
		trigger_if = {
			limit = { religion_group = christian }
			is_heretic = no # Cannot be a Christian heretic anymore
		}
		trigger_else = { NOT = { trait = zealous } }
	}

	society_rank = { #"Initiate"
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_prestige = 0.25
		}
		powers = {
			warrior_lodge_duel #Passive Power: Unlocks Duel
			warrior_lodge_shieldmaiden #Passive Power: Unlocks Shieldmaidens
			warrior_lodge_survivor #Passive Power: Survivor
			warrior_lodge_lifetime_of_war #Passive Power: A Lifetime of War
		}
	}
	
	society_rank = { #"Adept"
		level = 2
		limit = 20
		startup_limit = 6
		modifier = {
			monthly_character_prestige = 0.5
			combat_rating = 5
			martial = 1
		}
		powers = {
			warrior_lodge_reaver #Passive Power: Reaver
			warrior_lodge_warrior_training #Power: Warrior Training
			warrior_lodge_summon_commander #Power: Summon Commander
			# warrior_lodge_cws_christian_battle_trance #Power: Christian Battle Trance #TODO
		}
	}
	
	society_rank = { #"Master"
		level = 3
		limit = 10 
		startup_limit = 4
		modifier = {
			monthly_character_prestige = 0.75
			combat_rating = 10
			martial = 2
		}
		powers = {
			warrior_lodge_inspire_warriors #Power: Inspire Warriors
			warrior_lodge_war_sacrifice #Power: War Sacrifice
			warrior_lodge_christian_fortifications #Power: Fortifications of Christ
		}
	}

	society_rank = { #"Grandmaster"
		level = 4
		limit = 4
		startup_limit = 3
		modifier = { 
			monthly_character_prestige = 1
			combat_rating = 15
			martial = 3
		}
		powers = {
			warrior_lodge_indomitable #Passive Power: Indomitable
			warrior_lodge_call_to_glory #Power: Call to Glory
			warrior_lodge_choose_military_aspect #Power: Choose Military Aspect
		}
	}

	plots = {
	
	}

	monthly_currency_gain = {
		name = currency_name_warrior_lodge_cws_christian
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = hunter
			value = 1
		}
		has_trait = {
			trait = strategist
			value = 1
		}
		has_trait = {
			trait = duelist
			value = 1
		}
		has_trait = {
			trait = scarred
			value = 1
		}
		has_trait = {
			trait = scarred_mid
			value = 2
		}
		has_trait = {
			trait = scarred_high
			value = 3
		}
		has_trait = {
			trait = genius
			value = 1
		}
		has_trait = {
			trait = quick
			value = 1
		}
		has_trait = {
			trait = shrewd
			value = 1
		}
		has_trait = {
			trait = strong
			value = 3
		}
		has_trait = {
			trait = brawny
			value = 2
		}
		has_trait = {
			trait = giant
			value = 2
		}
		# has_trait = { # Unchristian
			# trait = impaler
			# value = 1
		# }
		has_trait = {
			trait = falconer
			value = 1
		}
		# has_trait = { # Sin
			# trait = wroth
			# value = 1
		# }
		has_trait = {
			trait = proud # Sin, but permitted to a degree
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = diligent
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = brave
			value = 2
		}
		has_trait = {
			trait = ambitious
			value = 1
		}
		# has_trait = { # Unchristian
			# trait = cruel
			# value = 1
		# }
		has_trait = {
			trait = zealous
			value = 1
		}
		has_trait = {
			trait = erudite
			value = 1
		}
		has_trait = {
			trait = stubborn
			value = 1
		}
		has_trait = {
			trait = adventurer
			value = 1
		}
		has_trait = {
			trait = shieldmaiden
			value = 1
		}
		# has_trait = { # Undisciplined
			# trait = berserker
			# value = 1
		# }
		has_trait = {
			trait = varangian
			value = 1
		}
		has_trait = {
			trait = crusader
			value = 2
		}
		has_trait = {
			trait = crusader_king
			value = 3
		}
		has_trait = {
			trait = crusader_queen
			value = 3
		}
		has_trait = { # Warrior-Monk
			trait = monk
			value = 1
		}
		has_trait = { # Warrior-Nun
			trait = nun
			value = 1
		}
		has_trait = { # Warrior-Pilgrim
			trait = pilgrim
			value = 1
		}
		has_trait = {
			trait = gladiator
			value = 1
		}
		has_trait = {
			trait = crowned_by_bishop 
			value = 1
		}
		has_trait = {
			trait = crowned_by_pope 
			value = 2
		}
		has_trait = {
			trait = baptized_by_bishop 
			value = 1
		}
		has_trait = {
			trait = baptized_by_pope 
			value = 2
		}
		has_trait = {
			trait = born_in_the_purple 
			value = 1
		}
		has_trait = {
			trait = augustus 
			value = 2
		}
		society_rank = { # Grandmaster
			rank = 4
			value = 5
		}
		#NEGATIVE modifiers
		has_trait = { # Vikings/Raiders/Pirates are not particularly liked
			trait = viking
			value = -1
		}
		has_trait = { # Vikings/Raiders/Pirates are not particularly liked
			trait = pirate
			value = -1
		}
		has_trait = { # Vikings/Raiders/Pirates are not particularly liked
			trait = ravager
			value = -2
		}
		has_trait = { # Vikings/Raiders/Pirates are not particularly liked
			trait = sea_king
			value = -3
		}
		has_trait = { # Vikings/Raiders/Pirates are not particularly liked
			trait = sea_queen
			value = -3
		}
		has_trait = { # Pagan Holy Warriors are not liked
			trait = valhalla_bound
			value = -1
		}
		has_trait = {
			trait = eagle_knight
			value = -1
		}
		has_trait = {
			trait = sun_warrior
			value = -1
		}
		has_trait = {
			trait = ukkos_hammer
			value = -1
		}
		has_trait = {
			trait = nyames_shield
			value = -1
		}
		has_trait = {
			trait = peruns_chosen
			value = -1
		}
		has_trait = {
			trait = hound_of_dievas
			value = -1
		}
		has_trait = {
			trait = ares_own
			value = -1
		}
		has_trait = {
			trait = skylord
			value = -1
		}
		has_trait = {
			trait = montu
			value = -1
		}
		has_trait = {
			trait = atens_chosen
			value = -1
		}
		has_trait = {
			trait = lughs_own
			value = -1
		}
		has_trait = {
			trait = morrigan
			value = -1
		}
		has_trait = {
			trait = craven
			value = -3
		}
		has_trait = {
			trait = weak
			value = -2
		}
		has_trait = {
			trait = frail
			value = -1
		}
		has_trait = {
			trait = slothful
			value = -1
		}
		# has_trait = { # Christian value
			# trait = content
			# value = -1
		# }
		has_trait = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
		has_trait = {
			trait = crowned_by_myself 
			value = -1
		}
		has_trait = {
			trait = excommunicated 
			value = -3
		}
		has_trait = {
			trait = dynastic_kinslayer 
			value = -1
		}
		has_trait = {
			trait = familial_kinslayer 
			value = -2
		}
		has_trait = {
			trait = kinslayer 
			value = -3
		}
		has_trait = {
			trait = tribal_kinslayer 
			value = -1
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = {
			trait = crusader
			factor = 1.1
		}
		mult_modifier = {
			trait = crusader_king
			factor = 1.2
		}
		mult_modifier = {
			trait = crusader_queen
			factor = 1.2
		}
		mult_modifier = {
			trait = gladiator
			factor = 1.1
		}
		mult_modifier = {
			trait = crowned_by_bishop
			factor = 1.1
		}
		mult_modifier = {
			trait = crowned_by_pope
			factor = 1.2
		}
		mult_modifier = {
			trait = baptized_by_bishop
			factor = 1.1
		}
		mult_modifier = {
			trait = baptized_by_pope
			factor = 1.2
		}
		mult_modifier = {
			trait = born_in_the_purple
			factor = 1.1
		}
		mult_modifier = {
			trait = augustus
			factor = 1.2
		}
		#NEGATIVE modifiers
		mult_modifier = {
			trait = excommunicated
			factor = 0.5
		}
		mult_modifier = {
			trait = kinslayer
			factor = 0.7
		}
		mult_modifier = {
			trait = familial_kinslayer
			factor = 0.8
		}
		mult_modifier = {
			trait = dynastic_kinslayer
			factor = 0.9
		}
	}	

	startup_populate = {
		trigger = {
			religion_group = christian
			is_heretic = no # Cannot be a Christian heretic anymore
			ai = yes
			is_adult = yes
			controls_religion = no
			is_in_society = no

			OR = {
				trait = zealous
				martial >= 12
				has_lifestyle_martial_trigger = yes
				has_education_martial_trigger = yes
				duelist_skill_is_medium_group_trigger = yes
				duelist_skill_is_high_group_trigger = yes
			}
		}
	}
}

# Hardcoded society tag. If this exists, religions will get versions of this society generated for them unless specifically opted out, or another is specificed. See dynamic_societies.info for more documentation
# ws_warrior_lodge_template = {
	# template = yes
	# primary_attribute = martial
	# is_religious = yes
	# opinion_to_other_members = +10
	# opinion_per_rank_above = +5
	# sound = warrior_lodge_ambient_01
	# society_ranks_gfx = warriors_ranks
	# society_influence = no
	
	# non_interference = {
		# always = yes
	# }
	
	# can_join_society = {
		# hidden_trigger = {
			# NAND = {
				# ai = yes
				# is_society_rank_full = { 
					# society = FROM
					# rank = 1
				# }
			# }
		# }
		# age = 16
		# FROM = {
			# num_of_society_members > 0
		# }
		# secret_religion = FROM
		# hidden_trigger = {
			# NOT = { has_character_flag = society_join_block }
		# }
		# trigger_if = {
			# limit = { prisoner = yes }
			# prisoner = no
		# }
	# }

	# show_society = {
		# FROM = {
			# num_of_society_members > 0
		# }
		# secret_religion = FROM
	# }
	
	# potential = {
		# age = 16
		# secret_religion = FROM
	# }
	
	# society_rank = {
		# level = 1
		# limit = 50
		# startup_limit = 0
		# decisions = {
			# secret_religions_induct_child
			# secret_religions_evoke_sympathy
		# }
	# }
	
	# society_rank = {
		# level = 2
		# limit = 30
		# startup_limit = 0
		# modifier = { 
			# is_visible = {
				# OR = {
					# same_society_as = FROM
					# FROM = { is_society_discovered = yes }
				# }
			# }
			# diplomacy = 1
		# }
		# decisions = {
			# secret_religions_induct_character
		# }
	# }
	
	# society_rank = {
		# level = 3
		# limit = 10
		# startup_limit = 0
		# modifier = {
			# is_visible = {
				# OR = {
					# same_society_as = FROM
					# FROM = { is_society_discovered = yes }
				# }
			# }
			# diplomacy = 2
		# }
		# decisions = {
			# secret_religions_prepare_grounds
		# }
	# }

	# society_rank = {
		# level = 4
		# limit = 1
		# startup_limit = 0
		# modifier = { 
			# diplomacy = 3
			# is_visible = {
				# OR = {
					# same_society_as = FROM
					# FROM = { is_society_discovered = yes }
				# }
			# }
		# }
		# decisions = {
			# secret_religions_openly_adopt_faith
		# }
	# }
	
	# plots = {
	
	# }
	
	# monthly_currency_gain = {
		# name = secret_religion_currency
		
		# per_attribute = {
			# name = diplomacy
			# value = 0.5
		# }
		# has_trait = {
			# trait = zealous
			# value = 3
		# }
		# has_trait = {
			# trait = scholar
			# value = 3
		# }
		# has_trait = {
			# trait = theologian
			# value = 3
		# }	
		# 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
		# }
		# society_rank = {
			# rank = 4
			# value = 10
		# }
	# }

	# member_score_per_attribute = 3
	# member_score_per_rank = 100

	# member_score = {
		# value = 10

		# modifier = {
			# trait = zealous
			# factor = 1.3
		# }
		# 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
		# }
	# }
	
	# startup_populate = {
		# trigger = {
			# always = no
		# }
	# }
# }