#####################
# PILGRIMAGE VALUES #
#####################

# Determines how many events a specific journey length will trigger
very_long_everpreg_pilgrimage_var = 5
long_everpreg_pilgrimage_var = 4
medium_everpreg_pilgrimage_var = 3
short_everpreg_pilgrimage_var = 2

# Reward values
short_everpreg_pilgrimage_piety_gain = {
	value = major_piety_gain
	if = {
		limit = {
			exists = dynasty
			dynasty = {
				has_dynasty_perk = erudition_legacy_4
			}
		}
		multiply = 1.3
	}
}
long_everpreg_pilgrimage_piety_gain = {
	value = major_piety_gain
	multiply = 1.5
	if = {
		limit = {
			exists = dynasty
			dynasty = {
				has_dynasty_perk = erudition_legacy_4
			}
		}
		multiply = 1.3
	}
}
very_long_everpreg_pilgrimage_piety_gain = {
	value = major_piety_gain
	multiply = 2.5
	if = {
		limit = {
			exists = dynasty
			dynasty = {
				has_dynasty_perk = erudition_legacy_4
			}
		}
		multiply = 1.3
	}
}
exceptionally_long_everpreg_pilgrimage_piety_gain = {
	value = major_piety_gain
	multiply = 3.5
	if = {
		limit = {
			exists = dynasty
			dynasty = {
				has_dynasty_perk = erudition_legacy_4
			}
		}
		multiply = 1.3
	}
}

# Distances to target holy site
long_everpreg_pilgrimage_max_length = 5000000 # 5M Over this distance, it will be an exceptionally long pilgrimage
medium_everpreg_pilgrimage_max_length = 1000000 # 1M, slightly larger than 1 'holy roman empire' away
short_everpreg_pilgrimage_max_length = 100000 # 100K, slightly larger than 1 'ireland' away.

everpreg_pilgrimage_cooldown_year_amount = 15

remaining_everpreg_pilgrimage_journey_events = {
	value = var:everpreg_pilgrimage_distance
	subtract = var:journey_event_counter
}

close_to_everpreg_pilgrimage_end_counter = {
	value = var:everpreg_pilgrimage_distance
	# Currently only valid for the last journey event of a Pilgrimage chain. The subtraction number will determine the number of extra events in addition to that.
	#subtract = 1
}

everpreg_pilgrimage_halfway_distance = {
	value = var:everpreg_pilgrimage_distance
	divide = 2
}

everpreg_pilgrimage_minimum_cost = {
	value = medium_gold_value
}
everpreg_pilgrimage_medium_extra_cost = {
	value = pilgrimage_minimum_cost
	multiply = 2
}
everpreg_pilgrimage_long_extra_cost = {
	value = pilgrimage_minimum_cost
	multiply = 2.5
}
everpreg_pilgrimage_very_long_extra_cost = {
	value = pilgrimage_minimum_cost
	multiply = 3.5
}


# hajj_actual_cost = {
# 	if = {
# 		limit = { exists = capital_province }
# 		if = {
# 			limit = {
# 				capital_province = {
# 					squared_distance = {
# 						target = title:b_makka
# 						value > long_everpreg_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			add = pilgrimage_very_long_extra_cost
# 		}
# 		else_if = {
# 			limit = {
# 				capital_province = {
# 					squared_distance = {
# 						target = title:b_makka
# 						value > medium_everpreg_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			add = pilgrimage_long_extra_cost
# 		}
# 		else_if = {
# 			limit = {
# 				capital_province = {
# 					squared_distance = {
# 						target = title:b_makka
# 						value > short_everpreg_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			add = pilgrimage_medium_extra_cost
# 		}
# 		else = {
# 			limit = {
# 				capital_province = {
# 					squared_distance = {
# 						target = title:b_makka
# 						value > short_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			add = pilgrimage_minimum_cost
# 		}
# 	}
# 	else = {
# 		add = pilgrimage_long_extra_cost
# 	}
# }