﻿namespace = ep2_wedding

# ON START - CEREMONY - BLOODY WEDDING

ep2_wedding.0101 = {
	type = activity_event
	title = ep2_wedding.0101.t
	desc = {
		desc = ep2_wedding.0101.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { root = scope:spouse_1 }
				desc = ep2_wedding.0101.desc.spouse
			}
			triggered_desc = {
				trigger = { has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 } }
				desc = ep2_wedding.0101.desc.bad
			}
			triggered_desc = {
				trigger = { has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 } }
				desc = ep2_wedding.0101.desc.good
			}
		}
	}
		
	theme = bloody_wedding_ceremony
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	right_portrait = {
		character = scope:spouse_2
		animation = admiration
	}
	
	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Feasts/ep2_event_grand_murder_feast"
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender } #for loc
	}

	option = { #kill all of them
		name = {
			trigger = { scope:spouse_2 = { is_lowborn = no } }
			text = ep2_wedding.0101.a
		}
		name = {
			trigger = { scope:spouse_2 = { is_lowborn = yes } }
			text = ep2_wedding.0101.a_lowborn
		}			
		custom_tooltip = ep2_wedding.0101.a.tt
		set_variable = bloody_wedding_murder_family_var
		ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = arbitrary
					has_trait = paranoid
					has_trait = deceitful
					has_trait = wrathful
					has_trait = vengeful
					has_trait = callous
					has_trait = sadistic
				}
				NOT = { has_trait = calm }
				add = 50
			}
			modifier = {
				OR = {
					has_trait = calm
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
					has_trait = honest
				}
				add = -50
			}
		}
	}
	
	option = { #kill only the spouse
		name = ep2_wedding.0101.b
		custom_tooltip = ep2_wedding.0101.a.tt
		set_variable = bloody_wedding_murder_solo_var
			ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = just
					has_trait = brave
					has_trait = temperate
					has_trait = impatient
				}
				NOT = { has_trait = wrathful }
				add = 50
			}
		}
	}
	
	option = { #kill only the spouse - during OUR wedding night
		name = ep2_wedding.0101.c
		custom_tooltip = ep2_wedding.0101.c.tt
		trigger = {
			root = scope:spouse_1
			scope:spouse_2 = { is_ai = yes } #too complex to account for this if it's a player
			NOT = {
				scope:activity = {
					any_attending_character = {
						is_close_or_extended_family_of = scope:spouse_2
						is_ai = no
					}
				}
			}
		}
		set_variable = bloody_wedding_murder_spouse_var
			ai_chance = {
			base = 100
			modifier = {
				OR = {
					has_trait = just
					has_trait = brave
					has_trait = patient
					has_trait = craven
				}
				add = 50
			}
		}
	}
	
	option = { #back down
		name = ep2_wedding.0101.d 
		custom_tooltip = ep2_wedding.0101.d.tt
		set_variable = {
			name = bloody_wedding_backed_down_var
			years = 1
		}
		ai_chance = {
			base = 10 #unlikely to back down once it's started
			modifier = { #UNLESS
				OR = {
					has_trait = calm
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
					has_trait = honest
				}
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
				add = 200
			}
		}
	}
}

# ON COMPLETE BANQUET - MASSACRE - BLOODY WEDDING - KILL EVERYONE

scripted_trigger ep2_wedding_0202_valid_family_member_trigger = {
	is_close_or_extended_family_of = scope:spouse_2
	this != root
	is_close_family_or_spouse_of_root_trigger = no
	this != scope:spouse_2
}

