﻿namespace = humiliation_events

##############################
# 001: Whipping Proxy - The Proxy's Punishment
##############################
humiliation_events.001 = {
	type = character_event
	title = humiliation_events.001.t
	desc = humiliation_events.001.desc
	theme = dungeon
	
	left_portrait = {
		character = root
		animation = schadenfreude
	}
	
	right_portrait = {
		character = scope:whipping_proxy
		animation = pain
	}
	
	trigger = {
		any_court_position_holder = {
			type = whipping_proxy_court_position
			employer = root
			NOT = { has_character_flag = had_whipping_event_recently }
		}
		NOT = { has_character_flag = had_whipping_event_recently }
	}
	
	immediate = {
		random_court_position_holder = {
			type = whipping_proxy_court_position
			employer = root
			save_scope_as = whipping_proxy
			add_character_flag = {
				flag = had_whipping_event_recently
				months = 24
			}
		}
		add_character_flag = {
			flag = had_whipping_event_recently
			months = 24
		}
	}
	
	option = {
		name = humiliation_events.001.a
		custom_tooltip = humiliation_events.001.a.tooltip
		
		stress_impact = {
			vengeful = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = medium_stress_impact_loss
			compassionate = medium_stress_impact_gain
			just = minor_stress_impact_gain
			forgiving = minor_stress_impact_gain
		}
		
		add_dread = minor_dread_gain
		
		scope:whipping_proxy = {
			add_trait = scarred
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
		}
		
		ai_chance = {
			base = 60
			modifier = {
				factor = 2.0
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = vengeful
				}
			}
		}
	}
	
	option = {
		name = humiliation_events.001.b
		custom_tooltip = humiliation_events.001.b.tooltip
		
		stress_impact = {
			compassionate = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
			sadistic = minor_stress_impact_gain
		}
		
		scope:whipping_proxy = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		
		ai_chance = {
			base = 40
			modifier = {
				factor = 2.0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
				}
			}
		}
	}
}

