namespace = Plus

#reserved: Plus.1350 to Plus.1399

#######################################
# BASTARD EVENTS
# Written by Rylock
#######################################

### BASTARD ASKS TO BE LEGITIMIZED

# Bastard has ambition to be legitimized
character_event = {
	id = Plus.1350
	desc = EVTDESC_Plus_1350
	picture = GFX_evt_son_asking_father
	
	min_age = 16
	max_age = 45
	capable_only = yes
	prisoner = no
	
	trigger = {
		trait = bastard
		has_ambition = obj_be_legitimized
		real_father = {
			in_command_trigger = no
			is_abroad_trigger = no
			has_regent = no
			is_ruler = yes
			is_not_busy_trigger = yes
			NOT = { is_inaccessible_trigger = yes }
		}
		NOR = {
			has_character_flag = refused_legitimacy_attempt
			is_inaccessible_trigger = yes
		}
		is_not_busy_trigger = yes
	}
	
	mean_time_to_happen = {
		months = 30
		modifier = {
			factor = 2
			is_ruler = yes
		}
		modifier = {
			factor = 2
			is_female = yes
		}
		modifier = {
			factor = 0.5
			trait = ambitious
		}
		modifier = {
			factor = 0.75
			trait = proud
		}
		modifier = {
			factor = 0.75
			trait = envious
		}
		modifier = {
			factor = 1.5
			trait = patient
		}
		modifier = {
			factor = 1.5
			trait = trusting
		}
		modifier = {
			factor = 1.5
			trait = shy
		}
	}
	
	option = {
		name = EVTOPTA_Plus_1350 #It's now or never...
		real_father = {
			character_event = { id = Plus.1351 days = 3 }
		}
		hidden_tooltip = {
			add_character_modifier = {
				name = do_not_disturb
				hidden = yes
				days = 3
			}
		}		
	}
}

