
namespace = warhorse


###########################################
# Name your warhorse
#	by Linnéa Thimrén
#	warhorse.0001 - Name your warhorse! Choose category
#	warhorse.0002 - Historical name
#	warhorse.0003 - Mythological name
#	warhorse.0004 - Common name
#
# Other events for your warhorse
#	by Linnéa Thimrén
#	warhorse.1001 - Buy new gear for your horse
#	warhorse.1101 - Stress reduction or prowess
#	warhorse.1201 - Your horse is sick! Pay gold or risk its death
#	warhorse.1301 - Another horse-enthusiast compliments your horse
#	warhorse.1401 - Your horse is cursed
#
# Breed your warhorse
#	by Linnéa Thimrén
#	8001 - You trusted steed is getting old, you should consider breeding! (25-30 years)
###########################################

###########################################
# Name your warhorse
#	0001-0999
###########################################

#Name your warhorse
warhorse.0001 = {
	type = character_event
	title = warhorse.0001.t
	desc = warhorse.0001.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}

	option = { #Historical name
		name = warhorse.0001.a
		trigger_event = warhorse.0002
	}

	option = { #Mythological name
		name = warhorse.0001.b
		trigger_event = warhorse.0003
	}
	
	option = { #Common name
		name = warhorse.0001.c
		trigger_event = warhorse.0004
	}

	after = {
		if = {
			limit = {
				scope:story = { exists = var:story_cycle_horse_name }
			}
			remove_character_flag = is_in_naming_event
		}
	}
}

scripted_trigger warhorse_0002_steppe_trigger = {
	OR = {
		culture = {
			has_cultural_pillar = heritage_mongolic
		}
		culture = {
			has_cultural_pillar = heritage_turkic
		}
#		faith.religion = faith:tengri_pagan.religion
	}
}

