#####################################
#		Training (without mentor)	#
#####################################
decisions = {
	### Mage ###
	teach_yourself_mage = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_mage_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_mage_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.1 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				OR = {
					true_religion = cult_of_sunwell
					true_religion = arcane_religion
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Hunter ###
	teach_yourself_hunter = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_hunter_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_hunter_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.101 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Warrior ###
	teach_yourself_warrior = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_warrior_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_warrior_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.201 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Paladin ###
	teach_yourself_paladin = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_paladin_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_paladin_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.301 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				true_religion_group = light_group
				OR = {
					has_benevolent_trait_trigger = yes
					has_pious_trait_trigger = yes
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Priest ###
	teach_yourself_priest = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_priest_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_priest_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.401 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				light_true_religion_trigger = yes
				OR = {
					has_benevolent_trait_trigger = yes
					has_pious_trait_trigger = yes
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Rogue ###
	teach_yourself_rogue = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_rogue_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_rogue_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.501 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Warlock ###
	teach_yourself_warlock = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_warlock_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_warlock_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.601 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				OR = {
					true_religion_group = fel_group
					AND = {
						has_impious_trait_trigger = yes
						OR = {
							has_evil_trait_trigger = yes
							has_unpleasant_trait_trigger = yes
						}
					}
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Shaman ###
	teach_yourself_shaman = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_shaman_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_shaman_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.701 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				shamanic_true_religion_trigger = yes
				OR = {
					has_benevolent_trait_trigger = yes
					has_pious_trait_trigger = yes
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Druid ###
	teach_yourself_druid = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_druid_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_druid_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.801 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				true_religion_group = druidism_group
				OR = {
					has_benevolent_trait_trigger = yes
					has_pious_trait_trigger = yes
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Loa Priest ###
	teach_yourself_loa_priest = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_loa_priest_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_loa_priest_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.901 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				true_religion_group = loa_group
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Necromancer ###
	teach_yourself_necromancer = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_necromancer_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_necromancer_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			narrative_event = { id = WCCLS.1101 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				OR = {
					true_religion_group = necromancy_group
					AND = {
						has_impious_trait_trigger = yes
						OR = {
							has_evil_trait_trigger = yes
							has_unpleasant_trait_trigger = yes
						}
					}
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	### Shadow Priest ###
	teach_yourself_shadow_priest = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_shadow_priest_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_shadow_priest_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.1201 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				OR = {
					true_religion_group = void_group
					true_religion = forsaken_cult
					AND = {
						has_impious_trait_trigger = yes
						OR = {
							has_evil_trait_trigger = yes
							has_unpleasant_trait_trigger = yes
						}
					}
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}
	
	### Monk ###
	teach_yourself_monk = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = hide_class_training_decisions_flag }

			potential_monk_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			allow_monk_trigger = yes
			OR = {
				AND = {
					is_ruler = yes
					wealth = 25
				}
				is_ruler = no
			}
		}
		effect = {
			if = {
				limit = { ai = no }
				wealth = -25
			}
			character_event = { id = WCCLS.1600 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.05

			modifier = {
				factor = 10

				true_religion_group = pandaren_religion_group
				OR = {
					has_benevolent_trait_trigger = yes
					has_pious_trait_trigger = yes
				}
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
			modifier = {
				factor = 2
				trait = brave
			}
		}
	}

	# Hide class training decisions
	# Always must be after these decisions
	hide_show_class_training_decisions = {
		is_high_prio = yes

		ai_check_interval = 60

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			ai = no
			is_adult = yes
			is_incapable = no
			prisoner = no

			potential_class_trigger = yes
		}

		allow = {

		}

		effect = {
			if = {
				limit = { NOT = { has_character_flag = hide_class_training_decisions_flag } }
				set_character_flag = hide_class_training_decisions_flag
			}
			else = {
				clr_character_flag = hide_class_training_decisions_flag
			}
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0
		}
	}

	###  Druid Forms ###
	learn_cat_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			can_learn_cat_bear_form_trigger = yes
			NOR = {
				cat_form_trigger = yes
				master_cat_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10000 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_bear_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			can_learn_cat_bear_form_trigger = yes
			NOR = {
				bear_form_trigger = yes
				master_bear_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10020 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_talon_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			can_learn_talon_form_trigger = yes
			NOR = {
				talon_form_trigger = yes
				master_talon_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10040 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_stag_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			can_learn_stag_form_trigger = yes
			NOT = {
				stag_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10060 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_master_cat_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			cat_form_trigger = yes
			can_master_cat_form_trigger = yes
			NOT = {
				master_cat_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10100 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_master_bear_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			bear_form_trigger = yes
			can_master_bear_form_trigger = yes
			NOT = {
				master_bear_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10120 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
	learn_master_talon_form = {
		is_high_prio = yes

		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			talon_form_trigger = yes
			can_master_talon_form_trigger = yes
			NOT = {
				master_talon_form_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}

		}
		effect = {
			set_character_flag = do_not_disturb			# Always must be before event chain

			character_event = { id = WCCLS.10140 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8
		}
	}
}

#################################################
#			Training (mentor)					#
#################################################
targetted_decisions = {
	ask_to_be_mentor = {
		third_party = FROM

		ai_target_filter = realm
		third_party_filter = home_court_including_me
		ai_third_party_filter = home_court_including_me

		ai_check_interval = 24
		diplomacy_icon = GFX_trainer_decision

		ai = no
		only_playable = yes

		potential = {
			FROM = { is_within_prev_diplo_range_trigger = yes }

			ROOT = { FROM = { can_positive_interact_with_prev_hiddenly_trigger = yes } }
			potential_mentor_class_trigger = yes
			ROOT = { FROM = { this_see_prev_class_trait_trigger = yes } }
		}

		third_party_potential = {
			FROMFROM = {
				# Can't force other players to pick class
				OR = {
					character = ROOT_FROM # Since FROM ain't working
					ai = yes
				}

				ROOT = {
					prev_student_this_class_mentor_potential = yes
				}
			}

			ROOT = {
				FROMFROM = {
					prev_mentor_this_class_student_potential = yes
					ROOT_FROM = {
						# If it's true, ROOT will be able to see FROMFROM's class after the end of the training
						this_would_see_prev_class_trait_if_prev_was_prevprev_class_trigger = yes
					}
				}
			}
		}
		allow = {
			#
		}
		third_party_allow = {
			# show_only_failed_conditions = yes

			FROMFROM = {
				show_scope_change = no

				ROOT = {
					show_scope_change = no

					prev_student_this_class_mentor_allow = yes
				}
			}
		}
		effect = {
			ROOT = {
				save_event_target_as = mentor
			}
			FROMFROM = {
				show_scope_change = no

				save_event_target_as = student

				pre_class_mentoring_effect = yes
			}
			FROM = {
				save_event_target_as = target_initiator

				character_event = { id = WCCLS.1500 }
			}
		}
		ai_acceptance = {
			factor = -20	# The base score

			# Opinion
			# Positive
			# ROOT likes FROM
			ROOT_likes_FROM_5_positive_per_5_opinion_chance = yes

			# ROOT likes FROMFROM
			additive_modifier = {
				value = 10
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 10 }
				opinion = { who = FROMFROM value < 20 }
			}
			additive_modifier = {
				value = 20
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 20 }
				opinion = { who = FROMFROM value < 30 }
			}
			additive_modifier = {
				value = 30
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 30 }
				opinion = { who = FROMFROM value < 40 }
			}
			additive_modifier = {
				value = 40
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 40 }
				opinion = { who = FROMFROM value < 50 }
			}
			additive_modifier = {
				value = 50
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 50 }
				opinion = { who = FROMFROM value < 70 }
			}
			additive_modifier = {
				value = 60
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 60 }
				opinion = { who = FROMFROM value < 70 }
			}
			additive_modifier = {
				value = 70
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 70 }
				opinion = { who = FROMFROM value < 80 }
			}
			additive_modifier = {
				value = 80
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 80 }
				opinion = { who = FROMFROM value < 90 }
			}
			additive_modifier = {
				value = 90
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value >= 90 }
				opinion = { who = FROMFROM value < 100 }
			}
			additive_modifier = {
				value = 100
				localisation_key = ROOT_likes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value == 100 }
			}

			# Negative
			# ROOT dislikes FROM
			ROOT_dislikes_FROM_5_negative_per_5_opinion_chance = yes

			# ROOT dislikes FROMFROM

			additive_modifier = {
				value = -10
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -10 }
				opinion = { who = FROMFROM value > -20 }
			}
			additive_modifier = {
				value = -20
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -20 }
				opinion = { who = FROMFROM value > -30 }
			}
			additive_modifier = {
				value = -30
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -30 }
				opinion = { who = FROMFROM value > -40 }
			}
			additive_modifier = {
				value = -40
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -40 }
				opinion = { who = FROMFROM value > -50 }
			}
			additive_modifier = {
				value = -50
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -50 }
				opinion = { who = FROMFROM value > -70 }
			}
			additive_modifier = {
				value = -60
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -60 }
				opinion = { who = FROMFROM value > -70 }
			}
			additive_modifier = {
				value = -70
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -70 }
				opinion = { who = FROMFROM value > -80 }
			}
			additive_modifier = {
				value = -80
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -80 }
				opinion = { who = FROMFROM value > -90 }
			}
			additive_modifier = {
				value = -90
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value <= -90 }
				opinion = { who = FROMFROM value > -100 }
			}
			additive_modifier = {
				value = -100
				localisation_key = ROOT_dislikes_FROMFROM_tooltip
				FROMFROM = { NOT = { character = ROOT_FROM } }
				opinion = { who = FROMFROM value == -100 }
			}

			# Traits
			# Positive
			additive_modifier = { # I don't mind help people
				value = 15
				localisation_key = ROOT_is_charitable
				trait = charitable
			}
			additive_modifier = { # I just like talking to people
				value = 10
				localisation_key = ROOT_is_gregarious
				trait = gregarious
			}
			additive_modifier = { # They look like good guys
				value = 5
				localisation_key = ROOT_is_trusting
				trait = trusting
			}
			# Negative
			additive_modifier = { # I would like to get more for it
				value = -5
				localisation_key = ROOT_is_greedy
				trait = greedy
			}
			additive_modifier = { # I don't like to contact with people
				value = -10
				localisation_key = ROOT_is_shy
				trait = shy
			}
			additive_modifier = { # They may kill me!
				value = -15
				localisation_key = ROOT_is_paranoid
				trait = paranoid
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0
		}
	}
}