# Bastard approaches father to ask to be legitimized
character_event = {
	id = Plus.1351
	desc = EVTDESC_Plus_1351
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1351 # It is not going to happen
		trigger = {
			NOT = { diplomacy = 14 }
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				FROM = { is_female = yes }
			}
			modifier = {
				factor = 2
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.5
				is_married = no
				NOT = { num_of_children = 1 }
			}
			modifier = {
				factor = 1.5
				num_of_children = 3
			}
			modifier = {
				factor = 1.5
				num_of_children = 4
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
			modifier = {
				factor = 2
				trait = cruel
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 5
				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
		hidden_tooltip = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1352 }
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_1351 # Convince him that this is for the best
		trigger = {
			diplomacy = 14
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				FROM = { is_female = yes }
			}
			modifier = {
				factor = 2
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.5
				is_married = no
				NOT = { num_of_children = 1 }
			}
			modifier = {
				factor = 1.5
				num_of_children = 3
			}
			modifier = {
				factor = 1.5
				num_of_children = 4
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
			modifier = {
				factor = 2
				trait = cruel
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 5
				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
		tooltip_info = diplomacy
		hidden_tooltip = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1353 }
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_1351 # Buy him an estate
		trigger = {
			wealth = 50
			FROM = {
				is_ruler = no
				spouse = { is_ruler = no }
				NOR = {
					has_character_modifier = estates_1
					has_character_modifier = estates_2
					has_character_modifier = estates_3
					has_character_modifier = estates_4
					has_character_modifier = estates_5
				}
			}
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 0 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0
				trait = greedy
			}
			modifier = {
				factor = 0
				has_character_modifier = ai_austerity
			}
			modifier = {
				factor = 1.5
				wealth = 200
			}
			modifier = {
				factor = 1.5
				wealth = 400
			}
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 2
				trait = charitable
			}
		}
		wealth = -50
		FROM = {
			set_character_flag = refused_legitimacy_attempt
			character_event = { id = Plus.1354 tooltip = buy_off_with_estate }
		}
	}
	option = {
		name = EVTOPTD_Plus_1351 # Legitimize him
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.75
				NOT = { age = 50 }
			}
			modifier = {
				factor = 0.5
				FROM = {
					OR = {
						trait = lunatic
						trait = possessed
						trait = drunkard
						trait = inbred
						is_weak_trigger = yes
					}
				}
			}
			modifier = {
				factor = 2
				FROM = {
					OR = {
						is_smart_trigger = yes
						diplomacy = 12
						martial = 12
						stewardship = 12
						intrigue = 12
					}
				}
			}
			modifier = {
				factor = 0.5
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 0.5
				NOT = { culture = FROM }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 75 }
			}
			modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0
				NOT = { reverse_opinion = { who = FROM value = -50 } }
			}
			modifier = {
				factor = 0
				NOT = { piety = 50 }
			}
			modifier = {
				factor = 4
				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}
				NOT = { has_law = enatic_succession }
				FROM = { is_female = no }
				spouse = { is_pregnant = no }
				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}
			modifier = {
				factor = 4
				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}
				NOT = { has_law = agnatic_succession }
				FROM = { is_female = yes }
				spouse = { is_pregnant = no }
				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = just
			}
			modifier = {
				factor = 1.5
				trait = honest
			}
			modifier = {
				factor = 0
				num_of_children = 5
			}
		}
		piety = -50
		FROM = {
			character_event = { id = Plus.1355 tooltip = legitimize_him }
		}
		hidden_tooltip = {
			FROM = {
				mother = {
					opinion = {
						who = ROOT
						modifier = legitimized_child
						years = 10
					}
				}
			}
			spouse = {
				if = {
					limit = {
						NOT = {
							any_child = { character = FROM }	
						}
					}
					opinion = {
						who = ROOT
						modifier = legitimized_bastard
						years = 20
					}
				}
			}
			any_child = {
				limit = {
					NOT = { character = FROM }
					dynasty = ROOT
					NOT = { trait = bastard }
				}
				opinion = {
					who = ROOT
					modifier = legitimized_bastard
					months = 12
				}
			}
		}
	}

	}

# Father outright refuses to legitimize the bastard
character_event = {
	id = Plus.1352
	desc = EVTDESC_Plus_1352
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1352 # So be it
		ai_chance = {
			factor = 30
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = charitable
			}
			modifier = {
				factor = 1.5
				trait = patient
			}
			modifier = {
				factor = 0
				OR = {
					trait = lunatic
					trait = possessed
					trait = wroth
					trait = ambitious
				}
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_very_disappointed
			years = 5
		}
		random = {
			chance = 50
			add_trait = content
		}
	}
	option = {
		name = EVTOPTB_Plus_1352 # This isn't right!
		ai_chance = {
			factor = 70
			modifier = {
				factor = 1.5
				trait = greedy
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 1.5
				trait = cruel
			}
			modifier = {
				factor = 1.5
				trait = just
			}
		}
		set_character_flag = potential_trouble_bastard
		opinion = {
			who = FROM
			modifier = denounced_child
			years = 20
		}
		if = {
			limit = { NOT = { trait = wroth } }
			random = {
				chance = 20
				add_trait = wroth
			}
		}
		if = {
			limit = { NOT = { trait = ambitious } }
			random = {
				chance = 50
				add_trait = ambitious
			}
		}
	}
}

# Father diplomatically refuses to legitimize the bastard
character_event = {
	id = Plus.1353
	desc = EVTDESC_Plus_1353
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1352 # So be it
		opinion = {
			who = FROM
			modifier = opinion_very_disappointed
			years = 5
		}
		if = {
			limit = { trait = ambitious }
			random = {
				chance = 25
				remove_trait = ambitious
			}
		}
	}
}

