﻿namespace = bp1_yearly

##################################################
# Henrik
# 

##################################################
# 6000-6999
##################################################


scripted_trigger rivals_child_trigger = {
	is_available_ai = yes
	age >= 14
	exists = liege
	can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = liege }
	has_short_disease_trigger = no
	OR = {
		has_trait = arrogant
		has_trait = brave
		has_trait = wrathful
		has_trait = ambitious
		has_trait = stubborn
		has_trait = vengeful
		has_trait = arbitrary
	}
	NOR = {
		has_relation_friend = root
		has_relation_best_friend = root
		has_trait = blind
		has_trait = craven
		has_trait = maimed
	}
}

scripted_effect set_new_rival_effect = {
	if = {
		limit = {
			NOR = {
				has_relation_friend = $CHARACTER$
				has_relation_best_friend = $CHARACTER$
				has_relation_rival = $CHARACTER$
				has_relation_nemesis = $CHARACTER$
			}
		}
		set_relation_rival = {
			target = $CHARACTER$
			reason = $REASON$
		}
	}
	else_if = {
		limit = {
			has_relation_rival = $CHARACTER$
		}
		set_relation_nemesis = {
			target = $CHARACTER$
			reason = $REASON$
		}
	}
}
#	
bp1_yearly.6000 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6000.t
	desc = bp1_yearly.6000.desc
	theme = unfriendly
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:rivals_child
		animation = rage
	}
	override_background = { reference = courtyard }

	cooldown = { years = 10 } #You can only be challenged by your rivals children once every decade.

	trigger = {
		has_dlc = "Friends and Foes"
		is_playable_character = yes
		is_available = yes
		OR = {
			any_relation = {
				type = nemesis
				is_travelling = no
				any_child = {
					rivals_child_trigger = yes
				}
			}
			any_relation = {
				type = rival
				is_travelling = no
				any_child = {
					rivals_child_trigger = yes
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		save_scope_as = attacked_rival
		if = { #Nemesis with valid children is always preferred
			limit = {
				any_relation = {
					type = nemesis
					any_child = {
						rivals_child_trigger = yes
					}
				}
			}
			random_relation = {
				type = nemesis
				limit = {
					any_child = {
						rivals_child_trigger = yes
					}
				}
				random_child = {
					limit = {
						rivals_child_trigger = yes
					}
					save_scope_as = rivals_child
				}
				save_scope_as = my_rival
			}
		}
		else = {
			random_relation = {
				type = rival
				limit = {
					any_child = {
						rivals_child_trigger = yes
					}
				}
				random_child = {
					limit = {
						rivals_child_trigger = yes
					}
					save_scope_as = rivals_child
				}
				save_scope_as = my_rival
			}
		}

		if = {
			limit = {
				exists = primary_heir
			}
			primary_heir = {
				save_scope_as = rivals_beneficiary #Used only if the rival is killed
			}
		}
		else_if = {
			limit = { exists = primary_spouse }
			primary_spouse = {
				save_scope_as = rivals_beneficiary
			}
		}
		#Else no benificiary is saved

		if = {
			limit = {
				exists = liege
			}
			liege = { save_scope_as = attacked_rivals_liege }
		}

	}

	# Accept the Challenge
	option = {
		name = bp1_yearly.6000.b

		custom_tooltip = bp1_yearly.6000.b.tt
		configure_start_single_combat_effect = {
			SC_INITIATOR = root
			SC_ATTACKER = scope:rivals_child
			SC_DEFENDER = root
			FATALITY = possible
			FIXED = no
			LOCALE = market
			OUTPUT_EVENT = bp1_yearly.6001
			INVALIDATION_EVENT = bp1_yearly.6002
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = major_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 1
				ai_compassion = -1
			}
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
		}
	}

	#My quarrel is not with you
	option = {
		name = bp1_yearly.6000.a
		flavor = bp1_yearly.6000.a.tt

		duel = {
			target = scope:rivals_child
			skill = diplomacy
			40 = {
				desc = bp1_yearly.6000.a.success
				compare_modifier = {
					value = scope:duel_value
				}
				send_interface_toast = {	
					title = bp1_yearly.6000.a.success
					left_icon = scope:rivals_child
					scope:rivals_child = {
						add_opinion = {
							modifier = defused_feud_escalation_opinion
							target = root
							opinion = 25
						}
					}
				}
			}
			60 = {
				desc = bp1_yearly.6000.a.failure
				send_interface_toast = {	
					title = bp1_yearly.6000.a.failure
					left_icon = scope:rivals_child
					set_new_rival_effect = { CHARACTER = scope:rivals_child REASON = rival_humiliating_refusal_to_fight }
					scope:rivals_child = {
						add_opinion = {
							modifier = humiliated_opinion
							target = root
							opinion = -50
						}
					}
				}
			}
		}
		
		stress_impact = {
			brave = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = 1
			}
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}
	
	# Guards!
	option = {
		name = bp1_yearly.6000.c
		add_prestige = minor_prestige_loss
		scope:rivals_child = {
			add_opinion = {
				modifier = humiliated_opinion
				target = root
				opinion = -50
			}
			progress_towards_rival_effect = {
				REASON = rival_child_challenge
				CHARACTER = root
				OPINION = 0
			}
		}
		stress_impact = {
			brave = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = 1
			}
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}
}

bp1_yearly.6001 = {
	hidden = yes

	#Note: Explicit scoping always necessary unless in fallback event - since this hidden event automatically switches who it fires for if you die!

	immediate = {
		if = {
			limit = {
				scope:sc_victor != scope:rivals_child #Attacked rival won
				scope:rivals_child = { is_alive = yes } #Child still lives
				scope:attacked_rival = { is_alive = yes } #Attacked rival still lives
			}
			scope:my_rival = {
				trigger_event = { id = bp1_yearly.6003 days = 1 } 
			}
		}
		else_if = {
			limit = {
				scope:sc_victor != scope:rivals_child #Attacked rival won
				scope:rivals_child = { is_alive = no } #Child is dead
			}
			scope:attacked_rival = {
				trigger_event = { id = bp1_yearly.6004 days = 1 } #I won and the child of my rival is dead.
			}
		}
		else_if = {
			limit = {
				scope:sc_victor = scope:rivals_child #Child won
				scope:attacked_rival = { is_alive = yes } #Attacked rival still lives
			}
			scope:my_rival = {
				trigger_event = { id = bp1_yearly.6005 days = 1 } #I lost but I live
			}
		}
		else = {
			scope:my_rival = {
				trigger_event = { id = bp1_yearly.6006 days = 1 } #I lost, my rival learns of my death
			}
		}
	}
}


#	Bout has invalidated, inform affected parties.
bp1_yearly.6002 = {
	hidden = yes

	immediate = {
		# Inform both parties that the duel has invalidated.
		scope:my_rival = {
			send_interface_toast = {	
				title = bp1_yearly.6002.trigger_failure
				left_icon = scope:rivals_child
			}
		}
	}
}

# Rival won - child arrives home
bp1_yearly.6003 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6003.t
	desc = bp1_yearly.6003.desc
	theme = unfriendly
	right_portrait = {
		character = root
		animation = disapproval
	}
	left_portrait = {
		character = scope:rivals_child
		animation = shame
	}

	lower_right_portrait = scope:attacked_rival

	immediate = {
		create_character_memory = {
			type = child_defeated_by_rival
			participants = {
				rival = scope:attacked_rival
				child_attacker = scope:rivals_child
			}
		}
		scope:attacked_rival = {
			create_character_memory = {
				type = attacked_by_rivals_child_won
				participants = {
					rival = scope:my_rival
					rivals_child = scope:rivals_child
				}
			}
		}
	}

	override_background = { reference = corridor_night }

	option = { # 
		name = bp1_yearly.6003.a
		flavor = not_controlling_child_tooltip

		add_prestige = minor_prestige_loss

		pay_short_term_gold = {
			target = scope:rivals_child
			gold = medium_gold_value
		}

		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6001.victory_toast
				left_icon = scope:sc_victor
				right_icon = scope:sc_loser
				scope:sc_victor = { add_prestige = medium_prestige_gain }
				scope:attacked_rival = {
					set_new_rival_effect = { CHARACTER = scope:rivals_child REASON = rival_child_defeated }
				}
			}
		}

		scope:rivals_child = {
			add_opinion = {
				target = root
				modifier = defended_family_honor_opinion
				opinion = 30
			}
		}
		scope:attacked_rival = {
			add_opinion = {
				target = root
				modifier = attacked_by_rivals_child
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:rivals_child
				modifier = defended_family_honor_opinion
				opinion = 30
			}
			every_child = { #Appreciated by Family
				limit = { this != scope:rivals_child }
				add_opinion = {
					target = scope:rivals_child
					modifier = defended_family_honor_opinion
					opinion = 15
				}
			}
		}
		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = major_stress_impact_gain
			vengeful = minor_stress_loss #Reducing the general gain that was in immediate
		}
		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
		}
	}

	option = {
		name = bp1_yearly.6003.b #How could you!?
		flavor = child_let_down_tooltip

		pay_short_term_gold = {
			target = scope:attacked_rival
			gold = medium_gold_value
		}

		scope:rivals_child = {
			progress_towards_rival_effect = {
				REASON = rival_child_challenge_recompense
				CHARACTER = root
				OPINION = default_rival_opinion
			}
		}
		
		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6001.victory_toast
				left_icon = scope:sc_victor
				right_icon = scope:sc_loser
				scope:sc_victor = { add_prestige = medium_prestige_gain }
			}
		}

		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}

	#Your hand is forced by the child here - there is no real opt out option.
}

