# Coronation Related
GetOath = { # This will get the first valid oath
	type = character

	## Diplomacy
	text = { # Alliances
		trigger = {
			has_variable = diplomacy_oath_1
		}
		localization_key = GetAllianceOathText
	}

	text = { # Children
		trigger = {
			has_variable = diplomacy_oath_2
		}
		localization_key = GetChildrenOathText
	}

	## Martial
	text = { # Reconquer Lands
		trigger = {
			has_variable = martial_oath_1
		}
		localization_key = GetReconquerOathText
	}

	text = { # Conquer Lands
		trigger = {
			has_variable = martial_oath_2
		}
		localization_key = GetConquestOathText
	}

	## Stewardship
	text = { # Peace
		trigger = {
			has_variable = stewardship_oath_1
		}
		localization_key = GetPeaceOathText
	}

	text = { # Buildings
		trigger = {
			has_variable = stewardship_oath_2
		}
		localization_key = GetBuildingOathText
	}

	## Intrigue

	## Learning
	text = { # University
		trigger = {
			has_variable = learning_oath_1
		}
		localization_key = GetUniversityOathText
	}

	#De Jure
	text = {
		trigger = {
			has_variable = purge_pretenders_oath
		}
		localization_key = GetPurgePretendersOathText
	}

	#End the Struggle
	text = {
		trigger = {
			has_variable = end_the_struggle_oath
		}
		localization_key = GetEndTheStruggleOathText
	}

	# Greatest Hunter
	text = {
		trigger = {
			has_variable = greatest_hunter_oath
		}
		localization_key = GetGreatestHunterOathText
	}

	# Heir Preparation
	text = {
		trigger = {
			has_variable = heir_preparation_oath
		}
		localization_key = GetHeirPreparationOathText
	}

	# Install Claimants
	text = {
		trigger = {
			has_variable = install_claimants_oath
		}
		localization_key = GetInstallClaimantsOathText
	}

	# Mend the Fracture
	text = {
		trigger = {
			has_variable = mend_the_fracture_oath
		}
		localization_key = GetMendTheFractureOathText
	}

	# Provide for the Warriors
	text = {
		trigger = {
			has_variable = provide_for_the_warriors_oath
		}
		localization_key = GetProvideForTheWarriorsOathText
	}

	# Provide for the Faithful
	text = {
		trigger = {
			has_variable = provide_for_the_faithful_oath
		}
		localization_key = GetProvideForTheFaithfulOathText
	}

	# Provide for the Poor
	text = {
		trigger = {
			has_variable = provide_for_the_poor_oath
		}
		localization_key = GetProvideForThePoorOathText
	}

	# Repent
	text = {
		trigger = {
			has_variable = repent_oath
		}
		localization_key = GetRepentOathText
	}

	## No Oath
	text = {
		localization_key = GetNoOathText
	}
}

