﻿holy_stuff_relic_miracle_scripted_effect_1 = { #Bleeding Hosts
	root = {
		create_artifact_bleeding_host_effect = { OWNER = this }
	}
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

create_artifact_bleeding_host_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_bleeding_host_name
		description = artifact_bleeding_host_description
		template = christian_icon_template
		type = tapestry
		visuals = bleeding_host
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = bleeding_host_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

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

holy_stuff_relic_miracle_scripted_effect_2 = { #Divine Healing
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
	if = {
		limit = { has_trait = bubonic_plague }
		remove_trait = bubonic_plague
	}
	if = {
		limit = { has_trait = consumption }
		remove_trait = consumption
	}
	if = {
		limit = { has_trait = cancer }
		remove_trait = cancer
	}
	if = {
		limit = { has_trait = early_great_pox }
		remove_trait = early_great_pox
	}
	if = {
		limit = { has_trait = great_pox }
		remove_trait = great_pox
	}
	if = {
		limit = { has_trait = gout_ridden }
		remove_trait = gout_ridden
	}
	if = {
		limit = { has_trait = ill }
		remove_trait = ill
	}
	if = {
		limit = { has_trait = lovers_pox }
		remove_trait = lovers_pox
	}
	if = {
		limit = { has_trait = pneumonic }
		remove_trait = pneumonic
	}
	if = {
		limit = { has_trait = leper }
		remove_trait = leper
	}
	if = {
		limit = { has_trait = smallpox }
		remove_trait = smallpox
	}
	if = {
		limit = { has_trait = typhus }
		remove_trait = typhus
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_3 = { #Blood Miracle
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_4 = { #Visions of the Holy Prepuce
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        add_trait = lifestyle_mystic
        add_character_modifier = {
	      modifier = visions_of_the_holy_prepuce_modifier
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_5 = { #Weeping Statue
	root = {
		create_artifact_weeping_statue_effect = { OWNER = this }
	}
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

create_artifact_weeping_statue_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_weeping_statue_name
		description = artifact_weeping_statue_description
		template = christian_relic_template
		type = sculpture
		visuals = weeping_statue
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = weeping_statue_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

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

holy_stuff_relic_miracle_scripted_effect_6 = { #Divine Pregnancy
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}

        scope:mother = {
            make_pregnant = {
                father = scope:father
                number_of_children = 1
            }
        }

	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_7 = { #Stigmata
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        add_trait = lifestyle_mystic
        add_trait = wounded_1
        add_character_modifier = {
	      modifier = stigmatised_modifier
	      years = 5
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_8 = { #Weeping Icon
	root = {
		create_artifact_weeping_icon_effect = { OWNER = this }
	}
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

create_artifact_weeping_icon_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_weeping_icon_name
		description = artifact_weeping_icon_description
		template = christian_icon_template
		type = tapestry
		visuals = weeping_icon
		wealth = scope:wealth
		quality = scope:quality
		history = {
			type = created_before_history
		}
		modifier = weeping_icon_modifier
		save_scope_as = newly_created_artifact
		decaying = no
	}

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

holy_stuff_relic_miracle_scripted_effect_9 = { #Exorcism
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
	if = {
		limit = { has_trait = depressed_1 }
		remove_trait = depressed_1
	}
	if = {
		limit = { has_trait = depressed_genetic }
		remove_trait = depressed_genetic
	}
	if = {
		limit = { has_trait = lunatic_1 }
		remove_trait = lunatic_1
	}
	if = {
		limit = { has_trait = lunatic_genetic }
		remove_trait = lunatic_genetic
	}
	if = {
		limit = { has_trait = possessed_1 }
		remove_trait = possessed_1
	}
	if = {
		limit = { has_trait = possessed_genetic }
		remove_trait = possessed_genetic
	}
        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}

holy_stuff_relic_miracle_scripted_effect_10 = { #Divine Dreams
	add_piety = major_piety_gain
	faith = {
		save_scope_as = faith
		change_fervor = {
			value = major_fervor_gain
		}
	}
        add_character_modifier = {
	      modifier = divine_dreams_modifier
	}
        add_trait = lifestyle_mystic

        capital_county = {
		set_variable = {
			name = relic_miracle
			years = 25
		}
               add_county_modifier = { 
			modifier = relic_miracle_modifier
			years = 25
		}
	}
	create_character_memory = {
		type = relic_miracle
	}
}