# Rival Won, the child is dead
# Rival Reaction event
bp1_yearly.6004 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6004.t
	desc = bp1_yearly.6004.desc
	theme = unfriendly
	left_portrait = {
		character = root
		animation = shock
	}
	right_portrait = {
		character = scope:my_rival
		animation = rage
	}

	lower_right_portrait = scope:rivals_child

	override_background = { reference = corridor_night }

	immediate = {
		create_character_memory = {
			type = attacked_by_rivals_child_won
			participants = {
				rival = scope:my_rival
				rivals_child = scope:rivals_child
			}
		}
		add_opinion = {
			target = root
			modifier = attacked_by_rivals_child
		}

		add_prestige = medium_prestige_gain

		show_as_tooltip = {
			scope:my_rival = {
				add_opinion = {
					target = root
					modifier = killed_my_child
				}
			}
		}
	}

	option = { # I must offer my condolances to X
		name = bp1_yearly.6004.a
		show_as_tooltip = {
			pay_short_term_gold = {
				target = scope:my_rival
				gold = medium_gold_value
			}
		}
		scope:my_rival = {
			add_character_flag = rival_apology
			trigger_event = bp1_yearly.6010 #A life taken - Parent reaction event
		}
		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}

	option = { # He has reaped what he has sown
		name = bp1_yearly.6004.b
		add_prestige = medium_prestige_gain

		scope:my_rival = {
			trigger_event = bp1_yearly.6010 #The loss of a child - Parent reaction event
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			craven = major_stress_impact_gain
			vengeful = minor_stress_loss #Reducing the general gain that was in immediate
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
			modifier = {
				has_trait = craven
				factor = 0
			}
		}
		
	}
}