GetOathSpecific = { # This will use a scope to find a specific oath, so it has to be set in the event where this is being used
	type = character

	## Diplomacy
	text = { # Reconquer Lands
		trigger = {
			scope:find_oath = flag:diplomacy_oath_1
		}
		localization_key = GetAllianceOathText
	}

	text = { # Children Oath
		trigger = {
			scope:find_oath = flag:diplomacy_oath_2
		}
		localization_key = GetChildrenOathText
	}

	## Martial
	text = { # Reconquer Lands
		trigger = {
			scope:find_oath = flag:martial_oath_1
		}
		localization_key = GetReconquerOathText
	}

	text = { # Conquer Lands
		trigger = {
			scope:find_oath = flag:martial_oath_2
		}
		localization_key = GetConquestOathText
	}

	## Stewardship
	text = { # Peace
		trigger = {
			scope:find_oath = flag:stewardship_oath_1
		}
		localization_key = GetPeaceOathText
	}

	text = { # Buildings
		trigger = {
			scope:find_oath = flag:stewardship_oath_2
		}
		localization_key = GetBuildingOathText
	}

	## Intrigue

	## Learning
	text = { # University
		trigger = {
			scope:find_oath = flag:learning_oath_1
		}
		localization_key = GetUniversityOathText
	}

	#Purge Pretenders
	text = {
		trigger = {
			scope:find_oath = flag:purge_pretenders_oath
		}
		localization_key = GetPurgePretendersOathText
	}

	#End the Struggle
	text = {
		trigger = {
			scope:find_oath = flag:end_the_struggle_oath
		}
		localization_key = GetEndTheStruggleOathText
	}

	# Greatest Hunter
	text = {
		trigger = {
			scope:find_oath = flag:greatest_hunter_oath
		}
		localization_key = GetGreatestHunterOathText
	}

	# Heir Preparation
	text = {
		trigger = {
			scope:find_oath = flag:heir_preparation_oath
		}
		localization_key = GetHeirPreparationOathText
	}

	# Install Claimants
	text = {
		trigger = {
			scope:find_oath = flag:install_claimants_oath
		}
		localization_key = GetInstallClaimantsOathText
	}

	# Mend the Fracture
	text = {
		trigger = {
			scope:find_oath = flag:mend_the_fracture_oath
		}
		localization_key = GetMendTheFractureOathText
	}

	# Provice for the Warriors
	text = {
		trigger = {
			scope:find_oath = flag:provide_for_the_warriors_oath
		}
		localization_key = GetProvideForTheWarriorsOathText
	}

	# Provide for the Faithful
	text = {
		trigger = {
			scope:find_oath = flag:provide_for_the_faithful_oath
		}
		localization_key = GetProvideForTheFaithfulOathText
	}

	# Provide for the Poor
	text = {
		trigger = {
			scope:find_oath = flag:provide_for_the_poor_oath
		}
		localization_key = GetProvideForThePoorOathText
	}

	# Repent
	text = {
		trigger = {
			scope:find_oath = flag:repent_oath
		}
		localization_key = GetRepentOathText
	}
}

GetRandomConflictDescriptor = {
	type = character
	random_valid = yes

	text = {
		trigger = {
			location = { geographical_region = world_europe }
			reverse_opinion = {
				target = scope:second
				value <= medium_negative_opinion
			}
		}
		localization_key = RandomConflictDescriptorIrelandToCathay
	}
	text = {
		trigger = {
			OR = { faith.religion = religion:protestant_religion faith.religion = religion:catholic_religion faith.religion = religion:eastern_orthodox_religion }
			reverse_opinion = {
				target = scope:second
				value <= medium_negative_opinion
			}
		}
		localization_key = RandomConflictDescriptorAcrossChristendom
	}
	text = {
		trigger = {
			OR = { faith.religion = religion:protestant_religion faith.religion = religion:catholic_religion faith.religion = religion:eastern_orthodox_religion }
			reverse_opinion = {
				target = scope:second
				value <= medium_negative_opinion
			}
			NOT = { # Talk about an edge case!
				is_target_in_global_variable_list = {
					name = unavailable_unique_decisions
					target = flag:flag_mended_great_schism
				}
			}
		}
		localization_key = RandomConflictDescriptorSchism
	}
	text = {
		trigger = {
			reverse_opinion = {
				target = scope:second
				value <= medium_negative_opinion
			}
		}
		localization_key = RandomConflictDescriptorStuffOfLegends
	}
	text = {
		trigger = {
			reverse_opinion = {
				target = scope:second
				value <= medium_negative_opinion
			}
		}
		localization_key = RandomConflictDescriptorFromEastToWest
	}
	text = {
		localization_key = RandomConflictDescriptorMarTheMood
	}
	text = {
		localization_key = RandomConflictDescriptorHangDarkly
	}
}

