###################################
#
# THE OLD GODS
# - Holmgång Events
#
###################################

# Written by Henrik Eklund

namespace = TOG

# Liege Hates You (Invisible)
character_event = {
	id = TOG.5015
	hide_window = yes

	min_age = 16
	max_age = 50
	only_men = yes
	capable_only = yes
	prisoner = no
	religion_group = pagan_group

	trigger = {
		has_dlc = "The Old Gods"
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		NOR = {
			has_character_flag = holmgang_target
			has_character_flag = holmgang_challenger
			trait = incapable
			trait = wounded
			is_maimed_trigger = yes
			is_ill = yes
		}
		is_not_busy_trigger = yes
		liege = {
			age = 16
			NOT = { age = 50 }
			is_alive = yes
			is_female = no
			prisoner = no
			NOR = {
				trait = incapable
				trait = wounded
				is_maimed_trigger = yes
				is_ill = yes
				is_inaccessible_trigger = yes
			}
			is_not_busy_trigger = yes
			NOT = { character = ROOT }
			NOT = { opinion = { who = ROOT value =  -40 } }
			NOT = {
				has_character_flag = holmgang_target
				has_character_flag = holmgang_challenger
			}
			OR = {
				religion = norse_pagan
				religion = norse_pagan_reformed
			}
			NOT = {
				reverse_has_opinion_modifier = {  #checks if target is actually already loyal (thus not suitable for challening)
					who = ROOT
					modifier = opinion_loyal_servant
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 180

		modifier = {
			factor = 0.5
			trait = wroth
		}
		modifier = {
			factor = 0.5
			trait = duelist
		}
		modifier = {
			factor = 0.5
			trait = berserker
		}
		modifier = {
			factor = 0.6
			combat_rating = 5
		}
		modifier = {
			factor = 0.6
			is_strong_trigger = yes
		}
		modifier = {
			factor = 0.6
			trait = brave
		}
		modifier = {
			factor = 0.7
			trait = viking
		}
		modifier = {
			factor = 1.5
			trait = slothful
		}
		modifier = {
			factor = 2.0
			NOT = { combat_rating = 1 }
		}
		modifier = {
			factor = 2.0
			trait = content
		}
		modifier = {
			factor = 2.0
			trait = kind
		}
		modifier = {
			factor = 4.0
			trait = craven
		}
		modifier = {
			factor = 0.5
			has_focus = focus_war
		}
	}

	immediate = {
		liege = {
			set_character_flag = holmgang_challenger
			hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
			character_event = { id = TOG.5000 }
		}
		set_character_flag = holmgang_target
		hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
	}
}

# Fellow Vassal Hates You (Invisible)
character_event = {
	id = TOG.5016
	hide_window = yes

	min_age = 16
	max_age = 50
	only_men = yes
	capable_only = yes
	prisoner = no
	religion_group = pagan_group

	trigger = {
		has_dlc = "The Old Gods"
		independent = no
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		NOR = {
			has_character_flag = holmgang_target
			has_character_flag = holmgang_challenger
			trait = incapable
			trait = wounded
			is_maimed_trigger = yes
			is_ill = yes
		}
		is_not_busy_trigger = yes
		liege = {
			any_vassal = {
				is_ruler = yes
				age = 16
				is_alive = yes
				is_female = no
				prisoner = no
				NOR = {
					trait = incapable
					trait = wounded
					is_maimed_trigger = yes
					is_ill = yes
					is_inaccessible_trigger = yes
				}
				is_not_busy_trigger = yes
				NOT = {
					character = ROOT
					liege = { character = ROOT }
				}
				NOT = { opinion = { who = ROOT value =  -40 } }
				NOT = {
					has_character_flag = holmgang_target
					has_character_flag = holmgang_challenger
				}
				OR = {
					religion = norse_pagan
					religion = norse_pagan_reformed
				}
				NOT = {
					reverse_has_opinion_modifier = {  #checks if target is actually already loyal (thus not suitable for challening)
						who = ROOT
						modifier = opinion_loyal_servant
					}
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 180

		modifier = {
			factor = 0.5
			trait = wroth
		}
		modifier = {
			factor = 0.5
			trait = duelist
		}
		modifier = {
			factor = 0.5
			trait = berserker
		}
		modifier = {
			factor = 0.6
			combat_rating = 5
		}
		modifier = {
			factor = 0.6
			is_strong_trigger = yes
		}
		modifier = {
			factor = 0.6
			trait = brave
		}
		modifier = {
			factor = 0.7
			trait = viking
		}
		modifier = {
			factor = 1.5
			trait = slothful
		}
		modifier = {
			factor = 2.0
			NOT = { combat_rating = 1 }
		}
		modifier = {
			factor = 2.0
			trait = content
		}
		modifier = {
			factor = 2.0
			trait = kind
		}
		modifier = {
			factor = 4.0
			trait = craven
		}
		modifier = {
			factor = 0.5
			has_focus = focus_war
		}
	}

	immediate = {
		liege = {
			random_vassal = {
				limit = {
					is_ruler = yes
					age = 16
					is_alive = yes
					is_female = no
					prisoner = no
					NOR = {
						trait = incapable
						trait = wounded
						is_maimed_trigger = yes
						is_ill = yes
						is_inaccessible_trigger = yes
					}
					is_not_busy_trigger = yes
					NOT = {
						character = ROOT
						liege = { character = ROOT }
					}
					NOT = { opinion = { who = ROOT value =  -40 } }
					NOT = {
						has_character_flag = holmgang_target
						has_character_flag = holmgang_challenger
					}
					OR = {
						religion = norse_pagan
						religion = norse_pagan_reformed
					}
					NOT = {
						reverse_has_opinion_modifier = {  #checks if target is actually already loyal (thus not suitable for challening)
							who = ROOT
							modifier = opinion_loyal_servant
						}
					}
				}
				set_character_flag = holmgang_challenger
				hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
				character_event = { id = TOG.5000 }
			}
		}
		set_character_flag = holmgang_target
		hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
	}
}

# Your Vassal Hates You (Invisible)
character_event = {
	id = TOG.5017
	hide_window = yes

	min_age = 16
	max_age = 50
	only_men = yes
	capable_only = yes
	prisoner = no
	only_rulers = yes
	religion_group = pagan_group

	trigger = {
		has_dlc = "The Old Gods"
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		NOR = {
			trait = incapable
			trait = wounded
			is_maimed_trigger = yes
			is_ill = yes
			has_character_flag = holmgang_target
			has_character_flag = holmgang_challenger
		}
		is_not_busy_trigger = yes
		any_vassal = {
			is_ruler = yes
			age = 16
			is_alive = yes
			is_female = no
			prisoner = no
			NOT = {
				trait = incapable
				trait = wounded
				is_maimed_trigger = yes
				is_ill = yes
				is_inaccessible_trigger = yes
			}
			is_not_busy_trigger = yes
			NOT = { character = ROOT }
			NOT = { opinion = { who = ROOT value =  -40 } }
			NOT = {
				has_character_flag = holmgang_target
				has_character_flag = holmgang_challenger
			}
			OR = {
				religion = norse_pagan
				religion = norse_pagan_reformed
			}
			NOT = {
				reverse_has_opinion_modifier = {  #checks if target is actually already loyal (thus not suitable for challening)
					who = ROOT
					modifier = opinion_loyal_servant
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 180

		modifier = {
			factor = 0.5
			trait = wroth
		}
		modifier = {
			factor = 0.5
			trait = duelist
		}
		modifier = {
			factor = 0.5
			trait = berserker
		}
		modifier = {
			factor = 0.6
			combat_rating = 5
		}
		modifier = {
			factor = 0.6
			is_strong_trigger = yes
		}
		modifier = {
			factor = 0.6
			trait = brave
		}
		modifier = {
			factor = 0.7
			trait = viking
		}
		modifier = {
			factor = 1.5
			trait = slothful
		}
		modifier = {
			factor = 2.0
			NOT = { combat_rating = 1 }
		}
		modifier = {
			factor = 2.0
			trait = content
		}
		modifier = {
			factor = 2.0
			trait = kind
		}
		modifier = {
			factor = 4.0
			trait = craven
		}
		modifier = {
			factor = 0.5
			has_focus = focus_war
		}
	}

	immediate = {
		random_vassal = {
			limit = {
				is_ruler = yes
				age = 16
				is_alive = yes
				is_female = no
				prisoner = no
				NOR = {
					trait = incapable
					trait = wounded
					is_maimed_trigger = yes
					is_ill = yes
					is_inaccessible_trigger = yes
				}
				is_not_busy_trigger = yes
				NOT = { character = ROOT }
				NOT = { opinion = { who = ROOT value =  -40 } }
				NOT = {
					has_character_flag = holmgang_target
					has_character_flag = holmgang_challenger
				}
				OR = {
					religion = norse_pagan
					religion = norse_pagan_reformed
				}
				NOT = {
					reverse_has_opinion_modifier = {  #checks if target is actually already loyal (thus not suitable for challening)
						who = ROOT
						modifier = opinion_loyal_servant
					}
				}
			}
			set_character_flag = holmgang_challenger
			hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
			character_event = { id = TOG.5000 }
		}
		set_character_flag = holmgang_target
		hidden_tooltip = { character_event = { id = TOG.5999 days = 50 } } # Safety catch flag clearing
	}
}

# The challenge is issued
character_event = {
	id = TOG.5000
	desc = EVTDESC_TOG_5000
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5000
		ai_chance = {
			factor = 50
			modifier = {
				factor = 10
				trait = brave
			}
			modifier = {
				factor = 10
				trait = berserker
			}
			modifier = {
				factor = 30
				trait = duelist
			}
			modifier = {
				factor = 10
				trait = wroth
			}
			modifier = {
				factor = 15
				has_focus = focus_war
			}
		}
		add_character_modifier = {
			name = do_not_disturb
			days = 14
			hidden = yes
		}
		FROM = {
			character_event = { id = TOG.5001 days = 2 tooltip = EVTTOOLTIP_TOG_5000 }
		}
	}
	option = {
		name = EVTOPTB_TOG_5000
		ai_chance = {
			factor = 50
			modifier = {
				factor = 30
				trait = craven
			}
			modifier = {
				factor = 10
				trait = kind
			}
			modifier = {
				factor = 10
				trait = slothful
			}
			modifier = {
				factor = 10
				trait = patient
			}
		}
		custom_tooltip = { text = no_holmgang }
		clr_character_flag = holmgang_challenger
		FROM = { 
			clr_character_flag = holmgang_target
		}
	}
}

# Challenge received
character_event = {
	id = TOG.5001
	desc = EVTDESC_TOG_5001
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5001
		ai_chance = {
			factor = 50
			modifier = {
				factor = 10
				trait = brave
			}
			modifier = {
				factor = 10
				trait = berserker
			}
			modifier = {
				factor = 30
				trait = duelist
			}
			modifier = {
				factor = 10
				trait = wroth
			}
			modifier = {
				factor = 15
				has_focus = focus_war
			}
		}
		add_character_modifier = {
			name = do_not_disturb
			days = 12
			hidden = yes
		}
		FROM = {
			character_event = { id = TOG.5002 days = 2 tooltip = EVTTOOLTIP_TOG_5002 }
		}
	}
	option = {
		name = EVTOPTB_TOG_5001
		ai_chance = {
			factor = 50
			modifier = {
				factor = 30
				trait = craven
			}
			modifier = {
				factor = 10
				trait = kind
			}
			modifier = {
				factor = 10
				trait = slothful
			}
			modifier = {
				factor = 10
				trait = patient
			}
		}
		FROM = {
			character_event = { id = TOG.5003 days = 2 tooltip = EVTTOOLTIP_TOG_5003 }
		}
		prestige = -100
		if = {
			limit = { trait = brave }
			random = {
				chance = 33
				remove_trait = brave
			}
		}
		if = {
			limit = {
				NOT = { trait = brave }
				NOT = { trait = craven }
				NOT = { trait = berserker }
			}
			random = {
				chance = 33
				add_trait = craven
				hidden_tooltip = {
					character_event = {
						id = 38257 #Notify Craven
					}
				}
			}
		}
	}
}

# Challenge accepted
character_event = {
	id = TOG.5002
	desc = EVTDESC_TOG_5002
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5002
		custom_tooltip = { text = holmgang_prepare }
		hidden_tooltip = {
			change_variable = { which = "lifestyle_martial" value = 1 }
			FROM = { change_variable = { which = "lifestyle_martial" value = 1 } }
			FROM = { character_event = { id = TOG.5004 days = 7} }			
			e_rebels = { holder_scope = { character_event = { id = DuelEngine.0 days = 8} } } #FROM = target, FROMFROM = challenger			
		}
	}
}

# Challenge refused
character_event = {
	id = TOG.5003
	desc = EVTDESC_TOG_5003
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5003
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROM = {
			clr_character_flag = holmgang_target
		}
		tooltip = {
			FROM = {
				prestige = -100
			}
		}
		prestige = 50
	}
}

# The Fight Begins! Opponent
character_event = {
	id = TOG.5004
	desc = EVTDESC_TOG_5004
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5004
	}
}

# The Fight Begins!
# replaced by duel engine, comment out
# character_event = {
	# id = TOG.5018
	# desc = EVTDESC_TOG_5018
	# picture = GFX_evt_melee
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# hide_from = yes

	# option = {
		# name = EVTOPTA_TOG_5004
		# if = {
			# limit = {
				# combat_rating_diff = { who = FROMFROM value = 5 }
			# }
			# custom_tooltip = { text = holmgang_chances_great }
		# }
		# if = {
			# limit = {
				# combat_rating_diff = { who = FROMFROM value = 3 }
				# NOT = {
					# combat_rating_diff = { who = FROMFROM value = 5 }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_very_good }
		# }
		# if = {
			# limit = {
				# combat_rating_diff = { who = FROMFROM value = 1 }
				# NOT = {
					# combat_rating_diff = { who = FROMFROM value = 3 }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_good }
		# }
		# if = {
			# limit = {
				# NOT = {
					# combat_rating_diff = { who = FROMFROM value = 1 }
					# FROMFROM = {
						# combat_rating_diff = { who = ROOT value = 1 }
					# }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_even }
		# }
		# if = {
			# limit = {
				# FROMFROM = {
					# combat_rating_diff = { who = ROOT value = 1 }
				# }
				# NOT = {
					# FROMFROM = {
						# combat_rating_diff = { who = ROOT value = 3 }
					# }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_poor }
		# }
		# if = {
			# limit = {
				# FROMFROM = {
					# combat_rating_diff = { who = ROOT value = 3 }
				# }
				# NOT = {
					# FROMFROM = {
						# combat_rating_diff = { who = ROOT value = 5 }
					# }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_very_poor }
		# }
		# if = {
			# limit = {
				# FROMFROM = {
					# combat_rating_diff = { who = ROOT value = 5 }
				# }
			# }
			# custom_tooltip = { text = holmgang_chances_terrible }
		# }
	# }
# }

# Wins (Scarred)
character_event = {
	id = TOG.5005
	desc = EVTDESC_TOG_5005
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5005
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = TOG.5027 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROMFROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}		
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -200 }
		}
	}
}

