###########################################
#
# Crusade Events
#
# ID 8300-8499 is reserved
#
###########################################

# Arriving for the crusade (Christians and Muslims)
character_event = {
	id = 8300
	desc = "EVTDESC8300"
	picture = "GFX_evt_crusaders"
	border = GFX_event_normal_frame_war
	
	war = yes
	min_age = 16
	capable_only = yes
	prisoner = no

	trigger = {
		OR = {
			religion_group = christian
			religion_group = muslim
		}
		has_called_crusade = yes
		in_command_trigger = yes
		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		NOR = {
			trait = crusader
			trait = mujahid			
		}
		crusade_target = {
			is_located_in = ROOT
		}
	}

	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = "EVTOPTA8300"
		trigger = {
			religion_group = christian
		}
		add_trait = crusader
	}
	option = {
		name = "GLORY"
		trigger = {
			religion_group = muslim
		}
		add_trait = mujahid
	}
}

# Arriving for the great holy war - Norse
character_event = {
	id = 8468
	desc = "EVTDESC8300"
	picture = "GFX_evt_battle"
	border = GFX_event_normal_frame_war
	
	war = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		NOT = { trait = valhalla_bound }
		in_command = yes
		OR = {
			AND = {
				any_war = {
					using_cb = crusade
				}
				OR = {
					religion = norse_pagan
					religion = norse_pagan_reformed
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
			any_liege = {
				OR = {
					religion = norse_pagan
					religion = norse_pagan_reformed
				}
				any_war = {
					using_cb = crusade
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		trigger = {
			OR = {
				religion = norse_pagan
				religion = norse_pagan_reformed
			}
		}
		name = "EVTOPTA8468"
		add_trait = valhalla_bound
	}
}

# Arriving for the great holy war - non-norse Pagans and Jews
character_event = {
	id = 8469
	desc = "EVTDESC8300"
	picture = "GFX_evt_battle"
	border = GFX_event_normal_frame_war
	
	war = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		OR = {
			is_pagan_religion = yes
			religion_group = jewish_group
			religion_group = zoroastrian_group
		}
		NOR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		has_crusade_trait_trigger = no
		in_command = yes
		OR = {
			AND = {
				any_war = {
					using_cb = crusade
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
			any_liege = {
				religion = ROOT
				any_war = {
					using_cb = crusade
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}

	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = "8469.a"
		add_crusade_trait_effect = yes
	}
}

# Arriving at the crusade target
character_event = {
	id = 8305
	desc = "EVTDESC8305"
	picture = "GFX_evt_siege"
	border = GFX_event_normal_frame_war

	war = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		has_called_crusade = yes
		in_command_trigger = yes
		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		crusade_target = {
			is_located_in = ROOT
		}
		NOT = { has_character_flag = arrived_at_crusade_target }
		location = {
			holder_scope = {
				NOT = { character = ROOT }
			}
		}
	}

	mean_time_to_happen = {
		days = 1
	}
	
	immediate = {
		hidden_tooltip = {
			set_character_flag = arrived_at_crusade_target
		}
	}
	
	option = {
		name = "EXCELLENT"
		prestige = 25
		piety = 25
	}
}

# Pope lifts Excommunication (AI characters only)
character_event = {
	id = 8306
	
	hide_window = yes

	min_age = 16
	capable_only = yes
	prisoner = no
	ai = yes
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		OR = {
			any_independent_ruler = {
				religion = ROOT
				any_war = { using_cb = crusade }
				excommunicated_for = ROOT
			}
			any_independent_ruler = {
				any_realm_lord = {
					religion = ROOT
					any_war = { using_cb = crusade }
					excommunicated_for = ROOT
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1
	}
	
	immediate = {
		any_independent_ruler = {
			limit = {
				religion = ROOT
				any_war = { using_cb = crusade }
				excommunicated_for = ROOT
			}
			set_character_flag = offered_revoked_excommunication
			letter_event = { id = 8467 days = 1 }
			break = yes
		}
		any_independent_ruler = {
			any_realm_lord = {
				limit = {
					religion = ROOT
					any_war = { using_cb = crusade }
					excommunicated_for = ROOT
				}
				set_character_flag = offered_revoked_excommunication
				letter_event = { id = 8467 days = 1 }
			}
		}
	}
}


### On actions events ###

# Character becomes zealous
# on_battle_won
# FROM = opposing army's owner
character_event = {
	id = 8310
	desc = "EVTDESC8310"
	picture = "GFX_evt_knight_kneeling"
	border = GFX_event_normal_frame_religion
	
	hide_from = yes
	
	min_age = 16
	capable_only = yes
	prisoner = no
	is_triggered_only = yes
	
	trigger = {
		NOT = { trait = zealous }
		NOT = { trait = cynical }
		
		has_called_crusade = yes
		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		crusade_target = {
			is_located_in = ROOT
		}
	}

	option = {
		name = "EXCELLENT"
		add_trait = zealous
	}
}

# Character becomes cynical
# on_battle_lost
# FROM = opposing army's owner
character_event = {
	id = 8320
	desc = "EVTDESC8320"
	picture = "GFX_evt_pale_rider"
	border = GFX_event_normal_frame_war

	min_age = 16
	capable_only = yes
	prisoner = no
	is_triggered_only = yes
	
	trigger = {
		NOT = { trait = cynical }
		NOT = { trait = zealous }
		
		has_called_crusade = yes
		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		crusade_target = {
			is_located_in = ROOT
		}
	}
	
	option = {
		name = "EVTOPTA8320"
		add_trait = cynical
	}
}

# Conquers the crusade target
# on_siege_won_leader
# FROM = barony won
character_event = {
	id = 8330
	desc = EVTDESC8330
	picture = GFX_evt_siege
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { is_capital = yes }
		
		has_called_crusade = yes
		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		crusade_target = {
			de_jure_vassal_or_below = FROM
		}
	}
	
	option = {
		name = EVTOPTA8330
		prestige = 100
		piety = 100
		hidden_tooltip = {
			set_character_flag = captures_crusade_target
			if = {
				limit = {
					independent = no
				}
				# Only liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								using_cb = crusade
							}
						}
						top_liege = {
							NOT = {
								any_war = {
									using_cb = crusade
								}
							}
						}
					}
					liege = { letter_event = { id = 8331 days = 1 } }
				}
				# Only top liege
				if = {
					limit = {
						liege = {
							NOT = {
								any_war = {
									using_cb = crusade
								}
							}
						}
						top_liege = {
							any_war = {
								using_cb = crusade
							}
						}
					}
					top_liege = { letter_event = { id = 8331 days = 1 } }
				}
				# Both liege and top liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								using_cb = crusade
							}
							ROOT = {
								top_liege = {
									NOT = { character = PREVPREV }
									any_war = {
										using_cb = crusade
									}
								}
							}
						}
					}
					liege = { letter_event = { id = 8331 days = 1 } }
					top_liege = { letter_event = { id = 8331 days = 1 } }
				}
			}
		}
	}
}

