pokemon-io-core 0.0.102 → 0.0.103

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.
@@ -7,6 +7,9 @@ export interface BaseBattleEvent {
7
7
  message: string;
8
8
  timestamp: number;
9
9
  }
10
+ export interface GenericBattleEvent extends BaseBattleEvent {
11
+ kind: Exclude<BattleEventKind, "stats_changed" | "action_declared" | "action_skipped_hard_cc" | "move_miss" | "move_hit" | "item_used" | "damage" | "heal" | "status_applied" | "fighter_switched" | "status_expired" | "status_tick" | "action_skipped_hard_cc" | "fighter_fainted" | "battle_end" | "random_event_effect" | "status_cleared">;
12
+ }
10
13
  export interface StatsChangedEvent extends BaseBattleEvent {
11
14
  kind: "stats_changed";
12
15
  targetId: FighterId;
@@ -24,6 +27,11 @@ export interface ActionDeclaredEvent extends BaseBattleEvent {
24
27
  kind: "action_declared";
25
28
  actorId: FighterId;
26
29
  }
30
+ export interface ActionSkippedHardCcEvent extends BaseBattleEvent {
31
+ kind: "action_skipped_hard_cc";
32
+ actorId: FighterId;
33
+ statusId: StatusId;
34
+ }
27
35
  export interface MoveMissEvent extends BaseBattleEvent {
28
36
  kind: "move_miss";
29
37
  actorId: FighterId;
@@ -77,6 +85,11 @@ export interface FighterSwitchedEvent extends BaseBattleEvent {
77
85
  remainingTurns: number;
78
86
  }[];
79
87
  }
88
+ export interface StatusClearedEvent extends BaseBattleEvent {
89
+ kind: "status_cleared";
90
+ targetId: FighterId;
91
+ statusIds: StatusId[];
92
+ }
80
93
  export interface StatusExpiredEvent extends BaseBattleEvent {
81
94
  kind: "status_expired";
82
95
  targetId: FighterId;
@@ -101,6 +114,7 @@ export interface RandomEventTriggeredEvent extends BaseBattleEvent {
101
114
  eventId: string;
102
115
  eventName: string;
103
116
  eventDescription: string;
117
+ narration?: string[];
104
118
  eventRarity: "common" | "rare" | "epic" | "legendary";
105
119
  imageUrl?: string;
106
120
  effects: Array<{
@@ -117,4 +131,4 @@ export interface RandomEventEffectEvent extends BaseBattleEvent {
117
131
  targetId: FighterId;
118
132
  effectType: string;
119
133
  }
120
- export type BattleEvent = ActionDeclaredEvent | MoveMissEvent | MoveHitEvent | ItemUsedEvent | DamageEvent | HealEvent | StatusAppliedEvent | StatusExpiredEvent | StatusTickEvent | FighterFaintedEvent | FighterSwitchedEvent | BattleEndEvent | StatsChangedEvent | RandomEventTriggeredEvent | RandomEventEffectEvent | BaseBattleEvent;
134
+ export type BattleEvent = ActionDeclaredEvent | ActionSkippedHardCcEvent | MoveMissEvent | MoveHitEvent | ItemUsedEvent | DamageEvent | HealEvent | StatusAppliedEvent | StatusClearedEvent | StatusExpiredEvent | StatusTickEvent | FighterFaintedEvent | FighterSwitchedEvent | BattleEndEvent | StatsChangedEvent | RandomEventTriggeredEvent | RandomEventEffectEvent | GenericBattleEvent;
@@ -20,6 +20,7 @@ export interface RandomEventDefinition {
20
20
  id: string;
21
21
  name: string;
22
22
  description: string;
23
+ narration?: string[];
23
24
  rarity: EventRarity;
24
25
  imageUrl?: string;
25
26
  effects: RandomEventEffect[];
@@ -9,6 +9,10 @@ export const CORE_RANDOM_EVENTS = [
9
9
  id: "fatigue",
10
10
  name: "💤 Cansancio General",
11
11
  description: "El cansancio afecta a ambos luchadores.",
12
+ narration: [
13
+ "El combate se alarga...",
14
+ "¡El cansancio empieza a afectar a los combatientes!",
15
+ ],
12
16
  rarity: "common",
13
17
  effects: [
14
18
  {
@@ -23,6 +27,7 @@ export const CORE_RANDOM_EVENTS = [
23
27
  id: "refreshing_breeze",
24
28
  name: "🍃 Brisa Refrescante",
25
29
  description: "Una suave brisa restaura la calma.",
30
+ narration: ["Una suave brisa recorre el campo de batalla...", "¡El ambiente se siente más tranquilo!"],
26
31
  rarity: "common",
27
32
  effects: [
28
33
  {
@@ -65,6 +70,12 @@ export const CORE_RANDOM_EVENTS = [
65
70
  id: "police_raid",
66
71
  name: "🚨 Redada Policial",
67
72
  description: "¡La policía confisca objetos sospechosos!",
73
+ narration: [
74
+ "¡SUENA UNA SIRENA A LO LEJOS!",
75
+ "🚨 ¡REDADA POLICIAL! 🚨",
76
+ "La policía entra en el estadio...",
77
+ "¡Están confiscando objetos sospechosos!",
78
+ ],
68
79
  rarity: "rare",
69
80
  effects: [
70
81
  {
@@ -57,7 +57,7 @@ export const applyDamageToFighter = (state, defender, amount, actorId, isCritica
57
57
  events.push({
58
58
  ...createBaseEvent(state.turnNumber, "status_cleared", `${defender.fighterId} se despierta por el golpe`),
59
59
  targetId: defender.fighterId,
60
- statusId: "sleep",
60
+ statusIds: ["sleep"],
61
61
  });
62
62
  }
63
63
  events.push({
@@ -6,17 +6,6 @@ const generateId = () => `evt_${Date.now()}_${Math.random().toString(36).substr(
6
6
  */
7
7
  export const applyRandomEvent = (state, event) => {
8
8
  const events = [];
9
- // Announce event trigger
10
- events.push({
11
- id: generateId(),
12
- turnNumber: state.turnNumber,
13
- kind: "random_event_triggered",
14
- eventId: event.id,
15
- eventName: event.name,
16
- eventDescription: event.description,
17
- message: `🎲 ${event.name}: ${event.description}`,
18
- timestamp: Date.now(),
19
- });
20
9
  let updatedState = state;
21
10
  // Apply each effect
22
11
  for (const effect of event.effects) {
@@ -1,4 +1,8 @@
1
1
  import { BattleEvent } from "../core/index.js";
2
- export declare const createBaseEvent: (turnNumber: number, kind: BattleEvent["kind"], message: string) => Omit<BattleEvent, "kind"> & {
3
- kind: typeof kind;
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;
4
8
  };
@@ -286,6 +286,7 @@ export const resolveTurn = (state, actions) => {
286
286
  eventId: randomEvent.id,
287
287
  eventName: randomEvent.name,
288
288
  eventDescription: randomEvent.description,
289
+ narration: randomEvent.narration,
289
290
  eventRarity: randomEvent.rarity,
290
291
  imageUrl: randomEvent.imageUrl,
291
292
  effects: randomEvent.effects.map((effect) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pokemon-io-core",
3
- "version": "0.0.102",
3
+ "version": "0.0.103",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",