# Wins (Scarred, Opponent Dies)
character_event = {
	id = TOG.5006
	desc = EVTDESC_TOG_5006
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5005
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = TOG.5029 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROMFROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		prestige = 200		
	}
}

# Wins
character_event = {
	id = TOG.5007
	desc = EVTDESC_TOG_5007
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5005
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = TOG.5027 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROMFROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -200 }
		}
	}
}

# Wins (Opponent Dies)
character_event = {
	id = TOG.5008
	desc = EVTDESC_TOG_5008
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5005
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = TOG.5029 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROMFROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		prestige = 200		
	}
}

# Wins (Opponent Flees)
character_event = {
	id = TOG.5009
	desc = EVTDESC_TOG_5009
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5005
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = TOG.5026 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROMFROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -400 }
		}
	}
}

# Draw (Both Wounded)
# obsoleted by duel engine, commented out
# character_event = {
	# id = TOG.5010
	# desc = EVTDESC_TOG_5010
	# picture = GFX_evt_melee
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# hide_from = yes

	# option = {
		# name = EVTOPTA_TOG_5010
		# hidden_tooltip = {
			# FROMFROM = {
				# character_event = { id = TOG.5025 }
			# }
		# }
		# clr_character_flag = holmgang_challenger
		# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# FROMFROM = {
			# clr_character_flag = holmgang_target
			# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# }
		# prestige = 50
		# add_trait = wounded
		# tooltip = {
			# FROMFROM = {
				# prestige = 50
				# add_trait = wounded
				# opinion = {
					# modifier = opinion_mutual_respect
					# who = ROOT
				# }
			# }
		# }
		# opinion = {
			# modifier = opinion_mutual_respect
			# who = FROMFROM
		# }
	# }
