﻿namespace = RE_hold_axis

RE_hold_axis.0001 = {
	hidden = yes
	immediate = {
		if = {
			limit = { 
				has_court_type = court_diplomatic
				NOT = { exists = root.var:RE_court_diplo_1_var } 
			}
			set_variable = {
				name = RE_court_diplo_1_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_diplomatic
				NOT = { exists = root.var:RE_court_diplo_2_var } 
			}
			set_variable = {
				name = RE_court_diplo_2_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_warlike
				NOT = { exists = root.var:RE_court_mart_1_var } 
			}
			set_variable = {
				name = RE_court_mart_1_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_warlike
				NOT = { exists = root.var:RE_court_mart_2_var } 
			}
			set_variable = {
				name = RE_court_mart_2_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_administrative
				NOT = { exists = root.var:RE_court_stew_1_var } 
			}
			set_variable = {
				name = RE_court_stew_1_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_administrative
				NOT = { exists = root.var:RE_court_stew_2_var } 
			}
			set_variable = {
				name = RE_court_stew_2_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_intrigue
				NOT = { exists = root.var:RE_court_intr_1_var } 
			}
			set_variable = {
				name = RE_court_intr_1_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_intrigue
				NOT = { exists = root.var:RE_court_intr_2_var } 
			}
			set_variable = {
				name = RE_court_intr_2_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_scholarly
				NOT = { exists = root.var:RE_court_lear_1_var } 
			}
			set_variable = {
				name = RE_court_lear_1_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
		if = {
			limit = { 
				has_court_type = court_scholarly
				NOT = { exists = root.var:RE_court_lear_2_var } 
			}
			set_variable = {
				name = RE_court_lear_2_var
				value = 50
			}
			add_character_flag = RE_new_axis
		}
	}
}
	
RE_hold_axis.1001 = {
	type = court_event
	title = RE_hold_axis.1001.t
	desc = { 
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = RE_new_axis
				}
				desc = RE_hold_axis.1001.desc_new
			}
			triggered_desc = {
				trigger = {
					always = yes
				}
				desc = RE_hold_axis.1001.desc_cont
			}	
		}
	}
	
	theme = realm
	court_scene = {
		button_position_character = scope:diplomat_two
		court_event_force_open = yes
		show_timeout_info = no
		should_pause_time = yes
		roles = {
			scope:diplomat_two = {
				group = petitioners_group
				animation = chancellor
			}
		}
	}
	
	widget = {
		gui = "event_window_widget_event_chain_progress"
		container = "custom_widgets_container"
		controller = event_chain_progress
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			OR = {
				has_court_type = court_warlike
				has_court_type = court_scholarly
				has_court_type = court_administrative
				has_court_type = court_intrigue
			}
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_courtier = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
			}
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
				weight = {
					base = 1
					compare_modifier = {
						value = diplomacy
						multiplier = 5
					}
				}
				save_scope_as = diplomat_two
				court_event_character_flag_effect = yes
			}
		}
		if = {
			limit = { 
				NOT = { exists = scope:diplomat_two }
			}
			hidden_effect = {
				create_character = {
					template = pool_repopulate_diplomacy
					dynasty = none
					location = root.capital_province
					faith = root.faith
					culture = root.culture
					save_scope_as = diplomat_two
				}
				scope:diplomat_two = {
					add_character_flag = REtemp
				}
			}
		}
		RE_axis_recount_diplo = yes
		# Trigger next event in chain.
		hold_court_queue_next_event_effect = yes
	}
	
	option = { 
		name = RE_hold_axis.1001.a
		custom_tooltip = RE_hold_axis.1001.a.tt
		trigger = {
			root.var:RE_court_diplo_1_var <= 85
		}
		stress_impact = {
			wrathful = medium_stress_loss
			ambitious = medium_stress_loss
			calm = medium_stress_gain
			content = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_diplo_1_var <= 14 }
			set_variable = {
				name = RE_court_diplo_1_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_1_var >= 15
					root.var:RE_court_diplo_1_var <= 34
				}
			}
			set_variable = {
				name = RE_court_diplo_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_1_var >= 35
					root.var:RE_court_diplo_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_diplo_1_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_diplo_1_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_diplo = yes }
	}
	
	option = { 
		name = RE_hold_axis.1001.b
		custom_tooltip = RE_hold_axis.1001.b.tt
		trigger = {
			root.var:RE_court_diplo_2_var <= 85
		}
		stress_impact = {
			honest = medium_stress_loss
			gregarious = medium_stress_loss
			deceitful = medium_stress_gain
			shy = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_diplo_2_var <= 14 }
			set_variable = {
				name = RE_court_diplo_2_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_2_var >= 15
					root.var:RE_court_diplo_2_var <= 34
				}
			}
			set_variable = {
				name = RE_court_diplo_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_2_var >= 35
					root.var:RE_court_diplo_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_diplo_2_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_diplo_2_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_diplo = yes }
	}
	
	option = { 
		name = RE_hold_axis.1001.c
		custom_tooltip = RE_hold_axis.1001.c.tt
		trigger = {
			root.var:RE_court_diplo_1_var >= 15
		}
		stress_impact = {
			wrathful = medium_stress_gain
			ambitious = medium_stress_gain
			calm = medium_stress_loss
			content = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_diplo_1_var >= 86 }
			set_variable = {
				name = RE_court_diplo_1_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_1_var >= 66
					root.var:RE_court_diplo_1_var <= 85
				}
			}
			set_variable = {
				name = RE_court_diplo_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_1_var >= 36
					root.var:RE_court_diplo_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_diplo_1_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_diplo_1_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_diplo = yes }
	}
	
	option = { 
		name = RE_hold_axis.1001.d
		custom_tooltip = RE_hold_axis.1001.d.tt
		trigger = {
			root.var:RE_court_diplo_2_var >= 15
		}
		stress_impact = {
			honest = medium_stress_gain
			gregarious = medium_stress_gain
			deceitful = medium_stress_loss
			shy = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_diplo_2_var >= 86 }
			set_variable = {
				name = RE_court_diplo_2_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_2_var >= 66
					root.var:RE_court_diplo_2_var <= 85
				}
			}
			set_variable = {
				name = RE_court_diplo_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_diplo_2_var >= 35
					root.var:RE_court_diplo_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_diplo_2_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_diplo_2_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_diplo = yes }
	}
	
	option = {
		name = RE_hold_axis.1001.e
		add_prestige = medium_prestige_gain
	}
	
	after = {
		if = {
			limit = { scope:diplomat_two = { has_character_flag = REtemp } }
			scope:diplomat_two = { silent_disappearance_effect = yes }
		}
		# Finish up the chain if relevant.
		remove_character_flag = RE_new_axis
		hold_court_queue_post_event_effect = yes
	}
}

