
# Written by Emil Tisander and Alexander Oltner

###########################################
#                                         #
# Sky Burial events 					  #
# by Emil Tisander                        #
# ID HL.8000-HL.8050      	              #
#                                         #
###########################################

namespace = HL

# Sky Burial trigger event
character_event = {
	id = HL.8001
	hide_window = yes

	is_triggered_only = yes
	
	trigger = {
		has_dlc = "Horse Lords"
		government = nomadic_government
		OR = {
			religion = tengri_pagan
			religion = tengri_pagan_reformed
			religion_group = zoroastrian_group
			religion_group = indian_group
		}
	}

	immediate = {
		if = {
			limit = {
				prestige = 20000
			}
			current_heir = {
				set_character_flag = sky_burial_tomb
			}
		}
		if = {
			limit = {
				current_heir = {
					is_child_of = ROOT
				}
			}
			if = {
				limit = {
					is_female = yes
				}
				current_heir = {
					set_character_flag = sky_burial_mother
				}
			}
			if = {
				limit = {
					is_female = no
				}
				current_heir = {
					set_character_flag = sky_burial_father
				}
			}
		}
		if = {
			limit = {
				current_heir = {
					sibling = ROOT
				}
			}
			if = {
				limit = {
					is_female = yes
				}
				current_heir = {
					set_character_flag = sky_burial_sister
				}
			}
			if = {
				limit = {
					is_female = no
				}
				current_heir = {
					set_character_flag = sky_burial_brother
				}
			}
			
		}
		current_heir = {
			set_character_flag = sky_burial
			character_event = { id = HL.8002 days = 60 }
		}
	}
}

# Clear event
character_event = {
	id = HL.8002
	hide_window = yes

	is_triggered_only = yes

	immediate = {
		clr_character_flag = sky_burial
		clr_character_flag = sky_burial_tomb
		clr_character_flag = sky_burial_father
		clr_character_flag = sky_burial_brother
		clr_character_flag = sky_burial_mother
		clr_character_flag = sky_burial_sister
	}
}

# Decide on Burial
character_event = {
	id = HL.8005
	title = EVTNAME_HL_8005
	picture = GFX_evt_shaman
	desc = { # Father
		trigger = {
			has_character_flag = sky_burial_father
		}
		text = EVTDESC_HL_8005_father
	}
	desc = { # Mother
		trigger = {
			has_character_flag = sky_burial_mother
		}
		text = EVTDESC_HL_8005_mother
	}
	desc = { # Brother
		trigger = {
			has_character_flag = sky_burial_brother
		}
		text = EVTDESC_HL_8005_brother
	}
	desc = { # Sister
		trigger = {
			has_character_flag = sky_burial_sister
		}
	}
	desc = { # Any other predecessor
		trigger = {
			NOT = { has_character_flag = sky_burial_father }
			NOT = { has_character_flag = sky_burial_brother }
			NOT = { has_character_flag = sky_burial_mother }
			NOT = { has_character_flag = sky_burial_sister }
		}
		text = EVTDESC_HL_8005_other
	}
	
	is_triggered_only = yes
	
	option = { # Sky Burial
		name = EVTOPTA_HL_8005
		custom_tooltip = { text = EVTOPTC_HL_8005_custom_tooltip_a }
		hidden_tooltip = {
			random_list = {
				25 = { character_event = { id = HL.8006 days = 10 } }
				25 = { character_event = { id = HL.8008 days = 10 } }
				50 = { character_event = { id = HL.8010 days = 10 } }
			}
		}
	}
	option = { # Raise a Golden Tomb instead
		name = EVTOPTB_HL_8005
		trigger = {
			has_character_flag = sky_burial_tomb
		}
		wealth = -250
		custom_tooltip = { text = EVTOPTC_HL_8005_custom_tooltip_b }
		hidden_tooltip = {
			character_event = { id = HL.8020 days = 10 }
		}
	}
	option = { # Lunatic option
		name = EVTOPTC_HL_8005
		trigger = {
			trait = lunatic
			OR = {
				has_landed_title = c_anxi
				any_realm_character = { has_landed_title = c_anxi }
			}
		}
		tooltip_info = lunatic
		custom_tooltip = { text = EVTOPTC_HL_8005_custom_tooltip_c }
		hidden_tooltip = {
			character_event = { id = HL.8030 days = 20 }
		}
	}
	option = { # Also for possessed
		name = EVTOPTC_HL_8005
		trigger = {
			trait = possessed
			OR = {
				has_landed_title = c_anxi
				any_realm_character = { has_landed_title = c_anxi }
			}
		}
		tooltip_info = possessed
		custom_tooltip = { text = EVTOPTC_HL_8005_custom_tooltip_c }
		hidden_tooltip = {
			character_event = { id = HL.8030 days = 20 }
		}
	}
}

