#WS Warrior Lodges
# The Immortals
warrior_lodge_ws_mazdan = {
	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_ws_mazdan # Must either be formed by decision.
			has_game_rule = { name = ws_mazdan_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_ws_mazdan } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_group = zoroastrian_group
					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 = zoroastrian_group }
					any_liege = { religion_group = zoroastrian_group }
					any_neighbor_independent_ruler = { religion_group = zoroastrian_group }
				}
			}
		}
	}
	
	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_ws_mazdan
					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 = zoroastrian_group }
						AND = {
							religion_group = zoroastrian_group
							is_heretic = yes # Cannot be a Mazdan heretic anymore
						}
					}
					#NAND = {
					#	religion_group = zoroastrian_group
					#	is_heretic = yes # Cannot be a Mazdan 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 = zoroastrian_group
				is_heretic = no # Cannot be a Mazdan heretic anymore
			}
		}
	}
	
	potential = { #if you change religion or become zealous while NOT Mazdan, you are kicked out
		trigger_if = {
			limit = { religion_group = zoroastrian_group }
			is_heretic = no # Cannot be a Mazdan heretic anymore
		}
		trigger_else = { NOT = { trait = zealous } }
	}
	
	society_rank = { #"Kurtash"
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_prestige = 0.25
			church_opinion = 5
		}
		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 = { #"Arstibara"
		level = 2
		limit = 20
		startup_limit = 6
		modifier = {
			monthly_character_prestige = 0.5
			church_opinion = 10
			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_zun_battle_trance #Power: Battle Trance
			warrior_lodge_ws_battle_trance #Power: Battle Trance
		}
	}
	
	society_rank = { #"Vacabara"
		level = 3
		limit = 10 
		startup_limit = 4
		modifier = {
			monthly_character_prestige = 0.75
			church_opinion = 15
			combat_rating = 10
			martial = 2
		}
		powers = {
			warrior_lodge_inspire_warriors #Power: Inspire Warriors
			warrior_lodge_war_sacrifice #Power: War Sacrifice
		}
	}

	society_rank = { #"Hazarapatish"
		level = 4
		limit = 4
		startup_limit = 3
		modifier = { 
			monthly_character_prestige = 1
			church_opinion = 20
			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_ws_mazdan
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = misguided_warrior 
			value = 1
		}
		has_trait = {
			trait = tough_soldier 
			value = 2
		}
		has_trait = {
			trait = skilled_tactician
			value = 3
		}
		has_trait = {
			trait = brilliant_strategist
			value = 4
		}
		has_trait = { # Zoroastrian
			trait = saoshyant
			value = 10
		}
		has_trait = {
			trait = saoshyant_descendant 
			value = 5
		}
		# triggered_gain = { # TODO - DOES NOT WORK!
			# desc = loc_key # What to show in the score gain breakdown. Passed through custom loc with the character as ROOT. The gain is provided as $GAIN$
			# trigger = {
				# is_bloodline_member_of = { saoshyant_male }
			# }
			# value = 5
		# }
		# triggered_gain = { # TODO - DOES NOT WORK!
			# desc = loc_key # What to show in the score gain breakdown. Passed through custom loc with the character as ROOT. The gain is provided as $GAIN$
			# trigger = {
				# is_bloodline_member_of = { saoshyant_female }
			# }
			# value = 5
		# }
		has_trait = {
			trait = gondi_shahansha 
			value = 5
		}
		has_trait = {
			trait = adventurer
			value = 2
		}
		has_trait = {
			trait = shieldmaiden
			value = 2
		}
		has_trait = { # Lifestyle
			trait = duelist
			value = 3
		}
		has_trait = {
			trait = strategist
			value = 3
		}
		has_trait = {
			trait = hunter
			value = 3
		}
		has_trait = {
			trait = zealous
			value = 3
		}
		has_trait = {
			trait = celibate
			value = 1
		}
		has_trait = {
			trait = pilgrim
			value = 1
		}
		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 = {
			trait = falconer
			value = 1
		}
		has_trait = {
			trait = just
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = diligent
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = chaste
			value = 1
		}
		has_trait = {
			trait = brave
			value = 3
		}
		society_rank = {
			rank = 4
			value = 5
		}
		#NEGATIVE modifiers
		has_trait = {
			trait = drunkard
			value = -1
		}
		has_trait = {
			trait = possessed
			value = -1
		}
		has_trait = {
			trait = deceitful
			value = -1
		}
		has_trait = {
			trait = arbitrary
			value = -1
		}
		has_trait = {
			trait = malnourished
			value = -1
		}
		has_trait = {
			trait = fat
			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 = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
	}

	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = { # Zoroastrian
			primary_title = { title = d_immortals }
			factor = 5.0
		}
		mult_modifier = {
			trait = saoshyant
			factor = 10.0
		}
		mult_modifier = {
			trait = saoshyant_descendant 
			factor = 5.0
		}
		mult_modifier = {
			trait = gondi_shahansha 
			factor = 2.0
		}
		mult_modifier = {
			is_priest = yes
			factor = 1.1
		}
	}
	
	startup_populate = {
		trigger = {
			religion_group = zoroastrian_group
			is_heretic = no # Cannot be a Mazdan 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
			}
		}
	}
}

