﻿
#Grand rite choice
grand_rite_good_outcome = {
	scope:activity = {
		every_attending_character = {
			limit = { this != root }
			custom = every_grand_rite_participant
			add_opinion = {
				target = root
				modifier = impressed_opinion
				opinion = grand_rite_good_outcome_opinion_value
			}
		}
	}
}

grand_rite_poor_outcome = {
	scope:activity = {
		every_attending_character = {
			limit = { this != root }
			custom = every_grand_rite_participant
			add_opinion = {
				target = root
				modifier = disappointed_opinion
				opinion = grand_rite_bad_outcome_opinion_value
			}
		}
	}
	add_stress = minor_stress_gain
}

hosted_successful_witch_coven_new_effect = {
	# Piety gain from Tenets.
	if = {
		limit = {
			faith = { has_doctrine_parameter = piety_from_witch_coven_active }
		}
		add_piety = grand_rite_piety_reward_value
	}

	# prestige gain from culture
	if = {
		limit = {
			culture = { has_cultural_parameter = witch_trait_more_valued }
		}
		add_prestige = grand_rite_prestige_reward_value
	}

	witch_improved_witchcraft_trait_xp_gain_effect = yes
}

attended_successful_witch_coven_new_effect = {# witch trait xp gain
	witch_improved_witchcraft_trait_xp_gain_effect = yes
}

disburse_witch_ritual_participant_rewards_effect = {
	save_temporary_scope_as = participant
	scope:activity = {
		add_activity_log_entry = {
			key = host_witch_ritual
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = scope:participant

			scope:participant = {
				attended_successful_witch_coven_new_effect = yes
			}
		}
	}
}

disburse_witch_ritual_host_rewards_effect = {
	scope:activity = {
		add_activity_log_entry = {
			key = host_witch_ritual
			tags = { completed }
			# this line below adds the entry to the Effects section of the conclusion UI
			show_in_conclusion = yes
			character = scope:host
			
			scope:host = {
				add_stress = grand_rite_host_stress_loss_value
				hosted_successful_witch_coven_new_effect = yes
			}
		}
	}
}

witch_improved_witchcraft_trait_xp_gain_effect = {
	add_trait_xp = {
		trait = witch
		value = {
			# from age 16-66 potential of 10 grand rites with avrg of 7.5, you can also attend others grand rites as well
			integer_range = {
				min = 5
				max = 10
			}
		}
	}
}