﻿###################
# MILITARY ORDERS #
###################

# Defined - Catholic & Pre-Catholic #

#Knights Hospitaller
ho_christian_knights_hospitaller = {
	
	type = military
	government = holy_order_government
	title = d_neow_military_hospitallers
	name = "holy_order_knights_hospitaller"
	coat_of_arms = "ho_knights_hospitaller"

	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder } }
			scope:founder = { has_variable = military_order_game_start_founder_2 }
			scope:province.county ?= title:c_spoleto
		}
		trigger_else = {
			scope:founder = {
				faith = faith:roman_catholic_faith
				culture = { has_cultural_pillar = heritage_italian }
			}
		}
	}

	weight = {
		value = 10
		if = {
			limit = { scope:province.county ?= title:c_spoleto }
			add = 100
		}
		if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder_2 } }
			add = 100000
		}
	}

	men_at_arms = { order_knights order_serjeants }

	effect = {
		scope:leader = {
			add_trait = lifestyle_physician
			add_trait_xp = {
				trait = lifestyle_physician
				value = { 25 50 }
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_celestial_hierarchy }
	}
}

#Teutonic Knights
ho_christian_teutonic_order = {
	
	type = military
	government = holy_order_government
	title = d_neow_military_teutonic_order
	name = "holy_order_teutonic_order"
	coat_of_arms = "ho_teutonic_order"

	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder } }
			scope:founder = { has_variable = military_order_game_start_founder_1 }
			scope:province.county ?= title:c_vienna
		}
		trigger_else = {
			scope:founder = {
				faith = faith:roman_catholic_faith
				culture = { has_cultural_pillar = heritage_central_germanic }
			}
		}
	}

	weight = {
		value = 10
		if = {
			limit = { scope:province.county ?= title:c_vienna }
			add = 100
		}
		if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder_1 } }
			add = 100000
		}
	}

	men_at_arms = { order_serjeants crossbowmen }

	effect = {
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_peace_of_god }
	}
}

#Knights of St Lazarus
#Who cared for lepers (as well as fighting in battles)
ho_knights_of_st_lazarus = {

	type = military
	government = holy_order_government
	title = d_neow_military_saint_lazarus
	name = "holy_order_knights_of_st_lazarus"
	coat_of_arms = "ho_knights_of_st_lazarus"

	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder } }
			scope:founder = { has_variable = military_order_game_start_founder_3 }
			scope:province.county ?= title:c_dublin
		}
		trigger_else = {
			scope:founder = {
				faith = faith:roman_catholic_faith
				culture = { has_cultural_pillar = heritage_goidelic }
			}
		}
	}

	weight = {
		value = 10
		if = {
			limit = { scope:province.county ?= title:c_dublin }
			add = 100
		}
		if = {
			limit = { scope:founder = { has_variable = military_order_game_start_founder_3 } }
			add = 100000
		}
	}

	men_at_arms = { order_knights order_serjeants }

	effect = {
		scope:leader = {
			add_trait = lifestyle_physician
			add_trait_xp = {
				trait = lifestyle_physician
				value = { 25 50 }
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_dulia }
	}
}

###################
# MONASTIC ORDERS #
###################

# Fixed

#Benedictines - extant by earliest game start
ho_contemplative_hospitaller_johannics = {
	
	type = monastic
	government = monastic_holy_order_government
	title = d_contemplative_hospitaller_johannics
	name = "contemplative_hospitaller_johannics"
	coat_of_arms = "ho_contemplative_hospitaller_johannics"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = monastic_game_start_founder_2 }
			}
			scope:province.county ?= title:c_capua
		}
		trigger_else = {
		}
	}

	weight = {
		value = 10
		#Should be founded in Italy
		if = {
			limit = {
				scope:province.county ?= title:c_capua
			}
			add = 10
		}
		#Trying to put benedictines here on game start
		if = {
			limit = {
				years_from_game_start < 1
				current_year >= 2555
				
				scope:province.county ?= title:c_capua
			}
			add = 10000
		}
	}


	effect = {
		scope:leader = {
			add_trait = lifestyle_physician
			add_trait_xp = {
				trait = lifestyle_physician
				value = { 25 50 }
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_celestial_hierarchy }
	}
}

