# On actions for the Pilgrimage activity

#To send an appropriate start event
everpreg_pilgrimage_setup = {
	events = {
		everpreg_pilgrimage.1001 # Start of generic pilgrimage
	}
}

# On-action managing possible journey events
everpreg_pilgrimage_journey_events = {
	random_events = {
		# Generic Pilgrimage Events
		100 = everpreg_pilgrimage.2001 # Bandits attack your camp!
		100 = everpreg_pilgrimage.2002 # Heathen-hating adherent challenges you
		100 = everpreg_pilgrimage.2003 # Companions are running low
		100 = everpreg_pilgrimage.2004 # Run into a potential friend
		100 = everpreg_pilgrimage.2005 # Peasant insults you
		100 = everpreg_pilgrimage.2006 # Lost!
		100 = everpreg_pilgrimage.2007 # Personal reflections
		50 = everpreg_pilgrimage.2008  # Become Ill
		100 = everpreg_pilgrimage.2009 # Travelling while Ill is bad for you
		25 = everpreg_pilgrimage.2010 # Meet a Mystic (chain)

		# 'Temptation' Events
		100 = everpreg_pilgrimage.2501 # Persistent Beggar
		100 = everpreg_pilgrimage.2511 # Cocky Lordling

		# Christian-specific Pilgrimage Events
		100 = everpreg_pilgrimage.3001 # Stand in the torrential rain to listen to a priest, or take shelter?
		50 = everpreg_pilgrimage.3002  # Naked preacher claims to have recovered Adam & Eve's innocence
		100 = everpreg_pilgrimage.3003 # Doomsayer promises the end is night!

		# Muslim-specific Pilgrimage Events
		100 = everpreg_pilgrimage.3102 # Why am I taking this pilgrimage?

		# Hindu-specific Pilgrimage Events
		100 = everpreg_pilgrimage.3201 # Ritual purification in a river
		100 = everpreg_pilgrimage.3202 # Contemplating the universe

		# Buddhist-specific Pilgrimage Events
		100 = everpreg_pilgrimage.3301 # Critical Wanderer
	}
	fallback = pilgrimage_journey_event_fallback
}

# On-action managing possible journey events
everpreg_hajj_journey_events = {
	random_events = {
		# Normal Events
		100 = everpreg_pilgrimage.2001
		100 = everpreg_pilgrimage.2002
		100 = everpreg_pilgrimage.2003
		100 = everpreg_pilgrimage.2004
		100 = everpreg_pilgrimage.2005
		100 = everpreg_pilgrimage.2006
		100 = everpreg_pilgrimage.2007
		50 = everpreg_pilgrimage.2008
		100 = everpreg_pilgrimage.2009
		25 = everpreg_pilgrimage.2010 # Meet a Mystic (chain)
		
		# 'Temptation' Events
		100 = everpreg_pilgrimage.2501 # Persistent Beggar
		100 = everpreg_pilgrimage.2511 # Cocky Lordling

		# Threshold Event
		9999 = everpreg_pilgrimage.3101 # High weight because we want it to be almost guaranteed.
	}
	fallback = pilgrimage_journey_event_fallback
}

# Fallback for the sake of stability
everpreg_pilgrimage_journey_event_fallback = {
	events = {
		everpreg_pilgrimage.9999
	}
}

# On-action managing possible destination events
everpreg_pilgrimage_destination_events = {
	first_valid_on_action = {
		everpreg_hajj_destination_events
		everpreg_christian_destination_events
		everpreg_jewish_destination_events
		everpreg_muslim_destination_events
		everpreg_hindu_destination_events
		everpreg_buddhist_destination_events
		everpreg_jain_destination_events
		everpreg_zoroastrian_destination_events
		everpreg_norse_destination_events
		everpreg_tengri_destination_events
		everpreg_pagan_destination_events
		everpreg_pilgrimage_generic_destination_events
	}
}

