﻿#############################################
# Create Holy Thorn
#############################################

create_artifact_holy_thorn_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
	}

	decision_group_type = decisions

	ai_check_interval = 120

	desc = create_artifact_holy_thorn_decision_desc
	selection_tooltip = create_artifact_holy_thorn_decision_tooltip

	is_shown = {
                has_crown_of_thorns_trigger = yes
	}

	cooldown = { years = 5 }

	is_valid = {
		faith.religion = faith:catholic.religion #Christian
	}

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
	}

	cost = {
		prestige = 250
	}

	effect = {
		custom_tooltip = create_artifact_holy_thorn_decision_tooltip

		if = {
			limit = {
				has_game_rule = holy_stuff_historical_context_on
			}
			custom_tooltip = holy_stuff_holy_thorn_context_tooltip
		}

		trigger_event = {
			id = holy_stuff_holy_thorn_event.0001
		}
	}

	ai_potential = {
		always = no
	}
	ai_will_do = {
		base = 0
	}
}

#############################################
# Create Splinter of the True Cross
#############################################

create_artifact_splinter_of_the_true_cross_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
	}

	decision_group_type = decisions

	ai_check_interval = 120

	desc = create_artifact_splinter_of_the_true_cross_decision_desc
	selection_tooltip = create_artifact_splinter_of_the_true_cross_decision_tooltip

	is_shown = {
                has_fragment_of_the_true_cross_trigger = yes
	}

	cooldown = { years = 5 }

	is_valid = {
		faith.religion = faith:catholic.religion #Christian
	}

	is_valid_showing_failures_only = {
		is_capable_adult = yes
		is_imprisoned = no
	}

	cost = {
		prestige = 250
	}

	effect = {
		custom_tooltip = create_artifact_splinter_of_the_true_cross_decision_tooltip

		if = {
			limit = {
				has_game_rule = holy_stuff_historical_context_on
			}
			custom_tooltip = holy_stuff_splinter_of_the_true_cross_context_tooltip
		}

		trigger_event = {
			id = holy_stuff_splinter_of_the_true_cross_event.0001
		}
	}

	ai_potential = {
		always = no
	}
	ai_will_do = {
		base = 0
	}
}

#############################################
# Relic Procession
#############################################

# hold_relic_procession_decision = {
# 	picture = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"

# 	ai_check_interval = 60

# 	desc = hold_relic_procession_decision_desc
# 	selection_tooltip = hold_relic_procession_decision_tooltip

# 	cooldown = { years = 10 }

# 	is_shown = {
# 		is_landed = yes
#             relic_procession_trigger = yes
# 	}

# 	is_valid_showing_failures_only = {
# 		is_available_adult = yes
# 		is_imprisoned = no
# 		short_term_gold >= medium_gold_value
# 	}

# 	cost = {
# 		gold = 50
# 	}

# 	effect = {
# 		capital_province = {
# 			spawn_activity = {
# 				type = activity_relic_procession
# 				owner = root
# 			}
# 		}

# 		show_as_tooltip = {
# 			holy_stuff_relic_procession_scripted_effect = yes
# 		}

# 		#Stress loss
# 		if = {
# 			limit = {
# 				has_trait = cynical
# 			}
# 			custom_tooltip = hold_relic_procession_decision_stress_cynical
# 		}
# 		else = {
# 			stress_impact = {
# 				base = medium_stress_impact_loss
# 				relic_collector = medium_stress_impact_loss
# 				zealous = medium_stress_impact_loss
# 			}
# 		}

# 		if = {
# 			limit = {
# 				has_game_rule = holy_stuff_historical_context_on
# 			}
# 			custom_tooltip = holy_stuff_relic_procession_context_tooltip
# 		}
# 	}

# 	ai_potential = {
# 		is_landed = yes
# 		is_available_adult = yes
#             relic_pilgrimage_site_trigger = yes
# 		OR = {
# 			has_trait = zealous
# 			has_trait = lifestyle_mystic
# 			has_trait = relic_collector
# 			has_trait = theologian
# 		}
# 	}

# 	ai_will_do = {
# 		modifier = {
# 			add = 100
# 			stress >= 50
# 		}
# 	}
# }

#############################################
# Pilgrim Souvenir Industry
#############################################

