###########################################
#                                         #
# Way of Life Rulership Events            #
#                                         #
# ID WoL.12000-WoL.12999                  #
#                                         #
###########################################

namespace = WoL

# Rulership Level Up
character_event = {
	id = WoL.12500

	is_triggered_only = yes
	hide_window = yes

	immediate = {
		if = {
			limit = {
				OR = {
					trait = indulgent_wastrel
					trait = thrifty_clerk
					trait = fortune_builder
				}

				random < 15 # 15% chance
			}

			character_event = { id = WoL.12501 } # Education level up
		}

		if = {
			limit = {
				NOR = {
					AND = {
						lifestyle_traits >= 1
						has_character_modifier = wol_steward_2
						NOT = { religion = jain }
					}

					has_character_modifier = wol_raja_dharma
				}

				random < 15 # 15% chance
			}

			character_event = { id = WoL.12502 }
		}

		if = {
			limit = {
				NOT = { trait = just }
				random < 15 # 15% chance
			}

			character_event = { id = WoL.12503 }
		}

		if = {
			limit = {
				NOT = { trait = diligent }
				random < 15 # 15% chance
			}

			character_event = { id = WoL.12504 }
		}

		if = {
			limit = {
				NOT = { trait = ambitious }
				random < 15 # 15% chance
			}

			character_event = { id = WoL.12505 }
		}
	}
}

# Stewardship Education Level Up
character_event = {
	id = WoL.12501
	desc = EVTDESC_WoL_12501
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes
	hide_from = yes
	hide_new = yes

	option = {
		name = EXCELLENT

		trigger_switch = {
			on_trigger = trait

			indulgent_wastrel = {
				hidden_effect = { remove_trait = indulgent_wastrel }
				add_trait = thrifty_clerk
			}

			thrifty_clerk = {
				hidden_effect = { remove_trait = thrifty_clerk }
				add_trait = fortune_builder
			}

			fortune_builder = {
				hidden_effect = { remove_trait = fortune_builder }
				add_trait = midas_touched

				if = {
					limit = { has_nickname = no }
					give_nickname = nick_the_lawgiver
				}
			}
		}
	}
}

# Administrator Level Up
character_event = {
	id = WoL.12502
	desc = EVTDESC_WoL_12502
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes
	hide_from = yes
	hide_new = yes

	option = {
		name = EXCELLENT

		if = {
			limit = {
				NOR = {
					has_character_modifier = wol_steward_1
					has_character_modifier = wol_steward_2
					trait = administrator
				}
			}

			add_character_modifier = {
				name = wol_steward_1
				duration = -1
			}
		}
		else_if = {
			limit = { has_character_modifier = wol_steward_1 }

			remove_character_modifier = wol_steward_1

			add_character_modifier = {
				name = wol_steward_2
				duration = -1
			}
		}
		else_if = {
			limit = {
				has_character_modifier = wol_steward_2
				lifestyle_traits < 1
			}

			remove_character_modifier = wol_steward_2
			add_trait = administrator
		}

		else_if = {
			limit = {
				trait = administrator
				religion = jain
			}

			add_character_modifier = {
				name = wol_raja_dharma
				duration = -1
			}
		}
	}
}

# More Just
character_event = {
	id = WoL.12503
	desc = EVTDESC_WoL_12503
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes
	hide_from = yes
	hide_new = yes

	option = {
		name = EXCELLENT

		if = {
			limit = { trait = arbitrary }
			remove_trait = arbitrary
		}
		else = {
			add_trait = just

			if = {
				limit = { has_nickname = no }
				give_nickname = nick_the_just
			}
		}
	}
}

# More Diligent
character_event = {
	id = WoL.12504
	desc = EVTDESC_WoL_12504
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes
	hide_from = yes
	hide_new = yes

	option = {
		name = EXCELLENT

		add_trait_partially_silently_diligent_effect = yes
	}
}

# More Ambitious
character_event = {
	id = WoL.12505
	desc = EVTDESC_WoL_12505
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes
	hide_from = yes
	hide_new = yes

	option = {
		name = EXCELLENT

		add_trait_partially_silently_ambitious_effect = yes
	}
}

# Legendary Wisdom
# on_yearly_pulse
character_event = {
	id = WoL.12506
	desc = EVTDESC_WoL_12506
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_yearly_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		trait = administrator
		stewardship >= 12
		NOT = { has_character_modifier = wol_legendary_wisdom }
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EXCELLENT

		add_character_modifier = {
			name = wol_legendary_wisdom
			duration = -1
		}

		if = {
			limit = {
				ai = no
				is_ironman = yes
			}

			set_character_flag = achievement_wise_guy
		}
	}
}