ho_contemplative_teutonic_order = {
	
	type = monastic
	government = monastic_holy_order_government
	title = d_contemplative_teutonic_order
	name = "contemplative_teutonic_order"
	coat_of_arms = "ho_contemplative_teutonic_order"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = monastic_game_start_founder_1 }
			}
			scope:province.county ?= title:c_wiener_neustadt
		}
		trigger_else = {
		}
	}

	weight = {
		value = 10
		#Should be founded in Italy
		if = {
			limit = {
				scope:province.county ?= title:c_wiener_neustadt
			}
			add = 10
		}
		#Trying to put benedictines here on game start
		if = {
			limit = {
				years_from_game_start < 1
				current_year >= 2555
				
				scope:province.county ?= title:c_wiener_neustadt
			}
			add = 10000
		}
	}


	effect = {
		scope:leader = {
			add_trait = lifestyle_physician
			add_trait_xp = {
				trait = lifestyle_physician
				value = { 25 50 }
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_peace_of_god }
	}
}

ho_contemplative_hospitaller_lazareans = {
	
	type = monastic
	government = monastic_holy_order_government
	title = d_contemplative_hospitaller_lazareans
	name = "contemplative_hospitaller_lazareans"
	coat_of_arms = "ho_contemplative_hospitaller_lazareans"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = monastic_game_start_founder_3 }
			}
			scope:province.county ?= title:c_offaly
		}
		trigger_else = {
		}
	}

	weight = {
		value = 10
		#Should be founded in Italy
		if = {
			limit = {
				scope:province.county ?= title:c_offaly
			}
			add = 10
		}
		#Trying to put benedictines here on game start
		if = {
			limit = {
				years_from_game_start < 1
				current_year >= 2555
				
				scope:province.county ?= title:c_offaly
			}
			add = 10000
		}
	}


	effect = {
		scope:leader = {
			add_trait = lifestyle_physician
			add_trait_xp = {
				trait = lifestyle_physician
				value = { 25 50 }
			}
		}
		scope:new_holy_order = { set_order_tenet = tenet:tenet_dulia }
	}
}

# Greek Catholic military orders (the faith is shared with Latin Catholics,
# so these names are selected by rite, not by a faith-wide name pool).
ho_neow_greek_catholic_sepulchre = {
	type = military
	government = holy_order_government
	name = "holy_order_brotherhood_of_the_holy_sepulchre"
	coat_of_arms = "ho_brotherhood_of_the_holy_sepulchre"
	trigger = {
		scope:founder = {
			rite = rite:greek_catholic_rite
			NOT = { has_variable = military_order_game_start_founder }
		}
	}
	weight = { value = 50 }
}
ho_neow_greek_catholic_first_patriarchate = {
	type = military
	government = holy_order_government
	name = "holy_order_knights_of_the_first_patriarchate"
	coat_of_arms = "ho_knights_of_the_first_patriarchate"
	trigger = {
		scope:founder = {
			rite = rite:greek_catholic_rite
			NOT = { has_variable = military_order_game_start_founder }
		}
	}
	weight = { value = 50 }
}
ho_neow_greek_catholic_theotokos = {
	type = military
	government = holy_order_government
	name = "holy_order_order_of_the_holy_virgin"
	coat_of_arms = "ho_order_of_the_holy_virgin"
	trigger = {
		scope:founder = {
			rite = rite:greek_catholic_rite
			NOT = { has_variable = military_order_game_start_founder }
		}
	}
	weight = { value = 50 }
}


###############################
# NEOW 2555 EASTERN HOLY ORDERS
###############################

ho_NEOW_athonite = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_athonite_fathers
	name = "holy_order_NEOW_athonite"
	coat_of_arms = "ho_NEOW_athonite_fathers"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_athonite }
			scope:province.county ?= title:c_chalkidike
		}
		trigger_else = {
			scope:founder = {
			faith = faith:orthodox
			rite = rite:byzantine_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_athonite } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_hesychasm } }
}

ho_NEOW_savvaite = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_savvaite_brothers
	name = "holy_order_NEOW_savvaite"
	coat_of_arms = "ho_NEOW_savvaite_brothers"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_savvaite }
			scope:province.county ?= title:c_podgorica
		}
		trigger_else = {
			scope:founder = {
			faith = faith:orthodox
			rite = rite:montenegrin_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_savvaite } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_mortification_of_the_flesh } }
}