ep2_wedding.0202 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { 
					root = scope:spouse_1
				}
				desc = ep2_wedding.0202.t.spouse
			}
			triggered_desc = {
				desc = ep2_wedding.0202.t
			}
		}
	}
	desc = {
		desc = ep2_wedding.0202.desc.intro
		random_valid = {
			triggered_desc = {
				trigger = { #compassionate
					OR = {
						has_trait = compassionate
						has_trait = forgiving
					}
				}
				desc = ep2_wedding.0202.desc.compassionate
			}
			triggered_desc = { #paranoid
				trigger = {
					has_trait = paranoid
				}
				desc = ep2_wedding.0202.desc.paranoid
			}
			triggered_desc = { #zealous
				trigger = {
					has_trait = zealous
				}
				desc = ep2_wedding.0202.desc.zealous
			}
			triggered_desc = { #sadistic
				trigger = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = torturer
					}
				}
				desc = ep2_wedding.0202.desc.sadistic
			}
			triggered_desc = { #cannibal
				trigger = {
					is_cannibal_trigger = yes
				}
				desc = ep2_wedding.0202.desc.cannibal
			}
			triggered_desc = { #craven
				trigger = {
					has_trait = craven
				}
				desc = ep2_wedding.0202.desc.craven
			}
			triggered_desc = { #arrogant
				trigger = {	
					OR = {
						has_trait = ambitious
						has_trait = arrogant
					}
					NOT = { has_trait = humble }
				}
				desc = ep2_wedding.0202.desc.arrogant
			}
			triggered_desc = { #lazy
				trigger = {
					has_trait = lazy
				}
				desc = ep2_wedding.0202.desc.lazy
			}
			triggered_desc = { #just
				trigger = {
					OR = {
						has_trait = just
						has_trait = honest
					}
				}
				desc = ep2_wedding.0202.desc.just
			}
			triggered_desc = { #wrathful
				trigger = {
					OR = {
						has_trait = wrathful
						has_trait = stubborn
						has_trait = vengeful
					}
					NOT = { has_trait = calm }
				}
				desc = ep2_wedding.0202.desc.wrathful
			}
			desc = ep2_wedding.0202.desc.fallback
		}
		desc = ep2_wedding.0202.desc.outro
	}
			
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = calm
					has_trait = craven
				}
			}
			animation = worry
		}
		animation = schadenfreude
	}
	center_portrait = {
		character = scope:mercenary_1
		animation = aggressive_sword
	}
	right_portrait = {
		character = scope:spouse_2
		animation = fear
	}
	lower_center_portrait = {
		trigger = { exists = scope:entourage_1 }
		character = scope:entourage_1
	}
	lower_right_portrait = {
		trigger = { exists = scope:entourage_2 }
		character = scope:entourage_2
	}
	lower_left_portrait = {
		trigger = { exists = scope:entourage_3 }
		character = scope:entourage_3
	}
	cooldown = { years = 3 } #so you don't get it again and again

	trigger = {
		exists = scope:activity
		has_variable = bloody_wedding_murder_family_var
	}
	
	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Feasts/ep2_event_grand_murder_feast"
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender } #for loc
		hidden_effect = {
			create_character = {
				template = mercenary
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				save_scope_as = mercenary_1
			}
			create_character = { #random peasant is present so the whole activity doesn't cancel
				template = servant_character
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = 50
				save_scope_as = shocked_rob
			}
			scope:shocked_rob = {
				add_to_activity = scope:activity
			}
		}
		if = {
			limit = {
				scope:activity = {
					any_attending_character = { 
						ep2_wedding_0202_valid_family_member_trigger = yes
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						ep2_wedding_0202_valid_family_member_trigger = yes
					}
					save_scope_as = entourage_1
				}
				random_attending_character = {
					limit = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						this != scope:entourage_1
					}
					save_scope_as = entourage_2
				}
				random_attending_character = {
					limit = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						this != scope:entourage_1
						this != scope:entourage_2
					}
					save_scope_as = entourage_3
				}
			}
		}
	}

	option = {
		name = {
			trigger = { scope:spouse_2 = { is_lowborn = no } }
			text = ep2_wedding.0202.a
		}
		name = {
			trigger = { scope:spouse_2 = { is_lowborn = yes } }
			text = ep2_wedding.0202.a.lowborn
		}
		if = {
			limit = { scope:spouse_2 = { is_ai = no } }
			scope:spouse_2 = { trigger_event = ep2_wedding.0204 }
		}
		else_if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						is_ai = no #there's a player family member
					}
				}
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						is_ai = no #there's a player family member
					}
					trigger_event = ep2_wedding.0204
				}
			}
		}
		else = {
			if = {
				limit = {
					scope:activity = {
						any_attending_character = {
							ep2_wedding_0202_valid_family_member_trigger = yes
						}
					}
				}
				scope:activity = {
					every_attending_character = {
						limit = {
							ep2_wedding_0202_valid_family_member_trigger = yes
						}
						custom = every_attending_relative_of_spouse_2
						death = {
							death_reason = death_bloody_wedding
						}
					}
				}
			}
			show_as_tooltip = { #we wanna show this
				scope:spouse_2 = {
					death = { death_reason = death_bloody_wedding }
					scope:host = {
						add_secret = {
							type = secret_murder
							target = scope:spouse_2
						}
					}
				}
			}
			hidden_effect = { #this does the effect
				unknown_murder_effect = {
					VICTIM = scope:spouse_2
					MURDERER = root
					REASON = death_bloody_wedding
				}
			}
			create_character_memory = {
				type = grand_wedding_massacre
				participants = {
					spouse_1 = scope:spouse_1
					spouse_2 = scope:spouse_2
				}
			}
		}
	}
	
	after = {
		if = {
			limit = { is_ai = yes }
			scope:mercenary_1 = { silent_disappearance_effect = yes }
		}
		hidden_effect = {
			scope:activity = { progress_activity_phase_after = { days = 1 } }
		}
	}
}