RE_hold_axis.1011 = {
	type = court_event
	title = RE_hold_axis.1011.t
	desc = { 
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = RE_new_axis
				}
				desc = RE_hold_axis.1011.desc_new
			}
			triggered_desc = {
				trigger = {
					always = yes
				}
				desc = RE_hold_axis.1011.desc_cont
			}	
		}
	}
	
	theme = realm
	court_scene = {
		button_position_character = scope:warrior_two
		court_event_force_open = yes
		show_timeout_info = no
		should_pause_time = yes
		roles = {
			scope:warrior_two = {
				group = petitioners_group
				animation = marshal
			}
		}
	}
	
	widget = {
		gui = "event_window_widget_event_chain_progress"
		container = "custom_widgets_container"
		controller = event_chain_progress
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_scholarly
				has_court_type = court_administrative
				has_court_type = court_intrigue
			}
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_courtier = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
			}
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
				weight = {
					base = 1
					compare_modifier = {
						value = martial
						multiplier = 5
					}
				}
				save_scope_as = warrior_two
				court_event_character_flag_effect = yes
			}
		}
		if = {
			limit = { 
				NOT = { exists = scope:warrior_two }
			}
			hidden_effect = {
				create_character = {
					template = pool_repopulate_martial
					dynasty = none
					location = root.capital_province
					faith = root.faith
					culture = root.culture
					save_scope_as = warrior_two
				}
				scope:warrior_two = {
					add_character_flag = REtemp
				}
			}
		}
		RE_axis_recount_mart = yes
		# Trigger next event in chain.
		hold_court_queue_next_event_effect = yes
	}
	
	option = { 
		name = RE_hold_axis.1011.a
		custom_tooltip = RE_hold_axis.1011.a.tt
		trigger = {
			root.var:RE_court_mart_1_var <= 85
		}
		stress_impact = {
			forgiving = medium_stress_gain
			compassionate = medium_stress_gain
			vengeful = medium_stress_loss
			sadistic = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_mart_1_var <= 14 }
			set_variable = {
				name = RE_court_mart_1_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_1_var >= 15
					root.var:RE_court_mart_1_var <= 34
				}
			}
			set_variable = {
				name = RE_court_mart_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_1_var >= 35
					root.var:RE_court_mart_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_mart_1_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_mart_1_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_mart = yes }
	}
	
	option = { 
		name = RE_hold_axis.1011.b
		custom_tooltip = RE_hold_axis.1011.b.tt
		trigger = {
			root.var:RE_court_mart_2_var <= 85
		}
		stress_impact = {
			patient = medium_stress_gain
			craven = medium_stress_gain
			brave = medium_stress_loss
			impatient = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_mart_2_var <= 14 }
			set_variable = {
				name = RE_court_mart_2_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_2_var >= 15
					root.var:RE_court_mart_2_var <= 34
				}
			}
			set_variable = {
				name = RE_court_mart_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_2_var >= 35
					root.var:RE_court_mart_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_mart_2_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_mart_2_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_mart = yes }
	}
	
	option = { 
		name = RE_hold_axis.1011.c
		custom_tooltip = RE_hold_axis.1011.c.tt
		trigger = {
			root.var:RE_court_mart_1_var >= 15
		}
		stress_impact = {
			vengeful = medium_stress_gain
			sadistic = medium_stress_gain
			forgiving = medium_stress_loss
			compassionate = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_mart_1_var >= 86 }
			set_variable = {
				name = RE_court_mart_1_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_1_var >= 66
					root.var:RE_court_mart_1_var <= 85
				}
			}
			set_variable = {
				name = RE_court_mart_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_1_var >= 35
					root.var:RE_court_mart_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_mart_1_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_mart_1_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_mart = yes }
	}
	
	option = { 
		name = RE_hold_axis.1011.d
		custom_tooltip = RE_hold_axis.1011.d.tt
		trigger = {
			root.var:RE_court_mart_2_var >= 15
		}
		stress_impact = {
			brave = medium_stress_gain
			impatient = medium_stress_gain
			patient = medium_stress_loss
			craven = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_mart_2_var >= 86 }
			set_variable = {
				name = RE_court_mart_2_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_2_var >= 66
					root.var:RE_court_mart_2_var <= 85
				}
			}
			set_variable = {
				name = RE_court_mart_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_mart_2_var >= 35
					root.var:RE_court_mart_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_mart_2_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_mart_2_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_mart = yes }
	}
	
	option = {
		name = RE_hold_axis.1011.e
		add_prestige = medium_prestige_gain
	}
	
	after = {
		if = {
			limit = { scope:warrior_two = { has_character_flag = REtemp } }
			scope:warrior_two = { silent_disappearance_effect = yes }
		}
		# Finish up the chain if relevant.
		remove_character_flag = RE_new_axis
		hold_court_queue_post_event_effect = yes
	}
}