everpreg_hajj_destination_events = {
	trigger = {
		exists = scope:activity.var:is_hajj
	}
	random_events = {
		100 = hajj.3001
		25 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_christian_destination_events = {
	trigger = {
		religion = religion:christianity_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_roma # Rome
				county = title:c_jerusalem # Jerusalem
				county = title:c_byzantion # Constantinople
				county = title:c_alexandria # Alexandria
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5001 # Rome
		100 = everpreg_pilgrimage.5011 # Jerusalem
		100 = everpreg_pilgrimage.5021 # Constantinople
		100 = everpreg_pilgrimage.5031 # Alexandria
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_jewish_destination_events = {
	trigger = {
		religion = religion:judaism_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_sinai # Mt. Sinai
				county = title:c_jerusalem # Jerusalem
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5011 # Jerusalem
		100 = everpreg_pilgrimage.5101 # Mt. Sinai
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_muslim_destination_events = {
	trigger = {
		religion = religion:islam_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_medina # Medina
				county = title:c_sinai # Mt. Sinai
				county = title:c_jerusalem # Jerusalem
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5011 # Jerusalem
		100 = everpreg_pilgrimage.5101 # Mt. Sinai
		100 = everpreg_pilgrimage.5201 # Medina
		# Mecca is handled separately as part of the Hajj
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_hindu_destination_events = {
	trigger = {
		religion = religion:hinduism_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_varanasi # Varanasi
				county = title:c_ayodhya # Ayodhya
				county = title:c_mathura # Mathura
				county = title:c_sthanisvara # Haridwar
				county = title:c_kanchipuram # Kanchipuram
				county = title:c_ujjayini # Ujjayini
				county = title:c_dvaraka # Dwarka
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5301 # Varanasi
		100 = everpreg_pilgrimage.5311 # Ayodhya
		100 = everpreg_pilgrimage.5321 # Mathura
		100 = everpreg_pilgrimage.5331 # Haridwar
		100 = everpreg_pilgrimage.5341 # Kanchipuram
		100 = everpreg_pilgrimage.5351 # Ujjayini
		100 = everpreg_pilgrimage.5361 # Dwarka
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_buddhist_destination_events = {
	trigger = {
		religion = religion:hinduism_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_gaya # Bodh Gaya
				county = title:c_kusinagara # Kusinagara
				county = title:c_varanasi # Sarnath
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5401 # Bodh Gaya
		100 = everpreg_pilgrimage.5411 # Kusinagara
		100 = everpreg_pilgrimage.5421 # Sarnath
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_jain_destination_events = {
	trigger = {
		religion = religion:hinduism_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_radha # Shikharj
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5501 # Shikharj
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_zoroastrian_destination_events = {
	trigger = {
		religion = religion:hinduism_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_baduspan # Ushi-darena
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5601 # Ushi-darena
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_norse_destination_events = {
	trigger = {
		religion = religion:germanic_religion
		exists = scope:activity.activity_province
		scope:activity.activity_province = {
			OR = {
				county = title:c_brunswick # Paderborn
			}
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5901 # Paderborn
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_tengri_destination_events = {
	trigger = {
		religion = religion:tengrism_religion
	}

	random_events = {
		100 = everpreg_pilgrimage.5911 # Blue Open Skies
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}

everpreg_pagan_destination_events = {
	trigger = {
		faith = {
			has_doctrine = tenet_sanctity_of_nature
		}
	}

	random_events = {
		100 = everpreg_pilgrimage.5921 # Sacred Grove
		100 = everpreg_pilgrimage.4001 # Meet the Mystic again
	}
}


everpreg_pilgrimage_generic_destination_events = {
	random_events = {
		100 = everpreg_pilgrimage.8900
		100 = everpreg_pilgrimage.8900 
	}
}

everpreg_pilgrimage_return_events = {
	random_events = {
		100 = everpreg_pilgrimage.9001
	}
}