#	Example:
# 
#	example_trigger = {
#		tag = GER
#		is_ai = no
#	}
#
#
#	In a script file:
#
#	trigger = {
#		exampel_trigger = yes
#	}
# 
#	THIS FILE IS FOR TRIGGERS SPECIFICALLY FOR THE GER TAG

is_controlled_by_ROOT_or_subject = {
    custom_trigger_tooltip = {
        tooltip = is_controlled_by_ROOT_or_ally
        CONTROLLER = {
            OR = {
                tag = ROOT
                is_subject_of = ROOT
            }
        }
    }
}

is_friend_or_potential_friend_of_GER = {
	OR = {
		is_puppet_of = GER
		is_puppet = no
	}
	OR = {
		is_in_faction_with = GER
		is_in_faction = no
	}
	NOT = { has_war_with = GER }
	has_capitulated = no
	exists = yes
}

is_alone_or_in_faction_at_peace_with_GER = {
	OR = {
		is_in_faction = no
		is_in_faction_with = GER
		AND = {
			is_in_faction = yes
			NOT = {
				is_in_faction_with = GER
			}
		}
	}
	NOT = {
		any_allied_country = {
			has_war_with = GER
		}
	}
}

#Country scope
GER_has_mefo_bills = {
	if = {
		limit = { has_idea = GER_mefo_bills_1 }
		has_idea = GER_mefo_bills_1
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_2 }
		has_idea = GER_mefo_bills_2
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_3 }
		has_idea = GER_mefo_bills_3
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_4 }
		has_idea = GER_mefo_bills_4
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_5 }
		has_idea = GER_mefo_bills_5
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_6 }
		has_idea = GER_mefo_bills_6
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_7 }
		has_idea = GER_mefo_bills_7
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_8 }
		has_idea = GER_mefo_bills_8
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_9 }
		has_idea = GER_mefo_bills_9
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_10 }
		has_idea = GER_mefo_bills_10
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_11 }
		has_idea = GER_mefo_bills_11
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_12 }
		has_idea = GER_mefo_bills_12
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_13 }
		has_idea = GER_mefo_bills_13
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_14 }
		has_idea = GER_mefo_bills_14
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_15 }
		has_idea = GER_mefo_bills_15
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_16 }
		has_idea = GER_mefo_bills_16
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_17 }
		has_idea = GER_mefo_bills_17
	}
	else_if = {
		limit = { has_idea = GER_mefo_bills_18 }
		has_idea = GER_mefo_bills_18
	}
	else = {		
		has_idea = GER_mefo_bills_1
	}
}

#Country scope
GER_can_delay_mefo_payment = {
	custom_trigger_tooltip = {
		tooltip = GER_can_delay_mefo_payment
		NOT = { has_idea = GER_mefo_bills_18 }
	}
}

GER_naval_interest_trigger = {
	OR = {
		AND = {
			not = { has_war_with = SOV }
			OR = {
				has_war_with = ENG
				has_war_with = USA
				has_war_with = JAP
			}
		}
		has_completed_focus = GER_plan_z
		has_completed_focus = GER_rebuild_the_high_seas_fleet
	}
}

GER_should_split_SOV_front_with_ITA = {
	set_temp_variable = { num_ger_units = GER.num_armies }
	set_temp_variable = { num_ita_units = ITA.num_armies }
	
	check_variable = { num_ger_units > 100 }
	check_variable = { num_ita_units > 90 }
	
	ITA = {
		is_ai = yes
	}
	
	ITA = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.1
		}
	}
	
	ROM = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.05
		}
	}
	
	HUN = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.25
		}
	}
}

# a more relaxed version of previous one
GER_should_continue_split_SOV_front_with_ITA = {

	set_temp_variable = { num_ger_units = GER.num_armies }
	set_temp_variable = { num_ita_units = ITA.num_armies }
	
	check_variable = { num_ger_units > 85 }
	check_variable = { num_ita_units > 75 }
	
	ITA = {
		is_ai = yes
	}
	
	ITA = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.15
		}
	}
	
	ROM = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.1
		}
	}
	
	HUN = {
		OR = {
			exists = no
			NOT = { is_in_faction_with = GER }
			surrender_progress < 0.30
		}
	}
}

going_war_with_SOV = {
	or = {
		has_war_with = SOV
		focus_progress = {
			focus = GER_ussr_war_goal
			progress > 0.01
		}
		is_justifying_wargoal_against = SOV
		has_wargoal_against = SOV
	}
}
