#Random Very Small Creature - so small it can reasonably fit inside a boot.
RandomVerySmallCreature = {
	type = character

	random_valid = yes

	text = {
		localization_key = a_toad
	}

	text = {
		localization_key = a_snake
	}

	text = {
		localization_key = a_grasshopper
	}

	text = {
		localization_key = a_mouse
	}

	text = {
		localization_key = a_rat
	}

	text = {
		localization_key = a_mole
	}

	text = {
		localization_key = a_hedgehog
	}

	text = {
		localization_key = a_spider
	}
}

#Should the very small creature be able to appear in more than just a boot?
RandomVerySmallCreatureDwelling = {
	type = character

	random_valid = yes

	text = {
		localization_key = a_boot
	}

	text = {
		localization_key = a_vase
	}

	text = {
		localization_key = a_stone_wall
	}

	text = {
		localization_key = a_crate
	}

	text = {
		localization_key = a_basket
	}

	text = {
		localization_key = a_tree_stump
	}

	text = {
		localization_key = a_plant_pot
	}

	text = {
		localization_key = a_helmet
	}
}

RandomPeasantGrievance = {
	type = character

	random_valid = yes

	text = {
		localization_key = pray_for_rain
	}

	text = {
		localization_key = pray_for_health
	}

	text = {
		localization_key = pray_for_gold
	}

	text = {
		localization_key = pray_for_love
	}
}

GetDomicileTypeConcept = {
	type = character

	text = {
		trigger = {
			domicile ?= { is_domicile_type = japanese_manor }
		}
		localization_key = JAPANESE_MANOR
	}

	text = {
		trigger = {
			domicile ?= { is_domicile_type = minority_community }
		}
		localization_key = MINORITY_COMMUNITY
	}
	text = {
		trigger = {
			NOT = {
				domicile ?= { is_domicile_type = japanese_manor }
			}
		}
		localization_key = ESTATE
		fallback = yes
	}
}

GetDomicileType = {
	type = character

	text = {
		trigger = {
			domicile ?= { is_domicile_type = japanese_manor }
		}
		localization_key = game_concept_manor
	}

	text = {
		trigger = {
			domicile ?= { is_domicile_type = minority_community }
		}
		localization_key = game_concept_minority_community
	}
	text = {
		trigger = {
			NOT = {
				domicile ?= { is_domicile_type = japanese_manor }
			}
		}
		localization_key = game_concept_estate
		fallback = yes
	}
}

GetRaidDomicileType = {
	type = character

	text = {
		trigger = {
			domicile ?= { is_domicile_type = japanese_manor }
		}
		localization_key = raid_manor
	}

	text = {
		trigger = {
			domicile ?= { is_domicile_type = minority_community }
		}
		localization_key = raid_minority_community
	}
	text = {
		trigger = {
			NOT = {
				domicile ?= { is_domicile_type = japanese_manor }
			}
		}
		localization_key = raid_estate
		fallback = yes
	}
}

ActivityGetFaileesBothAll = {
	type = character

	text = {
		trigger = { var:num_exam_family_entrants_failed = 2 }
		localization_key = FaileesBoth
	}

	text = {
		trigger = { var:num_exam_family_entrants_failed > 2 }
		localization_key = FaileesAll
	}
}

ActivityGetSuccessfulBothAll = {
	type = character

	text = {
		trigger = { var:num_exam_family_entrants_passed = 2 }
		localization_key = FaileesBoth
	}

	text = {
		trigger = { var:num_exam_family_entrants_passed > 2 }
		localization_key = FaileesAll
	}	
}

GetSinMisdeed = {
	type = character

	text = {
		trigger = {
			root.religion = { is_in_family = rf_abrahamic }
		}
		localization_key = sin_concept
	}

	text = {
		trigger = {
			NOT = {
				root.religion = { is_in_family = rf_abrahamic }			
			}
		}
		localization_key = misdeed_concept
	}
}

GetSinMisdeedPlural = {
	type = character

	parent = GetSinMisdeed
	suffix = "_plural"
}