# }

# Loses (Flees in Disgrace)
character_event = {
	id = TOG.5011
	desc = EVTDESC_TOG_5011
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	hide_from = yes

	option = {
		name = EVTOPTA_TOG_5011
		hidden_tooltip = {
			FROM = {
				character_event = { id = TOG.5024 }
			}
		}
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		tooltip = {
			FROM = { prestige = 200 }
		}
		prestige = -400
	}
}

# Loses (Wounded)
character_event = {
	id = TOG.5012
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	hide_from = yes		
	
	desc = {
		text = EVTDESC_TOG_5013
		trigger = {
			is_maimed_trigger = yes
		}
	}

	desc = {
		text = EVTDESC_TOG_5012
		trigger = {
			is_maimed_trigger = no
		}
	}

	option = {
		name = EVTOPTA_TOG_5012		
		clr_character_flag = holmgang_challenger
		hidden_tooltip = { remove_do_not_disturb_effect = yes }
		FROM = {
			clr_character_flag = holmgang_target
			hidden_tooltip = { remove_do_not_disturb_effect = yes }
		}
		tooltip = {
			FROM = { prestige = 200 }
		}
		prestige = -200		
	}
}

# # Loses (Maimed)
# character_event = {
	# id = TOG.5013
	# desc = EVTDESC_TOG_5013
	# picture = GFX_evt_bloody_man
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# hide_from = yes

	# option = {
		# name = EVTOPTA_TOG_5012		
		# clr_character_flag = holmgang_challenger
		# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# FROM = {
			# clr_character_flag = holmgang_target
			# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# }
		# tooltip = {
			# FROM = { prestige = 200 }
		# }
		# prestige = -200		
	# }
