herzegovina_uprising = {
	NOT = {
		has_global_flag = montenegro_ottomans_neogotiations
	}
	has_global_flag = OTO_herzegovina_uprising_1857
}

montenegro_revolt = {
	OTO = {
		has_active_mission = OTO_mission_herzegovina_uprising_1857_final
	}
	MNT = {
		has_completed_focus = MNT_focus_outbreak_of_the_pro_Montenegro_revolt
	}
}

MNT_OTO_neogotiations = {
	MNT = {
		has_completed_focus = MNT_focus_negotiations_with_the_ottomans_n
	}
	has_global_flag = montenegro_ottomans_neogotiations
}

MNT_OTO_war_1858 = {
	has_global_flag = MNT_war_1858
	OTO = {
		has_active_mission = MNT_OTO_mission_war_1858
	}
}

MNT_OTO_mission_war_1858_cancel_trigger = {
	OR = {
		OR = {
			NOT = {
				has_global_flag = MNT_war_1858
			}
			check_variable = {
				var = OTO.available_lives
				value = 0
				compare = less_than_or_equals
			}
			check_variable = {
				var = MNT.available_lives
				value = 0
				compare = less_than_or_equals
			}
		}
		OTO = {
			controls_state = 942
		}
		MNT = {
			days_since_capitulated < 1
		}
	}
}

division_limit_WAR_1858 = {
	if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = -2
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 6
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = -1
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 7
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = 0
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 8
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = 1
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 10
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = 2
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 12
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = 3
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 14
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
	else_if = {
		limit = {
			check_variable = {
				var = OTO.OTO_max_limit
				value = 4
				compare = equals
			}
		}
		num_divisions_in_states = {
			count > 16
			states = {
				1204
				1202
				225
				1205
				966
				942
			}
		}
	}
}