# ON COMPLETE BANQUET - MASSACRE - BLOODY WEDDING - KILL THE SPOUSE
ep2_wedding.0203 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = { 
					root = scope:spouse_1
				}
				desc = ep2_wedding.0203.t.spouse
			}
			triggered_desc = {
				desc = ep2_wedding.0203.t
			}
		}
	}
	desc = {
		desc = ep2_wedding.0203.desc.intro
		random_valid = {
			triggered_desc = {
				trigger = { #compassionate
					OR = {
						has_trait = compassionate
						has_trait = forgiving
					}
				}
				desc = ep2_wedding.0203.desc.compassionate
			}
			triggered_desc = { #paranoid
				trigger = {
					has_trait = paranoid
				}
				desc = ep2_wedding.0203.desc.paranoid
			}
			triggered_desc = { #zealous
				trigger = {
					has_trait = zealous
				}
				desc = ep2_wedding.0203.desc.zealous
			}
			triggered_desc = { #sadistic
				trigger = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = torturer
					}
				}
				desc = ep2_wedding.0203.desc.sadistic
			}
			triggered_desc = { #cannibal
				trigger = {
					is_cannibal_trigger = yes
				}
				desc = ep2_wedding.0203.desc.cannibal
			}
			triggered_desc = { #craven
				trigger = {
					has_trait = craven
				}
				desc = ep2_wedding.0203.desc.craven
			}
			triggered_desc = { #arrogant
				trigger = {	
					OR = {
						has_trait = ambitious
						has_trait = arrogant
					}
					NOT = { has_trait = humble }
				}
				desc = ep2_wedding.0203.desc.arrogant
			}
			triggered_desc = { #just
				trigger = {
					OR = {
						has_trait = just
						has_trait = honest
					}
				}
				desc = ep2_wedding.0203.desc.just
			}
			triggered_desc = { #wrathful
				trigger = {
					OR = {
						has_trait = wrathful
						has_trait = stubborn
						has_trait = vengeful
					}
					NOT = { has_trait = calm }
				}
				desc = ep2_wedding.0203.desc.wrathful
			}
			desc = ep2_wedding.0203.desc.fallback
		}
		desc = ep2_wedding.0203.desc.outro
	}
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = calm
					has_trait = craven
				}
			}
			animation = worry
		}
		animation = schadenfreude
	}
	center_portrait = {
		character = scope:my_agent
		animation = aggressive_dagger
	}
	right_portrait = {
		character = scope:spouse_2
		animation = shock
	}
	cooldown = { years = 3 } #so you don't get it again and again

	trigger = {
		exists = scope:activity
		has_variable = bloody_wedding_murder_solo_var
	}
	
	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Feasts/ep2_event_grand_murder_feast"
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		#save scopes for the celebration_spy_character template
		location.faith = {
			save_scope_as = guest_faith
		}
		location.culture = {
			save_scope_as = guest_culture
		}
		hidden_effect = {
			create_character = {
				template = celebration_spy_character
				dynasty = none
				location = root.location
				gender_female_chance = root_soldier_female_chance
				save_scope_as = my_agent
			}
		}
	}

	option = {
		name = ep2_wedding.0203.a
		if = {
			limit = { scope:spouse_2 = { is_ai = no } }
			scope:spouse_2 = { trigger_event = ep2_wedding.0204 }
		}
		else = {
			show_as_tooltip = { #we wanna show this
				scope:spouse_2 = {
					death = { death_reason = death_bloody_wedding }
					add_secret = {
						type = secret_murder
						target = scope:spouse_2
					}
				}
			}
			hidden_effect = { #this does the effect
				unknown_murder_effect = {
					VICTIM = scope:spouse_2
					MURDERER = root
					REASON = death_bloody_wedding
				}
			}
			create_character_memory = {
				type = grand_wedding_solo_kill
				participants = {
					spouse_1 = scope:spouse_1
					spouse_2 = scope:spouse_2
				}
			}
		}
	}
	
	after = {
		if = {
			limit = { is_ai = yes }
			scope:my_agent = { silent_disappearance_effect = yes }
		}
		hidden_effect = {
			scope:activity = { progress_activity_phase_after = { days = 1 } }
		}
	}
}

# ON START WNIGHT - MASSACRE - BLOODY WEDDING - WEDDING NIGHT KILL

