namespace = lalad_events
character_event = {
	id = lalad_events.0
	desc = "EVTDESClalad_events.0"
	picture = "GFX_evt_council"

	trigger = {
		ai = no
		in_command = yes
		is_landed = no
		location = {
			holder_scope = {
				NOT = { is_foe = ROOT }
				opinion = { who = ROOT value = 0 }
				OR = {
					NOT = { has_character_flag = gifted_landless }
					had_character_flag = { flag = gifted_landless days = 365 }
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 30
	}

	option = {
		name = "EVTOPTAlalad_events.0"
		location = {
			holder_scope = {
				reverse_opinion = { modifier = opinion_friend who = ROOT years = 2 }
				IF = {
					limit = { had_character_flag = { flag = gifted_landless days = 365 } }
					clr_character_flag = gifted_landless
				}
				set_character_flag = gifted_landless
			}
		}
		wealth = 10
	}
}

character_event = {
	id = lalad_events.1
	hide_window = yes

	trigger = {
		any_demesne_title = {
			has_title_flag = take_collins_seat
		}
		NOT = { has_character_flag = lord_protector }
	}

	mean_time_to_happen = {
		days = 1
	}

	immediate = {
		set_character_flag = lord_protector
	}
}

character_event = {
	id = lalad_events.10
	desc = "EVTDESClalad_events.10"
	picture = "GFX_evt_council"

	trigger = {
		ai = no
		in_command = yes
		is_landed = no
		NOT = {
			location = {
				has_province_modifier = highway_robber_band
			}
		}
		location = { is_land = yes }
	}

	mean_time_to_happen = {
		days = 183
	}

	option = {
		name = "EVTOPTAlalad_events.10"
		random_list = {
			35 = {
				location = {
					holder_scope = {
						character_event = { id = lalad_events.1001 }
					}
				}
			}

			35 = {
				location = {
					holder_scope = {
						character_event = { id = lalad_events.1002 }
					}
				}
			}

			20 = {
				location = {
					holder_scope = {
						character_event = { id = lalad_events.1003 }
					}
				}
			}

			10 = {
				add_trait = slothful
				hidden_tooltip = { character_event = { id = 38251 } }
			}
		}
	}
	option = {
		name = "EVTOPTBlalad_events.10"
	}
}

character_event = {
	id = lalad_events.11
	desc = "EVTDESClalad_events.11"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		location = {
			add_province_modifier = { name = highway_robber_band duration = -1 }
		}
	}

	option = {
		name = "EVTOPTAlalad_events.11"
		prestige = 100
	}
}

character_event = {
	id = lalad_events.12
	desc = "EVTDESClalad_events.12"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	option = {
		name = "EVTOPTAlalad_events.12"
		prestige = 100
	}
}

character_event = {
	id = lalad_events.13
	desc = "EVTDESClalad_events.13"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = { imprison = FROM }

	option = {
		name = "EVTOPTAlalad_events.13"
		prestige = -100
	}
}

character_event = {
	id = lalad_events.14
	desc = "EVTDESClalad_events.14"
	picture = "GFX_evt_council"

	trigger = {
		ai = no
		in_command = yes
		is_landed = no
		location = {
			has_province_modifier = highway_robber_band
		}
	}

	mean_time_to_happen = {
		days = 183
	}

	option = {
		name = "EVTOPTAlalad_events.14"
		wealth = 20
	}
}

character_event = {
	id = lalad_events.20
	desc = "EVTDESClalad_events.20"
	picture = "GFX_evt_council"

	trigger = {
		ai = no
		in_command = yes
		is_landed = no
		location = {
			holder_scope = {
				NOT = { is_foe = ROOT }
				opinion = { who = ROOT value = 0 }
			}
			NOT = { has_province_modifier = lalad_patrol }
		}
	}

	mean_time_to_happen = {
		days = 365
	}

	option = {
		name = "EVTOPTAlalad_events.20"
		random_list = {
			90 = {
				location = {
					holder_scope = {
						character_event = { id = lalad_events.2001 }
					}
				}
			}

			10 = {
				location = {
					holder_scope = {
						character_event = { id = lalad_events.2002 }
					}
				}
			}
		}
	}

	option = {
		name = "EVTOPTBlalad_events.20"
	}
}

character_event = {
	id = lalad_events.21
	desc = "EVTDESClalad_events.21"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	option = {
		name = "EVTOPTAlalad_events.21"
		prestige = 100
	}
}

character_event = {
	id = lalad_events.22
	desc = "EVTDESClalad_events.22"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		location = {
			add_province_modifier = { name = thieves_guild duration = -1 }
		}
	}

	option = {
		name = "EVTOPTAlalad_events.22"
		prestige = -100
	}
}

character_event = {
	id = lalad_events.100
	desc = "EVTDESClalad_events.100"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		any_demesne_title = {
			set_title_flag = take_collins_seat
		}
		IF = {
			limit = { independent = no }
			liege = {
				save_event_target_as = lalad_liege
			}
		}
	}

	option = {
		name = "EVTOPTAlalad_events.100"
		trigger = { any_courtier = { has_job_title = job_castellan } }
		create_title = { 
			tier = DUKE
			landless = yes
			name = "COLLINS_SEAT"
			holder = ROOT
			culture = ROOT
		}
		any_courtier = {
			IF = {
				limit = { has_job_title = job_castellan }
				character_event = { id = lalad_events.101 }
			}
		}
	}

	option = {
		name = "EVTOPTAlalad_events.100"
		trigger = { NOT = { any_courtier = { has_job_title = job_castellan } } }
		create_title = {
			tier = DUKE
			landless = yes
			name = "COLLINS_SEAT"
			holder = ROOT
			culture = ROOT
		}
		any_courtier = {
			IF = {
				limit = { has_job_title = job_chancellor }
				character_event = { id = lalad_events.101 }
			}
		}
	}
}

