namespace = mythos_event
#	0001-0099		generic events
#	0300-0399		dagon-related

# from game setup decision
mythos_event.0001 = {
	title = mythos_startup_decision_title
	desc = mythos_startup_event_desc
	right_portrait = root
	theme = faith
	override_environment = {
		trigger = { always = yes}
		reference = wilderness
	}
	# Option for each faith
	option = {
		name = mythos_cthulhu_fhtagn
		capital_county = {
			set_county_faith = faith:mythos_faith_cthulhu
		}
	}
	option = {
		name = mythos_ia_azathoth
		capital_county = {
			set_county_faith = faith:mythos_faith_azathoth
		}
	}
	option = {
		name = mythos_ia_dagon
		capital_county = {
			set_county_faith = faith:mythos_faith_dagon
		}
	}
	option = {
		name = mythos_ia_hastur
		capital_county = {
			set_county_faith = faith:mythos_faith_king_in_yellow
		}
	}
	option = {
		name = mythos_ia_kaiwan
		#Is there a good way to only have this available for characters in the eastern religion group?
		trigger = {
			NOT = {
				has_religion = religion:christianity_religion
			}
		}
		capital_county = {
			set_county_faith = faith:mythos_faith_black_lotus
		}
	}
	option = {
		name = mythos_ia_nyarlathotep
		capital_county = {
			set_county_faith = faith:mythos_faith_nyarlathotep
		}
	}
	option = {
		name = mythos_ia_shub_niggurath
		capital_county = {
			set_county_faith = faith:mythos_faith_shub_niggurath
		}
	}
	option = {
		name = mythos_ia_tsathoggua
		capital_county = {
			set_county_faith = faith:mythos_faith_tsathoggua
		}
	}
	option = {
		name = mythos_ia_yog_sothoth
		capital_county = {
			set_county_faith = faith:mythos_faith_yog_sothoth
		}
	}
	option = {
		name = mythos_pick_carterist
		trigger = {
			has_religion = religion:christianity_religion
		}
		capital_county = {
			set_county_faith = faith:mythos_faith_carterist
		}
	}
}

