pokemon-io-core 0.0.29 → 0.0.31

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.
@@ -189,6 +189,12 @@ const applyDamageToFighter = (state, defender, amount, actorId, isCritical) => {
189
189
  // ------------------------------------------------------
190
190
  const applyStatusToFighter = (state, target, statusId) => {
191
191
  const def = state.runtime.statusesById[statusId];
192
+ dbg("APPLY_STATUS_FN", {
193
+ targetId: target.fighterId,
194
+ statusId,
195
+ hasDef: !!def,
196
+ currentStatuses: target.statuses,
197
+ });
192
198
  if (!def)
193
199
  return { updated: target, events: [] };
194
200
  const events = [];
@@ -334,12 +340,31 @@ const resolveEffectTarget = (eff, actor, target) => {
334
340
  // Motor de efectos genérico (move + item)
335
341
  // ------------------------------------------------------
336
342
  const applyEffectsOnTarget = (state, actor, target, moveTypeId, isCritical, effects) => {
343
+ dbg("applyEffectsOnTarget", {
344
+ actorId: actor.fighterId,
345
+ targetId: target.fighterId,
346
+ moveTypeId,
347
+ isCritical,
348
+ effects,
349
+ });
337
350
  let currentActor = actor;
338
351
  let currentTarget = target;
339
352
  const events = [];
353
+ dbg("APPLY_EFFECTS_START", {
354
+ actorId: actor.fighterId,
355
+ targetId: target.fighterId,
356
+ moveTypeId,
357
+ isCritical,
358
+ effectsCount: effects?.length ?? 0,
359
+ });
340
360
  for (const eff of effects) {
361
+ dbg("EFFECT_LOOP", eff);
341
362
  switch (eff.kind) {
342
363
  case "heal": {
364
+ dbg("EFFECT_HEAL_START", {
365
+ amount: eff.amount,
366
+ targetDefault: eff.target,
367
+ });
343
368
  const { primary, isSelf } = resolveEffectTarget(eff, currentActor, currentTarget);
344
369
  const res = applyHealToFighter(state, primary, eff.amount, actor.fighterId);
345
370
  if (isSelf)
@@ -350,6 +375,10 @@ const applyEffectsOnTarget = (state, actor, target, moveTypeId, isCritical, effe
350
375
  break;
351
376
  }
352
377
  case "apply_status": {
378
+ dbg("EFFECT_APPLY_STATUS_START", {
379
+ statusId: eff.statusId,
380
+ targetDefault: eff.target,
381
+ });
353
382
  const { primary, isSelf } = resolveEffectTarget(eff, currentActor, currentTarget);
354
383
  const res = applyStatusToFighter(state, primary, eff.statusId);
355
384
  if (isSelf)
@@ -360,6 +389,7 @@ const applyEffectsOnTarget = (state, actor, target, moveTypeId, isCritical, effe
360
389
  break;
361
390
  }
362
391
  case "clear_status": {
392
+ dbg("debemos eliminar status");
363
393
  const { primary, isSelf } = resolveEffectTarget(eff, currentActor, currentTarget);
364
394
  const res = clearStatusFromFighter(state, primary, eff);
365
395
  if (isSelf)
@@ -370,6 +400,7 @@ const applyEffectsOnTarget = (state, actor, target, moveTypeId, isCritical, effe
370
400
  break;
371
401
  }
372
402
  case "damage": {
403
+ dbg("debemos hacer daño");
373
404
  const { primary, isSelf } = resolveEffectTarget(eff, currentActor, currentTarget);
374
405
  let totalDamage = 0;
375
406
  // Daño de fórmula (stats + tipo + crit…)
@@ -507,6 +538,11 @@ const resolveDamageMove = (state, playerKey, action) => {
507
538
  isCritical,
508
539
  effectiveness,
509
540
  });
541
+ dbg("MOVE_EFFECTS", {
542
+ moveId: move.id,
543
+ moveName: move.name,
544
+ effects: move.effects,
545
+ });
510
546
  // Todos los efectos (daño, aplicar estado, curas, etc.)
511
547
  const { actor: finalSelf, target: finalOpp, events: extraEvents, } = applyEffectsOnTarget(state, updatedSelf, updatedOpponent, move.typeId, isCritical, move.effects);
512
548
  events.push(...extraEvents);
@@ -7,7 +7,7 @@ export declare class PokemonSkin implements CombatSkin {
7
7
  getMoves(): MoveDefinition[];
8
8
  getItems(): ItemDefinition[];
9
9
  getAmulets(): never[];
10
- getStatuses(): never[];
10
+ getStatuses(): import("../..").StatusDefinition[];
11
11
  buildPlayerConfig(loadout: FighterLoadout): PlayerBattleConfig;
12
12
  }
13
13
  export declare const createPokemonSkin: () => CombatSkin;
@@ -1,5 +1,5 @@
1
1
  // pokemon-io-core/src/skins/pokemon/pokemonSkin.ts
2
- import { POKEMON_TYPES, POKEMON_TYPE_MATRIX, POKEMON_MOVES, POKEMON_FIGHTERS, POKEMON_ITEMS } from "./index";
2
+ import { POKEMON_TYPES, POKEMON_TYPE_MATRIX, POKEMON_MOVES, POKEMON_FIGHTERS, POKEMON_ITEMS, POKEMON_STATUSES } from "./index";
3
3
  const MAX_HP_DEFAULT = 100;
4
4
  // --- helpers ---
5
5
  const findPokemonById = (id) => {
@@ -70,7 +70,7 @@ export class PokemonSkin {
70
70
  return []; // más adelante
71
71
  }
72
72
  getStatuses() {
73
- return []; // más adelante
73
+ return POKEMON_STATUSES; // más adelante
74
74
  }
75
75
  buildPlayerConfig(loadout) {
76
76
  if (!loadout.fighterId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pokemon-io-core",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",