# realm_of_savannah
is_realm_of_savannah_member = {
	custom_trigger_tooltip = {
		tooltip = is_realm_of_savannah_member_tt
		is_in_array = {
			array = GLOBAL.realm_of_savannah_members
			value = THIS
		}
	}
}

is_not_realm_of_savannah_member = {
	custom_trigger_tooltip = {
		tooltip = is_not_realm_of_savannah_member_tt
		NOT = { is_realm_of_savannah_member = yes }
	}
}

is_realm_of_savannah_leader = {
	custom_trigger_tooltip = {
		tooltip = is_realm_of_savannah_leader_tt
		is_realm_of_savannah_member = yes
		is_faction_leader = yes
	}
}

is_not_realm_of_savannah_leader = {
	custom_trigger_tooltip = {
		tooltip = is_not_realm_of_savannah_leader_tt
		NOT = { is_realm_of_savannah_leader = yes }
	}
}

realm_of_savannah_exists = {
	custom_trigger_tooltip = {
		tooltip = realm_of_savannah_exists_tt
		has_variable = GLOBAL.realm_of_savannah_leader
	}
}

does_realm_of_savannah_exist = {
	realm_of_savannah_exists = yes
}

realm_of_savannah_does_not_exist = {
	custom_trigger_tooltip = {
		tooltip = realm_of_savannah_does_not_exist_tt
		NOT = { realm_of_savannah_exists = yes }
	}
}

does_realm_of_savannah_not_exist = {
	realm_of_savannah_does_not_exist = yes
}

has_border_war_with_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = has_border_war_with_realm_of_savannah_tt
		any_country = {
			is_realm_of_savannah_member = yes
			has_border_war_with = PREV
		}
	}
}

has_war_with_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = has_war_with_realm_of_savannah_tt
		any_enemy_country = {
			is_realm_of_savannah_member = yes
		}
	}
}

at_peace_with_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = at_peace_with_realm_of_savannah_tt
		NOT = {
			any_country = {
				is_realm_of_savannah_member = yes
				OR = {
					has_war_with = PREV
					has_border_war_with = PREV
				}
			}
		}
	}
}

borders_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = borders_realm_of_savannah_tt
		any_neighbor_country = {
			is_realm_of_savannah_member = yes
		}
	}
}

borders_realm_of_savannah_preline = {
	custom_trigger_tooltip = {
		tooltip = borders_realm_of_savannah_preline_tt
		any_neighbor_country = {
			is_realm_of_savannah_member = yes
		}
	}
}

does_not_border_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = does_not_border_realm_of_savannah_tt
		borders_realm_of_savannah = no
	}
}

can_join_realm_of_savannah = {
	can_join_realm_of_savannah_generic = yes
}

can_join_realm_of_savannah_generic = {
	# You must not be at war with the faction.
	at_peace_with_realm_of_savannah = yes

	# Must have mutually positive relations.
	has_mutually_positive_opinion_with_realm_of_savannah = yes

	# The leader must not hate you or vice-versa.
	NOT = { has_country_leader_with_trait = isolationist }
	NOT = { has_country_leader_with_trait = dislikes_realm_of_savannah }

	if = {
		limit = {
			var:GLOBAL.realm_of_savannah_leader = {
				is_brotherhood_nation = yes
			}
		}
		NOT = { has_country_leader_with_trait = dislikes_brotherhood_of_steel }
	}
	else_if = {
		limit = {
			var:GLOBAL.realm_of_savannah_leader = {
				has_country_leader_with_trait = dislikes_brotherhood_of_steel
			}
		}
		is_not_brotherhood_nation = yes
	}
}

has_mutually_positive_opinion_with_realm_of_savannah = {
	custom_trigger_tooltip = {
		tooltip = has_mutually_positive_opinion_with_realm_of_savannah_tt
		any_other_country = {
			is_realm_of_savannah_leader = yes
			has_mutually_positive_opinion_with_prev = yes
		}
	}
}
# reformed_banks
is_reformed_banks_member = {
	custom_trigger_tooltip = {
		tooltip = is_reformed_banks_member_tt
		is_in_array = {
			array = GLOBAL.reformed_banks_members
			value = THIS
		}
	}
}

is_not_reformed_banks_member = {
	custom_trigger_tooltip = {
		tooltip = is_not_reformed_banks_member_tt
		NOT = { is_reformed_banks_member = yes }
	}
}

is_reformed_banks_leader = {
	custom_trigger_tooltip = {
		tooltip = is_reformed_banks_leader_tt
		is_reformed_banks_member = yes
		is_faction_leader = yes
	}
}

is_not_reformed_banks_leader = {
	custom_trigger_tooltip = {
		tooltip = is_not_reformed_banks_leader_tt
		NOT = { is_reformed_banks_leader = yes }
	}
}

reformed_banks_exists = {
	custom_trigger_tooltip = {
		tooltip = reformed_banks_exists_tt
		has_variable = GLOBAL.reformed_banks_leader
	}
}

does_reformed_banks_exist = {
	reformed_banks_exists = yes
}

reformed_banks_does_not_exist = {
	custom_trigger_tooltip = {
		tooltip = reformed_banks_does_not_exist_tt
		NOT = { reformed_banks_exists = yes }
	}
}

does_reformed_banks_not_exist = {
	reformed_banks_does_not_exist = yes
}

has_border_war_with_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = has_border_war_with_reformed_banks_tt
		any_country = {
			is_reformed_banks_member = yes
			has_border_war_with = PREV
		}
	}
}

has_war_with_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = has_war_with_reformed_banks_tt
		any_enemy_country = {
			is_reformed_banks_member = yes
		}
	}
}

