#GetMythicalFounder
#GetRandomExteriorDetail
#GetRandomInteriorDetail
#GetWritingMaterial
#GetMusicalInstrument
#GetMusicalInstrumentPlural
#GetAncestorName
#GetSaintlyTrait
#GetPiousAdj
#GetCustodianSynonym

#reusing the claim throne custom loc to be a generic effect
#IMPORTANT: use the grab_appropriate_chronicler_effect in the immediate of the event or similar so it sets your mythical ancestor variable - this is done so we can always refer to the same ancestor
#ask before expanding pls
GetMythicalFounder = {
	type = character
	random_valid = yes

#	text = { # Charles Martell
#		trigger = {
#			var:mythical_ancestor_var = flag:charles_martell
#		}
#		localization_key = MythicalFounder_charles_martell
#	}
#	text = { # Alexander the Great
#		trigger = {
#			var:mythical_ancestor_var = flag:alexander
#		}
#		localization_key = MythicalFounder_alexander
#	}
#	text = { # Lech
#		trigger = {
#			var:mythical_ancestor_var = flag:lech
#		}
#		localization_key = MythicalFounder_lech
#	}
#	text = { # Czech
#		trigger = {
#			var:mythical_ancestor_var = flag:czech
#		}
#		localization_key = MythicalFounder_czech
#	}
#	text = { # Rus
#		trigger = {
#			var:mythical_ancestor_var = flag:rus
#		}
#		localization_key = MythicalFounder_rus
#	}
#	text = { # King Arthur
#		trigger = {
#			var:mythical_ancestor_var = flag:arthur
#		}
#		localization_key = MythicalFounder_arthur
#	}
#	text = { # Corineus
#		trigger = {
#			var:mythical_ancestor_var = flag:corineus
#		}
#		localization_key = MythicalFounder_corineus
#	}
#	text = { # Magnus Maximus
#		trigger = {
#			var:mythical_ancestor_var = flag:magnus_maximus
#		}
#		localization_key = MythicalFounder_magnus_maximus
#	}
#	text = { # Brutus of Troy
#		trigger = {
#			var:mythical_ancestor_var = flag:brutus
#		}
#		localization_key = MythicalFounder_brutus
#	}
#	text = { # Aeneas
#		trigger = {
#			var:mythical_ancestor_var = flag:aeneas
#		}
#		localization_key = MythicalFounder_aeneas
#	}
#	text = { # Scota
#		trigger = {
#			var:mythical_ancestor_var = flag:scota
#		}
#		localization_key = MythicalFounder_scota
#	}
#	text = { # Romulus
#		trigger = {
#			var:mythical_ancestor_var = flag:romulus
#		}
#		localization_key = MythicalFounder_romulus
#	}
#	text = { # Numa Pompilius
#		trigger = {
#			var:mythical_ancestor_var = flag:numa
#		}
#		localization_key = MythicalFounder_numa
#	}
#	text = { # Belisarius
#		trigger = {
#			var:mythical_ancestor_var = flag:belisarius
#		}
#		localization_key = MythicalFounder_belisarius
#	}
#	text = { # Ardashir
#		trigger = {
#			var:mythical_ancestor_var = flag:ardashir
#		}
#		localization_key = MythicalFounder_ardashir
#	}
#	text = { # Pharaohs
#		trigger = {
#			var:mythical_ancestor_var = flag:pharaohs
#		}
#		localization_key = MythicalFounder_pharaohs
#	}
#	text = { # Visigothic Kings
#		trigger = {
#			var:mythical_ancestor_var = flag:visigothic_kings
#		}
#		localization_key = MythicalFounder_visigothic_kings
#	}
#	text = { # Abd al-Rahman
#		trigger = {
#			var:mythical_ancestor_var = flag:abd_al_rahman
#		}
#		localization_key = MythicalFounder_abd_al_rahman
#	}
#	text = { # Zenobia
#		trigger = {
#			var:mythical_ancestor_var = flag:zenobia
#		}
#		localization_key = MythicalFounder_zenobia
#	}
#	text = { # King Solomon
#		trigger = {
#			var:mythical_ancestor_var = flag:solomon
#		}
#		localization_key = MythicalFounder_solomon
#	}
#	text = { # Conan Meriadoc
#		trigger = {
#			var:mythical_ancestor_var = flag:conan_meriadoc
#		}
#		localization_key = MythicalFounder_conan_meriadoc
#	}
#	text = { # Pishdadian Dynasty
#		trigger = {
#			var:mythical_ancestor_var = flag:pishdadian
#		}
#		localization_key = MythicalFounder_pishdadian
#	}
#	text = { # Chościsko
#		trigger = {
#			var:mythical_ancestor_var = flag:choscisko
#		}
#		localization_key = MythicalFounder_choscisko
#	}
#	text = { # Arsacids
#		trigger = {
#			var:mythical_ancestor_var = flag:arsacids
#		}
#		localization_key = MythicalFounder_arsacids
#	}
#	text = { # King David
#		trigger = {
#			var:mythical_ancestor_var = flag:david
#		}
#		localization_key = MythicalFounder_david
#	}
#	text = { # Karkota Naga
#		trigger = {
#			var:mythical_ancestor_var = flag:naga
#		}
#		localization_key = MythicalFounder_naga
#	}
#	text = { # God Brahman
#		trigger = {
#			var:mythical_ancestor_var = flag:brahman
#		}
#		localization_key = MythicalFounder_brahman
#	}
#	text = { # Odin
#		trigger = {
#			var:mythical_ancestor_var = flag:odin
#		}
#		localization_key = MythicalFounder_odin
#	}
#	text = { # Ragnar Lodbrok
#		trigger = {
#			var:mythical_ancestor_var = flag:ragnar
#		}
#		localization_key = MythicalFounder_ragnar
#	}
#	text = { # Brunhild
#		trigger = {
#			var:mythical_ancestor_var = flag:brunhild
#		}
#		localization_key = MythicalFounder_brunhild
#	}
#	text = { # Eremon
#		trigger = {
#			var:mythical_ancestor_var = flag:eremon
#		}
#		localization_key = MythicalFounder_eremon
#	}
#	text = { # Eber
#		trigger = {
#			var:mythical_ancestor_var = flag:eber
#		}
#		localization_key = MythicalFounder_eber
#	}
#	text = { # Genghis Khan
#		trigger = {
#			var:mythical_ancestor_var = flag:genghis
#		}
#		localization_key = MythicalFounder_genghis
#	}
#	text = { # Emperor Constantine I
#		trigger = {
#			var:mythical_ancestor_var = flag:constantine
#		}
#		localization_key = MythicalFounder_constantine
#	}
#	text = { # Emperor Justinian I
#		trigger = {
#			var:mythical_ancestor_var = flag:justinian
#		}
#		localization_key = MythicalFounder_justinian
#	}
#	text = { # Melusine
#		trigger = {
#			var:mythical_ancestor_var = flag:melusine
#		}
#		localization_key = MythicalFounder_melusina
#	}
	text = { # Fallback
		trigger = {
			var:mythical_ancestor_var = flag:fallback
		}
		localization_key = MythicalFounder_fallback
	}
}