# Respected Ruler
character_event = {
	id = WoL.12507
	desc = EVTDESC_WoL_12507
	picture = GFX_evt_relaxed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_yearly_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		trait = administrator
		stewardship >= 8
		NOT = { has_character_modifier = wol_respected_ruler }
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EXCELLENT

		add_character_modifier = {
			name = wol_respected_ruler
			duration = -1
		}
	}
}

### The Architect

# Architect brought before court
character_event = {
	id = WoL.12000
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy

	desc = {
		text = EVTDESC_WoL_12001
		trigger = { has_character_flag = architect_unknown }
	}
	desc = {
		text = EVTDESC_WoL_12002
		trigger = { has_character_flag = architect_charlatan }
	}
	desc = {
		text = EVTDESC_WoL_12003
		trigger = { has_character_flag = architect_trusted }
	}

	is_triggered_only = yes # on_focus_pulse, random_events

	ai = no

	trigger = {
		has_focus = focus_rulership
		wealth >= 400

		any_demesne_province = {
			has_empty_holding = yes
			owned_by = PREV
		}

		is_tribal = no
		is_nomadic = no
		in_seclusion = no

		NOR = {
			has_character_flag = architect_offer
			has_global_flag = rulership_castle
		}
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		set_global_flag = rulership_castle
		set_character_flag = architect_offer

		random_demesne_province = {
			limit = {
				has_empty_holding = yes
				owned_by = PREV
			}

			save_event_target_as = target_province
		}

		if = {
			limit = {
				job_treasurer = { stewardship >= 5 }
			}

			random_list = {
				75 = { set_character_flag = architect_trusted }
				25 = { set_character_flag = architect_charlatan }
			}
		}
		else = {
			set_character_flag = architect_unknown
		}
	}

	option = {
		name = EVTOPTA_WoL_12001

		wealth = -400

		custom_tooltip = {
			text = castle_construction_begins

			set_character_flag = building_castle

			event_target:target_province = {
				province_event = {
					id = WoL.12013 # Validation loop
					days = 1
				}
			}

			if = {
				limit = { has_character_flag = architect_unknown }

				random_list = {
					100 = { character_event = { id = WoL.12007 days = 260 } } # Castle finished
					50 = { character_event = { id = WoL.12006 days = 260 } } # Castle finished with less resources
					25 = { character_event = { id = WoL.12004 days = 260 } } # Architect caught absconding with money
					25 = { character_event = { id = WoL.12005 days = 260 } } # Construction more costly than estimated
				}
			}
			else_if = {
				limit = { has_character_flag = architect_charlatan }

				random_list = {
					40 = { character_event = { id = WoL.12004 days = 260 } } # Architect caught absconding with money
					40 = { character_event = { id = WoL.12005 days = 260 } } # Construction more costly than estimated
					20 = { character_event = { id = WoL.12007 days = 260 } } # Castle finished
				}
			}
			else = {
				random_list = {
					60 = { character_event = { id = WoL.12006 days = 260 } } # Castle finished with less resources
					40 = { character_event = { id = WoL.12007 days = 260 } } # Castle finished
				}
			}
		}
	}

	option = {
		name = EVTOPTB_WoL_12001

		custom_tooltip = {
			text = architect_refused
			clr_global_flag = rulership_castle
		}
	}

	after = {
		clr_character_flag = architect_unknown
		clr_character_flag = architect_charlatan
		clr_character_flag = architect_trusted
	}
}

# Architect caught absconding with money
character_event = {
	id = WoL.12004
	desc = EVTDESC_WoL_12004
	picture = GFX_evt_drunk
	border = GFX_event_normal_frame_economy
	portrait = new_character

	is_triggered_only = yes
	hide_new = yes

	immediate = {
		create_character = {
			random_traits = no
			dynasty = none
			female = no
			age = 42
			religion = ROOT
			culture = ROOT
			add_trait = slothful
			add_trait = deceitful
			add_trait = indulgent_wastrel
		}
	}

	option = {
		name = EVTOPTA_WoL_12004

		wealth = 150

		new_character = {
			show_scope_change = no

			imprison = yes
		}

		clr_global_flag = rulership_castle
		clr_character_flag = building_castle
	}
}

