###############################
# Christian Pilgrimage Events
#
# WtWSMSsoa.1 -> WtWSMSsoa.5
###############################

namespace = WtWSMSsoa

# Check Nicene pilgrim's location - then send on to destination choice event
character_event = {
	id = WtWSMSsoa.1

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						capital_scope = { province_id = 333 }
						capital_scope = { province_id = 764 }
						capital_scope = { province_id = 496 }
					}
				}
				character_event = { id = SoA.5016 days = 4 } # Go to Jerusalem
			}
			else_if = {
				limit = {
					capital_scope = { province_id = 774 }
				}
				character_event = { id = SoA.5017 days = 4 } # Go to Rome
			}
			else_if = {
				limit = {
					NOT = {
						OR = {
							capital_scope = { province_id = 774 }
							capital_scope = { province_id = 333 }
						}
					}
				}
				character_event = { id = WtWSMSsoa.2 days = 4 } # May choose destination
			}
		}
	}
}

# Nicene - Chose destination
character_event = {
	id = WtWSMSsoa.2
	desc = EVTDESC_SoA_5011
	picture = GFX_evt_icon
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_5011
		trigger = {
			NOT = { capital_scope = { province_id = 774 } }
		}
		set_character_flag = pilgrimage_to_jerusalem
		hidden_tooltip = {
			character_event = { id = SoA.5022 days = 15 }
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_PILGRIMAGE_TO_JERUSALEM
				picture = GFX_evt_pilgrims_epic_journey
			}
		}
	}

	option = {
		name = EVTOPTB_SoA_5011
		trigger = {
			NOT = { capital_scope = { province_id = 496 } }
			NOT = { religion = miaphysite }
			NOT = { religion = monophysite }
		}
		set_character_flag = pilgrimage_to_constantinople
		hidden_tooltip = {
			character_event = { id = SoA.5094 days = 15 }
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_PILGRIMAGE_TO_CONSTANTINOPLE
				picture = GFX_evt_pilgrims_epic_journey
			}
		}
	}
	option = {
		name = EVTOPTC_SoA_5011
		trigger = {
			NOT = { capital_scope = { province_id = 764 } }
		}
		set_character_flag = pilgrimage_to_antioch
		hidden_tooltip = {
			character_event = { id = SoA.5096 days = 15 }
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_PILGRIMAGE_TO_ANTIOCH
				picture = GFX_evt_pilgrims_epic_journey
			}
		}
	}

	option = {
		name = EVTOPTB_SoA_5020
		ai_chance = { factor = 50 }
		set_character_flag = pilgrimage_to_rome
		hidden_tooltip = {
			character_event = { id = SoA.5024 days = 15 }
		}
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_PILGRIMAGE_TO_ROME
				picture = GFX_evt_pilgrims_epic_journey
			}
		}
	}
}

# Insular - Chose destination
character_event = {
	id = WtWSMSsoa.3
	desc = EVTDESC_SoA_5011
	picture = GFX_evt_cathedral
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTDESC_WtWSMSsoa_3
		set_character_flag = pilgrimage_to_st_albans
		hidden_tooltip = { character_event = { id = WtWSMSsoa.4 days = 15 } }
		if = {
			limit = { ai = no }
			chronicle = {
				entry = CHRONICLE_PILGRIMAGE_TO_ST_ALBANS
				picture = GFX_evt_pilgrims_epic_journey
			}
		}
	}
}

# Insular - Setting out for St Albans (also selects events for road)
character_event = {
	id = WtWSMSsoa.4
	desc = EVTDESC_WtWSMSsoa_4
	picture = GFX_evt_pilgrims_epic_journey
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_SoA_5021
		clr_character_flag = preparing_pilgrimage
		hidden_tooltip = {
			add_trait = on_pilgrimage
			set_character_flag = good_pilgrimage
			narrative_event = { id = WtWSMSsoa.5 days = 30 }
		}
		hidden_tooltip = {
			if = {
				limit = {
					location = {
						distance = {
							where = 69	# Bedford
							value = 400	# Longer journey
						}
					}
				}
				random_list = {
					10 = { character_event = { id = SoA.5026 days = 5 random = 9 } } # List for longer journeys only
					10 = { character_event = { id = SoA.5027 days = 5 random = 9 } }
					10 = { narrative_event = { id = SoA.5028 days = 5 random = 9 } }
					10 = { character_event = { id = SoA.5029 days = 5 random = 9 } }
					10 = { character_event = { id = SoA.5030 days = 5 random = 9 } }
				}
			}
	
			random_list = {
				10 = { character_event = { id = SoA.5031 days = 15 random = 7 } } # List that is always checked
				10 = { character_event = { id = SoA.5032 days = 15 random = 7 } }
				10 = { narrative_event = { id = SoA.5033 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5034 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5035 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5036 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5037 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5038 days = 15 random = 7 } }
				10 = { character_event = { id = SoA.5039 days = 15 random = 7 } }
			}
			if = {
				limit = {
						OR = {
							is_title_active = d_knights_templar
							is_title_active = d_knights_hospitaler
						}
				}
				random_list = {
					10 = { narrative_event = { id = SoA.5045 days = 23 random = 4 } } # Holy orders events, close to destination
					10 = { character_event = { id = SoA.5046 days = 23 random = 4 } }
					10 = { character_event = { id = SoA.5047 days = 23 random = 4 } }
				}
			}
		}
	}
}

# Arrived at St Albans
narrative_event = {
	id = WtWSMSsoa.5
	title = EVTNAME_WtWSMSsoa_5
	desc = EVTDESC_WtWSMSsoa_5
	picture = GFX_evt_cathedral
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_SoA_5050
		hidden_tooltip = { character_event = { id = SoA.5055 days = 5 } }
	}
}