ep2_wedding.3060 = {
	type = activity_event
	title = ep2_wedding.3060.t
	desc = ep2_wedding.3060.desc
	theme = wedding_night_activity
	left_portrait = {
		character = root
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:spouse_2
		animation = flirtation
	}
	
	cooldown = { years = 3 }

	immediate = {
		play_sound_effect = "event:/DLC/EP2/SFX/Events/Grand_Activities/Feasts/ep2_event_grand_murder_feast"
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
	}

	#Go for it
	option = {
		name = ep2_wedding.3060.a
		duel = {
			skill = prowess
			target = scope:spouse_2
			65 = { #you kill them
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep2_wedding.3060.a.success
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.a.success
					unknown_murder_effect = {
						VICTIM = scope:spouse_2
						MURDERER = root
						REASON = death_mysterious
					}
				}
				create_character_memory = {
					type = grand_wedding_solo_kill
					participants = {
						spouse_1 = scope:spouse_1
						spouse_2 = scope:spouse_2
					}
				}
				give_nickname = nick_the_just_widowed
			}
			35 = { #they survive
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep2_wedding.3060.a.failure
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.a.failure
					scope:spouse_2 = {
						add_opinion = {
							target = root
							modifier = suspicion_opinion
							opinion = -50
						}
					}
				}
				set_variable = bloody_murder_fail
			}
		}
		stress_impact = {
			calm = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0 
				OR = {
					has_trait = craven
					has_trait = compassionate
					has_trait = calm
				}
			}
		}
	}
	
	#Offer some drink (poisoned)
	option = {
		name = ep2_wedding.3060.b
		trigger = {
			OR = {
				has_trait = lifestyle_herbalist
				has_trait = witch
				has_trait = lifestyle_physician
				has_trait = whole_of_body
				has_trait = lifestyle_gardener
				has_trait = schemer
			}
		}
		duel = {
			skill = intrigue
			target = scope:spouse_2
			80 = { #you kill them
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep2_wedding.3060.b.success
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.b.success
					unknown_murder_effect = {
						VICTIM = scope:spouse_2
						MURDERER = root
						REASON = death_mysterious
					}
				}
				create_character_memory = {
					type = grand_wedding_solo_kill
					participants = {
						spouse_1 = scope:spouse_1
						spouse_2 = scope:spouse_2
					}
				}
				give_nickname = nick_the_just_widowed
			}
			20 = { #they survive
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep2_wedding.3060.b.failure
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.b.failure
					scope:spouse_2 = {
						add_opinion = {
							target = root
							modifier = suspicion_opinion
							opinion = -50
						}
					}
				}
				set_variable = bloody_murder_fail
			}
		}
		stress_impact = {
			impatient = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0 
				OR = {
					has_trait = impatient
					has_trait = wrathful
					has_trait = compassionate
				}
			}
		}
	}
	
	#Cut their throat
	option = {
		name = ep2_wedding.3060.c
		flavor = ep2_wedding.3060.c.flavor
		trigger = {
			OR = {
				has_trait = lifestyle_hunter
				has_trait = torturer
				has_trait = lifestyle_blademaster
				has_trait = kinslayer
				has_trait = aggressive_attacker
				has_trait = murderer
				has_trait = wrathful
				has_trait = deceitful
				has_trait = sadistic
				has_trait = callous
			}
		}
		duel = {
			skills = { prowess intrigue }
			target = scope:spouse_2
			80 = { #you kill them
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = ep2_wedding.3060.c.success
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.c.success
					unknown_murder_effect = {
						VICTIM = scope:spouse_2
						MURDERER = root
						REASON = death_mysterious
					}
				}
				create_character_memory = {
					type = grand_wedding_solo_kill
					participants = {
						spouse_1 = scope:spouse_1
						spouse_2 = scope:spouse_2
					}
				}
				give_nickname = nick_the_just_widowed
			}
			20 = { #they survive
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = ep2_wedding.3060.c.failure
				send_interface_toast = {
					left_icon = scope:spouse_2
					title = ep2_wedding.3060.c.failure
					scope:spouse_2 = {
						add_opinion = {
							target = root
							modifier = suspicion_opinion
							opinion = -50
						}
					}
				}
				set_variable = bloody_murder_fail
			}
		}
		stress_impact = {
			compassionate = medium_stress_impact_gain
			craven = medium_stress_impact_gain
			calm = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0 
				OR = {
					has_trait = compassionate
					has_trait = craven
					has_trait = calm
				}
			}
		}
	}
	
	#I actually like this person
	option = {
		name = ep2_wedding.3060.d
		if = {
			limit = {
				scope:spouse_2 = { has_any_fertility_relationship_with_root_trigger = no }
			}
			set_relation_wedding_good_fertility = scope:spouse_2
		}
		progress_towards_lover_effect = {
			CHARACTER = scope:spouse_2
			REASON = lover_romantic_wedding_night
			OPINION = 20
		}
		had_sex_with_effect = {
			CHARACTER = scope:spouse_2
			PREGNANCY_CHANCE = pregnancy_chance
		}
		set_variable = {
			name = bloody_wedding_backed_down_var
			years = 1
		}
		stress_impact = {
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			wrathful = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				factor = 0 
				OR = {
					has_trait = callous
					has_trait = sadistic
					has_trait = wrathful
				}
			}
		}
	}
	
	after = {
		hidden_effect = {
			scope:activity = { progress_activity_phase_after = { days = 1 } }
		}
		remove_character_flag = is_naked
		scope:spouse_2 = {
			remove_character_flag = is_naked
		}
	}
}

