# Most events have been moved to childhood_personality_traits_events.txt

###################################
#
# Events for Guardian
#
# Id 2000-2499 and 38100 - 38299 is reserved
#
#
###################################
#
# Written by Sara Wendel-rtqvist & Henrik Fhraeus
# heavily revised by Johan Andersson
#
###################################

# Vassal wants to be guardian for liege's child
character_event = {
	id = 2480
	desc = EVTDESC2480
	picture = GFX_evt_council

	is_triggered_only = yes # on_yearly_pulse, random_events, guardian_offer

	only_playable = yes
	min_age = 20
	max_age = 70
	prisoner = no
	only_capable = yes

	trigger = {
		always = no # Not used in Plus
		independent = no
		health >= 4

		NOR = {
			trait = stressed
			trait = depressed
			trait = leper

			# Not if already having a ward
			any_ward = {
				age >= 6
			}
		}

		liege = {
			any_child = {
				age >= 6
				has_guardian = no
				is_ruler = no
				is_adult = no
				prisoner = no

				trigger_if = {
					limit = { is_female = yes }
					NOT = { religion_group = muslim }
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.2
			trait = slothful
		}

		mult_modifier = {
			factor = 0.2
			trait = shy
		}

		mult_modifier = {
			factor = 1.67
			trait = diligent
		}

		mult_modifier = {
			factor = 1.67
			trait = gregarious
		}

		mult_modifier = {
			factor = 2
			trait = ambitious
		}

		mult_modifier = {
			factor = 2
			martial >= 12
		}

		mult_modifier = {
			factor = 2
			stewardship >= 12
		}
	}

	option = {
		name = EVTOPTA2480

		liege = {
			show_scope_change = no

			letter_event = {
				id = 2481
				tooltip = EVTTOOLTIP2481
			}
		}
	}

	option = {
		name = EVTOPTB2480

		ai_chance = { factor = 0 }
	}
}

# The liege is asked by a vassal to let him/her raise the child
letter_event = {
	id = 2481
	desc = EVTDESC2481

	is_triggered_only = yes

	option = {
		name = EVTOPTA2481

		random_child = {
			show_scope_change = no

			limit = {
				age >= 6
				is_adult = no
				has_guardian = no
				prisoner = no
			}

			save_event_target_as = guardian_child

			character_event = {
				id = 2484
				tooltip = EVTTOOLTIP2484
			}
		}

		FROM = {
			show_scope_change = no

			letter_event = {
				id = 2482
				tooltip = EVTTOOLTIP2482
			}
		}
	}

	option = {
		name = EVTOPTB2481

		FROM = {
			show_scope_change = no

			letter_event = {
				id = 2483
				tooltip = EVTTOOLTIP2483
			}
		}
	}
}

# The vassal becomes the guardian of the child
letter_event = {
	id = 2482
	desc = EVTDESC2482

	is_triggered_only = yes

	option = {
		name = EXCELLENT

		event_target:guardian_child = {
			show_scope_change = no

			set_guardian = ROOT
		}

		opinion = {
			name = opinion_granted_guardianship
			who = FROM
			years = 2
		}
	}
}

# The vassal's request is denied
letter_event = {
	id = 2483
	desc = EVTDESC2483

	is_triggered_only = yes

	option = {
		name = EVTOPTA2483

		opinion = {
			name = opinion_denied_guardianship
			who = FROM
			years = 2
		}
	}
}

# The child is informed of the guardianship
character_event = {
	id = 2484
	desc = EVTDESC2484
	picture = GFX_evt_council

	is_triggered_only = yes

	ai = no

	option = {
		name = EVTOPTA2484
	}
}