namespace = trayar
character_event = {
id = trayar.1
desc = "EVTDESCTRAYAR1"
picture = GFX_roy_training
border = GFX_event_normal_frame_war
	
	only_rulers = yes
	min_age = 16
	prisoner = no
	only_capable = yes
	
	mean_time_to_happen = {
		months = 3
	}
	trigger = {
		OR = {
			tier = KING
			tier = EMPEROR
			ai = no
		}
		capital_holding = { has_building = ca_training_yard }
		NOT = { has_character_flag = training_yard_obtained }
	}
	immediate = { set_character_flag = training_yard_obtained }
	option = { 
		tooltip_info = martial
		trigger = {
			OR = {
				trait = misguided_warrior
				trait = tough_soldier
				trait = skilled_tactician
				trait = brilliant_strategist
			}
		}
		name = training_yard_yes_power
		change_martial = 1
		health = 1
	}	
	option = { 
		name = training_yard_yes
		change_martial = 1
	}	
	option = {
		tooltip_info = slothful
		trigger = {
			trait = slothful
		}
		name = training_yard_slothful
	}
	option = {
		tooltip_info = weak
		trigger = {
			trait = weak
		}
		name = weak_decides_to_train_hard
		hidden_tooltip = {
			character_event = { id = trayar.5 days = 700 random = 400 }
		}
	}
}
character_event = {
id = trayar.2
desc = "EVTDESCTRAYAR2"
picture = GFX_roy_training
border = GFX_event_normal_frame_diplomacy
	
	ai = no
	only_rulers = yes
	min_age = 16
	prisoner = no
	only_capable = yes

	mean_time_to_happen = {
		months = 10 
	}
	trigger = {
		capital_holding = { has_building = ca_training_yard }
		any_courtier = {
			has_job_title = job_marshal
		}
		NOT = { has_character_flag = training_yard_obtained_2 }
	}
	immediate = {
		set_character_flag = training_yard_obtained_2
	}
	option = {
		name = allow_training_yard
		any_courtier = {
			limit = {
				prisoner = no
				has_job_title = job_marshal
			}
			opinion = {
				modifier = training_yard_pos
				who = ROOT
				years = 5
			}
			change_martial = 1
		}
	}
	option = {
		name = dont_allow_training
		any_courtier = {
			limit = {
				prisoner = no
				has_job_title = job_marshal
			}
			opinion = {
				modifier = training_yard_neg
				who = ROOT
				years = 2
			}
		}
	}
}
character_event = {
id = trayar.3
desc = "EVTDESCTRAYAR3"
picture = GFX_roy_training
border = GFX_event_normal_frame_diplomacy
	
	only_rulers = yes
	min_age = 16
	prisoner = no
	only_capable = yes

	mean_time_to_happen = {
		years = 10
	}
	trigger = {
		OR = {
			tier = KING
			tier = EMPEROR
			ai = no
			is_patrician = yes
		}
		OR = {
			capital_holding = { has_building = ca_training_yard }
			family_palace = { has_building = fp_bowyer_2 }
		}
		trait = slothful
		trait = ambitious
	}
	option = {
		name = ambition_removes_slothfulness
		remove_trait = slothful
	}
}
character_event = {
id = trayar.4
desc = "EVTDESCTRAYAR4"
picture = GFX_roy_training
border = GFX_event_normal_frame_war
	
	ai = no
	only_rulers = yes
	min_age = 16
	prisoner = no
	only_capable = yes

	mean_time_to_happen = {
		years = 100
		modifier = {
			factor = 0.5
			trait = impaler
		}	
		modifier = {
			factor = 0.5
			trait = cruel
		}
		modifier = {
			factor = 0.5
			trait = wroth
		}
		modifier = {
			factor = 2
			trait = patient
		}	
		modifier = {
			factor = 2
			trait = temperate
		}	
	}
	trigger = {
		OR = {
			capital_holding = { has_building = ca_training_yard }
			family_palace = { has_building = fp_bowyer_2 }
		}
		NOT = { has_character_flag = impaler_broke_stuff }
	}
	immediate = {
		set_character_flag = impaler_broke_stuff
	}
	option = {
		trigger = {
			OR = {
				trait = impaler
				trait = cruel
			}
		}
		custom_tooltip = { text = impaler_or_cruel_trait }
		name = impaler_breaks_dummies
		piety = -30
	}
	option = {
		trigger = {
			NOT = {
				trait = impaler
				trait = cruel
			}
		}
		name = normal_breaks_dummies
		wealth = -10
		random = {
			add_trait = wroth
			chance = 25
		}
	}
}
character_event = {
id = trayar.5
desc = "EVTDESCTRAYAR5"
picture = GFX_roy_training
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = weak_got_stronger
		remove_trait = weak
	}
}
character_event = {
id = trayar.6
hide_window = yes

	max_age = 14
	prisoner = no
	
	trigger = {
		guardian = {
			ai = no
			is_ruler = yes
			OR = {
				capital_holding = { has_building = ca_training_yard }
				family_palace = { has_building = fp_bowyer_2 }
			}
		}
		NOT = { has_character_flag = training_yard_ward_event }
	}
	mean_time_to_happen = {
		years = 50
	}
	option = {
		set_character_flag = training_yard_ward_event
		name = OK
		add_trait = cruel
		guardian = {
			character_event = { id = trayar.7 }
		}
	}
}
character_event = {
id = trayar.7
desc = "EVTDESCTRAYAR7"
picture = GFX_evt_child_sword
border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		name = encourage_cruel_ward
		custom_tooltip = { text = ward_stays_cruel }
	}
	option = {
		name = punish_cruel_ward
		FROM = {
			opinion = {
				modifier = punished_cruel_trayar
				who = ROOT
				years = 1
			}
		}
		random_list = {
			70 = {
				FROM = {
					remove_trait = cruel
					hidden_tooltip = {
						character_event = { id = trayar.8 }
					}
				}
			}
			30 = {
				FROM = {
					add_trait = wroth
					hidden_tooltip = {
						character_event = { id = trayar.9 }
					}
				}
			}
		}
	}
	option = {
		name = talk_to_cruel_ward
		FROM = {
			remove_trait = cruel
		}
		random_list = {
			50 = {
				FROM = {
					add_trait = kind
					hidden_tooltip = {
						character_event = { id = trayar.10 }
					}
				}
			}
			50 = {
				FROM = {
					add_trait = craven
					hidden_tooltip = {
						character_event = { id = trayar.11 }
					}
				}
			}
		}
	}
}
character_event = {
id = trayar.8
hide_window = yes
	
	is_triggered_only = yes
	
	option = {
		name = OK
		guardian = {
			character_event = { id = trayar.12 }
		}
	}
}
character_event = {
	id = trayar.9
	hide_window = yes
	
	is_triggered_only = yes
	
	option = {
		name = OK
		guardian = {
			character_event = { id = trayar.13 }
		}
	}
}
character_event = {
	id = trayar.10
	hide_window = yes
	
	is_triggered_only = yes
	
	option = {
		name = OK
		guardian = {
			character_event = { id = trayar.14 }
		}
	}
}
character_event = {
	id = trayar.11
	hide_window = yes
	
	is_triggered_only = yes
	
	option = {
		name = OK
		guardian = {
			character_event = { id = trayar.15 }
		}
	}
}
# Punishment worked
character_event = {
id = trayar.12
desc = "EVTDESCTRAYAR12"
picture = GFX_evt_child_play
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	option = {
		name = trayar12option
	}
}
# Punishment didn't work, ward becomes wroth
character_event = {
id = trayar.13
desc = "EVTDESCTRAYAR13"
picture = GFX_evt_child_sword
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	option = {
		name = trayar13option
	}
}
# Talking worked, ward becomes kind
character_event = {
id = trayar.14
desc = "EVTDESCTRAYAR14"
picture = GFX_evt_child_play
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	option = {
		name = trayar14option
	}
}
# Talking wasn't succesful, ward becomes craven
character_event = {
id = trayar.15
desc = "EVTDESCTRAYAR15"
picture = GFX_evt_child_bully
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	option = {
		name = trayar15option
	}
}
character_event = {
id = trayar.16
hide_window = yes
	
	is_triggered_only = yes
	
	option = {
		set_character_flag = marshal_trayar_tutor
		name = OK
		liege = {
			character_event = { id = trayar.17 }
		}
	}
}
#Martial Improve starts
character_event = {
id = trayar.17
desc = "EVTDESCTRAYAR17"
picture = GFX_roy_training
border = GFX_event_normal_frame_war
	
	is_triggered_only = yes

	option = {
		name = martial_improve_start_option
		hidden_tooltip = {
			FROM = {
				character_event = { id = trayar.18 days = 350 random = 25 }
			}
		}
	}
}
character_event = {
id = trayar.18
hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		liege = {
			has_character_flag = improving_martial_education
		}
	}
	option = {
		name = OK
		liege = {
			character_event = { id = trayar.19 }
		}
	}
}
#Martial Improve ends
character_event = {
id = trayar.19
desc = "EVTDESCTRAYAR19"
picture = GFX_roy_training
border = GFX_event_normal_frame_war

	is_triggered_only = yes

	option = {
		clr_character_flag = improving_martial_education
		name = martial_improve_ends_option
		remove_trait = misguided_warrior
		add_trait = tough_soldier
		FROM = {
			clr_character_flag = marshal_trayar_tutor
		}
	}
}
#Martial Improve ends abruplty
character_event = {
id = trayar.20
desc = "EVTDESCTRAYAR20"
picture = GFX_roy_training
border = GFX_event_normal_frame_war
	
	ai = no
	only_rulers = yes
	min_age = 16
	prisoner = no
	only_capable = yes
	
	trigger = {
		any_courtier = {
			has_job_title = job_marshal
			NOT = { has_character_flag = marshal_trayar_tutor }
		}
		has_character_flag = improving_martial_education
	}
	option = {
		clr_character_flag = improving_martial_education
		name = martial_improve_ends_abruptly_option
	}
}