# Construction more costly than estimated
character_event = {
	id = WoL.12005
	desc = EVTDESC_WoL_12005
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EVTOPTA_WoL_12005

		wealth = -100

		character_event = {
			id = WoL.12008
			months = 2
		}
	}

	option = {
		name = EVTOPTB_WoL_12005

		wealth = 200

		custom_tooltip = {
			text = construction_ceases

			clr_global_flag = rulership_castle
			clr_character_flag = building_castle
		}
	}
}

# Castle finished with less resources
character_event = {
	id = WoL.12006
	desc = EVTDESC_WoL_12006
	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EXCELLENT

		event_target:target_province = {
			show_scope_change = no

			build_holding = {
				type = castle
				holder = ROOT
			}
		}

		wealth = 100

		clr_global_flag = rulership_castle
		clr_character_flag = building_castle

		character_event = {
			id = WoL.12500
			days = 1
		}
	}
}

# Castle finished
character_event = {
	id = WoL.12007
	desc = EVTDESC_WoL_12007
	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EVTOPTA_WoL_12007

		event_target:target_province = {
			show_scope_change = no

			build_holding = {
				type = castle
				holder = ROOT
			}

			clr_province_flag = castle_province
		}

		clr_global_flag = rulership_castle
		clr_character_flag = building_castle

		character_event = {
			id = WoL.12500
			days = 1
		}
	}
}

# Castle finished after delay
character_event = {
	id = WoL.12008
	desc = EVTDESC_WoL_12008
	picture = GFX_evt_magnificent_castle
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EVTOPTA_WoL_12008

		event_target:target_province = {
			show_scope_change = no

			build_holding = {
				type = castle
				holder = ROOT
			}

			clr_province_flag = castle_province
		}

		clr_global_flag = rulership_castle
		clr_character_flag = building_castle

		character_event = {
			id = WoL.12500
			days = 1
		}
	}
}

# No free holding slots
character_event = {
	id = WoL.12009
	desc = EVTDESC_WoL_12009
	picture = GFX_evt_construction_site
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	immediate = {
		clr_character_flag = building_castle
		clr_global_flag = rulership_castle
		clear_delayed_event = { id = WoL.12004 }
		clear_delayed_event = { id = WoL.12005 }
		clear_delayed_event = { id = WoL.12006 }
		clear_delayed_event = { id = WoL.12007 }
		clear_delayed_event = { id = WoL.12008 }
	}

	option = {
		name = EVTOPTA_WoL_12009

		wealth = 350
	}
}

# Architect - Validation Loop
province_event = {
	id = WoL.12013

	is_triggered_only = yes
	hide_window = yes

	trigger = {
		owner = {
			has_character_flag = building_castle
		}
	}

	immediate = {
		if = {
			limit = { has_empty_holding = no }

			owner = {
				character_event = { id = WoL.12009 } # End construction
			}
		}
		else = {
			repeat_event = {
				id = WoL.12013
				days = 1
			}
		}
	}
}

### Depressed
character_event = {
	id = WoL.12010
	desc = EVTDESC_WoL_12010
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no
	war = no

	trigger = {
		has_focus = focus_rulership
		NOT = { trait = depressed }
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EVTOPTA_WoL_12010

		add_trait = depressed
	}
}

### Stressed
character_event = {
	id = WoL.12011
	desc = EVTDESC_WoL_12011
	picture = GFX_evt_stressed_ruler
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership
		NOT = { trait = stressed }
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EVTOPTA_WoL_12011

		add_trait = stressed
	}
}

### The Murders