GetRandomExteriorDetail = { #Remember to use the 1st person present in the loc, feel free to expand
	type = character
	random_valid = yes

	text = { # You see a small bird among the trees
		trigger = {
			location = {
				OR = {
					terrain = forest
					terrain = jungle
				}
			}
		}
		localization_key = GetRandomExteriorDetail_small_bird
	}
	text = { # You hear a bird
		trigger = {
			location = {
				OR = {
					terrain = forest
					terrain = jungle
					terrain = plains
					terrain = hills
					terrain = mountains
				}
			}
		}
		localization_key = GetRandomExteriorDetail_birdsong
	}
	text = { # You find a wildflower
		trigger = {
			location = {
				OR = {
					terrain = desert
					terrain = desert_mountains
					terrain = drylands
					terrain = mountains
				}
			}
		}
		localization_key = GetRandomExteriorDetail_wildflower
	}
	text = { # You hear someone singing
		trigger = {
			location = {
				has_holding_type = castle_holding
			}
		}
		localization_key = GetRandomExteriorDetail_singing
	}
	text = { # You smell a banquet
		trigger = {
			location = {
				has_holding_type = castle_holding
			}
		}
		localization_key = GetRandomExteriorDetail_banquet
	}
	text = { # You hear the prayers
		trigger = {
			location = {
				has_holding_type = church_holding
			}
		}
		localization_key = GetRandomExteriorDetail_praying
	}
	text = { # You hear the bells
		trigger = {
			location = {
				has_holding_type = church_holding
				county = { NEOW_religion_is_broadly_christian_trigger = yes }
			}
		}
		localization_key = GetRandomExteriorDetail_bells
	}
	text = { # You see a passing merchant
		trigger = {
			location = {
				OR = {
					has_holding_type = city_holding
					has_building_or_higher = market_villages_01
				}
			}
		}
		localization_key = GetRandomExteriorDetail_merchant
	}
	text = { # You see someone fishing
		trigger = {
			location = {
				OR = {
					is_coastal = yes
					is_riverside_province = yes
				}
			}
		}
		localization_key = GetRandomExteriorDetail_fishing
	}
	text = { # You see snow
		trigger = {
			location = {
				has_province_modifier = winter_harsh_modifier
			}
		}
		localization_key = GetRandomExteriorDetail_snow
	}
	
	text = { # You see a peddler
		trigger = {
			location = {
				has_holding_type = city_holding
			}
		}
		localization_key = peddler_passing_by_in_hurry_pres
	}
}