GetSinfulShameful = {
	type = character

	text = {
		trigger = {
			root.religion = { is_in_family = rf_abrahamic }
		}
		localization_key = sinful_concept
	}

	text = {
		trigger = {
			NOT = {
				root.religion = { is_in_family = rf_abrahamic }			
			}
		}
		localization_key = shameful_concept
	}	
}

GetPiousBelievers = {
	type = character

	text = {
		trigger = {
			root.religion = { is_in_family = rf_abrahamic }
		}
		localization_key = pious_concept
	}

	text = {
		trigger = {
			NOT = {
				root.religion = { is_in_family = rf_abrahamic }			
			}
		}
		localization_key = believers_concept
	}
}


GetWickedDangerous = {
	type = character

	text = {
		trigger = {
			root.religion = { is_in_family = rf_abrahamic }
		}
		localization_key = wicked_concept
	}

	text = {
		trigger = {
			NOT = {
				root.religion = { is_in_family = rf_abrahamic }			
			}
		}
		localization_key = dangerous_concept
	}
}

GetHeathenMiscreant = {
	type = character

	text = {
		trigger = {
			root.religion = { is_in_family = rf_abrahamic }
		}
		localization_key = heathen_concept
	}

	text = {
		trigger = {
			NOT = {
				root.religion = { is_in_family = rf_abrahamic }			
			}
		}
		localization_key = miscreant_concept
	}
}

TeachingsAccordingToMovement = {
	type = character

	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				OR = {
					participant_group_type = hegemon_ruler
					participant_group_type = pro_hegemon_movement
				}
			}
		}
		localization_key = TeachingsAccordingToMovementProHegemon_Teaching
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = expansion_movement
			}
		}
		localization_key = TeachingsAccordingToMovementExpansion_Teaching
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = advancement_movement
			}
		}
		localization_key = TeachingsAccordingToMovementAdvancement_Teaching
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = conservative_movement
			}
		}
		localization_key = TeachingsAccordingToMovementConservative_Teaching
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = undecided_movement
			}
		}
		localization_key = TeachingsAccordingToMovementUndecided_Teaching
	}
	text = {
		fallback = yes
		localization_key = TeachingsAccordingToMovementFallback_Teaching
	}
}

TeachingResponsesAccordingToMovement = {
	type = character

	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				OR = {
					participant_group_type = hegemon_ruler
					participant_group_type = pro_hegemon_movement
				}
			}
		}
		localization_key = TeachingsAccordingToMovementProHegemon_Response
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = expansion_movement
			}
		}
		localization_key = TeachingsAccordingToMovementExpansion_Response
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = advancement_movement
			}
		}
		localization_key = TeachingsAccordingToMovementAdvancement_Response
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = conservative_movement
			}
		}
		localization_key = TeachingsAccordingToMovementConservative_Response
	}
	text = {
		trigger = { 
			top_participant_group:dynastic_cycle ?= {
				participant_group_type = undecided_movement
			}
		}
		localization_key = TeachingsAccordingToMovementUndecided_Response
	}
	text = {
		fallback = yes
		localization_key = TeachingsAccordingToMovementFallback_Response
	}
}

GetRandomHistoryPassage = {
	type = character

	random_valid = yes

	text = {
		localization_key = five_sons_history
	}
	text = {
		localization_key = hounds_history
	}
	text = {
		localization_key = testamenary_history
	}
	text = {
		localization_key = virtue_history
	}
	text = {
		localization_key = oaths_history
	}
	text = {
		localization_key = councels_history
	}
	text = {
		localization_key = canon_history
	}
}

GetRandomPoetryPassage = {
	type = character

	random_valid = yes

	text = {
		localization_key = wei_poetry
	}
	text = {
		localization_key = qi_poetry
	}
	text = {
		localization_key = kuai_poetry
	}
	text = {
		localization_key = decade_poetry
	}
	text = {
		localization_key = sheng_poetry
	}
	text = {
		localization_key = praise_poetry
	}
	text = {
		localization_key = sacrificial_poetry
	}
}