GetHoFGreeterExchangeFirstPerson = {
	type = character

	text = {
		trigger = {
			faith = {
				OR = {
					has_doctrine_parameter = homosexuality_shunned
					has_doctrine_parameter = homosexuality_illegal
				}
			}
			OR = {
				has_secret_relation_lover = scope:second
				has_relation_lover = scope:second
				has_relation_soulmate = scope:second
			}
			OR = {
				AND = {
					is_female = yes
					scope:second = {
						is_female = yes
					}
				}
				AND = {
					is_male = yes
					scope:second = {
						is_male = yes
					}
				}
			}
		}
		localization_key = HoFGreeterExchangeFPHopefullySubtleEmbrace
	}
	text = {
		trigger = {
			OR = {
				has_relation_lover = scope:second
				has_relation_soulmate = scope:second
			}
		}
		localization_key = HoFGreeterExchangeFPAllTooShortEmbrace
	}
	text = {
		trigger = {
			OR = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:second }
				reverse_opinion = {
					target = scope:second
					value >= very_high_positive_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeFPJoyousEmbrace
	}
	text = {
		trigger = {
			reverse_opinion = {
				target = scope:second
				value >= low_negative_opinion
			}
		}
		localization_key = HoFGreeterExchangeFPBriefAndCourteous
		fallback = yes
	}
	text = {
		trigger = {
			reverse_opinion = {
				target = scope:second
				value >= medium_negative_opinion
			}
		}
		localization_key = HoFGreeterExchangeFPCurtAndBrief
	}
	text = {
		trigger = {
			AND = {
				OR = {
					has_trait = wrathful
					has_trait = irritable
					ai_vengefulness >= low_positive_ai_value
					ai_rationality <= low_negative_ai_value
				}
				scope:second = {
					OR = {
						has_trait = wrathful
						has_trait = irritable
						ai_vengefulness >= low_positive_ai_value
						ai_rationality <= low_negative_ai_value
					}
					opinion = {
						target = PREV
						value >= high_negative_opinion
					}
				}
			}
		}
		localization_key = HoFGreeterExchangeFPVitriolAndAnger
	}
	text = {
		trigger = {
			reverse_opinion = {
				target = scope:second
				value >= high_negative_opinion
			}
		}
		localization_key = HoFGreeterExchangeFPVeiledInsults
	}
}

GetHoFGreeterExchange = {
	type = character

	text = {
		trigger = {
			faith = {
				OR = {
					has_doctrine_parameter = homosexuality_shunned
					has_doctrine_parameter = homosexuality_illegal
				}
			}
			OR = {
				has_relation_lover = scope:second
				has_relation_soulmate = scope:second
			}
			is_male = yes
			scope:second = {
				is_male = yes
			}
		}
		localization_key = HoFGreeterExchangeTenderAndBrotherly
	}
	text = { # They were *roommates!*
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			faith = {
				OR = {
					has_doctrine_parameter = homosexuality_shunned
					has_doctrine_parameter = homosexuality_illegal
				}
			}
			OR = {
				has_relation_lover = scope:second
				has_relation_soulmate = scope:second
			}
			is_female = yes
			scope:second = {
				is_female = yes
			}
		}
		localization_key = HoFGreeterExchangeTenderAndSisterly
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			OR = {
				has_secret_relation_lover = scope:second
				has_relation_lover = scope:second
				has_relation_soulmate = scope:second
			}
		}
		localization_key = HoFGreeterExchangeOverlong
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			OR = {
				has_relation_friend = scope:second
				has_relation_best_friend = scope:second
				AND = {
					opinion = {
						target = scope:second
						value >= very_high_positive_opinion
					}
					scope:second = {
						opinion = {
							target = PREV
							value >= very_high_positive_opinion
						}
					}
				}
			}
		}
		localization_key = HoFGreeterExchangeJoyous
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			opinion = {
				target = scope:second
				value >= low_positive_opinion
			}
			scope:second = {
				opinion = {
					target = PREV
					value >= low_positive_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeCourteous
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			opinion = {
				target = scope:second
				value >= low_negative_opinion
			}
			scope:second = {
				opinion = {
					target = PREV
					value >= low_negative_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeBrief
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			opinion = {
				target = scope:second
				value >= medium_negative_opinion
			}
			scope:second = {
				opinion = {
					target = PREV
					value >= medium_negative_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeTense
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			OR = {
				has_trait = wrathful
				has_trait = irritable
				ai_vengefulness >= low_positive_ai_value
				ai_rationality <= low_negative_ai_value
			}
			opinion = {
				target = scope:second
				value >= high_negative_opinion
			}
			scope:second = {
				OR = {
					has_trait = wrathful
					has_trait = irritable
					ai_vengefulness >= low_positive_ai_value
					ai_rationality <= low_negative_ai_value
				}
				opinion = {
					target = PREV
					value >= high_negative_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeLoudAndCurseLaden
	}
	text = {
		setup_scope = {
			involved_activity ?= { save_scope_as = activity }
			involved_activity.var:officiator ?= {
				save_scope_as = hof
			}
		}
		trigger = {
			opinion = {
				target = scope:second
				value >= high_negative_opinion
			}
			scope:second = {
				opinion = {
					target = PREV
					value >= high_negative_opinion
				}
			}
		}
		localization_key = HoFGreeterExchangeOpenlyHostile
	}
}

GetRandomCoronationObject = {
	type = character
	random_valid = yes

	text = {
		trigger = { var:random_coronation_object ?= flag:white_rod }
		localization_key = RandomCoronationObjectWhiteRod # White Rod of Ireland
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:coronation_cloak }
		localization_key = RandomCoronationObjectCoronationCloak # Imperial coronation cloak
	}
	text = {
		setup_scope = {
			random_equipped_character_artifact = {
				limit = { artifact_slot_type = regalia }
				save_scope_as = equipped_regalia
			}
		}
		trigger = { var:random_coronation_object ?= flag:equipped_regalia }
		localization_key = RandomCoronationObjectRegaliaArtifact
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:apostolic_cross }
		localization_key = RandomCoronationObjectApostolicCross
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:royal_religioustext }
		localization_key = RandomCoronationObjectRoyalReligioustext
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:sceptre_and_orb }
		localization_key = RandomCoronationObjectSceptreAndOrb
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:coronation_spoon }
		localization_key = RandomCoronationObjectCoronationSpoon # Coronation spoon - English but a fun generic
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:coronation_sword }
		localization_key = RandomCoronationObjectCoronationSword
	}
	text = {
		trigger = { var:random_coronation_object ?= flag:coronation_rings }
		localization_key = RandomCoronationObjectCoronationRings
	}
}

