################################################
#
# Imprisoned Events
#
# ID 50000 - 54999 are reserved
#
##################################################
#
# Written by Sara Wendel-rtqvist & Henrik Fhraeus

# A chance to escape!
character_event = {
	id = 50000
	desc = "EVTDESC50000"
	picture = "GFX_evt_into_the_dungeon"
	
	min_age = 14
	capable_only = yes
	prisoner = yes
	
	mean_time_to_happen = {
		months = 120
		
		modifier = {
			factor = 0.25
			has_character_modifier = house_arrest
		}
		modifier = {
			factor = 4
			has_character_modifier = the_oubliette
		}
		modifier = {
			factor = 0.8
			intrigue = 2
		}
		modifier = {
			factor = 0.8
			intrigue = 4
		}
		modifier = {
			factor = 0.8
			intrigue = 6
		}
		modifier = {
			factor = 0.8
			intrigue = 8
		}
		modifier = {
			factor = 0.8
			intrigue = 10
		}
		modifier = {
			factor = 0.8
			intrigue = 12
		}
		modifier = {
			factor = 0.8
			intrigue = 14
		}
		modifier = {
			factor = 0.8
			intrigue = 16
		}
		modifier = {
			factor = 0.8
			intrigue = 18
		}
		modifier = {
			factor = 0.8
			intrigue = 20
		}
		modifier = {
			factor = 0.8
			intrigue = 22
		}
		modifier = {
			factor = 0.8
			intrigue = 24
		}
		modifier = {
			factor = 0.8
			intrigue = 26
		}
		modifier = {
			factor = 0.8
			intrigue = 28
		}
		modifier = {
			factor = 0.8
			intrigue = 30
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 2 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 4 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 6 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 8 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 10 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 12 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 14 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 16 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 18 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 20 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 22 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 24 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 26 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 28 }
		}
		modifier = {
			factor = 1.25
			host = { realm_intrigue = 30 }
		}
	}
	
	option = {
		name = "EVTOPTA50000"
		ai_chance = {
			factor = 70
			modifier = {
				factor = 2
				trait = craven
			}
			modifier = {
				factor = 0.5
				trait = brave
			}
			modifier = {
				factor = 2
				trait = carefree
			}
			modifier = {
				factor = 0.5
				trait = disciplined
			}
			modifier = {
				factor = 2
				trait = content
			}
			modifier = {
				factor = 0.5
				trait = ambitious
			}
		}
	}
	
	option = {
		name = "EVTOPTB50000" #Do I risk it? Yes!
		hidden_tooltip = {
			random_list = {
				30 = {
					host = {
						character_event = {
							id = 50040
						}
					}
					character_event = {
						id = 50001
					}
				}
				70 = {
					host = {
						character_event = {
							id = 50002
						}
					}
				}
			}
		}
		ai_chance = { factor = 30 }
	}
}

#I'm free!
character_event = {
	id = 50001
	desc = "EVTDESC50001"
	picture = "GFX_evt_into_the_dungeon"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA50001"
		if = {
			limit = { has_character_modifier = house_arrest }
			prestige = 10
		}
		if = {
			limit = { has_character_modifier = the_dungeon }
			prestige = 50
		}
		if = {
			limit = { has_character_modifier = the_oubliette }
			prestige = 100
		}
		prisoner = no
	}
}

# The host is notified of the escape
character_event = {
	id = 50040
	desc = "EVTDESC50040"
	picture = GFX_evt_spymaster
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA50040"
		if = {
			limit = { FROM = { has_character_modifier = house_arrest } }
			prestige = -10
		}
		if = {
			limit = { FROM = { has_character_modifier = the_dungeon } }
			prestige = -50
		}
		if = {
			limit = { FROM = { has_character_modifier = the_oubliette } }
			prestige = -100
		}
	}
}

#A prisoner tried to escape!
character_event = {
	id = 50002
	desc = "EVTDESC50002"
	picture = "GFX_evt_into_the_dungeon"
	
	is_triggered_only = yes
	
	option = {
		trigger = { FROM = { has_character_modifier = house_arrest } }
		name = "EVTOPTA50002"
		ai_chance = { factor = 20 }
		
		hidden_tooltip = {
			FROM = {
				character_event = {
					id = 50003
				}
			}
		}
	}
	
	option = {
		trigger = {
			FROM = {
				OR = {
					has_character_modifier = house_arrest
					has_character_modifier = the_dungeon
				}
			}
		}
		name = "EVTOPTB50002"
		ai_chance = { factor = 20 }
		
		FROM = {
			hidden_tooltip = {
				remove_character_modifier = house_arrest
				remove_character_modifier = the_oubliette
				remove_character_modifier = the_dungeon
			}
			add_character_modifier = { 
				name = the_dungeon
				duration = -1
			}
			hidden_tooltip = {
				character_event = {
					id = 50003
				}
			}
		}
	}
	
	option = {
		name = "EVTOPTC50002"
		ai_chance = { 
			factor = 20
			modifier = {
				factor = 0
				trait = friendly
			}
			modifier = {
				factor = 5
				trait = cold
			}
		}
		
		FROM = {
			hidden_tooltip = {
				remove_character_modifier = house_arrest
				remove_character_modifier = the_dungeon
				remove_character_modifier = the_oubliette
			}
			add_character_modifier = { 
				name = the_oubliette
				duration = -1
			}
			hidden_tooltip = {
				character_event = {
					id = 50003
				}
			}
		}
	}
}

#Failed to escape!
character_event = {
	id = 50003
	desc = "EVTDESC50003"
	picture = "GFX_evt_into_the_dungeon"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA50003"
		trigger = {
			has_character_modifier = house_arrest
		}
	}
	
	option = {
		name = "EVTOPTB50003"
		trigger = {
			has_character_modifier = the_oubliette
		}
		if = {
			limit = {
				trait = stressed
				NOT = { trait = depressed }
			}
			random = {
				chance = 25
				add_trait = depressed
			}
		}
		if = {
			limit = { NOT = { trait = stressed } }
			random = {
				chance = 25
				add_trait = depressed
			}
		}
	}
	
	option = {
		name = "EVTOPTC50003"
		trigger = {
			has_character_modifier = the_dungeon
		}
		if = {
			limit = {
				trait = stressed
				NOT = { trait = depressed }
			}
			random = {
				chance = 25
				add_trait = depressed
			}
		}
		if = {
			limit = { NOT = { trait = stressed } }
			random = {
				chance = 25
				add_trait = depressed
			}
		}
	}
}

###############################################
# Request better accomodations
character_event = {
	id = 50005
	desc = "EVTDESC50005"
	picture = "GFX_evt_into_the_dungeon"
	border =GFX_event_normal_frame_intrigue
	
	min_age = 14
	capable_only = yes
	prisoner = yes
	
	trigger = {
		OR = {
			is_landed = yes
			has_minor_title = title_ruler_consort
			any_heir_title = { always = yes }
			trait = proud
		}
		NOT = { has_character_modifier = the_oubliette }
		NOT = { has_character_modifier = house_arrest }
		NOT = { has_character_flag = asked_for_better_prison }
	}
	
	mean_time_to_happen = {
		months = 12
		modifier = {
			factor = 0.5
			trait = extraverted
		}
		modifier = {
			factor = 2.0
			trait = introverted
		}
	}
	
	option = {
		name = "EVTOPTA50005"
		set_character_flag = asked_for_better_prison
		hidden_tooltip = {
			host = {
				character_event = {
					id = 50006
					days = 2
				}
			}
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 2
				trait = confident
			}
			modifier = {
				factor = 0.5
				trait = neurotic
			}
			modifier = {
				factor = 1.25
				prestige = 100
			}
			modifier = {
				factor = 1.25
				prestige = 200
			}
			modifier = {
				factor = 1.25
				prestige = 300
			}
			modifier = {
				factor = 1.25
				prestige = 400
			}
			modifier = {
				factor = 1.25
				prestige = 500
			}
			modifier = {
				factor = 1.25
				prestige = 600
			}
			modifier = {
				factor = 1.25
				prestige = 700
			}
			modifier = {
				factor = 1.25
				prestige = 800
			}
			modifier = {
				factor = 1.25
				prestige = 900
			}
			modifier = {
				factor = 1.25
				prestige = 1000
			}
		}
	}
	
	option = {
		name = "EVTOPTB50005" #I deserve this
		set_character_flag = asked_for_better_prison
		ai_chance = { factor = 50 }
	}
}