GetRandomAncientChinesePoet = {
	type = character

	random_valid = yes

	text = {
		localization_key = wang_wei # Wang Wei
	}
	text = {
		localization_key = tao_yuanming # Tao Yuanming
	}
	text = {
		localization_key = li_bai # Li Bai
	}
	text = {
		localization_key = du_fu # Du Fu
	}
	text = {
		localization_key = meng_haoran # Meng Haoran
	}
	text = {
		localization_key = liu_zongyuan # Liu Zongyuan
	}
	text = {
		localization_key = bai_juyi # Bai Juyi
	}
}

GetRandomAnnalsPassage = {
	type = character

	random_valid = yes

	text = {
		localization_key = yin_annals
	}
	text = {
		localization_key = huan_annals
	}
	text = {
		localization_key = zhuang_annals
	}
	text = {
		localization_key = min_annals
	}
	text = {
		localization_key = xi_annals
	}
	text = {
		localization_key = wen_annals
	}
	text = {
		localization_key = xuan_annals
	}
	text = {
		localization_key = cheng_annals
	}
}

GetRandomRitesPassage = {
	type = character

	random_valid = yes

	text = {
		localization_key = ai_rites
	}
	text = {
		localization_key = implements_rites
	}
	text = {
		localization_key = mourning_rites
	}
	text = {
		localization_key = cap_rites
	}
	text = {
		localization_key = scholar_rites
	}
	text = {
		localization_key = banquet_rites
	}
	text = {
		localization_key = doctrine_rites
	}
	text = {
		localization_key = pattern_rites
	}
}

GetRegionalPoetryExam = {
	type = character

	text = {
		trigger = { 
			has_government = celestial_government
		}
		localization_key = four_part_poetry_china
	}
	text = {
		trigger = { 
			has_government = meritocratic_government
		}
		localization_key = four_part_poetry_korea
	}
}

GetArtifactDecayDesc = {
	type = artifact 

	random_valid = yes

	text = {
		trigger = {
			OR = {
				artifact_type = armor_mail
				artifact_type = armor_plate
				artifact_type = armor_lamellar
				artifact_type = armor_laminar
				artifact_type = armor_brigandine
				artifact_type = miscellaneous
				artifact_type = brooch
				artifact_type = brooch_pedestal
				artifact_type = necklace
				artifact_type = regalia
				artifact_type = spear
				artifact_type = dagger
				artifact_type = sword
				artifact_type = mace
				artifact_type = goblet
			}
		}
		localization_key = artifact_decay_scratched
	}

	text = {
		trigger = {
			OR = {
				artifact_type = dagger
				artifact_type = sword
				artifact_type = mace
				artifact_type = axe
				artifact_type = hammer
			}
		}
		localization_key = artifact_decay_dull
	}

	text = {
		trigger = {
			OR = {
				artifact_type = book
				artifact_type = wall_big
				artifact_type = wall_small
			}
		}
		localization_key = artifact_decay_torn
	}

	text = {
		trigger = {
			OR = {
				artifact_type = sculpture
				artifact_type = throne
				artifact_type = miscellaneous
			}
		}
		localization_key = artifact_decay_cracked
	}
	
	text = {
		trigger = {
			OR = {
				artifact_type = sculpture
				artifact_type = throne
				artifact_type = miscellaneous
				artifact_type = brooch
				artifact_type = brooch_pedestal
			}
		}
		localization_key = artifact_decay_fracture
	}

	text = {
		fallback = yes
		localization_key = artifact_decay_worn
	}
}

GetExamFocusSkill = {
	type = activity

	#Capital Examination
	text = {
		trigger = {
			has_activity_option = {
				category = special_type
				option = imperial_examination_focus_martial
			}
		}
		localization_key = exam_focus_martial
	}
	text = {
		trigger = {
			has_activity_option = {
				category = special_type
				option = imperial_examination_focus_learning
			}
		}
		localization_key = exam_focus_learning
	}
	text = {
		trigger = {
			has_activity_option = {
				category = special_type
				option = imperial_examination_focus_stewardship
			}
		}
		localization_key = exam_focus_stewardship
	}
}