GetBusynessOpinion = {
	type = character
	random_valid = no

	text = {
		trigger = {
			OR = {
				has_trait = lazy
				ai_energy < medium_negative_ai_value
			}
		}
		localization_key = BusynessOpinionLazy
	}
	text = {
		trigger = {
			OR = {
				has_trait = diligent
				ai_energy > medium_negative_ai_value
			}
		}
		localization_key = BusynessOpinionDiligent
	}
	text = { localization_key = BusynessOpinionNeutral }
}

GetCoronationSite = {
	type = province
	random_valid = no

	text = { # Palatine Chapel in Aachen
		trigger = {
			religion = religion:christianity_religion
			has_special_building = yes
			has_building_or_higher = palace_of_aachen_01
		}
		localization_key = CoronationSitePalatineChapel
	}

	text = { # Hagia Sophia
		trigger = {
			religion = religion:christianity_religion
			has_special_building = yes
			has_building = hagia_sophia_01
		}
		localization_key = building_hagia_sophia_01
	}

	text = { # Hagia Sophia
		trigger = {
			religion = religion:islam_religion
			has_special_building = yes
			has_building = hagia_sophia_02
		}
		localization_key = building_hagia_sophia_02
	}

	text = { # Church of the Holy Sepulchre
		trigger = {
			religion = religion:christianity_religion
			has_special_building = yes
			OR = {
				has_building_or_higher = dome_of_the_rock_01
				has_building_or_higher = temple_in_jerusalem_01
			}
		}
		localization_key = CoronationSiteChurchOfTheHolySepulchre
	}

	text = { # Wawel Cathedral
		trigger = {
			religion = religion:christianity_religion
			this.barony = title:b_krakow
		}
		localization_key = CoronationSiteWawelCathedral
	}

	text = { # Westminster Abbey
		trigger = {
			religion = religion:christianity_religion
			has_special_building = yes
			has_building_or_higher = the_tower_of_london_01
		}
		localization_key = CoronationSiteWestminsterAbbey
	}

	text = { # [ROOT.Province.GetName]
		trigger = { always = yes }
		localization_key = CoronationSiteLocalHolding
	}
}