# Sky Burial - Bad weather
character_event = {
	id = HL.8006
	title = EVTNAME_HL_8006
	desc = EVTDESC_HL_8006
	picture = GFX_evt_nomad_camp
	
	is_triggered_only = yes
	
	option = { # Find shelter
		name = EVTOPTA_HL_8006
		if = {
			limit = {
				NOT = { trait = patient }
			}
			random = {
				chance = 30
				add_trait = patient
				hidden_tooltip = {
					character_event = { id = 38264 }
				}
			}
		}
		if = {
			limit = {
				trait = patient
			}
			prestige = 20
		}
		hidden_tooltip = {
			character_event = { id = HL.8010 days = 5 }
		}
	}
	option = { # Continue
		name = EVTOPTB_HL_8006
		if = {
			limit = {
				NOT = { trait = brave }
				NOT = { trait = craven }
			}
			random_list = {
				25 = {
					add_trait = brave
					hidden_tooltip = {
						character_event = { id = 38270 }
					}
				}
				10 = {
					add_trait = ill
					hidden_tooltip = {
						character_event = { id = 38290 }
					}	
				}
				60 = { }
			}
		}
		if = {
			limit = {
				trait = craven
				NOT = { trait = brave }
			}
			random_list = {
				50 = { remove_trait = craven }
				10 = {
					add_trait = ill
					hidden_tooltip = {
						character_event = { id = 38290 }
					}	
				}
				30 = { }
			}
		}
		if = {
			limit = {
				trait = brave
				NOT = { trait = content }
			}
			random_list = {
				10 = {
					add_trait = ambitious
					hidden_tooltip = {
						character_event = { id = 38278 }
					}
				}
				10 = {
					add_trait = ill
					hidden_tooltip = {
						character_event = { id = 38290 }
					}	
				}
				70 = { }
			}
		}
		hidden_tooltip = {
			character_event = { id = HL.8010 days = 5 }
		}
	}
}

# Sky Burial - Hermit encountered
character_event = {
	id = HL.8008
	title = EVTNAME_HL_8008
	desc = EVTDESC_HL_8008
	picture = GFX_evt_lunatic
	
	is_triggered_only = yes
	
	option = { # Give gift
		name = EVTOPTA_HL_8008
		wealth = -10
		trigger = {
			NOT = { trait = greedy }
		}
		if = {
			limit = {
				NOT = { trait = charitable }
			}
			random = {
				chance = 50
				add_trait = charitable
				hidden_tooltip = {
					character_event = { id = 38273 }
				}
			}
		}
		if = {
			limit = {
				trait = charitable
			}
			prestige = 20
		}
		hidden_tooltip = {
			character_event = { id = HL.8010 days = 5 }
		}
	}
	option = { # Ask to join
		name = EVTOPTB_HL_8008
		create_character = {
			random_traits = yes
			dynasty = NONE
			female = no
			age = 40
			religion = ROOT
			culture = ROOT
			trait = brilliant_strategist
			attributes = {
				martial = 10
			}
		}
		hidden_tooltip = {
			character_event = { id = HL.8010 days = 5 }
		}
	}
	option = { # Leave the hermit
		name = EVTOPTC_HL_8008
		hidden_tooltip = {
			character_event = { id = HL.8010 days = 5 }
		}
	}
}

# Perform Sky Burial
character_event = {
	id = HL.8010
	title = EVTNAME_HL_8010
	desc = EVTDESC_HL_8010
	picture = GFX_evt_shaman
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_HL_8010
		prestige = 100
		hidden_tooltip = {
			random = {
				chance = 10
				character_event = { id = HL.8011 days = 10 }
			}
		}
	}
}

# Followed by a Vulture
character_event = {
	id = HL.8011
	title = EVTNAME_HL_8011
	desc = EVTDESC_HL_8011
	picture = GFX_evt_nomad_camp
	
	is_triggered_only = yes
	
	option = { # Keep the vulture
		name = EVTOPTA_HL_8011
		prestige = 10
		if = {
			limit = {
				NOT = { trait = falconer }
			}
			add_trait = falconer
		}
	}
	option = { # Send it away
		name = EVTOPTB_HL_8011
	}
}