# ON START WNIGHT - THE CLEANING UP - BLOODY WEDDING - HOST
ep2_wedding.0301 = {
	type = activity_event
	title = ep2_wedding.0301.t
	desc = {
		first_valid = {
			triggered_desc = { #Your mercenaries killed everyone
				trigger = {
					has_variable = bloody_wedding_murder_family_var
				}
				desc = ep2_wedding.0301.desc.family
			}
			triggered_desc = { #Agent killed the spouse
				trigger = {
					has_variable = bloody_wedding_murder_solo_var
				}
				desc = ep2_wedding.0301.desc.agent
			}
			triggered_desc = { #Spouse died during the wedding night
				trigger = {
					has_variable = bloody_wedding_murder_spouse_var
				}
				desc = ep2_wedding.0301.desc.wedding_night
			}
		}
		first_valid = {
			triggered_desc = { #You're the spouse - wedding night kill
				trigger = {
					scope:spouse_1 = root 
					has_variable = bloody_wedding_murder_spouse_var
				}
				desc = ep2_wedding.0301.spouse_wnight
			}
			triggered_desc = { #You're the spouse
				trigger = {
					scope:spouse_1 = root 
				}
				desc = ep2_wedding.0301.spouse 
			}
			desc = ep2_wedding.0301.non_spouse #you're not the spouse
		}
	}
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				this = scope:spouse_1
			}
			animation = grief
		}
		animation = schadenfreude
	}
	center_portrait = {
		trigger = { exists = scope:shocked_guest }
		character = scope:shocked_guest
		animation = shock
	}
	right_portrait = {
		trigger = {
			root != scope:spouse_1
		}
		character = scope:spouse_1
		animation = grief
	}
	lower_right_portrait = scope:spouse_2
	cooldown = { years = 3 }

	trigger = {
		exists = scope:activity
	}

	immediate = {
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						is_alive = yes
						is_adult = yes
						this != scope:activity.special_guest:spouse_1
						this != scope:spouse_2
						this != scope:host
					}
				}
			}
			scope:activity = {
				random_attending_character = {
					limit = {
						is_alive = yes
						is_adult = yes
						this != scope:activity.special_guest:spouse_1
						this != scope:host
					}
					weight = {
						base = 1
						modifier = {
							add = -5
							is_close_family_or_spouse_of_root_trigger = yes
						}
						modifier = {
							add = 2
							is_close_or_extended_family_of = scope:spouse_2
						}
					}
					save_scope_as = shocked_guest
				}
			}
		}
	}

	option = { #What a tragedy!
		name = ep2_wedding.0301.a
		scope:spouse_1 = {
			remove_character_modifier = wedding_fertility_delay_modifier
		}
	}
	
	after = {
		if = {
			limit = {
				this = scope:host
			}
			scope:host = {
				save_scope_as = root_scope
				trigger_event = ep2_wedding.0955
			}
		}
		scope:activity = {
			every_attending_character = {
				limit = {
					this != scope:host
					this != scope:spouse_1
				}
				trigger_event = ep2_wedding.0956
			}
		}
	}
}

