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

	is_triggered_only = yes # on_yearly_pulse, random_events

	min_age = 16
	max_age = 45
	only_capable = yes
	prisoner = no

	trigger = {
		trait = bastard
		has_ambition = obj_be_legitimized
		is_inaccessible_trigger = no
		NOT = { has_character_flag = refused_legitimacy_attempt }

		real_father = {
			is_ruler = yes
			is_abroad = no
			has_regent = no
			in_command_trigger = no
			is_inaccessible_trigger = no
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.5
			is_ruler = yes
		}

		mult_modifier = {
			factor = 0.5
			is_female = yes
		}

		mult_modifier = {
			factor = 2
			trait = ambitious
		}

		mult_modifier = {
			factor = 1.33
			trait = proud
		}

		mult_modifier = {
			factor = 1.33
			trait = envious
		}

		mult_modifier = {
			factor = 0.67
			trait = patient
		}

		mult_modifier = {
			factor = 0.67
			trait = trusting
		}

		mult_modifier = {
			factor = 0.67
			trait = shy
		}
	}

	option = {
		name = EVTOPTA_Plus_1350 # It's now or never...

		real_father = {
			character_event = {
				id = Plus.1351
				days = 3
			}
		}

		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 = { diplomacy < 14 }

		hidden_effect = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1352 }
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 2
				FROM = { is_female = yes }
			}

			mult_modifier = {
				factor = 2
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 0.5

				is_married = no
				is_senior_consort_party = no
				num_of_children < 2 # FROM is my only child
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 3
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 4
			}

			mult_modifier = {
				factor = 2
				trait = paranoid
			}

			mult_modifier = {
				factor = 2
				trait = cruel
			}

			mult_modifier = {
				factor = 2
				trait = proud
			}

			mult_modifier = {
				factor = 5

				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1351 # Convince him that this is for the best
		tooltip_info = diplomacy

		trigger = { diplomacy >= 14 }

		hidden_effect = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1353 }
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 2
				FROM = { is_female = yes }
			}

			mult_modifier = {
				factor = 2
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 0.5

				is_married = no
				is_senior_consort_party = no
				num_of_children < 2 # FROM is my only child
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 3
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 4
			}

			mult_modifier = {
				factor = 2
				trait = paranoid
			}

			mult_modifier = {
				factor = 2
				trait = cruel
			}

			mult_modifier = {
				factor = 2
				trait = proud
			}

			mult_modifier = {
				factor = 5

				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
	}

	option = {
		name = EVTOPTC_Plus_1351 # Buy him an estate

		trigger = {
			wealth >= 50

			FROM = {
				is_ruler = no

				NOR = {
					any_spouse = { is_ruler = yes }
					has_character_modifier = estates_1
				}
			}
		}

		wealth = -50

		FROM = {
			show_scope_change = no

			set_character_flag = refused_legitimacy_attempt

			character_event = {
				id = Plus.1354
				tooltip = buy_off_with_estate
			}
		}

		ai_chance = {
			factor = 25

			trigger = {
				NOR = {
					trait = greedy
					has_character_modifier = ai_austerity
				}
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 1.5
				wealth = 200
			}

			mult_modifier = {
				factor = 1.5
				wealth = 400
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 2
				trait = charitable
			}
		}
	}

	option = {
		name = EVTOPTD_Plus_1351 # Legitimize him

		piety = -50

		FROM = {
			show_scope_change = no

			character_event = {
				id = Plus.1355
				tooltip = legitimize_him
			}
		}

		hidden_effect = {
			FROM = {
				mother = {
					opinion = {
						name = legitimized_child
						who = ROOT
						years = 10
					}
				}
			}

			any_spouse = {
				if = {
					limit = { NOT = { is_mother = FROM } }

					opinion = {
						name = legitimized_bastard
						who = ROOT
						years = 20
					}
				}
			}

			any_child = {
				limit = {
					dynasty = ROOT

					NOR = {
						character = FROM
						trait = bastard
					}
				}

				opinion = {
					name = legitimized_bastard
					who = ROOT
					years = 1
				}
			}
		}

		ai_chance = {
			factor = 25

			trigger = {
				piety >= 50
				num_of_children < 5

				reverse_opinion = {
					who = FROM
					value >= -50
				}
			}

			mult_modifier = {
				factor = 0.75
				age < 50
			}

			mult_modifier = {
				factor = 0.5

				FROM = {
					OR = {
						trait = lunatic
						trait = possessed
						trait = drunkard
						trait = inbred
						is_weak_trigger = yes
					}
				}
			}

			mult_modifier = {
				factor = 2

				FROM = {
					OR = {
						is_smart_trigger = yes
						diplomacy >= 12
						martial >= 12
						stewardship >= 12
						intrigue > 12
					}
				}
			}

			mult_modifier = {
				factor = 0.5
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 0.5
				NOT = { culture = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 50 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 75 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 4

				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}

				NOR = {
					has_law = enatic_succession
					any_spouse = { is_pregnant = yes }
					any_consort = { is_pregnant = yes }
				}

				FROM = { is_female = no }

				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}

			mult_modifier = {
				factor = 4

				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}

				NOR = {
					has_law = agnatic_succession
					any_spouse = { is_pregnant = yes }
					any_consort = { is_pregnant = yes }
				}

				FROM = { is_female = yes }

				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 1.5
				trait = just
			}

			mult_modifier = {
				factor = 1.5
				trait = honest
			}
		}
	}
}

