1.4.4 • Published 5 years ago

pkm-rpg v1.4.4

Weekly downloads
3
License
ISC
Repository
-
Last release
5 years ago
$ 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:

  1. Fork the repo and create your branch from master.
  2. If you've added code that should be tested, add tests.
  3. If you've changed APIs, update the documentation.
  4. Ensure the test suite passes.
  5. Make sure your code lints.
  6. Issue that pull request!

This project is licensed under the MIT License

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0-a

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago