@celibacy_cooldown_time = 365
@sale_of_titles_cooldown_time = 1825
@extort_subjects_cooldown_time = 730
@commission_epic_cooldown_time = 3650
@hold_mystical_communion_cooldown_time = 1825

### Embrace Celibacy
# by Petter Vilberg
# Unlocked by: Restraint
embrace_celibacy_decision = {
	ai_check_interval = 0
	picture = "gfx/interface/illustrations/decisions/decision_personal_religious.dds"

	desc = embrace_celibacy_decision_desc

	selection_tooltip = embrace_celibacy_decision_tooltip

	cooldown = { days = @celibacy_cooldown_time }

	is_shown = {
		has_perk = restraint_perk
		NOT = { has_trait = celibate }
	}

	is_valid_showing_failures_only = {
		NOR = {
			has_trait = lifestyle_reveler
			has_trait = seducer
		}
		is_available_adult_or_is_commanding = yes
	}

	is_valid = {
		has_perk = restraint_perk
	}

	effect = {

		send_interface_toast = {
			title = msg_became_celibate
			left_icon = root

			add_trait = celibate
		}

		stress_impact = {
			lustful = major_stress_impact_gain
			reveler_1 = medium_stress_impact_gain
			reveler_2 = medium_stress_impact_gain
			reveler_3 = major_stress_impact_gain
		}
	}
	
	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}
}

### Abandon Celibacy
# by Petter Vilberg
# Unlocked by: Restraint
abandon_celibacy_decision = {
	ai_check_interval = 0
	picture = "gfx/interface/illustrations/decisions/decision_misc.dds"

	desc = abandon_celibacy_decision_desc

	selection_tooltip = abandon_celibacy_decision_tooltip

	cooldown = { days = @celibacy_cooldown_time }

	is_shown = {
		has_perk = restraint_perk
		has_trait = celibate
	}

	is_valid_showing_failures_only = {
		is_available_adult_or_is_commanding = yes
	}

	is_valid = {
		has_perk = restraint_perk
	}

	effect = {

		send_interface_toast = {
			title = msg_stopped_being_celibate
			left_icon = root

			remove_trait = celibate
		}
	}
	
	ai_potential = {
		always = no
	}

	ai_will_do = {
		base = 0
	}
}


### Sale of Titles
# by Petter Vilberg
# Unlocked by: At Any Cost
sale_of_titles_decision = {
	picture = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds"

	desc = sale_of_titles_decision_desc

	selection_tooltip = sale_of_titles_decision_tooltip

	cooldown = { days = @sale_of_titles_cooldown_time }

	is_shown = {
		is_landed = yes
		has_perk = at_any_cost_perk
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	is_valid = {
		has_perk = at_any_cost_perk
	}

	cost = {
		prestige = medium_prestige_value
	}

	effect = {
		hidden_effect = {
			random = {
				chance = 2
				modifier = {
					add = 3
					has_trait = greedy
				}
				send_interface_toast = {
					title = sell_titles_nickname_gained
					left_icon = root
					set_nickname_effect = {
						NICKNAME = nick_the_greedy
					}
				}
			}
		}

		add_gold = major_gold_value

		custom_tooltip = sale_of_titles_side_effects_tt

		trigger_event = {
			on_action = sell_titles_side_effect_events
			days = 5
		}
	}
	
	ai_check_interval = 72
	
	ai_potential = {
		OR = {
			ai_greed >= medium_positive_ai_value
			gold < medium_gold_value
		}
	}

	ai_will_do = {
		base = 30
		
		modifier = {
			add = 70
			ai_greed >= high_positive_ai_value
		}
	}
}


### Extort Subjects
# by Petter Vilberg
# Unlocked by: It Is MY Domain
extort_subjects_decision = {
	picture = "gfx/interface/illustrations/decisions/extort_subjects.dds"

	desc = extort_subjects_decision_desc

	selection_tooltip = extort_subjects_decision_tooltip

	cooldown = { days = @extort_subjects_cooldown_time }

	is_shown = {
		has_perk = it_is_my_domain_perk
	}

	is_valid_showing_failures_only = {
		is_landed = yes
		is_available_adult = yes
		custom_description = {
			text = has_count_vassals_or_higher
			any_vassal = {
				highest_held_title_tier >= tier_county
			}
		}
	}

	is_valid = {
		has_perk = it_is_my_domain_perk
	}

	effect = {

		custom_description = {
			text = extort_subjects_effect
		}
		
		trigger_event = {
			id = subject_extortion.9999
			days = { 3 5 }
		}

		stress_impact = {
			generous = major_stress_gain
		}
	}
	
	ai_check_interval = 72
	
	ai_potential = {
		ai_greed >= medium_positive_ai_value
		ai_honor <= medium_negative_ai_value
		gold < medium_gold_value
	}

	ai_will_do = {
		base = 10
		
		modifier = {
			add = 45
			ai_greed >= high_positive_ai_value
		}
		modifier = {
			add = 45
			ai_honor <= high_negative_ai_value
		}
	}
}


### Commission Epic
# by Petter Vilberg
# Unlocked by: Making History
commission_epic_decision = {
	picture = "gfx/interface/illustrations/decisions/commission_epic.dds"

	desc = commission_epic_decision_desc

	selection_tooltip = commission_epic_decision_tooltip

	cooldown = { days = @commission_epic_cooldown_time }

	is_shown = {
		is_landed = yes
		exists = house
		has_perk = writing_history_perk
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = medium_gold_value
	}

	effect = {
		custom_description_no_bullet = {
			text = "commission_epic_once_complete_effect"
		}
		show_as_tooltip = {
			add_prestige = medium_prestige_gain
			add_character_modifier = {
				modifier = commission_epic_modifier
				years = 10
			}
		}
		custom_description_no_bullet = {
			text = "commission_epic_potential_cost_effect"
		}

		trigger_event = commission_epic.0001
	}
	
	ai_check_interval = 120
	
	ai_potential = {
		short_term_gold >= major_gold_value
	}

	ai_will_do = {
		base = 100
	}
}


### Hold Mystical Communion
hold_mystical_communion_decision = {
	picture = "gfx/interface/illustrations/decisions/hold_mystical_communion.dds"

	desc = hold_mystical_communion_decision_desc

	selection_tooltip = hold_mystical_communion_decision_tooltip

	cooldown = { days = @hold_mystical_communion_cooldown_time }

	is_shown = {
		is_landed = yes
		has_trait = lifestyle_mystic
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	is_valid = {
		has_trait = lifestyle_mystic
	}

	cost = {
		piety = medium_piety_value
	}

	effect = {
		show_as_tooltip = {
			mystical_communion_outcome_effect = yes
		}
		custom_tooltip = hold_mystical_communion_side_effects_tt

		hidden_effect = {
			random_list = {
				50 = {
					trigger_event = {
						id = mystic_lifestyle.0001
						days = 3
					}
				}
				50 = {
					trigger_event = {
						on_action = mystic_communion_side_effect_events
						days = 3
					}
				}
			}
		}

	}
	
	ai_check_interval = 120
	
	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 100
	}
}