ho_NEOW_sysoev = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_sysoev_order
	name = "holy_order_NEOW_sysoev"
	coat_of_arms = "ho_NEOW_sysoev"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_sysoev }
			scope:province.county ?= title:c_lyubim
		}
		trigger_else = {
			scope:founder = {
			faith = faith:russian_orthodox
			rite = rite:orthodox_slavic_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_sysoev } }
			add = 1000000000
		}
	}
	tenet = tenet_original_sin
}

ho_NEOW_iasi = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_iasi_fathers
	name = "holy_order_NEOW_iasi"
	coat_of_arms = "ho_NEOW_iasi_fathers"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_iasi }
			scope:province.county ?= title:c_iasi
		}
		trigger_else = {
			scope:founder = {
			faith = faith:orthodox
			rite = rite:byzantine_rite
			culture = { has_cultural_pillar = heritage_romanian }
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_iasi } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_symphonia } }
}

ho_NEOW_gabrielites = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_georgian_gabrielites
	name = "holy_order_NEOW_gabrielites"
	coat_of_arms = "ho_NEOW_georgian_gabrielites"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_gabrielites }
			scope:province.county ?= title:c_tbilisi
		}
		trigger_else = {
			scope:founder = {
			faith = faith:orthodox
			rite = rite:georgian_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_gabrielites } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_ora_et_labora } }
}

ho_NEOW_cypriot = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_cypriot_sepulchre
	name = "holy_order_NEOW_cypriot"
	coat_of_arms = "ho_brotherhood_of_the_holy_sepulchre"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_cypriot }
			scope:province.county ?= title:c_nicosia
		}
		trigger_else = {
			scope:founder = {
			faith = faith:orthodox
			rite = rite:orthodox_hellenic_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_cypriot } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_pentarchy } }
}

ho_NEOW_josaphat = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_josaphat_order
	name = "holy_order_NEOW_josaphat"
	coat_of_arms = "ho_basilian_order_of_josaphat"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_josaphat }
			scope:province.county ?= title:c_zemplen
		}
		trigger_else = {
			scope:founder = {
			rite = rite:greek_catholic_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_josaphat } }
			add = 1000000000
		}
	}
	effect = { scope:new_holy_order = { set_order_tenet = tenet:tenet_dulia } }
}

ho_NEOW_constantine = {
	type = military
	government = holy_order_government
	title = d_NEOW_knights_of_constantine
	name = "holy_order_NEOW_constantine"
	coat_of_arms = "ho_NEOW_knights_of_constantine"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_constantine }
			scope:province.county ?= title:c_byzantion
		}
		trigger_else = {
			scope:founder = {
			OR = {
				faith = faith:orthodox
				faith = faith:russian_orthodox
			}
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_constantine } }
			add = 1000000000
		}
	}
	men_at_arms = { order_serjeants order_knights }
}

ho_NEOW_peresvet = {
	type = military
	government = holy_order_government
	title = d_NEOW_peresvet_brotherhood
	name = "holy_order_NEOW_peresvet"
	coat_of_arms = "ho_NEOW_peresvet_brotherhood"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_peresvet }
			scope:province.county ?= title:c_vologda
		}
		trigger_else = {
			scope:founder = {
			faith = faith:russian_orthodox
			rite = rite:orthodox_slavic_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_peresvet } }
			add = 1000000000
		}
	}
	men_at_arms = { order_serjeants order_knights }
}


ho_christian_knights_templar = {
	
	type = military
	government = holy_order_government
	title = d_knights_templar
	name = "holy_order_knights_templar"
	coat_of_arms = "ho_knights_templar"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			scope:province.county ?= title:c_beirut
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
			}
		}
	}

	weight = {
		value = 10
		#Should be founded in jerusalem
		if = {
			limit = {
				scope:province.county ?= title:c_jerusalem
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_middle_east_jerusalem
				}
			}
			add = 100
		}
		#More likely if first holy order
		if = {
			limit = {
				scope:founder.faith = {
					NOT = {
						any_faith_holy_order = {
							leader ?= {
								government_has_flag = government_is_military_holy_order
							}
						}
					}
				}
			}
			add = 100
		}
		
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
		#Trying to put them here on game start
		if = {
			limit = {
				years_from_game_start < 1
				
				scope:province.county ?= title:c_beirut
			}
			add = 1000
		}
	}

	men_at_arms = { order_knights }

}