#Host responds to the prisoner's request
character_event = {
	id = 50006
	desc = EVTDESC50006
	picture = GFX_evt_into_the_dungeon
	border =GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA50006" # Denied
		trigger = { FROM = { prisoner = yes } }
		hidden_tooltip = {
			FROM = {
				character_event = {
					id = 50009
				}
			}
		}
		ai_chance = { factor = 34 }
	}
	
	option = {
		name = "EVTOPTB50006" # Granted
		trigger = {
			FROM = {
				prisoner = yes
			}
		}
		ai_chance = { 
			factor = 33 
			modifier = {
				factor = 0
				trait = cold
			}
			modifier = {
				factor = 5
				trait = friendly
			}
		}
		tooltip = {
			FROM = {	
				add_character_modifier = { 
					name = house_arrest
					duration = -1
				}
			}
		}
		hidden_tooltip = {
			FROM = {
				character_event = {
					id = 50007
				}
			}
		}
	}
	
	option = {
		name = "EVTOPTC50006" # The Oubliette!
		trigger = {
			FROM = {
				prisoner = yes
			}
		}
		ai_chance = { 
			factor = 33 
			modifier = {
				factor = 0
				trait = friendly
			}
			modifier = {
				factor = 5
				trait = cold
			}
		}
		
		tooltip = {
			FROM = {	
				add_character_modifier = {
					name = the_oubliette
					duration = -1
				}
			}
		}
		
		hidden_tooltip = {
			FROM = {
				character_event = {
					id = 50008
				}
			}
		}
	}
	option = {
		name = "EVTOPTD50006" # Already released
		trigger = {
			FROM = {
				prisoner = no
			}
		}
	}
}

# House Arrest
character_event = {
	id = 50007
	desc = "EVTDESC50007"
	picture = "GFX_evt_into_the_dungeon"
	border =GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTCONFIRM"
		clr_character_flag = asked_for_better_prison
		hidden_tooltip = {
			remove_character_modifier = house_arrest
			remove_character_modifier = the_dungeon
			remove_character_modifier = the_oubliette
		}
		if = {
			limit = {
				prisoner = yes
			}
			add_character_modifier = { 
				name = house_arrest
				duration = -1
			}
		}
	}
}

# The Oubliette
character_event = {
	id = 50008
	desc = "EVTDESC50008"
	picture = "GFX_evt_into_the_dungeon"
	border =GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTCONFIRM"
		clr_character_flag = asked_for_better_prison
		remove_character_modifier = the_dungeon
		hidden_tooltip = {
			remove_character_modifier = house_arrest
			remove_character_modifier = the_dungeon
			remove_character_modifier = the_oubliette
		}
		if = {
			limit = {
				prisoner = yes
			}
			add_character_modifier = {
				name = the_oubliette
				duration = -1
			}
		}
	}
}

# Request Denied
character_event = {
	id = 50009
	desc = "EVTDESC50009"
	picture = "GFX_evt_into_the_dungeon"
	border =GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = { name = "EVTOPTCONFIRM" }
}

###############################################

