Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/bukinoshita/catch-pokemon
- Owner: bukinoshita
- License: mit
- Created: 2017-06-27T23:53:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-04T04:49:56.000Z (over 5 years ago)
- Last Synced: 2024-12-01T07:33:40.414Z (28 days ago)
- Topics: algorithm, catch, javascript, nodejs, pokeball, pokemon
- Language: JavaScript
- Homepage:
- Size: 54.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
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`
RequiredPokemon's name
#### pokeball
Type: `string`
Options: `pokeball`, `masterball`, `greatball`, `ultraball` and `safariball`
RequiredPokeball's name
#### options
Type: `object`
##### hp
Type: `integer`
Pokemon's hp
##### catchRate
Type: `integer`
Pokemon's catch rate
##### asleep
Type: `boolean`
Default: falseDetermine if pokemon is asleep
##### frozen
Type: `boolean`
Default: falseDetermine if pokemon is frozen
##### paralyzed
Type: `boolean`
Default: falseDetermine if pokemon is paralyzed
##### burned
Type: `boolean`
Default: falseDetermine if pokemon is burned
##### poisoned
Type: `boolean`
Default: falseDetermine 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)