GetTurbanRebellionColor = {
	type = all
	text = {
		trigger = {
			situation:dynastic_cycle.var:wuking_element ?= flag:metal
		}
		localization_key = red
	}
	text = {
		trigger = {
			situation:dynastic_cycle.var:wuking_element ?= flag:earth
		}
		localization_key = green
	}
	text = {
		trigger = {
			situation:dynastic_cycle.var:wuking_element ?= flag:wood
		}
		localization_key = white
	}
	text = {
		trigger = {
			situation:dynastic_cycle.var:wuking_element ?= flag:fire
		}
		localization_key = black
	}
	text = {
		trigger = {
			situation:dynastic_cycle.var:wuking_element ?= flag:water
		}
		localization_key = yellow
	}	
}

GetCiPoemName = {
	type = character
	random_valid = yes

	#If Poem Tune is set we take that, otherwise it is random
	#To accomplish this all entries must exist check scope:poem_tune in trigger_if

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:riverside_city
			}
		}
		localization_key = riverside_city
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:green_jade_bowl
			}
		}
		localization_key = green_jade_bowl
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:scent_fills_the_hall
			}
		}
		localization_key = scent_fills_the_hall
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:lady_yu
			}
		}
		localization_key = lady_yu
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:butterflies_love_blossoms
			}
		}
		localization_key = butterflies_love_blossoms
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:plucking_mulberry_leafs
			}
		}
		localization_key = plucking_mulberry_leafs
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:rivertown_man
			}
		}
		localization_key = rivertown_man
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:spring_in_the_han_palace
			}
		}
		localization_key = spring_in_the_han_palace
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:winds_between_pine_trees
			}
		}
		localization_key = winds_between_pine_trees
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:memories_of_the_past_at_red_cliff
			}
		}
		localization_key = memories_of_the_past_at_red_cliff
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:my_wrath_bristles_through_my_helmet
			}
		}
		localization_key = my_wrath_bristles_through_my_helmet
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:thinking_of_the_past_at_beigu_pavilion
			}
		}
		localization_key = thinking_of_the_past_at_beigu_pavilion
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:dream_song
			}
		}
		localization_key = dream_song
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:as_in_a_dream
			}
		}
		localization_key = as_in_a_dream
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:immortal_by_the_river
			}
		}
		localization_key = immortal_by_the_river
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:longing_for_qin_e
			}
		}
		localization_key = longing_for_qin_e
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:new_chrysanthemum_flowers
			}
		}
		localization_key = new_chrysanthemum_flowers
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:poluomen_son
			}
		}
		localization_key = poluomen_son
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:pouring_out_deep_emotions
			}
		}
		localization_key = pouring_out_deep_emotions
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:rain_hits_a_bell
			}
		}
		localization_key = rain_hits_a_bell
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:spring_in_the_tower_of_jade
			}
		}
		localization_key = spring_in_the_tower_of_jade
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:drunk_in_the_fairyland
			}
		}
		localization_key = drunk_in_the_fairyland
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:anxiety_of_a_beauty
			}
		}
		localization_key = anxiety_of_a_beauty
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:writing_of_my_sorrow
			}
		}
		localization_key = writing_of_my_sorrow
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:sad_remembrance
			}
		}
		localization_key = sad_remembrance
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:on_the_advent_of_spring
			}
		}
		localization_key = on_the_advent_of_spring
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:silk_washing_stream
			}
		}
		localization_key = silk_washing_stream
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:at_an_inn_in_xinshi
			}
		}
		localization_key = at_an_inn_in_xinshi
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:on_red_lotus_petals
			}
		}
		localization_key = on_red_lotus_petals
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:pusa_man
			}
		}
		localization_key = pusa_man
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:a_quiet_night
			}
		}
		localization_key = a_quiet_night
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:huanxi_sand
			}
		}
		localization_key = huanxi_sand
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:overlapping_golden_light_of_small_hills
			}
		}
		localization_key = overlapping_golden_light_of_small_hills
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:the_river_is_red
			}
		}
		localization_key = the_river_is_red
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:the_road_is_difficult
			}
		}
		localization_key = the_road_is_difficult
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:phoenix_hairpin
			}
		}
		localization_key = phoenix_hairpin
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:boating_on_tai_lake
			}
		}
		localization_key = boating_on_tai_lake
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:prelude_to_the_water_song
			}
		}
		localization_key = prelude_to_the_water_song
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:rambling_young_man
			}
		}
		localization_key = rambling_young_man
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:king_of_lanling
			}
		}
		localization_key = king_of_lanling
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:washing_creek_sands
			}
		}
		localization_key = washing_creek_sands
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:magnolia_blossoms
			}
		}
		localization_key = magnolia_blossoms
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:petals_falling_in_the_river
			}
		}
		localization_key = petals_falling_in_the_river
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:my_way_passed_ancient_tombs
			}
		}
		localization_key = my_way_passed_ancient_tombs
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:dreaming_of_the_south_side_of_the_river
			}
		}
		localization_key = dreaming_of_the_south_side_of_the_river
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:beautiful_barbarian
			}
		}
		localization_key = beautiful_barbarian
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:missing_the_emperors_hometown
			}
		}
		localization_key = missing_the_emperors_hometown
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:daoist_priestess
			}
		}
		localization_key = daoist_priestess
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:a_bushel_of_pearls
			}
		}
		localization_key = a_bushel_of_pearls
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:bodhisattva_barbarian
			}
		}
		localization_key = bodhisattva_barbarian
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:clear_and_even_music
			}
		}
		localization_key = clear_and_even_music
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:lost_battle
			}
		}
		localization_key = lost_battle
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:beauty_yu
			}
		}
		localization_key = beauty_yu
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:crows_cry_at_night
			}
		}
		localization_key = crows_cry_at_night
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:phoenix_perched_on_the_parasol_tree
			}
		}
		localization_key = phoenix_perched_on_the_parasol_tree
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:imperial_avenue_procession
			}
		}
		localization_key = imperial_avenue_procession
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:rain_hits_a_bell
			}
		}
		localization_key = rain_hits_a_bell
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:divination_song
			}
		}
		localization_key = divination_song
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:attached_to_her_skirt
			}
		}
		localization_key = attached_to_her_skirt
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:partridge_sky
			}
		}
		localization_key = partridge_sky
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:mountain_hawthorn
			}
		}
		localization_key = mountain_hawthorn
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:the_song_of_tangduo
			}
		}
		localization_key = the_song_of_tangduo
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:the_song_of_tangduo
			}
		}
		localization_key = the_song_of_tangduo
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:fragrance_filling_the_hall
			}
		}
		localization_key = fragrance_filling_the_hall
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:the_water_clock_sings_at_night
			}
		}
		localization_key = the_water_clock_sings_at_night
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:butterflies_kiss_flowers
			}
		}
		localization_key = butterflies_kiss_flowers
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poem_tune
				}
				scope:poem_tune = flag:picking_mulberry
			}
		}
		localization_key = picking_mulberry
	}
}