ho_christian_order_of_calatrava = {
	
	type = military
	government = holy_order_government
	title = d_knights_calatrava
	name = "holy_order_order_of_calatrava"
	coat_of_arms = "ho_order_of_calatrava"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			scope:province.county ?= title:c_calatrava
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				culture = {
					has_cultural_pillar = heritage_iberian
				}
				scope:province = {
					OR = {
						geographical_region = world_europe_west_iberia
						geographical_region = world_africa_north_west
						geographical_region = world_europe_west_francia
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_calatrava
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province.kingdom ?= title:k_andalusia
			}
			add = 100
		}
		if = {
			limit = {
				scope:founder.primary_title ?= title:k_castille
			}
			add = 100
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_west_iberia
				}
			}
			add = 50
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
		#Trying to put here on game start
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				scope:province.county ?= title:c_calatrava
			}
			add = 10000
		}
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				NOT = { scope:province.county ?= title:c_calatrava }
			}
			multiply = 0
		}
	}

	men_at_arms = { caballero }

	effect = {
		scope:title = {
			set_variable = {
				name = order_heritage
				value = culture_pillar:heritage_iberian
			}
		}
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
	}
}


ho_christian_order_of_alcantara = {

	type = military
	government = holy_order_government
	title = d_knights_alcantara
	name = "holy_order_order_of_alcantara"
	coat_of_arms = "ho_order_of_alcantara"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				culture = {
					has_cultural_pillar = heritage_iberian
				}
				scope:province = {
					OR = {
						geographical_region = world_europe_west_iberia
						geographical_region = world_africa_north_west
						geographical_region = world_europe_west_francia
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_caceres
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province.kingdom ?= title:k_badajoz
			}
			add = 100
		}
		if = {
			limit = {
				scope:founder.primary_title ?= title:k_leon
			}
			add = 100
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_west_iberia
				}
			}
			add = 50
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
	}

	men_at_arms = { caballero }

	effect = {
		scope:title = {
			set_variable = {
				name = order_heritage
				value = culture_pillar:heritage_iberian
			}
		}
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
	}
}


ho_christian_order_of_santiago = {
	
	type = military
	government = holy_order_government
	title = d_knights_santiago
	name = "holy_order_knights_of_santiago"
	coat_of_arms = "ho_knights_of_santiago"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			scope:province.county ?= title:c_merida
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				culture = {
					has_cultural_pillar = heritage_iberian
				}
				scope:province = {
					OR = {
						geographical_region = world_europe_west_iberia
						geographical_region = world_africa_north_west
						geographical_region = world_europe_west_francia
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_mora
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province.kingdom ?= title:k_andalusia
			}
			add = 100
		}
		if = {
			limit = {
				scope:founder.primary_title ?= title:k_leon
			}
			add = 100
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_west_iberia
				}
			}
			add = 50
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
		#Trying to put here on game start
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				scope:province.county ?= title:c_merida
			}
			add = 10000
		}
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				NOT = { scope:province.county ?= title:c_merida }
			}
			multiply = 0
		}
	}

	men_at_arms = { caballero }

	effect = {
		scope:title = {
			set_variable = {
				name = order_heritage
				value = culture_pillar:heritage_iberian
			}
		}
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
	}
}


ho_christian_sword_brethren = {
	
	type = military
	government = holy_order_government
	title = d_sword_brethren
	name = "holy_order_sword_brethren"
	coat_of_arms = "ho_sword_brethren"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
			}
		}
	}

	weight = {
		value = 1
		if = {
			limit = {
				scope:founder = {
					culture = {
						has_cultural_pillar = heritage_central_germanic
					}
				}
			}
			add = 10
		}
		#Livonia is prioritized... but only if founder is german
		if = {
			limit = {
				scope:province.county ?= title:c_livs
				scope:founder = {
					culture = {
						has_cultural_pillar = heritage_central_germanic
					}
				}
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province = {
					kingdom = title:k_esthonia
				}
				scope:founder = {
					culture = {
						has_cultural_pillar = heritage_central_germanic
					}
				}
			}
			add = 200
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_east
				}
				scope:founder = {
					culture = {
						has_cultural_pillar = heritage_central_germanic
					}
				}
			}
			add = 50
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
	}

	men_at_arms = { order_serjeants crossbowmen }

	effect = {
		scope:title = {
			set_variable = {
				name = order_heritage
				value = culture_pillar:heritage_central_germanic
			}
		}
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
	}
}


