
namespace = Plus

#reserved: Plus.1100 to Plus.1149

#######################################
# DISINHERITANCE EVENTS
# Written by Rylock
#######################################

# Ruler considers disinheriting his heir
character_event = {
	id = Plus.1100
	picture = "GFX_evt_council"
	desc = "EVTDESC_Plus_1100"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1100" #Let it be done
		trigger = {
			FROM = {
				prisoner = no
				NOT = { trait = incapable }
			}
		}
		ai_chance = {
			factor = 100
		}
		custom_tooltip = { text = evt_relative_might_revolt }
		FROM = {
			add_trait = disinherited
			character_event = { id = Plus.1105 days = 3 tooltip = learns_disinheritance }
		}
		hidden_tooltip = {
			current_heir = {
				opinion = {
					who = ROOT
					modifier = opinion_pleased
					years = 10
				}
			}
			any_realm_character = {
				limit = {
					OR = {
						is_ruler = yes
						dynasty = ROOT
						is_close_relative = FROM
						NOT = { character = FROM }
						NOT = { character = ROOT }
					}
				}
				character_event = { id = Plus.1101 }
			}
			any_dynasty_member = {
				limit = {
					NOT = { same_realm = ROOT }
					NOT = { character = FROM }
				}
				character_event = { id = Plus.1101 }
			}
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_DISINHERITED_HEIR
				portrait = [From.GetID]
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_1100" #I doubt he will even understand what has happened...
		trigger = {
			FROM = { trait = incapable }
		}
		ai_chance = {
			factor = 100
		}
		FROM = {
			add_trait = disinherited
			character_event = { id = Plus.1110 days = 3 tooltip = learns_disinheritance }
		}
		hidden_tooltip = {
			current_heir = {
				opinion = {
					who = ROOT
					modifier = opinion_pleased
					years = 10
				}
			}
			any_realm_character = {
				limit = {
					OR = {
						is_ruler = yes
						dynasty = ROOT
						is_close_relative = FROM
						NOT = { character = FROM }
						NOT = { character = ROOT }
					}
				}
				character_event = { id = Plus.1101 }
			}
			any_dynasty_member = {
				limit = {
					NOT = { same_realm = ROOT }
					NOT = { character = FROM }
				}
				character_event = { id = Plus.1101 }
			}
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_DISINHERITED_HEIR
				portrait = [From.GetID]
			}
		}
	}
	option = {
		name = "EVTOPTC_Plus_1100" #He is in prison--what could he do?
		trigger = {
			FROM = {
				NOT = { trait = incapable }
				prisoner = yes
			}
		}
		ai_chance = {
			factor = 100
		}
		FROM = {
			add_trait = disinherited
			character_event = { id = Plus.1115 days = 3 tooltip = learns_disinheritance }
		}
		hidden_tooltip = {
			current_heir = {
				opinion = {
					who = ROOT
					modifier = opinion_pleased
					years = 10
				}
			}
			any_realm_character = {
				limit = {
					OR = {
						is_ruler = yes
						dynasty = ROOT
						is_close_relative = FROM
						NOT = { character = FROM }
						NOT = { character = ROOT }
					}
				}
				character_event = { id = Plus.1101 }
			}
			any_dynasty_member = {
				limit = {
					NOT = { same_realm = ROOT }
					NOT = { character = FROM }
				}
				character_event = { id = Plus.1101 }
			}
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_DISINHERITED_HEIR
				portrait = [From.GetID]
			}
		}
	}
	option = {
		name = "EVTOPTD_Plus_1100" #Reconsider
		ai_chance = {
			factor = 0
		}
		clr_character_flag = disinherited_child
		if = {
			limit = { tier = COUNT }
			prestige = 250
		}
		if = {
			limit = { tier = DUKE }
			prestige = 500
		}
		if = {
			limit = { tier = KING }
			prestige = 750
		}
		if = {
			limit = { tier = EMPEROR }
			prestige = 1000
		}
	}
}

