# Siege Events: 62000 - 62299

character_event = {
	id = 62000
	title = EVTNAME62000
	desc = EVTDESC62000
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes

			# Enemy troops are at least 10% of our troops
			troops = {
				who = troops
				value >= 0.1
				enemy = yes
			}
		}

		has_game_rule = {
			name = siege_events
			value = on
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			martial < 2
		}

		mult_modifier = {
			factor = 1.33
			martial < 4
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial >= 7
					}
				}
			}
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial >= 10
					}
				}
			}
		}

		mult_modifier = {
			factor = 10

			siege = {
				location = {
					### COW ###
					OR = { 
						has_wonder_upgrade = upgrade_hidden_gates
						has_wonder_upgrade = upgrade_cow_hidden_gates
					}
				}
			}
		}
	}

	immediate = {
		siege = {
			troops = -0.05

			enemy = {
				troops = -0.025
				morale = 0.10

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62030 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62030 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62000

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.05
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			troops = -0.025
		#			morale = 0.10
		#		}
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62030
	title = EVTNAME62000
	desc = EVTDESC62000
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62000

		# custom_tooltip = { text = successful_sally } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62001
	title = EVTNAME62001
	desc = EVTDESC62000
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = no

			# Enemy troops are no more than 1000% of our troops
			troops = {
				who = troops
				value < 10
				enemy = yes
			}
		}

		has_game_rule = {
			name = siege_events
			value = on
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.4
			trait = wroth
		}

		mult_modifier = {
			factor = 1.33
			martial >= 7
		}

		mult_modifier = {
			factor = 1.33
			martial >= 10
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial < 2
					}
				}
			}
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial < 4
					}
				}
			}
		}

		mult_modifier = {
			factor = 10

			siege = {
				location = {
					### COW ###
					OR = { 
						has_wonder_upgrade = upgrade_hidden_gates
						has_wonder_upgrade = upgrade_cow_hidden_gates
					}
				}
			}
		}
	}

	immediate = {
		siege = {
			morale = 0.10
			troops = -0.025

			enemy = {
				troops = -0.05

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62031 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62031 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62000

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 0.10
		#		troops = -0.025
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			troops = -0.05
		#		}
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62031
	title = EVTNAME62001
	desc = EVTDESC62000
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62000

		# custom_tooltip = { text = successful_sally_attacker } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62003
	title = EVTNAME62003
	desc = EVTDESC62002
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes

			# Enemy troops are at least 10% of our troops
			troops = {
				who = troops
				value >= 0.1
				enemy = yes
			}
		}

		NOT = {
			has_game_rule = {
				name = siege_events
				value = off
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.4
			trait = patient
		}

		mult_modifier = {
			factor = 1.33
			martial < 7
		}

		mult_modifier = {
			factor = 1.33
			martial < 10
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial >= 2
					}
				}
			}
		}

		mult_modifier = {
			factor = 0.8

			siege = {
				enemy = {
					leader = {
						martial >= 4
					}
				}
			}
		}
	}

	immediate = {
		siege = {
			troops = -0.025

			enemy = {
				troops = -0.05
				morale = -0.10

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62033 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62033 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62002

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.025
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			troops = -0.05
		#			morale = -0.1
		#		}
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62033
	title = EVTNAME62003
	desc = EVTDESC62002
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62002

		# custom_tooltip = { text = failed_sally } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62004
	title = EVTNAME62004
	desc = EVTDESC62004
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = no

			# Enemy troops are no more than 1000% of our troops
			troops = {
				who = troops
				value < 10
				enemy = yes
			}
		}

		has_game_rule = {
			name = siege_events
			value = on
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			trait = cruel
		}

		mult_modifier = {
			factor = 1.33
			intrigue >= 8
		}

		mult_modifier = {
			factor = 0.8
			trait = kind
		}

		mult_modifier = {
			factor = 0.8
			intrigue < 4
		}
	}

	immediate = {
		siege = {
			morale = 0.10

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62034 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62034 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62004

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 0.10
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62034
	title = EVTNAME62004
	desc = EVTDESC62004
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62034

		# custom_tooltip = { text = siege_execute } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62005
	title = EVTNAME62005
	desc = EVTDESC62005
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes
		}

		NOT = {
			has_game_rule = {
				name = siege_events
				value = off
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			trait = elusive_shadow
		}

		mult_modifier = {
			factor = 1.33
			intrigue >= 8
		}

		mult_modifier = {
			factor = 0.8
			trait = amateurish_plotter
		}

		mult_modifier = {
			factor = 0.8
			intrigue < 4
		}
	}

	immediate = {
		siege = {
			enemy = {
				morale = -0.10

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62035 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62035 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62005

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			morale = -0.10
		#		}
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62035
	title = EVTNAME62005
	desc = EVTDESC62005
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62005

		# custom_tooltip = { text = siege_treachery } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62006
	title = EVTNAME62006
	desc = EVTDESC62006
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes
		}

		has_game_rule = {
			name = siege_events
			value = on
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			martial < 2
		}

		mult_modifier = {
			factor = 1.33
			martial < 4
		}

		mult_modifier = {
			factor = 0.8
			martial >= 6
		}

		mult_modifier = {
			factor = 0.8
			martial >= 8
		}
	}

	immediate = {
		siege = {
			troops = -0.05

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62036 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62036 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62006

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.05
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62036
	title = EVTNAME62006
	desc = EVTDESC62006
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62006

		# custom_tooltip = { text = siege_disease } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62007
	title = EVTNAME62007
	desc = EVTDESC62007
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = no
		}

		NOT = {
			has_game_rule = {
				name = siege_events
				value = off
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.75
			martial < 2
		}

		mult_modifier = {
			factor = 0.75
			martial < 4
		}

		mult_modifier = {
			factor = 1.25
			martial >= 6
		}

		mult_modifier = {
			factor = 1.25
			martial >= 8
		}
	}

	immediate = {
		siege = {
			troops = -0.05

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62037 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62037 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62007

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.05
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62037
	title = EVTNAME62007
	desc = EVTDESC62007
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62007

		# custom_tooltip = { text = siege_hunger } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62008
	title = EVTNAME62008
	desc = EVTDESC62008
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = no
		}

		NOT = {
			has_game_rule = {
				name = siege_events
				value = off
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			diplomacy >= 6
		}

		mult_modifier = {
			factor = 1.33
			trait = grey_eminence
		}

		mult_modifier = {
			factor = 0.8
			diplomacy < 2
		}

		mult_modifier = {
			factor = 0.8
			trait = naive_appeaser
		}
	}

	immediate = {
		siege = {
			morale = 0.10

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62038 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62038 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62008

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 0.10
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62038
	title = EVTNAME62008
	desc = EVTDESC62008
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62008

		# custom_tooltip = { text = siege_trader } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62009
	title = EVTNAME62009
	desc = EVTDESC62009
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes
		}

		has_game_rule = {
			name = siege_events
			value = on
		}

		location = {
			duchy = {
				NOT = { title = d_toscana }
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			martial < 2
		}

		mult_modifier = {
			factor = 1.33
			martial < 4
		}

		mult_modifier = {
			factor = 0.8
			martial >= 6
		}

		mult_modifier = {
			factor = 0.8
			martial >= 8
		}
	}

	immediate = {
		siege = {
			troops = -0.01

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62039 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62039 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62009

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.01
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62039
	title = EVTNAME62009
	desc = EVTDESC62009
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62039

		# custom_tooltip = { text = siege_raiders } # CleanSlate: Not visible as it's a notification
	}
}

character_event = {
	id = 62010
	title = EVTNAME62010
	desc = EVTDESC62010
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	trigger = {
		siege = {
			is_attacker = yes
		}

		has_game_rule = {
			name = siege_events
			value = on
		}

		location = {
			duchy = {
				title = d_toscana
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			martial < 2
		}

		mult_modifier = {
			factor = 1.33
			martial < 4
		}

		mult_modifier = {
			factor = 0.8
			martial >= 6
		}

		mult_modifier = {
			factor = 0.8
			martial >= 8
		}
	}

	immediate = {
		siege = {
			troops = -0.01

			enemy = {
				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62040 }
					}

					any_liege = {
						limit = {
							war_with = ROOT

							ROOT = {
								liege = {
									NOT = { has_landed_title = e_rebels }
								}
							}
						}

						character_event = { id = 62040 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62010

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		troops = -0.01
		#	}
		# }
	}
}

character_event = { # Other side gets event
	id = 62040
	title = EVTNAME62010
	desc = EVTDESC62040
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62010

		# custom_tooltip = { text = siege_raiders } # CleanSlate: Not visible as it's a notification
	}
}

narrative_event = {
	id = 62011
	title = EVTNAME62011
	desc = EVTDESC62011
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	religion_group = christian

	trigger = {
		has_game_rule = {
			name = siege_events
			value = on
		}

		siege = {
			is_attacker = no

			# Determine if owner of sieging army is pagan
			enemy = {
				leader = {
					any_unit_leader = {
						trigger_if = {
							limit = { religion_group = pagan_group }

							any_unit = {
								any_unit_leader = {
									character = PREVPREV
								}
							}
						}
						trigger_else = {
							any_liege = {
								religion_group = pagan_group

								any_unit = {
									any_unit_leader = {
										character = PREVPREVPREV
									}
								}
							}
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			trait = zealous
		}

		mult_modifier = {
			factor = 1.33
			piety >= 500
		}

		mult_modifier = {
			factor = 0.8
			trait = cynical
		}

		mult_modifier = {
			factor = 0.8
			piety < 0
		}
	}

	immediate = {
		siege = {
			morale = 1

			enemy = {
				morale = -0.90
				troops = -0.90

				leader = {
					if = {
						limit = { war_with = ROOT }
						narrative_event = { id = 62041 }
					}

					any_liege = {
						limit = { war_with = ROOT }
						narrative_event = { id = 62041 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62011

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 1
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			morale = -0.90
		#			troops = -0.90
		#		}
		#	}
		# }
	}
}

narrative_event = { # Other side gets event
	id = 62041
	title = EVTNAME62041
	desc = EVTDESC62011
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62041

		# custom_tooltip = { text = siege_miracle } # CleanSlate: Not visible as it's a notification
	}
}

narrative_event = {
	id = 62012
	title = EVTNAME62011
	desc = EVTDESC62012
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	religion_group = christian

	trigger = {
		has_game_rule = {
			name = siege_events
			value = on
		}

		siege = {
			is_attacker = no

			# Determine if owner of sieging army is muslim
			enemy = {
				leader = {
					any_unit_leader = {
						trigger_if = {
							limit = { religion_group = muslim }

							any_unit = {
								any_unit_leader = {
									character = PREVPREV
								}
							}
						}
						trigger_else = {
							any_liege = {
								religion_group = muslim

								any_unit = {
									any_unit_leader = {
										character = PREVPREVPREV
									}
								}
							}
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			trait = zealous
		}

		mult_modifier = {
			factor = 1.33
			piety >= 500
		}

		mult_modifier = {
			factor = 0.8
			trait = cynical
		}

		mult_modifier = {
			factor = 0.8
			piety < 0
		}
	}

	immediate = {
		siege = {
			morale = 1

			enemy = {
				morale = -0.9
				troops = -0.9

				leader = {
					if = {
						limit = { war_with = ROOT }
						narrative_event = { id = 62042 }
					}

					any_liege = {
						limit = { war_with = ROOT }
						narrative_event = { id = 62042 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62012

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 1
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			morale = -0.90
		#			troops = -0.90
		#		}
		#	}
		# }
	}
}

narrative_event = { # Other side gets event
	id = 62042
	title = EVTNAME62041
	desc = EVTDESC62012
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62041

		# custom_tooltip = { text = siege_miracle } # CleanSlate: Not visible as it's a notification
	}
}

# Miracle
narrative_event = {
	id = 62013
	title = EVTNAME62011
	desc = EVTDESC62013
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events
	notification = yes

	religion_group = muslim

	trigger = {
		has_game_rule = {
			name = siege_events
			value = on
		}

		siege = {
			is_attacker = no

			# Determine if owner of sieging army is not pagan
			enemy = {
				leader = {
					any_unit_leader = {
						trigger_if = {
							limit = {
								NOT = { religion_group = pagan_group }
							}

							any_unit = {
								any_unit_leader = {
									character = PREVPREV
								}
							}
						}
						trigger_else = {
							any_liege = {
								NOT = { religion_group = pagan_group }

								any_unit = {
									any_unit_leader = {
										character = PREVPREVPREV
									}
								}
							}
						}
					}
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 1.33
			trait = zealous
		}

		mult_modifier = {
			factor = 1.33
			piety >= 500
		}

		mult_modifier = {
			factor = 0.8
			trait = cynical
		}

		mult_modifier = {
			factor = 0.8
			piety < 0
		}
	}

	immediate = {
		siege = {
			morale = 1

			enemy = {
				morale = -0.90
				troops = -0.90

				leader = {
					if = {
						limit = { war_with = ROOT }
						narrative_event = { id = 62043 }
					}

					any_liege = {
						limit = {  war_with = ROOT}
						narrative_event = { id = 62043 }
					}
				}
			}
		}
	}

	option = {
		name = EVTOPTA62013

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	siege = {
		#		show_scope_change = no
		#
		#		morale = 1
		#
		#		enemy = {
		#			show_scope_change = no
		#
		#			morale = -0.90
		#			troops = -0.90
		#		}
		#	}
		# }
	}
}

narrative_event = { # Other side gets event
	id = 62043
	title = EVTNAME62041
	desc = EVTDESC62013
	picture = GFX_evt_siege
	border = GFX_event_narrative_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62041

		# custom_tooltip = { text = siege_miracle } # CleanSlate: Not visible as it's a notification
	}
}

# Assault
character_event = {
	id = 62014
	title = EVTNAME62014
	desc = EVTDESC62014
	picture = GFX_evt_crusaders
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # on_siege_pulse, random_events

	religion_group = christian

	trigger = {
		siege = {
			is_attacker = yes

			# Determine if owner of defending army is not christian
			enemy = {
				leader = {
					any_unit_leader = {
						trigger_if = {
							limit = {
								NOT = { religion_group = christian }
							}

							any_unit = {
								any_unit_leader = {
									character = PREVPREV
								}
							}
						}
						trigger_else = {
							any_liege = {
								NOT = { religion_group = christian }

								any_unit = {
									any_unit_leader = {
										character = PREVPREVPREV
									}
								}
							}
						}
					}
				}
			}
		}

		can_be_maimed_trigger = yes

		NOR = {
			trait = craven
			trait = cynical
			trait = wounded
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2.0
			trait = zealous
		}

		mult_modifier = {
			factor = 2.0
			trait = brave
		}
	}

	immediate = {
		siege = {
			enemy = {
				morale = -0.10

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62044 }
					}

					any_liege = {
						limit = { war_with = ROOT }
						character_event = { id = 62044 }
					}
				}
			}
		}

		random_list = {
			80 = { add_trait = crusader }
			10 = { add_maimed_trait_effect = yes }
			10 = { add_trait_wounded_effect = yes }
		}
	}

	option = {
		name = EVTOPTA62014

		tooltip = {
			siege = {
				show_scope_change = no

				enemy = {
					show_scope_change = no

					morale = -0.10
				}
			}

			random_list = {
				80 = { add_trait = crusader }
				10 = { add_maimed_trait_effect = yes }
				10 = { add_trait_wounded_effect = yes }
			}
		}
	}
}

character_event = { # Other side gets event
	id = 62044
	title = EVTNAME62044
	desc = EVTDESC62044
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62044

		custom_tooltip = { text = siege_treachery }
	}
}

# Ill, pneumonic, leper or great_pox
character_event = {
	id = 62015
	title = EVTNAME62015
	desc = EVTDESC62015
	picture = GFX_evt_crusaders
	border = GFX_event_normal_frame_war

	is_triggered_only = yes # on_siege_pulse, random_events

	trigger = {
		is_ill = yes
		NOT = { trait = craven }
	}

	weight_multiplier = {
		factor = 1
	}

	option = {
		name = EVTOPTA62015

		siege = {
			show_scope_change = no

			troops = -0.10

			enemy = {
				show_scope_change = no

				morale = -0.20
				troops = -0.20

				leader = {
					if = {
						limit = { war_with = ROOT }
						character_event = { id = 62045 }
					}

					any_liege = {
						limit = { war_with = ROOT }
						character_event = { id = 62045 }
					}
				}
			}
		}

		random_list = {
			60 = {
				add_maimed_trait_effect = yes
				prestige = 50
			}

			40 = {
				death = {
					death_reason = death_battle
					killer = FROM
				}
			}
		}
	}

	option = {
		name = EVTOPTB62015

		siege = {
			show_scope_change = no

			troops = -0.15

			enemy = {
				show_scope_change = no

				morale = -0.05
				troops = -0.05

				leader = {
					if = {
						limit = {  war_with = ROOT }
						character_event = { id = 62046 }
					}

					any_liege = {
						limit = { war_with = ROOT }
						character_event = { id = 62046 }
					}
				}
			}
		}

		random = {
			chance = 50
			add_trait_fully_craven_effect = yes
		}

		prestige = -50
	}
}

character_event = { # Other side gets event
	id = 62045
	title = EVTNAME62044
	desc = EVTDESC62045
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62045

		custom_tooltip = { text = siege_assault }
	}
}

character_event = { # Other side gets event
	id = 62046
	title = EVTNAME62044
	desc = EVTDESC62045
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes

	ai = no

	option = {
		name = EVTOPTA62045

		custom_tooltip = { text = siege_hide }
	}
}

# Imprisoned by the winner. Fired from 'on_siege_over_loc_chars'.
# new_character is siege winner unit owner
# FROM is lost holding title
# ROOT is local character
character_event = {
	id = 62100
	desc = EVTDESC62100
	picture = GFX_evt_siege

	is_triggered_only = yes # on_siege_over_loc_chars, random_events

	ai = no # Better for performance

	trigger = {
		always = no # CK2Plus has better events to imprison characters

		new_character = {
			NOT = { has_landed_title = e_rebels }
			rebel = no

			NOR = { # Handled by SSI.61
				has_landed_title = e_aztec_empire

				any_liege = {
					has_landed_title = e_aztec_empire
				}
			}
		}

		OR = {
			is_ruler = yes

			trigger_if = {
				limit = { is_female = yes }
				practical_age < 40
			}

			host = {
				OR = {
					is_close_relative = ROOT
					is_married = ROOT

					any_consort = {
						character = ROOT
					}

					top_liege = {
						war_with = new_character
						is_close_relative = ROOT
					}
				}
			}

			# Doesn't work, on_action doesn't seem to fire for these characters
			trigger_if = {
				limit = { prisoner = yes }

				employer = {
					character = new_character
				}
			}
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2

			is_female = yes

			new_character = {
				OR = {
					religion_group = pagan_group
					religion_group = zoroastrian_group
				}
			}
		}

		# Doesn't work, on_action doesn't seem to fire for these characters
		mult_modifier = {
			factor = 4 # Free prisoner

			prisoner = yes

			employer = {
				character = new_character
			}
		}

		mult_modifier = {
			factor = 10 # if new_char (the sieger) was a warrior lodge member

			new_character = {
				is_member_of_any_warrior_lodge_trigger = yes
				society_rank > 1 # Must be rank 2 or higher
			}
		}

		mult_modifier = {
			factor = 10 # if new_char (the sieger) has a particular Legendary bloodline

			new_character = {
				any_owned_bloodline = {
					has_bloodline_flag = bloodline_reaver
				}
			}
		}
	}

	option = {
		name = EVTOPTA62100

		trigger = {
			center_flank_leader = {
				mercenary = no
			}
		}

		imprison = new_character

		new_character = {
			character_event = { id = 62101 }
		}
	}

	option = {
		name = EVTOPTA62100

		trigger = {
			center_flank_leader = {
				mercenary = yes
			}
		}

		center_flank_leader = {
			show_scope_change = no

			ROOT = {
				show_scope_change = no

				imprison = PREV
			}
		}
	}
}

# Jailor informed
character_event = {
	id = 62101
	desc = EVTDESC62101
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	notification = yes

	ai = no

	option = {
		name = EVTOPTA62101

		# CleanSlate: Not visible as it's a notification
		# tooltip = {
		#	FROM = {
		#		show_scope_change = no
		#
		#		imprison = yes
		#	}
		# }
	}
}