Skip to content

Check if player escape from battle with wild Pokemon and get probability of escaping

License

Notifications You must be signed in to change notification settings

bukinoshita/pokemon-player-escape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pokemon-player-escape Build Status

Check if player escape from battle with wild Pokemon and get probability of escaping

Install

$ npm install --save pokemon-player-escape

Usage

const pokemonPlayerEscape = require('pokemon-player-escape')

pokemonPlayerEscape.escape(25, 100)
// => false

pokemonPlayerEscape.probability(100, 100)
// => 0.6171875 (61%)

API

pokemonPlayerEscape()

.escape(myPokemonSpeed, pokemonSpeed, [nTimes])

Returns a boolean. If true player's pokemon escape.

myPokemonSpeed

Type: integer
Required

Player's Pokemon speed

pokemonSpeed

Type: integer
Required

Wild Pokemon speed

nTimes

Type: integer
Default: 0

Number of times player's pokemon tried to escape

.probability(myPokemonSpeed, pokemonSpeed, [nTimes])

Returns a number.

myPokemonSpeed

Type: integer
Required

Player's Pokemon speed

pokemonSpeed

Type: integer
Required

Wild Pokemon speed

nTimes

Type: integer
Default: 0

Number of times player's pokemon tried to escape

Related

License

MIT © Bu Kinoshita

About

Check if player escape from battle with wild Pokemon and get probability of escaping

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published