GetRandomInteriorDetail = { #Remember to use the gerund in the loc, feel free to expand
	type = character
	random_valid = yes
	
	text = { # A pantler carrying supplies
		localization_key = pantler_carrying_supplies
	}
	
	text = { # A cook scolding servants
		localization_key = cook_scolding_servants
	}
	
	text = { # A lady sewing
		trigger = {
			OR = {
				is_female = yes
				any_spouse ?= {
					is_female = yes
				}
			}
		}
		localization_key = lady_in_waiting_embroidering
	}
	
	text = { # A page brandishing armor
		trigger = {
			any_knight ?= {
				location = root.location
			}
		}
		localization_key = page_brandishing_armor
	}
	
	text = { # A draft banging the shutters
		trigger = {
			location = {
				NOT = { terrain = desert }
			}
		}
		localization_key = draft_from_window
	}

	text = {
		localization_key = servant_struggling_with_vase
	}

	text = {
		localization_key = courtier_passing_by_in_hurry
	}

	text = {
		localization_key = fly_crawling_on_decoration
	}

	text = {
		localization_key = feather_drift_past
	}
	
	text = {
		localization_key = cupbearer_pours_drink
	}
	
	text = {
		trigger = {
			location = {
				has_holding_type = castle_holding
			}
		}
		localization_key = courtiers_chat
	}	
}

GetWritingMaterial = {
	type = character
	random_valid = yes
	
	text = { # Parchment
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east_jerusalem
					AND = {
						geographical_region = world_steppe
						culture = { has_cultural_era_or_later = culture_era_late_medieval }
					}
				}
			}
		}
		localization_key = GetWritingMaterial_parchment
	}
	
	text = { # Papyrus
		trigger = {
			location = {
				geographical_region = custom_roman_aegyptus
			}
		}
		localization_key = GetWritingMaterial_papyrus
	}
	
	text = { # Vellum
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = ghw_region_afghanistan
					geographical_region = world_india_rajastan
				}
			}
		}
		localization_key = GetWritingMaterial_vellum
	}
	
	text = { # Palm leaf
		trigger = {
			location = {
				OR = {
					geographical_region = world_india
					geographical_region = world_burma
					geographical_region = world_asia_southeast
				}
			}
		}
		localization_key = GetWritingMaterial_palm_leaf
	}
	
	text = { # Stone stele
		trigger = {
			location = {
				geographical_region = world_steppe
			}
		}
		localization_key = GetWritingMaterial_stone_stele
	}
	
	text = { # Birch bark
		trigger = {
			location = {
				OR = {
					geographical_region = world_india
					geographical_region = world_tibet
					geographical_region = ghw_region_russia #Old Slavonic
				}
			}
		}
		localization_key = GetWritingMaterial_birch_bark
		fallback = yes
	}
	text = { # Paper
		trigger = {
			location = {
				OR = {
					geographical_region = world_asia_china
					geographical_region = world_asia_japan
					geographical_region = world_asia_korea
				}
			}
		}
		localization_key= GetWritingMaterial_paper
	}
}