# 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

		opinion = {
			name = opinion_very_disappointed
			who = FROM
			years = 5
		}

		random = {
			chance = 50
			add_trait_content_effect = yes
			remove_trait_ambitious_effect = yes
		}

		ai_chance = {
			factor = 30

			trigger = {
				NOR = {
					trait = lunatic
					trait = possessed
					trait = wroth
					trait = ambitious
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 1.5
				trait = charitable
			}

			mult_modifier = {
				factor = 1.5
				trait = patient
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1352 # This isn't right!

		set_character_flag = potential_trouble_bastard

		opinion = {
			name = denounced_child
			who = FROM
			years = 20
		}

		random = {
			chance = 20
			add_trait_wroth_effect = yes
			remove_trait_patient_effect = yes
		}

		random = {
			chance = 50
			add_trait_ambitious_effect = yes
			remove_trait_content_effect = yes
		}

		ai_chance = {
			factor = 70

			mult_modifier = {
				factor = 1.5
				trait = greedy
			}

			mult_modifier = {
				factor = 1.5
				trait = envious
			}

			mult_modifier = {
				factor = 1.5
				trait = cruel
			}

			mult_modifier = {
				factor = 1.5
				trait = just
			}
		}
	}
}

# 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 = {
			name = opinion_very_disappointed
			who = FROM
			years = 5
		}

		random = {
			chance = 25
			remove_trait_ambitious_effect = yes
		}
	}
}