# # Torture a prisoner!
# character_event = {
	# id = 50010
	# desc = "EVTDESC50010"
	# picture = "GFX_evt_torture"
	# border =GFX_event_normal_frame_intrigue
	
	# min_age = 14
	# only_rulers = yes
	# prisoner = no
	# capable_only = yes
	
	# trigger = {
		# NOT = { trait = friendly }
		# NOT = { trait = radical }
		# OR = {
			# trait = cold
			# trait = wroth
			# trait = pragmatic
			# trait = lunatic
			# trait = possessed
			# trait = paranoid
			# trait = impaler
			# trait = cold
		# }
		# any_courtier = {
			# age = 14
			# prisoner = yes
			# host = { character = ROOT }
			# NOT = { has_character_modifier = house_arrest }
		# }
	# }
	
	# mean_time_to_happen = {
		# months = 240
		# modifier = {
			# factor = 0.25
			# trait = impaler
		# }
		# modifier = {
			# factor = 0.5
			# trait = possessed
		# }
		# modifier = {
			# factor = 0.5
			# trait = cold
		# }
		# modifier = {
			# factor = 0.75
			# trait = paranoid
		# }
		# modifier = {
			# factor = 3.0
			# trait = carefree
		# }
	# }
	
	# option = {
		# name = EVTOPTA50010 # Resist my foul impulse
		# piety = 10
		# trigger = {
			# NOT = { has_character_flag = demon_child_non_pagan }
		# }
	# }
	
	# option = {
		# name = EVTOPTB50010 # Oil up the rack!
		# if = {
			# limit = { NOT = { religion = jain } }
			# piety = -10
		# }
		# if = {
			# limit = { religion = jain }
			# piety = -30
			# custom_tooltip = { text = jain_ahimsa_tooltip }
		# }
		# random_courtier = {
			# limit = {
				# age = 14
				# prisoner = yes
				# host = { character = ROOT }
				# NOT = { has_character_modifier = house_arrest }
			# }
			# random_list = {
				# 30 = {
					# character_event = {
						# id = 50011
						# tooltip = "EVTTOOLTIP50011"
					# }
				# }
				# 30 = {
					# character_event = {
						# id = 50012
						# tooltip = "EVTTOOLTIP50012"
					# }
				# }
				# 30 = {
					# character_event = {
						# id = 50013
						# tooltip = "EVTTOOLTIP50013"
					# }
				# }
				# 10 = {
					# character_event = {
						# id = 50014
						# tooltip = "EVTTOOLTIP50014"
					# }
				# }
			# }
		# }
	# }
# }

# # Tortured
# character_event = {
	# id = 50011
	# desc = "EVTDESC50011"
	# picture = "GFX_evt_torture"
	# border =GFX_event_normal_frame_intrigue
	
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTA50011"
		
		# add_character_modifier = { 
			# name = tortured
			# duration = 60
		# }
	# }
# }

# # Wounded
# character_event = {
	# id = 50012
	# desc = "EVTDESC50012"
	# picture = "GFX_evt_torture"
	# border =GFX_event_normal_frame_intrigue
	
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTA50012"
		# add_trait = wounded
	# }
# }

# # Maimed
# character_event = {
	# id = 50013
	# desc = "EVTDESC50013"
	# picture = "GFX_evt_torture"
	# border =GFX_event_normal_frame_intrigue
	
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTA50013"
		# add_trait = maimed
	# }
# }

# # Killed
# character_event = {
	# id = 50014
	# desc = "EVTDESC50014"
	# picture = "GFX_evt_death"
	# border =GFX_event_normal_frame_intrigue
	
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTA50014"
		# hidden_tooltip = {
			# FROM = {
				# character_event = {
					# id = 50015
				# }
			# }
		# }
		# death = {
			# death_reason = death_dungeon
			# killer = FROM
		# }
	# }
# }

# # Host notified of death
# character_event = {
	# id = 50015
	# desc = "EVTDESC50015"
	# picture = "GFX_evt_death"
	# border =GFX_event_normal_frame_intrigue
	
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTA50015"
		# prestige = -10
	# }
# }


###############################################

# Ruler is notified of the capture of an enemy commander
character_event = {
	id = 50020
	desc = "EVTDESC50020"
	picture = "GFX_evt_battle"
	border =GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTCONFIRM"
	}
}

###############################################