# Begin construction on Golden Tomb
character_event = {
	id = HL.8020
	title = EVTNAME_HL_8020
	desc = EVTDESC_HL_8020
	picture = GFX_evt_fishing
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_HL_8020
		prestige = 10
		hidden_tooltip = {
			character_event = { id = HL.8022 days = 5 }
		}
	}
}

# Golden Tomb Completed
character_event = {
	id = HL.8022
	title = EVTNAME_HL_8022
	desc = EVTDESC_HL_8022
	picture = GFX_evt_tengri_throneroom_oldgods
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_HL_8022
		prestige = 250
	}
	option = { # Cruel option
		if = {
			limit = {
				NOT = { trait = cruel }
			}
			add_trait = cruel
			prestige = 250
		}
		if = {
			limit = {
				trait = cruel
			}
			prestige = 300
		}
		name = EVTOPTB_HL_8022
	}
}

# On the way to olgoi-khorkhoi (Mongolian death worm)
character_event = {
	id = HL.8030
	title = EVTNAME_HL_8030
	desc = EVTDESC_HL_8030
	picture = GFX_evt_sand_desert
	
	is_triggered_only = yes
	
	option = { # Continue
		name = EVTOPTA_HL_8030
		prestige = -100
		piety = 100
		random_list = {
			15 = {
				death = {
					death_reason = death_accident
				}
			}
			85 = {
				character_event = { id = HL.8032 days = 10 }
			}
		}
	}
	option = { # Go back
		name = EVTOPTB_HL_8030
		prestige = -100

		random_list = {
			5 = {
				death = {
					death_reason = death_accident
				}
			}
			95 = { custom_tooltip = { text = EVTOPTA_HL_8032_custom_tooltip } }
		}
	}
}

# Sacrifice to olgoi-khorkhoi (Mongolian death worm)
character_event = {
	id = HL.8032
	title = EVTNAME_HL_8032
	desc = EVTDESC_HL_8032
	picture = GFX_evt_sand_desert
	
	is_triggered_only = yes

	option = { # Return home
		name = EVTOPTA_HL_8032
		trigger = {
			NOT = { trait = weak }
			NOT = { trait = ill }
			NOT = { trait = wounded }
			NOT = { trait = maimed }
		}
		prestige = -100
		piety = 100
		random_list = {
			40 = {
				death = {
					death_reason = death_accident
				}
			}
			60 = {
				custom_tooltip = { text = EVTOPTA_HL_8032_custom_tooltip }
				hidden_tooltip = {
					character_event = { id = HL.8035 days = 10 }
				}
			}
		}
	}
	option = { # Rest
		name = EVTOPTB_HL_8032
		trigger = {
			OR = {
				trait = weak
				trait = ill
				trait = wounded
				trait = maimed
			}
		}
		death = {
			death_reason = death_accident
		}
	}
}

# You return home from the desert
character_event = {
	id = HL.8035
	title = EVTNAME_HL_8035
	desc = EVTDESC_HL_8035
	picture = GFX_evt_tengri_throneroom_oldgods
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_HL_8035
		prestige = 150
		if = {
			limit = { NOT = { trait = strong } }
		}
		add_trait = strong
	}
}

###########################################
#                                         #
# Mongol wrestling events				  #
# by Alexander Oltner                     #
# ID HL.9000-HL.9050      	              #
#                                         #
###########################################

character_event = {
	id = HL.9000
	desc =  EVTDESC_HL_9000
	picture = GFX_evt_steppe_mercenaries
	border = GFX_event_normal_frame_war
	
	has_dlc = "Horse Lords"
	
	min_age =  16
	capable_only = yes
	prisoner = no
	only_playable = yes

	trigger = {
		government = nomadic_government
		war = no
		independent = yes
		NOT = { has_character_modifier = manly_skill_wrestling }
		NOT = { has_character_modifier = denied_wrestling }
		any_realm_character = {
			is_adult = yes
			ai = yes
			prisoner = no
			martial = 10
			NOT = {
				OR = {
					character = ROOT 
					trait = incapable
					trait = infirm
					health_traits = 1
					trait = craven
				}
			}
		}
		any_demesne_title = {
			tier = BARON
			has_building = no_wrestling_1
		}
	}
	
	mean_time_to_happen = {
		months = 360
		
		modifier = {
			factor = 0.7
			has_focus = focus_war
		}
		
		modifier = {
			factor = 0.8
			has_focus = focus_hunting
		}
		
	}
	
	option = {
		name = EVTOPTA_HL_9000
		character_event = { id = HL.9001 tooltip = EVTTOOLTIP_HL_9000A }
	}
	
	option = {
		name = EVTOPTB_HL_9000
		
		trigger = {
			NOT = { trait = slothful }
		}
		
		if = {
			limit = {
				NOT = { has_trait = diligent }
			}
			random = {
				add_trait = diligent
				chance = 35
				hidden_tooltip = { character_event = { id = 38256 } } # notify diligent
			}
		}
		add_character_modifier = {
			modifier = denied_wrestling
			years = 1
		}
	}
	
	option = {
		name = EVTOPTD_HL_9000
		
		trigger = {
			NOT = { trait = proud }
		}
		
		prestige = -20
	}
	
	option = {
		name = EVTOPTD_HL_9000
		
		trigger = {
			trait = proud
		}
		
		prestige = -20
		remove_trait = proud
	}
}