#Historical name
warhorse.0002 = {
	type = character_event
	title = warhorse.0001.t
	desc = warhorse.0002.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = market
	}
	left_portrait = {
		character = root
		animation = jockey_wave
		camera = camera_event_horse_left
	}

	option = {
		name = warhorse.0002.a
		trigger = {
			OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
			OR = {
				religion = religion:catholic_religion
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe }
				}
				culture = {
					has_cultural_pillar = heritage_frankish
				}
				culture = {
					has_cultural_pillar = heritage_central_germanic
				}
			}
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #King Charlemagne's warhorse in The Song of Roland
					name = story_cycle_horse_name
					value = flag:tencendur
				}
			}
		}
	}

	option = {
		name = warhorse.0002.c
		trigger = {
			OR = {
				faith.religion = religion:theomach_religion
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe_south }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe_west }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_middle_east_jerusalem }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_asia_minor }
				}
				culture = {
					has_cultural_pillar = heritage_latin
				}
				culture = {
					has_cultural_pillar = heritage_byzantine
				}
			}
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The cursed horse of Gnaeus Seius
					name = story_cycle_horse_name
					value = flag:seianian
				}
			}
		}
	}

	option = {
		name = warhorse.0002.d
		trigger = {
			faith.religion = religion:islam_religion
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The horse of Husayn ibn Ali
					name = story_cycle_horse_name
					value = flag:zuljanah
				}
			}
		}
	}

	option = {
		name = warhorse.0002.e
		trigger = {
			OR = {
				culture = {
					has_cultural_pillar = heritage_chinese
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { OR = {
						geographical_region = world_tibet
						geographical_region = world_asia_china
						geographical_region = world_asia_korea
						geographical_region = world_asia_southeast
						}
					}
				}
			}
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The warlord Lü Bu's horse
					name = story_cycle_horse_name
					value = flag:red_hare
				}
			}
		}
	}

	option = {
		trigger = {
			OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
			OR = {
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe_west }
				}
				culture = {
					has_cultural_pillar = heritage_frankish
				}
				culture = {
					has_cultural_pillar = heritage_central_germanic
				}
				culture = {
					has_cultural_pillar = heritage_latin
				}
				culture = {
					has_cultural_pillar = heritage_brythonic
				}
				culture = {
					has_cultural_pillar = heritage_iberian
				}
				culture = {
					has_cultural_pillar = heritage_west_germanic
				}
			}
		}
		name = warhorse.0002.f
		hidden_effect = {
			scope:story= {
				set_variable = { # The horse of Roland, general under Charlemagne
					name = story_cycle_horse_name
					value = flag:veillantif
				}
			}
		}
	}

	option = {
		trigger = {
			OR = {
				faith.religion = religion:theomach_religion
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe_south }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_europe_west }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_middle_east_jerusalem }
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_asia_minor }
				}
				culture = {
					has_cultural_pillar = heritage_latin
				}
				culture = {
					has_cultural_pillar = heritage_byzantine
				}
			}
		}
		name = warhorse.0002.g
		hidden_effect = {
			scope:story= {
				set_variable = { # The favorite horse of Emperor Caligula
					name = story_cycle_horse_name
					value = flag:incitatus
				}
			}
		}
	}
	#Moved to "historical" horses because close enough? And needs more steppe horses
	option = {
		name = warhorse.0003.aranjagaan
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Jangar's mount in the Epic of Jangar
					name = story_cycle_horse_name
					value = flag:aranjagaan
				}
			}
		}
	}
	option = {
		name = warhorse.0003.aranzhale
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Another of Jangar's horses in the Epic of Jangar
					name = story_cycle_horse_name
					value = flag:aranzhale
				}
			}
		}
	}
	option = {
		name = warhorse.0003.oyomaa
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Mengen Shigshirge's mount in the Epic of Jangar
					name = story_cycle_horse_name
					value = flag:oyomaa
				}
			}
		}
	}
	option = {
		name = warhorse.0003.rakhsh
		trigger = {
			current_date > 1000
			OR = {
				culture = {
					has_cultural_pillar = heritage_iranian
				}
				trigger_if = {
					limit = { is_landed = yes }
					capital_province = { geographical_region = world_middle_east_persia }
				}
			}
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #From the Persian national epic Shahnameh
					name = story_cycle_horse_name
					value = flag:rakhsh
				}
			}
		}
	}

	#Moved to end for use as fallback
	option = {
		trigger = {
			warhorse_0002_steppe_trigger = no
		}
		name = warhorse.0002.b
		hidden_effect = {
			scope:story= {
				set_variable = { #Alexander the Great's horse
					name = story_cycle_horse_name
					value = flag:bucephalus
				}
			}
		}
	}

	option = {
		name = warhorse.0002.go_back
		trigger_event = warhorse.0001
	}

	after = {
		if = {
			limit = {
				scope:story = { exists = var:story_cycle_horse_name }
			}
			remove_character_flag = is_in_naming_event
		}
	}
}

