##############################
# STEWARD
#
# Job: action_squeeze_peasants
# 	920: The Steward collects a tithe and sends it to his liege
# 	921: The peasants attempt to kill the Steward (Gets away, is wounded, is maimed, is killed)
#
# Job: action_oversee_construction
# 	923: Good Master Builder
# 	924: Sabotage
#
# Job: action_settle_tribe
# 	925: Local culture changes
# 	926: Steward wounded
# 	927: Steward maimed
# 	928: Steward killed
#
##############################


##############################
# STEWARD
# JOB: action_squeeze_peasants
##############################

# 920: The Steward collects a tithe and sends it to his liege
character_event = {
	id = 920
	title = "EVTNAME920"
	desc = "EVTDESC920"
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_squeeze_peasants
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			county = {
				is_occupied = no
			}
			owner = {
				job_treasurer = {
					character = ROOT
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 5
		
		modifier = {
			factor = 1.25
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			stewardship = 10
		}
		modifier = {
			factor = 0.75
			stewardship = 11
		}
		modifier = {
			factor = 0.75
			stewardship = 12
		}
		modifier = {
			factor = 0.75
			stewardship = 13
		}
	}
	
	option = {
		name = "EVTOPTA920"
		liege = { letter_event = { id = 20200 tooltip = "EVTTOOLTIP20200" } }
	}
}

# 20200: The liege is informed
character_event = {
	id = 20200
	desc = EVTDESC20200
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA20200
		scaled_wealth = 0.5
	}
}


# 921: The peasants attempt to kill the Steward (Gets away, is wounded, is killed)
character_event = {
	id = 921
	title = "EVTNAME921"
	desc = "EVTDESC921"
	picture = GFX_evt_peasants

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_squeeze_peasants
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			owner = {
				job_treasurer = {
					character = ROOT
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 360
	
		modifier = {
			factor = 0.75
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 1.25
			stewardship = 10
		}
		modifier = {
			factor = 1.25
			stewardship = 11
		}
		modifier = {
			factor = 1.25
			stewardship = 12
		}
		modifier = {
			factor = 1.25
			stewardship = 13
		}
		modifier = {
			factor = 0.5
			location = {
				revolt_risk = 0.01
			}
		}
		modifier = {
			factor = 0.5
			location = {
				revolt_risk = 0.02
			}
		}
		modifier = {
			factor = 0.75
			location = {
				NOT = { culture = ROOT }
			}
		}
	}
	
	option = {
		name = "EVTOPTA921"
		trigger = {
			NOT = { stewardship = 5 }
		}
		random_list = {
			25 = { character_event = { id = 20210 tooltip = "EVTTOOLTIP20210" } }
			50 = {
				character_event = { id = 20211 tooltip = "EVTTOOLTIP20211" }
				hidden_tooltip = {
					liege = { letter_event = { id = 20212 } }
				}
			}
			25 = {
				death = {
					death_reason = death_rabble
				}
				hidden_tooltip = {
					liege = { character_event = { id = 20213 } }
				}
			}
		}
	}
	option = {
		name = "EVTOPTA921"
		tooltip_info = stewardship
		trigger = {
			stewardship = 5
			NOT = { stewardship = 10 }
		}
		random_list = {
			35 = { character_event = { id = 20210 tooltip = "EVTTOOLTIP20210" } }
			50 = {
				character_event = { id = 20211 tooltip = "EVTTOOLTIP20211" }
				hidden_tooltip = {
					liege = { letter_event = { id = 20212 } }
				}
			}
			15 = {
				death = {
					death_reason = death_rabble
				}
				hidden_tooltip = {
					liege = { character_event = { id = 20213 } }
				}
			}
		}
	}
	option = {
		name = "EVTOPTA921"
		tooltip_info = stewardship
		trigger = {
			stewardship = 10
		}
		random_list = {
			50 = { character_event = { id = 20210 tooltip = "EVTTOOLTIP20210" } }
			40 = {
				character_event = { id = 20211 tooltip = "EVTTOOLTIP20211" }
				hidden_tooltip = {
					liege = { letter_event = { id = 20212 } }
				}
			}
			10 = {
				death = {
					death_reason = death_rabble
				}
				hidden_tooltip = {
					liege = { character_event = { id = 20213 } }
				}
			}
		}
	}
}

# 20210: Steward gets away
character_event = {
	id = 20210
	desc = "EVTDESC20210"
	picture = GFX_evt_peasants
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20210"
		prestige = -10
	}
}