# }

# Loses (Dies)
# replaced by duel engine, comment out
# character_event = {
	# id = TOG.5014
	# desc = EVTDESC_TOG_5014
	# picture = GFX_evt_bloody_man
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# hide_from = yes

	# option = {
		# name = EVTOPTA_TOG_5014
		# hidden_tooltip = {
			# FROMFROM = {
				# random_list = {
					# 50 = { character_event = { id = TOG.5021 } }
					# 50 = { character_event = { id = TOG.5023 } }
				# }
			# }
		# }
		# clr_character_flag = holmgang_challenger
		# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# FROMFROM = {
			# clr_character_flag = holmgang_target
			# hidden_tooltip = { remove_do_not_disturb_effect = yes }
		# }
		# death = {
			# death_reason = death_duel
			# killer = FROMFROM
		# }
	# }
# }

# Wins (Scarred) Opponent
character_event = {
	id = TOG.5020
	desc = EVTDESC_TOG_5020
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_TOG_5005
		add_trait = scarred
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -200 }
		}
	}
}

# Wins (Scarred, Opponent Dies) Opponent
character_event = {
	id = TOG.5021
	desc = EVTDESC_TOG_5021
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5005		
		prestige = 200
		
	}
}

# Wins Opponent
character_event = {
	id = TOG.5022
	desc = EVTDESC_TOG_5022
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5005
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -200 }
		}
	}
}