#Mythological
warhorse.0003 = {
	type = character_event
	title = warhorse.0001.t
	desc = warhorse.0003.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = wilderness
	}
	left_portrait = {
		character = root
		animation = jockey_gallop
		camera = camera_event_horse_very_left
	}

	option = {
		name = warhorse.0003.khiimori
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The Wind Horse in Mongolic syncretic spirituality
					name = story_cycle_horse_name
					value = flag:khiimori
				}
			}
		}
	}
	option = {
		name = warhorse.0003.tulpar
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #A winged Turkic horse
					name = story_cycle_horse_name
					value = flag:tulpar
				}
			}
		}
	}
	option = {
		name = warhorse.0003.rlung_rta
		trigger = {
			OR = {
				faith = faith:lamaism
				culture = {
					has_cultural_pillar = heritage_tibetan
				}
			}
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The Wind Horse in Tibetan Buddhism
					name = story_cycle_horse_name
					value = flag:rlung_rta
				}
			}
		}
	}
	option = {
		name = warhorse.0003.jonon_khar
		trigger = {
			warhorse_0002_steppe_trigger = yes
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #The origin story of the horsehead fiddle, a flying horse
					name = story_cycle_horse_name
					value = flag:jonon_khar
				}
			}
		}
	}
	option = {
		name = warhorse.0003.llamrei
		trigger = {
			trigger_if = {
				limit = { is_landed = yes }
				capital_province = { geographical_region = world_europe }
			}
			trigger_else_if = {
				limit = { exists = location }
				location = { geographical_region = world_europe }
			}
			trigger_else = { always = yes }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of King Arthur
					name = story_cycle_horse_name
					value = flag:llamrei
				}
			}
		}
	}

	option = {
		name = warhorse.0003.sleipnir
		trigger = {
			faith = { religion_tag = folkgerman_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Oden
					name = story_cycle_horse_name
					value = flag:sleipnir
				}
			}
		}
	}
	
	option = {
		name = warhorse.0003.uchchaihshravas
		trigger = {
			faith = { religion_tag = hinduism_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Surya (and Bali)
					name = story_cycle_horse_name
					value = flag:uchchaihshravas
				}
			}
		}
	}

	option = {
		name = warhorse.0003.dadhi_kra
		trigger = {
			faith = { religion_tag = hinduism_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Personification of the morning Sun
					name = story_cycle_horse_name
					value = flag:dadhi_kra
				}
			}
		}
	}

	option = {
		name = warhorse.0003.devadatta
		trigger = {
			faith = { religion_tag = hinduism_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Kalki
					name = story_cycle_horse_name
					value = flag:devadatta
				}
			}
		}
	}

	option = {
		name = warhorse.0003.keshi
		trigger = {
			faith = { religion_tag = hinduism_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Kalki
					name = story_cycle_horse_name
					value = flag:keshi
				}
			}
		}
	}

	option = {
		name = warhorse.0003.kanthaka
		trigger = {
			faith = { religion_tag = buddhism_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Siddhartha
					name = story_cycle_horse_name
					value = flag:kanthaka
				}
			}
		}
	}

	option = {
		name = warhorse.0003.haizum
		trigger = {
			faith = { religion_tag = islam_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of the archangel Gabriel (Jibril)
					name = story_cycle_horse_name
					value = flag:haizum
				}
			}
		}
	}

	option = {
		name = warhorse.0003.buraq
		trigger = {
			faith = { religion_tag = islam_religion }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of certain prophets
					name = story_cycle_horse_name
					value = flag:buraq
				}
			}
		}
	}

	option = {
		name = warhorse.0003.burko
		trigger = {
			culture = { has_cultural_pillar = heritage_east_slavic }
		}
		hidden_effect = {
			scope:story= {
				set_variable = { #Magical horse in Russian folklore
					name = story_cycle_horse_name
					value = flag:burko
				}
			}
		}
	}

	option = {
		trigger = {
			warhorse_0002_steppe_trigger = no
		}
		name = warhorse.0003.balius
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Achilles
					name = story_cycle_horse_name
					value = flag:balius
				}
			}
		}
	}

	option = {
		trigger = {
			warhorse_0002_steppe_trigger = no
		}
		name = warhorse.0003.xanthos
		hidden_effect = {
			scope:story= {
				set_variable = { #Horse of Achilles
					name = story_cycle_horse_name
					value = flag:xanthos
				}
			}
		}
	}

	option = {
		trigger = {
			warhorse_0002_steppe_trigger = no
		}
		name = warhorse.0003.boreas
		hidden_effect = {
			scope:story= {
				set_variable = { #God of the north wind
					name = story_cycle_horse_name
					value = flag:boreas
				}
			}
		}
	}

	option = {
		name = warhorse.0002.go_back
		trigger_event = warhorse.0001
	}

	after = {
		if = {
			limit = {
				scope:story = { exists = var:story_cycle_horse_name }
			}
			remove_character_flag = is_in_naming_event
		}
	}
}