GetWritingMaterialPlural = {
	type = character
	random_valid = yes
	
	text = { # Parchment
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east_jerusalem
					AND = {
						geographical_region = world_steppe
						culture = { has_cultural_era_or_later = culture_era_late_medieval }
					}
				}
			}
		}
		localization_key = GetWritingMaterial_parchment_plural
	}
	
	text = { # Papyrus
		trigger = {
			location = {
				geographical_region = custom_roman_aegyptus
			}
		}
		localization_key = GetWritingMaterial_papyrus_plural
	}
	
	text = { # Vellum
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = ghw_region_afghanistan
					geographical_region = world_india_rajastan
				}
			}
		}
		localization_key = GetWritingMaterial_vellum_plural
	}
	
	text = { # Palm leaf
		trigger = {
			location = {
				OR = {
					geographical_region = world_india
					geographical_region = world_burma
					geographical_region = world_asia_southeast
				}
			}
		}
		localization_key = GetWritingMaterial_palm_leaf_plural
	}
	
	text = { # Stone stele
		trigger = {
			location = {
				geographical_region = world_steppe
			}
		}
		localization_key = GetWritingMaterial_stone_stele_plural
	}
	
	text = { # Birch bark
		trigger = {
			location = {
				OR = {
					geographical_region = world_india
					geographical_region = world_tibet
					geographical_region = ghw_region_russia #Old Slavonic
				}
			}
		}
		localization_key = GetWritingMaterial_birch_bark_plural
		fallback = yes
	}

	text = { # Paper
		trigger = {
			location = {
				OR = {
					geographical_region = world_asia_china
					geographical_region = world_asia_japan
					geographical_region = world_asia_korea
					geographical_region = world_asia_southeast
				}
			}
		}
		localization_key= GetWritingMaterial_paper_plural
	}
}

GetMusicalInstrument = {
	type = character
	random_valid = yes
	
	text = { # Flute
		localization_key = GetMusicalInstrument_flute
	}
	
	text = { # Drum
		fallback = yes
		localization_key = GetMusicalInstrument_drum
	}
	
	text = { # Trumpet
		localization_key = GetMusicalInstrument_trumpet
	}
	
	text = { # Harp
		localization_key = GetMusicalInstrument_harp
	}
	
	text = { # Lute
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_lute
	}
	
	text = { # Fiddle
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_fiddle
	}
	
	text = { # Lyre
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
					geographical_region = world_africa_east
				}
			}
		}
		localization_key = GetMusicalInstrument_lyre
	}
	
	text = { # Tambourine
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_tambourine
	}

	text = { # Bagpipes
		trigger = {
			culture = { has_cultural_era_or_later = culture_era_high_medieval }
		}
		localization_key = GetMusicalInstrument_bagpipe
	}
	
	text = { # Hurdy-Gurdy
		trigger = {
			location = {
				geographical_region = world_europe
			}
			culture = { has_cultural_era_or_later = culture_era_late_medieval }
		}
		localization_key = GetMusicalInstrument_hurdy_gurdy
	}
}

GetMusicalInstrumentPlural = {
	type = character
	random_valid = yes
	
	text = { # Flute
		localization_key = GetMusicalInstrument_flute_plural
	}
	
	text = { # Drum
		fallback = yes
		localization_key = GetMusicalInstrument_drum_plural
	}
	
	text = { # Trumpet
		localization_key = GetMusicalInstrument_trumpet_plural
	}
	
	text = { # Harp
		localization_key = GetMusicalInstrument_harp_plural
	}
	
	text = { # Lute
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_lute_plural
	}
	
	text = { # Fiddle
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_fiddle_plural
	}
	
	text = { # Lyre
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
					geographical_region = world_africa_east
				}
			}
		}
		localization_key = GetMusicalInstrument_lyre_plural
	}
	
	text = { # Tambourine
		trigger = {
			location = {
				OR = {
					geographical_region = world_europe
					geographical_region = world_middle_east
					geographical_region = world_africa_north
				}
			}
		}
		localization_key = GetMusicalInstrument_tambourine_plural
	}

	text = { # Bagpipes
		trigger = {
			culture = { has_cultural_era_or_later = culture_era_high_medieval }
		}
		localization_key = GetMusicalInstrument_bagpipe_plural
	}
	
	text = { # Hurdy-Gurdy
		trigger = {
			location = {
				geographical_region = world_europe
			}
			culture = { has_cultural_era_or_later = culture_era_late_medieval }
		}
		localization_key = GetMusicalInstrument_hurdy_gurdy_plural
	}
}

GetPlagueEffect = {
	type = character
	random_valid = yes
	
	text = {
		localization_key = GetPlagueEffect_fire
	}
	
	text = {
		localization_key = GetPlagueEffect_limbs
	}
	
	text = {
		localization_key = GetPlagueEffect_thirdeye
	}
	
	text = {
		localization_key = GetPlagueEffect_nipple
	}

	text = {
		localization_key = GetPlagueEffect_blue
	}

	text = {
		localization_key = GetPlagueEffect_hairy
	}

	text = {
		localization_key = GetPlagueEffect_fingernails
	}

	text = {
		localization_key = GetPlagueEffect_eyes
	}
}