# Father buys off the bastard with an estate
character_event = {
	id = Plus.1354
	desc = EVTDESC_Plus_1354
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1352 # So be it
		ai_chance = {
			factor = 70
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = charitable
			}
			modifier = {
				factor = 1.5
				trait = patient
			}
			modifier = {
				factor = 0
				OR = {
					trait = lunatic
					trait = possessed
				}
			}
			modifier = {
				factor = 0.1
				OR = {
					trait = wroth
					trait = ambitious
				}
			}
		}
		add_character_modifier = {
			name = "estates_1"
			duration = -1
		}
		give_minor_title = title_lord
		random = {
			chance = 50
			add_trait = content
		}
	}
	option = {
		name = EVTOPTB_Plus_1354 # That's not enough!
		ai_chance = {
			factor = 30
			modifier = {
				factor = 1.5
				trait = greedy
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 1.5
				trait = cruel
			}
			modifier = {
				factor = 1.5
				trait = just
			}
		}
		set_character_flag = potential_trouble_bastard
		add_character_modifier = {
			name = "estates_1"
			duration = -1
		}
		give_minor_title = title_lord
		opinion = {
			who = FROM
			modifier = opinion_very_disappointed
			years = 5
		}
		if = {
			limit = { NOT = { trait = wroth } }
			random = {
				chance = 20
				add_trait = wroth
			}
		}
		if = {
			limit = { NOT = { trait = ambitious } }
			random = {
				chance = 50
				add_trait = ambitious
			}
		}
	}
}

# Father legitimizes the bastard
character_event = {
	id = Plus.1355
	desc = EVTDESC_Plus_1355
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	major = yes
	
	major_trigger = {
		OR = {
			character = FROM
			is_close_relative = FROM
			dynasty = FROM
			vassal_of = FROM
			is_close_relative = ROOT
		}
	}
	
	option = {
		name = EXCELLENT
		trigger = { character = ROOT }
		opinion = {
			who = FROM
			modifier = legitimized_me
			years = 20
		}
		set_father = FROM
		set_real_father = 0
		any_child = {
			limit = { dynasty = ROOT }
			dynasty = FROM
			any_child = {
				limit = { dynasty = ROOT }
				dynasty = FROM
			}
		}
		dynasty = FROM
		remove_trait = bastard
		add_trait = legit_bastard
		recalc_succession = yes
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_LEGITIMIZED_BY_FATHER
				portrait = [Root.GetID]
			}
		}
	}
	option = {
		name = OK
		trigger = { NOT = { character = ROOT } }
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_LEGITIMIZED_BY_FATHER
				portrait = [Root.GetID]
			}
		}
	}
}

### BASTARD MAKES A CLAIM AGAINST A YOUNGER SIBLING

# Ruler inherits who has a bastard sibling
character_event = {
	id = Plus.1360
	
	hide_window = yes
	is_triggered_only = yes
	
	only_rulers = yes
	
	trigger = {
		NOT = { religion_group = muslim }
		OR = {
			AND = {
				FROM = {
					OR = {
						has_law = succ_gavelkind
						has_law = succ_primogeniture
						has_law = succ_seniority
					}
				}
				any_sibling = {
					trait = bastard
					is_older_than = ROOT
				}
			}
			AND = {
				FROM = { has_law = succ_ultimogeniture }
				any_sibling = {
					trait = bastard
					ROOT = { is_older_than = PREV }
				}
			}
		}
	}
	
	immediate = {
		any_sibling = {
			limit = {
				trait = bastard
				OR = {
					AND = {
						FROM = { NOT = { has_law = succ_ultimogeniture } }
						is_older_than = ROOT
					}
					AND = {
						FROM = { has_law = succ_ultimogeniture }
						ROOT = { is_older_than = PREV }
					}
				}
			}
			character_event = { id = Plus.1361 days = 5 random = 10 }
		}
	}
}

