pokemon-io-core 0.0.110 → 0.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/core/battleState.d.ts +1 -1
  2. package/dist/core/fighters.d.ts +1 -1
  3. package/dist/engine/actions/move.js +16 -9
  4. package/dist/engine/combat/damage.js +17 -11
  5. package/dist/engine/events/applyRandomEvent.js +1 -3
  6. package/dist/engine/fighters/fighter.js +1 -1
  7. package/dist/skins/cliches/fighters.js +18 -18
  8. package/dist/skins/pokemon/fighters.js +18 -18
  9. package/package.json +2 -2
  10. package/dist/api/battle.d.ts +0 -90
  11. package/dist/api/room.d.ts +0 -29
  12. package/dist/api/socketTypes.d.ts +0 -96
  13. package/dist/core/actions.d.ts +0 -22
  14. package/dist/core/amulets.d.ts +0 -18
  15. package/dist/core/battleRuntime.d.ts +0 -46
  16. package/dist/core/emotes.d.ts +0 -13
  17. package/dist/core/engine.d.ts +0 -53
  18. package/dist/core/engine.js +0 -1046
  19. package/dist/core/events.d.ts +0 -142
  20. package/dist/core/ids.d.ts +0 -6
  21. package/dist/core/index.d.ts +0 -16
  22. package/dist/core/items.d.ts +0 -12
  23. package/dist/core/moves.d.ts +0 -87
  24. package/dist/core/randomEvents.d.ts +0 -28
  25. package/dist/core/randomEventsList.d.ts +0 -11
  26. package/dist/core/status.d.ts +0 -11
  27. package/dist/core/types.d.ts +0 -14
  28. package/dist/engine/actions/forcedSwitch.d.ts +0 -5
  29. package/dist/engine/actions/index.d.ts +0 -5
  30. package/dist/engine/actions/item.d.ts +0 -6
  31. package/dist/engine/actions/move.d.ts +0 -7
  32. package/dist/engine/actions/priority.d.ts +0 -6
  33. package/dist/engine/actions/switch.d.ts +0 -6
  34. package/dist/engine/combat/crit.d.ts +0 -2
  35. package/dist/engine/combat/damage.d.ts +0 -20
  36. package/dist/engine/combat/heal.d.ts +0 -6
  37. package/dist/engine/combat/index.d.ts +0 -5
  38. package/dist/engine/combat/stages.d.ts +0 -5
  39. package/dist/engine/combat/typeEffectiveness.d.ts +0 -3
  40. package/dist/engine/combat/winner.d.ts +0 -2
  41. package/dist/engine/debug.d.ts +0 -1
  42. package/dist/engine/effects/applyEffects.d.ts +0 -7
  43. package/dist/engine/effects/index.d.ts +0 -2
  44. package/dist/engine/effects/target.d.ts +0 -6
  45. package/dist/engine/engine.d.ts +0 -53
  46. package/dist/engine/engine.js +0 -1046
  47. package/dist/engine/events/applyRandomEvent.d.ts +0 -11
  48. package/dist/engine/events/index.d.ts +0 -2
  49. package/dist/engine/events/randomEventTrigger.d.ts +0 -16
  50. package/dist/engine/events.d.ts +0 -8
  51. package/dist/engine/fighters/fighter.d.ts +0 -4
  52. package/dist/engine/fighters/index.d.ts +0 -3
  53. package/dist/engine/fighters/selectors.d.ts +0 -13
  54. package/dist/engine/fighters/update.d.ts +0 -3
  55. package/dist/engine/index.d.ts +0 -12
  56. package/dist/engine/pokemonBattleService.d.ts +0 -6
  57. package/dist/engine/pokemonBattleService.js +0 -32
  58. package/dist/engine/rng.d.ts +0 -2
  59. package/dist/engine/rules.d.ts +0 -6
  60. package/dist/engine/runtime.d.ts +0 -7
  61. package/dist/engine/status/apply.d.ts +0 -6
  62. package/dist/engine/status/clear.d.ts +0 -6
  63. package/dist/engine/status/endOfTurn.d.ts +0 -6
  64. package/dist/engine/status/hardCc.d.ts +0 -3
  65. package/dist/engine/status/index.d.ts +0 -4
  66. package/dist/engine/turn/index.d.ts +0 -1
  67. package/dist/engine/turn/index.js +0 -1
  68. package/dist/engine/turn/resolveTurn.d.ts +0 -5
  69. package/dist/index.d.ts +0 -6
  70. package/dist/skins/CombatSkin.d.ts +0 -21
  71. package/dist/skins/cliches/clicheSkin.d.ts +0 -14
  72. package/dist/skins/cliches/fighters.d.ts +0 -2
  73. package/dist/skins/cliches/index.d.ts +0 -5
  74. package/dist/skins/cliches/items.d.ts +0 -2
  75. package/dist/skins/cliches/moves.d.ts +0 -2
  76. package/dist/skins/cliches/statuses.d.ts +0 -2
  77. package/dist/skins/cliches/types.d.ts +0 -13
  78. package/dist/skins/index.d.ts +0 -3
  79. package/dist/skins/pokemon/data/pokemon-moves.json +0 -609
  80. package/dist/skins/pokemon/fighters.d.ts +0 -2
  81. package/dist/skins/pokemon/index.d.ts +0 -6
  82. package/dist/skins/pokemon/items.d.ts +0 -2
  83. package/dist/skins/pokemon/moves.d.ts +0 -2
  84. package/dist/skins/pokemon/pokemonSkin.d.ts +0 -14
  85. package/dist/skins/pokemon/statuses.d.ts +0 -2
  86. package/dist/skins/pokemon/types.d.ts +0 -13
