###############################################
#
#	Wards and Wardens Other Decisions List
#
#	Rites of Passage - tribal coming of age rituals.
#
##################################################


#####################################################################
# Rites of Passage													#
# by Arkadiusz Majewski												#
#####################################################################

### Rites of Passage ###
rites_of_passage_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/mpo_decision_confederation.dds"
	}
	sort_order = 81

	desc = rites_of_passage_decision_desc
	selection_tooltip = rites_of_passage_decision_effect_tooltip

	ai_check_interval_by_tier = {
		barony = 0
		county = 60
		duchy = 60
		kingdom = 60
		empire = 60
		hegemony = 60
	}

	is_shown = {
		has_bp2_dlc_trigger = yes
		is_landed = yes
		government_has_flag = government_is_tribal
		OR = {
			OR = {
				AND = {
					is_adult = no
					NOT = {
						any_memory = {
							memory_type = completed_rites_of_passage
						}
					}
				}
				has_character_flag = unproven_adult_flag
			}
			any_child = {
				count >= 1
				OR = {
					AND = {
						is_adult = no
						NOT = {
							any_memory = {
								memory_type = completed_rites_of_passage
							}
						}
					}
					has_character_flag = unproven_adult_flag
				}
			}
			any_courtier = {
				is_hostage_of = root
				character_can_rites_of_passage_trigger = yes
			}
		}
	}

	cooldown = { days = 365 }

	is_valid = {
		OR = {
			any_child = {
				character_can_rites_of_passage_trigger = yes
			}
			character_can_rites_of_passage_trigger = yes
			any_courtier = {
				is_hostage_of = root
				character_can_rites_of_passage_trigger = yes
			}
		}
		custom_description = {
			text = rites_of_passage_trigger_chaplain
			cp:councillor_court_chaplain ?= {
				is_available_ai_adult = yes
			}
		}
	}

	is_valid_showing_failures_only = {
		OR = {
			is_available = yes
			any_child = {
				is_available = yes
			}
		}
		cp:councillor_court_chaplain ?= {
			is_available_ai_adult = yes
		}
	}

	effect = {
		trigger_event = bp2_decision.0002
		custom_tooltip = rites_of_passage_decision_effect_tooltip
		custom_tooltip = bp2_decision.0002.effect_tt
		custom_tooltip = bp2_decision.0002.effect_modifier_tt
	}
	
	cost = {
		prestige = minor_prestige_value
	}

	ai_potential = {
		OR = {
			any_child = {
				character_can_rites_of_passage_trigger = yes
				OR = {
					is_primary_heir_of = root
					can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				}
			}
			character_can_rites_of_passage_trigger = yes
			any_courtier = {
				is_hostage_of = root
				can_be_combatant_based_on_gender_trigger = { ARMY_OWNER = root }
				character_can_rites_of_passage_trigger = yes
			}
		}
	}

	ai_will_do = {
		base = 100
	}
}
