﻿action_being_raided = {
	type = alert
	check_create_action = {
		every_hostile_raider = {
			limit = {
				NOT = {
					root = { has_raid_immunity_against = prev }
				}
				any_army = {
					is_raid_army = yes
					location.province_owner ?= { 
						OR = {
							this = root
							any_liege_or_above = { this = root }
						}
					}				
				}
			}
			try_create_important_action = {
				important_action_type = action_being_raided
				actor = root
				recipient = this
			}
		}
	}

	effect = {
		scope:recipient = {
			random_army = {
				limit = {
					is_army_in_raid = yes
					is_raid_army = yes
					location.province_owner ?= { 
						OR = {
							this = root
							any_liege_or_above = { this = root }
						}
					}	
				}
				alternative_limit = {
					is_raid_army = yes
					location.province_owner ?= { 
						OR = {
							this = root
							any_liege_or_above = { this = root }
						}
					}	
				}
				if = {
					limit = { is_army_in_raid = yes }
					open_view_data = {
						view = raid
					}
				}
				pan_camera_to_province = location
			}
		}
	}

	soundeffect = "event:/SFX/UI/War/sfx_ui_war_declare_war"
}