# 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

		add_character_modifier = {
			name = estates_1
			duration = -1
		}

		give_minor_title = title_lord

		random = {
			chance = 50
			add_trait_content_effect = yes
			remove_trait_ambitious_effect = yes
		}

		ai_chance = {
			factor = 70
			trigger = {
				NOR = {
					trait = lunatic
					trait = possessed
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 1.5
				trait = charitable
			}

			mult_modifier = {
				factor = 1.5
				trait = patient
			}

			mult_modifier = {
				factor = 0.1

				OR = {
					trait = wroth
					trait = ambitious
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1354 # That's not enough!

		set_character_flag = potential_trouble_bastard

		add_character_modifier = {
			name = estates_1
			duration = -1
		}

		give_minor_title = title_lord

		opinion = {
			name = opinion_very_disappointed
			who = FROM
			years = 5
		}

		random = {
			chance = 20
			add_trait_wroth_effect = yes
			remove_trait_patient_effect = yes
		}

		random = {
			chance = 50
			add_trait_ambitious_effect = yes
			remove_trait_content_effect = yes
		}

		ai_chance = {
			factor = 30

			mult_modifier = {
				factor = 1.5
				trait = greedy
			}

			mult_modifier = {
				factor = 1.5
				trait = envious
			}

			mult_modifier = {
				factor = 1.5
				trait = cruel
			}

			mult_modifier = {
				factor = 1.5
				trait = just
			}
		}
	}
}

# 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 = {
			name = legitimized_me
			who = FROM
			years = 20
		}

		set_father = FROM
		set_real_father = 0

		any_child = {
			show_scope_change = no

			limit = { dynasty = ROOT }

			dynasty = FROM

			any_child = {
				show_scope_change = no
				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

	is_triggered_only = yes
	hide_window = 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
	only_capable = yes
	prisoner = no

	trigger = {
		trigger_if = {
			limit = { is_ruler = yes }
			is_theocracy = no
		}

		NOR = {
			has_strong_claim = FROMFROM
			trait = monk
			trait = nun
			government = order_government
		}

		FROMFROM = {
			is_primary_holder_title = yes
			holder_scope = { sibling = ROOT }

			trigger_if = {
				limit = { ROOT = { is_female = no } }

				trigger_if = {
					limit = { has_law = enatic_cognatic_succession }
					holder_scope = { is_female = no }
				}
				trigger_else = {
					NOT = { has_law = enatic_succession }
				}
			}
			trigger_else = {
				trigger_if = {
					limit = { has_law = cognatic_succession }
					holder_scope = { is_female = yes }
				}
				trigger_else = {
					NOT = { has_law = agnatic_succession }
				}
			}
		}
	}

	option = {
		name = EVTOPTA_Plus_1361 # The inheritance is rightfully mine!

		ai_chance = {
			factor = 50

			trigger = {
				NOR = {
					trait = content
					trait = humble
					trait = craven
				}
			}

			mult_modifier = {
				factor = 0.5

				is_ruler = yes
				NOT = { trait = ambitious }
			}

			mult_modifier = {
				factor = 0.5

				is_ruler = yes
				is_vassal_or_below_of = FROM
				NOT = { trait = ambitious }
			}

			mult_modifier = {
				factor = 0.5
				trait = charitable
			}

			mult_modifier = {
				factor = 1.5
				trait = greedy
			}

			mult_modifier = {
				factor = 1.5
				trait = envious
			}

			mult_modifier = {
				factor = 1.5
				trait = brave
			}

			mult_modifier = {
				factor = 2
				trait = proud
			}

			mult_modifier = {
				factor = 2
				trait = wroth
			}

			mult_modifier = {
				factor = 3
				trait = ambitious
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value < -50 }
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value >= 50 }
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value >= 75 }
			}

			mult_modifier = {
				factor = 0.5
				martial < 6
			}

			mult_modifier = {
				factor = 1.25
				martial >= 12
			}

			mult_modifier = {
				factor = 1.25
				martial >= 14
			}

			mult_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
		add_claim = FROMFROM
		remove_trait_silently_content_effect = yes
		add_trait_silently_ambitious_effect = yes

		FROM = { character_event = { id = Plus.1362 } }
	}

	option = {
		name = EVTOPTB_Plus_1361 # Let him have it

		piety = 10

		random = {
			chance = 50
			remove_trait_ambitious_effect = yes
		}

		ai_chance = {
			factor = 50

			trigger = {
				trigger_if = {
					limit = { has_character_flag = potential_trouble_bastard }

					OR = {
						trait = content
						trait = humble
						trait = craven
					}
				}
			}
		}
	}
}

# 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!

		opinion = {
			name = scheming_bastard
			who = FROM
			years = 5
		}

		hidden_effect = {
			any_vassal = {
				character_event = { id = Plus.1363 }
			}
		}

		ai_chance = { factor = 70 }
	}

	option = {
		name = EVTOPTB_Plus_1362 # Arrest him at once!

		trigger = {
			is_liege_of = FROM
			is_adult = yes
			is_incapable = no
			prisoner = no
			FROM = { is_ruler = no }
		}

		tyrant_plus_1_effect = yes

		opinion = {
			name = scheming_bastard
			who = FROM
			years = 5
		}

		FROM = {
			show_scope_change = no

			opinion = {
				name = opinion_tyrant
				who = ROOT
			}

			random_list = {
				50 = { imprison = ROOT }
				50 = { banish = yes }
			}
		}

		ai_chance = {
			factor = 30

			trigger = {
				NOR = {
					trait = kind
					trait = brave
					trait = honest
					trait = just
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = cruel
			}

			mult_modifier = {
				factor = 1.5
				trait = wroth
			}

			mult_modifier = {
				factor = 1.5
				trait = deceitful
			}

			mult_modifier = {
				factor = 1.5
				trait = craven
			}
		}
	}
}