# News spreads about heir's disinheritance
character_event = {
	id = Plus.1101
	picture = "GFX_evt_scandal"
	desc = "EVTDESC_Plus_1101"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1101" #Actually, he IS the law
		ai_chance = {
			factor = 40
			modifier = {
				factor = 1.5
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_3 } }
			}
			modifier = {
				factor = 2
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_4 } }
			}
			modifier = {
				factor = 0.25
				FROM = {
					primary_title = {
						OR = {
							has_law = succ_feudal_elective
							has_law = succ_tanistry
						}
					}
				}
			}
			modifier = {
				factor = 0.75
				FROM = { primary_title = { has_law = succ_gavelkind } }
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0.75
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.5
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROMFROM value = -25 } }
			}
			modifier = {
				factor = 0.1
				has_opinion_modifier = { who = FROM modifier = arbitrary_disinheritance }
			}
			modifier = {
				factor = 0.1
				is_rival = FROM
			}
			modifier = {
				factor = 1.25
				trait = arbitrary
			}
			modifier = {
				factor = 1.25
				trait = diligent
			}
			modifier = {
				factor = 1.5
				trait = content
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_1101" #I feel for him, but that is how it is
		ai_chance = {
			factor = 40
			modifier = {
				factor = 0
				FROM = {
					current_heir = { character = ROOT }
				}
			}
			modifier = {
				factor = 0.5
				FROMFROM = { trait = incapable }
			}
			modifier = {
				factor = 0.25
				NOT = { religion = FROMFROM }
			}
			modifier = {
				factor = 0.5
				culture = FROM
				NOT = { culture = FROMFROM }
			}
			modifier = {
				factor = 0.5
				NOT = { culture = FROM }
				NOT = { culture = FROMFROM }
			}
			modifier = {
				factor = 1.25
				NOT = { culture = FROM }
				culture = FROMFROM
			}
			modifier = {
				factor = 1.5
				NOT = { religion = FROM }
				religion = FROMFROM
			}
			modifier = {
				factor = 0.1
				is_rival = FROMFROM
			}
			modifier = {
				factor = 2
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 0.75
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = FROMFROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = charitable
			}
		}
		opinion = {
			who = FROM
			modifier = outraged_disinheritance
			years = 5
		}
		opinion = {
			who = FROMFROM
			modifier = sympathetic_disinheritance
			years = 10
		}
	}
	option = {
		name = "EVTOPTC_Plus_1101" #This is an outrage
		ai_chance = {
			factor = 60
			modifier = {
				factor = 0
				FROM = {
					current_heir = { character = ROOT }
				}
			}
			modifier = {
				factor = 2
				is_ruler = yes
				FROM = {
					primary_title = {
						OR = {
							has_law = succ_feudal_elective
							has_law = succ_tanistry
						}
					}
				}
			}
			modifier = {
				factor = 1.5
				is_ruler = yes
				FROM = { primary_title = { has_law = succ_gavelkind } }
			}
			modifier = {
				factor = 2
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_0 } }
			}
			modifier = {
				factor = 1.5
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_1 } }
			}
			modifier = {
				factor = 1.25
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_2 } }
			}
			modifier = {
				factor = 0.75
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_3 } }
			}
			modifier = {
				factor = 0.5
				is_ruler = yes
				FROM = { primary_title = { has_law = crown_authority_4 } }
			}
			modifier = {
				factor = 0.75
				is_ruler = no
			}
			modifier = {
				factor = 0.5
				NOT = { same_realm = FROMFROM }
			}
			modifier = {
				factor = 0.1
				FROMFROM = { trait = incapable }
			}
			modifier = {
				factor = 0.1
				is_rival = FROMFROM
			}
			modifier = {
				factor = 2
				is_rival = FROM
			}
			modifier = {
				factor = 0.25
				NOT = { religion = FROMFROM }
			}
			modifier = {
				factor = 0.5
				culture = FROM
				NOT = { culture = FROMFROM }
			}
			modifier = {
				factor = 0.5
				NOT = { culture = FROM }
				NOT = { culture = FROMFROM }
			}
			modifier = {
				factor = 1.5
				NOT = { culture = FROM }
				culture = FROMFROM
			}
			modifier = {
				factor = 2
				NOT = { religion = FROM }
				religion = FROMFROM
			}
			modifier = {
				factor = 0.5
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROMFROM value = 50 }
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROMFROM value = 25 }
			}
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = FROMFROM value = 0 } }
			}
			modifier = {
				factor = 0.5
				NOT = { opinion = { who = FROMFROM value = -25 } }
			}
			modifier = {
				factor = 1.25
				trait = just
			}
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
		}
		opinion = {
			who = FROM
			modifier = outraged_disinheritance
			years = 10
			multiplier = 2
		}
		opinion = {
			who = FROMFROM
			modifier = sympathetic_disinheritance
			years = 20
			multiplier = 2
		}
	}
}