# The Disciples of the Shaolin
warrior_lodge_ws_eastern = {
	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_ws_eastern # Must either be formed by decision.
			has_game_rule = { name = ws_eastern_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_ws_eastern } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_group = indian_group
					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 = indian_group }
					any_liege = { religion_group = indian_group }
					any_neighbor_independent_ruler = { religion_group = indian_group }
				}
			}
		}
	}
	
	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_ws_eastern
					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 = {
					NOT = { religion_group = indian_group }
				}

				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 = indian_group
			}
		}
	}
	
	potential = { #if you change religion or become zealous while NOT Eastern, you are kicked out
		trigger_if = {
			limit = { NOT = { religion_group = indian_group } }
			NOT = { trait = zealous }
		}
	}
	
	society_rank = { #"Initiate"
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_prestige = 0.25
			church_opinion = 5
		}
		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
			warrior_lodge_bon_toughness				# Power: Toughness
		}
	}
	
	society_rank = { #"Disciple"
		level = 2
		limit = 20
		startup_limit = 6
		modifier = {
			monthly_character_prestige = 0.5
			church_opinion = 10
			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
		}
	}
	
	society_rank = { #"Master"
		level = 3
		limit = 10 
		startup_limit = 4
		modifier = {
			monthly_character_prestige = 0.75
			church_opinion = 15
			combat_rating = 10
			martial = 2
		}
		powers = {
			warrior_lodge_inspire_warriors #Power: Inspire Warriors
			warrior_lodge_war_sacrifice #Power: War Sacrifice
		}
	}

	society_rank = { #"Grand Master"
		level = 4
		limit = 4
		startup_limit = 3
		modifier = { 
			monthly_character_prestige = 1
			church_opinion = 20
			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_ws_eastern
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = misguided_warrior 
			value = 1
		}
		has_trait = {
			trait = tough_soldier 
			value = 2
		}
		has_trait = {
			trait = skilled_tactician
			value = 3
		}
		has_trait = {
			trait = brilliant_strategist
			value = 4
		}
		# triggered_gain = { # TODO - DOES NOT WORK!
			# desc = loc_key # What to show in the score gain breakdown. Passed through custom loc with the character as ROOT. The gain is provided as $GAIN$
			# trigger = {
				# is_bloodline_member_of = { samrat_chakravartin_male }
			# }
			# value = 5
		# }
		# triggered_gain = { # TODO - DOES NOT WORK!
			# desc = loc_key # What to show in the score gain breakdown. Passed through custom loc with the character as ROOT. The gain is provided as $GAIN$
			# trigger = {
				# is_bloodline_member_of = { samrat_chakravartin_female }
			# }
			# value = 5
		# }
		has_trait = {
			trait = bhikkhu 
			value = 2
		}
		has_trait = {
			trait = bhikkhuni 
			value = 2
		}
		has_trait = {
			trait = muni
			value = 1
		}
		has_trait = {
			trait = aryika
			value = 1
		}
		has_trait = {
			trait = sanyasi
			value = 2
		}
		has_trait = {
			trait = sanyasini
			value = 2
		}
		has_trait = {
			trait = shaivist_hindu
			value = 3
		}
		has_trait = {
			trait = brahmin 
			value = 5
		}
		has_trait = {
			trait = kshatriya 
			value = 5
		}
		has_trait = {
			trait = adventurer
			value = 2
		}
		has_trait = {
			trait = shieldmaiden
			value = 2
		}
		has_trait = { # Lifestyle
			trait = duelist
			value = 3
		}
		has_trait = {
			trait = strategist
			value = 3
		}
		has_trait = {
			trait = hunter
			value = 3
		}
		has_trait = {
			trait = zealous
			value = 3
		}
		has_trait = {
			trait = celibate
			value = 1
		}
		has_trait = {
			trait = pilgrim
			value = 1
		}
		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 = {
			trait = falconer
			value = 1
		}
		has_trait = {
			trait = just
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = diligent
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = chaste
			value = 1
		}
		has_trait = {
			trait = brave
			value = 3
		}
		society_rank = {
			rank = 4
			value = 5
		}
		#NEGATIVE modifiers
		has_trait = {
			trait = drunkard
			value = -1
		}
		has_trait = {
			trait = possessed
			value = -1
		}
		has_trait = {
			trait = deceitful
			value = -1
		}
		has_trait = {
			trait = arbitrary
			value = -1
		}
		has_trait = {
			trait = malnourished
			value = -1
		}
		has_trait = {
			trait = fat
			value = -1
		}
		has_trait = {
			trait = craven
			value = -3
		}
		has_trait = {
			trait = vaishya
			value = -3
		}
		has_trait = {
			trait = weak
			value = -2
		}
		has_trait = {
			trait = frail
			value = -1
		}
		has_trait = {
			trait = slothful
			value = -1
		}
		has_trait = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = {
			trait = kshatriya 
			factor = 5
		}
		mult_modifier = {
			trait = brahmin
			factor = 1.25
		}
		mult_modifier = {
			trait = shaivist_hindu
			factor = 1.25
		}
		mult_modifier = {
			is_priest = yes
			factor = 1.1
		}
		#NEGATIVE modifiers
		mult_modifier = {
			trait = vaishya
			factor = 0.75
		}
	}
	
	startup_populate = {
		trigger = {
			religion_group = indian_group
			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
			}
		}
	}
}