RE_hold_axis.1021 = {
	type = court_event
	title = RE_hold_axis.1021.t
	desc = { 
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = RE_new_axis
				}
				desc = RE_hold_axis.1021.desc_new
			}
			triggered_desc = {
				trigger = {
					always = yes
				}
				desc = RE_hold_axis.1021.desc_cont
			}	
		}
	}
	
	theme = realm
	court_scene = {
		button_position_character = scope:bobuilder_two
		court_event_force_open = yes
		show_timeout_info = no
		should_pause_time = yes
		roles = {
			scope:bobuilder_two = {
				group = petitioners_group
				animation = steward
			}
		}
	}
	
	widget = {
		gui = "event_window_widget_event_chain_progress"
		container = "custom_widgets_container"
		controller = event_chain_progress
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_scholarly
				has_court_type = court_warlike
				has_court_type = court_intrigue
			}
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_courtier = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
			}
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
				weight = {
					base = 1
					compare_modifier = {
						value = stewardship
						multiplier = 5
					}
				}
				save_scope_as = bobuilder_two
				court_event_character_flag_effect = yes
			}
		}
		if = {
			limit = { 
				NOT = { exists = scope:bobuilder_two }
			}
			hidden_effect = {
				create_character = {
					template = pool_repopulate_stewardship
					dynasty = none
					location = root.capital_province
					faith = root.faith
					culture = root.culture
					save_scope_as = bobuilder_two
				}
				scope:bobuilder_two = {
					add_character_flag = REtemp
				}
			}
		}
		RE_axis_recount_stew = yes
		# Trigger next event in chain.
		hold_court_queue_next_event_effect = yes
	}
	
	option = { 
		name = RE_hold_axis.1021.a
		custom_tooltip = RE_hold_axis.1021.a.tt
		trigger = {
			root.var:RE_court_stew_1_var <= 85
		}
		stress_impact = {
			diligent = medium_stress_gain
			arbitrary = medium_stress_loss
			arrogant = medium_stress_loss
		}
		if = {
			limit = { root.var:RE_court_stew_1_var <= 14 }
			set_variable = {
				name = RE_court_stew_1_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_1_var >= 15
					root.var:RE_court_stew_1_var <= 34
				}
			}
			set_variable = {
				name = RE_court_stew_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_1_var >= 35
					root.var:RE_court_stew_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_stew_1_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_stew_1_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_stew = yes }
	}
	
	option = { 
		name = RE_hold_axis.1021.b
		custom_tooltip = RE_hold_axis.1021.b.tt
		trigger = {
			root.var:RE_court_stew_2_var <= 85
		}
		stress_impact = {
			fickle = medium_stress_gain
			stubborn = medium_stress_loss
			gregarious = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_stew_2_var <= 14 }
			set_variable = {
				name = RE_court_stew_2_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_2_var >= 15
					root.var:RE_court_stew_2_var <= 34
				}
			}
			set_variable = {
				name = RE_court_stew_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_2_var >= 35
					root.var:RE_court_stew_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_stew_2_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_stew_2_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_stew = yes }
	}
	
	option = { 
		name = RE_hold_axis.1021.c
		custom_tooltip = RE_hold_axis.1021.c.tt
		trigger = {
			root.var:RE_court_stew_1_var >= 15
		}
		stress_impact = {
			diligent = medium_stress_loss
			lazy = medium_stress_gain
			arrogant = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_stew_1_var >= 86 }
			set_variable = {
				name = RE_court_stew_1_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_1_var >= 66
					root.var:RE_court_stew_1_var <= 85
				}
			}
			set_variable = {
				name = RE_court_stew_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_1_var >= 35
					root.var:RE_court_stew_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_stew_1_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_stew_1_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_stew = yes }
	}
	
	option = { 
		name = RE_hold_axis.1021.d
		custom_tooltip = RE_hold_axis.1021.d.tt
		trigger = {
			root.var:RE_court_stew_2_var >= 15
		}
		stress_impact = {
			gregarious = medium_stress_loss
			stubborn = medium_stress_gain
			fickle = medium_stress_loss
			arrogant = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_stew_2_var >= 86 }
			set_variable = {
				name = RE_court_stew_2_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_2_var >= 66
					root.var:RE_court_stew_2_var <= 85
				}
			}
			set_variable = {
				name = RE_court_stew_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_stew_2_var >= 35
					root.var:RE_court_stew_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_stew_2_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_stew_2_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_stew = yes }
	}
	
	option = {
		name = RE_hold_axis.1021.e
		add_prestige = medium_prestige_gain
	}
	
	after = {
		if = {
			limit = { scope:bobuilder_two = { has_character_flag = REtemp } }
			scope:bobuilder_two = { silent_disappearance_effect = yes }
		}
		# Finish up the chain if relevant.
		remove_character_flag = RE_new_axis
		hold_court_queue_post_event_effect = yes
	}
}