# Heir receives news about disinheritance
character_event = {
	id = Plus.1105
	picture = "GFX_evt_bad_news"
	desc = "EVTDESC_Plus_1105"
	
	is_triggered_only = yes
	
	immediate = {
		log = "[Root.GetTitledName] has been disinherited by [From.GetTitledName]."
	}
	
	option = {
		name = "EVTOPTA_Plus_1105" #Disappointing, but truly I am relieved
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				OR = {
					trait = wroth
					trait = ambitious
					trait = greedy
				}
			}
			modifier = {
				factor = 2
				trait = humble
			}
		}
		opinion = {
			who = FROM
			modifier = disinherited_me
			years = 100
		}
	}
	option = {
		name = "EVTOPTB_Plus_1105" #Look for support in dealing with this outrage
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 0.5
				trait = craven
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 1.5
				trait = wroth
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
		}
		set_character_flag = flag_denied_title
		opinion = {
			who = FROM
			modifier = disinherited_me
			years = 100
			multiplier = 3
		}
		FROM = { primary_title = { add_pressed_claim = ROOT } }
		custom_tooltip = {
			text = LOOKING_FOR_SYMPATHETIC_LORD
			hidden_tooltip = {
				if = {
					limit = {
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							higher_tier_than = FROM
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							tier = FROM
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = DUKE
								}
								AND = {
									FROM = { tier = KING }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = DUKE
								}
								AND = {
									FROM = { tier = KING }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				clr_character_flag = found_sympathetic_lord
			}
		}
		if = {
			limit = {
				ai = yes
				has_plot = yes
				NOT = { plot_target_char = { character = FROM } }
			}
			set_character_flag = abort_plot
		}
		hidden_tooltip = { character_event =  { id = Plus.302 days = 3 } }
		if = {
			limit = {
				is_ruler = yes
				NOT = { leads_faction = yes }
			}
			clr_character_flag = faction_court_supporter
			clr_character_flag = faction_prosperity_supporter
			clr_character_flag = faction_glory_supporter
			clr_character_flag = faction_tradition_supporter
		}
	}
	option = {
		name = "EVTOPTC_Plus_1105" #I will become ruler, no matter what he says!
		trigger = {
			ai = yes
			NOT = { trait = content }
			NOT = { trait = humble }
			NOT = { trait = craven }
			NOT = { age = 65 }
			independent = no
			is_ruler = no
			FROM = {
				is_alive = yes
				independent = yes
			}
			liege = {
				character = FROM
				capital_scope = {
					any_independent_ruler = {
						religion_group = ROOT
						is_landed = yes
						NOT = { character = PREVPREV }
						capital_scope = {
							NOT = {
								distance = {
									where = PREVPREV
									distance = 400
								}
							}
						}
					}
				}
			}
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 2
				trait = wroth
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
		}
		set_character_flag = flag_denied_title
		opinion = {
			who = FROM
			modifier = disinherited_me
			years = 100
			multiplier = 4
		}
		FROM = { primary_title = { add_pressed_claim = ROOT } }
		if = {
			limit = {
				NOT = { plot_target_char = { character = FROM } }
			}
			set_character_flag = abort_plot
			set_character_flag = allow_plotting
		}
		character_event = { id = 37010 days = 45 }
	}
}

# Heir leaves former court to join court of a sympathetic lord
letter_event = {
	id = Plus.1106
	desc = "EVTDESC_Plus_1106"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1106" #We are pleased to welcome him
		ai_chance = {
			factor = 70
			modifier = {
				factor = 2
				is_close_relative = FROM
			}
		}
		if = {
			limit = { is_rival = FROM }
			remove_rival = FROM
		}
		if = {
			limit = { NOT = { is_friend = FROM } }
			add_friend = FROM
		}
		FROM = { banish = ROOT }
	}
	option = {
		name = "EVTOPTB_Plus_1106" #If he must come here, then so be it
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				is_rival = FROMFROM
			}
			modifier = {
				factor = 0
				has_opinion_modifier = { who = FROMFROM modifier = outraged_disinheritance }
			}
		}
		FROM = { banish = ROOT }
	}
}

# Incapable heir receives news about disinheritance
character_event = {
	id = Plus.1110
	picture = "GFX_evt_bad_news"
	desc = "EVTDESC_Plus_1110"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1110" #Maybe it's for the best
		opinion = {
			who = FROM
			modifier = disinherited_me
			years = 100
		}
	}
}

# Imprisoned heir receives news about disinheritance
character_event = {
	id = Plus.1115
	picture = "GFX_evt_bad_news"
	desc = "EVTDESC_Plus_1115"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1105" #Disappointing, but truly I am relieved
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				OR = {
					trait = wroth
					trait = ambitious
					trait = greedy
				}
			}
			modifier = {
				factor = 2
				trait = humble
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_1115" #There will be a reckoning
		ai_chance = {
			factor = 70
			modifier = {
				factor = 0.5
				trait = content
			}
			modifier = {
				factor = 0.5
				trait = craven
			}
			modifier = {
				factor = 0.5
				trait = humble
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 1.5
				trait = wroth
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
		}
		set_character_flag = flag_denied_title
		set_character_flag = disinherited_reckoning
		opinion = {
			who = FROM
			modifier = disinherited_me
			years = 100
			multiplier = 4
		}
		FROM = { primary_title = { add_pressed_claim = ROOT } }		
	}
}