# Inform liege of capturing the crusade target
letter_event = {
	id = 8331
	desc = "EVTDESC8331"
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		if = {
			limit = { NOT = { has_character_flag = captures_crusade_target } }
			prestige = 25
			piety = 25
		}
		set_character_flag = captures_crusade_target
	}
}


# Finds the Spear of Destiny / Holy Lance
# on_siege_won_leader
# FROM = barony won
character_event = {
	id = 8340
	desc = "EVTDESC8340"
	picture = "GFX_evt_siege"
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
		
	trigger = {
		religion_group = christian
		is_heretic = no
		FROM = { title = b_jerusalem }
		OR = {
			any_war = {
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					using_cb = crusade
				}
			}
		}
		NOT = { has_global_flag = found_the_holy_lance }
	}
	
	immediate = {
		hidden_tooltip = {
			set_global_flag = found_the_holy_lance
		}
	}
	
	option = {
		name = "EVTOPTA8340"
		prestige = 100
		if = {
			limit = { has_dlc = Mystics }
			add_artifact = spear_of_destiny
			new_artifact = {
				set_creation_date = 1.1.1
			}
		}
	}
}


# Finds the Holy Grail
# on_siege_won_leader
# FROM = barony won
character_event = {
	id = 8342
	desc = "EVTDESC8342"
	picture = "GFX_evt_siege"
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	trigger = {
		religion_group = christian
		is_heretic = no
		FROM = { title = b_syrcaesarea }
		OR = {
			any_war = {
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					using_cb = crusade
				}
			}
		}
		NOT = { has_global_flag = found_the_holy_grail }
	}
	
	immediate = {
		hidden_tooltip = {
			set_global_flag = found_the_holy_grail
		}
	}
	
	option = {
		name = "EVTOPTA8342"
		prestige = 200
		if = {
			limit = { has_dlc = Mystics }
			
			if = { 
				limit = {
					NOT = {
						has_game_rule = {
							name = supernatural_events
							value = off
						}
					}
				}
				add_artifact = holy_grail
				new_artifact = {
					set_creation_date = 1.1.1
				}
			}
			if = {
				limit = {
					has_game_rule = {
						name = supernatural_events
						value = off
					}
				}
				add_artifact = holy_chalice
				new_artifact = {
					set_creation_date = 1.1.1
				}
			}
		}
	}
}