##############################
# 002: Royal Footstool - Humiliation Before the Court
##############################
humiliation_events.002 = {
	type = character_event
	title = humiliation_events.002.t
	desc = humiliation_events.002.desc
	theme = feast
	
	left_portrait = {
		character = root
		animation = throne
	}
	
	right_portrait = {
		character = scope:footstool_proxy
		animation = shame
	}
	
	trigger = {
		any_court_position_holder = {
			type = royal_footstool_court_position
			employer = root
			NOT = { has_character_flag = had_footstool_event_recently }
		}
		is_at_feast = yes
		NOT = { has_character_flag = had_footstool_event_recently }
	}
	
	immediate = {
		random_court_position_holder = {
			type = royal_footstool_court_position
			employer = root
			save_scope_as = footstool_proxy
			add_character_flag = {
				flag = had_footstool_event_recently
				days = 365
			}
		}
		add_character_flag = {
			flag = had_footstool_event_recently
			days = 365
		}
	}
	
	option = {
		name = humiliation_events.002.a
		trait = callous
		custom_tooltip = humiliation_events.002.a.tooltip
		
		stress_impact = {
			arrogant = medium_stress_impact_loss
			vengeful = medium_stress_impact_loss
			sadistic = minor_stress_impact_loss
			humble = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
		}
		
		add_dread = medium_dread_gain
		change_current_court_grandeur = 5
		
		scope:footstool_proxy = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
			add_character_flag = deep_humiliation_memory
		}
		
		ai_chance = {
			base = 60
			modifier = {
				factor = 2.0
				OR = {
					has_trait = arrogant
					has_trait = vengeful
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}
	
	option = {
		name = humiliation_events.002.b
		trait = humble
		custom_tooltip = humiliation_events.002.b.tooltip
		
		stress_impact = {
			humble = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			arrogant = medium_stress_impact_gain
			sadistic = minor_stress_impact_gain
		}
		
		add_dread = -10
		change_current_court_grandeur = -5
		
		every_courtier = {
			limit = {
				OR = {
					has_trait = compassionate
					has_trait = forgiving
					has_trait = just
				}
			}
			add_opinion = {
				target = root
				modifier = merciful_opinion
				opinion = 10
			}
		}
		
		ai_chance = {
			base = 40
			modifier = {
				factor = 2.0
				OR = {
					has_trait = humble
					has_trait = compassionate
					has_trait = just
				}
			}
		}
	}
	
}

##############################
# 003: Bell Ringer - The Sound of Authority
##############################
humiliation_events.003 = {
	type = character_event
	title = humiliation_events.003.t
	desc = humiliation_events.003.desc
	theme = feast
	
	left_portrait = {
		character = root
		animation = personality_bold
	}
	
	right_portrait = {
		character = scope:bell_ringer
		animation = stress
	}
	
	trigger = {
		any_court_position_holder = {
			type = bell_ringer_court_position
			employer = root
			NOT = { has_character_flag = had_bell_event_recently }
		}
		NOT = { has_character_flag = had_bell_event_recently }
	}
	
	mean_time_to_happen = {
		months = 14
		modifier = {
			factor = 0.6
			has_trait = callous
		}
	}
	
	immediate = {
		random_court_position_holder = {
			type = bell_ringer_court_position
			employer = root
			save_scope_as = bell_ringer
			add_character_flag = {
				flag = had_bell_event_recently
				days = 275
			}
		}
		add_character_flag = {
			flag = had_bell_event_recently
			days = 275
		}
	}
	
	option = {
		name = humiliation_events.003.a
		trait = sadistic
		custom_tooltip = humiliation_events.003.a.tooltip
		
		stress_impact = {
			callous = minor_stress_impact_loss
			sadistic = medium_stress_impact_loss
			compassionate = minor_stress_impact_gain
		}
		
		add_dread = minor_dread_gain
		
		scope:bell_ringer = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
		}
		
		ai_chance = {
			base = 50
			modifier = {
				factor = 2.0
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = vengeful
				}
			}
		}
	}
	
	option = {
		name = humiliation_events.003.b
		custom_tooltip = humiliation_events.003.b.tooltip
		
		stress_impact = {
			compassionate = minor_stress_impact_loss
			forgiving = minor_stress_impact_loss
			sadistic = minor_stress_impact_gain
		}
		
		scope:bell_ringer = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 20
			}
		}
		
		ai_chance = {
			base = 35
			modifier = {
				factor = 2.0
				OR = {
					has_trait = compassionate
					has_trait = forgiving
				}
			}
		}
	}
	
}

##############################
# 004: Privy Cleaner - The Lowest Service
##############################
humiliation_events.004 = {
	type = character_event
	title = humiliation_events.004.t
	desc = humiliation_events.004.desc
	theme = feast
	
	left_portrait = {
		character = root
		animation = disgust
	}
	
	right_portrait = {
		character = scope:privy_cleaner
		animation = shame
	}
	
	trigger = {
		any_court_position_holder = {
			type = royal_privy_cleaner_court_position
			employer = root
			NOT = { has_character_flag = had_privy_event_recently }
		}
		NOT = { has_character_flag = had_privy_event_recently }
	}
	
	mean_time_to_happen = {
		months = 10
		modifier = {
			factor = 0.5
			has_trait = sadistic
		}
		modifier = {
			factor = 1.5
			has_trait = compassionate
		}
	}
	
	immediate = {
		random_court_position_holder = {
			type = royal_privy_cleaner_court_position
			employer = root
			save_scope_as = privy_cleaner
			add_character_flag = {
				flag = had_privy_event_recently
				days = 250
			}
		}
		add_character_flag = {
			flag = had_privy_event_recently
			days = 250
		}
	}
	
	option = {
		name = humiliation_events.004.a
		trait = sadistic
		custom_tooltip = humiliation_events.004.a.tooltip
		
		stress_impact = {
			sadistic = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			generous = minor_stress_impact_gain
		}
		
		add_dread = minor_dread_gain
		
		every_courtier = {
			add_opinion = {
				target = root
				modifier = undignified_court_opinion
				opinion = -5
			}
		}
		
		scope:privy_cleaner = {
			add_opinion = {
				target = root
				modifier = cruelty_opinion
				opinion = -20
			}
			add_health = -0.1
		}
		
		ai_chance = {
			base = 40
			modifier = {
				factor = 2.0
				OR = {
					has_trait = sadistic
					has_trait = callous
				}
			}
		}
	}
	
	option = {
		name = humiliation_events.004.b
		trait = temperate
		custom_tooltip = humiliation_events.004.b.tooltip
		
		stress_impact = {
			temperate = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			sadistic = minor_stress_impact_gain
		}
		
		add_dread = -5
		
		every_courtier = {
			add_opinion = {
				target = root
				modifier = dignified_ruler_opinion
				opinion = 5
			}
		}
		
		ai_chance = {
			base = 35
			modifier = {
				factor = 2.0
				OR = {
					has_trait = temperate
					has_trait = compassionate
				}
			}


		}
	}
	
}