# #Petition liege to release prisoner
# character_event = {
	# id = 50025
	# desc = "EVTDESC50025"
	# picture = GFX_evt_emissary
	
	# only_rulers = yes
	# min_age = 16
	# capable_only = yes
	# prisoner = no
	
	# trigger = {
		# war = no
		# in_command = no
		# is_abroad = no
		# independent = no
		# liege = {
			# num_of_prisoners = 1
			# NOT = { character = ROOT }
			# any_realm_character = {
				# prisoner = yes
				# host = { 
					# character = PREV
				# }
				# reverse_opinion = { who = ROOT value = 0 }
				# OR = {
					# is_friend = ROOT
					# is_lover = ROOT
					# is_close_relative = ROOT
				# }
				# NOT = {
					# has_character_modifier = petition_release_prisoner_timer
				# }
			# }
		# }
	# }
	
	# mean_time_to_happen = {
		# months = 50
	# }
	
	# option = {
		# name = "EVTOPTCONFIRM"
		# liege = {
			# random_realm_character = {
				# limit = {
					# host = {
						# character = PREV
					# }
					# prisoner = yes
					# reverse_opinion = { who = ROOT value = 0 }
					# OR = {
						# is_friend = ROOT
						# is_lover = ROOT
						# is_close_relative = ROOT
					# }
				# }
				# hidden_tooltip = {
					# add_character_modifier = {
						# name = petition_release_prisoner_timer
						# duration = -1
						# hidden = yes
					# }
				# }
			# }
		# }
		# liege = {
			# letter_event = {
				# id = 50026
				# tooltip = "EVTTOOLTIP50026"
			# }
		# }
		# ai_chance = {
			# factor = 75
			# modifier = {
				# factor = 2
				# trait = extraverted
			# }
			# modifier = {
				# factor = 0.5
				# trait = introverted
			# }
			# modifier = {
				# factor = 2
				# trait = confident
			# }
			# modifier = {
				# factor = 0.5
				# trait = neurotic
			# }
			# modifier = {
				# factor = 2
				# trait = brave
			# }
			# modifier = {
				# factor = 0.5
				# trait = craven
			# }
		# }
	# }
	
	# option = {
		# name = "EVTOPTNEVERMIND"
		# ai_chance = { factor = 25 }
	# }
# }

# #Liege responds
# letter_event = {
	# id = 50026
	# desc = "EVTDESC50026"
	# is_triggered_only = yes
	
	# option = {
		# name = "EVTOPTACCEPT"
		# prestige = -50
		# random_realm_character = {
			# limit = {
				# host = { character = ROOT }
				# prisoner = yes
				# has_character_modifier = petition_release_prisoner_timer
			# }
			# prisoner = no
			# hidden_tooltip = { character_event = { id = 50027 } }
		# }
		# any_vassal = {
			# limit = {
				# prisoner = no
			# }
			# opinion = {
				# modifier = opinion_released_prisoner
				# who = ROOT
				# months = 30
			# }
		# }
		# ai_chance = {
			# factor = 25
			# modifier = {
				# factor = 0.1
				# any_realm_character = {
					# host = { character = ROOT }
					# prisoner = yes
					# has_character_modifier = petition_release_prisoner_timer
					# NOT = { reverse_opinion = { who = ROOT value = 0 } }
				# }
			# }
			# modifier = {
				# factor = 0.2
				# any_realm_character = {
					# host = { character = ROOT }
					# prisoner = yes
					# has_character_modifier = petition_release_prisoner_timer
					# NOT = { opinion = { who = ROOT value = 0 } }
					# relative_power = { who = ROOT power = 0.2 }
				# }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 100 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 90 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 80 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 70 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 60 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 50 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 40 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 30 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 20 }
			# }
			# modifier = {
				# factor = 1.25
				# opinion = { who = FROM value = 10 }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -9 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -19 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -29 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -39 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -49 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -59 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -69 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -79 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -89 } }
			# }
			# modifier = {
				# factor = 0.8
				# NOT = { opinion = { who = FROM value = -99 } }
			# }
		# }
	# }
	# option = {
		# name = "EVTOPTREFUSE"
		# hidden_tooltip = { FROM = { letter_event = { id = 50027 } } }
		# any_vassal = {
			# limit = {
				# liege = {
					# character = ROOT
				# }
			# }
			# opinion = {
				# modifier = opinion_not_release_prisoner
				# who = ROOT
				# years = 5
			# }
		# }
		# ai_chance = { factor = 75 }
	# }
# }

# character_event = {
	# id = 50027
	# desc = "EVTDESC50027"
	# picture = GFX_evt_emissary
	# is_triggered_only = yes
	# show_from_from = yes
	
	# option = {
		# name = "EVTOPTCONFIRM"
		# prisoner = no
		# hidden_tooltip = { FROM = { FROM = { letter_event = { id = 50028 } } } }
	# }
# }
# letter_event = {
	# id = 50028
	# desc = "EVTDESC50028"
	# is_triggered_only = yes
	# show_from_from = yes
	
	# option = {
		# name = "EVTOPTCONFIRM"
		# FROM = { }
	# }
# }