# Sack of Jerusalem
# on_siege_won_leader
# FROM = barony won
character_event = {
	id = 8345
	desc = "EVTDESC8345"
	picture = "GFX_evt_siege"
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	religion_group = christian
		
	trigger = {
		is_heretic = no
		FROM = { title = b_jerusalem }
		OR = {
			any_war = {
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					using_cb = crusade
				}
			}
		}
	}
	
	option = {
		name = "EVTOPTA8345"
		prestige = 50
	}
}


# Loses the crusade target's capital
# on_siege_lost_leader
# FROM = barony lost
character_event = {
	id = 8350
	desc = "EVTDESC8350"
	picture = "GFX_evt_siege"
	border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	trigger = {
		FROM = { is_capital = yes }

		OR = {
			any_war = {
				attacker = { religion = ROOT }
				using_cb = crusade
			}
			any_liege = {
				any_war = {
					attacker = { religion = ROOT }
					using_cb = crusade
				}
			}
		}
		crusade_target = {
			de_jure_vassal_or_below = FROM
		}
	}
	
	option = {
		name = "EVTOPTA8350"
		prestige = -50
		piety = -50
		hidden_tooltip = {
			if = {
				limit = {
					independent = no
				}
				# Only liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								using_cb = crusade
							}
						}
						top_liege = {
							NOT = {
								any_war = {
									using_cb = crusade
								}
							}
						}
					}
					liege = { letter_event = { id = 8351 days = 1 } }
				}
				# Only top liege
				if = {
					limit = {
						liege = {
							NOT = {
								any_war = {
									using_cb = crusade
								}
							}
						}
						top_liege = {
							any_war = {
								using_cb = crusade
							}
						}
					}
					top_liege = { letter_event = { id = 8351 days = 1 } }
				}
				# Both liege and top liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								using_cb = crusade
							}
							ROOT = {
								top_liege = {
									NOT = { character = PREVPREV }
									any_war = {
										using_cb = crusade
									}
								}
							}
						}
					}
					liege = { letter_event = { id = 8351 days = 1 } }
					top_liege = { letter_event = { id = 8351 days = 1 } }
				}
			}
		}
	}
}

# Inform liege of losing the crusade target
letter_event = {
	id = 8351
	desc = "EVTDESC8351"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8351"
		prestige = -25
		piety = -25
	}
}


########################################
# Disappointment of not participating
########################################

### Pope Disappointed ###

