﻿#founding an undead city. TODO: ways to discount TODO: icon

found_undead_city = {

	duration = 0
	enable = yes
	toggle = no

	army_only = yes

	hidden = {
		unit_owner = {
			NOT = { religion = undead_pantheon }
		}
	}
	
	allow = {
		unit_owner = {
			OR = {
				has_country_modifier = necromancy_v
				has_country_modifier = necromancy_vi
				has_country_modifier = necromancy_vii
				has_country_modifier = necromancy_viii
				has_country_modifier = necromancy_ix
				has_country_modifier = necromancy_x
			}
		}
		is_army = yes
		in_combat = no
		is_moving = no
		in_siege = no
		is_exiled = no
		unit_location = {
			has_owner = yes
			owner = root.unit_owner
			state_loyalty >= 60
			root = {
				unit_owner = {
					treasury > 300
				}
			}
			has_city_status = yes
			NOT = { has_province_modifier = undead_city }
		}
		trigger_if = {
			limit = {
				exists = commander
			}
			commander = {
				loyalty > 33
			}
		}
	}
	
	
	start_effect = {
		unit_location = {
			add_permanent_province_modifier = {
				name = undead_city
				duration = -1
			}
			add_state_loyalty = -50
		}
		unit_owner = {
			add_treasury = -300
		}
	}
	
	ai_will_do = {
		base = 0
	}
	
	idle_entity_state = raiding
}