character_event = {
	id = HL.9001 # Wrestling Event
	desc =  EVTDESC_HL_9001
	picture = GFX_evt_steppe_mercenaries
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		random_realm_character = {
			limit = {
				is_adult = yes
				ai = yes
				prisoner = no
				martial = 10
				NOT = {
					OR = {
						character = ROOT 
						trait = incapable
						trait = infirm
						health_traits = 1
						trait = craven
					}
				}
			}
			save_event_target_as = wrestling_opponent
		}
	}
	
	option = {
		name = EVTOPTA_HL_9001
		
		event_target:wrestling_opponent = {
			character_event = {	id = HL.9002 tooltip = EVTTOOLTIP_HL_9001A }
		}
	}
	
	option = {
		name = EVTOPTD_HL_9001
		tooltip_info = lunatic
		
		trigger = {
			trait = lunatic
		}
		
		prestige = -50
		random_list = {
				29 = {
					add_trait = wounded
					hidden_tooltip = { character_event = { id = 38280 } }
				}
				45 = {
					add_trait = maimed
					hidden_tooltip = { character_event = { id = 38281 } }
				}
				25 = {
					death = { death_reason = death_accident }
				}
				1 = {
					custom_tooltip = { text = wrestling_win_vs_horse }
					hidden_tooltip = { 
						add_character_modifier = {
						modifier = manly_skill_wrestling
						years = 5
						}
					}
				}
			}
	}
	
	option = {
		name = EVTOPTB_HL_9001
		
		trigger = {
			NOT = { trait = arbitrary }
		}
		
		prestige = 50
		add_trait = arbitrary
		hidden_tooltip = { character_event = { id = 38266 } } # notify arbitrary
	}
	
	option = {
		name = EVTOPTB_HL_9001
		tooltip_info = arbitrary
		
		trigger = {
			trait = arbitrary
			NOT = { trait = proud }
		}
		
		prestige = 50
		add_trait = proud
		hidden_tooltip = { character_event = { id = 38261 } } # notify proud
	}
	
	option = {
		name = EVTOPTB_HL_9001
		
		trigger = {
			trait = arbitrary
			trait = proud
		}
		
		prestige = 75
	}
	
	option = {
		name = EVTOPTC_HL_9001
		
		prestige = -10
		if = {
			limit = {
				NOT = { trait = craven }
			}
			add_trait = craven
			hidden_tooltip = { character_event = { id = 38257 } } # notify craven
		}
	}

}

character_event = {
	id = HL.9002 # Wrestling Resolver

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				OR = {
					AND = {
						FROM = { trait = strong }
						NOT = { trait = strong }
					}
					AND = {
						FROM = { NOT = { trait = weak } }
						trait = weak
					}
				}
			}
			random_list = {
				95 = {
					FROM = {
						long_character_event = { id = HL.9003 } # Win
					}
				}
				5 = {
					FROM = {
						long_character_event = { id = HL.9004 } # Lose
					}
				}
			}
			break = yes
		}
		if = {
			limit = {
				OR = {
					AND = {
						FROM = { trait = strong }
						trait = strong
					}
					AND = {
						FROM = { NOT = { trait = strong } }
						FROM = { NOT = { trait = weak } }
						NOT = { trait = strong }
						NOT = { trait = weak }
					}
				}
			}
			random_list = {
				70 = {
					FROM = {
						long_character_event = { id = HL.9003 } 
					}
				}
				30 = {
					FROM = {
						long_character_event = { id = HL.9004 } 
					}
				}
			}
			break = yes
		}	
		if = {
			limit = {
				FROM = { trait = weak }
				trait = weak
			}
			random_list = {
				50 = {
					FROM = {
						long_character_event = { id = HL.9003 } 
					}
				}
				50 = {
					FROM = {
						long_character_event = { id = HL.9004 } 
					}
				}
			}
			break = yes
		}
		if = {
			limit = {
				OR = {
					AND = {
						FROM = { trait = weak }
						NOT = { trait = weak }
					}
					AND = {
						FROM = { NOT = { trait = strong } }
						trait = strong
					}
				}
			}
			random_list = {
				5 = {
					FROM = {
						long_character_event = { id = HL.9003 }
					}
				}
				95 = {
					FROM = {
						long_character_event = { id = HL.9004 }
					}
				}
			}
			break = yes
		}
	}
}

