﻿
###No war alliances against direct vassals, but sub-vassals allowed

yj_liege_vassal_check_trigger = {
	custom_description = {
		text = "basic_ally_can_join_because_liege_or_vassals"
		subject = scope:recipient
		
		# actor is defender, attackers do not include recipient's liege or vassals
		trigger_if = {
			limit = { scope:actor = { is_defender_in_war = scope:target } }
			scope:recipient = {
				NOR = {
					any_liege_or_above = {
						is_attacker_in_war = scope:target
					}
					any_vassal = {
						is_attacker_in_war = scope:target
					}
					AND = {
						any_vassal_or_below = { is_attacker_in_war = scope:target }
						NOT = { scope:actor = { target_is_liege_or_above = scope:recipient } }
					}	
				}
			}
		}
		   
		# actor is attacker, defenders do not include recipient's liege or vassals
		trigger_else_if = {
			limit = { scope:actor = { is_attacker_in_war = scope:target } }
			scope:recipient = {
				NOR = {
					any_liege_or_above = {
						is_defender_in_war = scope:target
					}
					any_vassal_or_below = {
						is_defender_in_war = scope:target
					}
				}
			}
		}
		
		# it's fine, whatever
		trigger_else = {
			always = yes
		}
	}
}