# 20211: Steward gets wounded
character_event = {
	id = 20211
	desc = "EVTDESC20211"
	picture = GFX_evt_peasants
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA20211
		add_trait = wounded
		custom_tooltip = { text = EVTTOOLTIP20212 }
	}
}

# 20212: Inform the Liege about wounding
character_event = {
	id = 20212
	desc = EVTDESC20212
	picture = GFX_evt_carriage
	
	is_triggered_only = yes
	
	notification = yes
	
	option = {
		name = EVTOPTA20212
#		prestige = -10
	}
}

# 20213: Inform the Liege about death
character_event = {
	id = 20213
	desc = EVTDESC20213
	picture = GFX_evt_death
	
	is_triggered_only = yes
	
	notification = yes
	
	option = {
		name = EVTOPTA20213
#		prestige = -15
	}
}

# 20214: Increased revolt risk
character_event = {
	id = 20214
	desc = "EVTDESC20214"
	picture = GFX_evt_peasants

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_squeeze_peasants
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			owner = {
				job_treasurer = {
					character = ROOT
				}
			}
			NOT = { has_province_modifier = high_taxes }
		}
	}
	
	mean_time_to_happen = {
		months = 240
	
		modifier = {
			factor = 0.75
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 1.25
			stewardship = 10
		}
		modifier = {
			factor = 1.25
			stewardship = 11
		}
		modifier = {
			factor = 1.25
			stewardship = 12
		}
		modifier = {
			factor = 1.25
			stewardship = 13
		}
		modifier = {
			factor = 0.75
			location = {
				revolt_risk = 0.01
			}
		}
		modifier = {
			factor = 0.75
			location = {
				revolt_risk = 0.02
			}
		}
		modifier = {
			factor = 0.75
			location = {
				NOT = { culture = ROOT }
			}
		}
		modifier = {
			factor = 0.75
			location = {
				NOT = { religion = ROOT }
			}
		}
	}

	option = {
		name = "EVTOPTA20214"
		hidden_tooltip = {
			location = {
				# Inform barons about the rebels
				owner = {
					if = {
						limit = {
							is_liege_of = ROOT
						}
						set_character_flag = liege_informed
					}
				}
				any_province_lord = {
					limit = {
						NOT = { has_character_flag = liege_informed }
						ai = no
					}
					character_event = { id = 20215 days = 1 }
				}
				# Inform liege
				ROOT = {
					liege = { letter_event = { id = 20216 } }
					clr_character_flag = liege_informed
				}
			}
		}
	}
}

# 20215: Inform province lords
character_event = {
	id = 20215
	desc = "EVTDESC20215"
	picture = GFX_evt_peasants
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20215"
	}
}

# 20214: Inform liege
letter_event = {
	id = 20216
	desc = "EVTDESC20216"
	border = GFX_event_letter_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20216"
		FROM = {
			location = {
				# Increase revolt risk
				add_province_modifier = {
					name = high_taxes
					duration = 365
				}
				# Province barons
				any_province_lord = {
					limit = {
						NOT = { character = ROOT }
						NOT = { character = FROM }
					}
					opinion = {
						who = ROOT
						modifier = opinion_irritated
						months = 12
					}
				}
			}
		}
	}
}


##############################
# STEWARD
# JOB: action_oversee_construction
##############################