RE_hold_axis.1031 = {
	type = court_event
	title = RE_hold_axis.1031.t
	desc = { 
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = RE_new_axis
				}
				desc = RE_hold_axis.1031.desc_new
			}
			triggered_desc = {
				trigger = {
					always = yes
				}
				desc = RE_hold_axis.1031.desc_cont
			}	
		}
	}
	
	theme = realm
	court_scene = {
		button_position_character = scope:amogi_two
		court_event_force_open = yes
		show_timeout_info = no
		should_pause_time = yes
		roles = {
			scope:amogi_two = {
				group = petitioners_group
				animation = spymaster
			}
		}
	}
	
	widget = {
		gui = "event_window_widget_event_chain_progress"
		container = "custom_widgets_container"
		controller = event_chain_progress
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_scholarly
				has_court_type = court_warlike
				has_court_type = court_administrative
			}
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_courtier = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
			}
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
				weight = {
					base = 1
					compare_modifier = {
						value = intrigue
						multiplier = 5
					}
				}
				save_scope_as = amogi_two
				court_event_character_flag_effect = yes
			}
		}
		if = {
			limit = { 
				NOT = { exists = scope:amogi_two }
			}
			hidden_effect = {
				create_character = {
					template = pool_repopulate_intrigue
					dynasty = none
					location = root.capital_province
					faith = root.faith
					culture = root.culture
					save_scope_as = amogi_two
				}
				scope:amogi_two = {
					add_character_flag = REtemp
				}
			}
		}
		RE_axis_recount_intr = yes
		# Trigger next event in chain.
		hold_court_queue_next_event_effect = yes
	}
	
	option = { 
		name = RE_hold_axis.1031.a
		custom_tooltip = RE_hold_axis.1031.a.tt
		trigger = {
			root.var:RE_court_intr_1_var <= 85
		}
		stress_impact = {
			impatient = medium_stress_loss
			ambitious = medium_stress_loss
			patient = medium_stress_gain
			content = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_intr_1_var <= 14 }
			set_variable = {
				name = RE_court_intr_1_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_1_var >= 15
					root.var:RE_court_intr_1_var <= 34
				}
			}
			set_variable = {
				name = RE_court_intr_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_1_var >= 35
					root.var:RE_court_intr_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_intr_1_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_intr_1_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_intr = yes }
	}
	
	option = { 
		name = RE_hold_axis.1031.b
		custom_tooltip = RE_hold_axis.1031.b.tt
		trigger = {
			root.var:RE_court_intr_2_var <= 85
		}
		stress_impact = {
			wrathful = medium_stress_loss
			paranoid = medium_stress_loss
			calm = medium_stress_gain
			trusting = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_intr_2_var <= 14 }
			set_variable = {
				name = RE_court_intr_2_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_2_var >= 15
					root.var:RE_court_intr_2_var <= 34
				}
			}
			set_variable = {
				name = RE_court_intr_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_2_var >= 35
					root.var:RE_court_intr_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_intr_2_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_intr_2_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_intr = yes }
	}
	
	option = { 
		name = RE_hold_axis.1031.c
		custom_tooltip = RE_hold_axis.1031.c.tt
		trigger = {
			root.var:RE_court_intr_1_var >= 15
		}
		stress_impact = {
			patient = medium_stress_loss
			content = medium_stress_loss
			impatient = medium_stress_gain
			ambitious = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_intr_1_var >= 86 }
			set_variable = {
				name = RE_court_intr_1_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_1_var >= 66
					root.var:RE_court_intr_1_var <= 85
				}
			}
			set_variable = {
				name = RE_court_intr_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_1_var >= 35
					root.var:RE_court_intr_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_intr_1_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_intr_1_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_intr = yes }
	}
	
	option = { 
		name = RE_hold_axis.1031.d
		custom_tooltip = RE_hold_axis.1031.d.tt
		trigger = {
			root.var:RE_court_intr_2_var >= 15
		}
		stress_impact = {
			calm = medium_stress_loss
			trusting = medium_stress_loss
			paranoid = medium_stress_gain
			wrathful = medium_stress_gain
		}
		if = {
			limit = { root.var:RE_court_intr_2_var >= 86 }
			set_variable = {
				name = RE_court_intr_2_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_2_var >= 66
					root.var:RE_court_intr_2_var <= 85
				}
			}
			set_variable = {
				name = RE_court_intr_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_intr_2_var >= 35
					root.var:RE_court_intr_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_intr_2_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_intr_2_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_intr = yes }
	}
	
	option = {
		name = RE_hold_axis.1031.e
		add_prestige = medium_prestige_gain
	}
	
	after = {
		if = {
			limit = { scope:amogi_two = { has_character_flag = REtemp } }
			scope:amogi_two = { silent_disappearance_effect = yes }
		}
		# Finish up the chain if relevant.
		remove_character_flag = RE_new_axis
		hold_court_queue_post_event_effect = yes
	}
}

