pokemon-io-core 0.0.9 → 0.0.11

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.
@@ -3,6 +3,8 @@ import type { FighterStats } from "./types";
3
3
  export interface FighterDefinition {
4
4
  id: FighterId;
5
5
  name: string;
6
+ description?: string;
7
+ img?: string;
6
8
  classId: TypeId;
7
9
  baseStats: FighterStats;
8
10
  recommendedMoves?: MoveId[];
@@ -9,6 +9,8 @@ export const POKEMON_FIGHTERS = [
9
9
  {
10
10
  id: "pikachu",
11
11
  name: "Pikachu",
12
+ description: "Rápido y agresivo, castiga con críticos frecuentes.",
13
+ img: '/pikachu.png',
12
14
  classId: POKEMON_TYPE_IDS.electric,
13
15
  baseStats: makeStats(55, 40, 90, 15),
14
16
  recommendedMoves: ["tackle", "thunder_shock"]
@@ -16,6 +18,8 @@ export const POKEMON_FIGHTERS = [
16
18
  {
17
19
  id: "charizard",
18
20
  name: "Charizard",
21
+ description: "Burst de fuego muy alto, algo frágil.",
22
+ img: '/charizard.png',
19
23
  classId: POKEMON_TYPE_IDS.fire,
20
24
  baseStats: makeStats(84, 78, 100, 10),
21
25
  recommendedMoves: ["tackle", "ember"]
@@ -23,6 +27,8 @@ export const POKEMON_FIGHTERS = [
23
27
  {
24
28
  id: "blastoise",
25
29
  name: "Blastoise",
30
+ description: "Tanque defensivo con presión constante de agua.",
31
+ img: '/blastoise.png',
26
32
  classId: POKEMON_TYPE_IDS.water,
27
33
  baseStats: makeStats(83, 100, 78, 8),
28
34
  recommendedMoves: ["tackle", "water_gun"]
@@ -30,6 +36,8 @@ export const POKEMON_FIGHTERS = [
30
36
  {
31
37
  id: "venusaur",
32
38
  name: "Venusaur",
39
+ description: "Juego de desgaste con grandes golpes de hierba.",
40
+ img: '/venusaur.png',
33
41
  classId: POKEMON_TYPE_IDS.grass,
34
42
  baseStats: makeStats(82, 83, 80, 8),
35
43
  recommendedMoves: ["tackle", "vine_whip"]
@@ -2,3 +2,4 @@ export * from "./types.js";
2
2
  export * from "./moves.js";
3
3
  export * from "./fighters.js";
4
4
  export * from "./pokemonSkin.js";
5
+ export * from "./items.js";
@@ -2,3 +2,4 @@ export * from "./types.js";
2
2
  export * from "./moves.js";
3
3
  export * from "./fighters.js";
4
4
  export * from "./pokemonSkin.js";
5
+ export * from "./items.js";
@@ -0,0 +1,2 @@
1
+ import { ItemDefinition } from "../../core";
2
+ export declare const POKEMON_ITEMS: ItemDefinition[];
@@ -0,0 +1,51 @@
1
+ // Para MVP: 4 objetos simples
2
+ export const POKEMON_ITEMS = [
3
+ {
4
+ id: "potion",
5
+ name: "Poción",
6
+ category: "heal_shield",
7
+ maxUses: 2,
8
+ effects: [
9
+ {
10
+ kind: "heal", // tu EffectDefinition debe tener esto
11
+ amount: 30
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ id: "super_potion",
17
+ name: "Super Poción",
18
+ category: "heal_shield",
19
+ maxUses: 1,
20
+ effects: [
21
+ {
22
+ kind: "heal",
23
+ amount: 60
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ id: "bomb",
29
+ name: "Bomba",
30
+ category: "damage",
31
+ maxUses: 1,
32
+ effects: [
33
+ {
34
+ kind: "damage",
35
+ powerMultiplier: 1.5
36
+ }
37
+ ]
38
+ },
39
+ {
40
+ id: "guard_charm",
41
+ name: "Amuleto de Guardia",
42
+ category: "status_buff",
43
+ maxUses: 1,
44
+ effects: [
45
+ {
46
+ kind: "apply_status",
47
+ statusId: "guard"
48
+ }
49
+ ]
50
+ }
51
+ ];
@@ -1,14 +1,13 @@
1
+ import { ItemDefinition, MoveDefinition, PlayerBattleConfig } from "../../core";
1
2
  import type { CombatSkin, FighterLoadout } from "../CombatSkin";
2
- import type { MoveDefinition, ItemDefinition, AmuletDefinition, StatusDefinition } from "../../core";
3
- import type { PlayerBattleConfig } from "../../core/engine";
4
3
  export declare class PokemonSkin implements CombatSkin {
5
4
  readonly id = "pokemon";
6
5
  getTypes(): import("../..").TypeDefinition[];
7
6
  getTypeEffectiveness(): import("../..").TypeEffectivenessMatrix;
8
7
  getMoves(): MoveDefinition[];
9
8
  getItems(): ItemDefinition[];
10
- getAmulets(): AmuletDefinition[];
11
- getStatuses(): StatusDefinition[];
9
+ getAmulets(): never[];
10
+ getStatuses(): never[];
12
11
  buildPlayerConfig(loadout: FighterLoadout): PlayerBattleConfig;
13
12
  }
14
13
  export declare const createPokemonSkin: () => CombatSkin;
@@ -1,7 +1,7 @@
1
- // src/skins/pokemon/pokemonSkin.ts
2
- import { POKEMON_TYPES, POKEMON_TYPE_MATRIX, POKEMON_MOVES, POKEMON_FIGHTERS } from "./index";
1
+ // pokemon-io-core/src/skins/pokemon/pokemonSkin.ts
2
+ import { POKEMON_TYPES, POKEMON_TYPE_MATRIX, POKEMON_MOVES, POKEMON_FIGHTERS, POKEMON_ITEMS } from "./index";
3
3
  const MAX_HP_DEFAULT = 100;
4
- // Helpers locales
4
+ // --- helpers ---
5
5
  const findPokemonById = (id) => {
6
6
  const lower = id.toLowerCase();
7
7
  return (POKEMON_FIGHTERS.find((f) => f.id.toLowerCase() === lower || f.name.toLowerCase() === lower) ?? null);
@@ -9,19 +9,19 @@ const findPokemonById = (id) => {
9
9
  const findMoveById = (id) => {
10
10
  return POKEMON_MOVES.find((m) => m.id === id) ?? null;
11
11
  };
12
+ const findItemById = (id) => {
13
+ return POKEMON_ITEMS.find((i) => i.id === id) ?? null;
14
+ };
12
15
  const FILLER_MOVE_ID = "tackle";
13
16
  const buildMovesFromLoadout = (fighter, loadout) => {
14
- // 1) si el jugador ha elegido moveIds, intentamos respetarlos
15
17
  const selectedMoveIds = loadout.moveIds ?? [];
16
18
  const selectedMoves = selectedMoveIds
17
19
  .map((id) => findMoveById(id))
18
20
  .filter((m) => m !== null);
19
- // 2) si ya hay 4 válidos → nos quedamos con los primeros 4
20
21
  if (selectedMoves.length >= 4) {
21
22
  return selectedMoves.slice(0, 4);
22
23
  }
23
24
  const result = [...selectedMoves];
24
- // 3) completamos con recommendedMoves del fighter
25
25
  const recommendedIds = fighter.recommendedMoves ?? [];
26
26
  for (const recId of recommendedIds) {
27
27
  if (result.length >= 4)
@@ -31,22 +31,27 @@ const buildMovesFromLoadout = (fighter, loadout) => {
31
31
  result.push(move);
32
32
  }
33
33
  }
34
- // 4) si sigue faltando, rellenamos con "tackle"
35
34
  const filler = findMoveById(FILLER_MOVE_ID);
36
35
  while (result.length < 4 && filler) {
37
36
  result.push(filler);
38
37
  }
39
- // Garantizamos que haya al menos 1 movimiento
40
38
  if (result.length === 0 && filler) {
41
39
  result.push(filler);
42
40
  }
43
- // Cortamos por si acaso
44
41
  return result.slice(0, 4);
45
42
  };
46
- // De momento no tenemos objetos / amuletos / estados modelados para Pokémon
47
- const POKEMON_ITEMS = [];
48
- const POKEMON_AMULETS = [];
49
- const POKEMON_STATUSES = [];
43
+ const buildItemsFromLoadout = (loadout) => {
44
+ const selectedItemIds = loadout.itemIds ?? [];
45
+ const selectedItems = selectedItemIds
46
+ .map((id) => findItemById(id))
47
+ .filter((i) => i !== null);
48
+ // Si tu motor sigue exigiendo 4 items, puedes rellenar aquí:
49
+ // while (selectedItems.length < 4 && POKEMON_ITEMS[selectedItems.length]) {
50
+ // selectedItems.push(POKEMON_ITEMS[selectedItems.length]);
51
+ // }
52
+ return selectedItems;
53
+ };
54
+ // --- skin ---
50
55
  export class PokemonSkin {
51
56
  id = "pokemon";
52
57
  getTypes() {
@@ -62,10 +67,10 @@ export class PokemonSkin {
62
67
  return POKEMON_ITEMS;
63
68
  }
64
69
  getAmulets() {
65
- return POKEMON_AMULETS;
70
+ return []; // más adelante
66
71
  }
67
72
  getStatuses() {
68
- return POKEMON_STATUSES;
73
+ return []; // más adelante
69
74
  }
70
75
  buildPlayerConfig(loadout) {
71
76
  if (!loadout.fighterId) {
@@ -76,17 +81,16 @@ export class PokemonSkin {
76
81
  throw new Error(`Unknown fighterId for Pokemon skin: ${loadout.fighterId}`);
77
82
  }
78
83
  const moves = buildMovesFromLoadout(fighter, loadout);
79
- // Importante: aquí aún no aplicamos items/amuletos, pero dejamos el contrato listo
84
+ const items = buildItemsFromLoadout(loadout);
80
85
  return {
81
86
  fighter,
82
87
  maxHp: MAX_HP_DEFAULT,
83
88
  moves,
84
- items: [], // Más adelante: mapear loadout.itemIds -> ItemDefinition[]
85
- amulet: null // Más adelante: loadout.amuletId -> AmuletDefinition
89
+ items,
90
+ amulet: null
86
91
  };
87
92
  }
88
93
  }
89
- // Helper para crear la skin (así importas siempre una factoría)
90
94
  export const createPokemonSkin = () => {
91
95
  return new PokemonSkin();
92
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pokemon-io-core",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",