###########################
#	Esoteric Order of Dagon #
###########################
# a child is born of the Covenant
mythos_event.0310 = {
	type = character_event
	title = mythos_event_get_covenant_child_title
	desc = {
		#General
		desc = mythos_event_get_covenant_child_desc_1
		#Conclusion
		first_valid = {
			#TODO: description is father was already hybrid
			triggered_desc = {
				trigger = {
					exists = player_heir
					player_heir = scope:hybrid_child
					has_trait = cynical
				}
				desc = mythos_event_get_covenant_child_desc_2_heir_cynical
			}
			triggered_desc = {
				trigger = {
					exists = player_heir
					player_heir = scope:hybrid_child
				}
				desc = mythos_event_get_covenant_child_desc_2_heir
			}
			triggered_desc = {
				desc = mythos_event_get_covenant_child_desc_2
			}
		}
	}

	theme = pregnancy
	left_portrait = {
		character = ROOT
		animation = newborn
	}
	lower_left_portrait = scope:hybrid_child
	immediate = {
		play_music_cue_once = { TRACK = mx_cue_birth }
		create_character = {
			#save_event_target_as = flag #save the character as an event target
			#save_temporary_event_target_as = flag #save the character as a temporary event target
			save_scope_as = hybrid_child
			#name =
			age = 0
			#gender = male/female/character scope
			gender_female_chance = 50
			#opposite_gender = character scope
			#TODO: chance of higher if father is already hybrid
			#trait = mythos_deep_hybrid_1
			random_traits_list = {
				count = 1
				mythos_deep_hybrid_1 = {
					weight = { base = 100 }
				}
				mythos_deep_hybrid_2 = {
					weight = {
						base = 0
						modifier = {
							add = 100
							ROOT = {
								has_trait = mythos_deep_hybrid
							}
						}
					}
				}
				mythos_deep_hybrid_3 = {
					weight = {
						base = 0
						modifier = {
							add = 50
							ROOT = {
								OR = {
									has_trait = mythos_deep_hybrid_2
									has_trait = mythos_deep_hybrid_3
								}
							}
						}
					}
				}
			}
			#random_traits_list = { count = { 1 5 } traitID = { some triggers } traitID = { some triggers } } #A number of traits specified by count (1 if not specified) will be picked from the traits that have their triggers met. Scopes are the same as where create_character is used. More than one grouping like this can be defined
			random_traits = yes
			#health =
			#fertility =
			#mother =
			father = ROOT
			#real_father = #(should only be set if the real father is not the same as father=)
			employer = ROOT #will end up in this court, will become a pool character unless specified or father/mother is landed
			#location = #pool province; mutually exclusive with employer
			#template_character =
			#faith, culture and dynasty are set from 1. template_character 2. father 3. mother 4. employer (not employer for dynasty) unless specified directly faith = faith tag OR a faith scope random_faith = { catholic = { some triggers } cathar = { some triggers }. Random one where the triggers are met will be picked. Scopes are the same as where create_character is used random_faith_in_religion = religion tag OR a faith scope (there's no religion scope) culture = culture name OR a culture scope #random_culture = { norse = { some triggers } norwegian = { some triggers }. Random one where the triggers are met will be picked. Scopes are the same as where create_character is used random_culture_in_group = culture group name OR a culture scope (there's no group scope) dynasty_house = dynasty house name OR a dynasty house scope dynasty = generate/inherit/none - What to do if dynasty_house is not specified. generate by default. martial/diplomacy/intrigue... = will get random unless specified
			#after_creation = { some effects } run after character is created. Scope starts off in the character, with the scope it was created in as PREV, and the same top scope and saved targets etc.
			dynasty = inherit
		}
	}
	#NAMING WIDGET
	widgets = {
		widget = {
			is_shown = {
				allow_naming_on_birth_of_child_trigger = { CHILD = scope:hybrid_child }
			}
			gui = "event_window_widget_name_child"
			container = "dynamic_birth_name"
			controller = name_character
			setup_scope = { scope:hybrid_child = { save_scope_as = name_character_target } }
		}
	}

	option = {
		name = mythos_ia_dagon
		stress_impact = {
			zealous = -30
			mythos_deep_hybrid_1 = -20
			mythos_deep_hybrid_2 = -20
			mythos_deep_hybrid_3 = -20
			mythos_deep_hybrid_4 = -20
			mythos_deep_hybrid_5 = -20
			compassionate = -10
			cynical = 20
		}
	}
}
# reset immortal age of young Purified Hybrids
# figure out something around on_actions to get this working
# in the meantime have them not immortal quite yet
mythos_event.0320 = {

}

#TODO:
#https://lovecraft.fandom.com/wiki/History_of_the_Necronomicon
#In 730, while still living in Damascus, Alhazred supposedly authored in Arabic a book of ultimate evil, al Azif, which would later become known as the Necronomicon.
#In 950 AD Theodorus Philetas of Constantinople translates the Kitab Al-Azif into Greek, and renames it the Necronomicon.
#In 1050 AD Patriarch Michael, disturbed by rumors about experimentation with the Necronomicon, has many copies of the book burned.
#1228 Olaus Wormius made a Latin translation; by this time, all Arabic versions are out of circulation
#1232	Condemned by the Vatican, Latin and Greek versions suppressed
#According to Olaus Wormius in his introduction to the Latin edition, all known copies of the Arabic versions are destroyed as well.
#In the 12th century Ibn Khallikan writes a biography of Abdul Alhazred.
#In 1232 AD Pope Gregory IX bans the Greek and Latin Necronomicons.

#Gilbert de la Poer: The first Baron Exham, granted title to Exham Priory by Henry III of England in 1261.
#There is "no evil report" connected to the family name before this point,
#but within 50 years a chronicle is referring to a de la Poer as "cursed of God".