GetCoronationSitePrefix = {
	type = province
	random_valid = no

	text = {
		trigger = {
			OR = {
				AND = {
					religion = religion:christianity_religion
					OR = {
						this.barony = title:b_krakow
						has_building_or_higher = palace_of_aachen_01
						has_building = hagia_sophia_01
						has_building_or_higher = dome_of_the_rock_01
						has_building_or_higher = temple_in_jerusalem_01
					}
				}
				AND = {
					religion = religion:islam_religion
					has_building = hagia_sophia_02
				}
			}
		}
		localization_key = the_with_space
	}
	text = { localization_key = blank_line }
}

GetCoronationSiteShort = {
	parent = GetCoronationSite
	suffix = _short
}

# Grabs a random relation - should only use with generated and dummy characters that wouldn't have any relations that contradict this.
GetRandomRelation = {
	type = character

	text = {
		trigger = { is_female = yes }
		localization_key = relation_mother
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_father
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_daughter
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_son
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_grandmother
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_grandfather
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_granddaughter
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_grandson
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_sister
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_brother
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_niece
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_nephew
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_aunt
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_uncle
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_stepdaughter
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_stepson
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_stepsister
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_stepbrother
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_stepmother
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_stepfather
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_sisterinlaw
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_brotherinlaw
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_auntinlaw
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_uncleinlaw
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_grandmotherinlaw
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_grandfatherinlaw
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_nieceinlaw
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_nephewinlaw
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_kinswoman
	}
	text = {
		trigger = { is_female = no }
		localization_key = relation_kinsman
	}
	text = {
		trigger = { is_female = yes }
		localization_key = relation_auntie
	}
	text = {
		trigger = { is_female = yes }
		localization_key = mama
	}
	text = {
		trigger = { is_female = no }
		localization_key = papa
	}
	text = {
		localization_key = relation_cousin
	}
	text = {
		localization_key = relation_best_friend_male
	}
	text = {
		localization_key = relation_friend_male
	}
	text = {
		localization_key = relation_cousininlaw_male
	}
	text = {
		localization_key = relation_chum
	}
	text = {
		localization_key = relation_pal
	}
}

GetTitleTierAdjective = {
	type = character

	text = {
		trigger = {
			highest_held_title_tier >= tier_empire
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_tribal
				government_has_flag = government_is_administrative
				government_has_flag = government_is_nomadic
			}
			culture = {
				OR = {
					has_cultural_pillar = heritage_mongolic
					has_cultural_pillar = heritage_turkic
				}
			}
		}
		localization_key = adjective_khaganal
	}
	text = {
		trigger = { highest_held_title_tier >= tier_empire }
		localization_key = adjective_imperial
	}
	text = {
		trigger = {
			highest_held_title_tier >= tier_kingdom
			OR = {
				government_has_flag = government_is_feudal
				government_has_flag = government_is_tribal
				government_has_flag = government_is_administrative
				government_has_flag = government_is_nomadic
			}
			culture = {
				OR = {
					has_cultural_pillar = heritage_mongolic
					has_cultural_pillar = heritage_turkic
				}
			}
		}
		localization_key = adjective_khanal
	}
	text = {
		trigger = { highest_held_title_tier >= tier_kingdom }
		localization_key = adjective_royal
	}
	#Tribal chieftains come first
	text = {
		trigger = {
			highest_held_title_tier >= tier_county
			government_has_flag = government_is_tribal
			government_has_flag = government_is_nomadic
			government_has_flag = government_is_herder	
		}
		localization_key = adjective_chiefly
	}
	text = {
		trigger = { highest_held_title_tier >= tier_duchy }
		localization_key = adjective_ducal
	}
	text = {
		trigger = { highest_held_title_tier >= tier_county }
		localization_key = adjective_comital
	}
	text = {
		trigger = { highest_held_title_tier >= tier_barony }
		localization_key = adjective_baronial
	}
	text = {
		trigger = { is_lowborn = no }
		localization_key = adjective_noble
	}
	text = {
		localization_key = adjective_common
	}
}