# 923: Good Master Builder
character_event = {
	id = 923
	title = "EVTNAME923"
	desc = "EVTDESC923"
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_economy

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_oversee_construction
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		NOT = { has_character_modifier = master_builder }
		location = {
			owner = {
				job_treasurer = {
					character = ROOT
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 13
		
		modifier = {
			factor = 1.25
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			stewardship = 10
		}
		modifier = {
			factor = 0.75
			stewardship = 11
		}
		modifier = {
			factor = 0.75
			stewardship = 12
		}
		modifier = {
			factor = 0.75
			stewardship = 13
		}
	}
	
	option = {
		name = "EVTOPTA923"
		add_character_modifier = {
			name = master_builder
			duration = -1
		}
		liege = { letter_event = { id = 20230 tooltip = "EVTTOOLTIP20230" } }
	}
}

# 20230: Liege get a letter
letter_event = {
	id = 20230
	desc = "EVTDESC20230"
	border = GFX_event_letter_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20230"
		hidden_tooltip = {
			FROM = {
				remove_character_modifier = master_builder
			}
		}
		FROM = {
			add_character_modifier = {
				name = master_builder
				duration = -1
			}
		}
		if = {
			limit = {
				has_dlc = "Reapers"
			}
			custom_tooltip = {
				text = increase_prosperity_custom_tooltip
				hidden_tooltip = {
					FROM = {
						location = {
							change_variable = { which = prosperity_value value = 6 }
						}
					}
				}
			}
		}
	}
}

# 924: Sabotage
character_event = {
	id = 924
	title = "EVTNAME924"
	desc = "EVTDESC924"
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_economy
	
	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_oversee_construction
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			any_province_lord = {
				independent = no
				NOT = { is_liege_of = ROOT }
				liege = {
					NOT = { reverse_opinion = { who = ROOT value = -20 } }
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 120
		
		modifier = {
			factor = 0.75
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 1.25
			stewardship = 10
		}
		modifier = {
			factor = 1.25
			stewardship = 11
		}
		modifier = {
			factor = 1.25
			stewardship = 12
		}
		modifier = {
			factor = 1.25
			stewardship = 13
		}
	}
	
	option = {
		name = "EVTOPTA924"
		location = {
			random_province_lord = {
				limit = {
					independent = no
					NOT = { is_liege_of = ROOT }
					liege = {
						NOT = { reverse_opinion = { who = ROOT value = -20 } }
					}
				}
				character_event = { id = 20240 tooltip = "EVTTOOLTIP20240" }
			}
		}
	}
}

# 20240: Noble sabotages building
character_event = {
	id = 20240
	desc = "EVTDESC20240"
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20240"
		ai_chance = { factor = 100 }
		hidden_tooltip = {
			if = {
				limit = {
					FROM = {
						liege = {
							job_spymaster = {
								intrigue = 12
							}
						}
					}
				}
				FROM = {
					liege = {
						job_spymaster = {
							character_event = { id = 20243 days = 14 }
						}
					}
				}
			}
		}
		FROM = {
			character_event = { id = 20241 days = 4 tooltip = "EVTTOOLTIP20241"	}
		}
	}
	option = {
		name = "EVTOPTB20240"
		ai_chance = { factor = 0 }
		prestige = 5
	}
}

# 20241: Sabotage!
character_event = {
	id = 20241
	desc = "EVTDESC20241"
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20241"
		liege = { letter_event = { id = 20242 tooltip = "EVTTOOLTIP20242" } }
	}
}

# 20242: The liege is informed
letter_event = {
	id = 20242
	desc = "EVTDESC20242"
	border = GFX_event_letter_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20242"
		FROM = {
			add_character_modifier = {
				name = sabotaged_building
				duration = 365
			}
		}
	}
}

# 20243: Spymaster finds out who's behind the sabotage
character_event = {
	id = 20243
	desc = "EVTDESC20243"
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20243"
		liege = { letter_event = { id = 20244 tooltip = "EVTTOOLTIP20244" } }
	}
}

# 20244: The liege is informed by his spymaster who is behind the sabotage
letter_event = {
	id = 20244
	desc = "EVTDESC20244"
	border = GFX_event_letter_frame_intrigue
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA20244"
		ai_chance = { factor = 100 }
		FROM = {
			FROM = {
				reverse_opinion = {
					modifier = opinion_dishonorable
					who = ROOT
					years = 2
				}
			}
		}
	}
	option = {
		name = "EVTOPTB20244"
		ai_chance = { factor = 0 }
	}
}

##############################
# STEWARD
# JOB: action_settle_tribe
##############################