#Common
warhorse.0004 = {
	type = character_event
	title = warhorse.0001.t
	desc = warhorse.0004.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = wilderness
	}
	left_portrait = {
		character = root
		animation = jockey_idle
		camera = camera_event_horse_extreme_closeup_left
	}

	option = {
		name = warhorse.0004.a
		hidden_effect = {
			scope:story= {
				set_variable = {
					name = story_cycle_horse_name
					value = flag:charger
				}
			}
		}
	}

	option = {
		trigger = {
			OR = { faith.religion = religion:eastern_orthodox_religion faith.religion = religion:catholic_religion faith.religion = religion:protestant_religion }
		}
		name = warhorse.0004.b
		hidden_effect = {
			scope:story= {
				set_variable = {
					name = story_cycle_horse_name
					value = flag:abbot
				}
			}
		}
	}
	
	option = {
		name = warhorse.0004.c
		hidden_effect = {
			scope:story= {
				set_variable = {
					name = story_cycle_horse_name
					value = flag:prancer
				}
			}
		}
	}
	option = {
		name = warhorse.0004.courser
		hidden_effect = {
			scope:story= {
				set_variable = {
					name = story_cycle_horse_name
					value = flag:courser
				}
			}
		}
	}

	option = {
		name = warhorse.0004.d
		trigger = {
			has_trait = lunatic
		}
		hidden_effect = {
			scope:story= {
				set_variable = {
					name = story_cycle_horse_name
					value = flag:glitterhoof
				}
			}
		}
	}

	option = {
		name = warhorse.0002.go_back
		trigger_event = warhorse.0001
	}

	after = {
		if = {
			limit = {
				scope:story = { exists = var:story_cycle_horse_name }
			}
			remove_character_flag = is_in_naming_event
		}
	}
}


###########################################
# Other events for your warhorse
#	1001-1999
###########################################

#Pay gold to get a better modifier
#Buy new gear for your horse
warhorse.1001 = {
	type = character_event
	title = warhorse.1001.t
	desc = warhorse.1001.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}
	
	trigger = {
		NOT = { 
			has_character_flag = had_warhorse_1001_event
			root.var:warhorse_modifier_level >= 2 #Update if we add more levels later
		}
		minor_gold_value_trigger = yes
		any_owned_story = {
			type = story_cycle_martial_lifestyle_warhorse
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_warhorse_1001_event
			days = 1825
		}
		if = {
			limit = {
				has_royal_court = yes
				employs_court_position = master_of_horse_court_position
				any_court_position_holder = {
					type = master_of_horse_court_position
					is_available_ai_adult = yes
				}
			}
			random_court_position_holder = {
				type = master_of_horse_court_position
				limit = { is_available_ai_adult = yes }
				save_scope_as = m_horse
			}
		}
	}

	option = { #Strength
		name = warhorse.1001.a
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:strength
		}
		trigger_event = {
			id = warhorse.1002
			days = { 7 9 }
		}
		ai_chance = {
			base = 50
		}
	}

	option = { #Agility
		name = warhorse.1001.b
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:agility
		}
		trigger_event = {
			id = warhorse.1002
			days = { 7 9 }
		}
		ai_chance = {
			base = 50
		}
	}

	option = { #Endurance
		name = warhorse.1001.c
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:endurance
		}
		trigger_event = {
			id = warhorse.1002
			days = { 7 9 }
		}
		ai_chance = {
			base = 50
		}
	}

	option = { #Fierceness
		name = warhorse.1001.d
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:fierceness
		}
		trigger_event = {
			id = warhorse.1002
			days = { 7 9 }
		}
		ai_chance = {
			base = 50
		}
	}

	option = {	#Master of Horse
		name = warhorse.1001.f
		trigger = {
			exists = scope:m_horse
		}
		custom_tooltip = warhorse.1001.f.tt
		scope:m_horse = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 15
			}
		}
		hidden_effect = {
			random_list = {
				50 = {	# nothing happens
					modifier = {
						scope:m_horse.aptitude:master_of_horse_court_position = 4
						factor = 0.1
					}
					modifier = {
						scope:m_horse.aptitude:master_of_horse_court_position = 3
						factor = 0.2
					}
					modifier = {
						scope:m_horse.aptitude:master_of_horse_court_position = 2
						factor = 0.3
					}
					modifier = {
						scope:m_horse.aptitude:master_of_horse_court_position = 1
						factor = 0.5
					}
					send_interface_toast = {
						title = warhorse.1001.f.failure
						left_icon = scope:m_horse
						custom_tooltip = warhorse.1001.f.failure.tt
					}
				}
				5 = {	#Your master of the horse makes your horse better
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:strength
					}
					trigger_event = {
						id = warhorse.1002
						days = { 7 9 }
					}
				}
				5 = {	#Your master of the horse makes your horse better
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:agility
					}
					trigger_event = {
						id = warhorse.1002
						days = { 7 9 }
					}
				}
				5 = {	#Your master of the horse makes your horse better
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:endurance
					}
					trigger_event = {
						id = warhorse.1002
						days = { 7 9 }
					}
				}
				5 = {	#Your master of the horse makes your horse better
					save_scope_value_as = {
						name = horse_skill_to_level
						value = flag:fierceness
					}
					trigger_event = {
						id = warhorse.1002
						days = { 7 9 }
					}
				}
			}
		}
		ai_chance = {
			base = 70
		}
	}

	option = { #Nah
		name = warhorse.1001.e
		custom_tooltip = warhorse.1001.e.tt
		ai_chance = {
			base = 0
			ai_value_modifier = {
				ai_greed = 0.75
			}
		}
	}
}

