npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pokemagic

v7.0.0

Published

Gym/Raid battle simulator for Pokemon GO + breakpoints and rankings

Downloads

41

Readme

pokemagic

Usage

npm install pokemagic

API

Pokedex

Example

const dex = require('pokemagic/dex');

dex.findPokemon('jolteon'); // Pokemon
dex.findMove('struggle'); // Move
dex.getAllPokemon(); // [Pokemon]
dex.getMoves(); // [Moves]

Battle Simulator

Example

const simulateBattle = require('pokemagic/simulateBattle');

const attackers = [
  {
    iv: 0xfff,
    lvl: 40,
    name: 'machamp',
    move1: 'counter',
    move2: 'dynamic punch',
  },
];

const defenders = [
  {
    iv: 0xfff,
    lvl: 40,
    name: 'tyranitar',
    move1: 'bite',
    move2: 'crunch',
  },
];

const options = {
  raid: null,
  weather: 'EXTREME',
};

const stats = simulateBattle(attackers, defenders, options);

stats.winner === 'atk'; // true

Attacker/Defender Objects

{
  iv: 'number', // hexadecimal
  lvl: 'number', // 1-40
  move1: 'string', // a valid Move name (see json/moves.json)
  move2: 'string',
  pokemon: { // a valid Pokemon object (see json/pokemon.json)
    id: 'number',
    name: 'string',
    type1: 'string',
    type2: 'string',
    stats: { stamina: 'number', attack: 'number', defense: 'number' },
  },
}

Request Options

{
  atkDodgeStrategy: 'charge', // 'all' | 'charge' | null
  raid: {
    cp: 'number',
    hp: 'number',
    cpm: 'number',
  },
  raidTier: 'number',
  weather: 'string', // EXTREME, CLEAR, FOGGY, SUNNY (see lib/weather.js)
};

Response

const Pokemon = {
  id: 'number',
  name: 'string',
  iv: 'string',
  moves: ['string', 'string'],
  cp: 'number',
  hp: 'number',
  dmgDealt: 'number',
  dmgTaken: 'number',
};

const Response = {
  log: [
    {
      // A log of all the moves that took place
      p: 'string', // Pokemon
      m: 'string', // Move
      dmg: 'number', // Damage
      ms: 'number', // Time
    },
  ],
  state: {
    atk: [Pokemon],
    def: [Pokemon],
  },
  timeElapsed: 'number',
  timeRemaining: 'number',
  timedOut: 'boolean',
  winner: 'string', // atk | def
};

Breakpoint & Bulkpoint

Example

const breakpoint = require('pokemagic/breakpoint');

// Calculate the break/bulk points for a Raikou fighting a Kyogre
const point = breakpoint('raikou', 'kyogre');

Response

{
  atk: [{ // breakpoints
    move: 'string',
    table: [{
      dmg: 'number',
      cp: 'number',
      lvl: 'number',
      pct: 'string', // percentage increase over previous point
    }],
  }],
  def: [{ // bulkpoints
    move: 'string',
    table: [{
      dmg: 'number',
      cp: 'number',
      lvl: 'number',
      pct: 'string',
    }],
  }],

Attacker/Defender Profile

Response

{
  pokemon: Pokemon,
  raidInfo: {
    cp: "number",
    hp: "number",
    cpm: "number"
  },
  data: [{
    // Each move will have its own counters list
    quick: "string",
    charge: "string",
    // Each list belongs to a Pokemon, in case there are multiple movesets
    // that are viable counters
    results: [{
      name: "string",
      stats: [{
        dps: 'number',
        legacy: 'number', // 0=not legacy,1=quick legacy,2=charge legacy,3=double legacy,4=community day
        moves: ['string', 'string'], // Quick & Charge move
        name: 'string', // Pokemon's name
        score: 'number', // Internally used to rank best counters
        tdo: 'number',
      }],
    }],
  }],
  types: {
    immune: ['string'],
    notEffective: ['string'],
    superEffective: ['string'],
  },
}

Type Rankings

Example

const typeRankings = require('pokemagic/typeRankings');

const rank = typeRankings('electric');

Response

[
  {
    name: 'string',
    moves: ['string', 'string'],
    dps: 'number', // Damage per second
    score: 'number', // Internally used to sort
    tdo: 'number', // Total time
    wins: 'number', // Number of battles won
    count: 'number', // Number of battles fought
  },
];

IV Calculator

Example

const calculateIV = require('pokemagic/calculateIV');

const matches = calculateIV(
  findPokemon('MEWTWO'), // Pokemon
  3982, // CP
  164, // HP
  40 // Level
);

Response

Possible IV values are returned. If the array is empty then no IVs were matched.

[{ atk: 'number', def: 'number', sta: 'number' }];