# Peasant Dragged Before Court
character_event = {
	id = WoL.12015
	desc = EVTDESC_WoL_12015
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership
		in_seclusion = no
		in_command_trigger = no
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EVTOPTA_WoL_12015

		custom_tooltip = {
			text = peasant_hanged

			character_event = {
				id = WoL.12500 # Rulership level up
				days = 1
			}

			random = {
				chance = 50

				character_event = {
					id = WoL.12016 # Another Murder (Peasant Hanged)
					years = 5
					random = 3650
				}
			}
		}
	}

	option = {
		name = EVTOPTB_WoL_12015

		custom_tooltip = {
			text = peasant_imprisoned

			character_event = {
				id = WoL.12500 # Rulership level up
				days = 1
			}

			random = {
				chance = 50

				random_list = {
					50 = {
						character_event = {
							id = WoL.12021 # Another Murder (Peasant imprisoned)
							years = 5
							random = 3650
						}
					}

					50 = {
						character_event = {
							id = WoL.12022 # Another Murder (Peasant died in dungeon)
							years = 5
							random = 3650
						}
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTC_WoL_12015

		custom_tooltip = {
			text = peasant_set_free

			character_event = {
				id = WoL.12500 # Rulership level up
				days = 1
			}

			random = {
				chance = 50

				set_character_flag = peasant_freed_guilty

				character_event = {
					id = WoL.12017 # Another Murder (Peasant Set Free)
					years = 5
					random = 3650
				}
			}
		}
	}

	option = {
		name = EVTOPTD_WoL_12015
		tooltip_info = impaler

		trigger = { trait = impaler }

		custom_tooltip = {
			text = peasant_tortured

			random_list = {
				50 = {
					character_event = {
						id = WoL.12018 # Peasant admits under torture
						days = 15
					}
				}

				50 = {
					character_event = {
						id = WoL.12019 # Peasant does not admit under torture
						days = 15
					}
				}
			}
		}
	}
}

# Another Murder (Peasant Hanged)
character_event = {
	id = WoL.12016
	desc = EVTDESC_WoL_12016
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	only_playable = yes
	only_capable = yes
	prisoner = no

	option = {
		name = EVTOPTA_WoL_12016

		if = {
			limit = { has_nickname = no }
			give_nickname = nick_the_rash
		}

		prestige = -20
	}
}

# Another Murder (Peasant Set Free)
character_event = {
	id = WoL.12017
	desc = EVTDESC_WoL_12017
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	only_playable = yes
	only_capable = yes
	prisoner = no

	option = {
		name = EVTOPTA_WoL_12017

		prestige = -20
	}
}

# Peasant admits under torture
character_event = {
	id = WoL.12018
	desc = EVTDESC_WoL_12018
	picture = GFX_evt_torture
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EVTOPTA_WoL_12018

		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}

		hidden_effect = {
			random = {
				chance = 50

				character_event = {
					id = WoL.12020 # Another Murder (Peasant died during torture)
					years = 5
					random = 3650
				}
			}
		}
	}
}

# Peasant does not admit under torture
character_event = {
	id = WoL.12019
	desc = EVTDESC_WoL_12019
	picture = GFX_evt_torture
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	option = {
		name = EVTOPTA_WoL_12019

		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}

		hidden_effect = {
			random = {
				chance = 50

				character_event = {
					id = WoL.12020 # Another Murder (Peasant died during torture)
					years = 5
					random = 3650
				}
			}
		}
	}
}

# Another Murder (Peasant died during torture)
character_event = {
	id = WoL.12020
	desc = EVTDESC_WoL_12020
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	only_playable = yes
	only_capable = yes
	prisoner = no

	option = {
		name = EVTOPTA_WoL_12020

		prestige = -20
	}
}

# Another Murder (Peasant imprisoned)
character_event = {
	id = WoL.12021
	desc = EVTDESC_WoL_12021
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	only_playable = yes
	only_capable = yes
	prisoner = no

	option = {
		name = EVTOPTA_WoL_12021

		prestige = -20
	}
}

# Another Murder (Peasant died in dungeon)
character_event = {
	id = WoL.12022
	desc = EVTDESC_WoL_12022
	picture = GFX_evt_bloody_man
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	only_playable = yes
	only_capable = yes
	prisoner = no

	option = {
		name = EVTOPTA_WoL_12022

		prestige = -20
	}
}