@@ -1,11 +0,0 @@
1
- import type { RandomEventDefinition } from "../../core/randomEvents.js";
2
- import type { BattleState } from "../../core/battleState.js";
3
- import type { BattleEvent } from "../../core/events.js";
4
- /**
5
- * Apply a random event to the battle state
6
- * Follows Single Responsibility - only handles event application
7
- */
8
- export declare const applyRandomEvent: (state: BattleState, event: RandomEventDefinition) => {
9
- state: BattleState;
10
- events: BattleEvent[];
11
- };
@@ -1,2 +0,0 @@
1
- export * from "./randomEventTrigger.js";
2
- export * from "./applyRandomEvent.js";
@@ -1,16 +0,0 @@
1
- import { type RandomEventDefinition } from "../../core/randomEvents.js";
2
- /**
3
- * Determina si debe dispararse un evento aleatorio en este turno
4
- *
5
- * @param turnNumber - Número del turno actual
6
- * @returns true si debe ocurrir un evento
7
- */
8
- export declare function shouldTriggerRandomEvent(turnNumber: number): boolean;
9
- /**
10
- * Selecciona un evento aleatorio basado en los pesos de rareza
11
- * Usa "weighted random selection" para dar más probabilidad a eventos comunes
12
- *
13
- * @param events - Array de eventos disponibles
14
- * @returns Evento seleccionado
15
- */
16
- export declare function selectRandomEvent(events: RandomEventDefinition[]): RandomEventDefinition;
@@ -1,8 +0,0 @@
1
- import { BattleEvent } from "../core/index.js";
2
- export declare const createBaseEvent: <K extends BattleEvent["kind"]>(turnNumber: number, kind: K, message: string) => {
3
- id: string;
4
- turnNumber: number;
5
- kind: K;
6
- message: string;
7
- timestamp: number;
8
- };
@@ -1,4 +0,0 @@
1
- import { BattleFighter } from "../../core/index.js";
2
- import { PlayerFighterBattleConfig, RuntimeBattleState } from "../rules.js";
3
- export declare const createBattleFighter: (cfg: PlayerFighterBattleConfig) => BattleFighter;
4
- export declare const recomputeEffectiveStatsForFighter: (state: RuntimeBattleState, fighter: BattleFighter) => BattleFighter;
@@ -1,3 +0,0 @@
1
- export * from './fighter.js';
2
- export * from './selectors.js';
3
- export * from './update.js';
@@ -1,13 +0,0 @@
1
- import { BattleFighter, PlayerBattleState } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const getActiveFighter: (player: PlayerBattleState) => BattleFighter;
4
- export declare const getOpponentAndSelf: (state: RuntimeBattleState, playerKey: "player1" | "player2") => {
5
- self: BattleFighter;
6
- opponent: BattleFighter;
7
- };
8
- export declare const getPlayersAndActives: (state: RuntimeBattleState, playerKey: "player1" | "player2") => {
9
- selfPlayer: PlayerBattleState;
10
- oppPlayer: PlayerBattleState;
11
- self: BattleFighter;
12
- opponent: BattleFighter;
13
- };
@@ -1,3 +0,0 @@
1
- import { BattleFighter } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const updateFightersInState: (state: RuntimeBattleState, actingPlayerKey: "player1" | "player2", updatedSelf: BattleFighter, updatedOpponent: BattleFighter) => RuntimeBattleState;
@@ -1,12 +0,0 @@
1
- export * from './debug.js';
2
- export * from './events.js';
3
- export * from './rng.js';
4
- export * from './rules.js';
5
- export * from './runtime.js';
6
- export * from './actions/index.js';
7
- export * from './combat/index.js';
8
- export * from './effects/index.js';
9
- export * from './fighters/index.js';
10
- export * from './status/index.js';
11
- export * from './turn/index.js';
12
- export * from './events/index.js';
@@ -1,6 +0,0 @@
1
- import { BattleActions, BattleState } from "../core/index.js";
2
- export declare const createPokemonBattle: (fighter1Id: string, fighter2Id: string) => BattleState;
3
- export declare const runPokemonTurn: (state: BattleState, actions: BattleActions) => {
4
- newState: BattleState;
5
- events: import("../index.js").BattleEvent[];
6
- };
@@ -1,32 +0,0 @@
1
- import { POKEMON_FIGHTERS, POKEMON_MOVES, POKEMON_TYPE_MATRIX, POKEMON_TYPES, } from "../skins/pokemon";
2
- import { createInitialBattleState, resolveTurn, } from "../core/engine.js";
3
- const findPokemon = (id) => POKEMON_FIGHTERS.find((p) => p.id === id);
4
- const findMove = (id) => POKEMON_MOVES.find((m) => m.id === id);
5
- export const createPokemonBattle = (fighter1Id, fighter2Id) => {
6
- const f1 = findPokemon(fighter1Id);
7
- const f2 = findPokemon(fighter2Id);
8
- const config = {
9
- types: POKEMON_TYPES,
10
- typeEffectiveness: POKEMON_TYPE_MATRIX,
11
- moves: POKEMON_MOVES,
12
- items: [], // MVP: sin items
13
- amulets: [],
14
- statuses: [],
15
- player1: {
16
- fighter: f1,
17
- maxHp: f1.baseStats.defense + f1.baseStats.offense,
18
- moves: POKEMON_MOVES.filter((m) => (f1.recommendedMoves ?? []).includes(m.id)),
19
- items: [],
20
- amulet: null,
21
- },
22
- player2: {
23
- fighter: f2,
24
- maxHp: f2.baseStats.defense + f1.baseStats.offense,
25
- moves: POKEMON_MOVES.filter((m) => (f2.recommendedMoves ?? []).includes(m.id)),
26
- items: [],
27
- amulet: null,
28
- },
29
- };
30
- return createInitialBattleState(config);
31
- };
32
- export const runPokemonTurn = (state, actions) => resolveTurn(state, actions);
@@ -1,2 +0,0 @@
1
- export declare const randomInRange: (min: number, max: number) => number;
2
- export declare const chance: (probability: number) => boolean;
@@ -1,6 +0,0 @@
1
- import { BattleState, BattleRules, BattleRuntime } from "../core/index.js";
2
- export type { BattleRules, BattleRuntime, BattleConfig, PlayerBattleConfig, PlayerFighterBattleConfig, } from "../core/index.js";
3
- export interface RuntimeBattleState extends BattleState {
4
- runtime: BattleRuntime;
5
- }
6
- export declare const DEFAULT_RULES: BattleRules;
@@ -1,7 +0,0 @@
1
- import { BattleState, FighterStats } from "../core/index.js";
2
- import { BattleConfig } from "./rules.js";
3
- export declare const buildMap: <T extends {
4
- id: string;
5
- }>(list: T[]) => Record<string, T>;
6
- export declare const cloneStats: (stats: FighterStats) => FighterStats;
7
- export declare const createInitialBattleState: (config: BattleConfig) => BattleState;
@@ -1,6 +0,0 @@
1
- import { BattleEvent, BattleFighter, StatusId } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const applyStatusToFighter: (state: RuntimeBattleState, target: BattleFighter, statusId: StatusId) => {
4
- updated: BattleFighter;
5
- events: BattleEvent[];
6
- };
@@ -1,6 +0,0 @@
1
- import { BattleEvent, BattleFighter, ClearStatusEffect } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const clearStatusFromFighter: (state: RuntimeBattleState, target: BattleFighter, effect: ClearStatusEffect) => {
4
- updated: BattleFighter;
5
- events: BattleEvent[];
6
- };
@@ -1,6 +0,0 @@
1
- import { BattleEvent } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const applyEndOfTurnStatuses: (state: RuntimeBattleState) => {
4
- state: RuntimeBattleState;
5
- events: BattleEvent[];
6
- };
@@ -1,3 +0,0 @@
1
- import { BattleFighter } from "../../core/index.js";
2
- import { RuntimeBattleState } from "../rules.js";
3
- export declare const hasHardCc: (state: RuntimeBattleState, fighter: BattleFighter) => boolean;
@@ -1,4 +0,0 @@
1
- export * from './apply.js';
2
- export * from './clear.js';
3
- export * from './endOfTurn.js';
4
- export * from './hardCc.js';
@@ -1 +0,0 @@
1
- export * from './resolveTurn.js';
@@ -1 +0,0 @@
1
- export * from './resolveTurn.js';
@@ -1,5 +0,0 @@
1
- import { BattleActions, BattleEvent, BattleState } from "../../core/index.js";
2
- export declare const resolveTurn: (state: BattleState, actions: BattleActions) => {
3
- newState: BattleState;
4
- events: BattleEvent[];
5
- };
package/dist/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from "./core/index.js";
2
- export * from "./api/battle.js";
3
- export * from "./api/room.js";
4
- export * from "./api/socketTypes.js";
5
- export * from "./skins/CombatSkin.js";
6
- export * from "./engine/index.js";
@@ -1,21 +0,0 @@
1
- import type { TypeDefinition, TypeEffectivenessMatrix, MoveDefinition, ItemDefinition, AmuletDefinition, StatusDefinition } from "../core/index.js";
2
- import { PlayerBattleConfig } from "../engine/rules.js";
3
- export interface TeamFighterLoadout {
4
- fighterId: string | null;
5
- moveIds: string[];
6
- }
7
- export interface PlayerTeamLoadout {
8
- fighters: TeamFighterLoadout[];
9
- itemIds: string[];
10
- amuletId: string | null;
11
- }
12
- export interface CombatSkin {
13
- readonly id: string;
14
- getTypes(): TypeDefinition[];
15
- getTypeEffectiveness(): TypeEffectivenessMatrix;
16
- getMoves(): MoveDefinition[];
17
- getItems(): ItemDefinition[];
18
- getAmulets(): AmuletDefinition[];
19
- getStatuses(): StatusDefinition[];
20
- buildPlayerConfig(loadout: PlayerTeamLoadout): PlayerBattleConfig;
21
- }
@@ -1,14 +0,0 @@
1
- import { ItemDefinition, MoveDefinition } from "../../core/index.js";
2
- import { PlayerBattleConfig } from "../../engine/rules.js";
3
- import type { CombatSkin, PlayerTeamLoadout } from "../CombatSkin.js";
4
- export declare class TribeSkin implements CombatSkin {
5
- readonly id = "tribe";
6
- getTypes(): import("../../index.js").TypeDefinition[];
7
- getTypeEffectiveness(): import("../../index.js").TypeEffectivenessMatrix;
8
- getMoves(): MoveDefinition[];
9
- getItems(): ItemDefinition[];
10
- getAmulets(): never[];
11
- getStatuses(): import("../../index.js").StatusDefinition[];
12
- buildPlayerConfig(loadout: PlayerTeamLoadout): PlayerBattleConfig;
13
- }
14
- export declare const createTribeSkin: () => CombatSkin;
@@ -1,2 +0,0 @@
1
- import type { FighterDefinition } from "../../core/index.js";
2
- export declare const TRIBE_FIGHTERS: FighterDefinition[];
@@ -1,5 +0,0 @@
1
- export * from "./fighters.js";
2
- export * from "./moves.js";
3
- export * from "./clicheSkin.js";
4
- export * from "./statuses.js";
5
- export * from "./types.js";
@@ -1,2 +0,0 @@
1
- import { ItemDefinition } from "../../core/index.js";
2
- export declare const POKEMON_ITEMS: ItemDefinition[];
@@ -1,2 +0,0 @@
1
- import type { MoveDefinition } from "../../core/index.js";
2
- export declare const TRIBE_MOVES: MoveDefinition[];
@@ -1,2 +0,0 @@
1
- import type { StatusDefinition } from "../../core/index.js";
2
- export declare const TRIBE_STATUSES: StatusDefinition[];
@@ -1,13 +0,0 @@
1
- import type { TypeDefinition, TypeEffectivenessMatrix, TypeId } from "../../core/index.js";
2
- export declare const TRIBE_TYPE_IDS: {
3
- readonly canallita: "canallita";
4
- readonly cayetano: "cayetano";
5
- readonly perroflauta: "perroflauta";
6
- readonly cryptobro: "cryptobro";
7
- readonly cunado: "cunado";
8
- readonly gymbro: "gymbro";
9
- };
10
- export type TribeTypeId = (typeof TRIBE_TYPE_IDS)[keyof typeof TRIBE_TYPE_IDS];
11
- export declare const TRIBE_TYPES: TypeDefinition[];
12
- export declare const TRIBE_TYPE_MATRIX: TypeEffectivenessMatrix;
13
- export declare const getTribeTypeEffectiveness: (attackerTypeId: TypeId, defenderTypeId: TypeId) => number;
@@ -1,3 +0,0 @@
1
- export * from "./pokemon/index.js";
2
- export * from "./cliches/index.js";
3
- export * from "./CombatSkin.js";