# ON START - THE CLEANING UP - BLOODY WEDDING - SURVIVORS / this is the event where the guests realize it's a bloody wedding
ep2_wedding.0302 = {
	type = activity_event
	title = ep2_wedding.0302.t
	desc = {
		first_valid = {
			triggered_desc = { #Host killed everyone
				trigger = {
					scope:host = { has_variable = bloody_wedding_murder_family_var }
				}
				desc = ep2_wedding.0302.desc.family
			}
			triggered_desc = { #Agent killed the spouse
				trigger = {
					scope:host = { has_variable = bloody_wedding_murder_solo_var }
				}
				desc = ep2_wedding.0302.desc.agent
			}
			triggered_desc = { #Spouse died during the wedding night
				trigger = {
					scope:host = { has_variable = bloody_wedding_murder_spouse_var }
				}
				desc = ep2_wedding.0302.desc.wedding_night
			}
		}
		first_valid = {
			triggered_desc = { #Spouse!
				trigger = {
					this = scope:spouse_1
				}
				desc = ep2_wedding.0302.spouse 
			}
			triggered_desc = { #Good relationship
				trigger = {
					has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
				}
				desc = ep2_wedding.0302.good 
			}
			triggered_desc = { #Bad relationship
				trigger = {
					has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
				}
				desc = ep2_wedding.0302.bad 
			}
			triggered_desc = { #You admire the hustle
				trigger = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = torturer
						has_trait = vengeful
					}
				}
				desc = ep2_wedding.0302.sadistic 
			}
			desc = ep2_wedding.0302.indifferent
		}
	}
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:spouse_1
		animation = grief
	}
	lower_center_portrait = scope:spouse_2
	cooldown = { years = 3 }
	override_sound = { reference = "event:/SFX/Events/Themes/sfx_event_theme_type_intrigue" }

	trigger = {
		exists = scope:activity
	}

	immediate = {
		play_music_cue = mx_cue_murder
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		if = {
			limit = {
				scope:host = { has_variable = bloody_wedding_murder_family_var }
			}
			show_as_tooltip = {
				scope:activity = {
					every_attending_character = {
						limit = {
							OR = {
								is_close_or_extended_family_of = scope:spouse_2
								this = scope:spouse_2
							}
						}
						custom = every_attending_relative_of_spouse_2
						death = {
							death_reason = death_bloody_wedding
						}
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:host = {
					OR = {
						has_variable = bloody_wedding_murder_solo_var
						has_variable = bloody_wedding_murder_spouse_var
					}
				}
			}
			show_as_tooltip = {
				scope:spouse_2 = {
					death = {
						death_reason = death_bloody_wedding
					}
				}
			}
		}			
	}

	option = {
		name = ep2_wedding.0302.a
	}
}

# CONCLUSION - BLOODY WEDDING - HOST
ep2_wedding.0955 = {
	type = activity_event
	title = ep2_wedding.0955.t
	desc = {
		desc = ep2_wedding.0955.desc.intro
		first_valid = {
			triggered_desc = { #failed - you're spouses
				trigger = {
					has_variable = bloody_murder_fail
				}
				desc = ep2_wedding.0955.desc.failed
			}
			desc = ep2_wedding.0955.desc.murder
		}
		first_valid = {
			triggered_desc = { #Good relationship
				trigger = {
					has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
					NOT = { has_variable = bloody_murder_fail }
				}
				desc = ep2_wedding.0955.good 
			}
			triggered_desc = { #Bad relationship
				trigger = {
					has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
					NOT = { has_variable = bloody_murder_fail }
				}
				desc = ep2_wedding.0955.bad 
			}
			triggered_desc = { #Rejoice
				trigger = {
					OR = {
						has_trait = sadistic
						has_trait = callous
						has_trait = torturer
						has_trait = vengeful
					}
					NOT = { has_variable = bloody_murder_fail }
				}
				desc = ep2_wedding.0955.sadistic 
			}
			triggered_desc = { #Repent, kinda
				trigger = {
					OR = {
						has_trait = compassionate
						has_trait = forgiving
						has_trait = just
						has_trait = trusting
					}
					NOT = { has_variable = bloody_murder_fail }
				}
				desc = ep2_wedding.0955.compassionate 
			}
			triggered_desc = { #Meh
				trigger = { NOT = { has_variable = bloody_murder_fail } }
				desc = ep2_wedding.0955.indifferent
			}
		}
	}
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = { has_variable = bloody_murder_fail }
			animation = anger
		}
		animation = schadenfreude
	}
	right_portrait ={
		trigger = { scope:spouse_2 = { is_alive = yes } }
		character = scope:spouse_2
		animation = schadenfreude
	}
	cooldown = { years = 3 }

	immediate = {
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
	}

	option = {
		name = {
			trigger = { has_variable = bloody_murder_fail }
			text = ep2_wedding.0955.a.failure
		}
		name = {
			trigger = { NOT = { has_variable = bloody_murder_fail } }
			text = ep2_wedding.0955.a 
		}
		show_as_tooltip = {
			disburse_murder_wedding_host_rewards = yes
		}
		#Stress rewards
		stress_impact = {
			paranoid = massive_stress_impact_loss
			callous = massive_stress_impact_loss
			sadistic = massive_stress_impact_loss
			compassionate = massive_stress_impact_gain
			just = massive_stress_impact_gain
			calm = major_stress_impact_gain
		}
		
		hidden_effect = {
			if = { #if you haven't failed
				limit = {
					NOT = { has_variable = bloody_murder_fail }
				}
				trigger_event = { #cleans up the variables with enough delay for the guest events
					id = ep2_wedding.0958
					days = 7
				}
				if = { #if they have a parent they always send the letter unless they're too nice
					limit = {
						scope:activity.var:spouse_2_var = {
							any_parent = {
								is_available_ai_adult = yes
							}
						}
					}
					scope:activity.var:spouse_2_var = {
						random_parent = {
							limit = {
								is_available_ai_adult = yes
							}
							save_scope_as = avenging_family
						}
					}
					random = {
						chance = 100
						modifier = {
							add = -25
							OR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = calm
							}
						}
						modifier = {
							add = -25
							has_any_good_relationship_with_root_trigger = yes
						}
						modifier = {
							add = 25
							has_any_bad_relationship_with_root_trigger = yes
						}
						trigger_event = {
							id = ep2_wedding.0957
							days = 14
						}
					}
				}
				else_if = { #if they have a close family member it's a random chance
					limit = {
						scope:activity.var:spouse_2_var = {
							any_close_family_member = {
								is_available_ai_adult = yes
								NOT = { is_parent_of = scope:activity.var:spouse_2_var }
							}
						}
					}
					scope:activity.var:spouse_2_var = {
						random_close_family_member = {
							limit = {
								is_available_ai_adult = yes
								NOT = { is_parent_of = scope:activity.var:spouse_2_var }
							}
							save_scope_as = avenging_family
						}
					}
					random = {
						chance = 50
						modifier = {
							add = 25
							OR = {
								has_trait = vengeful
								has_trait = wrathful
								has_trait = callous
							}
						}
						modifier = {
							add = 25
							has_any_bad_relationship_with_root_trigger = yes
						}
						modifier = {
							add = -25
							OR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = calm
							}
						}
						modifier = {
							add = -25
							has_any_good_relationship_with_root_trigger = yes
						}
						trigger_event = {
							id = ep2_wedding.0957
							days = 14
						}
					}
				}
				else_if = { #if they have an extended family member it's a a bit errr
					limit = {
						scope:activity.var:spouse_2_var = {
							any_close_or_extended_family_member = {
								is_available_ai_adult = yes
								NOT = { is_close_family_of = scope:activity.var:spouse_2_var }
							}
						}
					}
					scope:activity.var:spouse_2_var = {
						random_close_or_extended_family_member = {
							limit = {
								is_available_ai_adult = yes
								NOT = { is_close_family_of = scope:activity.var:spouse_2_var }
							}
							save_scope_as = avenging_family
						}
					}
					random = {
						chance = 20
						modifier = {
							add = 25
							OR = {
								has_trait = vengeful
								has_trait = wrathful
								has_trait = callous
							}
						}
						modifier = {
							add = 25
							has_any_bad_relationship_with_root_trigger = yes
						}
						modifier = {
							add = -25
							OR = {
								has_trait = compassionate
								has_trait = forgiving
								has_trait = calm
							}
						}
						modifier = {
							add = -25
							has_any_good_relationship_with_root_trigger = yes
						}
						trigger_event = {
							id = ep2_wedding.0957
							days = 14
						}
					}
				}
			}
		}
	}
}

