Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pkmn/client

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pkmn/client - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

build/index.mjs

309

build/index.d.ts

@@ -1,4 +0,305 @@

export * from './battle';
export * from './field';
export * from './pokemon';
export * from './side';
import * as _pkmn_data from '@pkmn/data';
import { PokemonSet, ID, SideCondition, GenderName, HPColor, StatusName, BoostsTable, NatureName, HPTypeName, TypeName, MoveTarget, Move, Effect, DataKind, StatID, SpeciesName, Generations, Generation, GameType, SideID } from '@pkmn/data';
import { Username, AvatarIdent, DetailedPokemon, PokemonHealth, PokemonDetails, PokemonIdent, PokemonSearchID, MoveName, Protocol, EffectName, Message, FormatName, ArgType, BattleArgsKWArgType, PokemonHPStatus } from '@pkmn/protocol';
declare class Side {
readonly battle: Battle;
readonly n: number;
readonly sets?: PokemonSet[];
id: ID;
name: Username | '';
avatar: AvatarIdent | 'unknown';
foe: Side;
ally?: Side;
rating: string;
active: Array<Pokemon | null>;
focus: number;
lastPokemon: Pokemon | null;
team: Pokemon[];
totalPokemon: number;
sideConditions: {
[id: string]: {
name: SideCondition;
level: number;
minDuration: number;
maxDuration: number;
remove?: boolean;
};
};
wisher: Pokemon | null;
private readonly provider;
constructor(battle: Battle, n: 0 | 1 | 2 | 3, sets?: PokemonSet[], provider?: (s: Side, d: DetailedPokemon, p?: PokemonSet) => Pokemon);
setAvatar(avatar: AvatarIdent): void;
setName(name: Username, avatar?: AvatarIdent): void;
addSideCondition(effect: {
name: string;
id: ID;
}): {
name: SideCondition;
level: number;
minDuration: number;
maxDuration: number;
remove?: undefined;
} | {
name: SideCondition;
level: number;
minDuration: number;
maxDuration: number;
remove: true;
} | undefined;
removeSideCondition(condition: ID): void;
addPokemon(details: DetailedPokemon, replaceSlot?: number): Pokemon;
switchIn(pokemon: Pokemon, slot?: number): void;
dragIn(pokemon: Pokemon, slot?: number): void;
replace(pokemon: Pokemon, slot?: number): void;
switchOut(pokemon: Pokemon, slot?: number): void;
swapTo(pokemon: Pokemon, slot: number): void;
swapWith(pokemon: Pokemon, target: Pokemon): void;
faint(pokemon: Pokemon, slot?: number): void;
clearPokemon(): void;
reset(): void;
destroy(): void;
}
interface EffectState {
id: ID;
level?: number;
apparentType?: string;
type?: TypeName;
stat?: StatID;
speciesForme?: SpeciesName;
pokemon?: Pokemon;
shiny?: boolean;
gender?: GenderName;
duration?: 'turn' | 'move' | number;
}
interface EffectTable {
[effectid: string]: EffectState;
}
type MoveSlot = {
name: MoveName;
id: ID;
ppUsed: number;
virtual?: boolean;
} | {
name: MoveName;
id: ID;
ppUsed: number;
pp: number;
maxpp: number;
target: MoveTarget;
disabled?: boolean;
virtual?: boolean;
};
type ItemEffect = 'found' | 'frisked' | 'knocked off' | 'stolen' | 'harvested' | 'bestowed' | 'tricked' | 'disturbed';
type LastItemEffect = 'eaten' | 'flung' | 'knocked off' | 'stolen' | 'consumed' | 'incinerated' | 'popped' | 'held up';
type CopySource = 'batonpass' | 'illusion' | 'shedtail';
declare class Pokemon implements DetailedPokemon, PokemonHealth {
readonly side: Side;
readonly set?: PokemonSet;
slot: number;
details: PokemonDetails;
name: string;
baseSpeciesForme: string;
level: number;
shiny: boolean;
gender: GenderName;
readonly originalIdent: PokemonIdent;
searchid: PokemonSearchID;
hp: number;
maxhp: number;
baseMaxhp: number;
hpcolor: HPColor;
status?: StatusName;
fainted: boolean;
newlySwitched: boolean;
beingCalledBack: boolean;
statusStage: number;
statusState: {
sleepTurns: number;
toxicTurns: number;
};
boosts: Partial<BoostsTable>;
volatiles: EffectTable;
ability: ID;
baseAbility: ID;
illusion?: Pokemon;
revealedDetails?: PokemonDetails;
item: ID;
itemEffect: ItemEffect | '';
lastItem: ID;
lastItemEffect: LastItemEffect | '';
teamPreviewItem: boolean;
nature?: NatureName;
hpType?: HPTypeName;
teraType?: TypeName;
moveSlots: MoveSlot[];
maxMoves?: Array<{
id: ID;
target: MoveTarget;
disabled?: boolean;
}>;
zMoves?: Array<{
name: MoveName;
id: ID;
target: MoveTarget;
} | null>;
canDynamax?: boolean;
canGigantamax?: boolean;
canMegaEvo?: boolean;
canUltraBurst?: boolean;
trapped?: boolean;
maybeTrapped?: boolean;
maybeDisabled?: boolean;
lastMove: ID;
lastMoveTargetLoc?: number;
moveThisTurn: ID | boolean;
hurtThisTurn: boolean;
movesUsedWhileActive: ID[];
constructor(side: Side, details: DetailedPokemon, set?: PokemonSet);
toString(): string;
get ivs(): _pkmn_data.StatsTable<number> | undefined;
get evs(): _pkmn_data.StatsTable<number> | undefined;
get happiness(): number | undefined;
get ident(): Protocol.PokemonIdent;
get position(): number;
get species(): _pkmn_data.Specie;
get baseSpecies(): _pkmn_data.Specie;
get speciesForme(): string;
set speciesForme(speciesForme: string);
get weighthg(): number;
get types(): [TypeName] | [TypeName, TypeName];
get addedType(): TypeName | undefined;
get switching(): "in" | "out" | undefined;
get moves(): ID[];
hasItem(): boolean;
isActive(): boolean;
healthParse(hpstring: string): [delta: number, denominator: number, oldnum: number, oldcolor: "" | HPColor] | null;
static parseHealth(hpstring: string, output?: PokemonHealth): [delta: number, denominator: number, oldnum: number, oldcolor: HPColor | ''] | null;
checkDetails(details?: PokemonDetails): boolean;
hasVolatile(volatile: ID): boolean;
addVolatile(volatile: ID, args?: Omit<EffectState, 'id'>): void;
removeVolatile(volatile: ID): void;
clearTurnstatuses(): void;
clearMovestatuses(): void;
clearVolatiles(): void;
clearVolatile(): void;
copyVolatileFrom(pokemon: Pokemon, copySource?: CopySource): void;
rememberMove(moveName: MoveName | ID, ppUsed?: number, recursionSource?: PokemonIdent): void;
useMove(move: Partial<Move> & NA, target: Pokemon | null, from?: EffectName | MoveName): void;
cantUseMove(effect: Partial<Effect> & NA, move?: Partial<Move> & NA): void;
activateAbility(effectOrName?: {
kind: DataKind;
name: string;
} | string, isNotBase?: boolean): void;
effectiveAbility(): ID;
rememberAbility(ability: string, isNotBase?: boolean): void;
copyTypesFrom(pokemon: Pokemon): void;
isGrounded(): boolean;
static getDamageRange(damage: [delta: number, denominator: number, oldnum: number, oldcolor: HPColor | ''], hpcolor: HPColor): [number, number];
static getPixelRange(pixels: number, color: HPColor | ''): [number, number];
static getFormattedRange(range: [number, number], precision: number, separator: string): string;
reset(): void;
destroy(): void;
}
type WeatherState<T = ID> = [T, number, number];
type WeatherName = 'Sand' | 'Sun' | 'Rain' | 'Hail' | 'Snow' | 'Harsh Sunshine' | 'Heavy Rain' | 'Strong Winds';
type TerrainName = 'Electric' | 'Grassy' | 'Psychic' | 'Misty';
interface FieldConditionState {
id: ID;
minDuration: number;
maxDuration: number;
level?: number;
}
declare class Field {
readonly battle: Battle;
weather?: WeatherName;
weatherState: FieldConditionState;
terrain?: TerrainName;
terrainState: FieldConditionState;
pseudoWeather: {
[id: string]: FieldConditionState;
};
constructor(battle: Battle);
hasPseudoWeather(id: ID): boolean;
addPseudoWeather(id: ID, minDuration: number, maxDuration: number): void;
removePseudoWeather(id: ID): void;
setTerrain(id?: ID): void;
setWeather(id?: ID, poke?: Pokemon, isUpkeep?: boolean, ability?: {
name: string;
}): void;
reset(): void;
destroy(): void;
}
declare const NULL: {
name: string;
id: ID;
kind: DataKind;
};
type NA = typeof NULL;
declare class Battle {
readonly gens: Generations;
gen: Generation;
readonly field: Field;
readonly p1: Side;
readonly p2: Side;
readonly p3?: Side;
readonly p4?: Side;
readonly sides: [Side, Side] | [Side, Side, Side, Side];
turn: number;
gameType: GameType;
rated: boolean | Message;
rules: {
[ruleName: string]: 1 | 0;
};
tier: FormatName | '';
teamPreviewCount: number;
speciesClause: boolean;
kickingInactive: number | 'on-unknown' | 'off';
totalTimeLeft: number;
graceTimeLeft: number;
lastMove: ID | 'switch-in' | 'healing-wish';
request?: Protocol.Request;
requestStatus: 'inapplicable' | 'received' | 'applicable' | 'applied';
private readonly handler;
private readonly createSide;
constructor(gens: Generations, player?: ID | null, sets?: PokemonSet[] | Array<PokemonSet[] | undefined>, field?: (b: Battle) => Field, side?: (b: Battle, n: 0 | 1 | 2 | 3, s?: PokemonSet[]) => Side);
add(line: string): void;
add(args: ArgType, kwArgs: BattleArgsKWArgType): void;
update(): void;
private findPokemon;
private findIllusion;
get(type: 'abilities' | 'items' | 'moves' | 'species' | 'conditions', s?: string): _pkmn_data.Specie | {
name: string;
id: ID;
kind: DataKind;
} | _pkmn_data.Ability | _pkmn_data.Item | _pkmn_data.Move | _pkmn_data.Condition;
setTurn(turnNum: string | number): void;
upkeep(): void;
parsePokemonId(pokemonid: PokemonIdent | SideID): {
name: string;
siden: number;
slot: number;
pokemonid: Protocol.PokemonIdent | SideID;
};
getSwitchedPokemon(pokemonid: PokemonIdent | SideID, details: PokemonDetails): Pokemon;
getSwitchedOutPokemon(pokemonid: PokemonIdent, details: PokemonDetails): Pokemon | undefined;
rememberTeamPreviewPokemon(sideid: SideID, details: PokemonDetails): Pokemon;
getSide(sidename: string): Side;
swapSideConditions(): void;
getPokemon(pokemonid?: '' | 'null' | PokemonIdent | SideID): Pokemon | null;
checkActive(poke: Pokemon): boolean;
pokemonAt(side: SideID, slot: number): Protocol.PokemonIdent | undefined;
damagePercentage(ident: PokemonIdent, hpstring: PokemonHPStatus): string | undefined;
getPokemonTypeList(ident: PokemonIdent): _pkmn_data.TypeName[];
getPokemonSpeciesForme(ident: PokemonIdent): Protocol.SpeciesName;
currentWeather(): ID;
ngasActive(): boolean;
abilityActive(abilities: ID[]): boolean;
reset(): void;
destroy(): void;
}
export { Battle, CopySource, Field, ItemEffect, LastItemEffect, NA, NULL, Pokemon, Side, TerrainName, WeatherName, WeatherState };

22

package.json
{
"name": "@pkmn/client",
"version": "0.5.1",
"version": "0.6.0",
"description": "Client battle engine for Pokémon Showdown",
"repository": "github:pkmn/ps",
"license": "MIT",
"sideEffects": false,
"main": "build/index.js",
"module": "build/index.mjs",
"types": "build/index.d.ts",
"description": "Client battle engine for Pokémon Showdown",
"license": "MIT",
"publishConfig": {

@@ -12,13 +15,10 @@ "access": "public"

"files": [
"build",
"!build/test",
"src",
"!src/test"
"build"
],
"dependencies": {
"@pkmn/data": "^0.6.2",
"@pkmn/protocol": "^0.5.1"
"@pkmn/data": "^0.7.0",
"@pkmn/protocol": "^0.6.0"
},
"devDependencies": {
"@pkmn/dex": "^0.6.2"
"@pkmn/dex": "^0.7.0"
},

@@ -29,3 +29,3 @@ "scripts": {

"compile": "tsc -p .",
"build": "npm run compile",
"build": "npm run compile && node ../build src/index.ts",
"test": "jest",

@@ -32,0 +32,0 @@ "pretest": "npm run build",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc