# Written by Magnus Karlsson

###########################################
#                                         #
# Horse Lords Misc events                 #
# ID HL.1-HL.49                           #
#                                         #
###########################################

namespace = HL

# Informed about nomad settling as feudal
narrative_event = {
	id = HL.1
	title = EVTNAMEHL1
	desc = EVTDESCHL1
	picture = GFX_evt_steppe_mercenaries
	border = GFX_event_narrative_frame_diplomacy

	is_triggered_only = yes # nomad_adopt_feudalism/republicanism, settlement_decisions.txt

	trigger = {
		NOT = { has_character_flag = show_HL_1_only_once }
	}

	immediate = {
		set_character_flag = show_HL_1_only_once
	}

	option = {
		name = INTERESTING

		clr_character_flag = show_HL_1_only_once
	}
}

# Informed about nomad settling as tribal
narrative_event = {
	id = HL.2
	title = EVTNAMEHL2
	desc = EVTDESCHL2
	picture = GFX_evt_council
	border = GFX_event_narrative_frame_diplomacy

	is_triggered_only = yes # adopt_tribalism, settlement_decisions.txt

	option = {
		name = INTERESTING
	}
}

# CleanSlate: why is this event in this file?
character_event = {
	id = 44482

	is_triggered_only = yes # on_settlement_construction_completed
	hide_window = yes

	only_playable = yes

	trigger = {
		FROM = { holding_type = temple }
	}

	immediate = {
		religion_authority = {
			name = temple_built
			years = 20
		}

		if = {
			limit = { has_ambition = obj_strengthen_religion }

			change_variable = {
				which = strengthen_religion
				value = 1
			}
		}
	}
}

character_event = {
	id = HL.4

	is_triggered_only = yes # on_settlement_construction_completed
	hide_window = yes

	only_playable = yes
	has_dlc = "Horse Lords"

	trigger = {
		FROM = { holding_type = temple }

		clan_title = { clan = yes }
	}

	immediate = {
		clan_title = {
			holder_scope = {
				top_liege = {
					if = {
						limit = {
							religion = ROOT

							NOR = {
								has_feud_with = ROOT
								character = ROOT
							}
						}

						clan_title = {
							clan_reverse_opinion = {
								name = opinion_built_temple
								who = PREVPREVPREV # ROOT's clan title
								years = 20
							}
						}
					}

					any_vassal = {
						limit = {
							clan = yes
							religion = ROOT

							NOR = {
								has_feud_with = ROOT
								character = ROOT
							}
						}

						clan_title = {
							clan_reverse_opinion = {
								name = opinion_built_temple
								who = PREVPREVPREVPREV # ROOT's clan title
								years = 20
							}
						}
					}
				}
			}
		}
	}
}

# Notify about feud started between clans
character_event = {
	id = HL.6
	title = EVTNAMEHL6
	desc = EVTDESCHL6
	picture = GFX_evt_shaman
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_feud_started

	ai = no
	has_dlc = "Horse Lords"

	option = {
		name = EVTOPTAHL6
	}
}

# Feud started between two clans because of raid and pillaging
character_event = {
	id = HL.8

	is_triggered_only = yes # on_loot_province, random_events
	hide_window = yes

	only_playable = yes
	has_dlc = "Horse Lords"

	trigger = {
		is_nomadic = yes

		FROM = {
			owner = {
				is_nomadic = yes
				is_ruler = yes
				same_realm = ROOT
				NOT = { has_feud_with = ROOT }
			}
		}
	}

	immediate = {
		clan_title = {
			FROM = {
				owner = {
					clan_title = {
						create_feud = PREVPREVPREV
					}
				}
			}
		}
	}
}

# Notify about clan adopting another faith
character_event = {
	id = HL.9
	title = EVTNAMEHL9
	desc = EVTDESCHL9
	picture = GFX_evt_tribal_shrine
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # adopt_faith, hl_clan_decisions.txt

	option = {
		name = OK
	}
}

# Death of blood brother
character_event = {
	id = HL.10
	title = EVTNAMEHL10
	desc = EVTDESCHL10
	picture = GFX_evt_tribal_shrine
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # on_blood_brother_death

	ai = no
	has_dlc = "Horse Lords"

	option = {
		name = EVTOPTAHL10
	}
}

# Notify about clan adopting another faith
character_event = {
	id = HL.11
	title = EVTNAMEHL11
	desc = EVTDESCHL11
	picture = GFX_evt_tribal_shrine
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # adopt_faith, hl_clan_decisions.txt

	option = {
		name = EXCELLENT
	}
}


# End blood oath on death
character_event = {
	id = HL.12

	is_triggered_only = yes # on_death
	hide_window = yes

	only_playable = yes
	has_dlc = "Horse Lords"

	trigger = {
		is_nomadic = yes
	}

	immediate = {
		clan_title = {
			end_oath = THIS
		}
	}
}