//determines if the pokemon will be caught will the given pokeball, and pokemon passed in int Pokeball::canCatch(Pokemon p) { if (!p.isWild()) { //cout << "Cannot capture other trainer's Pokemon!" << endl; return -1; } double f[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; f[0] = 100 - p.getLevel(); f[1] = (1.0 - 1.0*p.getHP() / p.getMaxHP()) * 200; f[2] = rand() % 200; double prob = f[0] + f[1] + f[2]; if (prob >= 250) { // cout << p.getName() << " was successfully caught!" << endl; return 1; } //cout << "Oh no, it broke free!" << endl; return 0; }