### Noble Feud
character_event = {
	id = WoL.12026
	desc = EVTDESC_WoL_12026
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events
	hide_from = yes

	only_playable = yes
	min_age = 16
	only_capable = yes

	trigger = {
		has_focus = focus_rulership

		any_vassal = {
			is_adult = yes
			is_incapable = no
			prisoner = no
			ai = yes
			NOT = { is_close_relative = ROOT }

			ROOT = {
				any_vassal = {
					is_adult = yes
					is_incapable = no
					prisoner = no
					ai = yes

					NOR = {
						character = PREVPREV
						is_close_relative = ROOT
						is_close_relative = PREVPREV
					}

					opinion = {
						who = PREVPREV
						value < -30
					}

					reverse_opinion = {
						who = PREVPREV
						value < -30
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		random_vassal = {
			limit = {
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes
				NOT = { is_close_relative = ROOT }

				ROOT = {
					any_vassal = {
						is_adult = yes
						is_incapable = no
						prisoner = no
						ai = yes

						NOR = {
							character = PREVPREV
							is_close_relative = ROOT
							is_close_relative = PREVPREV
						}

						opinion = {
							who = PREVPREV
							value < -30
						}

						reverse_opinion = {
							who = PREVPREV
							value < -30
						}
					}
				}
			}

			save_event_target_as = feuding_noble_1
		}

		random_vassal = {
			limit = {
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes

				NOR = {
					character = event_target:feuding_noble_1
					is_close_relative = ROOT
					is_close_relative = event_target:feuding_noble_1
				}

				opinion = {
					who = event_target:feuding_noble_1
					value < -30
				}

				reverse_opinion = {
					who = event_target:feuding_noble_1
					value < -30
				}
			}

			save_event_target_as = feuding_noble_2
		}
	}

	option = {
		name = EVTOPTA_WoL_12026

		reverse_opinion = {
			name = opinion_happy
			who = event_target:feuding_noble_1
			years = 2
		}

		reverse_opinion = {
			name = opinion_angry
			who = event_target:feuding_noble_2
			years = 2
		}
	}

	option = {
		name = EVTOPTB_WoL_12026

		reverse_opinion = {
			name = opinion_happy
			who = event_target:feuding_noble_2
			years = 2
		}

		reverse_opinion = {
			name = opinion_angry
			who = event_target:feuding_noble_1
			years = 2
		}
	}

	option = {
		name = EVTOPTC_WoL_12026

		prestige = 50

		reverse_opinion = {
			name = opinion_upset
			who = event_target:feuding_noble_1
			years = 2
		}

		reverse_opinion = {
			name = opinion_upset
			who = event_target:feuding_noble_2
			years = 2
		}
	}

	after = {
		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}
	}
}


### Farm Fire
# Fired from 'on_focus_pulse'
character_event = {
	id = WoL.12027
	desc = EVTDESC_WoL_12027
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership

		any_vassal = {
			is_adult = yes
			is_incapable = no
			prisoner = no
			ai = yes
			NOT = { is_close_relative = ROOT }
		}
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		random_vassal = {
			limit = {
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes
				NOT = { is_close_relative = ROOT }
			}

			save_event_target_as = farm_fire_noble
		}
	}

	option = {
		name = EVTOPTA_WoL_12027

		event_target:farm_fire_noble = {
			show_scope_change = no

			wealth = -50

			opinion = {
				name = opinion_angry
				who = ROOT
				years = 2
			}
		}
	}

	option = {
		name = EVTOPTB_WoL_12027

		capital_scope = {
			show_scope_change = no

			add_province_modifier = {
				name = peasant_unrest
				years = 1
			}
		}

		reverse_opinion = {
			name = opinion_happy
			who = event_target:farm_fire_noble
			years = 2
		}
	}

	option = {
		name = EVTOPTC_WoL_12027

		wealth = -50

		reverse_opinion = {
			name = opinion_happy
			who = event_target:farm_fire_noble
			years = 2
		}
	}

	after = {
		character_event = {
			id = WoL.12500
			days = 1
		}
	}
}

### Witch
character_event = {
	id = WoL.12028
	desc = EVTDESC_WoL_12028
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy
	portrait = new_character

	is_triggered_only = yes # on_focus_pulse, random_events
	hide_new = yes

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership
		num_of_count_titles >= 1
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		random_demesne_province = {
			limit = { owned_by = PREV }
			save_event_target_as = witch_province
		}

		random_list = {
			50 = {
				create_character = {
					random_traits = no
					dynasty = none
					female = yes
					age = 28
					religion = ROOT
					culture = ROOT
					add_trait = ugly
					add_trait = kind
					add_trait = charitable
					add_trait = humble
					add_trait = honest
					add_trait = shy
					add_trait = trusting
					add_trait = naive_appeaser
				}
			}

			50 = {
				create_character = {
					random_traits = no
					dynasty = none
					female = yes
					age = 26
					religion = ROOT
					culture = ROOT
					add_trait = hunchback
					add_trait = wroth
					add_trait = envious
					add_trait = paranoid
					add_trait = deceitful
					add_trait = shy
					add_trait = cynical
					add_trait = amateurish_plotter
				}
			}
		}
	}

	option = {
		name = EVTOPTA_WoL_12028

		event_target:witch_province = {
			show_scope_change = no

			add_province_modifier = {
				name = peasants_protected
				years = 1
			}
		}

		new_character = {
			show_scope_change = no

			death = {
				death_reason = death_execution_burning
				killer = ROOT
			}
		}

		piety = 30
	}

	option = {
		name = EVTOPTB_WoL_12028

		reverse_imprison = new_character
	}

	option = {
		name = EVTOPTC_WoL_12028

		event_target:witch_province = {
			show_scope_change = no

			add_province_modifier = {
				name = peasant_unrest
				years = 1
			}
		}

		culture_techpoints = 50
	}

	after = {
		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}
	}
}