# Headers for Hunt events
HuntHeader = {
	type = character

	# Titlenamehunt
	text = { 
		trigger = {
			OR = {
				has_character_flag = impressive_hunt
				has_character_flag = personal_hunt
				has_character_flag = glorious_hunt
			}
		}
		localization_key = hunt_kings_hunt_header
	}

	# Hunt
	text = { 
		localization_key = hunt_default_header
	}
}

GetLocalCommonerTerm = {
	type = character

	text = { 
		trigger = {
			location.county = {
				any_county_province = {
					OR = {
						has_holding_type = tribal_holding
						has_holding_type = nomad_holding
						has_holding_type = herder_holding
					}
				}
			}
			is_female = no
		}
		localization_key = tribesman
	}
	text = { 
		trigger = {
			location.county = {
				any_county_province = {
					OR = {
						has_holding_type = tribal_holding
						has_holding_type = nomad_holding
						has_holding_type = herder_holding
					}
				}
			}
			is_female = yes
		}
		localization_key = tribeswoman
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_building = city_01
					has_building = temple_01
				}
				county = {
					development_level <= 5
				}
			}
		}
		localization_key = villagers
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_holding_type = city_holding
					has_holding_type = church_holding
				}
			}
			is_female = no
		}
		localization_key = townsman
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_holding_type = city_holding
					has_holding_type = church_holding
				}
			}
			is_female = yes
		}
		localization_key = townswoman
	}
	text = { 
		trigger = {
			location = {
				has_holding_type = castle_holding
			}
		}
		localization_key = peasant
	}
	text = { 
		localization_key = commoner
		fallback = yes
	}
}
GetLocalCommonerTermPlural = {
	type = character

	text = { 
		trigger = {
			location.county = {
				any_county_province = {
					OR = {
						has_holding_type = tribal_holding
						has_holding_type = nomad_holding
						has_holding_type = herder_holding
					}
				}
			}
		}
		localization_key = tribespeople
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_building = city_01
					has_building = temple_01
				}
				county = {
					development_level <= 5
				}
			}
		}
		localization_key = villagers
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_holding_type = city_holding
					has_holding_type = church_holding
				}
				county = {
					development_level >= 20
				}
			}
		}
		localization_key = cityfolk
	}
	text = { 
		trigger = {
			location = {
				OR = {
					has_holding_type = city_holding
					has_holding_type = church_holding
				}
			}
		}
		localization_key = townsfolk
	}
	text = { 
		trigger = {
			location = {
				has_holding_type = castle_holding
			}
		}
		localization_key = peasants
	}
	text = { 
		localization_key = commoners
		fallback = yes
	}
}