at_peace_with_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = at_peace_with_reformed_banks_tt
		NOT = {
			any_country = {
				is_reformed_banks_member = yes
				OR = {
					has_war_with = PREV
					has_border_war_with = PREV
				}
			}
		}
	}
}

borders_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = borders_reformed_banks_tt
		any_neighbor_country = {
			is_reformed_banks_member = yes
		}
	}
}

borders_reformed_banks_preline = {
	custom_trigger_tooltip = {
		tooltip = borders_reformed_banks_preline_tt
		any_neighbor_country = {
			is_reformed_banks_member = yes
		}
	}
}

does_not_border_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = does_not_border_reformed_banks_tt
		borders_reformed_banks = no
	}
}

can_join_reformed_banks = {
	can_join_reformed_banks_generic = yes
}

can_join_reformed_banks_generic = {
	# You must not be at war with the faction.
	at_peace_with_reformed_banks = yes

	# Must have mutually positive relations.
	has_mutually_positive_opinion_with_reformed_banks = yes

	# The leader must not hate you or vice-versa.
	NOT = { has_country_leader_with_trait = isolationist }
	NOT = { has_country_leader_with_trait = dislikes_reformed_banks }

	if = {
		limit = {
			var:GLOBAL.reformed_banks_leader = {
				is_brotherhood_nation = yes
			}
		}
		NOT = { has_country_leader_with_trait = dislikes_brotherhood_of_steel }
	}
	else_if = {
		limit = {
			var:GLOBAL.reformed_banks_leader = {
				has_country_leader_with_trait = dislikes_brotherhood_of_steel
			}
		}
		is_not_brotherhood_nation = yes
	}
}

has_mutually_positive_opinion_with_reformed_banks = {
	custom_trigger_tooltip = {
		tooltip = has_mutually_positive_opinion_with_reformed_banks_tt
		any_other_country = {
			is_reformed_banks_leader = yes
			has_mutually_positive_opinion_with_prev = yes
		}
	}
}
# Phalange Revolt
is_phalange_revolt_member = {
	custom_trigger_tooltip = {
		tooltip = is_phalange_revolt_member_tt
		is_in_array = {
			array = GLOBAL.phalange_revolt_members
			value = THIS
		}
	}
}

is_not_phalange_revolt_member = {
	custom_trigger_tooltip = {
		tooltip = is_not_phalange_revolt_member_tt
		NOT = { is_phalange_revolt_member = yes }
	}
}

is_phalange_revolt_leader = {
	custom_trigger_tooltip = {
		tooltip = is_phalange_revolt_leader_tt
		is_phalange_revolt_member = yes
		is_faction_leader = yes
	}
}

is_not_phalange_revolt_leader = {
	custom_trigger_tooltip = {
		tooltip = is_not_phalange_revolt_leader_tt
		NOT = { is_phalange_revolt_leader = yes }
	}
}

phalange_revolt_exists = {
	custom_trigger_tooltip = {
		tooltip = phalange_revolt_exists_tt
		has_variable = GLOBAL.phalange_revolt_leader
	}
}

does_phalange_revolt_exist = {
	phalange_revolt_exists = yes
}

phalange_revolt_does_not_exist = {
	custom_trigger_tooltip = {
		tooltip = phalange_revolt_does_not_exist_tt
		NOT = { phalange_revolt_exists = yes }
	}
}

does_phalange_revolt_not_exist = {
	phalange_revolt_does_not_exist = yes
}

has_border_war_with_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = has_border_war_with_phalange_revolt_tt
		any_country = {
			is_phalange_revolt_member = yes
			has_border_war_with = PREV
		}
	}
}

has_war_with_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = has_war_with_phalange_revolt_tt
		any_enemy_country = {
			is_phalange_revolt_member = yes
		}
	}
}

at_peace_with_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = at_peace_with_phalange_revolt_tt
		NOT = {
			any_country = {
				is_phalange_revolt_member = yes
				OR = {
					has_war_with = PREV
					has_border_war_with = PREV
				}
			}
		}
	}
}

borders_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = borders_phalange_revolt_tt
		any_neighbor_country = {
			is_phalange_revolt_member = yes
		}
	}
}

borders_phalange_revolt_preline = {
	custom_trigger_tooltip = {
		tooltip = borders_phalange_revolt_preline_tt
		any_neighbor_country = {
			is_phalange_revolt_member = yes
		}
	}
}

does_not_border_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = does_not_border_phalange_revolt_tt
		borders_phalange_revolt = no
	}
}

can_join_phalange_revolt = {
	can_join_phalange_revolt_generic = yes
}

can_join_phalange_revolt_generic = {
	# You must not be at war with the faction.
	at_peace_with_phalange_revolt = yes

	# Must have mutually positive relations.
	has_mutually_positive_opinion_with_phalange_revolt = yes

	# The leader must not hate you or vice-versa.
	NOT = { has_country_leader_with_trait = isolationist }
	NOT = { has_country_leader_with_trait = dislikes_phalange_revolt }

	if = {
		limit = {
			var:GLOBAL.phalange_revolt_leader = {
				is_brotherhood_nation = yes
			}
		}
		NOT = { has_country_leader_with_trait = dislikes_brotherhood_of_steel }
	}
	else_if = {
		limit = {
			var:GLOBAL.phalange_revolt_leader = {
				has_country_leader_with_trait = dislikes_brotherhood_of_steel
			}
		}
		is_not_brotherhood_nation = yes
	}
}

has_mutually_positive_opinion_with_phalange_revolt = {
	custom_trigger_tooltip = {
		tooltip = has_mutually_positive_opinion_with_phalange_revolt_tt
		any_other_country = {
			is_phalange_revolt_leader = yes
			has_mutually_positive_opinion_with_prev = yes
		}
	}
}