# 925: The Steward has settled the tribe
character_event = {
	id = 925
	title = EVTNAME925
	desc = EVTDESC925
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_economy

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_settle_tribe
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			county = {
				is_occupied = no
			}
			owner = {
				job_treasurer = {
					character = ROOT
				}
				NOT = { culture = PREV }
			}
			OR = {
				NOT = { 
					has_game_rule = {
						name = culture_conversion
						value = restricted
					}
				}
				any_neighbor_province = { ROOT = { liege = { culture = PREVPREV } } }
				any_neighbor_province = { port = yes } 
			}
		}
	}
	
	mean_time_to_happen = {
		months = 600
		
		modifier = {
			factor = 3
			OR = {
				has_game_rule = {
					name = culture_conversion
					value = slower_normal
				}
				has_game_rule = {
					name = culture_conversion
					value = faster_melting_pots_and_slower_normal
				}
			}
		}
		
		modifier = {
			factor = 3.0
			liege = {
				tier = count
			}
		}
		
		modifier = {
			factor = 1.25
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			stewardship = 9
		}
		modifier = {
			factor = 0.75
			stewardship = 10
		}
		modifier = {
			factor = 0.75
			stewardship = 11
		}
		modifier = {
			factor = 0.75
			stewardship = 12
		}
		modifier = {
			factor = 0.75
			stewardship = 13
		}
		modifier = { #Roman Renaissance.
			factor = 0.5
			has_global_flag = flag_started_roman_renaissance
			liege = { culture = roman }
			location = { county = { culture_group = latin } }
		}
		modifier = {
			factor = 0.75
			liege = {
				culture = roman
	    		any_owned_bloodline = {
    				has_bloodline_flag = bloodline_faster_roman
    			}
			}
		}
		modifier = { #Greek culture is more impervious to Romanization.
			factor = 2
			liege = { culture = roman }
			location = { county = { culture = greek } }
		}
		modifier = {
			factor = 0.25
			location = {
				county = {
					OR = {
						culture = zhangzhung
						culture = sumpa
					}
					owner = {
						culture = bodpa
						OR = {
							any_owned_bloodline = {
								has_bloodline_flag = bloodline_songtsen_gampo
							}
							top_liege = {
								any_owned_bloodline = {
									has_bloodline_flag = bloodline_songtsen_gampo
								}
							}
						}
					}
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA925
		
		prestige = 50
		hidden_tooltip  = {
			liege = { character_event = { id = 20205 } }
		}
	}
}

# 20205: The liege is informed
character_event = {
	id = 20205
	desc = EVTDESC20205
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA20205
		FROM = {
			location = {
				culture = ROOT
				if = {
					limit = {
						has_province_modifier = nomad_agitation
					}
					remove_province_modifier = nomad_agitation
				}
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_grateful
			months = 60
		}
	}
}

# 20206: The Steward is attacked and wounded
character_event = {
	id = 20206
	title = EVTNAME20206
	desc = EVTDESC20206
	picture = GFX_evt_peasants
	border = GFX_event_normal_frame_economy

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_settle_tribe
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		location = {
			owner = {
				job_treasurer = {
					character = ROOT
				}
				NOT = { culture = PREV }
			}
			OR = { #Otherwise if the Settle Tribe is picked and the province cannot be converted, the Steward will always be attacked no matter what.
				NOT = { 
					has_game_rule = {
						name = culture_conversion
						value = restricted
					}
				}
				any_neighbor_province = { ROOT = { liege = { culture = PREVPREV } } }
				any_neighbor_province = { port = yes } 
			}
		}
	}
	
	mean_time_to_happen = {
		months = 500
		
		modifier = {
			factor = 0.75
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 0.75
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			location = { has_province_modifier = depopulated_1 }
		}
		modifier = {
			factor = 0.50
			location = { has_province_modifier = depopulated_2 }
		}
		modifier = {
			factor = 0.25
			location = { has_province_modifier = depopulated_3 }
		}
		modifier = {
			factor = 1.25
			stewardship = 9
		}
		modifier = {
			factor = 1.25
			stewardship = 10
		}
		modifier = {
			factor = 1.25
			stewardship = 11
		}
		modifier = {
			factor = 1.25
			stewardship = 12
		}
		modifier = {
			factor = 1.25
			stewardship = 13
		}
	}
	
	option = {
		name = EVTOPTA20206
		add_trait = wounded
		hidden_tooltip  = {
			liege = { character_event = { id = 20207 } }
		}
	}
}

# 20207: The liege is informed
character_event = {
	id = 20207
	desc = EVTDESC20207
	picture = GFX_evt_peasants
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA20207
		opinion = {
			who = FROM
			modifier = opinion_grateful
			months = 60
		}
	}
}

##############################
# STEWARD
# JOB: action_build_legend
##############################

