Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bukinoshita/catch-pokemon

Algorithm to catch a pokemon
https://github.com/bukinoshita/catch-pokemon

algorithm catch javascript nodejs pokeball pokemon

Last synced: 10 days ago
JSON representation

Algorithm to catch a pokemon

Awesome Lists containing this project

README

        

# catch-pokemon [![Build Status](https://travis-ci.org/bukinoshita/catch-pokemon.svg?branch=master)](https://travis-ci.org/bukinoshita/catch-pokemon)

> Algorithm to catch a pokemon

## Install

```
$ npm install --save catch-pokemon
```

## Usage
```js
const catchPokemon = require('catch-pokemon')

catchPokemon('Pikachu', 'masterball')
// => All right! Pikachu was caught!
```

## API

### catchPokemon(pokemon, pokeball, [options])

returns a `promise`

#### pokemon

Type: `string`

Required

Pokemon's name

#### pokeball

Type: `string`

Options: `pokeball`, `masterball`, `greatball`, `ultraball` and `safariball`

Required

Pokeball's name

#### options

Type: `object`

##### hp

Type: `integer`

Pokemon's hp

##### catchRate

Type: `integer`

Pokemon's catch rate

##### asleep

Type: `boolean`

Default: false

Determine if pokemon is asleep

##### frozen

Type: `boolean`

Default: false

Determine if pokemon is frozen

##### paralyzed

Type: `boolean`

Default: false

Determine if pokemon is paralyzed

##### burned

Type: `boolean`

Default: false

Determine if pokemon is burned

##### poisoned

Type: `boolean`

Default: false

Determine if pokemon is poisoned

If `hp` and `catchRate` are passed it won't look up for these information on API (faster). Otherwise, it will try to find the Pokemon on the API.

## Related

- [pokemon-game](https://github.com/bukinoshita/pokemon-game) — Pokemon game — Get 'em all
- [pokedex-api](https://github.com/bukinoshita/pokedex-api) — Pokedex API
- [pokemon-catch-probability](https://github.com/bukinoshita/pokemon-catch-probability) — Check probabilty to catch a pokemon
- [get-pokeball](https://github.com/bukinoshita/get-pokeball) — Get pokeball information
- [pokeball-shake](https://github.com/bukinoshita/pokeball-shake) — Algorithm to determine how many times pokeball shakes
- [pokemon-capture-quote](https://github.com/bukinoshita/pokemon-capture-quote) — Pokemon capture quote
- [pokemon-f](https://github.com/bukinoshita/pokemon-f) — Algorithm to calculate `f` on capture pokemon method

## License

MIT © [Bu Kinoshita](https://bukinoshita.io)