# Rival Won, the child is dead
# Parent reaction event
bp1_yearly.6010 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6010.t #The Loss of a Child
	desc = {
		desc = bp1_yearly.6010.desc
		triggered_desc = {
			trigger = {
				has_character_flag = rival_apology
			}
			desc = bp1_yearly.6010.desc.apology
		}
	}
	theme = unfriendly
	left_portrait = {
		character = root
		animation = shock
	}

	lower_right_portrait = scope:rivals_child

	override_background = { reference = corridor_night }

	immediate = {
		create_character_memory = {
			type = child_killed_by_rival
			participants = {
				rival = scope:attacked_rival
				child_attacker = scope:rivals_child
			}
		}
		add_stress = 20
		add_opinion = {
			target = scope:attacked_rival
			modifier = killed_my_child
		}
		if = {
			limit = {
				has_character_flag = rival_apology
			}
			scope:attacked_rival = {
				pay_short_term_gold = {
					target = scope:my_rival
					gold = medium_gold_value
				}
			}
		}
	}

	option = { # [attacked_rival.GetName] will regret this day!
		name = bp1_yearly.6010.a
		flavor = bp1_yearly.6010.a.flavor
		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6010.vengeance.outcome_toast
				left_icon = scope:my_rival
				scope:my_rival = {
					if = {
						limit = {
							NOT = { has_relation_nemesis = scope:attacked_rival }
						}
						set_relation_nemesis = {
							reason = nemesis_rival_killed_child
							involved_character = scope:rivals_child
							target = scope:attacked_rival
						}
					}
					#Cycle of revenge more likely to continue
					every_child = {
						custom = every_child_6010
						progress_towards_rival_effect = {
							REASON = rival_attacked_rival
							CHARACTER = scope:attacked_rival
							OPINION = default_rival_opinion
						}
					}
				}
			}
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = major_stress_impact_gain
			vengeful = minor_stress_loss #Reducing the general gain that was in immediate
		}
		
		ai_chance = {
			base = 100
			modifier = {
				has_character_flag = rival_apology 
				factor = 0.5 #Half as likely to go for this option if issued an apology
			}
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
		}
	}

	option = { # Escalation is madness!
		name = bp1_yearly.6010.b
		flavor = bp1_yearly.6010.b.flavor

		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6010.deescalation.outcome_toast
				left_icon = scope:my_rival
				scope:my_rival = {
					add_prestige = minor_prestige_loss
				}
			}
		}

		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}
		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				NOT = { has_character_flag = rival_apology } #Apology offsets the traits.
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				NOT = { has_character_flag = rival_apology } #Apology offsets the traits.
				factor = 0
			}
			modifier = {
				has_trait = impatient
				NOT = { has_character_flag = rival_apology } #Apology offsets the traits.
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				NOT = { has_character_flag = rival_apology } #Apology offsets the traits.
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				NOT = { has_character_flag = rival_apology } #Apology offsets the traits.
				factor = 0
			}
		}
	}
	after = {
		if = {
			limit = { has_character_flag = rival_apology }
			remove_character_flag = rival_apology
		}
	}
}