# Pope is concerned that an independent ruler is not participating in crusade
character_event = {
	id = 8400
	desc = "EVTDESC8400"
	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion
	
	only_playable = yes
	only_men = yes
	only_capable = yes
	min_age = 16
	prisoner = no
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		had_global_flag = { flag = crusade_called days = 180 }
		
		any_independent_ruler = {
			religion = ROOT
			NOT = {
				any_war = {
					using_cb = crusade
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			rightful_religious_head_scope = {
				character = ROOT
			}
			NOT = { excommunicated_for = ROOT }
			NOR = {
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_emperor
				}
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_king
				}
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_duke
				}
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_count
				}
			}
			NOT = {
				any_realm_province = {
					any_neighbor_province = {
						has_owner = yes
						NOT = { religion_group = christian } 
					}
				}
			}
			NOT = { mercenary = yes }
		}
	}
	
	mean_time_to_happen = {
		months = 6
		
		modifier = {
			factor = 0.5
			trait = zealous
		}
	}
	
	option = {
		name = "EVTOPTA8400"
		random_independent_ruler = {
			limit = {
				religion = ROOT
				NOT = {
					any_war = {
						using_cb = crusade
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				rightful_religious_head_scope = {
					character = ROOT
				}
				NOT = { excommunicated_for = ROOT }
				NOR = {
					reverse_has_opinion_modifier = {
						who = ROOT
						modifier = opinion_not_participating_in_crusade_emperor
					}
					reverse_has_opinion_modifier = {
						who = ROOT
						modifier = opinion_not_participating_in_crusade_king
					}
					reverse_has_opinion_modifier = {
						who = ROOT
						modifier = opinion_not_participating_in_crusade_duke
					}
					reverse_has_opinion_modifier = {
						who = ROOT
						modifier = opinion_not_participating_in_crusade_count
					}
				}
				NOT = {
					any_realm_province = {
						any_neighbor_province = {
							has_owner = yes
							NOT = { religion_group = christian } 
						}
					}
				}
				NOT = { mercenary = yes }
			}
			letter_event = { id = 8405 days = 1 }
		}		
	}
}

# Pope shares his concerns
letter_event = {
	id = 8405
	desc = "EVTDESC8405"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8405"
		trigger = { primary_title = { tier = EMPEROR } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_emperor
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8405"
		trigger = { primary_title = { tier = KING } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_king
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8405"
		trigger = { primary_title = { tier = DUKE } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_duke
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8405"
		trigger = { primary_title = { tier = COUNT } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_count
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTB8405"
		set_character_flag = reminded_about_crusade
	}
}

# Pope is disappointed in the rulers decision to not participate in the crusade
character_event = {
	id = 8410
	desc = "EVTDESC8410"
	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion
	
	only_playable = yes
	only_men = yes
	only_capable = yes
	min_age = 16
	prisoner = no
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		had_global_flag = { flag = crusade_called days = 180 }
		
		any_independent_ruler = {
			had_character_flag = { flag = reminded_about_crusade days = 30 }
			religion = ROOT
			NOT = {
				any_war = {
					using_cb = crusade
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			rightful_religious_head_scope = {
				character = ROOT
			}
			NOT = { excommunicated_for = ROOT }
		}
	}
	
	mean_time_to_happen = {
		months = 6
		
		modifier = {
			factor = 0.5
			trait = zealous
		}
	}
	
	option = {
		name = "EVTOPTA8410"
		random_independent_ruler = {
			limit = {
				had_character_flag = { flag = reminded_about_crusade days = 30 }
				religion = ROOT
				NOT = {
					any_war = {
						using_cb = crusade
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				rightful_religious_head_scope = {
					character = ROOT
				}
				NOT = { excommunicated_for = ROOT }
			}
			clr_character_flag = reminded_about_crusade
			letter_event = { id = 8415 days = 1 }
		}		
	}
}

# Pope shares his disappointment
letter_event = {
	id = 8415
	desc = "EVTDESC8415"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8415"
		trigger = { primary_title = { tier = EMPEROR } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_emperor
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8415"
		trigger = { primary_title = { tier = KING } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_king
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8415"
		trigger = { primary_title = { tier = DUKE } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_duke
				who = ROOT
				years = 10
			}
		}
	}
	option = {
		name = "EVTOPTA8415"
		trigger = { primary_title = { tier = COUNT } }
		religion_head = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_count
				who = ROOT
				years = 10
			}
		}
	}
}


### Bishop Disappointed ###

# Bishop is concerned that an independent ruler is not participating in crusade
character_event = {
	id = 8420
	desc = "EVTDESC8420"
	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_religion

	only_men = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	only_rulers = yes
	
	trigger = {
		has_called_crusade = yes
		controls_religion = no
		is_theocracy = yes
		had_global_flag = { flag = crusade_called days = 180 }
		NOT = { has_character_flag = no_complains_about_not_crusading }
		independent = no
		
		liege = {
			war = no
			independent = yes
			religion = ROOT
			prisoner = no
			higher_tier_than = COUNT # Exclude small rulers
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			religion_head = {
				PREV = {
					rightful_religious_head_scope = {
						character = PREVPREV
					}
					NOT = { excommunicated_for = PREV }
				}
			}
			NOT = {
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_bishop
				}
			}
			NOT = {
				any_realm_province = {
					any_neighbor_province = {
						has_owner = yes
						NOT = { religion_group = ROOT } 
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 60
		
		modifier = {
			factor = 0.90
			trait = detached_priest
		}
		modifier = {
			factor = 0.85
			trait = martial_cleric
		}
		modifier = {
			factor = 0.80
			trait = scholarly_theologian
		}
		modifier = {
			factor = 0.75
			trait = mastermind_theologian
		}
		modifier = {
			factor = 0.5
			trait = crusader
		}
		modifier = {
			factor = 0.75
			is_strong_trigger = yes
		}
		modifier = {
			factor = 0.75
			trait = brave
		}
		modifier = {
			factor = 0.5
			trait = zealous
		}
		modifier = {
			factor = 1.25
			trait = content
		}
		modifier = {
			factor = 1.25
			is_weak_trigger = yes
		}
		modifier = {
			factor = 1.25
			trait = craven
		}
		modifier = {
			factor = 1.25
			trait = cynical
		}
	}
	
	option = {
		name = "EVTOPTA8420"
		ai_chance = { factor = 100 }
		set_character_flag = bishop_complains_about_not_crusading
		liege = { letter_event = { id = 8425 days = 1 } }		
	}
	option = {
		name = "EVTOPTB8420"
		set_character_flag = no_complains_about_not_crusading
	}
}

# Bishop shares his concerns
letter_event = {
	id = 8425
	desc = "EVTDESC8425"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8425"
		FROM = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_bishop
				who = ROOT
				years = 10
			}
		}
		FROM = { clr_character_flag = bishop_complains_about_not_crusading }
	}
	option = {
		name = "EVTOPTB8425"
		FROM = { set_character_flag = reminded_about_crusade }
	}
}

# Bishop is disappointed in the rulers decision to not participate in the crusade
character_event = {
	id = 8430
	desc = "EVTDESC8430"
	picture = GFX_evt_bishop
	border = GFX_event_normal_frame_religion
	
	only_rulers = yes
	has_character_flag = bishop_complains_about_not_crusading
	
	trigger = {
		had_character_flag = { flag = reminded_about_crusade days = 30 }
		liege = {
			war = no
			independent = yes
			religion = ROOT
			prisoner = no
			higher_tier_than = COUNT # Exclude small rulers
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			religion_head = {
				PREV = {
					rightful_religious_head_scope = {
						character = PREVPREV
					}
					NOT = { excommunicated_for = PREV }
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 3
	}
	
	option = {
		name = "EVTOPTA8430"
		clr_character_flag = bishop_complains_about_not_crusading
		clr_character_flag = reminded_about_crusade
		liege = { letter_event = { id = 8435 days = 1 } }		
	}
}

# Bishop shares his disappointment
letter_event = {
	id = 8435
	desc = "EVTDESC8435"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8435"
		FROM = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_emperor
				who = ROOT
				years = 10
			}
		}
	}
}


### Vassal Disappointed ###

# Vassal is concerned that an independent ruler is not participating in crusade
character_event = {
	id = 8440
	desc = "EVTDESC8440"
	picture = GFX_evt_emissary

	only_rulers = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		has_called_crusade = yes
		controls_religion = no
		had_global_flag = { flag = crusade_called days = 180 }
		NOT = { has_character_flag = no_complains_about_not_crusading }
		independent = no
		
		liege = {
			war = no
			independent = yes
			religion = ROOT
			prisoner = no
			higher_tier_than = COUNT # Exclude small rulers
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			religion_head = {
				PREV = {
					rightful_religious_head_scope = {
						character = PREVPREV
					}
					NOT = { excommunicated_for = PREV }
				}
			}
			NOT = {
				reverse_has_opinion_modifier = {
					who = ROOT
					modifier = opinion_not_participating_in_crusade_vassal
				}
			}
			NOT = {
				any_realm_province = {
					any_neighbor_province = {
						has_owner = yes
						NOT = { religion_group = ROOT } 
					}
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 120
		
		modifier = {
			factor = 0.90
			trait = misguided_warrior
		}
		modifier = {
			factor = 0.85
			trait = tough_soldier
		}
		modifier = {
			factor = 0.80
			trait = skilled_tactician
		}
		modifier = {
			factor = 0.75
			trait = brilliant_strategist
		}
		modifier = {
			factor = 0.5
			trait = crusader
		}
		modifier = {
			factor = 0.75
			is_strong_trigger = yes
		}
		modifier = {
			factor = 0.75
			trait = brave
		}
		modifier = {
			factor = 0.5
			trait = zealous
		}
		modifier = {
			factor = 1.25
			trait = content
		}
		modifier = {
			factor = 1.25
			is_weak_trigger = yes
		}
		modifier = {
			factor = 1.25
			trait = craven
		}
		modifier = {
			factor = 1.25 
			trait = cynical
		}
	}
	
	option = {
		name = "EVTOPTA8440"
		ai_chance = { factor = 100 }
		set_character_flag = vassal_complains_about_not_crusading
		liege = { letter_event = { id = 8445 days = 1 } }		
	}
	option = {
		name = "EVTOPTB8440"
		set_character_flag = no_complains_about_not_crusading
	}
}

# Vassal shares his concerns
letter_event = {
	id = 8445
	desc = "EVTDESC8445"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8445"
		FROM = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_vassal
				who = ROOT
				years = 10
			}
		}
		FROM = { clr_character_flag = vassal_complains_about_not_crusading }
	}
	option = {
		name = "EVTOPTB8445"
		FROM = { set_character_flag = reminded_about_crusade }
	}
}

# Vassal is disappointed in the rulers decision to not participate in the crusade
character_event = {
	id = 8450
	desc = "EVTDESC8450"
	picture = GFX_evt_emissary
	
	only_rulers = yes
	has_character_flag = vassal_complains_about_not_crusading
	
	trigger = {
		had_character_flag = { flag = reminded_about_crusade days = 30 }
		liege = {
			war = no
			independent = yes
			religion = ROOT
			prisoner = no
			higher_tier_than = COUNT # Exclude small rulers
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
					NOT = { has_non_aggression_pact_with = PREVPREV }
				}
			}
			religion_head = {
				PREV = {
					rightful_religious_head_scope = {
						character = PREVPREV
					}
					NOT = { excommunicated_for = PREV }
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 3
	}
	
	option = {
		name = "EVTOPTA8450"
		clr_character_flag = vassal_complains_about_not_crusading
		clr_character_flag = reminded_about_crusade
		liege = { letter_event = { id = 8455 days = 1 } }		
	}
}

# Vassal shares his disappointment
letter_event = {
	id = 8455
	desc = "EVTDESC8455"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8455"
		FROM = {
			opinion = {
				modifier = opinion_not_participating_in_crusade_vassal
				who = ROOT
				years = 10
			}
		}
	}
}


########################################
# Excommunicated (Player only)
########################################


### Pope Offer to Forgive Excommunicated ###

# Pope finds an excommunicated catholic
character_event = {
	id = 8460
	desc = "EVTDESC8460"
	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion
	
	only_playable = yes
	religion = catholic
	only_men = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		
		OR = {
			any_independent_ruler = {
				ai = no	# Only for players
				religion = catholic
				prisoner = no
				NOT = {
					any_war = {
						using_cb = crusade
						any_attacker = { character = PREVPREV }
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				excommunicated_for = ROOT
				NOT = { has_character_flag = offered_revoked_excommunication }
				NOT = {
					any_realm_province = {
						any_neighbor_province = {
							has_owner = yes
							NOT = { religion = catholic } 
						}
					}
				}
			}
			any_independent_ruler = {
				religion = catholic
				any_realm_lord = {
					ai = no
					religion = catholic
					prisoner = no
					NOT = {
						any_war = {
							using_cb = crusade
							any_attacker = { character = PREVPREV }
						}
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = PREVPREV }
							NOT = { has_non_aggression_pact_with = PREVPREV }
						}
					}
					excommunicated_for = ROOT
					NOT = { has_character_flag = offered_revoked_excommunication }
					NOT = {
						any_realm_province = {
							any_neighbor_province = {
								has_owner = yes
								NOT = { religion_group = christian } 
							}
						}
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 3
	}
	
	option = {
		name = "EVTOPTA8460"
		any_independent_ruler = {
			limit = {
				ai = no	# Only for players
				religion = catholic
				prisoner = no
				NOT = {
					any_war = {
						using_cb = crusade
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				excommunicated_for = ROOT
				NOT = { has_character_flag = offered_revoked_excommunication }
				NOT = {
					any_realm_province = {
						any_neighbor_province = {
							has_owner = yes
							NOT = { religion_group = christian } 
						}
					}
				}
			}
			set_character_flag = offered_revoked_excommunication
			letter_event = { id = 8465 days = 1 }
		}
		any_independent_ruler = {
			limit = {
				religion = catholic
			}
			any_realm_lord = {
				limit = {
					ai = no
					religion = catholic
					prisoner = no
					NOT = {
						any_war = {
							using_cb = crusade
						}
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = PREVPREV }
							NOT = { has_non_aggression_pact_with = PREVPREV }
						}
					}
					excommunicated_for = ROOT
					NOT = { has_character_flag = offered_revoked_excommunication }
					NOT = {
						any_realm_province = {
							any_neighbor_province = {
								has_owner = yes
								NOT = { religion_group = christian } 
							}
						}
					}
				}
				set_character_flag = offered_revoked_excommunication
				letter_event = { id = 8465 days = 1 }
			}
		}
	}
}

# Pope sends his offer
letter_event = {
	id = 8465
	desc = "EVTDESC8465"
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTA8465"
		ai_chance = { factor = 100 }
	}
	option = {
		name = "EVTOPTB8465"
		ai_chance = { factor = 0 }
	}
}

# Pope lifts Excommunication
character_event = {
	id = 8466
	desc = "EVTDESC8466"
	picture = GFX_evt_pope
	border = GFX_event_normal_frame_religion
	
	only_playable = yes
	religion = catholic
	only_men = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		
		OR = {
			any_independent_ruler = {
				ai = no
				religion = catholic
				prisoner = no
				any_war = {
					using_cb = crusade
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				excommunicated_for = ROOT
				has_character_flag = offered_revoked_excommunication
			}
			any_independent_ruler = {
				religion = catholic
				any_realm_lord = {
					ai = no
					religion = catholic
					prisoner = no
					any_war = {
						using_cb = crusade
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = PREVPREV }
							NOT = { has_non_aggression_pact_with = PREVPREV }
						}
					}
					excommunicated_for = ROOT
					has_character_flag = offered_revoked_excommunication
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1
	}
	
	option = {
		name = "EVTOPTA8466"
		any_independent_ruler = {
			limit = {
				ai = no
				religion = catholic
				prisoner = no
				any_war = {
					using_cb = crusade
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
						NOT = { has_non_aggression_pact_with = PREVPREV }
					}
				}
				excommunicated_for = ROOT
				has_character_flag = offered_revoked_excommunication
			}
			letter_event = { id = 8467 days = 1 }
		}
		any_independent_ruler = {
			limit = {
				religion = catholic
			}
			any_realm_lord = {
				limit = {
					ai = no
					religion = catholic
					prisoner = no
					any_war = {
						using_cb = crusade
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = PREVPREV }
							NOT = { has_non_aggression_pact_with = PREVPREV }
						}
					}
					excommunicated_for = ROOT
					has_character_flag = offered_revoked_excommunication
				}
				letter_event = { id = 8467 days = 1 }
			}
		}
	}
}

# Pope sends his offer
letter_event = {
	id = 8467
	desc = "EVTDESC8467"
	
	is_triggered_only = yes
	
	option = {
		name = "EXCELLENT"
		excommunicate = no
		clr_character_flag = offered_revoked_excommunication
	}
}
