﻿is_hostile_to_me = {
    save_temporary_scope_as = owner
    NOR = {
        this = root
        is_allied_in_war = root
    }
    OR = {
        is_at_war_with = root
        any_liege_or_above = {
            is_at_war_with = root
        }
        is_causing_raid_hostility_towards = root
        root = {
            is_causing_raid_hostility_towards = prev
        }

        # enemy of my enemy
        any_primary_war_enemy = {
            any_war_enemy = {
                this = root
            }
        }
    }
}

is_friendly_to_me = {
    save_temporary_scope_as = owner
    OR = {
        this = root
        is_allied_in_war = root
        any_liege_or_above = {
            is_allied_in_war = root
        }
    }
}