LegendaryShrineName = {
	type = province

	text = {
		trigger = {
			exists = var:leg_b_name
		}
		localization_key = checked_leg_b_name
	}

	text = {
		localization_key = building_type_legendary_shrine
	}
}

LegendaryPalaceName = {
	type = province

	text = {
		trigger = {
			exists = var:leg_b_name
		}
		localization_key = checked_leg_b_name
	}

	text = {
		localization_key = building_type_legendary_palace
	}
}

LegendaryStatueName = {
	type = province

	text = {
		trigger = {
			exists = var:leg_b_name
		}
		localization_key = checked_leg_b_name
	}

	text = {
		localization_key = building_type_legendary_statue
	}
}

LegendaryWatchtowerName = {
	type = province

	text = {
		trigger = {
			exists = var:leg_b_name
		}
		localization_key = checked_leg_b_name
	}

	text = {
		localization_key = building_type_legendary_watchtower
	}
}

LegendaryHuntingLodgeName = {
	type = province

	text = {
		trigger = {
			exists = var:leg_b_name
		}
		localization_key = checked_leg_b_name
	}

	text = {
		localization_key = building_type_legendary_hunting_lodge
	}
}

GetAncestorName = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_name
	}
}

GetAncestorNamePossessive = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name_possessive
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_namepossessive
	}
}

GetAncestorFirstName = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_firstname
	}
}

GetAncestorFirstNamePossessive = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name_possessive
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_firstnamepossessive
	}
}

GetAncestorNameNoTooltip = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_namenotooltip
	}
}

GetAncestorNamePossessiveNoTooltip = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name_possessive
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_namepossessivenotooltip
	}
}

GetAncestorFirstNameNoTooltip = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_firstnamenotooltip
	}
}

GetAncestorFirstNamePossessiveNoTooltip = {
	type = legend

	text = {
		trigger = {
			exists = legend_property:ancestor_flag
		}
		localization_key = ancestor_flag_name_possessive
	}

	text = {
		trigger = {
			exists = legend_property:ancestor
		}
		localization_key = ancestor_firstnamepossessivenotooltip
	}
}

GetBirthCircumstancesLegend = {
	type = legend

	text = {
		trigger = {
			legend_property:reason ?= flag:virgin
		}
		localization_key = born_to_a_virgin_mother
	}

	text = {
		trigger = {
			NOT = {
				legend_property:reason = flag:virgin
			}
		}
		localization_key = born_under_auspicious_stars
	}
}

GetSaintlyTrait = {
	type = character
	
	text = {
		trigger = {
			has_trait = theologian
		}
		localization_key = GetSaintlyTrait_theologian
	}

	text = {
		trigger = {
			has_trait = sayyid
		}
		localization_key = GetSaintlyTrait_sayyid
	}
}

GetPiousAdj = {
	type = character
	random_valid = yes
	
	text = {
		localization_key = GetPiousAdj_pious
	}
	text = {
		localization_key = GetPiousAdj_sacred
	}
	text = {
		localization_key = GetPiousAdj_holy
	}
	text = {
		localization_key = GetPiousAdj_devout
	}
	text = {
		localization_key = GetPiousAdj_religious
	}
	text = {
		localization_key = GetPiousAdj_saintly
	}
}

GetDescendantSynonym = {
	type = character
	random_valid = yes
	
	text = {
		localization_key = GetDescendantSynonym_descendant
	}
	text = {
		localization_key = GetDescendantSynonym_offspring
	}
	text = {
		localization_key = GetDescendantSynonym_heir
	}
	text = {
		localization_key = GetDescendantSynonym_progeny
	}
	text = {
		localization_key = GetDescendantSynonym_scion
	}
}

GetCustodianSynonym = {
	type = character
	random_valid = yes
	
	text = {
		localization_key = GetCustodianSynonym_custodian
	}
	text = {
		localization_key = GetCustodianSynonym_guardian
	}
	text = {
		localization_key = GetCustodianSynonym_protector
	}
	text = {
		localization_key = GetCustodianSynonym_keeper
	}
	text = {
		localization_key = GetCustodianSynonym_defender
	}
}