#	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
			}
			NOT = { has_dlc = "Man the Guns" }
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = PEACE_ONLY
			}
			NOT = { original_tag = ENG }
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_RELEASE_NATIONS_PEACE_ONLY_TOOLTIP
			has_war = no
		}
	}
	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 = FREE
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_volunteers
				option = LIMITED
			}
		}
		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 = {
			has_game_rule = {
				rule = allow_volunteers
				option = BLOCKED
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_VOLUNTEERS_BLOCKED_TT
			always = no
		}
	}
}