# Bastard sibling considers making a claim against the inheritance
character_event = {
	id = Plus.1361
	desc = EVTDESC_Plus_1361
	picture = GFX_evt_knight_kneeling
	
	is_triggered_only = yes
	
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		OR = {
			is_ruler = no
			NOT = { capital_holding = { holding_type = temple } }
		}
		NOR = {
			has_strong_claim = FROMFROM
			trait = monk
			trait = nun
			any_liege = { holy_order = yes }
		}
		FROMFROM = {
			is_primary_holder_title = yes
			holder_scope = { sibling = ROOT }
			OR = {
				AND = {
					ROOT = { is_female = no }
					NOT = { has_law = enatic_succession }
					NOT = { has_law = enatic_cognatic_succession }
				}
				AND = {
					ROOT = { is_female = no }
					has_law = enatic_cognatic_succession
					holder_scope = { is_female = no }
				}
				AND = {
					ROOT = { is_female = yes }
					NOT = { has_law = agnatic_succession }
					NOT = { has_law = cognatic_succession }
				}
				AND = {
					ROOT = { is_female = yes }
					has_law = cognatic_succession
					holder_scope = { is_female = yes }
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA_Plus_1361 # The inheritance is rightfully mine!
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					trait = content
					trait = humble
					trait = craven
				}
			}
			modifier = {
				factor = 0.5
				is_ruler = yes
				NOT = { trait = ambitious }
			}
			modifier = {
				factor = 0.5
				is_ruler = yes
				any_liege = { character = FROM }
				NOT = { trait = ambitious }
			}
			modifier = {
				factor = 0.5
				trait = charitable
			}
			modifier = {
				factor = 1.5
				trait = greedy
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 2
				trait = wroth
			}
			modifier = {
				factor = 3
				trait = ambitious
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.25
				NOT = { opinion = { who = FROM value = -50 } }
			}
			modifier = {
				factor = 0.75
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 0.75
				opinion = { who = FROM value = 75 }
			}
			modifier = {
				factor = 0.5
				NOT = { martial = 6 }
			}
			modifier = {
				factor = 1.25
				martial = 12
			}
			modifier = {
				factor = 1.25
				martial = 14
			}
			modifier = {
				factor = 1.25
				martial = 16
			}
		}
		if = {
			limit = {
				has_nickname = no
				is_female = no
			}
			give_nickname = nick_the_bastard
		}
		set_character_flag = flag_denied_title
		FROMFROM = { add_claim = ROOT }
		if = {
			limit = { NOT = { trait = ambitious } }
			add_trait = ambitious
		}
		hidden_tooltip = {
			FROM = { character_event = { id = Plus.1362 } }
		}
	}
	option = {
		name = EVTOPTB_Plus_1361 # Let him have it
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				has_character_flag = potential_trouble_bastard
				NOR = {
					trait = content
					trait = humble
					trait = craven
				}
			}
		}
		piety = 10
		if = {
			limit = { trait = ambitious }
			random = {
				chance = 50
				remove_trait = ambitious
			}
		}
	}
}

