#Events for blackmail

namespace = blackmail


########################
# Blackmail Handling
# 0001-0999
########################

#Character refuses to be blackmailed
blackmail.0001 = {
	type = character_event
	title = blackmail.0001.t
	desc = blackmail.0001.desc
	theme = intrigue
	left_portrait = {
		character = scope:recipient
		animation = dismissal
	}

	trigger = {
		exists = scope:target
		scope:target = { can_be_exposed_by = root }
	}

	immediate = {
		play_music_cue = mx_cue_murder
	}

	after = { remove_variable = currently_blackmailing }

	option = {
		name = blackmail.0001.a
		scope:target = {
			expose_secret = root
		}
	}

	option = {
		name = blackmail.0001.b
		scope:target = {
			disable_exposure_by = root
		}
		ai_chance = {
			factor = 0
		}
	}
}



########################
# Blackmail-related stuff
# 1000-1999
########################

#Blackmailing someone causes Dread
blackmail.1001 = {
	type = character_event
	title = blackmail.1001.t
	desc = blackmail.1001.desc
	theme = intrigue
	left_portrait = {
		character = scope:blackmail_target
		animation = worry
	}
	
	trigger = {
		is_landed = yes
		any_vassal = {
			being_blackmailed_by_root_trigger = yes
		}
		NOT = { has_character_flag = had_event_blackmail_1001 }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		play_music_cue = mx_cue_murder
		add_character_flag = {
			flag = had_event_blackmail_1001
			days = 3650
		}
		random_vassal = {
			limit = {
				root = {
					OR = {
						has_hook_of_type = {
							target = prev
							type = weak_blackmail_hook
						}
						has_hook_of_type = {
							target = prev
							type = strong_blackmail_hook
						}
					}
				}
			}
			save_scope_as = blackmail_target
		}
	}

	option = {
		name = blackmail.1001.a
		add_dread = medium_dread_gain
		stress_impact = {
			compassionate = medium_stress_impact_gain
		}
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_vengefulness = 0.5
			}
		}
	}

	option = { #Assure your vassals no one has anything to fear
		name = blackmail.1001.b
		add_dread = medium_dread_loss
		stress_impact = {
			base = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 2
				ai_honor = 1
			}
		}
	}
}


#Being under Blackmail causes Stress
blackmail.1002 = {
	type = character_event
	title = blackmail.1002.t
	desc = blackmail.1002.desc
	theme = intrigue
	left_portrait = {
		character = scope:blackmailer
		animation = scheme
	}
	
	trigger = {
		NOT = { has_character_flag = had_event_blackmail_1002 }
		OR = {
			any_vassal = {
				OR = {
					has_hook_of_type = {
						target = root
						type = weak_blackmail_hook
					}
					has_hook_of_type = {
						target = root
						type = strong_blackmail_hook
					}
				}
			}
			AND = {
				exists = liege
				is_in_civil_war = no
				liege = {
					OR = {
						has_hook_of_type = {
							target = root
							type = weak_blackmail_hook
						}
						has_hook_of_type = {
							target = root
							type = strong_blackmail_hook
						}
					}
				}
			}
			any_close_or_extended_family_member = {
				OR = {
					has_hook_of_type = {
						target = root
						type = weak_blackmail_hook
					}
					has_hook_of_type = {
						target = root
						type = strong_blackmail_hook
					}
				}
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.5
			has_trait = trusting
		}
	}

	immediate = {
		play_music_cue = mx_cue_murder
		add_character_flag = {
			flag = had_event_blackmail_1002
			days = 3650
		}
		every_vassal = {	
			limit = {
				OR = {
					has_hook_of_type = {
						target = root
						type = weak_blackmail_hook
					}
					has_hook_of_type = {
						target = root
						type = strong_blackmail_hook
					}
				}
			}
			add_to_temporary_list = blackmailers
		}
		liege = {
			if = {
				limit = {
					is_in_civil_war = no
					OR = {
						has_hook_of_type = {
							target = root
							type = weak_blackmail_hook
						}
						has_hook_of_type = {
							target = root
							type = strong_blackmail_hook
						}
					}
				}
				add_to_temporary_list = blackmailers
			}
		}
		every_close_or_extended_family_member = {
			limit = {
				OR = {
					has_hook_of_type = {
						target = root
						type = weak_blackmail_hook
					}
					has_hook_of_type = {
						target = root
						type = strong_blackmail_hook
					}
				}
			}
			add_to_temporary_list = blackmailers
		}
		random_in_list = {
			list = blackmailers
			save_scope_as = blackmailer
		}
	}

	option = {
		name = blackmail.1002.a
		trigger = { NOT = { has_trait = trusting } }
		show_as_unavailable = { always = yes }
		stress_impact = {
			base = medium_stress_gain
			paranoid = minor_stress_impact_gain
		}
		ai_chance = {
			base = 1000
		}
	}

	option = {
		name = blackmail.1002.b
		trigger = {
			has_trait = trusting
		}
		trait = trusting
		stress_impact = {
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 1000
		}
	}
}