RE_hold_axis.1041 = {
	type = court_event
	title = RE_hold_axis.1041.t
	desc = { 
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = RE_new_axis
				}
				desc = RE_hold_axis.1041.desc_new
			}
			triggered_desc = {
				trigger = {
					always = yes
				}
				desc = RE_hold_axis.1041.desc_cont
			}	
		}
	}
	
	theme = realm
	court_scene = {
		button_position_character = scope:smartypants_two
		court_event_force_open = yes
		show_timeout_info = no
		should_pause_time = yes
		roles = {
			scope:smartypants_two = {
				group = petitioners_group
				animation = court_chaplain
			}
		}
	}
	
	widget = {
		gui = "event_window_widget_event_chain_progress"
		container = "custom_widgets_container"
		controller = event_chain_progress
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 0
			OR = {
				has_court_type = court_diplomatic
				has_court_type = court_intrigue
				has_court_type = court_warlike
				has_court_type = court_administrative
			}
		}
	}
	
	immediate = {
		if = {
			limit = { 
				any_courtier = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
			}
			random_courtier = {
				limit = {
					is_available_ai_adult = yes
					has_court_event_flag = no
				}
				weight = {
					base = 1
					compare_modifier = {
						value = learning
						multiplier = 5
					}
				}
				save_scope_as = smartypants_two
				court_event_character_flag_effect = yes
			}
		}
		if = {
			limit = { 
				NOT = { exists = scope:smartypants_two }
			}
			hidden_effect = {
				create_character = {
					template = pool_repopulate_learning
					dynasty = none
					location = root.capital_province
					faith = root.faith
					culture = root.culture
					save_scope_as = smartypants_two
				}
				scope:smartypants_two = {
					add_character_flag = REtemp
				}
			}
		}
		RE_axis_recount_lear = yes
		# Trigger next event in chain.
		hold_court_queue_next_event_effect = yes
	}
	
	option = { 
		name = RE_hold_axis.1041.a
		custom_tooltip = RE_hold_axis.1041.a.tt
		trigger = {
			root.var:RE_court_lear_1_var <= 85
		}
		if = {
			limit = { root.var:RE_court_lear_1_var <= 14 }
			set_variable = {
				name = RE_court_lear_1_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_1_var >= 15
					root.var:RE_court_lear_1_var <= 34
				}
			}
			set_variable = {
				name = RE_court_lear_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_1_var >= 35
					root.var:RE_court_lear_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_lear_1_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_lear_1_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_lear = yes }
	}
	
	option = { 
		name = RE_hold_axis.1041.b
		custom_tooltip = RE_hold_axis.1041.b.tt
		trigger = {
			root.var:RE_court_lear_2_var <= 85
		}
		if = {
			limit = { root.var:RE_court_lear_2_var <= 14 }
			set_variable = {
				name = RE_court_lear_2_var
				value = 25
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_2_var >= 15
					root.var:RE_court_lear_2_var <= 34
				}
			}
			set_variable = {
				name = RE_court_lear_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_2_var >= 35
					root.var:RE_court_lear_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_lear_2_var
				value = 75
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_lear_2_var
				value = 90
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_lear = yes }
	}
	
	option = { 
		name = RE_hold_axis.1041.c
		custom_tooltip = RE_hold_axis.1041.c.tt
		trigger = {
			root.var:RE_court_lear_1_var >= 15
		}
		if = {
			limit = { root.var:RE_court_lear_1_var >= 86 }
			set_variable = {
				name = RE_court_lear_1_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_1_var >= 66
					root.var:RE_court_lear_1_var <= 85
				}
			}
			set_variable = {
				name = RE_court_lear_1_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_1_var >= 35
					root.var:RE_court_lear_1_var <= 65
				}
			}
			set_variable = {
				name = RE_court_lear_1_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_lear_1_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_lear = yes }
	}
	
	option = { 
		name = RE_hold_axis.1041.d
		custom_tooltip = RE_hold_axis.1041.d.tt
		trigger = {
			root.var:RE_court_lear_2_var >= 15
		}
		if = {
			limit = { root.var:RE_court_lear_2_var >= 86 }
			set_variable = {
				name = RE_court_lear_2_var
				value = 75
			}
			add_prestige = major_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_2_var >= 66
					root.var:RE_court_lear_2_var <= 85
				}
			}
			set_variable = {
				name = RE_court_lear_2_var
				value = 50
			}
			add_prestige = medium_prestige_loss
		}
		else_if = {
			limit = {
				AND = {
					root.var:RE_court_lear_2_var >= 35
					root.var:RE_court_lear_2_var <= 65
				}
			}
			set_variable = {
				name = RE_court_lear_2_var
				value = 25
			}
			add_prestige = minor_prestige_loss
		}
		else = {
			set_variable = {
				name = RE_court_lear_2_var
				value = 10
			}
			add_prestige = minor_prestige_gain
		}
		hidden_effect = { RE_axis_recount_lear = yes }
	}
	
	option = {
		name = RE_hold_axis.1041.e
		add_prestige = medium_prestige_gain
	}
	
	after = {
		if = {
			limit = { scope:smartypants_two = { has_character_flag = REtemp } }
			scope:smartypants_two = { silent_disappearance_effect = yes }
		}
		# Finish up the chain if relevant.
		remove_character_flag = RE_new_axis
		hold_court_queue_post_event_effect = yes
	}
}