# 20208: The Steward has managed to raise an eager force of warriors
character_event = {
	id = 20208
	title = EVTNAME20208
	desc = EVTDESC20208
	picture = GFX_evt_viking_battle_oldgods
	border = GFX_event_normal_frame_war

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_build_legend
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		liege = {
			OR = { # The AI pretty much always just let their warriors stand around, getting a prestige hit when they disband
				war = yes
				ai = no
			}
			is_adult = yes
			prisoner = no
			prestige = 10
			NOT = { trait = incapable }
			OR = {
				NOT = { has_character_flag = tribal_build_legend_troops }
				had_character_flag = { flag = tribal_build_legend_troops days = 1825 }
			}
		}
		
		location = {
			county = {
				is_occupied = no
			}
			ROOT = {
				liege = {
					is_capital = PREVPREV
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 120
		
		modifier = {
			factor = 3.0
			liege = {
				tier = count
			}
		}
		
		modifier = {
			factor = 1.25
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			stewardship = 9
		}
		modifier = {
			factor = 0.75
			stewardship = 10
		}
		modifier = {
			factor = 0.75
			stewardship = 11
		}
		modifier = {
			factor = 0.75
			stewardship = 12
		}
		modifier = {
			factor = 0.75
			stewardship = 13
		}
	}
	
	option = {
		name = EVTOPTA20208
		
		prestige = 50
		hidden_tooltip  = {
			liege = { character_event = { id = 20209 } }
		}
	}
}

# 20209: The liege is informed
character_event = {
	id = 20209
	desc = EVTDESC20209
	picture = GFX_evt_viking_battle_oldgods
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		capital_scope = {
			ROOT = {
				spawn_unit = {
					province = PREV
					home = PREV
					owner = THIS
					#leader = none
					match_character = THIS
					match_mult = 0.075
					match_min = 100
					match_max = 3000
					attrition = 1.0
					earmark = tribal_build_legend
					disband_on_peace = yes
					can_toggle_looting = no
				}
				spawn_unit = {
					province = PREV
					home = PREV
					owner = THIS
					#leader = none
					match_character = THIS
					match_mult = 0.075
					match_min = 100
					match_max = 3000
					attrition = 1.0
					earmark = tribal_build_legend
					disband_on_peace = yes
					can_toggle_looting = no
				}
				spawn_unit = {
					province = PREV
					home = PREV
					owner = THIS
					#leader = none
					match_character = THIS
					match_mult = 0.075
					match_min = 100
					match_max = 3000
					attrition = 1.0
					earmark = tribal_build_legend
					disband_on_peace = yes
					can_toggle_looting = no
				}
			}
		}
		
		clr_character_flag = tribal_build_legend_troops
		set_character_flag = tribal_build_legend_troops
		
		character_event = { id = 20217 days = 365 random = 90 }
	}
	
	option = {
		name = EVTOPTA20209
		opinion = {
			who = FROM
			modifier = opinion_grateful
			months = 60
		}
	}
}

# 20217: The men are displeased and disband
character_event = {
	id = 20217
	desc = EVTDESC20217
	picture = GFX_evt_viking_battle_oldgods
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	war = no
	
	trigger = {
		has_earmarked_regiments = tribal_build_legend
	}
	
	option = {
		name = EVTOPTA20217
		prestige = -50
		clr_character_flag = tribal_build_legend_troops
		disband_event_forces = tribal_build_legend
	}
}

##############################
# STEWARD
# JOB: action_collect_tribute
##############################

# 20225: The Steward demands extra funds from the ruler
character_event = {
	id = 20225
	title = EVTNAME20225
	desc = EVTDESC20225
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy

	min_age = 16
	capable_only = yes
	prisoner = no
	has_job_title = yes
	
	trigger = {
		has_job_action = action_collect_tribute
		NOT = { has_character_modifier = in_seclusion }
		NOT = { has_character_modifier = bedridden_illness }
		NOT = { trait = incapable }
		liege = {
			ROOT = {
				location = {
					county = {
						is_occupied = no
					}
					any_province_lord = {
						NOT = { character = ROOT }
						NOT = { character = PREVPREVPREV }
						OR = {
							vassal_of = PREVPREVPREV
							pays_tribute_to = PREVPREVPREV
						}
						capital_scope = {
							province = PREVPREV
						}
						NOT = { has_character_modifier = hidden_extra_tribute }
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 60
		
		modifier = {
			factor = 1.25
			NOT = { stewardship = 2 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 3 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 4 }
		}
		modifier = {
			factor = 1.25
			NOT = { stewardship = 5 }
		}
		modifier = {
			factor = 0.75
			stewardship = 9
		}
		modifier = {
			factor = 0.75
			stewardship = 10
		}
		modifier = {
			factor = 0.75
			stewardship = 11
		}
		modifier = {
			factor = 0.75
			stewardship = 12
		}
		modifier = {
			factor = 0.75
			stewardship = 13
		}
	}
	
	immediate = {
		liege = {
			save_event_target_as = tribute_asker
			ROOT = {
				location = {
					random_province_lord = {
						limit = {
							NOT = { character = PREVPREVPREV }
							OR = {
								vassal_of = PREVPREVPREV
								pays_tribute_to = PREVPREVPREV
							}
							capital_scope = {
								province = PREVPREV
							}
							NOT = { has_character_modifier = hidden_extra_tribute }
						}
						save_event_target_as = tribute_giver
					}
				}
			}
		}
	}
	
	option = {
		name = EVTOPTA20225 # Demand more tribute
		
		ai_chance = { factor = 100 }
		
		event_target:tribute_giver = {
			character_event = { id = 20226 days = 3 tooltip = EVTTOOLTIP_20226 }
		}
	}
	
	option = {
		name = EVTOPTB20225 # I don't dare ask
		ai_chance = { factor = 0 }
	}
}

# 20226: The Steward demands extra funds from the ruler. Ruler response event.
character_event = {
	id = 20226
	title = EVTNAME20225
	desc = EVTDESC20226
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	immediate = {
		add_character_modifier = {
			name = hidden_extra_tribute
			hidden = yes
			days = 1825 # 5 years
		}
	}
	
	option = {
		name = EVTOPTA20226 # Accept demand
		ai_chance = {
			factor = 100
			modifier = {
				factor = 3.0
				trait = charitable
			}
			modifier = {
				factor = 3.0
				trait = content
			}
			modifier = {
				factor = 5.0
				trait = craven
			}
			modifier = {
				factor = 2.0
				opinion = {
					who = event_target:tribute_asker
					value = 25
				}
			}
			modifier = {
				factor = 2.0
				opinion = {
					who = event_target:tribute_asker
					value = 50
				}
			}
			modifier = {
				factor = 2.0
				opinion = {
					who = event_target:tribute_asker
					value = 75
				}
			}
		}
		
		tooltip = {
			transfer_scaled_wealth = {
				to = event_target:tribute_asker
				min = 5
				value = 1.0 # One year's income
			}
		}
		
		opinion = {
			who = event_target:tribute_asker
			modifier = squeezed_for_extra_tribute
			years = 10
		}
		
		opinion = {
			who = FROM
			modifier = squeezed_for_extra_tribute
			years = 10
		}
		
		hidden_tooltip = {
			FROM = { character_event = { id = 20227 } } # Notifications
		}
	}
	
	option = {
		name = EVTOPTB20226 # Refuse
		ai_chance = {
			factor = 100
			modifier = {
				factor = 5.0
				trait = greedy
			}
			modifier = {
				factor = 2.0
				NOT = {
					opinion = {
						who = event_target:tribute_asker
						value = -24
					}
				}
			}
			modifier = {
				factor = 2.0
				NOT = {
					opinion = {
						who = event_target:tribute_asker
						value = -49
					}
				}
			}
			modifier = {
				factor = 2.0
				NOT = {
					opinion = {
						who = event_target:tribute_asker
						value = -74
					}
				}
			}
		}
		
		opinion = {
			who = event_target:tribute_asker
			modifier = squeezed_for_extra_tribute
			years = 5
		}
		
		hidden_tooltip = {
			FROM = { character_event = { id = 20229 } } # Notifications
		}
	}
}

# 20227: The target accepts to pay extra tribute. Steward notified.
character_event = {
	id = 20227
	title = EVTNAME20225
	desc = EVTDESC20227
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	immediate = {
		liege = {
			 character_event = { id = 20228 } # Liege notified
		}
	}
	
	option = {
		name = EXCELLENT
	}
}

# 20228: The target accepts to pay extra tribute. Liege notified.
character_event = {
	id = 20228
	title = EVTNAME20225
	desc = EVTDESC20228
	picture = GFX_evt_carriage
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		
		transfer_scaled_wealth = {
			from = FROMFROM
			min = 5
			value = 1.0 # One year's income
		}
		
		tooltip = {
			reverse_opinion = {
				who = FROMFROM
				modifier = squeezed_for_extra_tribute
				years = 10
			}
		}
	}
}

# 20229: The target refuses to pay extra tribute. Steward notified.
character_event = {
	id = 20229
	title = EVTNAME20225
	desc = EVTDESC20229
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	immediate = {
		liege = {
			 character_event = { id = 20231 } # Liege notified
		}
	}
	
	option = {
		name = EVTOPTA20229
	}
}

# 20231: The target refuses to pay extra tribute. Liege notified.
character_event = {
	id = 20231
	title = EVTNAME20225
	desc = EVTDESC20231
	picture = GFX_evt_emissary
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA20231
		
		opinion = {
			who = FROMFROM
			modifier = refused_extra_tribute
			years = 5
		}
	}
}