#My horse is cooler now!
warhorse.1002 = {
	type = character_event
	title = warhorse.1001.t
	desc = warhorse.1002.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = terrain
	}
	left_portrait = {
		character = root
		animation = jockey_victory
		camera = camera_event_horse_left
	}

	immediate = {
		level_horse_modifier_effect = yes
	}

	option = {
		name = warhorse.1002.a
	}
}

#Stress reduction or prowess
warhorse.1101 = {
	type = character_event
	title = warhorse.1101.t
	desc = warhorse.1101.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}
	
	trigger = {
		NOT = { has_character_flag = had_warhorse_1101_event }
		stress > medium_stress_gain
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			stress > 75
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_warhorse_1101_event
			days = 1825
		}
	}

	option = { #Practice cool battle stuff
		name = warhorse.1101.a
		add_character_modifier = {
			modifier = horse_practice_modifier
			years = 5
		}
		stress_impact = {
			base = minor_stress_gain
			diligent = medium_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_energy = 0.5
			}
		}
	}

	option = { #Ride leisurely
		name = warhorse.1101.b
		stress_impact = {
			base = medium_stress_loss
			lazy = minor_stress_impact_loss
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.5
			}
		}
	}
}


#Your horse is sick! Pay gold or risk its death (end of story)
warhorse.1201 = {
	type = character_event
	title = warhorse.1201.t
	desc = warhorse.1201.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = alley_night
	}
	left_portrait = {
		character = root
		animation = horse_exhausted
		camera = camera_event_horse_very_left
	}
	override_effect_2d = {
		reference = rain
	}
	
	trigger = {
		NOT = { has_character_flag = had_warhorse_1201_event }
	}

	immediate = {
		add_character_flag = {
			flag = had_warhorse_1201_event
			days = 1825
		}
	}

	option = { #I'll pay whatever!
		name = warhorse.1201.a
		remove_short_term_gold = minor_gold_value
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.75
			}
		}
	}

	option = { #no
		name = warhorse.1201.b
		random_list = {
			50 = {
				desc = warhorse.1201.b_good
				show_chance = no
				custom_tooltip = warhorse.1201.b.tt
				send_interface_toast = {
					title = warhorse.1201.b_good
				}
			}
			50 = {
				desc = warhorse.1201.b_bad
				show_chance = no
				send_interface_toast = {
					title = warhorse.1201.b_bad
					show_as_tooltip = { remove_horse_story_modifiers_effect = yes }
				}
				scope:story = {
					hidden_effect = { end_story = yes }
				}
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_rationality = 0.25
				ai_greed = 0.25
			}
		}
	}
}