# 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

		opinion = {
			name = sympathetic_to_cause
			who = FROMFROM
			years = 5
			multiplier = 2
		}

		ai_chance = {
			factor = 30

			trigger = {
				NOT = {
					any_heir_title = {
						holder = FROM
					}
				}
			}

			mult_modifier = {
				factor = 3

				religion = FROMFROM
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 2

				culture = FROMFROM
				NOT = { culture = FROM }
			}

			mult_modifier = {
				factor = 0.5

				opinion_diff = {
					first = FROMFROM
					second = FROM
					value < 0
					as_if_liege = yes
				}
			}

			mult_modifier = {
				factor = 2

				opinion_diff = {
					first = FROMFROM
					second = FROM
					value >= 20
					as_if_liege = yes
				}
			}

			mult_modifier = {
				factor = 2

				opinion_diff = {
					first = FROMFROM
					second = FROM
					value >= 40
					as_if_liege = yes
				}
			}

			mult_modifier = {
				factor = 0.5
				is_close_relative = FROM
			}

			mult_modifier = {
				factor = 1.5

				OR = {
					trait = bastard
					trait = legit_bastard
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1363 # No, I support my liege

		opinion = {
			name = scheming_bastard
			who = FROMFROM
			years = 5
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 3

				religion = FROM
				NOT = { religion = FROMFROM }
			}

			mult_modifier = {
				factor = 2

				culture = FROM
				NOT = { culture = FROMFROM }
			}

			mult_modifier = {
				factor = 2

				likes_better_than = {
					who = FROM
					than = FROMFROM
				}
			}

			mult_modifier = {
				factor = 2
				dynasty = FROM
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value < -50 }
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 0.75
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value >= 50 }
			}

			mult_modifier = {
				factor = 1.25
				opinion = { who = FROM value >= 75 }
			}
		}
	}
}

### 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
	only_capable = yes
	prisoner = no

	trigger = {
		real_father = { always = yes }
		is_dumb_trigger = no
		is_inaccessible_trigger = no

		# Not a member of the clergy
		trigger_if = {
			limit = { is_ruler = yes }
			is_priest = no
		}

		# Father who raised them is dead or disliked
		father_even_if_dead = {
			trigger_if = {
				limit = { is_alive = yes }

				reverse_opinion = {
					who = ROOT
					value < 0
				}
			}
		}

		# Either they're smart or mother is alive
		trigger_if = {
			limit = { mother = { is_alive = no } }

			OR = {
				is_smart_trigger = yes
				learning >= 8
				intrigue >= 8
			}
		}

		# Real father is a liege
		real_father = {
			is_liege_or_above_of = ROOT
			is_abroad = no
			is_incapable = no
			has_regent = no
			in_command_trigger = no
			is_inaccessible_trigger = no
		}

		# Is male or unmarried
		trigger_if = {
			limit = { is_female = yes }
			is_married = no
		}


		NOR = {
			any_heir_title =  { always = yes }
			any_child = { dynasty = ROOT }
			trait = bastard
			trait = legit_bastard
			trait = proud
			trait = humble
			trait = content
			trait = nun
			trait = monk
			has_character_flag = knows_real_father
		}
	}

	weight_multiplier = {
		days = 1

		mult_modifier = {
			factor = 20

			real_father = { ai = no }
			NOT = { has_global_flag = player_real_father_check }
		}

		mult_modifier = {
			factor = 0.5
			is_female = yes
		}

		mult_modifier = {
			factor = 10
			trait = ambitious
		}

		mult_modifier = {
			factor = 5

			OR = {
				trait = quick
				trait = shrewd
			}
		}

		mult_modifier = {
			factor = 10
			trait = genius
		}

		mult_modifier = {
			factor = 2

			mother = {
				is_alive = yes
				same_realm = ROOT
			}
		}

		mult_modifier = {
			factor = 2
			trait = envious
		}

		mult_modifier = {
			factor = 2
			trait = just
		}

		mult_modifier = {
			factor = 1.5
			trait = honest
		}

		mult_modifier = {
			factor = 0.5
			trait = trusting
		}

		mult_modifier = {
			factor = 0.5
			trait = shy
		}

		mult_modifier = {
			factor = 0.5
			trait = slothful
		}
	}

	option = {
		name = EVTOPTA_Plus_1370 # I need to know the truth

		real_father = {
			show_scope_change = no

			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

		if = {
			limit = { NOT = { trait = proud } }

			random_list = {
				30 = {
					add_trait_proud_effect = yes
					remove_trait_humble_effect = yes
				}

				30 = {
					trigger = { NOT = { trait = content } }
					add_trait_content_effect = yes
					remove_trait_ambitious_effect = yes
				}

				40 = { } # Nothing happens
			}
		}
	}

	after = {
		set_character_flag = knows_real_father
	}
}