GetFighterTerm = {
	type = character
	text = {
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_asia_minor
					geographical_region = world_middle_east_jerusalem
					geographical_region = world_middle_east_arabia
					geographical_region = world_africa_north
				}
			}
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_era_or_later = culture_era_high_medieval
				NOT = {
					has_cultural_parameter = martial_custom_female_only_combatant
				}
			}

		}
		localization_key = man_at_arms
	}
	text = {
		trigger = {
			OR = {
				culture = {
					has_cultural_era_or_later = culture_era_high_medieval
				}
				government_allows = administrative
			}
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
		}
		localization_key = soldier
	}
	text = {
		localization_key = warrior
		fallback = yes
	}
}
GetFighterTermPlural = {
	type = character
	text = {
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_asia_minor
					geographical_region = world_middle_east_jerusalem
					geographical_region = world_middle_east_arabia
					geographical_region = world_africa_north
				}
			}
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_era_or_later = culture_era_high_medieval
				NOT = {
					has_cultural_parameter = martial_custom_female_only_combatant
				}
			}
		}
		localization_key = men_at_arms
	}
	text = {
		trigger = {
			OR = {
				culture = {
					has_cultural_era_or_later = culture_era_high_medieval
				}
				government_allows = administrative
			}
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
		}
		localization_key = soldiers_custom_loc
	}
	text = {
		localization_key = warriors
		fallback = yes
	}
}
GetFighterTermPossessive = {
	type = character
	text = {
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_asia_minor
					geographical_region = world_middle_east_jerusalem
					geographical_region = world_middle_east_arabia
					geographical_region = world_africa_north
				}
			}
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_era_or_later = culture_era_high_medieval
				NOT = {
					has_cultural_parameter = martial_custom_female_only_combatant
				}
			}

		}
		localization_key = man_at_arms_possessive
	}
	text = {
		trigger = {
			OR = {
				culture = {
					has_cultural_era_or_later = culture_era_high_medieval
				}
				government_has_flag = government_is_administrative
			}
			NOR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
		}
		localization_key = soldier_possessive
	}
	text = {
		localization_key = warrior_possessive
		fallback = yes
	}
}
GetMotherlyFatherly = {
	type = character
	text = {
		trigger = {
			is_female = yes
		}
		localization_key = motherly
	}
	text = {
		trigger = {
			is_male = yes
		}
		localization_key = fatherly
	}
	text = {
		localization_key = parental
		fallback = yes
	}
}

GetLowOfficial = {
	type = character
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_administrative
				government_has_flag = government_is_republic
			}
		}
		localization_key = baron_administrative_male_byzantine_group
	}
	
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
		}
		localization_key = tribal_elder
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				OR = {
					has_cultural_pillar = language_french
					has_cultural_pillar = language_occitano_romance
				}
			}
		}
		localization_key = seigneur
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_pillar = language_italian
			}
		}
		localization_key = signore
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				OR = {
					has_cultural_pillar = language_iberian
					has_cultural_pillar = heritage_iberian
				}
			}
		}
		localization_key = hidalgo
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_pillar = language_high_german
			}
		}
		localization_key = junker
	}
	text = {
		trigger = {
			culture = {
				has_cultural_pillar = language_arabic
			}
		}
		localization_key = baron_feudal_male_arabic_group
	}
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_administrative
				government_has_flag = government_is_republic
			}
		}
		localization_key = count_administrative_male
	}

	text = {
		localization_key = nobility_lord
		fallback = yes
	}
}

GetLowOfficialPlural = {
	type = character
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_tribal
				government_has_flag = government_is_nomadic
				government_has_flag = government_is_herder
			}
		}
		localization_key = tribal_elders
	}
	text = {
		trigger = {
			culture = {
				has_cultural_pillar = language_greek
			}
		}
		localization_key = archons
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				OR = {
					has_cultural_pillar = language_french
					has_cultural_pillar = language_occitano_romance
				}
			}
		}
		localization_key = seigneurs
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_pillar = language_italian
			}
		}
		localization_key = signori
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				OR = {
					has_cultural_pillar = language_iberian
					has_cultural_pillar = heritage_iberian
				}
			}
		}
		localization_key = hidalgos
	}
	text = {
		trigger = {
			government_has_flag = government_is_feudal
			culture = {
				has_cultural_pillar = language_high_german
			}
		}
		localization_key = junkers
	}
	text = {
		trigger = {
			culture = {
				has_cultural_pillar = language_arabic
			}
		}
		localization_key = walis
	}
	text = {
		trigger = {
			OR = {
				government_has_flag = government_is_administrative
				government_has_flag = government_is_republic
			}
		}
		localization_key = magistrates
	}
	text = {
		localization_key = nobility_lord_plural
		fallback = yes
	}
}