ho_christian_knights_of_the_tau = {
	
	type = military
	government = holy_order_government
	title = d_knights_of_the_tau
	name = "holy_order_knights_of_the_tau"
	coat_of_arms = "ho_knights_of_the_tau"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
			}
		}
	}

	weight = {
		value = 2
		if = {
			limit = {
				scope:province.county ?= title:c_lucca
			}
			add = 200
		}
		if = {
			limit = {
				scope:province = {
					kingdom = title:k_italy
				}
			}
			add = 10
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_south_italy
				}
			}
			add = 5
		}
		#Mathilda founded this order!
		if = {
			limit = {
				scope:founder = character:7757
			}
			add = 1000
		}
	}

}


ho_christian_knights_of_the_holy_sepulchre = {
	type = military
	government = holy_order_government
	title = d_knights_of_the_holy_sepulchre
	name = "holy_order_knights_of_the_holy_sepulchre"
	coat_of_arms = "ho_knights_of_the_holy_sepulchre"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = faith:catholic
			}
		}
	}

	weight = {
		value = 10
		#Should be founded in jerusalem
		if = {
			limit = {
				scope:province.county ?= title:c_jerusalem
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_middle_east_jerusalem
				}
			}
			add = 100
		}
		#Less likely if orthodox holy order exists
		if = {
			limit = {
				OR = {
					faith:orthodox = {
						any_faith_holy_order = {
							leader ?= {
								primary_title = title:d_holy_sepulchre
							}
						}
					}
					faith:christian_faith = {
						any_faith_holy_order = {
							leader ?= {
								primary_title = title:d_holy_sepulchre
							}
						}
					}
				}
			}
			multiply = 0.2
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
		#Prevent competing for initial placement in Jerusalem
		if = {
			limit = {
				scope:founder = {
					has_character_flag = military_order_game_start_founder
				}
			}
			multiply = 0
		}
	}

}


ho_christian_order_of_aviz = {
	
	type = military
	government = holy_order_government
	title = d_knights_aviz
	name = "holy_order_knights_of_aviz"
	coat_of_arms = "ho_knights_of_aviz"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			scope:province.county ?= title:c_alcacer_do_sal
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				culture = {
					OR = {
						this = culture:portuguese
						any_parent_culture_or_above = {
							this = culture:portuguese
						}
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_alcacer_do_sal
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province.kingdom ?= {
					OR = {
						this = title:k_portugal
						this = title:k_badajoz
					}
				}
			}
			add = 100
		}
		if = {
			limit = {
				scope:founder.primary_title ?= title:k_portugal
			}
			add = 100
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_europe_west_iberia
				}
			}
			add = 50
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
		#Trying to put here on game start
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				scope:province.county ?= title:c_alcacer_do_sal
			}
			add = 10000
		}
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				NOT = { scope:province.county ?= title:c_alcacer_do_sal }
			}
			multiply = 0
		}
	}

	men_at_arms = { caballero }

	effect = {
		scope:title = {
			set_variable = {
				name = order_heritage
				value = culture_pillar:heritage_iberian
			}
		}
		scope:leader = {
			if = {
				limit = {
					NOT = {
						has_realm_law = cultural_holy_order_succession_law
					}
				}
				add_realm_law = cultural_holy_order_succession_law
			}
		}
	}
}


ho_christian_order_of_st_thomas = {

	type = military
	government = holy_order_government
	title = d_knights_of_st_thomas
	name = "holy_order_knights_of_st_thomas"
	coat_of_arms = "ho_knights_of_st_thomas"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				OR = {
					culture = {
						OR = {
							this = culture:english
							this = culture:anglo_saxon
							any_parent_culture_or_above = {
								this = culture:english
							}
							any_parent_culture_or_above = {
								this = culture:anglo_saxon
							}
						}
					}
					AND = {	
						OR = {
							primary_title = title:k_england
							primary_title = title:e_britannia
						}
						culture = {
							OR = {
								this = culture:norman
								any_parent_culture_or_above = {
									this = culture:norman
								}
							}
						}
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_acre
			}
			add = 1000
		}
		if = {
			limit = {
				scope:founder.primary_title ?= {
					OR = {
						this = title:k_england
						this = title:e_britannia
					}
				}
			}
			add = 100
		}
		if = {
			limit = {
				scope:province.kingdom ?= {
					OR = {
						this = title:k_syria
						this = title:k_jerusalem
					}
				}
			}
			add = 100
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
	}

	men_at_arms = { longbowmen }

}