character_event = {
	id = lalad_events.101
	desc = "EVTDESClalad_events.101"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = { 
		FROM = {
			any_demesne_title = {
				IF = {
					limit = { has_title_flag = take_collins_seat }
					grant_title_no_opinion = ROOT
				}
			}
		}
	}

	option = {
		name = "EVTOPTAlalad_events.101"
		any_demesne_title = {
			IF = {
				limit = { has_title_flag = take_collins_seat }
				add_claim = FROM
			}
		}
		set_defacto_liege = event_target:lalad_liege
		clear_event_target = lalad_liege
		FROM = {
			any_demesne_title = {
				IF = {
					limit = { is_landless_type_title = yes }
					holder_scope = {
						set_defacto_liege = FROM
					}
					gender_succ = cognatic
					succession = primogeniture
					set_title_flag = landless_adventurer
				}
			}
			IF = {
				limit = {
					ROOT = {
						primary_title = { region = world_westeros }
					}
				}
				spawn_unit = {
					owner = FROM
					province = 226
					home = 226
					troops = {
						knights = { 50 50 }
						light_cavalry = { 150 150 }
						light_infantry = { 300 300 }
						heavy_infantry = { 200 200 }
						archers = { 300 300 }
					}
					earmark = lalad_troops
					attrition = 0.0
					maintenance_multiplier = 0.0
				}
			}
			IF = {
				limit = {
					ROOT = {
						primary_title = { region = world_essos }
					}
				}
				spawn_unit = {
					owner = FROM
					province = 419
					home = 419
					troops = {
						knights = { 50 50 }
						light_cavalry = { 150 150 }
						light_infantry = { 300 300 }
						heavy_infantry = { 200 200 }
						archers = { 300 300 }
					}
					earmark = lalad_troops
					attrition = 0.0
					maintenance_multiplier = 0.0
				}
			}
			IF = {
				limit = {
					ROOT = {
						primary_title = {
							NOR = {
								region = world_westeros
								region = world_essos
							}
						}
					}
				}
				spawn_unit = {
					owner = FROM
					province = 496
					home = 496
					troops = {
						knights = { 50 50 }
						light_cavalry = { 150 150 }
						light_infantry = { 300 300 }
						heavy_infantry = { 200 200 }
						archers = { 300 300 }
					}
					earmark = lalad_troops
					attrition = 0.0
					maintenance_multiplier = 0.0
				}
			}
		}
		remove_opinion = { who = FROM modifier = opinion_vassal_transfer }
		prestige = 50
		set_character_flag = lord_protector
	}
}