#################################
# 			Abilities			#
#################################
decisions = {
	### Mage ###
	# Gives random bonus or chance to study dark magic
	study_magical_secrets = {
		ai_check_interval = 36

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_mage_class_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}
			custom_tooltip = {
				text = has_not_used_decision_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = study_magical_secrets_cooldown_flag }
						had_character_flag = { flag = study_magical_secrets_cooldown_flag years = 3 }
					}
				}
			}
		}

		effect = {
			set_character_flag = do_not_disturb
			set_character_flag = study_magical_secrets_cooldown_flag

			hidden_effect = { character_event = { id = WCCLS.15 } }
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0.25
		}
	}

	### Hunter ###

	### Warrior ###

	### Paladin ###
	write_libram = {
		is_high_prio = yes

		ai_check_interval = 120

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			is_paladin_class_trigger = yes

			trigger_if = {
				limit = { ai = yes }
				NOT = { has_character_flag = wrote_libram }		# Otherwise, AI create a ton of librams
				NOT = { any_artifact = { has_artifact_flag = libram } }
			}

			can_write_libram = yes
		}
		allow = {
			show_only_failed_conditions = yes

			prisoner = no
			is_inaccessible_trigger = no

			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}
			piety = 750
		}
		effect = {
			set_character_flag = do_not_disturb			# Otherwise, you can fire decision twice
			set_character_flag = wrote_libram

			tooltip = { piety = -750 }
			
			character_event = { id = WCCLS.10200 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8

			modifier = {
				factor = 0
				war = yes
			}
		}
	}

	### Priest ###

	### Rogue ###

	### Warlock ###

	### Shaman ###

	### Druid ###
	cat_form_druid = {
		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				cat_form_trigger = yes
				master_cat_form_trigger = yes
			}
			NOR = {
				trait = cat_form
				trait = master_cat_form
			}
			prefers_cat_form_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
		}
		effect = {
			shapeshift_cat_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = no
			}
		}
	}
	bear_form_druid = {
		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				bear_form_trigger = yes
				master_bear_form_trigger = yes
			}
			NOR = {
				trait = bear_form
				trait = master_bear_form
			}
			prefers_bear_form_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
		}
		effect = {
			shapeshift_bear_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = no
			}
		}
	}
	talon_form_druid = {
		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				talon_form_trigger = yes
				master_talon_form_trigger = yes
			}
			NOR = {
				trait = talon_form
				trait = master_talon_form
			}
			prefers_talon_form_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
		}
		effect = {
			shapeshift_talon_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = no
			}
		}
	}
	stag_form_druid = {
		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				stag_form_trigger = yes
			}
			NOT = {
				trait = stag_form
			}
			prefers_stag_form_trigger = yes
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
		}
		effect = {
			shapeshift_stag_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = no
			}
		}
	}
	pack_form_druid = {
		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				pack_form_trigger = yes
			}
			NOT = {
				trait = pack_form
			}
		}
		allow = {
			show_only_failed_conditions = yes

			is_incapable = no
			prisoner = no
			is_inaccessible_trigger = no
		}
		effect = {
			shapeshift_pack_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = no
			}
		}
	}
	shapeshift_back_druid = {
		is_high_prio = yes
		ai_check_interval = 12

		# only_playable = yes

		potential = {
			is_adult = yes
			OR = {
				is_shapeshifted_trigger = yes
			}
		}
		allow = {
			show_only_failed_conditions = yes
		}
		effect = {
			shapeshift_back_effect = yes
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				in_command = yes
			}
		}
	}
	enter_emerald_dream_decision = {
		is_high_prio = yes	#Made it high priority because it's quest only thing now
		
		ai_check_interval = 60

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			NOT = {
				trait = in_emerald_dream
			}
			is_druid_class_trigger = yes
			
			has_quest = quest_enter_emerald_dream
		}
		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest

			prisoner = no
			is_inaccessible_trigger = no

			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}
		}
		effect = {
			character_event = { id = WCED.1 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1

			modifier = {
				factor = 0
				war = yes
			}
		}
	}
	# Commented out because you leave the Dream in 3 years not matter what
	# leave_emerald_dream = {
		# is_high_prio = yes

		# ai_check_interval = 60

		# only_playable = yes

		# potential = {
			# trait = in_emerald_dream
		# }
		# allow = {
		# }
		# effect = {
			# character_event = { id = WCED.2 }
		# }
		# revoke_allowed = {
			# always = no
		# }
		# ai_will_do = {
			# factor = 1
		# }
	# }

	### Loa Priest ###

	### Death Knight
	forge_runeblade = {
		is_high_prio = yes

		ai_check_interval = 120

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			OR = {
				is_death_knight_class_trigger = yes
				trait = creature_nathrezim
			}

			trigger_if = {
				limit = { ai = yes }
				NOT = { has_character_flag = forged_runeblade }		# Otherwise, AI create a ton of librams
				NOT = { any_artifact = { has_artifact_flag = combat_weapon } }
			}
		}
		allow = {
			show_only_failed_conditions = yes

			prisoner = no
			is_inaccessible_trigger = no

			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}
			trigger_if = {
				limit = { trait = creature_nathrezim }
				wealth = 500
			}
			trigger_else = {
				piety = 500
			}
		}
		effect = {
			set_character_flag = do_not_disturb				# Otherwise, you can fire decision twice
			set_character_flag = forged_runeblade

			tooltip = {
				forge_runeblade_cost_effect = yes
			}
			
			character_event = { id = WCCLS.10300 }
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 0.8

			modifier = {
				factor = 0
				war = yes

			}
		}
	}

	### Necromancer ###

	### Shadow Priest ###
}
targetted_decisions = {
	### Mage ###
	# Gives 2 year opinion bonus
	conjure_food = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 24

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_mage_class_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = conjure_food_cooldown_flag }
						had_character_flag = { flag = conjure_food_cooldown_flag years = 3 }
					}
				}
			}

			has_5_6_magic_class_or_higher_trigger = yes
			has_3_mana_trigger = yes
		}

		effect = {
			set_character_flag = conjure_food_cooldown_flag

			tooltip = { remove_3_mana_effect = yes }

			character_event = { id = WCCLS.10 }
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.25
		}
	}
	# Gives +2 to every attribute
	sharp_mind_dec = {
		filter = realm_including_me
		ai_target_filter = court_including_me
		ai_check_interval = 48

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_mage_class_trigger = yes
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_modifier = sharp_mind }
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_5_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = sharp_mind_cooldown_flag }
						had_character_flag = { flag = sharp_mind_cooldown_flag years = 5 }
					}
				}
			}
			FROM = {
				is_inaccessible_trigger = no

				has_1_mana_trigger = yes
			}
		}

		effect = {
			set_character_flag = sharp_mind_cooldown_flag

			tooltip = { add_character_modifier = { name = sharp_mind years = 2 } }
			opinion = { modifier = opinion_grateful who = FROM years = 10 }
			hidden_effect = { character_event = { id = WCCLS.40 } }

			FROM = {
				remove_1_mana_effect = yes
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			modifier = {
				factor = 10
				character = FROM
			}
			modifier = {
				factor = 4
				FROM = { is_benevolent_trigger = yes }
			}
			modifier = {
				factor = 2
				reverse_opinion = {
					who = FROM
					value = 30
				}
			}
			modifier = {
				factor = 0
				NOR = {
					is_close_relative = FROM
					is_friend = FROM
					is_lover = FROM
					FROM = {
						has_minor_title = title_court_physician
						de_facto_liege = ROOT
					}
				}
			}
		}
	}

	### Hunter ###

	### Warrior ###

	### Paladin ###
	# Removes wounded and severely_injured traits
	heal_wounds = {
		filter = realm_including_me
		ai_target_filter = court_including_me
		ai_check_interval = 6

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				is_paladin_class_trigger = yes
				is_priest_class_trigger = yes
				is_shaman_class_trigger = yes
				is_druid_class_trigger = yes
				is_loa_priest_class_trigger = yes
				is_monk_class_trigger = yes
			}
		}

		potential = {
			prisoner = no

			OR = {
				trait = wounded
				trait = severely_injured
				trait = infection
			}
			
			from_prefer_to_heal_and_buff_this_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			ROOT = {
				is_inaccessible_trigger = no

				custom_tooltip = {
					text = has_not_used_decision_5_years_tooltip
					hidden_tooltip = {
						OR = {
							NOT = { has_character_flag = heal_wounds_cooldown_flag }
							had_character_flag = { flag = heal_wounds_cooldown_flag days = 1825 }
						}
					}
				}
			}
			FROM = {
				show_scope_change = no
				is_inaccessible_trigger = no

				conditional_tooltip = {
					trigger = { ROOT = { trait = severely_injured } }
					has_5_6_magic_class_or_higher_trigger = yes
					has_3_mana_trigger = yes
				}
				conditional_tooltip = {
					trigger = { ROOT = { NOT = { trait = severely_injured } } }
					has_1_mana_trigger = yes
				}
			}
		}

		effect = {
			ROOT = {
				set_character_flag = heal_wounds_cooldown_flag

				if = {
					limit = { character = FROM }
					heal_wounds_effect = yes
				}
				else = {
					tooltip = { heal_wounds_effect = yes }
					letter_event = { id = WCCLS.805 }
				}
			}
			FROM = {
				show_scope_change = no
				if = {
					limit = { character = ROOT }
					if = {
						limit = { ROOT = { trait = severely_injured } }
						remove_3_mana_effect = yes
					}
					else = {
						remove_1_mana_effect = yes
					}
				}
				else = {
					tooltip = {
						if = {
							limit = { ROOT = { trait = severely_injured } }
							remove_3_mana_effect = yes
						}
						else = {
							remove_1_mana_effect = yes
						}
					}
				}
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			from_prefer_to_heal_and_buff_this_score = yes
		}
	}
	# Gives 2 year health bonus or health penalty if ROOT is undead, demon or void creature
	light_mark_dec = {
		filter = realm_including_me
		ai_target_filter = court_including_me
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				is_paladin_class_trigger = yes
				is_priest_class_trigger = yes
			}
		}

		potential = {
			is_untouchable_trigger = no

			FROM = { is_within_prev_diplo_range_trigger = yes }

			OR = {
				character = FROM
				has_invader_title_trigger = no
			}

			# FROM can't hurt itself
			NOT = {
				FROM = {
					character = ROOT
					is_dark_being_trigger = yes
				}
			}
			
			from_prefer_to_heal_and_buff_this_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			NOT = { has_character_modifier = light_mark_good }
			NOT = { has_character_modifier = light_mark_bad }
			NOT = { has_character_modifier = touch_of_elune }
			custom_tooltip = {
				text = has_not_used_decision_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = light_mark_cooldown_flag }
						had_character_flag = { flag = light_mark_cooldown_flag years = 3 }
					}
				}
			}

			is_humanoid_trigger = yes

			FROM = {
				show_scope_change = no

				is_inaccessible_trigger = no

				has_3_4_magic_class_or_higher_trigger = yes
				has_2_mana_trigger = yes
			}
		}

		effect = {
			FROM = { save_event_target_as = target_priest }

			ROOT = {
				show_scope_change = no

				set_character_flag = light_mark_cooldown_flag

				if = {
					limit = { trait = creature_lothraxim }
					
					tooltip = {
						if = {
							limit = { FROM = { trait = subclass_moon_priest } }
							add_character_modifier = { name = touch_of_elune years = 2 }
						}
						else = {
							add_character_modifier = { name = light_mark_good years = 2 }
						}
					}
					if = {
						limit = { NOT = { character = FROM } }
						opinion = { modifier = opinion_grateful who = FROM years = 5 }
					}
					hidden_effect = { character_event = { id = WCCLS.305 } }
				}

				else_if = {
					limit = { is_dark_being_trigger = yes }
					tooltip = { add_character_modifier = { name = light_mark_bad years = 2 } }
					if = {
						limit = { NOT = { character = FROM } }
						opinion = { modifier = opinion_traitor who = FROM }
					}
					hidden_effect = { character_event = { id = WCCLS.305 } }
				}
				else = {
					tooltip = {
						if = {
							limit = { FROM = { trait = subclass_moon_priest } }
							add_character_modifier = { name = touch_of_elune years = 2 }
						}
						else = {
							add_character_modifier = { name = light_mark_good years = 2 }
						}
					}
					if = {
						limit = { NOT = { character = FROM } }
						opinion = { modifier = opinion_grateful who = FROM years = 5 }
					}
					hidden_effect = { character_event = { id = WCCLS.305 } }
				}
			}
			FROM = {
				show_scope_change = no

				remove_2_mana_effect = yes
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.01
			from_prefer_to_heal_and_buff_this_score = yes
			# AI can't hurt anyone
			modifier = {
				factor = 0
				is_dark_being_trigger = no
			}
		}
	}

	### Priest ###

	### Rogue ###
	# Gives a chance to make ROOT incapable for a while
	poison_with_gas = {
		ai_target_filter = rivals
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_rogue_class_trigger = yes
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			NOT = { character = FROM }
			from_in_range_to_hurt_this_trigger = yes
			NOT = { has_character_flag = poison_with_gas_ongoing_flag }

			has_invader_title_trigger = no

			# AI preferences
			# ai_from_prefer_to_hurt_this_trigger = yes	# No need because check only rivals
		}

		allow = {
			show_only_failed_conditions = yes

			prisoner = no
			is_inaccessible_trigger = no

			NOT = { has_character_modifier = has_been_poisoned_by_gas }
			custom_tooltip = {
				text = has_not_been_target_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = poison_with_gas_cooldown_flag }
						had_character_flag = { flag = poison_with_gas_cooldown_flag years = 3 }
					}
				}
			}

			is_dark_being_trigger = no
			is_humanoid_trigger = yes

			FROM = {
				is_inaccessible_trigger = no

				conditional_tooltip = {
					trigger = {
						ROOT = {
							OR = {
								tier = COUNT
								any_close_relative = { tier = COUNT }
							}
						}
					}
					intrigue = 8
					scaled_wealth = { value = 0.5 min = 100 }
				}
				conditional_tooltip = {
					trigger = {
						ROOT = {
							OR = {
								tier = DUKE
								any_close_relative = { tier = DUKE }
							}
						}
					}
					intrigue = 12
					scaled_wealth = { value = 1.0 min = 200 }
				}
				conditional_tooltip = {
					trigger = {
						ROOT = {
							OR = {
								tier = KING
								any_close_relative = { tier = KING }
							}
						}
					}
					intrigue = 15
					scaled_wealth = { value = 1.5 min = 300 }
				}
				conditional_tooltip = {
					trigger = {
						ROOT = {
							OR = {
								tier = EMPEROR
								any_close_relative = { tier = EMPEROR }
							}
						}
					}
					intrigue = 18
					scaled_wealth = { value = 2.0 min = 400 }
				}
				conditional_tooltip = {
					trigger = {
						ROOT = {
							NOT = { higher_tier_than = BARON }
							NOT = { any_close_relative = { higher_tier_than = BARON } }
						}
					}
					scaled_wealth = { value = 0.25 min = 50 }
				}
			}
		}

		effect = {
			set_character_flag = poison_with_gas_ongoing_flag
			set_character_flag = poison_with_gas_cooldown_flag

			FROM = {
				show_scope_change = no
				if = {
					limit = {
						ROOT = {
							OR = {
								tier = EMPEROR
								any_close_relative = { tier = EMPEROR }
							}
						}
					}
					scaled_wealth = { value = -2.0 min = -400 }
				}
				else = {
					if = {
						limit = {
							ROOT = {
								OR = {
									tier = KING
									any_close_relative = { tier = KING }
								}
							}
						}
						scaled_wealth = { value = -1.5 min = -300 }
					}
					else = {
						if = {
							limit = {
								ROOT = {
									OR = {
										tier = DUKE
										any_close_relative = { tier = DUKE }
									}
								}
							}
							scaled_wealth = { value = -1.0 min = -200 }
						}
						else = {
							if = {
								limit = {
									ROOT = {
										OR = {
											tier = COUNT
											any_close_relative = { tier = COUNT }
										}
									}
								}
								scaled_wealth = { value = -0.5 min = -100 }
							}
							else = {
								scaled_wealth = { value = -0.25 min = -50 }
							}
						}
					}
				}
			}
			hidden_effect = {
				random_list = {
					5 = {
						set_character_flag = deadly_gas_attack_flag
						character_event = { id = WCCLS.505 days = 3 }
					}
					5 = {
						set_character_flag = very_successful_gas_attack_flag
						character_event = { id = WCCLS.505 days = 3 }
						modifier = {
							factor = 0
							trait = blinded
						}
					}
					60 = {
						set_character_flag = successful_gas_attack_flag
						character_event = { id = WCCLS.505 days = 3 }
					}
					30 = {
						set_character_flag = failed_gas_attack_flag
						FROM = { long_character_event = { id = WCCLS.506 days = 3 } }
						modifier = {
							factor = 1.29
							higher_tier_than = KING
						}
						modifier = {
							factor = 1.29
							higher_tier_than = DUKE
						}
						modifier = {
							factor = 1.29
							higher_tier_than = COUNT
						}
						modifier = {
							factor = 1.29
							is_ruler = yes
						}
						modifier = {
							factor = 1.29
							health = 10
						}
						modifier = {
							factor = 1.29
							health = 8
						}
						modifier = {
							factor = 1.29
							health = 6
						}
						modifier = {
							factor = 1.46
							FROM = { NOT = { intrigue = 8 } }
						}
						modifier = {
							factor = 1.46
							FROM = { NOT = { intrigue = 4 } }
						}
						modifier = {
							factor = 0.8
							FROM = { intrigue = 18 }
						}
						modifier = {
							factor = 0.8
							FROM = { intrigue = 15 }
						}
						modifier = {
							factor = 0.8
							FROM = { intrigue = 12 }
						}
						modifier = {
							factor = 0.8
							NOT = { health = 4 }
						}
						modifier = {
							factor = 0.8
							NOT = { health = 2 }
						}
					}
				}
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			from_likes_to_hurt_score = yes
		}
	}

	### Warlock ###
	# Gives soul_shard that can be used alter
	prisoner_drain_soul = {
		filter = court
		ai_target_filter = court
		ai_check_interval = 12

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				is_warlock_class_trigger = yes
				society_member_of = shadow_council
			}
		}

		potential = {
			is_untouchable_trigger = no

			prisoner = yes

			host = { character = FROM }
		}

		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest

			is_dark_being_trigger = no
			is_humanoid_trigger = yes

			NOT = { diplomatic_immunity = yes }
			FROM = {
				is_inaccessible_trigger = no
			}
		}

		effect = {
			death = { death_reason = death_missing }
			hidden_effect = { character_event = { id = MNM.7506 } }
			FROM = {
				show_scope_change = no

				add_2_fel_corruption_effect = yes

				increase_visibility_minor_effect = yes
				minor_soul_corruption_effect = yes
				add_soul_shard_effect = yes
				# How many people you killed?
				hidden_effect = { murder_bloodline_check_effect = yes }

				ROOT = {
					show_scope_change = no

					PREV_society_sacrifice_THIS_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.01
				NOR = {
					trait = dwarf
					is_priest = yes
					is_ascetic_trigger = yes
					is_virgin_trigger = yes
					is_landed = yes
				}
			}
		}
	}
	# Uses soul_shard to restore mana
	restore_mana = {
		filter = self
		ai_target_filter = none
		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_warlock_class_trigger = yes
			mana_is_full_trigger = no
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			has_artifact = soul_shard
			custom_tooltip = {
				text = has_not_used_decision_5_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = restore_mana_cooldown_flag }
						had_character_flag = { flag = restore_mana_cooldown_flag days = 1825 }
					}
				}
			}
		}

		effect = {
			add_10_fel_corruption_effect = yes

			destroy_artifact = soul_shard
			custom_tooltip = {
				text = restore_mana_effect_tooltip
				hidden_effect = {
					set_character_flag = completely_restored_mana_flag
					character_event = { id = WCCLS.5 }
				}
			}
		}

		ai_will_do = {
			factor = 0.25
		}
	}
	# Uses soul_shard to increase fel corruption
	use_soul_shard = {
		filter = self
		ai_target_filter = none
		ai_check_interval = 12

		ai = no
		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_warlock_class_trigger = yes
			NOT = {
				trait = being_demon
				check_variable = { which = fel_corruption value = 100 }
				is_susceptible_to_fel_corruption_trigger = no
			}
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			has_artifact = soul_shard
			custom_tooltip = {
				text = has_not_used_decision_1_year_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = use_soul_shard_cooldown_flag }
						had_character_flag = { flag = use_soul_shard_cooldown_flag days = 365 }
					}
				}
			}
		}

		effect = {
			set_character_flag = use_soul_shard_cooldown_flag

			add_15_fel_corruption_effect = yes

			destroy_artifact = soul_shard
		}

		ai_will_do = {
			factor = 0.25
		}
	}
	# Adds demon modifier using soul_shard
	summon_demon = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 48

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = summon_demon_ongoing_flag }

			is_warlock_class_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_5_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = summon_demon_cooldown_flag }
						had_character_flag = { flag = summon_demon_cooldown_flag years = 5 }
					}
				}
			}

			has_3_4_magic_class_or_higher_trigger = yes
			has_2_mana_trigger = yes
			has_artifact = soul_shard
		}

		effect = {
			set_character_flag = summon_demon_ongoing_flag
			set_character_flag = summon_demon_cooldown_flag

			add_10_fel_corruption_effect = yes

			destroy_artifact = soul_shard
			character_event = { id = WCCLS.610 }
			remove_2_mana_effect = yes
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.25
		}
	}
	# Gives chance to make ROOT opinion_loyal_servant
	control_mind = {
		ai_target_filter = realm
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			OR = {
				is_incapable = no
				trait = lich_king
			}
			prisoner = no

			OR = {
				# trait = creature_nathrezim
				# trait = creature_cthraxxi
				# trait = creature_qiraji
				# trait = vampire
				is_warlock_class_trigger = yes
				is_death_knight_class_trigger = yes
				is_necromancer_class_trigger = yes
				is_shadow_priest_class_trigger = yes
				# trait = subclass_dark_shaman
				trait = lich_king

				AND = {
					OR = {
						society_member_of = shadow_council
						society_member_of = twilights_hammer_cult
					}
					society_rank > 2
				}
			}
		}

		potential = {
			control_mind_target_potential_trigger = yes

			NOT = { character = FROM }
			NOT = { has_character_flag = mind_control_attempt_flag }
		}

		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest
			
			FROM = {
				show_scope_change = yes
				ROOT = {
					show_scope_change = yes
					control_mind_target_allow_trigger = yes
				}
			}

			OR = {
				custom_tooltip = {
					text = mind_control_already_done
					hidden_tooltip = {
						NOR = {
							has_character_flag = mind_control_attempt_flag
							has_opinion_modifier = { who = FROM modifier = opinion_loyal_servant }
							trait = possessed
							trait = lunatic
						}
					}
				}
				trigger_if = {
					limit = {
						FROM = {
							has_quest_control_mind_trigger = yes
							ROOT = { quest_control_mind_prev_target_trigger = yes }
						}
					}
					FROM = {
						show_scope_change = yes

						ROOT = {
							show_scope_change = yes

							quest_control_mind_prev_target_trigger = yes
						}
					}
				}
			}

			FROM = {
				is_inaccessible_trigger = no

				custom_tooltip = {
					text = control_mind_ongoing_tooltip
					NOT = { has_character_flag = control_mind_ongoing_flag }
				}

				OR = {
					trigger_if = {
						limit = {
							OR = {
								is_warlock_class_trigger = yes
								is_death_knight_class_trigger = yes
								is_necromancer_class_trigger = yes
								is_shadow_priest_class_trigger = yes
							}
						}
						AND = {
							has_5_6_magic_class_or_higher_trigger = yes
							has_2_mana_trigger = yes
						}
					}
					trigger_if = {
						limit = {
							OR = {
								society_member_of = shadow_council
								society_member_of = twilights_hammer_cult
							}
							society_rank > 2
						}
						trigger_if = {
							limit = {
								has_quest_control_mind_trigger = yes
								ROOT = { quest_control_mind_prev_target_trigger = yes }
							}
							ROOT = {
								show_scope_change = yes

								quest_control_mind_prev_target_trigger = yes
							}
						}
						trigger_else = {
							has_society_currency_medium_trigger = yes
						}
					}
					trigger_if = {
						limit = { trait = lich_king }
						piety = 100
					}

					# Fallback
					always = no
				}
			}
		}

		effect = {
			save_event_target_as = target_mind
			
			set_character_flag = mind_control_attempt_flag

			FROM = {
				set_character_flag = control_mind_ongoing_flag

				hidden_effect = { character_event = { id = WCCLS.615 days = 3 } }

				if = {
					limit = {
						OR = {
							society_member_of = shadow_council
							society_member_of = twilights_hammer_cult
						}
					}
					if = {
						limit = { ROOT = { NOT = { is_quest_target_of = FROM } } }
						increase_visibility_effect = yes
					}
					if = {
						limit = { ROOT = { is_quest_target_of = FROM } }
						increase_visibility_minor_effect = yes
					}
				}
				if = {
					limit = {
						has_quest_control_mind_trigger = yes
						ROOT = { quest_control_mind_prev_target_trigger = yes }
					}
					# Pay nothing
				}
				else_if = {
					limit = {
						OR = {
							is_warlock_class_trigger = yes
							is_necromancer_class_trigger = yes
							is_death_knight_class_trigger = yes
							is_shadow_priest_class_trigger = yes
						}
						has_5_6_magic_class_or_higher_trigger = yes
						has_2_mana_trigger = yes
					}
					remove_2_mana_effect = yes
				}
				else_if = {
					limit = {
						OR = {
							society_member_of = shadow_council
							society_member_of = twilights_hammer_cult
						}
						society_rank > 2
						has_society_currency_medium_trigger = yes
					}
					detract_society_currency_medium_effect = yes
				}
				else = {
					piety = -100
				}
				if = {
					limit = {
						OR = {
							is_shadow_priest_class_trigger = yes
							society_member_of = twilights_hammer_cult
						}
						is_susceptible_to_void_corruption_trigger = yes
					}
					add_5_void_corruption_effect = yes
				}
				else_if = {
					limit = {
						OR = {
							is_warlock_class_trigger = yes
							society_member_of = shadow_council
						}
						is_susceptible_to_fel_corruption_trigger = yes
					}
					add_5_fel_corruption_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 0.25
			modifier = {
				factor = 0.5
				FROM = { is_benevolent_trigger = yes }
			}
			modifier = {
				factor = 0.25
				ROOT = { is_landed = no }
			}
			modifier = {
				factor = 3
				ROOT = { among_most_powerful_vassals = 5 }
			}
		}
	}

	### Shaman ###

	### Druid ###

	### Loa Priest ###
	# Gives stressed or depressed or weak or slow or stutter or lisp to ROOT
	# If FROM fails, gives quick or strong to ROOT or do nothing
	bad_voodoo = {
		ai_target_filter = realm
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_loa_priest_class_trigger = yes
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			NOT = { character = FROM }
			from_in_range_to_hurt_this_trigger = yes
			NOT = { has_character_flag = bad_voodoo_ongoing_flag }

			# AI preferences
			ai_from_prefer_to_hurt_this_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = bad_voodoo_cooldown_flag }
						had_character_flag = { flag = bad_voodoo_cooldown_flag years = 3 }
					}
				}
			}

			is_dark_being_trigger = no
			is_humanoid_trigger = yes
			OR = {
				NOT = { trait = lisp }
				NOT = { trait = slow }
				NOT = { trait = stutter }
				NOT = { trait = weak }
				NOT = { trait = depressed }
				NOT = { trait = stressed }
			}

			has_invader_title_trigger = no

			FROM = {
				is_inaccessible_trigger = no

				has_1_mana_trigger = yes
			}
		}

		effect = {
			save_event_target_as = target_doll

			set_character_flag = bad_voodoo_ongoing_flag
			set_character_flag = bad_voodoo_cooldown_flag

			hidden_effect = {
				random_list = {
					50 = {	# Success
						random_list = {
							10 = {
								set_character_flag = bad_voodoo_lisp_flag
								modifier = {
									factor = 0
									trait = lisp
								}
							}
							5 = {
								set_character_flag = bad_voodoo_slow_flag
								modifier = {
									factor = 0
									trait = slow
								}
							}
							10 = {
								set_character_flag = bad_voodoo_stutter_flag
								modifier = {
									factor = 0
									trait = stutter
								}
							}
							5 = {
								set_character_flag = bad_voodoo_weak_flag
								modifier = {
									factor = 0
									trait = weak
								}
							}
							20 = {
								set_character_flag = bad_voodoo_depressed_flag
								modifier = {
									factor = 0
									trait = depressed
								}
							}
							50 = {
								set_character_flag = bad_voodoo_stressed_flag
								modifier = {
									factor = 0
									trait = stressed
								}
							}
						}
						modifier = {
							factor = 2.24
							has_9_10_magic_class_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_7_8_magic_class_or_higher_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_5_6_magic_class_or_higher_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_3_4_magic_class_or_higher_trigger = yes
						}
					}
					50 = {	# Fail
						random_list = {
							80 = { set_character_flag = bad_voodoo_nothing_flag }
							10 = {
								set_character_flag = bad_voodoo_quick_flag
								modifier = {
									factor = 0
									trait = quick
								}
							}
							10 = {
								set_character_flag = bad_voodoo_strong_flag
								modifier = {
									factor = 0
									trait = strong
								}
							}
						}
					}
				}
			}
			FROM = {
				remove_1_mana_effect = yes

				hidden_effect = {
					character_event = { id = WCCLS.905 days = 3 }
				}
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			from_likes_to_hurt_score = yes
		}
	}

	### Death Knight

	### Necromancer ###
	prisoner_disembowel = {
		filter = court
		ai_target_filter = court
		ai_check_interval = 12

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			OR = {
				is_incapable = no
				trait = lich_king
			}
			prisoner = no

			OR = {
				society_member_of = cult_of_the_damned
				is_necromancer_class_trigger = yes
			}
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			prisoner = yes

			host = { character = FROM }
		}

		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest

			is_dark_being_trigger = no
			is_humanoid_trigger = yes

			NOT = { diplomatic_immunity = yes }
			FROM = {
				OR = {
					is_inaccessible_trigger = no
					trait = lich_king
				}
			}
		}

		effect = {
			hidden_effect = { long_character_event = { id = MNM.7506 } }
			FROM = {
				show_scope_change = no

				increase_visibility_minor_effect = yes
				minor_soul_corruption_effect = yes
				add_prev_useful_flesh = yes
				hidden_effect = {
					# How many people you killed?
					murder_bloodline_check_effect = yes
					character_event = { id = WCCLS.1105 }
				}
			}
			death = { death_reason = death_missing }
			# Small Humanoid
			if = {
				limit = { is_small_humanoid_trigger = yes }
				FROM = {
					show_scope_change = no
					if = {
						limit = { has_quest = quest_disembowel_small_humanoid }
						clr_quest = quest_disembowel_small_humanoid
						add_society_currency_minor_and_chance_to_get_artifact_effect = yes
					}
					else_if = {
						limit = { society_member_of = cult_of_the_damned }
						add_society_currency_trivial_effect = yes
					}
				}
			}
			# Medium Humanoid
			else_if = {
				limit = { is_medium_humanoid_trigger = yes }
				FROM = {
					show_scope_change = no
					if = {
						limit = { has_quest = quest_disembowel_medium_humanoid }
						clr_quest = quest_disembowel_medium_humanoid
						add_society_currency_minor_and_chance_to_get_artifact_effect = yes
					}
					else_if = {
						limit = { society_member_of = cult_of_the_damned }
						add_society_currency_trivial_effect = yes
					}
				}
			}
			# Large Humanoid
			else_if = {
				limit = { is_large_humanoid_trigger = yes }
				FROM = {
					show_scope_change = no
					if = {
						limit = { has_quest = quest_disembowel_large_humanoid }
						clr_quest = quest_disembowel_large_humanoid
						add_society_currency_medium_and_chance_to_get_artifact_effect = yes
					}
					else_if = {
						limit = { society_member_of = cult_of_the_damned }
						add_society_currency_minor_effect = yes
					}
				}
			}
			else = {
				if = {
					limit = { society_member_of = cult_of_the_damned }
					add_society_currency_trivial_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 0.25
		}
	}
	prisoner_raise_from_dead = {
		filter = court
		ai_target_filter = court
		ai_check_interval = 12

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			OR = {
				is_incapable = no
				trait = lich_king	# Ner'zhul is incapable
			}

			OR = {
				trait = being_undead
				is_death_knight_class_trigger = yes
				is_necromancer_class_trigger = yes
				AND = {
					society_member_of = cult_of_the_damned
					society_rank > 1
				}
			}
		}

		# If you modify potential or allow, don't forget to change WCDAC.7050
		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			prisoner = yes

			NOT = { character = FROM }
			NOT = { has_character_flag = being_raised_flag }

			NOT = { trait = being_undead }
			can_be_undead_trigger = yes

			host = { character = FROM }
		}

		# If you modify potential or allow, don't forget to change WCDAC.7050
		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest

			FROM = {
				show_scope_change = no

				OR = {
					is_inaccessible_trigger = no
					trait = lich_king	# Ner'zhul is incapable
				}

				not_raising_undead_flag_trigger = yes

				OR = {
					trigger_if = {
						limit = {
							OR = {
								is_death_knight_class_trigger = yes
								is_necromancer_class_trigger = yes
							}
						}
						has_1_mana_trigger = yes
					}
					trigger_if = {
						limit = {
							society_member_of = cult_of_the_damned
							society_rank > 1
						}
						trigger_if = {
							limit = {
								has_quest_turn_into_undead_trigger = yes
								ROOT = { quest_turn_into_undead_prev_target_trigger = yes }
							}
							ROOT = {
								quest_turn_into_undead_prev_target_trigger = yes
							}
						}
						trigger_else = {
							has_society_currency_minor_trigger = yes
						}
					}
					AND = {
						wealth = 50
						prestige = 100
						piety = 50
					}
				}
			}
		}

		effect = {
			hidden_effect = {
				FROM = {
					save_event_target_as = target_necromancer

					set_character_flag = raising_undead_flag
				}
				save_event_target_as = target_undead

				set_character_flag = being_raised_flag
			}

			FROM = {
				show_scope_change = no
				hidden_effect = { character_event = { id = WCUND.300 } }

				increase_visibility_effect = yes
				minor_soul_corruption_effect = yes
				if = {
					limit = {
						has_quest_turn_into_undead_trigger = yes
						ROOT = { quest_turn_into_undead_prev_target_trigger = yes }
					}
					# Pay nothing
				}
				else_if = {
					limit = {
						OR = {
							is_death_knight_class_trigger = yes
							is_necromancer_class_trigger = yes
						}
						has_1_mana_trigger = yes
					}
					remove_1_mana_effect = yes
				}
				else_if = {
					limit = {
						society_member_of = cult_of_the_damned
						society_rank > 1
						has_society_currency_minor_trigger = yes
					}
					detract_society_currency_minor_effect = yes
				}
				else = {
					wealth = -50
					prestige = -100
					piety = -50
				}
			}
		}

		ai_will_do = {
			factor = 0.25
		}
	}
	# Turns character into abomination
	prisoner_create_monstrous_undead = {
		filter = court
		ai_target_filter = court
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			OR = {
				is_incapable = no
				trait = lich_king	# Ner'zhul is incapable
			}

			OR = {
				is_necromancer_class_trigger = yes
				AND = {
					society_member_of = cult_of_the_damned
					society_rank > 2
				}
			}
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			prisoner = yes

			NOT = { character = FROM }
			NOT = { has_character_flag = being_raised_flag }	# The same flag that uses prisoner_raise_from_dead decision

			can_be_undead_trigger = yes
			NOT = { trait = being_undead }
			NOR = {
				trait = creature_wraith
				trait = creature_banshee
				trait = creature_plague_eruptor
				trait = creature_abomination
				trait = creature_lich
			}
			host = { character = FROM }
		}

		allow = {
			# show_only_failed_conditions = yes # Better to see conditions because this decision is part of quest

			FROM = {
				show_scope_change = no
				OR = {
					is_inaccessible_trigger = no
					trait = lich_king	# Ner'zhul is incapable
				}

				not_raising_undead_flag_trigger = yes

				OR = {
					trigger_if = {
						limit = { is_necromancer_class_trigger = yes }
						has_5_6_magic_class_or_higher_trigger = yes
						has_3_mana_trigger = yes
					}
					trigger_if = {
						limit = {
							society_member_of = cult_of_the_damned
							society_rank > 2
						}
						trigger_if = {
							limit = {
								has_quest_turn_into_undead_trigger = yes
								ROOT = { quest_turn_into_undead_prev_target_trigger = yes }
							}
							ROOT = {
								quest_turn_into_undead_prev_target_trigger = yes
							}
						}
						trigger_else = {
							has_society_currency_medium_trigger = yes
						}
					}

					# Fallback
					always = no
				}
				check_variable = { which = useful_flesh value = 12 }
			}
		}

		effect = {
			hidden_effect = {
				set_character_flag = being_raised_flag
				FROM = { set_character_flag = raising_undead_flag }
			}

			save_event_target_as = target_prisoner
			FROM = { save_event_target_as = target_necromancer }

			hidden_effect = { long_character_event = { id = MNM.7506 } }
			FROM = {
				show_scope_change = no
				hidden_effect = { character_event = { id = WCUND.350 } }

				### Pays currency
				if = {
					limit = {
						has_quest_turn_into_undead_trigger = yes
						ROOT = { quest_turn_into_undead_prev_target_trigger = yes }
					}
					# Pay nothing
				}
				else_if = {
					limit = {
						is_necromancer_class_trigger = yes
						has_5_6_magic_class_or_higher_trigger = yes
						has_3_mana_trigger = yes
					}
					remove_3_mana_effect = yes
				}
				else_if = {
					limit = {
						society_member_of = cult_of_the_damned
						society_rank > 2
						has_society_currency_medium_trigger = yes
					}
					detract_society_currency_medium_effect = yes
				}
				change_variable = { which = useful_flesh value = -12 }
				### Gets currency
				# Completes quest - gets society currency
				complete_quest_turn_into_undead_prev_effect = yes
				# Gets visibility variables
				increase_visibility_effect = yes

				major_soul_corruption_effect = yes
			}
		}

		ai_will_do = {
			factor = 0.25
		}
	}

	### Shadow Priest ###
	# Adds stressed or depressed or lunatic trait to ROOT
	# If FROM fails gives lunatic trait to FROM or do nothing
	drive_crazy = {
		ai_target_filter = realm
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_shadow_priest_class_trigger = yes
		}

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no

			NOT = { character = FROM }
			from_in_range_to_hurt_this_trigger = yes
			NOT = { has_character_flag = drive_crazy_ongoing_flag }

			# AI preferences
			ai_from_prefer_to_hurt_this_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_3_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = drive_crazy_cooldown_flag }
						had_character_flag = { flag = drive_crazy_cooldown_flag years = 3 }
					}
				}
			}

			NOT = { trait = being_demon }
			NOT = { trait = being_void }
			is_humanoid_trigger = yes
			OR = {
				NOT = { trait = stressed }
				NOT = { trait = depressed }
				NOT = { trait = lunatic }
			}

			has_invader_title_trigger = no

			FROM = {
				show_scope_change = no

				is_inaccessible_trigger = no

				has_1_mana_trigger = yes
			}
		}

		effect = {
			save_event_target_as = target_crazy

			set_character_flag = drive_crazy_ongoing_flag
			set_character_flag = drive_crazy_cooldown_flag

			hidden_effect = {
				random_list = {
					50 = {	# Success
						random_list = {
							20 = {
								set_character_flag = drive_crazy_lunatic_flag
								modifier = {
									factor = 2.66
									has_9_10_magic_class_trigger = yes
								}
								modifier = {
									factor = 2.66
									has_7_8_magic_class_or_higher_trigger = yes
								}
								modifier = {
									factor = 2.66
									has_5_6_magic_class_or_higher_trigger = yes
								}
								modifier = {
									factor = 2.66
									has_3_4_magic_class_or_higher_trigger = yes
								}
								modifier = {
									factor = 0
									trait = lunatic
								}
							}
							30 = {
								set_character_flag = drive_crazy_depressed_flag
								modifier = {
									factor = 0
									trait = depressed
								}
							}
							50 = {
								set_character_flag = drive_crazy_stressed_flag
								modifier = {
									factor = 0
									trait = stressed
								}
							}
						}
						modifier = {
							factor = 2.24
							has_9_10_magic_class_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_7_8_magic_class_or_higher_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_5_6_magic_class_or_higher_trigger = yes
						}
						modifier = {
							factor = 2.24
							has_3_4_magic_class_or_higher_trigger = yes
						}
					}
					50 = {	# Fail
						random_list = {
							80 = { set_character_flag = drive_crazy_fail_flag }
							20 = {
								set_character_flag = drive_crazy_epic_fail_flag
								modifier = {
									factor = 0
									FROM = { trait = lunatic }
								}
							}
						}
					}
				}
			}
			FROM = {
				remove_1_mana_effect = yes

				add_5_void_corruption_effect = yes

				hidden_effect = {
					character_event = { id = WCCLS.1205 days = 3 }
				}
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			from_likes_to_hurt_score = yes
		}
	}
	# Summons creature_nraqi or creature_cthraxxi or adds pet_merciless_one
	summon_void_creature = {
		filter = self
		ai_target_filter = self
		ai_check_interval = 48

		only_playable = yes

		potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			NOT = { has_character_flag = summon_void_creature_ongoing_flag }

			is_shadow_priest_class_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			is_inaccessible_trigger = no

			custom_tooltip = {
				text = has_not_used_decision_5_years_tooltip
				hidden_tooltip = {
					OR = {
						NOT = { has_character_flag = summon_void_creature_cooldown_flag }
						had_character_flag = { flag = summon_void_creature_cooldown_flag years = 5 }
					}
				}
			}

			has_5_6_magic_class_or_higher_trigger = yes
			has_3_mana_trigger = yes
		}

		effect = {
			set_character_flag = summon_void_creature_ongoing_flag
			set_character_flag = summon_void_creature_cooldown_flag

			remove_3_mana_effect = yes

			add_15_void_corruption_effect = yes

			hidden_effect = {
				character_event = { id = WCCLS.1213 }
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.25
		}
	}
	
	### Monk ###
	soothing_mist = {
		filter = realm_including_me
		ai_target_filter = court_including_me
		ai_check_interval = 12
		
		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_adult = yes
			is_incapable = no
			prisoner = no

			is_monk_class_trigger = yes
		}

		potential = {
			is_untouchable_trigger = no

			OR = {
				trait = stressed
				trait = depressed
			}
			
			from_prefer_to_heal_and_buff_this_trigger = yes
		}

		allow = {
			show_only_failed_conditions = yes

			prisoner = no
			is_inaccessible_trigger = no

			FROM = {
				is_inaccessible_trigger = no

				has_5_6_magic_class_or_higher_trigger = yes
				has_2_mana_trigger = yes
			}
		}

		effect = {
			if = {
				limit = { character = FROM }
				remove_stressed_and_depressed_effect = yes
			}
			else = {
				tooltip = { remove_stressed_and_depressed_effect = yes }
				
				letter_event = { id = WCCLS.1605 }
			}
			FROM = {
				if = {
					limit = { character = ROOT }
					remove_2_mana_effect = yes
				}
				else = {
					tooltip = { remove_2_mana_effect = yes }
				}
			}
		}

		revoke_allowed = { always = no }

		ai_will_do = {
			factor = 0.1
			from_prefer_to_heal_and_buff_this_score = yes
		}
	}
}
settlement_decisions = {
	### Shaman ###
	earths_blessing = {
		filter = realm_owned
		ai_target_filter = owned
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_playable = yes
			is_adult = yes
			is_incapable = no
			prisoner = no

			OR = {
				is_shaman_class_trigger = yes
				is_druid_class_trigger = yes
			}
		}

		potential = {
			location = { NOT = { has_province_modifier = druid_blessing } }

			is_capital = yes
			has_siege = no
			is_occupied = no
		}

		allow = {
			show_only_failed_conditions = yes

			FROM = {
				show_scope_change = no
				is_inaccessible_trigger = no

				has_3_4_magic_class_or_higher_trigger = yes
				has_2_mana_trigger = yes
			}
		}

		effect = {
			location = {
				show_scope_change = no

				save_event_target_as = target_province
				add_province_modifier = { name = druid_blessing duration = 1825 }
			}

			holder_scope = {
				show_scope_change = no

				if = {
					limit = { NOT = { character = FROM } }
					opinion = { modifier = opinion_grateful who = FROM years = 5 }
				}
				character_event = { id = WCCLS.810 }
			}

			FROM = {
				show_scope_change = no

				remove_2_mana_effect = yes
			}
		}

		revoke_allowed = {
			always = no
		}

		ai_will_do = {
			factor = 0.25
		}
	}

	### Druid ###
	# Adds "World Tree" building and 2 holding slots
	plant_world_tree = {
		is_high_prio = yes

		ai_check_interval = 36

		filter = sub_realm_owned
		ai_target_filter = vassal_owned

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

			is_playable = yes
			is_adult = yes
			is_incapable = no
			prisoner = no

			is_druid_class_trigger = yes
		}

		potential = {
			location = { NOT = { has_province_modifier = world_tree_province_modifier } }

			holding_type = temple
			has_siege = no
			is_occupied = no
			NOT = { has_holding_modifier = looted_modifier }
		}

		allow = {
			custom_tooltip = {
				text = only_one_world_tree_per_realm_tooltip
				hidden_tooltip = {
					FROM = { NOT = { any_realm_province = { has_province_modifier = world_tree_province_modifier } } }
				}
			}

			holder_scope = {
				religion = FROM
				liege = { religion_group = druidism_group }
			}
			location = {
				religion = FROM

				NOR = {
					terrain = arctic
					terrain = desert
					terrain = burnt_earth
					terrain = scorched_earth
					terrain = underground
				}
			}

			FROM = {
				higher_tier_than = COUNT

				religion_group = druidism_group
				true_religion_group = druidism_group

				has_9_10_magic_class_trigger = yes

				wealth = 250
				piety = 5000
				has_5_mana_trigger = yes
			}
		}

		effect = {
			save_event_target_as = target_title
			FROM = {
				save_event_target_as = target_druid

				wealth = -250
				piety = -5000
				remove_5_mana_effect = yes

				character_event = { id = WCCLS.815 }
			}

			custom_tooltip = {
				text = plant_world_tree_tooltip
				hidden_tooltip = {
					location = {
						save_event_target_as = target_province

						add_province_modifier = { name = world_tree_province_modifier duration = -1 }

						province_event = { id = WCCLS.819 years = 3 }	# If you changed years, rewrite plant_world_tree_tooltip localization
					}
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}
	# corrupt_world_tree and burn_world_tree are in wc_realm_decisions.txt
}