ho_christian_knights_of_the_red_star = {
	
	type = military
	government = holy_order_government
	title = d_knights_of_the_red_star
	name = "holy_order_knights_of_the_red_star"
	coat_of_arms = "ho_knights_of_the_red_star"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				faith = {
					has_doctrine_parameter = is_western_christian_faith
				}
				OR = {
					culture = {
						OR = {
							this = culture:czech
							any_parent_culture_or_above = {
								this = culture:czech
							}
						}
					}
					primary_title = title:k_bohemia
					scope:province.kingdom ?= {
						this = title:k_bohemia
					}
				}
			}
		}
	}

	weight = {
		value = 10
		#Historical founding area
		if = {
			limit = {
				scope:province.county ?= title:c_praha
			}
			add = 1000
		}
		if = {
			limit = {
				scope:founder.primary_title ?= {
					this = title:k_bohemia
				}
			}
			add = 100
		}
		if = {
			limit = {
				scope:province.kingdom ?= {
					OR = {
						this = title:k_bohemia
						this = title:k_poland
					}
				}
			}
			add = 10
		}
		#Less likely outside age of crusades
		if = {
			limit = {
				NOT = {
					scope:founder.religion = { exists = var:variable_ghw_unlocked }
				}
			}
			multiply = 0.1
		}
	}

}


ho_christian_brotherhood_of_the_holy_sepulchre = {
	type = military
	government = holy_order_government
	title = d_holy_sepulchre
	name = "holy_order_brotherhood_of_the_holy_sepulchre"
	coat_of_arms = "ho_holy_sepulchre"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				OR = {
					faith = faith:orthodox
					faith = faith:christian_faith
					faith = faith:iconoclast
				}
			}
		}
	}

	weight = {
		value = 5
		#Should be founded in jerusalem
		if = {
			limit = {
				scope:province.county ?= title:c_jerusalem
			}
			add = 1000
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_middle_east_jerusalem
				}
			}
			add = 100
		}
		#Less likely if orthodox holy order exists
		if = {
			limit = {
				OR = {
					faith:orthodox = {
						any_faith_holy_order = {
							leader ?= {
								primary_title = title:d_holy_sepulchre
							}
						}
					}
					faith:christian_faith = {
						any_faith_holy_order = {
							leader ?= {
								primary_title = title:d_holy_sepulchre
							}
						}
					}
				}
			}
			multiply = 0.2
		}
		#Prevent competing for initial placement in Jerusalem
		if = {
			limit = {
				scope:founder = {
					has_character_flag = military_order_game_start_founder
				}
			}
			multiply = 0
		}
	}

}


ho_akritai_of_the_passes = {
	
	type = military
	government = holy_order_government
	name = "holy_order_akritai_of_the_passes"
	title = d_akritai_of_the_passes

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder.faith = {
				religion = religion:christianity_religion
				save_temporary_scope_as = founder_faith
			}
			scope:founder = {
				OR = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_byzantine
							has_cultural_pillar = heritage_caucasian
						}
					}
					faith = faith:orthodox
					rite = rite:armenian_rite
					faith = faith:iconoclast
				}
			}
			scope:founder = {
				any_neighboring_top_liege_realm_owner = {
					faith = {
						faith_hostility_level = {
							target = scope:founder_faith
							value >= faith_evil_level
						}
					}
				}
				any_sub_realm_county = {
					faith = {
						faith_hostility_level = {
							target = scope:founder_faith
							value >= faith_evil_level
						}
					}
				}
			}
			scope:province = {
				geographical_region = world_asia_minor
			}
		}
	}

	weight = {
		value = 20
		if = {
			limit = {
				scope:province.kingdom = {
					OR = {
						this = title:k_pontus
						this = title:k_anatolia
					}
				}
			}
			add = 100
		}
		#Trying to put here on game start
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				scope:province.county ?= title:c_lycandus
			}
			add = 10000
		}
		if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
				NOT = {
					scope:province.county ?= title:c_lycandus
				}
			}
			multiply = 0
		}
	}
	
	effect = {
		scope:leader = {
			set_variable = {
				name = ho_akritai
				days = 30
			}
		}
	}

	men_at_arms = { akritai }
}