# The ruler hears that their ambitious sibling has made a claim
character_event = {
	id = Plus.1362
	desc = EVTDESC_Plus_1362
	picture = GFX_evt_whispers
	
	is_triggered_only = yes
	
	immediate = {
		log = "[From.GetFullName] has made a claim to the [Root.PrimaryTitle.GetFullName], even though [From.GetSheHe] is a bastard."
	}
	
	option = {
		name = EVTOPTA_Plus_1362 # Damn him!
		ai_chance = {
			factor = 70
		}
		opinion = {
			who = FROM
			modifier = scheming_bastard
			years = 5
		}
		hidden_tooltip = {
			any_vassal = {
				character_event = { id = Plus.1363 }
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_1362 # Arrest him at once!
		trigger = {
			NOT = { trait = incapable }
			prisoner = no
			is_adult = yes
			is_liege_of = FROM
			FROM = { is_ruler = no }
		}
		ai_chance = {
			factor = 30
			modifier = {
				factor = 0
				OR = {
					trait = kind
					trait = brave
					trait = honest
					trait = just
				}
			}
			modifier = {
				factor = 1.5
				trait = cruel
			}
			modifier = {
				factor = 1.5
				trait = wroth
			}
			modifier = {
				factor = 1.5
				trait = deceitful
			}
			modifier = {
				factor = 1.5
				trait = craven
			}
		}
		tyrant_plus_1_effect = yes
		opinion = {
			who = FROM
			modifier = scheming_bastard
			years = 5
		}
		random_list = {
			50 = {
				FROM = { imprison = ROOT }
			}
			50 = {
				FROM = { banish = yes }
			}
		}
	}
}

# Vassals of the ruler consider whether to support the bastard
character_event = {
	id = Plus.1363
	desc = EVTDESC_Plus_1363
	picture = GFX_evt_whispers
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1363 # Perhaps he should rule instead
		ai_chance = {
			factor = 30
			modifier = {
				factor = 3
				religion = FROMFROM
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 2
				culture = FROMFROM
				NOT = { culture = FROM }
			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion_diff = {
						first = FROMFROM
						second = FROM
						value = 0
						as_if_liege = yes
					}
				}
			}
			modifier = {
				factor = 2
				opinion_diff = {
					first = FROMFROM
					second = FROM
					value = 20
					as_if_liege = yes
				}
			}
			modifier = {
				factor = 2
				opinion_diff = {
					first = FROMFROM
					second = FROM
					value = 40
					as_if_liege = yes
				}
			}
			modifier = {
				factor = 0.5
				is_close_relative = FROM
			}
			modifier = {
				factor = 1.5
				OR = {
					trait = bastard
					trait = legit_bastard
				}
			}
			modifier = {
				factor = 0
				any_heir_title = {
					holder = FROM
				}
			}
		}
		opinion = {
			who = FROMFROM
			modifier = sympathetic_to_cause
			multiplier = 2
			years = 5
		}
	}
	option = {
		name = EVTOPTB_Plus_1363 # No, I support my liege
		ai_chance = {
			factor = 50
			modifier = {
				factor = 3
				religion = FROM
				NOT = { religion = FROMFROM }
			}
			modifier = {
				factor = 2
				culture = FROM
				NOT = { culture = FROMFROM }
			}
			modifier = {
				factor = 2
				likes_better_than = { who = FROM than = FROMFROM }
			}
			modifier = {
				factor = 2
				dynasty = FROM
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 1.25
				opinion = { who = FROM value = 75 }
			}
			modifier = {
				factor = 0.75
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 0.75
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.75
				NOT = { opinion = { who = FROM value = -50 } }
			}
		}
		opinion = {
			who = FROMFROM
			modifier = scheming_bastard
			years = 5
		}		
	}
}

### UNKNOWN BASTARD LEARNS WHO THEIR FATHER IS