# 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

		FROM = {
			show_scope_change = no
			add_trait = bastard
		}

		if = {
			limit = { trait = deceitful }
			remove_trait = deceitful
		}
		else_if = {
			limit = { NOT = { trait = honest } }

			random = {
				chance = 30
				add_trait_honest_effect = yes
			}
		}

		hidden_effect = {
			FROM = {
				father = {
					opinion = {
						name = opinion_cuckolded
						who = ROOT
						years = 5
					}

					ROOT = {
						mother = {
							reverse_opinion = {
								name = opinion_unfaithful_husband
								who = PREVPREV
								years = 5
							}
						}
					}
				}

				set_father = 0
				dynasty = mother_bastard

				character_event = {
					id = Plus.1372
					days = 1
				}
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 0.1
				trait = deceitful
			}

			mult_modifier = {
				factor = 2
				trait = kind
			}

			mult_modifier = {
				factor = 1.5
				trait = charitable
			}

			mult_modifier = {
				factor = 1.5
				trait = humble
			}

			mult_modifier = {
				factor = 1.5
				trait = trusting
			}

			mult_modifier = {
				factor = 0.5
				trait = cruel
			}

			mult_modifier = {
				factor = 0.5
				trait = paranoid
			}

			mult_modifier = {
				factor = 0.5
				trait = proud
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1371 # Deny it

		trigger = { intrigue < 12 }

		if = {
			limit = { trait = honest }
			remove_trait = honest
		}
		else_if = {
			limit = { NOT = { trait = deceitful } }

			random = {
				chance = 30
				add_trait_deceitful_effect = yes
			}
		}

		FROM = {
			character_event = { id = Plus.1373 }
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 0.1
				trait = honest
			}
		}
	}

	option = {
		name = EVTOPTC_Plus_1371 # Convince him it's not true
		tooltip_info = intrigue

		trigger = { intrigue >= 12 }

		if = {
			limit = { trait = honest }
			remove_trait = honest
		}
		else_if = {
			limit = { NOT = { trait = deceitful } }

			random = {
				chance = 30
				add_trait_deceitful_effect = yes
			}
		}

		FROM = {
			character_event = { id = Plus.1374 }
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 0.1
				trait = honest
			}
		}
	}
}

# 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

		FROM = {
			show_scope_change = no

			character_event = {
				id = Plus.1376
				tooltip = ask_to_be_recognized
			}
		}

		ai_chance = {
			factor = 50

			trigger = {
				NOR = {
					trait = craven
					trait = humble
					trait = content
				}

				NAND = {
					is_female = yes
					is_married = yes
					any_spouse = { is_ruler = yes }
				}
			}

			mult_modifier = {
				factor = 0.1
				is_female = yes
			}

			mult_modifier = {
				factor = 0.5
				trait = patient
			}

			mult_modifier = {
				factor = 0.5
				trait = trusting
			}

			mult_modifier = {
				factor = 0.5
				trait = shy
			}

			mult_modifier = {
				factor = 5
				trait = ambitious
			}

			mult_modifier = {
				factor = 1.5
				trait = envious
			}

			mult_modifier = {
				factor = 1.5
				trait = proud
			}

			mult_modifier = {
				factor = 1.5
				trait = brave
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1372 # I only wanted to know the truth

		hidden_effect = {
			set_character_flag = refused_legitimacy_attempt

			FROM = {
				character_event = { id = Plus.1375 }
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 0.5
				trait = ambitious
			}
		}
	}
}

