A calculator for Pokémon combat power given their level and IVs
Install package using npm:
$ npm i pokemon-go-cpUsing the package:
var cpCalculator = require('pokemon-go-cp');
// Choose a Pokémon by its Dex number:
var pokemon = 1; // Bulbasaur
// Choose Pokémon iv between 0 and 15:
var atk = 12;
var def = 14;
var sta = 15;
// Calculate the combat power as shown in Pokémon Go
cpCalculator.calculate(pokemon, atk, def, sta); // 546
// Choose a Pokémon level. If not set, default is 20
var pokemonLevel = 31.5;
cpCalculator.calculate(pokemon, atk, def, sta, pokemonLevel); // 839Feel free to open pull requests.
In case there are Pokémon missing or combat power is calculated incorrectly, you might want to use the generator.js script to update the database.
$ cd src/
$ node generator.jsThis project is licensed under the MIT License - see the LICENSE file for details