# Unknown bastard decides whether to approach their true father
character_event = {
	id = Plus.1370
	desc = EVTDESC_Plus_1370
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	min_age = 16
	max_age = 30
	capable_only = yes
	prisoner = no

	trigger = {
		real_father = { always = yes }
		#not a member of the clergy
		OR = {
			is_ruler = no
			NOT = { capital_holding = { holding_type = temple } }
		}
		#father who raised them is dead or disliked
		father_even_if_dead = {
			OR = {
				is_alive = no
				NOT = { reverse_opinion = { who = ROOT value = 0 } }
			}
		}
		#either they're smart or mother is alive
		OR = {
			mother = { is_alive = yes }
			is_smart_trigger = yes
			learning = 8
			intrigue = 8
		}
		#real father is a liege
		any_liege = {
			in_command_trigger = no
			is_abroad_trigger = no
			has_regent = no
			NOT = { is_inaccessible_trigger = yes }
			ROOT = {
				real_father = {
					character = PREVPREV
				}
			}
		}
		OR = {
			is_female = no
			AND = {
				is_female = yes
				is_married = no
			}
		}
		NOR = {
			any_heir_title =  { always = yes }
			any_child = { dynasty = ROOT }
			trait = bastard
			trait = legit_bastard
			is_dumb_trigger = yes
			trait = proud
			trait = humble
			trait = content
			trait = nun
			trait = monk
			is_inaccessible_trigger = yes
			has_character_flag = knows_real_father
		}
		is_not_busy_trigger = yes
	}
	
	weight_multiplier = {
		days = 1
		modifier = {
			factor = 20
			real_father = { ai = no }
			NOT = { has_global_flag = player_real_father_check }
		}
		modifier = {
			factor = 0.5
			is_female = yes
		}
		modifier = {
			factor = 10
			trait = ambitious
		}
		modifier = {
			factor = 5
			OR = {
				trait = quick
				trait = shrewd
			}
		}
		modifier = {
			factor = 10
			trait = genius
		}
		modifier = {
			factor = 2
			mother = {
				is_alive = yes
				same_realm = ROOT
			}
		}
		modifier = {
			factor = 2
			trait = envious
		}
		modifier = {
			factor = 2
			trait = just
		}
		modifier = {
			factor = 1.5
			trait = honest
		}
		modifier = {
			factor = 0.5
			trait = trusting
		}
		modifier = {
			factor = 0.5
			trait = shy
		}
		modifier = {
			factor = 0.5
			trait = slothful
		}
	}
	
	option = {
		name = EVTOPTA_Plus_1370 # I need to know the truth
		set_character_flag = knows_real_father
		real_father = {
			if = {
				limit = { ai = no }
				set_global_flag = player_real_father_check
			}
			character_event = { id = Plus.1371 tooltip = ask_him_the_truth }
		}
	}
	option = {
		name = EVTOPTB_Plus_1370 # No, I already have a family
		set_character_flag = knows_real_father
		if = {
			limit = { NOT = { trait = proud } }
			random = {
				chance = 30
				add_trait = proud
			}
		}
		if = {
			limit = {
				NOT = { trait = proud }
				NOT = { trait = content }
			}
			random = {
				chance = 30
				add_trait = content
			}
		}
	}
}

# Unknown bastard approaches their true father and asks for the truth
character_event = {
	id = Plus.1371
	desc = EVTDESC_Plus_1371
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	immediate = {
		log = "[From.GetFullName] has approached [Root.GetTitledName], asking if he is [From.GetHerHis] real father..."
	}
	
	option = {
		name = EVTOPTA_Plus_1371 # Tell him the truth
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.1
				trait = deceitful
			}
			modifier = {
				factor = 2
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = charitable
			}
			modifier = {
				factor = 1.5
				trait = humble
			}
			modifier = {
				factor = 1.5
				trait = trusting
			}
			modifier = {
				factor = 0.5
				trait = cruel
			}
			modifier = {
				factor = 0.5
				trait = paranoid
			}
			modifier = {
				factor = 0.5
				trait = proud
			}
		}
		FROM = { add_trait = bastard }
		if = {
			limit = {
				NOR = {
					trait = honest
					trait = deceitful
				}
			}
			random = {
				chance = 30
				add_trait = honest
				
			}
		}
		if = {
			limit = { trait = deceitful }
			remove_trait = deceitful
			
		}
		hidden_tooltip = {
			FROM = {
				hidden_tooltip = {
					father = {
						opinion = {
							who = ROOT
							modifier = opinion_cuckolded
							years = 5
						}
						ROOT = {
							mother = {
								reverse_opinion = {
									who = PREVPREV
									modifier = opinion_unfaithful_husband
									years = 5
								}
							}
						}
					}
					set_father = 0
				}
				dynasty = mother_bastard
				character_event = { id = Plus.1372 days = 1 }
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_1371 # Deny it
		trigger = {
			NOT = { intrigue = 12 }
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.1
				trait = honest
			}
		}
		if = {
			limit = {
				NOR = {
					trait = honest
					trait = deceitful
				}
			}
			random = {
				chance = 30
				add_trait = deceitful
				
			}
		}
		if = {
			limit = { trait = honest }
			remove_trait = honest
			
		}
		hidden_tooltip = {
			FROM = { character_event = { id = Plus.1373 } }
		}
	}
	option = {
		name = EVTOPTC_Plus_1371 # Convince him it's not true
		trigger = {
			intrigue = 12
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.1
				trait = honest
			}
		}
		tooltip_info = intrigue
		if = {
			limit = {
				NOR = {
					trait = honest
					trait = deceitful
				}
			}
			random = {
				chance = 30
				add_trait = deceitful
				
			}
		}
		if = {
			limit = { trait = honest }
			remove_trait = honest
			
		}
		hidden_tooltip = {
			FROM = { character_event = { id = Plus.1374 } }
		}
	}
}