# Rival Lost, Child Lives
bp1_yearly.6005 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6005.t
	desc = bp1_yearly.6005.desc
	theme = unfriendly
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:rivals_child
		animation = personality_bold
	}
	override_background = { reference = corridor_day }

	immediate = {
		create_character_memory = {
			type = child_defeated_rival
			participants = {
				rival = scope:attacked_rival
				child_attacker = scope:rivals_child
			}
		}
		scope:attacked_rival = {
			create_character_memory = {
				type = attacked_by_rivals_child_lost
				participants = {
					rival = scope:my_rival
					rivals_child = scope:rivals_child
				}
			}
		}
	}

	option = { # This should teach [attacked_rival.GetName] a valuable lesson
		name = bp1_yearly.6005.a 
		flavor = rewarding_success_in_child_tooltip

		add_prestige = medium_prestige_gain
		
		pay_short_term_gold = {
			target = scope:rivals_child
			gold = medium_gold_value
		}

		scope:rivals_child = {
			add_opinion = {
				target = root
				modifier = defended_family_honor_opinion
				opinion = 30
			}
		}
		scope:attacked_rival = {
			add_opinion = {
				target = root
				modifier = attacked_by_rivals_child
			}
		}
		hidden_effect = {
			add_opinion = {
				target = scope:rivals_child
				modifier = defended_family_honor_opinion
				opinion = 30
			}
			every_child = { #Appreciated by Family
				limit = { this != scope:rivals_child }
				add_opinion = {
					target = scope:rivals_child
					modifier = defended_family_honor_opinion
					opinion = 15
				}
			}
		}

		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6005.outcome_toast
				left_icon = scope:sc_victor
				right_icon = scope:sc_loser
				scope:sc_loser = { add_prestige = major_prestige_loss }
				scope:attacked_rival = {
					set_new_rival_effect = { CHARACTER = scope:rivals_child REASON = rival_child_won }
				}
			}
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = major_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
		}
	}

	option = { # #How could you!?
		name = bp1_yearly.6005.b
		flavor = child_let_down_tooltip

		scope:rivals_child = {
			progress_towards_rival_effect = {
				REASON = rival_attacked_rival_criticised
				CHARACTER = root
				OPINION = -25
			}
			if = {
				limit = {
					NOT = { has_trait = disloyal }
				}
				random = {
					chance = 25
					add_trait = disloyal
				}
			}
		}
		
		scope:attacked_rival = {
			send_interface_toast = {
				title = bp1_yearly.6005.outcome_toast
				left_icon = scope:sc_victor
				right_icon = scope:sc_loser
				scope:my_rival = {
					pay_short_term_gold = {
						target = scope:attacked_rival
						gold = medium_gold_value
					}
				}
			}
		}

		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}


		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}
}

