#	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
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = LIMITED
			}
		}
		always = yes # Handled by game logic.
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_guarantees
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_GUARANTEES_SAME_IDEOLOGY_TOOLTIP
			has_government = FROM
		}
	}
	else_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
			}
		}
		always = yes
	}
	if = {
		limit = {
			has_game_rule = {
				rule = allow_release_nations
				option = PEACE_ONLY
			}
		}
		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
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = LIMITED
			}
		}
		always = yes #handled by game logic, see above
	}
	else_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
		}
	}
	else_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
		}
	}
	else_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
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_lend_lease
				option = LIMITED
			}
		}
		always = yes #handled by game logic, see above
	}
	else_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
		}
	}
	else_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
		}
	}
	else_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
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_licensing
				option = SAME_IDEOLOGY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_ALLOW_LICENSING_SAME_IDEOLOGY_TT
			has_government = FROM
		}
	}
	else_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
		}
	}
	else_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 = FOCUSES_ONLY
			}
		}
		custom_trigger_tooltip = {
			tooltip = RULE_WARGOALS_BLOCKED_TT
			always = no
		}
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = ALWAYS_FREE
			}
		}
		always = yes
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = LIMITED
			}
		}
		always = yes
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_25
			}
		}
		threat>0.24
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_50
			}
		}
		threat>0.49
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_75
			}
		}
		threat>0.74
	}
	else_if = {
		limit = {
			has_game_rule = {
				rule = allow_wargoals
				option = FREE_100
			}
		}
		threat>0.99
	}
}
DIPLOMACY_BOOST_PARTY_POPULARITY_ENABLE_TRIGGER = {
	always = no 
}
DIPLOMACY_STAGE_COUP_ENABLE_TRIGGER = {
	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
			}
		}
		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
		}
	}
}

DIPLOMACY_JOIN_FACTION_ENABLE_TRIGGER = {
	always = no #disabled for now
}
DIPLOMACY_OFFER_JOIN_FACTION_ENABLE_TRIGGER = {
	if = {
		limit = {
			has_country_flag = ENG_sepoy_rebellious_state_diplomacy_flag
		}
		custom_trigger_tooltip = {
			tooltip = RULE_OFFER_JOIN_FACTION_BLOCKED_TT
			FROM = {
				#OR = {
				#	TAG = SRS
				#	TAG = BIK
				#	TAG = OUD
				#	TAG = GWA
				#	TAG = KAR
				#	TAG = KAS
				#}
				has_country_flag = ENG_sepoy_rebellious_state_diplomacy_flag
			}
		}
	}
	else = {
		always = no #disabled for now
	}
}

DIPLOMACY_REQUEST_EXP_FORCE_ENABLE_TRIGGER = {
	if = {
		limit = {
			tag = DEN
			FROM = {
				OR = {
					tag = HLS
					tag = SCH
				}
			}
		}
		custom_trigger_tooltip = {
			tooltip = DEN_SCH_no_request_forces
			always = no
		}
	}
	else = {
		always = yes
	}
}

# 
DIPLOMACY_CALL_ALLY_ENABLE_TRIGGER = {
	FROM={
		custom_trigger_tooltip = {
			tooltip = EOANB_cant_call_neutral_vassal
			NOT = {
				OR={
					has_idea = SRS_idea_princely_neutrality
					has_country_flag = eoanb_diplomaticaly_neutral_vassal
					is_in_faction_with = CBI
					tag = CBI
					has_autonomy_state = autonomy_OTT_vassal
				}
			}
		}
	}
	if = {
		limit = {
			tag = QNG
		}
		custom_trigger_tooltip = {
			tooltip = EOANB_cant_call_autonomus_navies
			FROM = {
				NOT = {
					has_idea = QNG_autonomus_navy
				}
			}
		}
	}
	if = {
		limit = {
			FROM = {
				tag = USA
			}
			tag = PRU
			country_exists = PRR
			date < 1859.1.1
		}
		custom_trigger_tooltip = {
			tooltip = EOANB_PRU_civil_war_no_USA_intervention
			always = no
		}
	}
}
DIPLOMACY_JOIN_ALLY_ENABLE_TRIGGER = {
	custom_trigger_tooltip = {
		tooltip = EOANB_cant_call_neutral_vassal
		NOT = {
			OR={
				has_idea = SRS_idea_princely_neutrality
				has_country_flag = eoanb_diplomaticaly_neutral_vassal
				is_in_faction_with = CBI
				tag = CBI
				has_autonomy_state = autonomy_OTT_vassal
			}
		}
	}
	if = {
		limit = {
			tag = USA
			FROM = {
				tag = PRU
			} 
			country_exists = PRR
			date < 1859.1.1
		}
		custom_trigger_tooltip = {
			tooltip = EOANB_PRU_civil_war_no_USA_intervention
			always = no
		}
	}
}