# Father admits the truth
character_event = {
	id = Plus.1372
	desc = EVTDESC_Plus_1372
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_Plus_1372 # Ask to be recognized
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0
				OR = {
					trait = craven
					trait = humble
					trait = content
				}
			}
			modifier = {
				factor = 0
				is_female = yes
				is_married = yes
				spouse = { is_ruler = yes }
			}
			modifier = {
				factor = 0.1
				is_female = yes
			}
			modifier = {
				factor = 0.5
				trait = patient
			}
			modifier = {
				factor = 0.5
				trait = trusting
			}
			modifier = {
				factor = 0.5
				trait = shy
			}
			modifier = {
				factor = 5
				trait = ambitious
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 1.5
				trait = proud
			}
			modifier = {
				factor = 1.5
				trait = brave
			}
		}
		FROM = { character_event = { id = Plus.1376 tooltip = ask_to_be_recognized } }
	}
	option = {
		name = EVTOPTB_Plus_1372 # I only wanted to know the truth
		ai_chance = {
			factor = 50
			modifier = {
				factor = 0.5
				trait = ambitious
			}
		}
		set_character_flag = refused_legitimacy_attempt
		hidden_tooltip = {
			FROM = { character_event = { id = Plus.1375 } }
		}
	}
}

# Father denies it poorly
character_event = {
	id = Plus.1373
	desc = EVTDESC_Plus_1373
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_1373 # So be it
		opinion = {
			who = FROM
			modifier = denounced_child
			years = 20
		}
	}
}

# Father denies it well
character_event = {
	id = Plus.1374
	desc = EVTDESC_Plus_1374
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_1374 # Guess I was wrong
	}
}

# Bastard doesn't ask to be recognized
character_event = {
	id = Plus.1375
	desc = EVTDESC_Plus_1375
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes

	option = {
		name = OK
	}
}