character_event = {
	id = HL.9003 # Win Wrestling
	desc =  EVTDESC_HL_9003
	picture = GFX_evt_tengri_throneroom_oldgods
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_HL_9003
		tooltip_info = proud
		
		trigger = {
			trait = proud
		}
		
		prestige = 100
		if = {
			limit = {
				NOT = { is_rival = FROM }
			}
			add_rival = FROM
		}
		add_character_modifier = {
			modifier = manly_skill_wrestling
			years = 5
		}
	}
	
	option = {
		name = EVTOPTB_HL_9003
		
		prestige = 50
		add_character_modifier = {
			modifier = manly_skill_wrestling
			years = 5
		}
	}
	
	option = {
		name = EVTOPTC_HL_9003
		tooltip_info = kind
		
		trigger = {
			trait = kind
			NOT = { is_friend = FROM }
		}
		
		prestige = 25
		add_friend = FROM
		add_character_modifier = {
			modifier = manly_skill_wrestling
			years = 5
		}
	}
	
	option = {
		name = EVTOPTC_HL_9003
		tooltip_info = gregarious
		
		trigger = {
			trait = gregarious
			NOT = { trait = kind }
			NOT = { is_friend = FROM }
		}
		
		prestige = 25
		add_friend = FROM
		add_character_modifier = {
			modifier = manly_skill_wrestling
			years = 5
		}
	}
	
	option = {
		name = EVTOPTD_HL_9003
		tooltip_info = homosexual
		
		trigger = {
			trait = homosexual
			FROM = { trait = homosexual }
			FROM = { NOT = { is_close_relative = ROOT } }
			NOT = { is_lover = FROM }
			NOT = { is_former_lover = FROM }
		}
		
		prestige = 50
		add_lover = FROM
		add_character_modifier = {
			modifier = manly_skill_wrestling
			years = 5
		}
	}
}

character_event = {
	id = HL.9004 # Lose Wrestling
	desc =  EVTDESC_HL_9004
	picture = GFX_evt_mongols
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTB_HL_9004
		tooltip_info = gregarious
		
		trigger = {
			trait = gregarious
		}
		
		FROM = { prestige = 25 }
		prestige = -25
		if = {
			limit = {
				NOT = { is_friend = FROM }
			}
			add_friend = FROM
		}
	}
	
	option = {
		name = EVTOPTA_HL_9004
		
		FROM = { prestige = 50 }
		prestige = -50
	}
	
	option = {
		name = EVTOPTC_HL_9004
		tooltip_info = wroth
		
		trigger = {
			trait = wroth
			FROM = { NOT = { health_traits = 1 } }
		}
		
		FROM = { prestige = 75 }
		prestige = -75
		FROM = { 
			random_list = {
					90 = {
						add_trait = wounded
					}
					10 = {
						add_trait = maimed
					}
				} 
			}
		if = {
			limit = {
				NOT = { is_rival = FROM }
			}
			add_rival = FROM
		}
		if = {
			limit = {
				NOT = { trait = cruel }
			}
			add_trait = cruel
			hidden_tooltip = { character_event = { id = 38259 } } # notify cruel
		}
	}
	
	option = {
		name = EVTOPTD_HL_9004
		tooltip_info = homosexual
		
		trigger = {
			trait = homosexual
			FROM = { trait = homosexual }
			FROM = { NOT = { is_close_relative = ROOT } }
			NOT = { is_lover = FROM }
			NOT = { is_former_lover = FROM }
		}
		
		FROM = { prestige = 50 }
		prestige = -50
		add_lover = FROM
	}
}