protect_homeland_1 = {
	enable = {
		surrender_progress > 0.05
	}
	abort = {
		OR = {
			surrender_progress < 0.01
			has_capitulated = yes
		}
	}
	
	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			any_state = {
				is_core_of = FROM.FROM
				controller = {
					has_war_with = FROM.FROM
				}
			}
		}
		value = 10
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			NOT = { is_core_of = FROM.FROM }
		}
		value = -10
	}
}

protect_homeland_2 = {
	enable = {
		surrender_progress > 0.10
	}
	abort = {
		OR = {
			surrender_progress < 0.05
			has_capitulated = yes
		}
	}
	
	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			any_state = {
				is_core_of = FROM.FROM
				controller = {
					has_war_with = FROM.FROM
				}
			}
		}
		value = 100
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			NOT = { is_core_of = FROM.FROM }
		}
		value = -100
	}
}

protect_homeland_3 = {
	enable = {
		surrender_progress > 0.20
	}
	abort = {
		OR = {
			surrender_progress < 0.10
			has_capitulated = yes
		}
	}
	
	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			any_state = {
				is_core_of = FROM.FROM
				controller = {
					has_war_with = FROM.FROM
				}
			}
		}
		value = 250
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			NOT = { is_core_of = FROM.FROM }
		}
		value = -250
	}
	ai_strategy = {
		type = spare_unit_factor
		value = -100
	}
	ai_strategy = {
		type = garrison
		value = -100
	}
}

protect_homeland_4 = {
	enable = {
		surrender_progress > 0.30
	}
	abort = {
		OR = {
			surrender_progress < 0.15
			has_capitulated = yes
		}
	}
	
	ai_strategy = {
		type = front_unit_request
		state_trigger = { 
			any_state = {
				is_core_of = FROM.FROM
				controller = {
					has_war_with = FROM.FROM
				}
			}
		}
		value = 500
	}
	ai_strategy = {
		type = front_unit_request
		state_trigger = {
			NOT = { is_core_of = FROM.FROM }
		}
		value = -500
	}
	ai_strategy = {
		type = dont_defend_ally_borders
		value = 9999
	}
}
