﻿create_artifact_coals_of_st_lawrence_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_masterwork = yes

	# Create the artifact
	create_artifact = {
		name = artifact_coals_of_st_lawrence_name
		description = artifact_coals_of_st_lawrence_description
		template = christian_relic_template
		type = pedestal
		visuals = coals_of_st_lawrence
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = coals_of_st_lawrence_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = coals_of_st_lawrence
		set_variable = christian_relic
		save_scope_as = masterwork
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

create_artifact_holy_land_soil_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_common = yes

	# Create the artifact
	create_artifact = {
		name = artifact_holy_land_soil_name
		description = artifact_holy_land_soil_description
		template = christian_relic_template
		type = pedestal
		visuals = holy_land_soil
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = holy_land_soil_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = holy_land_soil
		save_scope_as = common
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

create_artifact_iron_chips_chains_of_st_peter_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_famed = yes

	# Create the artifact
	create_artifact = {
		name = artifact_iron_chips_chains_of_st_peter_name
		description = artifact_iron_chips_chains_of_st_peter_description
		template = christian_relic_template
		type = pedestal
		visuals = iron_chips_chains_of_st_peter
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = iron_chips_chains_of_st_peter_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = iron_chips_chains_of_st_peter
		set_variable = christian_relic
		save_scope_as = famed
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

create_artifact_iron_file_dust_gridiron_of_st_lawrence_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_famed = yes

	# Create the artifact
	create_artifact = {
		name = artifact_iron_file_dust_gridiron_of_st_lawrence_name
		description = artifact_iron_file_dust_gridiron_of_st_lawrence_description
		template = christian_relic_template
		type = pedestal
		visuals = iron_file_dust_gridiron_of_st_lawrence
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = iron_file_dust_gridiron_of_st_lawrence_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = iron_file_dust_gridiron_of_st_lawrence
		set_variable = christian_relic
		save_scope_as = famed
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

create_artifact_martyr_shrine_lamp_oil_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_common = yes

	# Create the artifact
	create_artifact = {
		name = artifact_martyr_shrine_lamp_oil_name
		description = artifact_martyr_shrine_lamp_oil_description
		template = christian_relic_template
		type = pedestal
		visuals = martyr_shrine_lamp_oil
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = martyr_shrine_lamp_oil_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = martyr_shrine_lamp_oil
		save_scope_as = common
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

create_artifact_straw_manger_of_jesus_effect = {
	# Get the character the artifact is being made for.
	$OWNER$ = { save_scope_as = owner }
	# Not really used, but if we don't set the scopes we get errors in the feature selection
	set_artifact_rarity_masterwork = yes

	# Create the artifact
	create_artifact = {
		name = artifact_straw_manger_of_jesus_name
		description = artifact_straw_manger_of_jesus_description
		template = christian_relic_template
		type = pedestal
		visuals = straw_manger_of_jesus
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = straw_manger_of_jesus_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

	scope:newly_created_artifact = {
		set_variable = { name = historical_unique_artifact value = yes }
		set_variable = straw_manger_of_jesus
		set_variable = christian_relic
		save_scope_as = masterwork
		set_variable = {
			name = relic
			value = flag:christian
		}
	}
}

holy_stuff_relic_merchant_scripted_effect = {
	## Create Merchant
	scope:relic_merchant_target = {
		if = {
			limit = {
				any_character_to_title_neighboring_and_across_water_county = {
					NOT = {
						culture = { this = scope:relic_merchant_target.culture }
					}
					OR = {
						faith = { religion_tag = christianity_religion }
					}
				}
			}
			random_character_to_title_neighboring_and_across_water_county = {
				limit = {
					NOT = {
						culture = { this = scope:relic_merchant_target.culture }
					}
					OR = {
						faith = { religion_tag = christianity_religion }
					}
				}
				save_scope_as = merchant_county
			}
		}
		else = {
			random_county = {
				limit = {
					holder ?= {
						NOT = {
							culture = { this = scope:relic_merchant_target.culture }
						}
						OR = {
							faith = { religion_tag = christianity_religion }
						}
					}
				}
				save_scope_as = merchant_county
			}
		}
	}
}