### Drunkard
character_event = {
	id = WoL.12029
	desc = EVTDESC_WoL_12029
	picture = GFX_evt_drunk
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events

	min_age = 16
	only_playable = yes
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership
		num_of_count_titles >= 1
		in_command_trigger = no

		any_vassal = {
			trait = drunkard
			is_adult = yes
			is_incapable = no
			prisoner = no
			ai = yes
			NOT = { is_close_relative = ROOT }
		}
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		random_demesne_province = {
			limit = { owned_by = PREV }
			save_event_target_as = drunken_rampage
		}

		random_vassal = {
			limit = {
				trait = drunkard
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes
				NOT = { is_close_relative = ROOT }
			}

			save_event_target_as = noble_drunkard
		}
	}

	option = {
		name = EVTOPTA_WoL_12029

		prestige = 30

		event_target:noble_drunkard = {
			show_scope_change = no

			wealth = -50

			opinion = {
				name = opinion_angry
				who = ROOT
				years = 2
			}
		}
	}

	option = {
		name = EVTOPTB_WoL_12029

		prestige = -30

		event_target:drunken_rampage = {
			show_scope_change = no

			add_province_modifier = {
				name = merchants_unhappy
				years = 1
			}
		}

		reverse_opinion = {
			name = opinion_happy
			who = event_target:noble_drunkard
			years = 2
		}
	}

	option = {
		name = EVTOPTC_WoL_12029

		wealth = -50

		reverse_opinion = {
			name = opinion_happy
			who = event_target:noble_drunkard
			years = 2
		}
	}

	after = {
		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}
	}
}

### City Brigands
character_event = {
	id = WoL.12031
	desc = EVTDESC_WoL_12031
	picture = GFX_evt_throne_room
	border = GFX_event_normal_frame_economy

	is_triggered_only = yes # on_focus_pulse, random_events
	hide_from = yes

	only_playable = yes
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		has_focus = focus_rulership

		any_vassal = {
			is_republic = yes
			is_adult = yes
			is_incapable = no
			prisoner = no
			ai = yes
			NOT = { is_close_relative = ROOT }

			ROOT = {
				any_vassal = {
					is_republic = no
					is_adult = yes
					is_incapable = no
					prisoner = no
					ai = yes

					NOR = {
						is_close_relative = ROOT
						is_close_relative = PREVPREV
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1
	}

	immediate = {
		random_vassal = {
			limit = {
				is_republic = yes
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes
				NOT = { is_close_relative = ROOT }
			}

			save_event_target_as = brigands_mayor

			primary_title = {
				save_event_target_as = mayor_city
			}
		}

		random_vassal = {
			limit = {
				is_republic = no
				is_adult = yes
				is_incapable = no
				prisoner = no
				ai = yes

				NOR = {
					is_close_relative = ROOT
					is_close_relative = event_target:brigands_mayor
				}
			}

			save_event_target_as = brigands_noble
		}
	}

	option = {
		name = EVTOPTA_WoL_12031

		event_target:brigands_noble = {
			show_scope_change = no

			transfer_scaled_wealth = {
				from = event_target:brigands_mayor
				value = 1
				min = 50
				max = 50
			}

			opinion = {
				name = opinion_happy
				who = ROOT
				years = 2
			}
		}

		reverse_opinion = {
			name = opinion_unhappy
			who = event_target:brigands_mayor
			years = 2
		}
	}

	option = {
		name = EVTOPTB_WoL_12031

		reverse_opinion = {
			name = opinion_unhappy
			who = event_target:brigands_noble
			years = 2
		}

		reverse_opinion = {
			name = opinion_happy
			who = event_target:brigands_mayor
			years = 2
		}
	}

	option = {
		name = EVTOPTC_WoL_12031

		transfer_scaled_wealth = {
			to = event_target:brigands_noble
			value = 1
			min = 50
			max = 50
		}

		reverse_opinion = {
			name = opinion_happy
			who = event_target:brigands_noble
			years = 2
		}

		reverse_opinion = {
			name = opinion_happy
			who = event_target:brigands_mayor
			years = 2
		}
	}

	after = {
		character_event = {
			id = WoL.12500 # Rulership level up
			days = 1
		}
	}
}