#	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
#						}
#					}
#				}
#			}
#		}

# This specifically overrides the rule check as to whether or not you can guarantee other ideologies
DIPLOMACY_GUARANTEE_ENABLE_TRIGGER_OVERRIDES_GAME = {
	NOT = {
		has_game_rule = {
			rule = allow_guarantees
			option = LIMITED
		}
	}
}

DIPLOMACY_GUARANTEE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = ALWAYS_FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = LIMITED
			}
		}
		always = yes # Handled by game logic.
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_GUARANTEES_SAME_IDEOLOGY_TOOLTIP
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_GUARANTEES_BLOCKED_TOOLTIP
			always = no
		}
	}
}

DIPLOMACY_REVOKE_GUARANTEE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_revoke_guarantees
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_REVOKE_GUARANTEES_BLOCKED_TOOLTIP
			always = no
		}
	}
}

DIPLOMACY_RELEASE_NATION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = FREE
			}
			OR = {
				NOT = { has_dlc = "Man the Guns" }
				NOT = { original_tag = ENG }
			}
			OR = {
				NOT = { has_dlc = "La Resistance" }
				NOT = { original_tag = SPR }
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = FREE
			}
			has_dlc = "Man the Guns"
			original_tag = ENG
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_NOT_BRITAIN_TOOLTIP
			NOT = { FROM = { tag = MLT } }
			NOT = { FROM = { tag = CYP } }
			NOT = { FROM = { tag = PAL } }
			NOT = { FROM = { tag = ISR } }
			NOT = { FROM = { tag = JOR } }
			NOT = {
				AND = {
					FROM = { tag = EGY }
					is_ironman = no
				}
			}
			NOT = { FROM = { tag = KUW } }
			NOT = { FROM = { tag = QAT } }
			NOT = { FROM = { tag = UAE } }
			NOT = { FROM = { tag = BLZ } }
			NOT = { FROM = { tag = BAH } }
			NOT = { FROM = { tag = JAM } }
			NOT = { FROM = { tag = TRI } }
			NOT = { FROM = { tag = BAS } }
			NOT = { FROM = { tag = GYA } }
			NOT = { FROM = { tag = SRL } }
			NOT = { FROM = { tag = MLD } }
			NOT = { FROM = { tag = FIJ } }
			NOT = { FROM = { tag = BRM } }
			NOT = { FROM = { tag = SUD } }
			NOT = { FROM = { tag = SOM } }
			NOT = { FROM = { tag = UGA } }
			NOT = { FROM = { tag = KEN } }
			NOT = { FROM = { tag = TZN } }
			NOT = { FROM = { tag = ZAM } }
			NOT = { FROM = { tag = MLW } }
			NOT = { FROM = { tag = ZIM } }
			NOT = { FROM = { tag = BOT } }
			NOT = { FROM = { tag = NGA } }
			NOT = { FROM = { tag = GHA } }
			NOT = { FROM = { tag = SIE } }
			NOT = { FROM = { tag = GAM } }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = FREE
			}
			has_dlc = "La Resistance"
			original_tag = SPR
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_SPAIN_TOOLTIP
			has_global_flag = scw_over
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = FREE
			}
			has_dlc = "La Resistance"
			original_tag = SPR
			#has_completed_focus = SPR_masters_of_our_own_fate
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_ANARCHIST_SPAIN_TOOLTIP
			NOT = { original_tag = SPR }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = PEACE_ONLY
			}
			OR = {
				NOT = { has_dlc = "Man the Guns" }
				NOT = { original_tag = ENG }
			}
			OR = {
				NOT = { has_dlc = "La Resistance" }
				NOT = { original_tag = SPR }
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_PEACE_ONLY_TOOLTIP
			has_war = no
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = PEACE_ONLY
			}
			has_dlc = "Man the Guns"
			original_tag = ENG
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_PEACE_ONLY_TOOLTIP
			has_war = no
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_NOT_BRITAIN_TOOLTIP
			NOT = { FROM = { tag = MLT } }
			NOT = { FROM = { tag = CYP } }
			NOT = { FROM = { tag = PAL } }
			NOT = { FROM = { tag = ISR } }
			NOT = { FROM = { tag = JOR } }
			NOT = { FROM = { tag = EGY } }
			NOT = { FROM = { tag = KUW } }
			NOT = { FROM = { tag = QAT } }
			NOT = { FROM = { tag = UAE } }
			NOT = { FROM = { tag = BLZ } }
			NOT = { FROM = { tag = BAH } }
			NOT = { FROM = { tag = JAM } }
			NOT = { FROM = { tag = TRI } }
			NOT = { FROM = { tag = BAS } }
			NOT = { FROM = { tag = GYA } }
			NOT = { FROM = { tag = SRL } }
			NOT = { FROM = { tag = MLD } }
			NOT = { FROM = { tag = FIJ } }
			NOT = { FROM = { tag = BRM } }
			NOT = { FROM = { tag = SUD } }
			NOT = { FROM = { tag = SOM } }
			NOT = { FROM = { tag = UGA } }
			NOT = { FROM = { tag = KEN } }
			NOT = { FROM = { tag = TZN } }
			NOT = { FROM = { tag = ZAM } }
			NOT = { FROM = { tag = MLW } }
			NOT = { FROM = { tag = ZIM } }
			NOT = { FROM = { tag = BOT } }
			NOT = { FROM = { tag = NGA } }
			NOT = { FROM = { tag = GHA } }
			NOT = { FROM = { tag = SIE } }
			NOT = { FROM = { tag = GAM } }
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = PEACE_ONLY
			}
			has_dlc = "La Resistance"
			original_tag = SPR
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_PEACE_ONLY_TOOLTIP
			has_war = no
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_SPAIN_TOOLTIP
			has_global_flag = scw_over
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_BLOCKED_TOOLTIP
			always = no
		}
	}
}
DIPLOMACY_MILACC_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_OFFER_MILACC_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_DOCKING_RIGHTS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_OFFER_DOCKING_RIGHTS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_access
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_MILITARY_ACCESS_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_LEND_LEASE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = LIMITED
			}
		}
		always = yes #handled by game logic, see above
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = SAME_FACTION
			}
		}
		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 = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_INCOMING_LEND_LEASE_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = LIMITED
			}
		}
		always = yes #handled by game logic, see above
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = SAME_FACTION
			}
		}
		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 = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEND_LEASE_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_REQUEST_LICENSED_PRODUCTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = SAME_FACTION
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_SAME_FACTION_TT
			is_in_faction_with = FROM
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_BLOCKED_TT
			always = no
		}
	}
}
DIPLOMACY_GENERATE_WARGOAL_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = ALWAYS_FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = LIMITED
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_25
			}
		}
		threat>0.24
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_50
			}
		}
		threat>0.49
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_75
			}
		}
		threat>0.74
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_100
			}
		}
		threat>0.99
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FOCUSES_ONLY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_WARGOALS_BLOCKED_TT
			always = no
		}
	}
}
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
		}
	}
}
DIPLOMACY_LEAVE_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_leave_faction
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LEAVE_FACTION_BLOCKED_TOOLTIP
			always = no
		}
	}
}
 DIPLOMACY_ASSUME_FACTION_LEADERSHIP_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_take_over_faction
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ASSUME_LEADERSHIP_BLOCKED_TOOLTIP
			always = no
		}
	}
}
DIPLOMACY_KICK_FROM_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_kick_faction
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_KICK_FROM_FACTION_BLOCKED_TOOLTIP
			always = no
		}
	}
}
DIPLOMACY_SEND_VOLUNTEERS_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = ALWAYS_FREE
			}
		}
		if = {
			limit = {
				NOT = { tag = SPC }
				FROM = {
					tag = SPC
					#has_completed_focus = SPR_regional_defense_council_of_aragon
				}
			}
			custom_trigger_tooltip = {
				tooltip = RULE_VOLUNTEERS_NOT_ANARCHISTS_TT
				NOT = { FROM = { tag = SPC } }
			}
		}
		else = {
			always = yes
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = LIMITED
			}
		}
		if = {
			limit = {
				NOT = { tag = SPC }
				FROM = {
					tag = SPC
					#has_completed_focus = SPR_regional_defense_council_of_aragon
				}
			}
			custom_trigger_tooltip = {
				tooltip = RULE_VOLUNTEERS_NOT_ANARCHISTS_TT
				NOT = { FROM = { tag = SPC } }
			}
		}
		else_if = {
			limit = {
				has_dlc = "La Resistance"
				tag = POR
				FROM = { original_tag = SPR }
				NOT = { has_global_flag = scw_over }
			}
			custom_trigger_tooltip = {
				tooltip = RULE_VOLUNTEERS_PORTUGAL_SCW_TT
				NOT = {
					AND = {
						#has_completed_focus = POR_support_the_spanish_republic
						FROM = { NOT = { tag = SPD } }
					}
				}
				NOT = {
					AND = {
						#has_completed_focus = POR_support_the_spanish_nationalists
						FROM = { NOT = { tag = SPA } }
					}
				}
				NOT = {
					AND = {
						#has_completed_focus = POR_support_a_spanish_monarchy_in_the_war
						FROM = { NOT = { tag = SPB } }
					}
				}
			}
		}
		else = {
			always = yes
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_SAME_IDEOLOGY_TT
			has_government = FROM
		}
		if = {
			limit = {
				NOT = { tag = SPC }
				FROM = {
					tag = SPC
					#has_completed_focus = SPR_regional_defense_council_of_aragon
				}
			}
			custom_trigger_tooltip = {
				tooltip = RULE_VOLUNTEERS_NOT_ANARCHISTS_TT
				NOT = { FROM = { tag = SPC } }
			}
		}
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_BLOCKED_TT
			always = no
		}
	}
}