GetCiPoemTheme = {
	type = character
	random_valid = yes

	#If Poem Theme is set we take that, otherwise it is random
	#To accomplish this all entries must exist check scope:poem_theme in trigger_if

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:love
			}
		}
		localization_key = ci_poem_theme_love
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:nature
			}
		}
		localization_key = ci_poem_theme_nature
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:longing
			}
		}
		localization_key = ci_poem_theme_longing
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:separation
			}
		}
		localization_key = ci_poem_theme_separation
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:sadness_and_pain
			}
		}
		localization_key = ci_poem_theme_sadness_and_pain
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:philosophy
			}
		}
		localization_key = ci_poem_theme_philosophy
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:mythological_events
			}
		}
		localization_key = ci_poem_theme_mythological_events
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:daily_chores
			}
		}
		localization_key = ci_poem_theme_daily_chores
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:poetry_theme
				}
				scope:poetry_theme = flag:historical_events
			}
		}
		localization_key = ci_poem_theme_historical_events
	}
}

GetCiPoemQuality = {
	type = character
	random_valid = yes

	#Poem Quality - Should always be set, but the key will work without it

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:weak
			}
		}
		localization_key = ci_poem_description_weak
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:mid
			}
		}
		localization_key = ci_poem_description_mid
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:great
			}
		}
		localization_key = ci_poem_description_great
	}
}