GetRegionalSword = {
	type = character
	text = {
		trigger = {
			culture = { has_cultural_pillar = heritage_japonic }
		}
		localization_key = katana 
	}
	text = {
		trigger = {
			culture = {
				has_graphical_iranian_culture_group_trigger = yes
			}
		}
		localization_key = shamshir
	}
	text = {
		trigger = {
			culture = {
				has_graphical_african_culture_group_trigger = yes
				has_cultural_era_or_later = culture_era_high_medieval
				has_cultural_pillar = heritage_east_african
			}
		}
		localization_key = shotel
	}
	text = {
		trigger = {
			culture = {
				has_graphical_african_culture_group_trigger = yes
				has_cultural_pillar = heritage_akan
			}
		}
		localization_key = akrafena
	}
	text = {
		trigger = {
			culture = {
				has_graphical_african_culture_group_trigger = yes
				has_cultural_pillar = heritage_yoruba
			}
		}
		localization_key = ida
	}
	text = {
		trigger = {
			culture = {
				has_graphical_african_culture_group_trigger = yes
				OR = {
					has_cultural_pillar = heritage_central_african
					has_cultural_pillar = heritage_berber
					has_cultural_pillar = heritage_sahelian
				}
				
			}
		}
		localization_key = takoba
	}
	text = {
		trigger = {
			culture = {
				has_cultural_pillar = heritage_burman
				
			}
		}
		localization_key = dha
	}
	text = {
		trigger = {
			culture = {
				has_graphical_india_culture_group_trigger = yes
				has_cultural_era_or_later = culture_era_late_medieval
				current_year >= 1300
			}
		}
		localization_key = talwar
	}
	text = {
		trigger = {
			culture = {
				has_graphical_india_culture_group_trigger = yes
			}
		}
		localization_key = khanda
	}
	text = {
		trigger = {
			culture = {
				has_cultural_era_or_later = culture_era_early_medieval
				has_cultural_pillar = heritage_turkic
			}
		}
		localization_key = kilij
	}
	text = {
		trigger = {
			culture = { has_graphical_steppe_culture_group_trigger = yes }
		}
		localization_key = saber
	}
	text = {
		trigger = {
			culture = {
				has_cultural_era_or_later = culture_era_high_medieval
				has_graphical_western_culture_group_trigger = yes
			}
			has_character_flag = need_military_outfit
		}
		localization_key = longsword
	}
	text = {
		trigger = {
			culture = {
				has_cultural_era_or_later = culture_era_late_medieval
				has_graphical_western_culture_group_trigger = yes
				current_year >= 1300
			}
		}
		localization_key = estoc
	}
	text = {
		trigger = {
			culture = {
				has_graphical_mena_culture_group_trigger = yes
				has_cultural_pillar = language_arabic
			}
		}
		localization_key = saif
	}
	text = {
		trigger = {
			culture = {
				has_graphical_mediterranean_culture_group_trigger = yes
				has_cultural_pillar = heritage_byzantine
			}
		}
		localization_key = spathion
	}
	text = {
		trigger = {
			culture = {
				has_graphical_mena_culture_group_trigger = yes
			}
		}
		localization_key = scimitar
	}
	text = {
		localization_key = signature_weapon_sword
		fallback = yes
	}
}

#For tribal versus non tribal history making
GetChronicleSaga = {
	type = character
	text = {
		trigger = {
			OR = {
        		government_has_flag = government_is_tribal
        		government_has_flag = government_is_nomadic
        		government_has_flag = government_is_herder
        		AND = {
        			culture = {
        				NOT = {
        					has_cultural_era_or_later = culture_era_high_medieval
        				}
        			}
        			faith = {
        				has_doctrine_parameter = unreformed
        			}
        		}
        	}
		}
		localization_key = saga
	}
	text = {
		localization_key = chronicle
		fallback = yes
	}
}