establish_pilgrim_souvenir_industry_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
	}

	decision_group_type = decisions


	ai_check_interval = 120

	desc = establish_pilgrim_souvenir_industry_decision_desc
	selection_tooltip = establish_pilgrim_souvenir_industry_decision_tooltip

	cooldown = { years = 25 }

	is_shown = {
            can_establish_pilgrim_souvenir_industry_trigger = yes
	}

	is_valid = {
            stewardship >= decent_skill_rating
		OR = {
			has_trait = administrator
			has_trait = education_stewardship_1
			has_trait = education_stewardship_2
			has_trait = education_stewardship_3
			has_trait = education_stewardship_4
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
		short_term_gold >= medium_gold_value
	}

	effect = {
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0001
		}

		if = {
			limit = {
				has_game_rule = holy_stuff_historical_context_on
			}
			custom_tooltip = holy_stuff_pilgrim_souvenir_industry_context_tooltip
		}
	}

	ai_potential = {
		is_landed_or_landless_administrative = yes
		is_available_adult = yes
		culture = {
			has_cultural_era_or_later = culture_era_high_medieval
		}
		OR = { 
			faith = {
				any_holy_site = {
					holder.top_liege = root
					count > 0
				}
			}
            	relic_pilgrimage_site_trigger = yes
		}
            stewardship >= decent_skill_rating
		OR = {
			has_trait = administrator
			has_trait = education_stewardship_1
			has_trait = education_stewardship_2
			has_trait = education_stewardship_3
			has_trait = education_stewardship_4
		}
		NOR = {
			has_trait = greedy
			has_trait = lazy
		}
	}

	ai_will_do = {
		base = 100
	}
}

#############################################
# Fake Relic
#############################################

fake_relic_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_smith.dds"
	}

	decision_group_type = decisions

	ai_check_interval = 120

	desc = fake_relic_decision_desc
	selection_tooltip = fake_relic_decision_tooltip

	cooldown = { years = 25 }

	is_shown = {
		NOT = { this = root.faith.religious_head }
            relic_hunter_is_valid_trigger = yes
		NOR = {
			has_trait = honest
			has_trait = just
			has_trait = zealous
		}
		OR = {
			has_trait = cynical
			has_trait = deceitful
			has_trait = greedy
		}
	}

	is_valid_showing_failures_only = {
		is_imprisoned = no
		is_available_adult = yes
	}

	effect = {
		trigger_event = {
			id = holy_stuff_fake_relic_event.0001
		}

		if = {
			limit = {
				has_game_rule = holy_stuff_historical_context_on
			}
			custom_tooltip = holy_stuff_fake_relic_context_tooltip
		}
	}

	ai_potential = {
		is_available_adult = yes
		OR = {
			has_trait = deceitful
			has_trait = greedy
		}
		NOR = {
			has_trait = honest
			has_trait = zealous
		}
	}

	ai_will_do = {
		base = 50

		modifier = {
			add = 35
			OR = {
				has_trait = arbitrary
				has_trait = cynical
				has_trait = profligate #Profligates need money all the time
			}
		}
		modifier = {
			add = 25
			OR = { #When you have nothing left to lose, forging relics is easier
				has_trait = denounced
				has_trait = disinherited
				has_trait = excommunicated
			}
		}
		modifier = {
			add = -35
			OR = {
				has_trait = contrite #A guilty conscience is a hindrance when faking relics
				has_trait = just
			}
		}
		modifier = {
			add = 30
                  debt_level >= 5
		}
	}
}

#############################################
# Go on Relic Pilgrimage
#############################################

# go_on_relic_pilgrimage_decision = {
# 	picture = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"
# 	ai_check_interval = 60
	
# 	sort_order = 64

# 	desc = go_on_relic_pilgrimage_decision_desc
# 	selection_tooltip = go_on_relic_pilgrimage_decision_tooltip

# 	cooldown = { years = pilgrimage_cooldown_year_amount }