#Prose Description

GetProseTheme = {
	type = character
	random_valid = yes

	#If Prose Theme is set we take that, otherwise it is random
	#To accomplish this all entries must exist check scope:prose_theme in trigger_if

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:commentary_on_the_four_books
			}
		}
		localization_key = prose_theme_comentary
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:logic
			}
		}
		localization_key = prose_theme_logic
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:critiquing_opponents
			}
		}
		localization_key = prose_theme_critiquing_opponents
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:sentiments
			}
		}
		localization_key = prose_theme_sentiments
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:betterment
			}
		}
		localization_key = prose_theme_betterment
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:human_existance
			}
		}
		localization_key = prose_theme_human_existance
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:prose_theme_lands_ideals
			}
		}
		localization_key = prose_theme_lands_ideals
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:rewriting_history
			}
		}
		localization_key = prose_theme_rewriting_history
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:bio
			}
		}
		localization_key = prose_theme_bio
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:prose_theme
				}
				scope:prose_theme = flag:emperor
			}
		}
		localization_key = prose_theme_emperor
	}
}

GetProseTopic = {
	type = character
	random_valid = yes

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:topic
				}
				scope:topic = flag:prose_philosophy
			}
		}
		localization_key = prose_theme_philosophy
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:topic
				}
				scope:topic = flag:prose_history
			}
		}
		localization_key = prose_topic_history
	}
	
}

GetProseQuality = {
	type = character
	random_valid = yes

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:weak
			}
		}
		localization_key = prose_quality_weak
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:mid
			}
		}
		localization_key = prose_quality_mid
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:great
			}
		}
		localization_key = prose_quality_great
	}
}

#Monograph Description


GetMonographTheme = {
	type = character
	random_valid = yes

	#If Poem Theme is set we take that, otherwise it is random
	#To accomplish this all entries must exist check scope:poem_theme in trigger_if

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:home_duchy
			}
		}
		localization_key = monograph_theme_home_duchy
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:home_kingdom
			}
		}
		localization_key = monograph_theme_home_kingdom
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:home_empire
			}
		}
		localization_key = monograph_theme_home_empire
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:home_hegemony
			}
		}
		localization_key = monograph_theme_home_hegemony
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:point_of_interest
			}
		}
		localization_key = monograph_theme_point_of_interest
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:commentary_on_earlier_works
			}
		}
		localization_key = monograph_theme_commentary_on_earlier_works
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:algebraic_geometry
			}
		}
		localization_key = monograph_theme_algebraic_geometry
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:linear_algebra
			}
		}
		localization_key = monograph_theme_linear_algebra
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:spherical_trigonometry
			}
		}
		localization_key = monograph_theme_spherical_trigonometry
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:computational_studies
			}
		}
		localization_key = monograph_theme_computational_studies
	}

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:method_of_solving_simultaneous_congruences
			}
		}
		localization_key = monograph_theme_method_of_solving_simultaneous_congruences
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:magic_squares_magic_circles
			}
		}
		localization_key = monograph_theme_magic_squares_magic_circles
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:monograph_theme
				}
				scope:monograph_theme = flag:teaching_overview_of_all_mathematical_methods
			}
		}
		localization_key = monograph_theme_teaching_overview_of_all_mathematical_methods
	}
}

GetMonographTopic = {
	type = character
	random_valid = yes

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:topic
				}
				scope:topic = flag:monograph_mathematics
			}
		}
		localization_key = monograph_topic_mathematics
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:topic
				}
				scope:topic = flag:monograph_geography
			}
		}
		localization_key = monograph_topic_geography
	}
}

GetMonographQuality = {
	type = character
	random_valid = yes

	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:weak
			}
		}
		localization_key = monograph_description_quality_weak
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:mid
			}
		}
		localization_key = monograph_description_quality_mid
	}
	text = {
		trigger = {
			trigger_if = {
				limit = {
					exists = scope:quality_of_artifact
				}
				scope:quality_of_artifact = flag:great
			}
		}
		localization_key = monograph_description_quality_great
	}
}