ho_kingdom_akritai = {
	
	type = military
	government = holy_order_government
	name = "holy_order_kingdom_akritai"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder.faith = {
				religion = religion:christianity_religion
				save_temporary_scope_as = founder_faith
			}
			scope:founder = {
				OR = {
					culture = {
						OR = {
							has_cultural_pillar = heritage_byzantine
							has_cultural_pillar = heritage_caucasian
						}
					}
					faith = faith:orthodox
					rite = rite:armenian_rite
					faith = faith:iconoclast
				}
			}
			scope:founder = {
				any_neighboring_top_liege_realm_owner = {
					faith = {
						faith_hostility_level = {
							target = scope:founder_faith
							value >= faith_evil_level
						}
					}
				}
				any_sub_realm_county = {
					faith = {
						faith_hostility_level = {
							target = scope:founder_faith
							value >= faith_evil_level
						}
					}
				}
			}
		}
	}

	weight = {
		value = 10
		if = {
			limit = {
				scope:province = {
					geographical_region = world_asia_minor
				}
			}
			add = 20
		}
	}
	
	effect = {
		scope:leader = {
			set_variable = {
				name = ho_akritai
				days = 30
			}
		}
	}

	men_at_arms = { akritai }
}


ho_knights_of_the_first_patriarchate = {
	type = military
	government = holy_order_government
	title = d_knights_of_the_first_patriarchate
	name = "holy_order_knights_of_the_first_patriarchate"
	coat_of_arms = "ho_knights_of_the_first_patriarchate"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				OR = {
					faith = faith:orthodox
					faith = faith:christian_faith
					faith = faith:iconoclast
				}
			}
		}
	}

	weight = {
		value = 5
		#Should be founded in jerusalem
		if = {
			limit = {
				scope:province.county ?= title:c_antiocheia
			}
			add = 500
		}
		if = {
			limit = {
				scope:province = {
					geographical_region = world_middle_east_jerusalem
				}
			}
			add = 5
		}
	}

}


ho_order_of_the_holy_virgin = {
	type = military
	government = holy_order_government
	title = d_order_of_the_holy_virgin
	name = "holy_order_order_of_the_holy_virgin"
	coat_of_arms = "ho_order_of_the_holy_virgin"

	trigger = {
		trigger_if = {
			limit = {
				scope:founder = { has_variable = military_order_game_start_founder }
			}
			always = no
		}
		trigger_else = {
			scope:founder = {
				OR = {
					faith = faith:orthodox
					faith = faith:christian_faith
				}
			}
		}
	}

	weight = {
		value = 5
	}

}


# NEOW: Johannites of St. John Chrysostom (Romania)
ho_NEOW_johannites = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_johannites
	name = "holy_order_NEOW_johannites"
	coat_of_arms = "ho_NEOW_johannites"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_johannites }
			scope:province.county ?= title:c_suceava
		}
		trigger_else = {
			scope:founder = {
				faith = faith:orthodox
				rite = rite:byzantine_rite
				culture = { has_cultural_pillar = heritage_romanian }
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_johannites } }
			add = 1000000000
		}
	}
	tenet = tenet_divine_liturgy
}

# NEOW: Order of St. Peter Mogila (Kiev)
ho_NEOW_mogila = {
	type = monastic
	government = monastic_holy_order_government
	title = d_NEOW_mogila_order
	name = "holy_order_NEOW_mogila"
	coat_of_arms = "ho_NEOW_mogila"
	trigger = {
		trigger_if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_startup } }
			scope:founder = { has_variable = NEOW_holy_order_2555_mogila }
			scope:province.county ?= title:c_kyiv
		}
		trigger_else = {
			scope:founder = {
				faith = faith:orthodox
				rite = rite:byzantine_rite
			}
		}
	}
	weight = {
		value = 50
		if = {
			limit = { scope:founder = { has_variable = NEOW_holy_order_2555_mogila } }
			add = 1000000000
		}
	}
	tenet = tenet_scholasticism
}