character_event = {
	id = lalad_events.102
	desc = "EVTDESClalad_events.102"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		any_claim = {
			IF = {
				limit = { has_title_flag = take_collins_seat }
				grant_title_no_opinion = ROOT
			}
		}
	}

	option = {
		name = "EVTOPTAlalad_events.102"
		any_demesne_title = {
			IF = {
				limit = { has_title_flag = take_collins_seat }
				clr_title_flag = take_collins_seat
			}
		}
		any_demesne_title = {
			IF = {
				limit = { has_title_flag = landless_adventurer }
				activate_title = { title = THIS status = no }
				destroy_landed_title = ROOT
			}
		}
		any_realm_character = {
			IF = {
				limit = { has_character_flag = lord_protector }
				reverse_remove_opinion = { who = ROOT modifier = opinion_vassal_transfer }
				clr_character_flag = lord_protector
			}
		}
		disband_event_forces = lalad_troops
	}
}

character_event = {
	id = lalad_events.1001
	desc = "EVTDESClalad_events.1001"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		opinion = { modifier = scheming_bastard who = FROM duration = -1 }
		IF = {
			limit = { NOT = { wealth = 100 } }
			clear_wealth = ROOT
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 100
				NOT = { wealth = 200 }
			}
			wealth = -100
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 200
				NOT = { wealth = 500 }
			}
			wealth = -200
			FROM = { wealth = 200 }
		}
		IF = {
			limit = { wealth = 500 }
			wealth = -500
			FROM = { wealth = 500 }
		}
	}

	option = {
		name = "EVTOPTAlalad_events.1001"
		FROM = {
			character_event = { id = lalad_events.11 }
		}
	}
}

character_event = {
	id = lalad_events.1002
	desc = "EVTDESClalad_events.1002"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		opinion = { modifier = scheming_bastard who = FROM duration = -1 }
		IF = {
			limit = { NOT = { wealth = 100 } }
			clear_wealth = ROOT
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 100
				NOT = { wealth = 200 }
			}
			wealth = -100
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 200
				NOT = { wealth = 500 }
			}
			wealth = -200
			FROM = { wealth = 200 }
		}
		IF = {
			limit = { wealth = 500 }
			wealth = -500
			FROM = { wealth = 500 }
		}
			random_child = {
				limit = {
					NOT = { character = ROOT }
					at_location = FROM
				}
				imprison = FROM
			}
			random_spouse = {
				limit = {
					NOT = { character = ROOT }
					at_location = FROM
				}
				imprison = FROM
			}
			random_dynasty_member = {
				limit = {
					NOT = { character = ROOT }
					at_location = FROM
				}
				imprison = FROM
			}
			random_courtier = {
				limit = {
					NOT = { character = ROOT }
					at_location = FROM
				}
				imprison = FROM
			}
	}

	option = {
		name = "EVTOPTAlalad_events.1002"
		FROM = {
			character_event = { id = lalad_events.12 }
		}
	}
}

character_event = {
	id = lalad_events.1003
	desc = "EVTDESClalad_events.1003"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		opinion = { modifier = scheming_bastard who = FROM duration = -1 }
	}

	option = {
		name = "EVTOPTAlalad_events.1003"
		FROM = {
			character_event = { id = lalad_events.13 }
		}
	}
}

character_event = {
	id = lalad_events.2001
	desc = "EVTDESClalad_events.2001"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		opinion = { modifier = opinion_friend who = FROM years = 5 }
		IF = {
			limit = { NOT = { wealth = 100 } }
			clear_wealth = ROOT
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 100
				NOT = { wealth = 200 }
			}
			wealth = -100
			FROM = { wealth = 100 }
		}
		IF = {
			limit = {
				wealth = 200
				NOT = { wealth = 500 }
			}
			wealth = -200
			FROM = { wealth = 200 }
		}
		IF = {
			limit = { wealth = 500 }
			wealth = -500
			FROM = { wealth = 500 }
		}
		FROM = {
			location = {
				add_province_modifier = { name = lalad_patrol days = 365 }
				remove_province_modifier = smugglers_ring
				remove_province_modifier = thieves_guild
				remove_province_modifier = highway_robber_band
			}
		}
	}

	option = {
		name = "EVTOPTAlalad_events.2001"
		FROM = {
			character_event = { id = lalad_events.21 }
		}
	}
}

character_event = {
	id = lalad_events.2002
	desc = "EVTDESClalad_events.2002"
	picture = "GFX_evt_council"

	is_triggered_only = yes

	immediate = {
		opinion = { modifier = opinion_furious who = FROM years = 5 }
	}

	option = {
		name = "EVTOPTAlalad_events.2002"
		FROM = {
			character_event = { id = lalad_events.22 }
		}
	}
}