decisions = {
	erect_the_wall = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		potential = {
			independent = yes

			275 = {
				NOR = {
					has_province_modifier = the_greymane_wall
					has_province_modifier = the_gilnean_wall
				}
			}
			
			# AI doesn't use it if it's open to world
			trigger_if = {
				limit = { ai = yes }
				NOT = {
					diplomacy = 10
					
					trait = charitable
					trait = kind
					trait = ambitious
					trait = gregarious
				}
			}
			completely_controls = c_hothills
			has_landed_title = k_gilneas
		}

		allow = {
			war = no

			wealth = 500
			
			is_in_political_faction_trigger = no
			275 = {
				TECH_FORTIFICATIONS_CONSTRUCTION = 3
				TECH_CONSTRUCTION = 3
			}
		}

		effect = {
			if = {
				limit = { dynasty = 24000 }
				275 = {
					show_scope_change = no
					
					add_province_modifier = { name = the_greymane_wall duration = -1 }
				}
			}
			else = {
				275 = {
					show_scope_change = no
					
					add_province_modifier = { name = the_gilnean_wall duration = -1 }
				}
			}
			
			wealth = -500
			prestige = 500
			
			custom_tooltip = {
				text = all_rulers_behind_wall_worsens_attitude_tooltip
				hidden_effect = {
					any_realm_lord = {
						limit = {
							is_landed = yes
							higher_tier_than = BARON
							
							capital_scope = { region = world_eastern_kingdoms }
							any_realm_province = { NOT = { region = world_eastern_kingdoms_lordaeron_gilnean_peninsula } }
						}
						opinion = { modifier = opinion_extremely_disappointed who = ROOT years = 25 }
					}
					any_independent_ruler = {
						limit = {
							is_landed = yes
							higher_tier_than = BARON
							
							capital_scope = {
								region = world_eastern_kingdoms
								NOT = { region = world_eastern_kingdoms_lordaeron_gilnean_peninsula }
							}
						}
						opinion = { modifier = opinion_extremely_disappointed who = ROOT years = 10 }
					}
				}
			}
			hidden_tooltip = { narrative_event = { id = WCRLM.100 } }
		}

		ai_will_do = {
			factor = 1
		}
	}
	corrupt_the_sunwell = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		potential = {
			independent = yes

			NOT = { has_global_flag = sunwell_is_being_restored_flag }

			evil_public_religion_trigger = yes

			394 = {
				wonder = {
					has_wonder = wonder_sunwell

					NOR = {
						has_wonder_flag = wonder_lightwell_flag
						has_wonder_flag = wonder_deathwell_flag
						has_wonder_flag = wonder_felwell_flag
						has_wonder_flag = wonder_voidwell_flag
					}

					wonder_owner = { character = ROOT }
				}
			}
		}

		allow = {
		}

		effect = {
			narrative_event = { id = WCTHW.1000 }
		}

		ai_will_do = {
			factor = 1
		}
	}
	restore_the_sunwell = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		potential = {
			independent = yes

			NOT = { has_global_flag = sunwell_is_being_restored_flag }
			
			394 = {
				wonder = {
					wonder_owner = { character = ROOT }
				}
			}

			trigger_if = {
				limit = {
					394 = {
						wonder = {
							has_wonder = wonder_sunwell
							has_wonder_flag = wonder_deathwell_flag
						}
					}
				}
				NOT = { religion_group = necromancy_group }
			}
			trigger_else_if = {
				limit = {
					394 = {
						wonder = {
							has_wonder = wonder_sunwell
							has_wonder_flag = wonder_felwell_flag
						}
					}
				}
				NOT = { religion_group = fel_group }
			}
			trigger_else_if = {
				limit = {
					394 = {
						wonder = {
							has_wonder = wonder_sunwell
							has_wonder_flag = wonder_voidwell_flag
						}
					}
				}
				NOT = { religion_group = void_group }
			}
			trigger_else = {
				always = no
			}
		}

		allow = {
			war = no

			# evil_public_religion_trigger = no
			OR = {
				religion_group = arcane_group
				religion_group = fel_group
				religion_group = light_group
				religion_group = void_group
			}

			scaled_wealth = { value = 1 min = 500 }

			# custom_tooltip = {
				# text = sunwell_isnt_damaged_tooltip
				# 394 = {
					# wonder = {
						# has_wonder = wonder_sunwell
						# is_damaged = no
					# }
				# }
			# }
		}

		effect = {
			set_global_flag = sunwell_is_being_restored_flag
			
			clr_global_flag = sunwell_naaru_spark_flag
			clr_global_flag = voidwell_restoring_flag
			clr_global_flag = felwell_restoring_flag

			394 = {
				wonder = {
					save_event_target_as = target_sunwell
				}
			}

			scaled_wealth = { value = -1 min = -500 }
			scaled_prestige = { value = -1 min = -500 }

			narrative_event = { id = WCTHW.1100 }
		}

		ai_will_do = {
			factor = 1
		}
	}
	# Ability to get rid of all evil characters without penalties
	burn_evil_beings = {
		ai_check_interval = 36

		only_playable = yes

		potential = {
			ROOT = {
				any_courtier_or_vassal = {
					is_burnable_potential_trigger = yes
					is_burnable_allow_trigger = yes
				}
			}
		}

		allow = {
		}

		effect = {
			ROOT = {
				show_scope_change = no

				any_courtier_or_vassal = {
					limit = {
						is_burnable_potential_trigger = yes
						is_burnable_allow_trigger = yes
					}
					show_scope_change = no
					
					prev_burn_evil_being_this_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	# Ability to convert evil characters
	convert_evil_beings = {
		ai_check_interval = 36

		only_playable = yes

		potential = {
			ROOT = {

				trait = creature_lothraxim
				any_courtier_or_vassal = {
					is_burnable_potential_trigger = yes
					is_burnable_allow_trigger = yes
					NOT = {
						trait = zealous
					}
				}
			}
		}

		allow = {
		}

		effect = {
			ROOT = {
				show_scope_change = no

				any_courtier_or_vassal = {
					limit = {
						is_burnable_potential_trigger = yes
						is_burnable_allow_trigger = yes
					}
					show_scope_change = no
					
					religion = FROM
					abdicate_holy_order_if_religion_changes_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	convert_to_tribal_monarchy = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes

		potential = {
			is_playable = yes

			government = tribal_government

			can_be_feudal_trigger = no
		}

		allow = {
			war = no

			trigger_if = {
				limit = { independent = yes }
				primary_title = {
					OR = {
						has_law = tribal_organization_4
						has_law = tribal_organization_3
						has_law = tribal_organization_2
					}
				}
			}
			trigger_else = {
				liege = {
					OR = {
						is_tribal = no
						government = tribal_monarchy_government
					}
					is_nomadic = no
				}
			}
			
			reformed_castle_capital_trigger = yes
		}

		effect = {
			set_government_type = tribal_monarchy_government

			hidden_tooltip = {
				any_demesne_title = {
					limit = {
						tier = baron
						holding_type = tribal
					}

					# Warcraft
					convert_tribal_to_castle_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	claim_capital_city = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		potential = {
			is_playable = yes
			independent = yes

			NOT = { has_character_flag = claim_capital_city_attempt_flag }

			primary_title = {
				faction_title_trigger = no
				OR = {
					# If primary_title is one of these titles, can claim its capital
					title = e_gorian_empire
					# If capital is one of these counties, can claim it
					capital_scope = {
						county = {
							OR = {
								title = c_stromgarde
								title = c_stratholme
								title = c_stormwind
								title = c_silvermoon
								title = c_lordaeron
								title = c_ironforge
								title = c_gnomeregan
								title = c_gilneas
								title = c_dalaran
								title = c_alterac
							}
						}
					}
				}
				capital_scope = {
					county = {
						holder_scope = {
							ai = yes
							
							war = no
							
							NOT = { character = ROOT }
							is_vassal_or_below_of = ROOT
						}
					}
				}
			}
		}

		allow = {
		}

		effect = {
			set_character_flag = claim_capital_city_attempt_flag

			primary_title = {
				show_scope_change = no
				capital_scope = {
					show_scope_change = no
					county = {
						show_scope_change = no
						usurp_title_plus_barony_if_unlanded_and_vassals = ROOT
					}
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}

	horde_invite_bloodthirsty_clans = {
		is_high_prio = yes

		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		potential = {
			has_global_flag = orcish_invasion_flag
			NOT = { has_global_flag = horde_invited_bloodthirsty_clans_flag }

			has_landed_title = e_horde
			73 = { has_province_modifier = dark_portal_is_open_2 }
		}

		allow = {
			num_of_count_titles = 3
			73 = {
				holder_scope = {
					OR = {
						character = PREVPREV
						is_liege_or_above = PREVPREV
					}
				}
			}
			prestige = 1000
		}

		effect = {
			prestige = -1000

			narrative_event = { id = WCFTW.4 }
		}

		ai_will_do = {
			factor = 1
		}
	}
	
	awaken_ymiron = {
		is_high_prio = yes
		
		ai_check_interval = 12
		
		only_playable = yes
		
		potential = {
			is_untouchable_trigger = no
			
			is_adult = yes
			is_incapable = no
			
			NOT = { has_global_flag = ymiron_happend_flag }

			culture_group = vrykul_group
			
			has_character_flag = is_angerboda_flag
		}
		
		allow = {
			prisoner = no
			is_inaccessible_trigger = no
			
			completely_controls = c_gjalerbron
		}
		
		effect = {
			set_global_flag = ymiron_happend_flag
			
			character_event = { id = WCRLM.799 }
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	# Regent Lord of Quel'thalas removes Regent Lord title (makes Quel'thalas elective)
	remove_regent_lord_title = {
		is_high_prio = yes
		
		ai_check_interval = 120
		
		only_playable = yes
		
		potential = {
			is_untouchable_trigger = no
			
			is_adult = yes
			is_incapable = no
			
			has_character_flag = is_regent_lord_flag
		}
		
		allow = {
			prisoner = no
			is_inaccessible_trigger = no
			
			ruled_years = 20
		}
		
		effect = {
			clr_character_flag = is_regent_lord_flag
			
			# Makes de-jure Quel'thalas titles elective
			if = {
				limit = {
					is_feudal = yes
					evil_public_religion_trigger = no
					
					any_demesne_title = {
						de_jure_sunstrider_title_trigger = yes
						prevs_title_can_has_laws_trigger = yes
						is_law_potential = succ_feudal_elective
						is_law_allowed = succ_feudal_elective
						NOT = { has_law = succ_feudal_elective }
					}
				}
				any_demesne_title = {
					limit = {
						de_jure_sunstrider_title_trigger = yes
						prevs_title_can_has_laws_trigger = yes
						is_law_potential = succ_feudal_elective
						is_law_allowed = succ_feudal_elective
						NOT = { has_law = succ_feudal_elective }
					}
					add_law = succ_feudal_elective
				}
				
				# Small notification to players
				any_player = {
					limit = {
						same_realm = ROOT
					}
					character_event = { id = WCTFT.600 }
				}
			}
			remove_special_character_title = REGENT_LORD_TITLE
		}
	}
	
	#hive_government
	#Gives 10 year bonus to morale, vassal opinion, but minus to taxes and building cost
	song_of_swarm = {
		is_high_prio = yes
		
		ai_check_interval = 24
		
		only_playable = yes
		
		potential = {
			is_untouchable_trigger = no
			
			is_adult = yes
			is_incapable = no
			
			government = hive_government
		}
		
		allow = {
			prisoner = no
			is_inaccessible_trigger = no
			
			NOT = { has_character_modifier = song_of_swarm_cooldown }
			NOT = { has_character_modifier = song_of_swarm_modifier }
			
			# AI preferences
			trigger_if = {
				limit = { ai = yes }
				war = yes	# AI uses it at war
			}
		}
		
		effect = {
			add_character_modifier = { name = song_of_swarm_cooldown years = 50 }
			
			add_character_modifier = { name = song_of_swarm_modifier years = 10 }
		}
		
		ai_will_do = {
			factor = 1
		}
	}
}
targeted_decisions = {
	# Ability to get rid of evil character without penalties
	burn_evil_being = {
		filter = sub_realm
		ai_target_filter = court
		ai_check_interval = 24

		ai = no
		only_playable = yes

		from_potential = {
		}

		potential = {
			FROM = {
				ROOT = {
					is_burnable_potential_trigger = yes
				}
			}
		}

		allow = {
			show_only_failed_conditions = yes

			FROM = {
				show_scope_change = no

				ROOT = {
					show_scope_change = no
					
					is_burnable_allow_trigger = yes
				}
			}
		}

		effect = {
			FROM = {
				show_scope_change = no
				
				ROOT = {
					show_scope_change = no
					
					prev_burn_evil_being_this_effect = yes
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
}
title_decisions = {
	genocide_decision = {
		is_high_prio = yes

		filter = owned
		ai_target_filter = owned
		ai_check_interval = 24

		only_playable = yes

		from_potential = {
		}

		potential = {
			tier = COUNT
			
			owner = { character = FROM }
		}

		allow = {
			FROM = { completely_controls = ROOT }
			location = {
				NOT = { has_province_modifier = genocide_province_cooldown }
				
				trigger_if = {
					limit = { from_potential_cull_this_province_trigger = yes }
					from_allow_cull_this_province_trigger = yes
				}
				trigger_else_if = {
					limit = { from_potential_raise_this_province_trigger = yes }
					from_allow_raise_this_province_trigger = yes
				}
				trigger_else = {
					from_allow_genocide_this_province_trigger = yes
				}
				
				trigger_if = {
					limit = { has_province_modifier = nomad_agitation }
					custom_tooltip = {
						text = has_castle_or_city_tooltip
						any_province_holding = {
							OR = {
								holding_type = castle
								holding_type = city
							}
						}
					}
				}
				is_occupied = no
			}
		}

		effect = {
			hidden_effect = {
				location = {
					add_province_modifier = {
						name = genocide_province_cooldown
						years = 3
						hidden = yes
					}
				}
				
				FROM = {
					if = {
						limit = { independent = no }
						top_liege = {
							add_character_modifier = {
								name = genocide_realm_cooldown
								months = 3 # 4 genocides per year
								hidden = yes
							}
						}
					}
					add_character_modifier = {
						name = genocide_realm_cooldown
						months = 3 # 4 genocides per year
						hidden = yes
					}
				}
			}
			
			# Handled by pillage_settlement decision
			hidden_tooltip = {
				location = { save_event_target_as = nickname_target }
				FROM = { save_event_target_as = nickname_receiver }
				if = {
					limit = {
						owner = {
							has_nickname = no
							is_adult = yes
							is_incapable = no
						}
						location = { is_aggressive_trigger = no }
					}
					random_list = {
						5 = {
							owner = { give_nickname = nick_the_destroyer }
						}
						5 = {
							owner = { give_nickname = nick_the_slayer_of_culture }
							modifier = {
								factor = 0
								event_target:nickname_target = { culture = FROM }
							}
						}
						5 = {
							owner = { give_nickname = nick_the_terror_of_provincename }
						}
						5 = {
							owner = { give_nickname = nick_the_culture_marauder }
							modifier = {
								factor = 0
								event_target:nickname_target = { culture = FROM }
							}
						}
						75 = {}
					}
				}
			}

			location = {
				if = {
					limit = { from_potential_cull_this_province_trigger = yes }
					add_province_modifier = { name = ongoing_culling years = 2 }
				}
				else_if = {
					limit = { from_potential_raise_this_province_trigger = yes }
					add_province_modifier = { name = ongoing_raising years = 2 }
				}
				else = {
					add_province_modifier = { name = ongoing_genocide years = 2 }
				}
				
				custom_tooltip = {
					text = "PILLAGE_DESTROY_BUILDINGS"
					hidden_tooltip = {
						any_province_holding = {
							limit = {
								settlement_can_be_destroyed_trigger = yes
							}
							destroy_random_building = THIS
							destroy_random_building = THIS
						}
					}
				}
			}
			location = { province_event = { id = WCRLM.200 years = 1 } }
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				FROM = {
					OR = {
						war = yes
						has_character_modifier = genocide_realm_cooldown
					}
				}
			}
			modifier = {
				factor = 0
				FROM = {
					top_liege = {
						OR = {
							war = yes
							has_character_modifier = genocide_realm_cooldown
						}
					}
				}
			}
		}
	}

	# Copy of monastic_order_convert_county
	# Converts elf province if you holds the right sunwell
	sunwell_ruler_convert_county = {
		is_high_prio = yes

		filter = owned
		ai_target_filter = owned
		ai_check_interval = 12

		only_playable = yes
		only_independent = yes

		from_potential = {
			is_untouchable_trigger = no

			independent = yes

			any_realm_wonder = {
				has_wonder = wonder_sunwell
				is_active = yes
			}
		}

		potential = {
			tier = COUNT

			location = {
				from_can_switch_religion_province_trigger = yes
				
				NOT = { religion = FROM }
				culture_group = elf_group
			}
			holder_scope = {
				OR = {
					is_liege_or_above = FROM
					character = FROM
				}
			}
		}

		allow = {
			FROM = { piety = 250 }
			location = {
				owner = { NOT = { religion = PREV } } # Cannot convert counties of owners who has that religion
			}
		}

		effect = {
			location = {
				religion = FROM
				add_province_modifier = {
					name = religious_tension
					years = 2
				}
			}
			FROM = {
				piety = -250
				hidden_tooltip = { character_event = { id = MNM.4990 } }
			}
			hidden_tooltip = {
				if = { # Notify county owner
					limit = {
						holder_scope = { NOT = { character = FROM } }
					}
					holder_scope = { character_event = { id = MNM.4991 } }
				}
			}
		}

		ai_will_do = {
			factor = 1
		}
	}
}
settlement_decisions = {
	corrupt_world_tree = {
		is_high_prio = yes

		ai_check_interval = 60

		filter = sub_realm_owned
		ai_target_filter = sub_realm_owned

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

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

			religion = old_gods_worship
		}

		potential = {
			location = { NOT = { has_province_flag = corrupt_world_tree_ongoing_flag } }

			has_title_flag = world_tree_title_flag
			holding_type = temple
			has_siege = no
			is_occupied = no
		}

		allow = {
			holder_scope = {
				religion = FROM
				liege = {
					religion = old_gods_worship
				}
			}
			location = { religion = FROM }

			FROM = {
				true_religion = old_gods_worship

				wealth = 250
				piety = 5000
			}
		}

		effect = {
			save_event_target_as = target_title

			FROM = {
				save_event_target_as = target_corruptor

				wealth = -250
				piety = -5000
			}

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

						set_province_flag = corrupt_world_tree_ongoing_flag		# Stops from firing decision twice
					}
					FROM = { narrative_event = { id = WCVOD.410 } }
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}
	# WCRLM.595 is another way to fire WCRLM.600 event, check its condtions as well
	burn_world_tree = {
		is_high_prio = yes

		ai_check_interval = 60

		filter = sub_realm_owned
		ai_target_filter = sub_realm_owned

		only_playable = yes

		from_potential = {
			is_untouchable_trigger = no

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

			NOT = { religion = old_gods_worship }
		}

		potential = {
			location = { NOT = { has_province_flag = burn_world_tree_ongoing_flag } }
			
			trigger_if = {
				limit = { NOT = { has_title_flag = nightmare_tree_title_flag } }
				FROM = { NOT = { religion_group = druidism_group } }
			}

			OR = {
				has_title_flag = world_tree_title_flag
				has_title_flag = nightmare_tree_title_flag
			}
			holding_type = temple
			has_siege = no
			is_occupied = no
			
			# AI Preferences
			FROM = {
				OR = {
					ai = no
					evil_true_religion_trigger = yes
					trait = cruel
					trait = lunatic
					ROOT = { has_title_flag = nightmare_tree_title_flag }
				}
			}
		}

		allow = {
			holder_scope = {
				trigger_if = {
					limit = { ROOT = { NOT = { has_title_flag = nightmare_tree_title_flag } } }
					NOT = { religion_group = druidism_group }
				}
				NOT = { religion = old_gods_worship }
			}

			FROM = {
				trigger_if = {
					limit = { ROOT = { NOT = { has_title_flag = nightmare_tree_title_flag } } }
					NOT = { true_religion_group = druidism_group }
				}
				NOT = { true_religion = old_gods_worship }
			}
		}

		effect = {
			# immediate of WCRLM.600
			save_event_target_as = target_title
			location = {
				save_event_target_as = target_province

				set_province_flag = burn_world_tree_ongoing_flag		# Stops from firing decision twice
			}
			FROM = { save_event_target_as = target_arsonist }

			FROM = {
				show_scope_change = no

				# option of WCRLM.600
				prestige = 2500

				custom_tooltip = {
					text = burn_world_tree_tooltip	# Needs FROM as a scope
					hidden_tooltip = { narrative_event = { id = WCRLM.600 } }
				}
			}
		}
		revoke_allowed = {
			always = no
		}
		ai_will_do = {
			factor = 1
		}
	}
}