# Wins (Opponent Dies) Opponent
character_event = {
	id = TOG.5023
	desc = EVTDESC_TOG_5023
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5005
		prestige = 200		
	}
}

# Wins (Opponent Flees) Opponent
character_event = {
	id = TOG.5024
	desc = EVTDESC_TOG_5024
	picture = GFX_evt_melee
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5005
		prestige = 200
		tooltip = {
			FROMFROM = { prestige = -400 }
		}
	}
}

# Draw (Both Wounded) Opponent
# obsoleted by duel engine, commented out
# character_event = {
	# id = TOG.5025
	# desc = EVTDESC_TOG_5010
	# picture = GFX_evt_melee
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# option = {
		# name = EVTOPTA_TOG_5010
		# prestige = 50
		# tooltip = {
			# FROM = {
				# prestige = 50
				# opinion = {
					# modifier = opinion_mutual_respect
					# who = ROOT
				# }
			# }
		# }
		# opinion = {
			# modifier = opinion_mutual_respect
			# who = FROM
		# }
	# }
# }

# Loses (Flees in Disgrace) Opponent
character_event = {
	id = TOG.5026
	desc = EVTDESC_TOG_5026
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5011
		tooltip = {
			FROM = { prestige = 200 }
		}
		prestige = -400
	}
}

# Loses (Wounded) Opponent
character_event = {
	id = TOG.5027
	desc = EVTDESC_TOG_5027
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	desc = {
		text = EVTDESC_TOG_5028
		trigger = {
			is_maimed_trigger = yes
		}
	}

	option = {
		name = EVTOPTA_TOG_5012
		tooltip = {
			FROM = { prestige = 200 }
		}
		prestige = -200		
	}
}

# Loses (Maimed) Opponent
# replaced by duel engine, comment out
# character_event = {
	# id = TOG.5028
	# desc = EVTDESC_TOG_5028
	# picture = GFX_evt_bloody_man
	# border = GFX_event_normal_frame_war

	# is_triggered_only = yes

	# option = {
		# name = EVTOPTA_TOG_5012
		# tooltip = {
			# FROM = { prestige = 200 }
		# }
		# prestige = -200
		# add_trait = maimed
	# }
# }

# Loses (Dies) Opponent
character_event = {
	id = TOG.5029
	desc = EVTDESC_TOG_5029
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = EVTOPTA_TOG_5014
		death = {
			death_reason = death_duel
			killer = FROM
		}
	}
}

###########################################
# Flag management                         #
###########################################

# Safety catch - clears character flags and modifiers
character_event = {
	id = TOG.5999

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		clr_character_flag = holmgang_challenger
		clr_character_flag = holmgang_target
	}
}