# Knights of the Eagle
warrior_lodge_ws_aztec = {
	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_aztec_post_arrival_warrior_lodge_ws_aztec # Must either be formed by decision.
			has_game_rule = { name = ws_eastern_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_ws_aztec } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_openly_aztec_or_reformed_trigger = yes
					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_openly_aztec_or_reformed_trigger = yes }
					any_liege = { religion_openly_aztec_or_reformed_trigger = yes }
					any_neighbor_independent_ruler = { religion_openly_aztec_or_reformed_trigger = yes }
				}
			}
		}
	}

	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_ws_aztec
					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 = { religion_openly_aztec_or_reformed_trigger = no }

				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_openly_aztec_or_reformed_trigger = yes
			}
		}
	}
	
	potential = { #if you change religion or become zealous while NOT pagan, you are kicked out
		trigger_if = {
			limit = { religion_openly_aztec_or_reformed_trigger = no }
			NOT = { trait = zealous }
		}
	}
	
	society_rank = { #"Fledling"
		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 = { #"Warrior"
		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_tengri_call_of_the_steppe	# Power: Call of the Steppe
		}
	}
	
	society_rank = { #"Veteran"
		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
		}
	}

	society_rank = { #"Hero"
		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_ws_aztec
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = bloodthirsty_gods_1 
			value = 1
		}
		has_trait = {
			trait = bloodthirsty_gods_2
			value = 2
		}
		has_trait = {
			trait = bloodthirsty_gods_3
			value = 3
		}
		has_trait = {
			trait = eagle_knight 
			value = 5
		}
		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 = {
			trait = impaler
			value = 1
		}
		has_trait = {
			trait = falconer
			value = 1
		}
		has_trait = {
			trait = wroth
			value = 1
		}
		has_trait = {
			trait = proud
			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 = {
			trait = cruel
			value = 1
		}
		has_trait = {
			trait = stubborn
			value = 1
		}
		has_trait = {
			trait = adventurer
			value = 1
		}
		has_trait = {
			trait = pirate
			value = 1
		}
		has_trait = {
			trait = ravager
			value = 2
		}
		has_trait = {
			trait = sea_king
			value = 3
		}
		has_trait = {
			trait = sea_queen
			value = 3
		}
		has_trait = {
			trait = shieldmaiden
			value = 1
		}
		#NEGATIVE modifiers
		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 = {
			trait = content
			value = -1
		}
		has_trait = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = {
			trait = eagle_knight 
			factor = 5
		}
		mult_modifier = {
			is_priest = yes
			factor = 1.1
		}
		mult_modifier = {
			trait = zealous
			factor = 1.25
		}
	}
	
	startup_populate = {
		trigger = {
			religion_openly_aztec_or_reformed_trigger = yes
			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
			}
		}
	}
}

