Context. Weak-lensing peak counts have been shown to be a powerful tool for cosmology. They provide non-Gaussian information of large scale structures and are complementary to second-order statistics. Aims. We propose a new flexible method for predicting weak-lensing peak counts, which can be adapted to realistic scenarios, such as a real source distribution, intrinsic galaxy alignment, mask effects, and photo-z errors from surveys. The new model is also suitable for applying the tomography technique and nonlinear filters. Methods. A probabilistic approach to modeling peak counts is presented. First, we sample halos from a mass function. Second, we assign them density profiles. Third, we place those halos randomly on the fie...