#	Triggers to control if diplomatic actions are enabled:
#		Format:
#
#		<diplomatic action tag>_enabled_trigger = {
#			<trigger contents>
#		}
#
#		ROOT is the country initiating the diplomatic action.
#		FROM is the recipient or target of the diplomatic action.
#
#		Note:  For cleaner tooltips, it is recommended that you use
#			if triggers within the enable triggers, and a single
#			custom_trigger_tooltip trigger within each if trigger.
#
#		Example: (Germany is prevented from declaring war on the Soviet Union.)
#
#		DIPLOMACY_WAR_ENABLE_TRIGGER = {
#			if = {
#				limit = {
#					tag = GER
#				}
#				custom_trigger_tooltip = {
#					tooltip = PREVENT_GER_WAR_ON_SOV
#					FROM = {
#						NOT = {
#							tag = SOV
#						}
#					}
#				}
#			}
#		}

DIPLOMACY_GENERATE_WARGOAL_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_WARGOALS_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_WARGOALS_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_MILACC_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_OFFER_MILACC_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_MILITARY_ACCESS_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_DOCKING_RIGHTS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_DOCKING_RIGHTS_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_DOCKING_RIGHTS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_OFFER_DOCKING_RIGHTS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_DOCKING_RIGHTS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_DOCKING_RIGHTS_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_DOCKING_RIGHTS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_RELEASE_NATION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_RELEASE_NATION_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_RELEASE_NATION_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_REQUEST_LICENSED_PRODUCTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_LEND_LEASE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_INCOMING_LEND_LEASE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_SEND_VOLUNTEERS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = RULE_OPTION_DEFAULT
			}	
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_SAME_FACTION_TT
			OR = {
				is_in_faction_with = FROM
				has_rule = can_send_volunteers
			}
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = RULE_OPTION_DEFAULT
			}	
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_SAME_FACTION_TT
			OR = {
				is_in_faction_with = FROM
				has_rule = can_send_volunteers
			}
		}
	}
}

# This specifically overrides the rule check as to whether or not you can guarantee other ideologies
DIPLOMACY_GUARANTEE_ENABLE_TRIGGER_OVERRIDES_GAME = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_GUARANTEE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = ALLOWED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = ALLOWED_WITH_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_GUARANTEE_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
}

DIPLOMACY_REVOKE_GUARANTEE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_revoke_guarantees
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_REVOKED_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_revoke_guarantees
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_REVOKED_GUARANTEE_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_revoke_guarantees
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_JOIN_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_JOIN_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_JOIN_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = ALLOWED
			}
		}
		always = yes
	}
}


DIPLOMACY_OFFER_JOIN_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_join_faction
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_LEAVE_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_leave_faction
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_LEAVE_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_leave_faction
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_LEAVE_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_leave_faction
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_KICK_FROM_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_kick_faction
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_KICK_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_kick_faction
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_KICK_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_kick_faction
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_ASSUME_FACTION_LEADERSHIP_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_take_over_faction
				option = RULE_OPTION_DEFAULT
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_TAKE_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_take_over_faction
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_TAKE_FACTION_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_take_over_faction
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_CALL_ALLY_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_callying_allies
				option = RULE_OPTION_DEFAULT
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_callying_allies
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_CALL_ALLY_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_callying_allies
				option = ALLOWED
			}
		}
		always = yes
	}
}

DIPLOMACY_JOIN_ALLY_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_joining_allies
				option = RULE_OPTION_DEFAULT
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_joining_allies
				option = DISALLOWED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_JOIN_ALLY_DISALLOWED_TT
			always = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_joining_allies
				option = ALLOWED
			}
		}
		always = yes
	}
}

#La Resistance

DIPLOMACY_BOOST_PARTY_POPULARITY_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_party_boosting
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_party_boosting
				option = AI_ONLY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_BOOST_PARTY_AI_ONLY_TT
			FROM = { is_ai = yes }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_party_boosting
				option = PLAYER_ONLY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_BOOST_PARTY_PLAYER_ONLY_TT
			FROM = { is_ai = no }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_party_boosting
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_BOOST_PARTY_BLOCKED_TT
			always = no
		}
	}
}

DIPLOMACY_STAGE_COUP_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_coups
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_coups
				option = AI_ONLY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_COUP_AI_ONLY_TT
			FROM = { is_ai = yes }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_coups
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_COUP_BLOCKED_TT
			always = no
		}
	}
}