﻿namespace = feast_default_laurence
#Bitter rebelious fellow vassal wants to murder your liege at your feast
feast_default_laurence.100 = { 
	type = activity_event
	title = feast_default_laurence.100.t
	desc = feast_default_laurence.100.desc

	theme = feast_activity

	override_background = { reference = corridor_night }

	left_portrait = {
		character = root
		animation = personality_dishonorable 
		camera = camera_event_very_left	
	}
	center_portrait = {
		character = scope:conspiratorial_fellow
		#animation = marshal_dagger
		animation = marshal
		camera = camera_event_left_forward
	}
	right_portrait = {
		character = scope:intent_target
		animation = wedding_drunk
		camera = camera_event_right_away
	}
	cooldown = { years = 10 }
	trigger = {
		# Correct intent for vibes time.
		has_activity_intent = murder_attendee_intent
		# Some extra cautious validity checks.
		intent_target ?= {
			is_alive = yes
		}
		liege = intent_target
		#Someone who has been in a war with our liege and therefore has a grudge
		scope:activity = {
			any_attending_character = { 
				this != root
				is_ai = yes
				any_memory = {
					OR = {
						has_memory_type = offensive_war 
						has_memory_type = defensive_war
					}
					any_memory_participant = {
						this = root.intent_target 
					}
				}
			}
		}
	}
	immediate = {
		save_scope_as = feast_host   
		scope:activity = {
			random_attending_character = {
				limit = {
					this != root
					is_ai = yes
					any_memory = {
						OR = {
							has_memory_type = offensive_war 
							has_memory_type = defensive_war
						}
						any_memory_participant = {
							this = root.intent_target 
						}
					}
				}
				save_scope_as = conspiratorial_fellow
				random_memory = {
					limit = {
						OR = {
							has_memory_type = offensive_war 
							has_memory_type = defensive_war
						}
						any_memory_participant = {
							this = root.intent_target 
						}
					}
					save_scope_as = war_memory
				}
			}
		}
		intent_target = {
			save_scope_as = intent_target
		}
	}
	# You agree to turn a blind eye to his murder attempt on your liege
	option = {
		name = feast_default_laurence.100.a
		scope:conspiratorial_fellow = {
			duel = {
				skill = intrigue 
				value = scope:intent_target.intrigue

				30 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -39
					}
					min = 5
					desc = feast_default_laurence.100.a.tt.success
					scope:intent_target = {
						trigger_event = feast_default_laurence.101
					} 
					show_as_tooltip = {
						scope:conspiratorial_fellow = {
							unknown_murder_effect = {
								VICTIM = scope:intent_target
								MURDERER = scope:conspiratorial_fellow 
								REASON = death_murder
							}
							add_trait = murderer 
						}
					}					
				}
				70 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = 3.5
						min = -39
					}
					min = 10
					desc = feast_default_laurence.100.a.tt.failure
					root = { 
						send_interface_toast = {
							type = event_intrigue_bad 
							title = feast_default_laurence.100.a.tt.failure
							left_icon = scope:intent_target
							scope:conspiratorial_fellow = {
								add_prestige = medium_prestige_loss
								add_secret = {
									type = secret_murder_attempt
									target = scope:intent_target
								}
								reverse_add_opinion = {
									target = scope:intent_target
									modifier = suspicion_opinion
									opinion = -60
								}
							}
						}
					}
				}
			}
		}
		stress_impact = {
			brave = minor_stress_impact_loss
			wrathful = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
			content = medium_stress_impact_gain
			calm = minor_stress_impact_gain
			craven = miniscule_stress_impact_gain	
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = craven
				factor = 0
			}
			modifier = {
				has_trait = brave
				factor = 2
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 2
			}
			modifier = {
				has_trait = content
				factor = 0
			}
			modifier = {
				has_trait = ambitious
				factor = 2
			}
		}
	}
	# Simply gather information on HerHis habits and ticks.
	option = {
		name = feast_default_laurence.100.b

		# Do we already have a scheme against them? If so, add the modifier immediately.
		if = {
			limit = {
				any_scheme = { 
					scheme_type = murder
					scheme_target_character = scope:intent_target 
				}
			}
			random_scheme = {
				limit = { 
					scheme_type = murder
					scheme_target_character = scope:intent_target
				}
				add_scheme_modifier = { type = feast_learnt_habits_modifier }
			}
		}
		# Otherwise, note that we notify them that they'll gain a bonus to murdering this character if they start in the next X years.
		else = {
			# If we've already got someone logged for this, warn that we'll overwrite them.
			if = {
				limit = { has_variable = feast_events_ewan_0001_bonus_value }
				custom_tooltip = feast_events_ewan.0001.e.tt.bonus_to_murder_scheme.overwrite
			}
			# Set the variable.
			set_variable = {
				name = feast_events_ewan_0001_bonus_value
				value = scope:intent_target
				years = feast_events_ewan_0001_murder_scheme_bonus_time_to_use_value
			}
			# Inform the player.
			custom_tooltip = feast_events_ewan.0001.e.tt.bonus_to_murder_scheme
		}
		stress_impact = {
			craven = miniscule_stress_impact_loss			
			wrathful = medium_stress_impact_loss			
			ambitious = medium_stress_impact_loss
			content = medium_stress_impact_gain
			brave = minor_stress_impact_gain
			calm = minor_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = brave
				factor = 0
			}
			modifier = {
				has_trait = craven
				factor = 2
			}
			modifier = {
				has_trait = calm
				factor = 0
			}
			modifier = {
				has_trait = wrathful
				factor = 2
			}
			modifier = {
				has_trait = content
				factor = 0
			}
			modifier = {
				has_trait = ambitious
				factor = 2
			}
		}
	}
	#Threaten conspiratorial_fellow and get hook
	option = {
		name = feast_default_laurence.100.c
		if = {
			limit = {
				can_add_hook = {
					target = scope:conspiratorial_fellow
					type = suspicious_activity_hook
				}
			}
			add_hook = {
				type = suspicious_activity_hook
				target = scope:conspiratorial_fellow
			}
			add_intrigue_lifestyle_xp = minor_lifestyle_xp
		}
		else = {
			add_intrigue_lifestyle_xp = major_lifestyle_xp
		}
		stress_impact = {
			paranoid = medium_stress_impact_loss
			vengeful = minor_stress_impact_loss
			deceitful = medium_stress_impact_loss
			forgiving = miniscule_stress_impact_gain
			honest = minor_stress_impact_gain
			trusting = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = forgiving
				factor = 0
			}
			modifier = {
				has_trait = vengeful
				factor = 2
			}
			modifier = {
				has_trait = honest
				factor = 0
			}
			modifier = {
				has_trait = deceitful
				factor = 2
			}
			modifier = {
				has_trait = trusting
				factor = 0
			}
			modifier = {
				has_trait = paranoid
				factor = 2
			}
		}
	}
}
#You were killed by a vassal at another vassal's murder intent feast
feast_default_laurence.101 = {
	type = activity_event
	title = feast_default_laurence.100.t
	desc = feast_default_laurence.101.desc

	theme = feast_activity

	left_portrait = {
		character = scope:intent_target
		animation = sick_stomach 
		camera = camera_event_very_left
		
	}
	right_portrait = {
		character = scope:feast_host
		animation = wedding_drunk
		camera = camera_event_right_away
	}
	option = {
		name = feast_default_laurence.101.a
		scope:conspiratorial_fellow = {
			unknown_murder_effect = {
				VICTIM = scope:intent_target
				MURDERER = scope:conspiratorial_fellow 
				REASON = death_murder
			}
			add_trait = murderer 
		}
		scope:feast_host = {
			trigger_event = feast_default_laurence.102
		}
	}
}
#Your guest succeeded at murdering your liege
feast_default_laurence.102 = {

	type = activity_event
	title = feast_default_laurence.100.t
	desc = feast_default_laurence.102.desc

	theme = feast_activity

	left_portrait = {
		character = scope:feast_host
		animation = personality_dishonorable 
		camera = camera_event_very_left
		
	}
	center_portrait = {
		character = scope:intent_target
		animation = sick_stomach 
		camera = camera_event_very_left_activity
		
	}
	right_portrait = {
		character = scope:conspiratorial_fellow
		animation = sword_coup_degrace
		camera = camera_event_right_away
	}
	#Befriend murderer but gain murder trait!
	option = { 
		name = feast_default_laurence.102.a
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		set_relation_friend = { 
			reason = friend_bonded_over_sins
			target = scope:conspiratorial_fellow
		}
		reverse_add_opinion = {
			target = scope:conspiratorial_fellow
			modifier = befriended_opinion
			opinion = 50
		}
		scope:feast_host = {
			add_trait = murderer 
		}
		stress_impact = {
			gregarious = medium_stress_impact_loss
			trusting = medium_stress_impact_loss
			shy = minor_stress_impact_gain
			paranoid = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = shy
				factor = 0
			}
			modifier = {
				has_trait = gregarious
				factor = 2
			}
			modifier = {
				has_trait = paranoid
				factor = 0
			}
			modifier = {
				has_trait = trusting
				factor = 2
			}
		}				
	}
	#Attempt to imprison him for his crime
	option = { 
		name = feast_default_laurence.102.b
		flavor = feast_default_laurence.102.b.flavor
		duel = {
			skill = intrigue 
			value = scope:conspiratorial_fellow.intrigue
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				min = 10
				send_interface_toast = {
					type = event_intrigue_good 
					title = feast_default_laurence.102.b.tt.success
					left_icon = scope:conspiratorial_fellow						
					rightfully_imprison_character_effect = {
						TARGET = scope:conspiratorial_fellow
						IMPRISONER = scope:feast_host 
					}
					add_intrigue_lifestyle_xp = medium_lifestyle_xp	
					reverse_add_opinion = {
						target = scope:conspiratorial_fellow
						modifier = betrayed_me_opinion
						opinion = -80
					}				
				}
			}
			70 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -39
				}
				min = 5	
				send_interface_toast = {
					type = event_intrigue_bad 
					title = feast_default_laurence.102.b.tt.fail
					left_icon = scope:conspiratorial_fellow	
					reverse_add_opinion = {
						target = scope:conspiratorial_fellow
						modifier = betrayed_me_opinion
						opinion = -30
					}					
				}
				desc = feast_default_laurence.102.b.tt.fail	
			}
		}	
		stress_impact = {
			deceitful = medium_stress_impact_loss
			paranoid = medium_stress_impact_loss
			arbitrary = minor_stress_impact_loss
			honest = medium_stress_impact_gain
			trusting = medium_stress_impact_gain
			just = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = deceitful
				factor = 2
			}
			modifier = {
				has_trait = honest
				factor = 0
			}
			modifier = {
				has_trait = paranoid
				factor = 2
			}
			modifier = {
				has_trait = trusting
				factor = 0
			}
			modifier = {
				has_trait = arbitrary
				factor = 2
			}
			modifier = {
				has_trait = just
				factor = 0
			}
		}
	}
}	
