﻿# Is the alliance reason still valid
# Root = First character of alliance reason
# scope:second = Second character of alliance reason
is_alliance_valid = {
	OR = {
		any_spouse = {
			this = scope:second
		}
		betrothed = scope:second
		is_parent_of = scope:second
		is_child_of = scope:second
		is_sibling_of = scope:second
		is_grandparent_of = scope:second
		is_great_grandparent_of = scope:second
		is_grandchild_of = scope:second
		is_great_grandchild_of = scope:second
		is_uncle_or_aunt_of = scope:second
		is_nibling_of = scope:second
		scope:second = {
			OR = {
				has_opinion_modifier = {
					modifier = perk_negotiated_alliance_opinion
					target = root
				}
				has_opinion_modifier = {
					modifier = event_negotiated_alliance_opinion
					target = root
				}
			}
		}
		#childhood friendship with hostage event, where they swear to be friends forever
		AND = {
			OR = {
				has_relation_friend = scope:second
				has_relation_best_friend = scope:second
			}
			OR = {
				any_memory = {
					has_memory_type = hostage_oath_of_friendship
					has_memory_participant = scope:second
				}
				scope:second = {
					any_memory = {
						has_memory_type = hostage_oath_of_friendship
						has_memory_participant = root
					}
				}
			}
		}
		# FP3 struggle case
		#AGOT Disabled - enabled for GPT-AGOT
		has_character_flag = fp3_is_a_loyalist_puppet
		scope:second = { has_character_flag = fp3_is_a_loyalist_puppet }
	}
}