# Bastard asks to be recognized
character_event = {
	id = Plus.1376
	desc = EVTDESC_Plus_1376
	picture = GFX_evt_son_asking_father
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_Plus_1351 # It is not going to happen
		trigger = {
			NOT = { diplomacy = 14 }
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				FROM = { is_female = yes }
			}
			modifier = {
				factor = 2
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.5
				is_married = no
				NOT = { num_of_children = 1 }
			}
			modifier = {
				factor = 1.5
				num_of_children = 3
			}
			modifier = {
				factor = 1.5
				num_of_children = 4
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
			modifier = {
				factor = 2
				trait = cruel
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 5
				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
		hidden_tooltip = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1352 }
			}
		}
	}
	option = {
		name = EVTOPTB_Plus_1351 # Convince him that this is for the best
		trigger = {
			diplomacy = 14
		}
		ai_chance = {
			factor = 50
			modifier = {
				factor = 2
				FROM = { is_female = yes }
			}
			modifier = {
				factor = 2
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = 0 } }
			}
			modifier = {
				factor = 1.5
				NOT = { reverse_opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 0.5
				is_married = no
				NOT = { num_of_children = 1 }
			}
			modifier = {
				factor = 1.5
				num_of_children = 3
			}
			modifier = {
				factor = 1.5
				num_of_children = 4
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
			modifier = {
				factor = 2
				trait = cruel
			}
			modifier = {
				factor = 2
				trait = proud
			}
			modifier = {
				factor = 5
				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
		tooltip_info = diplomacy
		hidden_tooltip = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1353 }
			}
		}
	}
	option = {
		name = EVTOPTC_Plus_1351 # Buy him an estate
		trigger = {
			wealth = 50
			FROM = {
				is_ruler = no
				spouse = { is_ruler = no }
				NOR = {
					has_character_modifier = estates_1
					has_character_modifier = estates_2
					has_character_modifier = estates_3
					has_character_modifier = estates_4
					has_character_modifier = estates_5
				}
			}
		}
		ai_chance = {
			factor = 25
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 0 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0
				trait = greedy
			}
			modifier = {
				factor = 0
				has_character_modifier = ai_austerity
			}
			modifier = {
				factor = 1.5
				wealth = 200
			}
			modifier = {
				factor = 1.5
				wealth = 400
			}
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 2
				trait = charitable
			}
		}
		wealth = -50
		FROM = {
			set_character_flag = refused_legitimacy_attempt
			character_event = { id = Plus.1354 tooltip = buy_off_with_estate }
		}
	}
	option = {
		name = EVTOPTD_Plus_1351 # Legitimize him
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0.75
				NOT = { age = 50 }
			}
			modifier = {
				factor = 0.5
				FROM = {
					OR = {
						trait = lunatic
						trait = possessed
						trait = drunkard
						trait = inbred
						is_weak_trigger = yes
					}
				}
			}
			modifier = {
				factor = 2
				FROM = {
					OR = {
						is_smart_trigger = yes
						diplomacy = 12
						martial = 12
						stewardship = 12
						intrigue = 12
					}
				}
			}
			modifier = {
				factor = 0.5
				NOT = { religion = FROM }
			}
			modifier = {
				factor = 0.5
				NOT = { culture = FROM }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 50 }
			}
			modifier = {
				factor = 1.5
				opinion = { who = FROM value = 75 }
			}
			modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value = 25 }
			}
			modifier = {
				factor = 0
				NOT = { reverse_opinion = { who = FROM value = -50 } }
			}
			modifier = {
				factor = 0
				NOT = { piety = 50 }
			}
			modifier = {
				factor = 4
				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}
				NOT = { has_law = enatic_succession }
				FROM = { is_female = no }
				spouse = { is_pregnant = no }
				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}
			modifier = {
				factor = 4
				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}
				NOT = { has_law = agnatic_succession }
				FROM = { is_female = yes }
				spouse = { is_pregnant = no }
				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}
			modifier = {
				factor = 1.5
				trait = kind
			}
			modifier = {
				factor = 1.5
				trait = just
			}
			modifier = {
				factor = 1.5
				trait = honest
			}
			modifier = {
				factor = 0
				num_of_children = 5
			}
		}
		piety = -50
		FROM = {
			character_event = { id = Plus.1355 tooltip = legitimize_him }
		}
		hidden_tooltip = {
			FROM = {
				mother = {
					opinion = {
						who = ROOT
						modifier = legitimized_child
						years = 10
					}
				}
			}
			spouse = {
				if = {
					limit = {
						NOT = {
							any_child = { character = FROM }	
						}
					}
					opinion = {
						who = ROOT
						modifier = legitimized_bastard
						years = 20
					}
				}
			}
			any_child = {
				limit = {
					NOT = { character = FROM }
					dynasty = ROOT
					NOT = { trait = bastard }
				}
				opinion = {
					who = ROOT
					modifier = legitimized_bastard
					months = 12
				}
			}
		}
	}
}

