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

# Arriving for the crusade
character_event = {
	id = 8300
	desc = "EVTDESC8300"
	picture = "GFX_evt_crusaders"
	border = GFX_event_normal_frame_war
	
	min_age = 16
	capable_only = yes
	prisoner = no
	in_command = yes
	
	is_triggered_only = yes
	
	trigger = {
		religion_group = christian
		NOR = { trait = crusader trait = crusader_king trait = crusader_queen}
		OR = {
			AND = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				religion_group = christian
				crusade_target = {
					is_located_in = ROOT
				}
			}
			any_liege = {
				religion_group = christian
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}
    
	immediate = {
		abdicate_holy_order_if_religion_changes_effect = yes
	}
	
	option = {
		trigger = {
			religion_group = christian
		}
		name = "EVTOPTA8300"
		add_trait = crusader
	}
	
	option = {
		trigger = {
			NOT = { religion_group = christian }
		}
		name = "GLORY"
		add_trait = crusader
	}
}

# Arriving for the crusade (Muslim)
character_event = {
	id = 8301
	desc = "EVTDESC8300"
	picture = "GFX_evt_moors"
	border = GFX_event_normal_frame_war
	
	min_age = 16
	capable_only = yes
	prisoner = no
	in_command = yes
	
	is_triggered_only = yes
	
	trigger = {
		religion_group = muslim
		NOT = { trait = mujahid }
		OR = {
			AND = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				religion_group = muslim
				crusade_target = {
					is_located_in = ROOT
				}
			}
			any_liege = {
				religion_group = muslim
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}
    
	immediate = {
		abdicate_holy_order_if_religion_changes_effect = yes
	}
	
	option = {
		trigger = {
			religion_group = muslim
		}
		name = "EVTOPTA8301"
		add_trait = mujahid
	}
	
	option = {
		trigger = {
			NOT = { religion_group = muslim }
		}
		name = "GLORY"
		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
	
	min_age = 16
	capable_only = yes
	prisoner = no
	in_command = yes
	
	is_triggered_only = yes
	
	trigger = {
		OR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		NOT = { trait = valhalla_bound }
		OR = {
			AND = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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 = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}
    
	immediate = {
		abdicate_holy_order_if_religion_changes_effect = yes
	}
	
	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
	
	min_age = 16
	capable_only = yes
	prisoner = no
	in_command = yes
	
	is_triggered_only = yes
	
	trigger = {
		OR = {
			religion_group = pagan_group
            religion_group = african_group
			religion_group = jewish_group
			religion_group = zoroastrian_group
		}
		NOR = {
			religion = norse_pagan
			religion = norse_pagan_reformed
		}
		has_crusade_trait_trigger = no
		OR = {
			AND = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
			any_liege = {
				religion = ROOT
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				crusade_target = {
					is_located_in = ROOT
				}
			}
		}
	}
    
	immediate = {
		abdicate_holy_order_if_religion_changes_effect = yes
	}
	
	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

	min_age = 16
	capable_only = yes
	prisoner = no
	religion = catholic
	in_command = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_called_crusade = yes
		OR = {
			any_war = {
				OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
		}

		crusade_target = {
			is_located_in = ROOT
		}
		NOT = { has_character_flag = arrived_at_crusade_target }
		location = {
			holder_scope = {
				NOT = { character = ROOT }
			}
		}
	}
	
	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

	only_men = yes
	min_age = 16
	capable_only = yes
	prisoner = no
	religion = catholic
	
	is_triggered_only = yes
	
	trigger = {
		controls_religion = yes
		has_called_crusade = yes
		OR = {
			any_independent_ruler = {
				ai = yes
				religion = catholic
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				excommunicated_for = ROOT
			}
			any_independent_ruler = {
				religion = catholic
				any_realm_lord = {
					ai = yes
					religion = catholic
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_crusade
						}
					}
					excommunicated_for = ROOT
				}
			}
		}
	}
	
	immediate = {
		any_independent_ruler = {
			limit = {
				ai = yes
				religion = catholic
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
				excommunicated_for = ROOT
			}
			set_character_flag = offered_revoked_excommunication
			letter_event = { id = 8467 days = 1 }
		}
		any_independent_ruler = {
			limit = {
				religion = catholic
			}
			any_realm_lord = {
				limit = {
					ai = yes
					religion = catholic
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_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
	religion = catholic
	
	is_triggered_only = yes
	
	trigger = {
		NOT = { trait = zealous }
		NOT = { trait = cynical }
		
		has_called_crusade = yes
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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
	religion = catholic
	
	is_triggered_only = yes
	
	trigger = {
		NOT = { trait = cynical }
		NOT = { trait = zealous }
		
		has_called_crusade = yes
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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 }
#		religion = catholic
		
		has_called_crusade = yes
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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 = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
						}
						top_liege = {
							NOT = {
								any_war = {
									OR = {
										using_cb = crusade
										using_cb = new_crusade
									}
								}
							}
						}
					}
					liege = { letter_event = { id = 8331 days = 1 } }
				}
				# Only top liege
				if = {
					limit = {
						liege = {
							NOT = {
								any_war = {
									OR = {
										using_cb = crusade
										using_cb = new_crusade
									}
								}
							}
						}
						top_liege = {
							any_war = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
						}
					}
					top_liege = { letter_event = { id = 8331 days = 1 } }
				}
				# Both liege and top liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
							ROOT = {
								top_liege = {
									NOT = { character = PREVPREV }
									any_war = {
										OR = {
											using_cb = crusade
											using_cb = new_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
    
	immediate = {
		abdicate_holy_order_if_religion_changes_effect = 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
	
	religion = catholic
	
	is_triggered_only = yes
		
	trigger = {
		FROM = { title = b_jerusalem }
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
		}
		NOT = { has_global_flag = found_the_holy_lance }
		NOT = {
			has_alternate_start_parameter = { key = religion_names value = random }
		}
	}
	
	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
	religion = catholic
	
	trigger = {
		FROM = { title = b_syrcaesarea }
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
		}
		NOT = { has_global_flag = found_the_holy_grail }
		NOT = {
			has_alternate_start_parameter = { key = religion_names value = random }
		}
	}
	
	immediate = {
		hidden_tooltip = {
			set_global_flag = found_the_holy_grail
		}
	}
	
	option = {
		name = "EVTOPTA8342"
		prestige = 200
		if = {
			limit = { has_dlc = Mystics }
			
			if = { 
				limit = {
					OR = {
						has_game_rule = {
							name = supernatural_events
							value = on
						}
						has_game_rule = {
							name = supernatural_events
							value = unrestricted
						}
					}
				}
				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
	
	religion = catholic
	
	is_triggered_only = yes
		
	trigger = {
		FROM = { title = b_jerusalem }
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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 }
#		religion = catholic
		OR = {
			any_war = {
				OR = {
					using_cb = crusade
					using_cb = new_crusade
				}
			}
			any_liege = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_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 = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
						}
						top_liege = {
							NOT = {
								any_war = {
									OR = {
										using_cb = crusade
										using_cb = new_crusade
									}
								}
							}
						}
					}
					liege = { letter_event = { id = 8351 days = 1 } }
				}
				# Only top liege
				if = {
					limit = {
						liege = {
							NOT = {
								any_war = {
									OR = {
										using_cb = crusade
										using_cb = new_crusade
									}
								}
							}
						}
						top_liege = {
							any_war = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
						}
					}
					top_liege = { letter_event = { id = 8351 days = 1 } }
				}
				# Both liege and top liege
				if = {
					limit = {
						liege = {
							NOT = { character = ROOT }
							any_war = {
								OR = {
									using_cb = crusade
									using_cb = new_crusade
								}
							}
							ROOT = {
								top_liege = {
									NOT = { character = PREVPREV }
									any_war = {
										OR = {
											using_cb = crusade
											using_cb = new_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
	religion = catholic
	only_men = yes
	only_capable = yes
	min_age = 16
	prisoner = no
	
	is_triggered_only = yes
	
	trigger = {
		controls_religion = yes
		is_preparing_crusade = yes
		
		any_independent_ruler = {
			religion = catholic
			NOT = {
				has_pledged_crusade_participation = yes
			}
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
				}
			}
			rightful_religious_head_scope = {
				character = ROOT
			}
			NOT = { excommunicated_for = ROOT }
			NOT = {
				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 }
		}
	}
	
	option = {
		name = "EVTOPTA8400"
		random_independent_ruler = {
			limit = {
				religion = catholic
				NOT = {
					has_pledged_crusade_participation = yes
				}
				NOT = {
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_crusade
						}
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
					}
				}
				rightful_religious_head_scope = {
					character = ROOT
				}
				NOT = { excommunicated_for = ROOT }
				NOT = {
					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
		pledge_crusade_participation = yes
	}
}

# 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
	religion = catholic
	only_men = yes
	only_capable = yes
	min_age = 16
	prisoner = no
	
	is_triggered_only = yes
	
	trigger = {
		controls_religion = yes
		
		any_independent_ruler = {
			had_character_flag = { flag = reminded_about_crusade days = 30 }
			religion = catholic
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = PREVPREV }
				}
			}
			rightful_religious_head_scope = {
				character = ROOT
			}
			NOT = { excommunicated_for = ROOT }
		}
	}
	
	option = {
		name = "EVTOPTA8410"
		random_independent_ruler = {
			limit = {
				had_character_flag = { flag = reminded_about_crusade days = 30 }
				religion = catholic
				NOT = {
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_crusade
						}
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = 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
	only_rulers = yes
	prisoner = no
	religion = catholic
	
	trigger = {
		is_preparing_crusade = yes
		NOT = { has_character_flag = no_complains_about_not_crusading }
		is_priest = yes
		independent = no
		controls_religion = no
		
		liege = {
			independent = yes
			religion = catholic
			prisoner = no
			NOT = { trait = incapable }
			higher_tier_than = COUNT # Exclude small rulers
			NOT = {
				has_pledged_crusade_participation = yes
			}
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
					any_attacker = { character = PREVPREV }
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = 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 = christian } 
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 120
		
		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 = "EVTOPTB8405"
		FROM = { set_character_flag = reminded_about_crusade }
		pledge_crusade_participation = yes
	}
}

# 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 = {
			NOT = {
				has_pledged_crusade_participation = yes
			}
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = 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
	religion = catholic
	
	trigger = {
		is_preparing_crusade = yes
		NOT = { has_character_flag = no_complains_about_not_crusading }
		independent = no
		controls_religion = no
		
		liege = {
			independent = yes
			religion = catholic
			prisoner = no
			NOT = { trait = incapable }
			higher_tier_than = COUNT # Exclude small rulers
			NOT = {
				has_pledged_crusade_participation = yes
			}
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
					any_attacker = { character = PREVPREV }
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = 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 = christian } 
					}
				}
			}
		}
	}

	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 = "EVTOPTB8405"
		FROM = { set_character_flag = reminded_about_crusade }
		pledge_crusade_participation = yes
	}
}

# 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 = {
			NOT = {
				has_pledged_crusade_participation = yes
			}
			NOT = {
				any_war = {
					OR = {
						using_cb = crusade
						using_cb = new_crusade
					}
				}
			}
			crusade_target = {
				holder_scope = {
					NOT = { reverse_has_truce = 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
		is_preparing_crusade = yes
		
		OR = {
			any_independent_ruler = {
				ai = no	# Only for players
				religion = catholic
				prisoner = no
				NOT = {
					has_pledged_crusade_participation = yes
				}
				NOT = {
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_crusade
						}
						any_attacker = { character = PREVPREV }
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = 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 = {
						has_pledged_crusade_participation = yes
					}
					NOT = {
						any_war = {
							OR = {
								using_cb = crusade
								using_cb = new_crusade
							}
							any_attacker = { character = PREVPREV }
						}
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = 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 = {
					has_pledged_crusade_participation = yes
				}
				NOT = {
					any_war = {
						OR = {
							using_cb = crusade
							using_cb = new_crusade
						}
					}
				}
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = 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 = {
							OR = {
								using_cb = crusade
								using_cb = new_crusade
							}
						}
					}
					NOT = {
						has_pledged_crusade_participation = yes
					}
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = 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 }
		pledge_crusade_participation = yes
	}
	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
				has_pledged_crusade_participation = yes
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = PREVPREV }
					}
				}
				excommunicated_for = ROOT
				has_character_flag = offered_revoked_excommunication
			}
			any_independent_ruler = {
				religion = catholic
				any_realm_lord = {
					ai = no
					religion = catholic
					prisoner = no
					has_pledged_crusade_participation = yes
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = 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
				has_pledged_crusade_participation = yes
				crusade_target = {
					holder_scope = {
						NOT = { reverse_has_truce = 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
					has_pledged_crusade_participation = yes
					crusade_target = {
						holder_scope = {
							NOT = { reverse_has_truce = 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
	}
}


