#	Example:
#
#	example_trigger = {
#		tag = GER
#		is_ai = no
#	}
#
#
#	In a script file:
#
#	trigger = {
#		exampel_trigger = yes
#	}
#

can_ROOT_get_wargoal_on_THIS = {
	exists = yes
	NOT = { is_in_faction_with = ROOT }
	NOT = { is_subject_of = ROOT }
}

is_border_conflict_defender_vs_FROM = {
	has_variable = ROOT.defender_state_vs_@FROM
}

has_not_initiated_border_incident_with_FROM = {
	custom_trigger_tooltip = {
		tooltip = not_initiated_border_incident_with_FROM
		NOT = {
			any_state = {
				check_variable = { FROM.defender_state_vs_@PREV = id }
			}
		}
	}
}

has_not_initiated_border_incident_with_ROOT = {
	custom_trigger_tooltip = {
		tooltip = not_initiated_border_incident_with_ROOT
		NOT = {
			any_state = {
				check_variable = { ROOT.defender_state_vs_@PREV = id }
			}
		}
	}
}

#State scope
has_ROOT_at_least_1_div_in_current_state_scope = {
	custom_trigger_tooltip = {
		tooltip = at_least_one_division_in_state
		ROOT = { divisions_in_state = { state = PREV size > 0 } }
	}
}


#State scope
is_controlled_by_ROOT_or_subject = {
	custom_trigger_tooltip = {
		tooltip = is_controlled_by_ROOT_or_subject
		CONTROLLER = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

#Country scope
is_free_or_subject_of_root = {
	OR = {
		is_subject = no
		is_subject_of = ROOT
	}
}

#State scope
is_controlled_by_ROOT_or_ally = {
	custom_trigger_tooltip = {
		tooltip = is_controlled_by_ROOT_or_ally
		CONTROLLER = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
				is_in_faction_with = ROOT
			}
		}
	}
}

enemy_has_equal_or_better_radar_tech_trigger = {
	custom_trigger_tooltip = {
		tooltip = enemy_has_equal_or_better_radar_tech_trigger_tt
		if = {
			limit = {
				ROOT = {
					has_tech = radio_detection
					NOT = {
						has_tech = decimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = radio_detection
					has_tech = decimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = decimetric_radar
					NOT = {
						has_tech = improved_decimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = decimetric_radar
					has_tech = improved_decimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = improved_decimetric_radar
					NOT = {
						has_tech = centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = improved_decimetric_radar
					has_tech = centimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = centimetric_radar
					NOT = {
						has_tech = improved_centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = centimetric_radar
					has_tech = improved_centimetric_radar
				}
			}
		}
		else_if = {
			limit = {
				ROOT = {
					has_tech = improved_centimetric_radar
					NOT = {
						has_tech = advanced_centimetric_radar
					}
				}
			}
			FROM = {
				OR = {
					has_tech = improved_centimetric_radar
					has_tech = advanced_centimetric_radar
				}
			}
		}
		#no more steps needed because end of research tree is reached
	}
}

is_available_to_collaboration_government = { # occupied_countries.1 should be updated along with this
	always = yes
}

has_large_ally_not_pick_closed_economy = {
	any_of_scopes = {
		array = faction_members

		NOT = { tag = PREV }
		num_of_military_factories > 30
	}
}

owns_or_subject_of = {
	custom_trigger_tooltip = {
		tooltip = owns_or_subject_of_tt
		owner = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

controls_or_subject_of = {
	custom_trigger_tooltip = {
		tooltip = controls_or_subject_of_tt
		controller = {
			OR = {
				tag = ROOT
				is_subject_of = ROOT
			}
		}
	}
}

is_core_or_compliance_60 = {
	custom_trigger_tooltip = {
		tooltip = is_core_or_compliance_60_tt
		OR = {
			controller = {
				PREV = { is_core_of = PREV }
			}
			compliance > 60
		}
	}
}


has_same_ideology = {
	custom_trigger_tooltip = {
		tooltip = has_same_ideology_tt
		OR = {
			AND = {
				has_government = democratic
				ROOT = { has_government = democratic }
			}
			AND = {
				has_government = fascism
				ROOT = { has_government = fascism }
			}
			AND = {
				has_government = communism
				ROOT = { has_government = communism }
			}
			AND = {
				has_government = neutrality
				ROOT = { has_government = neutrality }
			}
		}
	}
}

has_specialist_level_trigger = {
	skill > 5
	skill < 6
}

has_expert_level_trigger = {
	skill > 6
	skill < 7
}

has_genius_level_trigger = {
	skill > 7
}