# 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 = {
			name = denounced_child
			who = FROM
			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

	ai = no

	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

	ai = no

	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 = { diplomacy < 14 }

		hidden_effect = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1352 }
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 2
				FROM = { is_female = yes }
			}

			mult_modifier = {
				factor = 2
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 0.5

				is_married = no
				is_senior_consort_party = no
				num_of_children < 2
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 3
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 4
			}

			mult_modifier = {
				factor = 2
				trait = paranoid
			}

			mult_modifier = {
				factor = 2
				trait = cruel
			}

			mult_modifier = {
				factor = 2
				trait = proud
			}

			mult_modifier = {
				factor = 5

				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_1351 # Convince him that this is for the best
		tooltip_info = diplomacy

		trigger = { diplomacy >= 14 }

		hidden_effect = {
			FROM = {
				set_character_flag = refused_legitimacy_attempt
				character_event = { id = Plus.1353 }
			}
		}

		ai_chance = {
			factor = 50

			mult_modifier = {
				factor = 2
				FROM = { is_female = yes }
			}

			mult_modifier = {
				factor = 2
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < 0 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value < -25 }
			}

			mult_modifier = {
				factor = 0.5

				is_married = no
				is_senior_consort_party = no
				num_of_children < 2
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 3
			}

			mult_modifier = {
				factor = 1.5
				num_of_children >= 4
			}

			mult_modifier = {
				factor = 2
				trait = paranoid
			}

			mult_modifier = {
				factor = 2
				trait = cruel
			}

			mult_modifier = {
				factor = 2
				trait = proud
			}

			mult_modifier = {
				factor = 5

				current_heir = {
					is_child_of = ROOT
					NOT = { is_older_than = FROM }
				}
			}
		}
	}

	option = {
		name = EVTOPTC_Plus_1351 # Buy him an estate

		trigger = {
			wealth >= 50

			FROM = {
				is_ruler = no

				NOR = {
					any_spouse = { is_ruler = yes }
					has_character_modifier = estates_1
				}
			}
		}

		wealth = -50

		FROM = {
			show_scope_change = no

			set_character_flag = refused_legitimacy_attempt

			character_event = {
				id = Plus.1354
				tooltip = buy_off_with_estate
			}
		}

		ai_chance = {
			factor = 25

			trigger = {
				NOR = {
					trait = greedy
					has_character_modifier = ai_austerity
				}
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 0 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 1.5
				wealth >= 200
			}

			mult_modifier = {
				factor = 1.5
				wealth >= 400
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 2
				trait = charitable
			}
		}
	}

	option = {
		name = EVTOPTD_Plus_1351 # Legitimize him

		ai_chance = {
			factor = 25

			trigger = {
				piety >= 50
				num_of_children < 5

				reverse_opinion = {
					who = FROM
					value >= -50
				}
			}

			mult_modifier = {
				factor = 0.75
				age < 50
			}

			mult_modifier = {
				factor = 0.5

				FROM = {
					OR = {
						trait = lunatic
						trait = possessed
						trait = drunkard
						trait = inbred
						is_weak_trigger = yes
					}
				}
			}

			mult_modifier = {
				factor = 2

				FROM = {
					OR = {
						is_smart_trigger = yes
						diplomacy >= 12
						martial >= 12
						stewardship >= 12
						intrigue >= 12
					}
				}
			}

			mult_modifier = {
				factor = 0.5
				NOT = { religion = FROM }
			}

			mult_modifier = {
				factor = 0.5
				NOT = { culture = FROM }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 25 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 50 }
			}

			mult_modifier = {
				factor = 1.5
				opinion = { who = FROM value >= 75 }
			}

			mult_modifier = {
				factor = 1.5
				reverse_opinion = { who = FROM value >= 25 }
			}

			modifier = {
				factor = 4

				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}

				FROM = { is_female = no }

				NOR = {
					has_law = enatic_succession
					any_spouse = { is_pregnant = yes }
				}

				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}

			mult_modifier = {
				factor = 4

				OR = {
					has_law = succ_gavelkind
					has_law = succ_primogeniture
					has_law = succ_seniority
				}

				FROM = { is_female = yes }

				NOR = {
					has_law = agnatic_succession
					any_spouse = { is_pregnant = yes }
				}

				current_heir = {
					NOT = { is_child_of = ROOT }
				}
			}

			mult_modifier = {
				factor = 1.5
				trait = kind
			}

			mult_modifier = {
				factor = 1.5
				trait = just
			}

			mult_modifier = {
				factor = 1.5
				trait = honest
			}
		}

		piety = -50

		FROM = {
			show_scope_change = no

			character_event = {
				id = Plus.1355
				tooltip = legitimize_him
			}
		}

		hidden_effect = {
			FROM = {
				mother = {
					opinion = {
						name = legitimized_child
						who = ROOT
						years = 10
					}
				}
			}

			any_spouse = {
				if = {
					limit = { NOT = { is_mother = FROM } }

					opinion = {
						name = legitimized_bastard
						who = ROOT
						years = 20
					}
				}
			}

			any_child = {
				limit = {
					dynasty = ROOT

					NOR = {
						character = FROM
						trait = bastard
					}
				}

				opinion = {
					name = legitimized_bastard
					who = ROOT
					years = 1
				}
			}
		}
	}
}

