﻿country_decisions = {
	
	# Form Imperium Mortis
	form_imperium_mortis = {
		
		potential = {
			num_of_cities >= 1
			religion = undead_pantheon
			NOT = { has_variable = formed_imperium_mortis }
		}
		
		allow = {
			custom_tooltip = {
				text = imperium_mortis_not_existing
				NOT = {
					any_country = {
						tag = IMM
					}
				}
			}
			can_form_nation_trigger = yes
			has_country_modifier = necromancy_x
			capital_scope = {
				trade_goods = necromantic_energy
			}
		}
		
		
		effect = {
			custom_tooltip = "tier_3_formable_tooltip"
			if = {
				limit = {
					NOT = { government = imperial_cult }
				}
				republic_to_monarchy_law_variable_effect = yes # decide which legion law should be transferred
				change_government = imperial_cult
				republic_to_monarchy_law_change_effect = yes # change legion law based on variable if present
				switch_government_type_event_clearup_effect = yes
			}
			add_country_modifier = {
				name = imperium_mortis_modifier
				duration = -1
			}
			change_country_name = "Imperium_Mortis_Name"
			hidden_effect = {
				change_country_adjective = "Imperium_Mortis_Adjective"
				change_country_color = "pitch_black"
				change_country_tag = IMM
				change_country_flag = IMM
			}
			capital_scope = {
				add_province_modifier = {
					name = imperium_mortis_capital
					duration = -1
				}
			}
			add_5_free_province_investments = yes
			set_variable = formed_imperium_mortis #TODO new heritage
		}
		
		ai_will_do = {
			base = 1
		}
	}
}