#Another horse-enthusiast compliments your horse
warhorse.1301 = {
	type = character_event
	title = warhorse.1301.t
	desc = warhorse.1301.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = garden
	}
	left_portrait = {
		character = root
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}
	right_portrait = {
		character = scope:horse_vassal
		animation = admiration
		camera = camera_event_very_right
	}
	
	trigger = {
		NOT = { has_character_flag = had_warhorse_1301_event }
		any_vassal = {
			is_available_healthy_ai_adult = yes
			OR = {
				any_owned_story = {
					type = story_cycle_martial_lifestyle_warhorse
				}
				has_lifestyle = martial_lifestyle
				has_court_position = master_of_horse_court_position
			}
		}
	}

	immediate = {
		add_character_flag = {
			flag = had_warhorse_1301_event
			days = 1825
		}
		random_vassal = {
			limit = {
				is_available_healthy_ai_adult = yes
				is_powerful_vassal = yes
				any_owned_story = {
					type = story_cycle_martial_lifestyle_warhorse
				}
			}
			alternative_limit = {
				is_available_healthy_ai_adult = yes
				has_court_position = master_of_horse_court_position
			}
			alternative_limit = {
				is_available_healthy_ai_adult = yes
				is_powerful_vassal = yes
				has_lifestyle = martial_lifestyle
			}
			alternative_limit = {
				is_available_healthy_ai_adult = yes
				any_owned_story = {
					type = story_cycle_martial_lifestyle_warhorse
				}
			}
			alternative_limit = {
				is_available_healthy_ai_adult = yes
				has_lifestyle = martial_lifestyle
			}
			save_scope_as = horse_vassal
		}
	}

	option = { #Let them ride
		name = warhorse.1301.a
		reverse_add_opinion = {
			target = scope:horse_vassal
			modifier = friendliness_opinion
			opinion = 20
		}
		if = {
			limit = { #They can't handle the horse
				has_character_modifier = horse_fierceness_modifier
				scope:horse_vassal = {
					prowess < medium_skill_rating
				}
			}
			random = {
				chance = 50
				scope:horse_vassal = {
					increase_wounds_effect = { REASON = horse_riding_accident }
				}
			}
			custom_tooltip = warhorse.1301.a.tt
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
			}

		}
	}

	option = { #Don't let them ride
		name = warhorse.1301.b
		add_prestige = medium_prestige_gain
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_vengefulness = 0.25
				ai_greed = 0.25
			}

		}
	}
}


################
#Your horse is cursed
################