# Rival died, triumphant homecoming?
bp1_yearly.6006 = {
	type = character_event
	content_source = dlc_006
	title = bp1_yearly.6006.t
	desc = bp1_yearly.6006.desc
	theme = unfriendly
	left_portrait = {
		character = root
		animation = disapproval
	}
	right_portrait = {
		character = scope:rivals_child
		animation = happiness
	}

	lower_right_portrait = scope:attacked_rival

	override_background = { reference = corridor_day }

	immediate = {
		if = {
			limit = {
				exists = scope:attacked_rivals_liege #If the rival had a liege this liege will take offense
				scope:attacked_rivals_liege != this
				scope:attacked_rivals_liege != scope:rivals_child
			}
			scope:attacked_rivals_liege = {
				add_opinion = {
					target = scope:rivals_child
					modifier = murdered_my_vassal_crime
				}
			}
		}
		create_character_memory = {
			type = child_killed_rival
			participants = {
				rival = scope:attacked_rival
				child_attacker = scope:rivals_child
			}
		}
		if = {
			limit = { exists = scope:rivals_beneficiary }
			scope:rivals_beneficiary = {
				create_character_memory = {
					type = parent_was_killed_by_rivals_child
					participants = {
						dead_relation = scope:attacked_rival
						relation_killer = scope:rivals_child
						rival = scope:my_rival
					}
				}
			}
		}
	}

	option = { # You make me proud [rivals_child.Custom('GetDaughterSon')]
		name = bp1_yearly.6006.a 

		flavor = rewarding_success_in_child_tooltip

		add_prestige = medium_prestige_gain
		
		pay_short_term_gold = {
			target = scope:rivals_child
			gold = minor_gold_value
		}

		if = {
			limit = { exists = scope:rivals_beneficiary }
			scope:rivals_beneficiary = {
				send_interface_toast = {
					title = bp1_yearly.6006.outcome_toast
					left_icon = scope:sc_victor
					right_icon = scope:sc_loser
					scope:rivals_beneficiary = { add_prestige = major_prestige_loss }
					scope:rivals_beneficiary = {
						set_new_rival_effect = { CHARACTER = scope:rivals_child REASON = rival_killed_parent }
						set_new_rival_effect = { CHARACTER = scope:my_rival REASON = rival_killed_parent }
					}
				}
				add_opinion = {
					target = root
					modifier = attacked_by_rivals_child
				}
			}
		}

		scope:rivals_child = {
			add_opinion = {
				target = root
				modifier = defended_family_honor_opinion
				opinion = 30
			}
		}

		if = {
			limit = {
				exists = scope:attacked_rivals_liege #If the rival had a liege this liege will take offense
				scope:attacked_rivals_liege != this
				scope:attacked_rivals_liege != scope:rivals_child
			}
			scope:attacked_rivals_liege = {
				add_opinion = {
					target = scope:my_rival
					modifier = murdered_my_vassal_crime
				}
			}
		}

		hidden_effect = {
			add_opinion = {
				target = scope:rivals_child
				modifier = defended_family_honor_opinion
				opinion = 30
			}
			every_child = { #Appreciated by Family
				limit = { this != scope:rivals_child }
				add_opinion = {
					target = scope:rivals_child
					modifier = defended_family_honor_opinion
					opinion = 15
				}
			}
		}

		stress_impact = {
			forgiving = medium_stress_impact_gain
			calm = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			shy = minor_stress_impact_gain
			craven = major_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				has_trait = patient
				factor = 0
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = forgiving
				factor = 0
			}
		}
	}

	option = { # How could you do this? We must compensate [rivals_beneficiary.GetTitledFirstNameNoTooltip]
		name = bp1_yearly.6006.b	
		trigger = {
			exists = scope:rivals_beneficiary
		}

		flavor = child_let_down_tooltip


		scope:rivals_child = {
			scope:rivals_beneficiary = { save_scope_as = relationship_reason_involved_character }
			progress_towards_rival_effect = {
				REASON = rival_child_challenge_recompense_6006
				CHARACTER = root
				OPINION = -25
			}
			clear_saved_scope = relationship_reason_involved_character

			if = {
				limit = {
					NOT = { has_trait = disloyal }
				}
				random = {
					chance = 25
					add_trait = disloyal
				}
			}
		}
		
		scope:rivals_beneficiary = {
			send_interface_toast = {
				title = bp1_yearly.6006.outcome_toast
				left_icon = scope:sc_victor
				right_icon = scope:sc_loser
				scope:my_rival = {
					pay_short_term_gold = {
						target = scope:rivals_beneficiary
						gold = medium_gold_value
					}
				}
			}
		}

		
		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}


		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}

	option = { # Donate to charity
		name = bp1_yearly.6006.c	
		trigger = {
			NOT = { exists = scope:rivals_beneficiary }
		}
		flavor = bp1_yearly.6006.c.tt

		add_piety = medium_piety_gain

		remove_short_term_gold = medium_gold_value

		scope:rivals_child = {
			scope:attacked_rival = { save_scope_as = relationship_reason_involved_character }
			progress_towards_rival_effect = {
				REASON = rival_child_challenge_recompense_charity
				CHARACTER = root
				OPINION = -25
			}
			clear_saved_scope = relationship_reason_involved_character
		}
		
		stress_impact = {
			vengeful = major_stress_impact_gain
			wrathful = major_stress_impact_gain
			impatient = major_stress_impact_gain
			arbitrary = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
		}


		
		ai_chance = {
			base = 100
			modifier = {
				has_trait = vengeful
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 0
			}
			modifier = {
				has_trait = impatient
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 0
			}
			modifier = {
				has_trait = arrogant
				factor = 0
			}
		}
	}

}
