pkm-rpg
v1.4.4
Published
An pokemon rpg toolkit for those looking to build a pokemon RPG
Downloads
11
Readme
$ npm i -s pkm-rpg
Import
import * as pkmrpg from 'pkm-rpg'
Require
var pkmrpg = require('pkm-rpg')
Interface
interface IPokemonCreateRequest {
// A name or ID is required although optional here is to let req set either name or id
// Name of pokemon (will try and find it in pokedex)
name?: string,
// Pokedex number of pokemon (will try and find it in pokedex)
id?: number,
// Stats to give created pokemon
level?: number,
hp?: number,
attack?: number,
defense?: number,
special_attack?: number,
special_defense?: number,
speed?: number,
moves?: string[]
}
Ussage
var Pikachu = pkmrpg.Pokemon.pokemonCreate({
id: 25,
level: 100,
moves: ['thunder bolt', 'iron tail', 'quick attack', 'tackle']
});
interface IPokemon {
name: string;
types: string[];
level?: number;
hp: number;
attack: number;
defense: number;
special_attack: number;
special_defense: number;
speed: number;
moves: string[] | IMove[];
moves_pp_used?: number[];
inventory: number;
// Set this to true if you don't want default stats set on BattlePokemon pokemon creation
is_battle_ready?: boolean;
}
interface IBattlePokemonReady extends IPokemon {
status_effect?: string;
accuracy: number;
evasion: number;
max_accuracy: number;
max_evasion: number;
max_hp: number;
max_attack: number;
max_defense: number;
max_special_attack: number;
max_special_defense: number;
max_speed: number;
moves: string[];
}
Ussage
var Pikachu = pkmrpg.Battle.pokemonCreate({
name: 'Pikachu',
types: [ 'Electric' ],
level: 100,
hp: 700,
attack: 1100,
defense: 800,
special_attack: 1000,
special_defense: 1000,
speed: 1800,
moves: [ 'thunder bolt', 'iron tail', 'quick attack', 'tackle' ],
inventory: 1,
status_effect: '',
accuracy: 100,
evasion: 100,
max_accuracy: 100,
max_evasion: 100,
max_hp: 700,
max_attack: 1100,
max_defense: 800,
max_special_attack: 1000,
max_special_defense: 1000,
max_speed: 1800,
moves_pp_used: [ 0, 0, 0, 0 ],
is_battle_ready: true
});
Chain Ussage
var Pikachu = pkmrpg.Pokemon.pokemonCreate({...});
var BattlePikachu = pkmrpg.Battle.pokemonCreate(Pikachu.getBattlePokemonReady());
var Onyx = pkmrpg.Pokemon.pokemonCreate({...});
var BattleOnyx = pkmrpg.Battle.pokemonCreate(Onyx.getBattlePokemonReady());
var Pikachu = pkmrpg.Pokemon.pokemonCreate({...});
var BattlePikachu = pkmrpg.Battle.pokemonCreate(Pikachu.getBattlePokemonReady());
BattlePikachu.Attack(BattlePikachu.battle_moves[2], BattleOnyx) // Returns attack log (text)
Pull requests are the best way to propose changes to the codebase (we use Github Flow). We actively welcome your pull requests:
- Fork the repo and create your branch from
master
. - If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
- Make sure your code lints.
- Issue that pull request!
This project is licensed under the MIT License