# 	is_shown = {
# 		is_landed = yes
# 		believes_in_pilgrimage_trigger = yes
#             relic_hunter_is_valid_trigger = yes
#             has_global_variable = relic_pilgrimage_site_event #Relic pilgrimages without relic pilgrimage sites make no sense.
# 		OR = {
# 			AND = {
# 				root.capital_province = { geographical_region = world_africa }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_africa
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_middle_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_asia_minor }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_asia_minor	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_south_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_burma }
# 				title_province = { geographical_region = world_burma }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_burma	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_india	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_east }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_province_in_region = {
# 							region = world_europe_south_east
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_north }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_north	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_west_britannia	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_south_east }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_south_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_south_italy	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_south_italy }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_south_italy	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_south_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_west_britannia }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_west_britannia	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_west_francia	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_west_francia }
# 				any_county_in_region = {
# 					region = world_europe_west_francia	
#                         	county_is_pilgrimage_site_trigger = yes
# 					NOT = { is_holy_site_of = root.faith }
# 					NOT = { holder = root }
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_west_germania }
# 				any_county_in_region = {
# 					region = world_europe_west_germania	
#                         	county_is_pilgrimage_site_trigger = yes
# 					NOT = { is_holy_site_of = root.faith }
# 					NOT = { holder = root }
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_europe_west_iberia }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_west_iberia	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_europe_west_francia	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_india }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_india	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_burma	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_middle_east }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_middle_east	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_asia_minor	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_steppe }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_steppe	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_tibet	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 			AND = {
# 				root.capital_province = { geographical_region = world_tibet }
# 				OR = {
# 					AND = {
# 						any_county_in_region = {
# 							region = world_tibet	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 					AND = {
# 						any_county_in_region = {
# 							region = world_steppe	
#                         			county_is_pilgrimage_site_trigger = yes
# 							NOT = { is_holy_site_of = root.faith }
# 							NOT = { holder = root }
# 						}
# 					}
# 				}
# 			}
# 		}
# 	}

# 	is_valid_showing_failures_only = {
# 		is_available_adult = yes
# 		is_at_war = no
# 	}

# 	effect = {
# 		custom_tooltip = relic_pilgrimage_effect_1
# 		custom_tooltip = relic_pilgrimage_effect_2
# 		if = { #What is the minimum you will have to pay?
# 			limit = {
# 				any_county = {
# 					limit = {
#                         		county_is_pilgrimage_site_trigger = yes
# 						NOT = { is_holy_site_of = root.faith }
# 						NOT = { holder = root }
# 					}
# 					squared_distance = {
# 						target = root.capital_province
# 						value <= short_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			custom_tooltip = pilgrimage_effect_3
# 		}
# 		else_if = {
# 			limit = {
# 				any_county = {
# 					limit = {
#                         		county_is_pilgrimage_site_trigger = yes
# 						NOT = { is_holy_site_of = root.faith }
# 						NOT = { holder = root }
# 					}
# 					squared_distance = {
# 						target = root.capital_province
# 						value <= medium_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			custom_tooltip = pilgrimage_effect_4
# 		}
# 		else_if = {
# 			limit = {
# 				any_county = {
# 					limit = {
#                         		county_is_pilgrimage_site_trigger = yes
# 						NOT = { is_holy_site_of = root.faith }
# 						NOT = { holder = root }
# 					}
# 					squared_distance = {
# 						target = root.capital_province
# 						value <= long_pilgrimage_max_length
# 					}
# 				}
# 			}
# 			custom_tooltip = pilgrimage_effect_5
# 		}
# 		else = {
# 			custom_tooltip = pilgrimage_effect_6
# 		}
# 		if = {
# 			limit = { has_trait = ill }
# 			custom_tooltip = line_break
# 			custom_tooltip = pilgrimage_illness_warning
# 		}
# 		if = {
# 			limit = { is_ai = yes }
# 			trigger_event = holy_stuff_go_on_relic_pilgrimage_event.0006
# 		}
# 		else = {
# 			trigger_event = holy_stuff_go_on_relic_pilgrimage_event.0001
# 		}


# 		if = {
# 			limit = {
# 				has_game_rule = holy_stuff_historical_context_on
# 			}
# 			custom_tooltip = holy_stuff_go_on_relic_pilgrimage_context_tooltip
# 		}
# 	}

# 	ai_potential = {
# 		is_landed = yes
# 		is_available_adult = yes
# 		short_term_gold > pilgrimage_minimum_cost
# 	}

# 	ai_will_do = {
# 		base = 20
# 		modifier = {
# 			add = -100
# 			NOT = { short_term_gold >= pilgrimage_medium_extra_cost }
# 		}
# 		modifier = {
# 			add = 30
# 			short_term_gold >= pilgrimage_long_extra_cost
# 		}
# 		modifier = {
# 			add = 20
# 			piety_level <= 2
# 		}
# 		modifier = {
# 			add = 20
# 			has_trait = zealous
# 		}
# 		modifier = {
# 			add = 20
# 			has_trait = zealous
# 			NOT = { has_trait = pilgrim }
# 		}
# 		modifier = {
# 			add = -30
# 			has_trait = cynical
# 		}
# 		modifier = {
# 			add = -30
# 			has_trait = pilgrim
# 		}
# 	}
# }