# The Futuwwa Brotherhood
warrior_lodge_ws_muslim = {
	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_ws_muslim # Must either be formed by decision.
			has_game_rule = { name = ws_muslim_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_ws_muslim } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_group = muslim
					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 = muslim }
					any_liege = { religion_group = muslim }
					any_neighbor_independent_ruler = { religion_group = muslim }
				}
			}
		}
	}
	
	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_ws_muslim
					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 = muslim }
						AND = {
							religion_group = muslim
							is_heretic = yes # Cannot be a Muslim heretic anymore
						}
					}
					#NAND = {
					#	religion_group = muslim
					#	is_heretic = yes # Cannot be a Muslim 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 = muslim
				is_heretic = no # Cannot be a Muslim heretic anymore
			}
		}
	}
	
	potential = { #if you change religion or become zealous while NOT Muslim, you are kicked out
		trigger_if = {
			limit = { religion_group = muslim }
			is_heretic = no # Cannot be a Muslim heretic anymore
		}
		trigger_else = { NOT = { trait = zealous } }
	}
	
	society_rank = { #"Adherent"
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_prestige = 0.25
			muslim_opinion = 2
		}
		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 = { #"Companion"
		level = 2
		limit = 20
		startup_limit = 6
		modifier = {
			monthly_character_prestige = 0.5
			muslim_opinion = 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_zun_battle_trance #Power: Battle Trance
			warrior_lodge_ws_battle_trance #Power: Battle Trance
		}
	}
	
	society_rank = { #"Devoted"
		level = 3
		limit = 10 
		startup_limit = 4
		modifier = {
			monthly_character_prestige = 0.75
			muslim_opinion = 10
			combat_rating = 10
			martial = 2
		}
		powers = {
			warrior_lodge_inspire_warriors #Power: Inspire Warriors
			warrior_lodge_war_sacrifice #Power: War Sacrifice
		}
	}

	society_rank = { #"Grand Master"
		level = 4
		limit = 4
		startup_limit = 3
		modifier = { 
			monthly_character_prestige = 1
			muslim_opinion = 15
			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_ws_muslim
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = misguided_warrior 
			value = 1
		}
		has_trait = {
			trait = tough_soldier 
			value = 2
		}
		has_trait = {
			trait = skilled_tactician
			value = 3
		}
		has_trait = {
			trait = brilliant_strategist
			value = 4
		}
		has_trait = { # Muslim
			trait = sayyid
			value = 5
		}
		has_trait = {
			trait = mirza 
			value = 5
		}
		has_trait = {
			trait = mujahid 
			value = 5
		}
		has_trait = {
			trait = faqih
			value = 3
		}
		has_trait = {
			trait = hajjaj
			value = 2
		}
		has_trait = {
			trait = ashari
			value = 2
		}
		has_trait = {
			trait = mutazilite
			value = 2
		}
		has_trait = {
			trait = adventurer
			value = 2
		}
		has_trait = {
			trait = shieldmaiden
			value = 2
		}
		has_trait = { # Lifestyle
			trait = duelist
			value = 3
		}
		has_trait = {
			trait = strategist
			value = 3
		}
		has_trait = {
			trait = hunter
			value = 3
		}
		has_trait = {
			trait = zealous
			value = 3
		}
		has_trait = {
			trait = celibate
			value = 1
		}
		has_trait = {
			trait = pilgrim
			value = 1
		}
		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 = {
			trait = falconer
			value = 1
		}
		has_trait = {
			trait = just
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = diligent
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = chaste
			value = 1
		}
		has_trait = {
			trait = brave
			value = 3
		}
		society_rank = {
			rank = 4
			value = 5
		}
		#NEGATIVE modifiers
		has_trait = {
			trait = drunkard
			value = -1
		}
		has_trait = {
			trait = possessed
			value = -1
		}
		has_trait = {
			trait = deceitful
			value = -1
		}
		has_trait = {
			trait = arbitrary
			value = -1
		}
		has_trait = {
			trait = malnourished
			value = -1
		}
		has_trait = {
			trait = fat
			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 = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
		has_trait = {
			trait = decadent
			value = -3
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

	member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = { # Muslim
			trait = sayyid
			factor = 5
		}
		mult_modifier = {
			trait = mirza 
			factor = 5
		}
		mult_modifier = {
			trait = mujahid 
			factor = 5
		}
		mult_modifier = {
			trait = faqih
			factor = 1.5
		}
		mult_modifier = {
			trait = hajjaj
			factor = 1.25
		}
		#NEGATIVE modifiers
		mult_modifier = {
			trait = decadent
			factor = 0.8
		}
		mult_modifier = {
			trait = drunkard
			factor = 0.8
		}
	}
	
	startup_populate = {
		trigger = {
			religion_group = muslim
			is_heretic = no # Cannot be a Muslim 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
			}
		}
	}
}