##############################
# 005: Privy Cleaner - Public Degradation (Noble Humiliation)
##############################
humiliation_events.005 = {
	type = character_event
	title = humiliation_events.005.t
	desc = humiliation_events.005.desc
	theme = feast
	
	left_portrait = {
		character = root
		animation = personality_bold
	}
	
	right_portrait = {
		character = scope:privy_cleaner
		animation = shame
	}
	
	trigger = {
		any_court_position_holder = {
			type = royal_privy_cleaner_court_position
			employer = root
			NOT = { has_character_flag = had_public_degradation_event_recently }
		}
		NOT = { has_character_flag = had_public_degradation_event_recently }
	}
	
	mean_time_to_happen = {
		months = 16
		modifier = {
			factor = 0.7
			has_trait = arrogant
		}
		modifier = {
			factor = 0.8
			dread >= 50
		}
		modifier = {
			factor = 1.5
			has_trait = compassionate
		}
		modifier = {
			factor = 1.5
			has_trait = forgiving
		}
	}
	
	immediate = {
		random_court_position_holder = {
			type = royal_privy_cleaner_court_position
			employer = root
			save_scope_as = privy_cleaner
			add_character_flag = {
				flag = had_public_degradation_event_recently
				days = 300
			}
		}
		add_character_flag = {
			flag = had_public_degradation_event_recently
			days = 300
		}
	}
	
	# Option A: Continue the Public Degradation
	option = {
		name = humiliation_events.005.a
		trait = callous
		custom_tooltip = humiliation_events.005.a.tooltip
		
		stress_impact = {
			sadistic = medium_stress_impact_loss
			callous = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			humble = minor_stress_impact_gain
			just = minor_stress_impact_gain
		}
		
		add_dread = medium_dread_gain
		
		# Control gain in capital but noble opinion penalty
		capital_county = {
			change_county_control = 5
		}
		
		every_vassal = {
			limit = {
				is_landed = yes
				NOT = { has_trait = sadistic }
			}
			add_opinion = {
				target = root
				modifier = uncomfortable_with_cruelty_opinion
				opinion = -10
			}
		}
		
		scope:privy_cleaner = {
			add_opinion = {
				target = root
				modifier = deep_humiliation_memory
				opinion = -30
			}
		}
		
		ai_chance = {
			base = 50
			modifier = {
				factor = 2.0
				OR = {
					has_trait = sadistic
					has_trait = callous
					has_trait = arrogant
				}
			}
			modifier = {
				factor = 1.5
				dread >= 60
			}
		}
	}
	
	# Option B: End the Public Spectacle
	option = {
		name = humiliation_events.005.b
		custom_tooltip = humiliation_events.005.b.tooltip
		
		stress_impact = {
			just = medium_stress_impact_loss
			temperate = minor_stress_impact_loss
			compassionate = minor_stress_impact_loss
			sadistic = medium_stress_impact_gain
			vengeful = minor_stress_impact_gain
		}
		
		add_dread = -10
		add_legitimacy = minor_legitimacy_gain
		
		every_vassal = {
			limit = {
				is_landed = yes
				OR = {
					has_trait = just
					has_trait = temperate
				}
			}
			add_opinion = {
				target = root
				modifier = respected_opinion
				opinion = 10
			}
		}
		
		scope:privy_cleaner = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 15
			}
		}
		
		ai_chance = {
			base = 35
			modifier = {
				factor = 2.0
				OR = {
					has_trait = just
					has_trait = temperate
					has_trait = compassionate
				}
			}
		}
	}
}