#They give you the chills
warhorse.1401 = {
	type = character_event
	title = warhorse.1401.t
	desc = warhorse.1401.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = bp1_bonfire
	}
	left_portrait = {
		character = root
		animation = jockey_idle
		camera = camera_event_horse_extreme_closeup_left
	}
	
	trigger = {
		NOT = { has_character_flag = had_warhorse_1401_event }
		scope:story = {
			exists = var:story_cycle_horse_name
			var:story_cycle_horse_name = flag:seianian
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		add_character_flag = {
			flag = had_warhorse_1401_event
			days = 1825
		}
	}

	option = {
		name = warhorse.1401.a
		custom_tooltip = warhorse.1401.a.tt
		trigger_event = {
			id = warhorse.1402
			days = { 30 60 }
		}
	}

	option = {
		name = warhorse.1401.b
		show_as_tooltip = {
			remove_horse_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
		stress_impact = {
			base = minor_stress_loss
		}
	}
}

#The horse has injured you
warhorse.1402 = {
	type = character_event
	title = warhorse.1401.t
	desc = warhorse.1402.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = army_camp
	}
	left_portrait = {
		character = root
		animation = horse_exhausted
		camera = camera_event_horse_left_forward
	}

	immediate = {
		add_character_modifier = {
			modifier = cursed_horse_modifier
			years = 5
		}
	}

	option = {
		name = warhorse.1402.a
		random = {
			chance = 25
			show_as_tooltip = {
				death = {
					death_reason = death_horse_riding_accident
				}
			}
			trigger_event = {
				id = warhorse.1499
				days = { 30 60 }
			}
		}
	}

	option = {
		name = warhorse.1402.b
		show_as_tooltip = {
			remove_horse_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
	}
}

#The horse kills you...
warhorse.1499 = {
	type = character_event
	title = warhorse.1401.t
	desc = warhorse.1499.desc
	theme = martial_chivalry_focus
	override_effect_2d = {
		reference = rain
		trigger = {
			location = {
				has_winter_trigger = no
				graphical_wilderness_desert_trigger = no
			}
		}	
	}
	override_background = {
		reference = wilderness
	}
	left_portrait = {
		character = root
		animation = throne_room_kneel_1
	}

	option = {
		name = warhorse.1499.a
		death = {
			death_reason = death_horse_riding_accident
		}
	}
}


###########################################
# Breed your warhorse
#	8001-8999
###########################################

#You trusted steed is getting old, you should consider breeding! (25-30 years)
warhorse.8001 = {
	type = character_event
	title = warhorse.8001.t
	desc = warhorse.8001.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = garden
	}
	left_portrait = {
		character = root
		animation = standing_horse
		camera = camera_event_standing_with_horse_left
	}

	immediate = {
	
	}

	option = { #Strength
		name = warhorse.8001.a
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:strength
		}
		trigger_event = { #A new horse is born!
			id = warhorse.8002
			days = { 30 60 }
		}
		ai_chance = {
			base = 10
		}
	}

	option = { #Agility
		name = warhorse.8001.b
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:agility
		}
		trigger_event = { #A new horse is born!
			id = warhorse.8002
			days = { 30 60 }
		}
		ai_chance = {
			base = 10
		}
	}
	
	option = { #Endurance
		name = warhorse.8001.c
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:endurance
		}
		trigger_event = { #A new horse is born!
			id = warhorse.8002
			days = { 30 60 }
		}
		ai_chance = {
			base = 10
		}
	}

	option = { #Fierceness
		name = warhorse.8001.d
		remove_short_term_gold = minor_gold_value
		save_scope_value_as = {
			name = horse_skill_to_level
			value = flag:fierceness
		}
		trigger_event = { #A new horse is born!
			id = warhorse.8002
			days = { 30 60 }
		}
		ai_chance = {
			base = 10
		}
	}

	option = { #Nah
		name = warhorse.8001.e
		trigger_event = { #Horse dies
			id = warhorse.8003
			days = { 30 60 }
		}
		ai_chance = {
			base = 0
		}
	}
}

#A new horse is born!
warhorse.8002 = {
	type = character_event
	title = warhorse.8002.t
	desc = warhorse.8002.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = courtyard
	}
	left_portrait = {
		character = root
		animation = personality_compassionate
	}

	immediate = {
		level_horse_modifier_effect = yes
	}

	option = {
		name = warhorse.8002.a
	}

	after = {
		scope:story = { #To start over with the new horse
			remove_variable = story_cycle_horse_name
			remove_variable = horse_gender
			assign_horse_gender_effect = { GENDER = random }
		}
	}
}

#Horse dies
warhorse.8003 = {
	type = character_event
	title = warhorse.8001.t
	desc = warhorse.8003.desc
	theme = martial_chivalry_focus
	override_background = {
		reference = garden
	}
	left_portrait = {
		character = root
		animation = sadness
	}

	immediate = {
	
	}

	option = {
		name = warhorse.8003.a
		show_as_tooltip = {
			remove_horse_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
	}
}