# Disinherited heir finally gets out of prison -- now what?
character_event = {
	id = Plus.1116
	
	hide_window = yes
	
	is_triggered_only = yes
	
	only_playable = yes
	only_rulers = yes
	
	trigger = {
		any_child = {
			trait = disinherited
			ai = yes
			is_alive = yes
			is_ruler = no
			prisoner = no
			NOT = { trait = incapable }
			has_character_flag = disinherited_reckoning
		}
	}
	
	
	immediate = {
		random_child = {
			limit = {
				trait = disinherited
				ai = yes
				is_alive = yes
				is_ruler = no
				prisoner = no
				NOT = { trait = incapable }
				has_character_flag = disinherited_reckoning
			}
			clr_character_flag = disinherited_reckoning
			character_event = { id = Plus.1117 }
		}
	}
}
	
character_event = {
	id = Plus.1117
	picture = "GFX_evt_bad_news"
	desc = "AI_EVENT"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTB_Plus_1105" #Look for support in dealing with this outrage
		custom_tooltip = {
			text = LOOKING_FOR_SYMPATHETIC_LORD
			hidden_tooltip = {
				if = {
					limit = {
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							higher_tier_than = FROM
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							tier = FROM
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = DUKE
								}
								AND = {
									FROM = { tier = KING }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_independent_ruler = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = KING
								}
								AND = {
									FROM = { tier = KING }
									tier = DUKE
								}
								AND = {
									FROM = { tier = DUKE }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				if = {
					limit = {
						ROOT = { NOT = { has_character_flag = found_sympathetic_lord } }
						is_ruler = no
						OR = {
							FROM = { is_liege_of = ROOT }
							liege = { NOT = { has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance } } }
						}
					}
					random_realm_character = {
						limit = {
							has_opinion_modifier = { who = ROOT modifier = sympathetic_disinheritance }
							OR = {
								AND = {
									FROM = { tier = EMPEROR }
									tier = DUKE
								}
								AND = {
									FROM = { tier = KING }
									tier = COUNT
								}
							}
						}
						ROOT = { set_character_flag = found_sympathetic_lord }
						letter_event = { id = Plus.1106 }
					}
				}
				clr_character_flag = found_sympathetic_lord
			}
		}
		if = {
			limit = {
				ai = yes
				NOT = { plot_target_char = { character = FROM } }
			}
			set_character_flag = abort_plot
			set_character_flag = allow_plotting
		}
	}
	option = {
		name = "EVTOPTC_Plus_1105" #I will become ruler, no matter what he says!
		trigger = {
			ai = yes
			NOT = { trait = content }
			NOT = { trait = humble }
			NOT = { trait = craven }
			NOT = { age = 65 }
			independent = no
			is_ruler = no
			FROM = {
				is_alive = yes
				independent = yes
			}
			liege = {
				capital_scope = {
					any_independent_ruler = {
						religion_group = ROOT
						is_landed = yes
						NOT = { character = PREVPREV }
						capital_scope = {
							NOT = {
								distance = {
									where = PREVPREV
									distance = 400
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				NOT = { plot_target_char = { character = FROM } }
			}
			set_character_flag = abort_plot
			set_character_flag = allow_plotting
		}
		character_event = { id = 37010 days = 45 }
	}
}

### RECONCILIATION WITH DISINHERITED CHILD

# Ruler considers reconciliation (fired from decision)
character_event = {
	id = Plus.1120
	picture = "GFX_evt_council"
	desc = "EVTDESC_Plus_1120"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1120" #He is my son, that is all that matters
		trigger = {
			FROM = { is_female = no }
		}
		clr_character_flag = disinherited_child
		if = {
			limit = {
				NOT = { trait = just }
				NOT = { trait = arbitrary }
			}
			random = {
				chance = 20
				add_trait = arbitrary
			}
		}
		if = {
			limit = { trait = just }
			random = {
				chance = 20
				remove_trait = just
			}
		}
		current_heir = {
			remove_opinion = { who = ROOT modifier = opinion_pleased }
			opinion = { who = ROOT modifier = opinion_outraged years = 10 }
		}
		FROM = {
			remove_trait = disinherited
			character_event = { id = Plus.1125 days = 3 tooltip = learns_reconciliation }
		}
		hidden_tooltip = {
			any_realm_character = {
				limit = {
					OR = {
						is_ruler = yes
						dynasty = ROOT
						is_close_relative = FROM
						NOT = { character = FROM }
						NOT = { character = ROOT }
					}
				}
				character_event = { id = Plus.1121 }
			}
			any_dynasty_member = {
				limit = {
					NOT = { same_realm = ROOT }
					NOT = { character = FROM }
				}
				character_event = { id = Plus.1121 }
			}
		}
	}
	option = {
		name = "EVTOPTB_Plus_1120" #She is my daughter, that is all that matters
		trigger = {
			FROM = { is_female = yes }
		}
		clr_character_flag = disinherited_child
		if = {
			limit = {
				NOT = { trait = just }
				NOT = { trait = arbitrary }
			}
			random = {
				chance = 20
				add_trait = arbitrary
			}
		}
		if = {
			limit = { trait = just }
			random = {
				chance = 20
				remove_trait = just
			}
		}
		current_heir = {
			remove_opinion = { who = ROOT modifier = opinion_pleased }
			opinion = { who = ROOT modifier = opinion_outraged years = 10 }
		}
		FROM = {
			remove_trait = disinherited
			character_event = { id = Plus.1126 days = 3 tooltip = learns_reconciliation }
		}
		hidden_tooltip = {
			any_realm_character = {
				limit = {
					OR = {
						is_ruler = yes
						dynasty = ROOT
						is_close_relative = FROM
						NOT = { character = FROM }
						NOT = { character = ROOT }
					}
				}
				character_event = { id = Plus.1121 }
			}
			any_dynasty_member = {
				limit = {
					NOT = { same_realm = ROOT }
					NOT = { character = FROM }
				}
				character_event = { id = Plus.1121 }
			}
		}
	}
	option = {
		name = "EVTOPTC_Plus_1120" #Forget it
		trigger = {
			ai = no
		}
		if = {
			limit = { tier = COUNT }
			prestige = 125
		}
		if = {
			limit = { tier = DUKE }
			prestige = 250
		}
		if = {
			limit = { tier = KING }
			prestige = 375
		}
		if = {
			limit = { tier = EMPEROR }
			prestige = 500
		}
	}
}

# News spreads about the reconciliation
character_event = {
	id = Plus.1121
	picture = "GFX_evt_courtiers_talking"
	desc = "EVTDESC_Plus_1121"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1121"
		if = {
			limit = {
				OR = {
					has_opinion_modifier = { who = FROM modifier = outraged_disinheritance }
					has_opinion_modifier = { who = FROMFROM modifier = sympathetic_disinheritance }
				}
			}
			remove_opinion = { who = FROM modifier = outraged_disinheritance }
			remove_opinion = { who = FROMFROM modifier = sympathetic_disinheritance }
			opinion = { who = FROM modifier = arbitrary_disinheritance years = 10 }
		}
	}
}

# Son receives news of reconciliation
character_event = {
	id = Plus.1125
	picture = "GFX_evt_son_asking_father"
	desc = "EVTDESC_Plus_1125"
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = flag_denied_title
		clr_character_flag = disinherited_reckoning
		remove_opinion = { who = FROM modifier = disinherited_me }
		opinion = { who = FROM modifier = arbitrary_disinheritance multiplier = 2 years = 20 }
	}
}

# Daughter receives news of reconciliation
character_event = {
	id = Plus.1126
	picture = "GFX_evt_daughter_asking_father"
	desc = "EVTDESC_Plus_1125"
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		clr_character_flag = flag_denied_title
		clr_character_flag = disinherited_reckoning
		remove_opinion = { who = FROM modifier = disinherited_me }
		opinion = { who = FROM modifier = arbitrary_disinheritance multiplier = 2 years = 20 }
	}
}

### REMOVE DISINHERITED TRAIT UPON RULER DEATH

# Ruler dies -- fired from on_death
character_event = {
	id = Plus.1130
	
	hide_window = yes
	is_triggered_only = yes
	
	trigger = {
		any_child = {
			is_alive = yes
			trait = disinherited
			has_opinion_modifier = { who = ROOT modifier = disinherited_me }
		}
	}
	
	immediate = {
		random_child = {
			limit = {
				is_alive = yes
				trait = disinherited
				has_opinion_modifier = { who = ROOT modifier = disinherited_me }
			}
			character_event = { id = Plus.1131 days = 3 }
		}
	}
}

# Child receives news of removed disinherited trait
character_event = {
	id = Plus.1131
	picture = "GFX_evt_death"
	desc = "EVTDESC_Plus_1131"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA_Plus_1131"
		remove_trait = disinherited
	}
}