# Bar Kokhba's Chosen
warrior_lodge_ws_jewish = {
	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_ws_jewish # Must either be formed by decision.
			has_game_rule = { name = ws_jewish_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_ws_jewish } }

			trigger_if = {
				limit = { has_religion_matching_available_warrior_lodge_trigger = yes }
				OR = {
					religion_group = jewish_group
					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 = jewish_group }
					any_liege = { religion_group = jewish_group }
					any_neighbor_independent_ruler = { religion_group = jewish_group }
				}
			}
		}
	}
	
	can_join_society = {
		trigger_if = {
			limit = { ai = yes }

			NOT = {
				is_society_rank_full = {
					society = warrior_lodge_ws_jewish
					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 = jewish_group }
						AND = {
							religion_group = jewish_group
							is_heretic = yes # Cannot be a Jewish heretic anymore
						}
					}
					#NAND = {
					#	religion_group = jewish_group
					#	is_heretic = yes # Cannot be a Jewish 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 = jewish_group
				is_heretic = no # Cannot be a Jewish heretic anymore
			}
		}
	}
	
	potential = { #if you change religion or become zealous while NOT Jewish, you are kicked out
		trigger_if = {
			limit = { religion_group = jewish_group }
			is_heretic = no # Cannot be a Jewish heretic anymore
		}
		trigger_else = { NOT = { trait = zealous } }
	}
	
	society_rank = { #"Adherent"
		level = 1
		limit = 50 
		startup_limit = 10
		modifier = {
			monthly_character_prestige = 0.25
			church_opinion = 5
		}
		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 = { #"Companion"
		level = 2
		limit = 20
		startup_limit = 6
		modifier = {
			monthly_character_prestige = 0.5
			church_opinion = 10
			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
		}
	}
	
	society_rank = { #"Devoted"
		level = 3
		limit = 10 
		startup_limit = 4
		modifier = {
			monthly_character_prestige = 0.75
			church_opinion = 15
			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 = { #"Grand Master"
		level = 4
		limit = 4
		startup_limit = 3
		modifier = { 
			monthly_character_prestige = 1
			church_opinion = 20
			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_ws_jewish
		
		per_attribute = {
			name = martial
			value = 0.25
		}
		has_trait = {
			trait = misguided_warrior 
			value = 1
		}
		has_trait = {
			trait = tough_soldier 
			value = 2
		}
		has_trait = {
			trait = skilled_tactician
			value = 3
		}
		has_trait = {
			trait = brilliant_strategist
			value = 4
		}
		has_trait = { # Jewish
			trait = kanai
			value = 5
		}
		has_trait = {
			trait = pilgrim 
			value = 3
		}
		has_trait = {
			trait = adventurer
			value = 2
		}
		has_trait = {
			trait = shieldmaiden
			value = 2
		}
		has_trait = { # Lifestyle
			trait = duelist
			value = 3
		}
		has_trait = {
			trait = strategist
			value = 3
		}
		has_trait = {
			trait = hunter
			value = 3
		}
		has_trait = {
			trait = zealous
			value = 3
		}
		has_trait = {
			trait = celibate
			value = 1
		}
		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 = {
			trait = falconer
			value = 1
		}
		has_trait = {
			trait = just
			value = 1
		}
		has_trait = {
			trait = proud
			value = 1
		}
		has_trait = {
			trait = patient
			value = 1
		}
		has_trait = {
			trait = diligent
			value = 1
		}
		has_trait = {
			trait = humble
			value = 1
		}
		has_trait = {
			trait = chaste
			value = 1
		}
		has_trait = {
			trait = brave
			value = 3
		}
		society_rank = {
			rank = 4
			value = 5
		}
		#NEGATIVE modifiers
		has_trait = {
			trait = drunkard
			value = -1
		}
		has_trait = {
			trait = possessed
			value = -1
		}
		has_trait = {
			trait = deceitful
			value = -1
		}
		has_trait = {
			trait = arbitrary
			value = -1
		}
		has_trait = {
			trait = malnourished
			value = -1
		}
		has_trait = {
			trait = fat
			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 = {
			trait = dwarf
			value = -1
		}
		has_trait = {
			trait = clubfooted
			value = -1
		}
		has_trait = {
			trait = hunchback
			value = -1
		}
		has_trait = {
			trait = decadent
			value = -3
		}
		has_trait = {
			trait = excommunicated
			value = -3
		}
	}
	
	member_score_per_attribute = 3
	member_score_per_rank = 100

		member_score = {
		value = 10

		warrior_lodge_member_score = yes

		mult_modifier = { # Jewish
			trait = kanai
			factor = 4
		}
	}
	
	startup_populate = {
		trigger = {
			religion_group = jewish_group
			is_heretic = no # Cannot be a Jewish 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
			}
		}
	}
}