ep2_wedding.0958 = { #variable clean up - done in an event so they persist for the guests
	hidden = yes
	immediate = {
		remove_variable ?= bloody_wedding_murder_family_var
		remove_variable ?= bloody_wedding_murder_solo_var
		remove_variable ?= bloody_wedding_murder_spouse_var
	}
}

# CONCLUSION - BLOODY WEDDING - SURVIVOR
ep2_wedding.0956 = {
	type = activity_event
	title = ep2_wedding.0956.t
	desc = ep2_wedding.0956.desc
	theme = bloody_wedding_banquet
	left_portrait = {
		character = root
		triggered_animation = {
			trigger = {
				has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
			}
			animation = schadenfreude
		}
		animation = sadness
	}
	lower_right_portrait = scope:host
	cooldown = { years = 3 }
	
	immediate = {
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
	}

	option = {
		name = {
			trigger = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 }
			}
			text = ep2_wedding.0956.a.good
		}
		name = {
			trigger = {
				NOT = { has_any_good_relationship_with_character_trigger = { CHARACTER = scope:spouse_2 } }
			}
			text = ep2_wedding.0956.a
		}
		if = {
			limit = {
				OR = {
					has_trait = torturer
					has_trait = sadistic
					has_trait = vengeful
					has_trait = callous
				}
			}
			show_as_tooltip = { #handed out to the host in their event
				add_opinion = {
					modifier = respect_opinion
					target = scope:host
					opinion = 20
				}
			}
		}
		else = {
			show_as_tooltip = {
				add_opinion = {
					modifier = suspicion_opinion
					target = scope:host
					opinion = -25
				}
			}
		}
		add_prestige = medium_prestige_gain
		create_character_memory = {
			type = grand_wedding_massacre_guest
			participants = {
				spouse_1 = scope:spouse_1
				spouse_2 = scope:spouse_2
			}
		}
		stress_impact = {
			torturer = major_stress_impact_loss
			sadistic = major_stress_impact_loss
			callous = major_stress_impact_loss
			vengeful = major_stress_impact_loss
			paranoid = medium_stress_impact_gain
		}
	}
}

### PLAYER ONLY EVENTS ###

# MASSACRE - SOMEONE IS TRYING TO KILL YOU
ep2_wedding.0204 = {
	type = activity_event
	title = ep2_wedding.0204.t
	desc = {
		desc = ep2_wedding.0204.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = {
					#you only get this event if the host chose family kill
					this != scope:spouse_2
				}
				desc = ep2_wedding.0204.desc.family.non_spouse
			}
			#we assume you're the spouse otherwise
			triggered_desc = {
				trigger = {
					scope:host = { has_variable = bloody_wedding_murder_family_var }
				}
				desc = ep2_wedding.0204.desc.family
			}
			triggered_desc = {
				trigger = {
					scope:host = { has_variable = bloody_wedding_murder_solo_var }
				}
				desc = ep2_wedding.0204.desc.solo
			}
		}
	}
	theme = bloody_wedding_banquet
	left_portrait = {
		character = scope:mercenary_1
		animation = aggressive_axe
	}
	center_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:mercenary_2
		animation = aggressive_sword
	}
	lower_center_portrait = {
		trigger = {
			root != scope:spouse_2
			NOT = { scope:host = { has_variable = bloody_wedding_murder_solo_var } }
		}
		character = scope:spouse_2
	}
	lower_right_portrait = {
		trigger = {
			exists = scope:entourage_1
			root != scope:entourage_1
			NOT = { scope:host = { has_variable = bloody_wedding_murder_solo_var } }
		}
		character = scope:entourage_1
	}
	lower_left_portrait = {
		trigger = {
			exists = scope:entourage_2
			root != scope:entourage_2
			NOT = { scope:host = { has_variable = bloody_wedding_murder_solo_var } }
		}
		character = scope:entourage_2
	}
	cooldown = { years = 3 }
	
	immediate = {
		play_music_cue = mx_cue_murder
		scope:activity.special_guest:spouse_1 = { save_scope_as = spouse_1 }
		scope:activity.var:spouse_2_var = { save_scope_as = spouse_2 }
		save_scope_as = murder_victim
		hidden_effect = {
			create_character = {
				template = mercenary
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				save_scope_as = mercenary_1
			}
			create_character = {
				template = mercenary
				dynasty = none
				location = root.location
				culture = root.location.culture
				faith = root.location.faith
				gender_female_chance = root_soldier_female_chance
				save_scope_as = mercenary_2
			}
		}
	}

	option = { #Skill duel to get out
		name = ep2_wedding.0204.a
		duel = {
			skill = prowess
			value = medium_skill_rating
			# Die, unfortunately
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				min = 5
				desc = ep2_wedding.0204.a.tt.failure
				#no need for your own toast if you die
				scope:host = {
					send_interface_toast = {
						title = ep2_wedding.0204.a.tt.success.host #these are flipped in loc
						right_icon = scope:murder_victim
						scope:murder_victim = {
							death = {
								death_reason = death_bloody_wedding
							}
						}
					}
				}
			}
			# Save yourself
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				min = 5
				desc = ep2_wedding.0204.a.tt.success
				send_interface_toast = {
					title = ep2_wedding.0204.a.tt.success
					left_icon = scope:murder_victim
				}
				scope:host = {
					send_interface_toast = {
						title = ep2_wedding.0204.a.tt.failure.host
						right_icon = scope:murder_victim
						if = {
							limit = { root = scope:spouse_2 }
							set_variable = bloody_murder_fail
						}
					}
				}
				if = {
					limit = { root = scope:spouse_2 }
					create_character_memory = {
						type = grand_wedding_massacre_spouse_survivor
						participants = {
							host = scope:host
							spouse_1 = scope:spouse_1
							spouse_2 = scope:spouse_2
						}
					}
				}
				else = {
					create_character_memory = {
						type = grand_wedding_massacre_survivor
						participants = {
							host = scope:host
							spouse_1 = scope:spouse_1
							spouse_2 = scope:spouse_2
						}
					}
				}
			}
		}
		if = {
			limit = {
				scope:spouse_2 ?= { is_ai = yes }
			}
			custom_tooltip = {
				text = ep2_wedding.0204.a.spouse_2_murder.tt
				unknown_murder_effect = {
					VICTIM = scope:spouse_2
					MURDERER = scope:host
					REASON = death_bloody_wedding
				}
			}
		}
		if = {
			limit = {
				scope:activity = {
					any_attending_character = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						is_ai = yes
						this != root
					}
				}
			}
			scope:activity = {
				every_attending_character = {
					limit = {
						ep2_wedding_0202_valid_family_member_trigger = yes
						is_ai = yes
						this != root
					}
					custom = every_attending_relative_of_spouse_2
					death = {
						death_reason = death_bloody_wedding
					}
				}
			}
		}	
	}
}

# Bloody Wedding follow up event

ep2_wedding.0957 = {
	type = letter_event
	opening = {
		desc = ep2_wedding.0957.opening
	}
	desc = {
		first_valid = {
			triggered_desc = { 
				trigger = { scope:avenging_family = { is_parent_of = scope:spouse_2 } }
				desc = ep2_wedding.0957.desc.parent
			}
			desc = ep2_wedding.0957.desc
		}
	}
	sender = scope:avenging_family

	option = {
		name = ep2_wedding.0957.a
		if = {
			limit = {
				#DLC check
				has_bp1_dlc_trigger = yes
				scope:avenging_family.house.house_head = {
					valid_for_feud_events_with_target_trigger = { TARGET = root }
				}
			}
			scope:avenging_family = {
				house_feud_start_effect = {
					# Feuding House Head
					ACTOR = scope:avenging_family
					# Target House Head
					TARGET = root
					# Feud Reason
					REASON = bloody_wedding
					# House Member attacker if relevant, otherwise same as ACTOR 
					ATTACKER = scope:avenging_family
					# House Member victim if relevant, otherwise same as TARGET 
					VICTIM = scope:spouse_2
				}
			}
		}
		scope:spouse_2 = {
			every_close_family_member = {
				custom = ep2_wedding.0957.a.tt
				limit = {
					is_close_family_or_spouse_of_root_trigger = no
					this != scope:avenging_family
				}
				add_opinion = {
					target = root
					modifier = bloody_wedding_family_opinion
				}
			}
		}
		add_prestige = minor_prestige_loss
	}
}
