pokemon-io-core 0.0.115 → 0.0.117
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.
- package/dist/api/battle.d.ts +90 -0
- package/dist/api/room.d.ts +29 -0
- package/dist/api/socketTypes.d.ts +96 -0
- package/dist/core/actions.d.ts +22 -0
- package/dist/core/amulets.d.ts +18 -0
- package/dist/core/battleRuntime.d.ts +46 -0
- package/dist/core/emotes.d.ts +13 -0
- package/dist/core/events.d.ts +142 -0
- package/dist/core/ids.d.ts +6 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/items.d.ts +12 -0
- package/dist/core/moves.d.ts +87 -0
- package/dist/core/randomEvents.d.ts +28 -0
- package/dist/core/randomEventsList.d.ts +11 -0
- package/dist/core/status.d.ts +11 -0
- package/dist/core/types.d.ts +14 -0
- package/dist/engine/actions/forcedSwitch.d.ts +5 -0
- package/dist/engine/actions/index.d.ts +5 -0
- package/dist/engine/actions/item.d.ts +6 -0
- package/dist/engine/actions/move.d.ts +7 -0
- package/dist/engine/actions/priority.d.ts +6 -0
- package/dist/engine/actions/switch.d.ts +6 -0
- package/dist/engine/combat/crit.d.ts +2 -0
- package/dist/engine/combat/damage.d.ts +20 -0
- package/dist/engine/combat/heal.d.ts +6 -0
- package/dist/engine/combat/index.d.ts +5 -0
- package/dist/engine/combat/stages.d.ts +5 -0
- package/dist/engine/combat/typeEffectiveness.d.ts +3 -0
- package/dist/engine/combat/winner.d.ts +2 -0
- package/dist/engine/debug.d.ts +1 -0
- package/dist/engine/effects/applyEffects.d.ts +7 -0
- package/dist/engine/effects/index.d.ts +2 -0
- package/dist/engine/effects/target.d.ts +6 -0
- package/dist/engine/events/applyRandomEvent.d.ts +11 -0
- package/dist/engine/events/index.d.ts +2 -0
- package/dist/engine/events/randomEventTrigger.d.ts +16 -0
- package/dist/engine/events.d.ts +8 -0
- package/dist/engine/fighters/fighter.d.ts +4 -0
- package/dist/engine/fighters/index.d.ts +3 -0
- package/dist/engine/fighters/selectors.d.ts +13 -0
- package/dist/engine/fighters/update.d.ts +3 -0
- package/dist/engine/index.d.ts +12 -0
- package/dist/engine/index.js +1 -1
- package/dist/engine/rng.d.ts +2 -0
- package/dist/engine/rules.d.ts +6 -0
- package/dist/engine/runtime.d.ts +7 -0
- package/dist/engine/status/apply.d.ts +6 -0
- package/dist/engine/status/clear.d.ts +6 -0
- package/dist/engine/status/endOfTurn.d.ts +6 -0
- package/dist/engine/status/hardCc.d.ts +3 -0
- package/dist/engine/status/index.d.ts +4 -0
- package/dist/engine/turn/resolveTurn.d.ts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/skins/CombatSkin.d.ts +21 -0
- package/dist/skins/cliches/clicheSkin.d.ts +14 -0
- package/dist/skins/cliches/fighters.d.ts +2 -0
- package/dist/skins/cliches/index.d.ts +5 -0
- package/dist/skins/cliches/items.d.ts +2 -0
- package/dist/skins/cliches/moves.d.ts +2 -0
- package/dist/skins/cliches/statuses.d.ts +2 -0
- package/dist/skins/cliches/types.d.ts +13 -0
- package/dist/skins/index.d.ts +3 -0
- package/dist/skins/pokemon/fighters.d.ts +2 -0
- package/dist/skins/pokemon/index.d.ts +6 -0
- package/dist/skins/pokemon/items.d.ts +2 -0
- package/dist/skins/pokemon/moves.d.ts +2 -0
- package/dist/skins/pokemon/pokemonSkin.d.ts +14 -0
- package/dist/skins/pokemon/statuses.d.ts +2 -0
- package/dist/skins/pokemon/types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BattleEvent, StatusId, VolatileStatus } from "../core/index.js";
|
|
2
|
+
export interface BattlePlayerStatusView {
|
|
3
|
+
statusId: StatusId;
|
|
4
|
+
stacks: number;
|
|
5
|
+
remainingTurns: number;
|
|
6
|
+
}
|
|
7
|
+
export interface BattlePlayerMoveView {
|
|
8
|
+
moveId: string;
|
|
9
|
+
currentPP: number;
|
|
10
|
+
maxPP: number;
|
|
11
|
+
}
|
|
12
|
+
export interface BattlePlayerItemView {
|
|
13
|
+
itemId: string;
|
|
14
|
+
usesRemaining: number;
|
|
15
|
+
maxUses: number;
|
|
16
|
+
}
|
|
17
|
+
export interface BattleTeamSlotView {
|
|
18
|
+
fighterId: string;
|
|
19
|
+
hp: number;
|
|
20
|
+
isAlive: boolean;
|
|
21
|
+
statuses: BattlePlayerStatusView[];
|
|
22
|
+
}
|
|
23
|
+
export interface BattlePlayerView {
|
|
24
|
+
playerId: string;
|
|
25
|
+
nickname: string;
|
|
26
|
+
hp: number;
|
|
27
|
+
statuses: BattlePlayerStatusView[];
|
|
28
|
+
volatileStatus: VolatileStatus;
|
|
29
|
+
activeFighterId: string | null;
|
|
30
|
+
activeIndex: number;
|
|
31
|
+
activeMoves: BattlePlayerMoveView[];
|
|
32
|
+
inventory: BattlePlayerItemView[];
|
|
33
|
+
team: BattleTeamSlotView[];
|
|
34
|
+
statStages?: {
|
|
35
|
+
offense: number;
|
|
36
|
+
defense: number;
|
|
37
|
+
speed: number;
|
|
38
|
+
crit: number;
|
|
39
|
+
accuracy: number;
|
|
40
|
+
evasion: number;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export type BattleStatus = "ongoing" | "awaiting_forced_switch" | "finished";
|
|
44
|
+
export type ForcedSwitchReason = "roar" | "faint";
|
|
45
|
+
export interface ForcedSwitchView {
|
|
46
|
+
targetPlayerId: string;
|
|
47
|
+
sourcePlayerId: string;
|
|
48
|
+
reason: ForcedSwitchReason;
|
|
49
|
+
turnNumber: number;
|
|
50
|
+
}
|
|
51
|
+
export interface BattleView {
|
|
52
|
+
roomId: string;
|
|
53
|
+
status: BattleStatus;
|
|
54
|
+
winnerId: string | null;
|
|
55
|
+
currentTurnPlayerId: string | null;
|
|
56
|
+
startedAt: string;
|
|
57
|
+
players: BattlePlayerView[];
|
|
58
|
+
events: BattleEvent[];
|
|
59
|
+
turnStartActiveFighterIdByPlayerId?: Record<string, string | null>;
|
|
60
|
+
turnStartHpByPlayerId: {
|
|
61
|
+
[playerId: string]: number;
|
|
62
|
+
};
|
|
63
|
+
turnStartStatusesByPlayerId?: Record<string, BattlePlayerStatusView[]>;
|
|
64
|
+
turnStartStatStagesByPlayerId?: Record<string, {
|
|
65
|
+
offense: number;
|
|
66
|
+
defense: number;
|
|
67
|
+
speed: number;
|
|
68
|
+
crit: number;
|
|
69
|
+
accuracy: number;
|
|
70
|
+
evasion: number;
|
|
71
|
+
}>;
|
|
72
|
+
turnNumber: number;
|
|
73
|
+
pendingActions?: {
|
|
74
|
+
player1: boolean;
|
|
75
|
+
player2: boolean;
|
|
76
|
+
};
|
|
77
|
+
pendingRandomEvent?: {
|
|
78
|
+
eventName: string;
|
|
79
|
+
eventDescription: string;
|
|
80
|
+
imageUrl?: string;
|
|
81
|
+
effects: Array<{
|
|
82
|
+
effectType: string;
|
|
83
|
+
target: string;
|
|
84
|
+
percentValue?: number;
|
|
85
|
+
statType?: string;
|
|
86
|
+
statChange?: number;
|
|
87
|
+
}>;
|
|
88
|
+
} | null;
|
|
89
|
+
forcedSwitch: ForcedSwitchView | null;
|
|
90
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface PlayerLoadoutFighterView {
|
|
2
|
+
fighterId: string;
|
|
3
|
+
moveIds: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface PlayerLoadoutView {
|
|
6
|
+
fighters: PlayerLoadoutFighterView[];
|
|
7
|
+
itemIds: string[];
|
|
8
|
+
amuletId: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface PlayerView {
|
|
11
|
+
id: string;
|
|
12
|
+
nickname: string;
|
|
13
|
+
isOwner: boolean;
|
|
14
|
+
isSelf: boolean;
|
|
15
|
+
isReady: boolean;
|
|
16
|
+
loadout: PlayerLoadoutView | null;
|
|
17
|
+
}
|
|
18
|
+
export type RoomStatusView = "waiting" | "in_battle" | "finished";
|
|
19
|
+
export interface RoomView {
|
|
20
|
+
id: string;
|
|
21
|
+
ownerId: string;
|
|
22
|
+
status: RoomStatusView;
|
|
23
|
+
fightersPerPlayer: number;
|
|
24
|
+
players: PlayerView[];
|
|
25
|
+
skinId: string;
|
|
26
|
+
stageId: string;
|
|
27
|
+
name: string;
|
|
28
|
+
hasPassword: boolean;
|
|
29
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { BattleView } from "./battle.js";
|
|
2
|
+
import { RoomView } from "./room.js";
|
|
3
|
+
import { EmoteId } from "../core/emotes.js";
|
|
4
|
+
export interface ClientToServerEvents {
|
|
5
|
+
"room:create": (payload: {
|
|
6
|
+
nickname: string;
|
|
7
|
+
roomName: string;
|
|
8
|
+
password?: string | null;
|
|
9
|
+
}) => void;
|
|
10
|
+
"room:join": (payload: {
|
|
11
|
+
roomId: string;
|
|
12
|
+
nickname: string;
|
|
13
|
+
password?: string | null;
|
|
14
|
+
}) => void;
|
|
15
|
+
"room:leave": (payload: {
|
|
16
|
+
roomId: string;
|
|
17
|
+
}) => void;
|
|
18
|
+
"room:reconnect": (payload: {
|
|
19
|
+
roomId: string;
|
|
20
|
+
oldPlayerId: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
"room:setLoadout": (payload: {
|
|
23
|
+
roomId: string;
|
|
24
|
+
fighters: {
|
|
25
|
+
fighterId: string;
|
|
26
|
+
moveIds: string[];
|
|
27
|
+
}[];
|
|
28
|
+
itemIds: string[];
|
|
29
|
+
amuletId?: string | null;
|
|
30
|
+
}) => void;
|
|
31
|
+
"room:startBattleRequest": (payload: {
|
|
32
|
+
roomId: string;
|
|
33
|
+
}) => void;
|
|
34
|
+
"room:setConfig": (payload: {
|
|
35
|
+
roomId: string;
|
|
36
|
+
skinId: string;
|
|
37
|
+
stageId: string;
|
|
38
|
+
fightersPerPlayer: number;
|
|
39
|
+
}) => void;
|
|
40
|
+
"room:list": () => void;
|
|
41
|
+
"battle:useMove": (payload: {
|
|
42
|
+
roomId: string;
|
|
43
|
+
moveIndex: number;
|
|
44
|
+
}) => void;
|
|
45
|
+
"battle:useItem": (payload: {
|
|
46
|
+
roomId: string;
|
|
47
|
+
itemIndex: number;
|
|
48
|
+
}) => void;
|
|
49
|
+
"battle:switchFighter": (payload: {
|
|
50
|
+
roomId: string;
|
|
51
|
+
newIndex: number;
|
|
52
|
+
}) => void;
|
|
53
|
+
"battle:chooseForcedSwitch": (payload: {
|
|
54
|
+
roomId: string;
|
|
55
|
+
newIndex: number;
|
|
56
|
+
}) => void;
|
|
57
|
+
"battle:rematchSameLoadout": (payload: {
|
|
58
|
+
roomId: string;
|
|
59
|
+
}) => void;
|
|
60
|
+
"battle:rematchChangeLoadout": (payload: {
|
|
61
|
+
roomId: string;
|
|
62
|
+
}) => void;
|
|
63
|
+
"battle:sendEmote": (payload: {
|
|
64
|
+
roomId: string;
|
|
65
|
+
emoteId: EmoteId;
|
|
66
|
+
}) => void;
|
|
67
|
+
"battle:acknowledgeRandomEvent": (payload: {
|
|
68
|
+
roomId: string;
|
|
69
|
+
}) => void;
|
|
70
|
+
ping: () => void;
|
|
71
|
+
}
|
|
72
|
+
export interface ServerToClientEvents {
|
|
73
|
+
"connection:state": (payload: {
|
|
74
|
+
isConnected: boolean;
|
|
75
|
+
socketId: string | null;
|
|
76
|
+
}) => void;
|
|
77
|
+
"room:list": (payload: RoomView[]) => void;
|
|
78
|
+
"room:state": (payload: RoomView) => void;
|
|
79
|
+
"room:error": (payload: {
|
|
80
|
+
code: string;
|
|
81
|
+
message: string;
|
|
82
|
+
}) => void;
|
|
83
|
+
"battle:state": (payload: BattleView) => void;
|
|
84
|
+
"battle:emote": (payload: {
|
|
85
|
+
playerId: string;
|
|
86
|
+
emoteId: EmoteId;
|
|
87
|
+
timestamp: number;
|
|
88
|
+
}) => void;
|
|
89
|
+
"battle:randomEventTriggered": (payload: {
|
|
90
|
+
eventId: string;
|
|
91
|
+
eventName: string;
|
|
92
|
+
eventDescription: string;
|
|
93
|
+
imageUrl?: string;
|
|
94
|
+
}) => void;
|
|
95
|
+
pong: (msg: string) => void;
|
|
96
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ActionKind = "use_move" | "use_item" | "switch_fighter" | "no_action";
|
|
2
|
+
export interface UseMoveAction {
|
|
3
|
+
kind: "use_move";
|
|
4
|
+
moveIndex: number;
|
|
5
|
+
}
|
|
6
|
+
export interface UseItemAction {
|
|
7
|
+
kind: "use_item";
|
|
8
|
+
itemIndex: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SwitchFighterAction {
|
|
11
|
+
kind: "switch_fighter";
|
|
12
|
+
newIndex: number;
|
|
13
|
+
forced?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface NoAction {
|
|
16
|
+
kind: "no_action";
|
|
17
|
+
}
|
|
18
|
+
export type PlayerAction = UseMoveAction | UseItemAction | SwitchFighterAction | NoAction;
|
|
19
|
+
export interface BattleActions {
|
|
20
|
+
player1: PlayerAction;
|
|
21
|
+
player2: PlayerAction;
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AmuletId, TypeId, StatusId } from "./ids.js";
|
|
2
|
+
import type { EffectDefinition } from "./moves.js";
|
|
3
|
+
export type PassiveTriggerKind = "always" | "on_hit" | "on_damage_taken" | "on_below_hp_threshold";
|
|
4
|
+
export interface PassiveTriggerCondition {
|
|
5
|
+
kind: PassiveTriggerKind;
|
|
6
|
+
hpThresholdPercent?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PassiveEffectDefinition {
|
|
9
|
+
trigger: PassiveTriggerCondition;
|
|
10
|
+
effects: EffectDefinition[];
|
|
11
|
+
appliedStatusId?: StatusId;
|
|
12
|
+
}
|
|
13
|
+
export interface AmuletDefinition {
|
|
14
|
+
id: AmuletId;
|
|
15
|
+
name: string;
|
|
16
|
+
classId: TypeId | null;
|
|
17
|
+
passiveEffects: PassiveEffectDefinition[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AmuletDefinition } from "./amulets.js";
|
|
2
|
+
import { FighterDefinition } from "./fighters.js";
|
|
3
|
+
import { ItemDefinition } from "./items.js";
|
|
4
|
+
import { MoveDefinition } from "./moves.js";
|
|
5
|
+
import { StatusDefinition } from "./status.js";
|
|
6
|
+
import { TypeDefinition, TypeEffectivenessMatrix } from "./types.js";
|
|
7
|
+
import { ItemId, MoveId, StatusId, TypeId } from "./ids.js";
|
|
8
|
+
export interface BattleRules {
|
|
9
|
+
baseCritChance: number;
|
|
10
|
+
critPerStat: number;
|
|
11
|
+
critMultiplier: number;
|
|
12
|
+
stabMultiplier: number;
|
|
13
|
+
randomMinDamageFactor: number;
|
|
14
|
+
randomMaxDamageFactor: number;
|
|
15
|
+
}
|
|
16
|
+
export interface BattleRuntime {
|
|
17
|
+
rules: BattleRules;
|
|
18
|
+
typesById: Record<TypeId, TypeDefinition>;
|
|
19
|
+
movesById: Record<MoveId, MoveDefinition>;
|
|
20
|
+
itemsById: Record<ItemId, ItemDefinition>;
|
|
21
|
+
amuletsById: Record<string, AmuletDefinition>;
|
|
22
|
+
statusesById: Record<StatusId, StatusDefinition>;
|
|
23
|
+
typeEffectiveness: TypeEffectivenessMatrix;
|
|
24
|
+
}
|
|
25
|
+
export interface PlayerFighterBattleConfig {
|
|
26
|
+
fighter: FighterDefinition;
|
|
27
|
+
maxHp: number;
|
|
28
|
+
moves: MoveDefinition[];
|
|
29
|
+
amulet: AmuletDefinition | null;
|
|
30
|
+
}
|
|
31
|
+
export interface PlayerBattleConfig {
|
|
32
|
+
fighters: PlayerFighterBattleConfig[];
|
|
33
|
+
items: ItemDefinition[];
|
|
34
|
+
amulet: AmuletDefinition | null;
|
|
35
|
+
}
|
|
36
|
+
export interface BattleConfig {
|
|
37
|
+
types: TypeDefinition[];
|
|
38
|
+
typeEffectiveness: TypeEffectivenessMatrix;
|
|
39
|
+
moves: MoveDefinition[];
|
|
40
|
+
items: ItemDefinition[];
|
|
41
|
+
amulets: AmuletDefinition[];
|
|
42
|
+
statuses: StatusDefinition[];
|
|
43
|
+
player1: PlayerBattleConfig;
|
|
44
|
+
player2: PlayerBattleConfig;
|
|
45
|
+
rules?: Partial<BattleRules>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type EmoteCategory = "emotional" | "strategic" | "social";
|
|
2
|
+
export type EmoteId = string;
|
|
3
|
+
export interface EmoteDefinition {
|
|
4
|
+
id: EmoteId;
|
|
5
|
+
category: EmoteCategory;
|
|
6
|
+
emoji: string;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const EMOTES: EmoteDefinition[];
|
|
11
|
+
export declare const getEmoteById: (id: EmoteId) => EmoteDefinition | undefined;
|
|
12
|
+
export declare const getEmotesByCategory: (category: EmoteCategory) => EmoteDefinition[];
|
|
13
|
+
export declare const isValidEmoteId: (id: string) => id is EmoteId;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { FighterId, MoveId, ItemId, StatusId } from "./ids.js";
|
|
2
|
+
export type BattleEventKind = "turn_start" | "action_declared" | "action_skipped_hard_cc" | "move_miss" | "move_hit" | "item_used" | "status_cleared" | "damage" | "heal" | "fighter_switched" | "shield_applied" | "status_applied" | "status_refreshed" | "status_expired" | "status_tick" | "fighter_fainted" | "turn_end" | "stats_changed" | "random_event_triggered" | "random_event_effect" | "battle_end";
|
|
3
|
+
export interface BaseBattleEvent {
|
|
4
|
+
id: string;
|
|
5
|
+
turnNumber: number;
|
|
6
|
+
kind: BattleEventKind;
|
|
7
|
+
message: string;
|
|
8
|
+
timestamp: number;
|
|
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
|
+
}
|
|
13
|
+
export interface StatsChangedEvent extends BaseBattleEvent {
|
|
14
|
+
kind: "stats_changed";
|
|
15
|
+
targetId: FighterId;
|
|
16
|
+
changes: {
|
|
17
|
+
offense?: number;
|
|
18
|
+
defense?: number;
|
|
19
|
+
speed?: number;
|
|
20
|
+
crit?: number;
|
|
21
|
+
accuracy?: number;
|
|
22
|
+
evasion?: number;
|
|
23
|
+
};
|
|
24
|
+
source?: "move" | "status" | "item" | "random_event";
|
|
25
|
+
}
|
|
26
|
+
export interface ActionDeclaredEvent extends BaseBattleEvent {
|
|
27
|
+
kind: "action_declared";
|
|
28
|
+
actorId: FighterId;
|
|
29
|
+
/**
|
|
30
|
+
* Optional custom list of narration lines.
|
|
31
|
+
* If present, the frontend should play these lines instead of the default message.
|
|
32
|
+
*/
|
|
33
|
+
narration?: string[];
|
|
34
|
+
moveId?: MoveId;
|
|
35
|
+
itemId?: ItemId;
|
|
36
|
+
targetId?: FighterId;
|
|
37
|
+
}
|
|
38
|
+
export interface ActionSkippedHardCcEvent extends BaseBattleEvent {
|
|
39
|
+
kind: "action_skipped_hard_cc";
|
|
40
|
+
actorId: FighterId;
|
|
41
|
+
statusId: StatusId;
|
|
42
|
+
}
|
|
43
|
+
export interface MoveMissEvent extends BaseBattleEvent {
|
|
44
|
+
kind: "move_miss";
|
|
45
|
+
actorId: FighterId;
|
|
46
|
+
moveId: MoveId;
|
|
47
|
+
targetId: FighterId;
|
|
48
|
+
}
|
|
49
|
+
export interface MoveHitEvent extends BaseBattleEvent {
|
|
50
|
+
kind: "move_hit";
|
|
51
|
+
actorId: FighterId;
|
|
52
|
+
moveId: MoveId;
|
|
53
|
+
targetId: FighterId;
|
|
54
|
+
isCritical: boolean;
|
|
55
|
+
effectiveness: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ItemUsedEvent extends BaseBattleEvent {
|
|
58
|
+
kind: "item_used";
|
|
59
|
+
actorId: FighterId;
|
|
60
|
+
itemId: ItemId;
|
|
61
|
+
targetId: FighterId;
|
|
62
|
+
}
|
|
63
|
+
export interface DamageEvent extends BaseBattleEvent {
|
|
64
|
+
kind: "damage";
|
|
65
|
+
actorId: FighterId;
|
|
66
|
+
targetId: FighterId;
|
|
67
|
+
amount: number;
|
|
68
|
+
isCritical: boolean;
|
|
69
|
+
source?: "move" | "status" | "item" | "random_event";
|
|
70
|
+
}
|
|
71
|
+
export interface HealEvent extends BaseBattleEvent {
|
|
72
|
+
kind: "heal";
|
|
73
|
+
actorId: FighterId;
|
|
74
|
+
targetId: FighterId;
|
|
75
|
+
amount: number;
|
|
76
|
+
source?: "move" | "status" | "item" | "random_event";
|
|
77
|
+
}
|
|
78
|
+
export interface StatusAppliedEvent extends BaseBattleEvent {
|
|
79
|
+
kind: "status_applied";
|
|
80
|
+
targetId: FighterId;
|
|
81
|
+
statusId: StatusId;
|
|
82
|
+
stacks: number;
|
|
83
|
+
durationTurns: number;
|
|
84
|
+
}
|
|
85
|
+
export interface FighterSwitchedEvent extends BaseBattleEvent {
|
|
86
|
+
kind: "fighter_switched";
|
|
87
|
+
fromFighterId: FighterId;
|
|
88
|
+
toFighterId: FighterId;
|
|
89
|
+
toHp: number;
|
|
90
|
+
toStatuses: {
|
|
91
|
+
statusId: string;
|
|
92
|
+
stacks: number;
|
|
93
|
+
remainingTurns: number;
|
|
94
|
+
}[];
|
|
95
|
+
}
|
|
96
|
+
export interface StatusClearedEvent extends BaseBattleEvent {
|
|
97
|
+
kind: "status_cleared";
|
|
98
|
+
targetId: FighterId;
|
|
99
|
+
statusIds: StatusId[];
|
|
100
|
+
}
|
|
101
|
+
export interface StatusExpiredEvent extends BaseBattleEvent {
|
|
102
|
+
kind: "status_expired";
|
|
103
|
+
targetId: FighterId;
|
|
104
|
+
statusId: StatusId;
|
|
105
|
+
}
|
|
106
|
+
export interface StatusTickEvent extends BaseBattleEvent {
|
|
107
|
+
kind: "status_tick";
|
|
108
|
+
targetId: FighterId;
|
|
109
|
+
statusId: StatusId;
|
|
110
|
+
stacks: number;
|
|
111
|
+
}
|
|
112
|
+
export interface FighterFaintedEvent extends BaseBattleEvent {
|
|
113
|
+
kind: "fighter_fainted";
|
|
114
|
+
fighterId: FighterId;
|
|
115
|
+
}
|
|
116
|
+
export interface BattleEndEvent extends BaseBattleEvent {
|
|
117
|
+
kind: "battle_end";
|
|
118
|
+
winner: "player1" | "player2" | "draw";
|
|
119
|
+
}
|
|
120
|
+
export interface RandomEventTriggeredEvent extends BaseBattleEvent {
|
|
121
|
+
kind: "random_event_triggered";
|
|
122
|
+
eventId: string;
|
|
123
|
+
eventName: string;
|
|
124
|
+
eventDescription: string;
|
|
125
|
+
narration?: string[];
|
|
126
|
+
eventRarity: "common" | "rare" | "epic" | "legendary";
|
|
127
|
+
imageUrl?: string;
|
|
128
|
+
effects: Array<{
|
|
129
|
+
effectType: string;
|
|
130
|
+
target: string;
|
|
131
|
+
percentValue?: number;
|
|
132
|
+
statType?: string;
|
|
133
|
+
statChange?: number;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
136
|
+
export interface RandomEventEffectEvent extends BaseBattleEvent {
|
|
137
|
+
kind: "random_event_effect";
|
|
138
|
+
eventId: string;
|
|
139
|
+
targetId: FighterId;
|
|
140
|
+
effectType: string;
|
|
141
|
+
}
|
|
142
|
+
export type BattleEvent = ActionDeclaredEvent | ActionSkippedHardCcEvent | MoveMissEvent | MoveHitEvent | ItemUsedEvent | DamageEvent | HealEvent | StatusAppliedEvent | StatusClearedEvent | StatusExpiredEvent | StatusTickEvent | FighterFaintedEvent | FighterSwitchedEvent | BattleEndEvent | StatsChangedEvent | RandomEventTriggeredEvent | RandomEventEffectEvent | GenericBattleEvent;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./actions.js";
|
|
2
|
+
export * from "./randomEvents.js";
|
|
3
|
+
export { CORE_RANDOM_EVENTS, POKEMON_RANDOM_EVENTS } from "./randomEventsList.js";
|
|
4
|
+
export * from "./emotes.js";
|
|
5
|
+
export * from "./events.js";
|
|
6
|
+
export * from "./events.js";
|
|
7
|
+
export * from "./fighters.js";
|
|
8
|
+
export * from "./ids.js";
|
|
9
|
+
export * from "./items.js";
|
|
10
|
+
export * from "./moves.js";
|
|
11
|
+
export * from "./status.js";
|
|
12
|
+
export * from "./randomEventsList.js";
|
|
13
|
+
export * from "./battleRuntime.js";
|
|
14
|
+
export * from "./battleState.js";
|
|
15
|
+
export * from "./amulets.js";
|
|
16
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ItemId } from "./ids.js";
|
|
2
|
+
import type { EffectDefinition, TargetKind } from "./moves.js";
|
|
3
|
+
export type ItemCategory = "damage" | "heal_shield" | "status_buff";
|
|
4
|
+
export interface ItemDefinition {
|
|
5
|
+
id: ItemId;
|
|
6
|
+
name: string;
|
|
7
|
+
target: TargetKind;
|
|
8
|
+
maxUses: number;
|
|
9
|
+
image: string;
|
|
10
|
+
effects: EffectDefinition[];
|
|
11
|
+
narration?: string[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { MoveId, StatusId, TypeId } from "./ids.js";
|
|
2
|
+
export type EffectTarget = "self" | "enemy";
|
|
3
|
+
export type EffectKind = "damage" | "heal" | "shield" | "modify_stats" | "apply_status" | "clear_status" | "modify_hit_chance" | "modify_crit_chance" | "modify_priority" | "modify_effective_speed" | "force_switch";
|
|
4
|
+
export type TargetKind = EffectTarget;
|
|
5
|
+
interface BaseEffect {
|
|
6
|
+
target?: EffectTarget;
|
|
7
|
+
chance?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DamageEffect extends BaseEffect {
|
|
10
|
+
kind: "damage";
|
|
11
|
+
/**
|
|
12
|
+
* Daño “de fórmula” (stats + tipo + crit…).
|
|
13
|
+
* Si no se define, NO se llama a computeDamage.
|
|
14
|
+
*/
|
|
15
|
+
basePower?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Daño plano adicional.
|
|
18
|
+
* Se suma al daño de fórmula o se usa solo si no hay basePower.
|
|
19
|
+
*/
|
|
20
|
+
flatAmount?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface HealEffect extends BaseEffect {
|
|
23
|
+
kind: "heal";
|
|
24
|
+
amount: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ShieldEffect extends BaseEffect {
|
|
27
|
+
kind: "shield";
|
|
28
|
+
amount: number;
|
|
29
|
+
durationTurns: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ModifyStatsEffect extends BaseEffect {
|
|
32
|
+
kind: "modify_stats";
|
|
33
|
+
offenseDelta?: number;
|
|
34
|
+
defenseDelta?: number;
|
|
35
|
+
speedDelta?: number;
|
|
36
|
+
critDelta?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface ApplyStatusEffect extends BaseEffect {
|
|
39
|
+
kind: "apply_status";
|
|
40
|
+
statusId: StatusId;
|
|
41
|
+
}
|
|
42
|
+
export interface ClearStatusEffect extends BaseEffect {
|
|
43
|
+
kind: "clear_status";
|
|
44
|
+
statusIds?: StatusId[];
|
|
45
|
+
kinds?: ("hard_cc" | "soft")[];
|
|
46
|
+
clearAll?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface ModifyHitChanceEffect extends BaseEffect {
|
|
49
|
+
kind: "modify_hit_chance";
|
|
50
|
+
delta: number;
|
|
51
|
+
}
|
|
52
|
+
export interface ModifyCritChanceEffect extends BaseEffect {
|
|
53
|
+
kind: "modify_crit_chance";
|
|
54
|
+
delta: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ModifyPriorityEffect extends BaseEffect {
|
|
57
|
+
kind: "modify_priority";
|
|
58
|
+
delta: number;
|
|
59
|
+
}
|
|
60
|
+
export interface ForceSwitchEffect extends BaseEffect {
|
|
61
|
+
kind: "force_switch";
|
|
62
|
+
/**
|
|
63
|
+
* Mensaje/razón opcional para debug/narración interna.
|
|
64
|
+
* Si no lo usas, lo puedes ignorar en el engine.
|
|
65
|
+
*/
|
|
66
|
+
reason?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ModifyEffectiveSpeedEffect extends BaseEffect {
|
|
69
|
+
kind: "modify_effective_speed";
|
|
70
|
+
multiplier: number;
|
|
71
|
+
}
|
|
72
|
+
export type EffectDefinition = DamageEffect | HealEffect | ShieldEffect | ModifyStatsEffect | ApplyStatusEffect | ClearStatusEffect | ModifyHitChanceEffect | ModifyCritChanceEffect | ModifyPriorityEffect | ModifyEffectiveSpeedEffect | ForceSwitchEffect;
|
|
73
|
+
export interface MoveDefinition {
|
|
74
|
+
id: MoveId;
|
|
75
|
+
name: string;
|
|
76
|
+
typeId: TypeId;
|
|
77
|
+
accuracy?: number;
|
|
78
|
+
maxPP: number;
|
|
79
|
+
priority?: number;
|
|
80
|
+
charge?: {
|
|
81
|
+
invulnerability?: string;
|
|
82
|
+
};
|
|
83
|
+
bypassInvulnerability?: string[];
|
|
84
|
+
effects: EffectDefinition[];
|
|
85
|
+
narration?: string[];
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type EventRarity = "common" | "rare" | "epic" | "legendary";
|
|
2
|
+
export type EventEffectType = "damage_percent" | "heal_percent" | "stat_change" | "apply_status" | "reset_stats" | "swap_hp";
|
|
3
|
+
export type EventTarget = "both" | "self" | "opponent" | "random_one";
|
|
4
|
+
export interface EventCondition {
|
|
5
|
+
type: "has_item" | "hp_below_percent" | "hp_above_percent" | "fighter_type" | "has_status" | "stat_stage_above" | "always";
|
|
6
|
+
value?: string | number;
|
|
7
|
+
}
|
|
8
|
+
export interface RandomEventEffect {
|
|
9
|
+
effectType: EventEffectType;
|
|
10
|
+
target: EventTarget;
|
|
11
|
+
condition?: EventCondition;
|
|
12
|
+
percentValue?: number;
|
|
13
|
+
statType?: "offense" | "defense" | "speed" | "crit" | "accuracy" | "evasion";
|
|
14
|
+
statChange?: number;
|
|
15
|
+
statusId?: string;
|
|
16
|
+
statusDuration?: number;
|
|
17
|
+
randomChoices?: RandomEventEffect[];
|
|
18
|
+
}
|
|
19
|
+
export interface RandomEventDefinition {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
narration: string[];
|
|
24
|
+
rarity: EventRarity;
|
|
25
|
+
imageUrl?: string;
|
|
26
|
+
effects: RandomEventEffect[];
|
|
27
|
+
}
|
|
28
|
+
export declare const RARITY_WEIGHTS: Record<EventRarity, number>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RandomEventDefinition } from "./randomEvents.js";
|
|
2
|
+
/**
|
|
3
|
+
* CORE Random Events - Generic events that work with any skin
|
|
4
|
+
* Phase 1 + Phase 2: 9 total CORE events
|
|
5
|
+
*/
|
|
6
|
+
export declare const CORE_RANDOM_EVENTS: RandomEventDefinition[];
|
|
7
|
+
/**
|
|
8
|
+
* POKEMON-SPECIFIC Random Events
|
|
9
|
+
* These only appear when using the Pokemon skin
|
|
10
|
+
*/
|
|
11
|
+
export declare const POKEMON_RANDOM_EVENTS: RandomEventDefinition[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { StatusId } from "./ids.js";
|
|
2
|
+
import type { EffectDefinition } from "./moves.js";
|
|
3
|
+
export type StatusKind = "hard_cc" | "soft";
|
|
4
|
+
export interface StatusDefinition {
|
|
5
|
+
id: StatusId;
|
|
6
|
+
name: string;
|
|
7
|
+
kind: StatusKind;
|
|
8
|
+
minDurationTurns: number;
|
|
9
|
+
maxDurationTurns: number;
|
|
10
|
+
effectsPerStack: EffectDefinition[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TypeId } from "./ids.js";
|
|
2
|
+
export type Effectiveness = 0 | 0.9 | 1 | 1.1;
|
|
3
|
+
export interface TypeDefinition {
|
|
4
|
+
id: TypeId;
|
|
5
|
+
displayName: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
export type TypeEffectivenessMatrix = Record<TypeId, Record<TypeId, Effectiveness>>;
|
|
9
|
+
export interface FighterStats {
|
|
10
|
+
offense: number;
|
|
11
|
+
defense: number;
|
|
12
|
+
speed: number;
|
|
13
|
+
crit: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BattleEvent, PlayerAction } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const resolveItemUse: (state: RuntimeBattleState, playerKey: "player1" | "player2", action: PlayerAction) => {
|
|
4
|
+
state: RuntimeBattleState;
|
|
5
|
+
events: BattleEvent[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BattleEvent, PlayerAction } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const processNarration: (lines: string[], actorId: string, targetId: string) => string[];
|
|
4
|
+
export declare const resolveDamageMove: (state: RuntimeBattleState, playerKey: "player1" | "player2", action: PlayerAction) => {
|
|
5
|
+
state: RuntimeBattleState;
|
|
6
|
+
events: BattleEvent[];
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlayerAction } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const getMovePriorityAndSpeed: (state: RuntimeBattleState, playerKey: "player1" | "player2", action: PlayerAction) => {
|
|
4
|
+
priority: number;
|
|
5
|
+
speed: number;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BattleEvent, PlayerAction } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const resolveSwitchFighter: (state: RuntimeBattleState, playerKey: "player1" | "player2", action: PlayerAction) => {
|
|
4
|
+
state: RuntimeBattleState;
|
|
5
|
+
events: BattleEvent[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BattleEvent, BattleFighter, FighterId, TypeId } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
interface DamageComputationInput {
|
|
4
|
+
state: RuntimeBattleState;
|
|
5
|
+
attacker: BattleFighter;
|
|
6
|
+
defender: BattleFighter;
|
|
7
|
+
moveTypeId: TypeId;
|
|
8
|
+
basePower: number;
|
|
9
|
+
isCritical: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const computeDamage: (input: DamageComputationInput) => {
|
|
12
|
+
damage: number;
|
|
13
|
+
effectiveness: number;
|
|
14
|
+
};
|
|
15
|
+
interface DamageApplyResult {
|
|
16
|
+
updatedDefender: BattleFighter;
|
|
17
|
+
events: BattleEvent[];
|
|
18
|
+
}
|
|
19
|
+
export declare const applyDamageToFighter: (state: RuntimeBattleState, defender: BattleFighter, amount: number, actorId: FighterId, isCritical: boolean) => DamageApplyResult;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BattleEvent, BattleFighter, FighterId } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const applyHealToFighter: (state: RuntimeBattleState, target: BattleFighter, amount: number, sourceId: FighterId) => {
|
|
4
|
+
updated: BattleFighter;
|
|
5
|
+
events: BattleEvent[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const STAGE_MULTIPLIERS_STATS: Record<number, number>;
|
|
2
|
+
export declare const STAGE_MULTIPLIERS_ACCURACY: Record<number, number>;
|
|
3
|
+
export declare const getCritChanceFromStage: (stage: number) => number;
|
|
4
|
+
export declare const getStatMultiplier: (stage: number) => number;
|
|
5
|
+
export declare const getAccuracyMultiplier: (stage: number) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dbg: (...args: unknown[]) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BattleEvent, BattleFighter, EffectDefinition, TypeId } from "../../core/index.js";
|
|
2
|
+
import { RuntimeBattleState } from "../rules.js";
|
|
3
|
+
export declare const applyEffectsOnTarget: (state: RuntimeBattleState, actor: BattleFighter, target: BattleFighter, moveTypeId: TypeId | null, isCritical: boolean, effects: EffectDefinition[]) => {
|
|
4
|
+
actor: BattleFighter;
|
|
5
|
+
target: BattleFighter;
|
|
6
|
+
events: BattleEvent[];
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BattleFighter, EffectDefinition, EffectKind, EffectTarget } from "../../core/index.js";
|
|
2
|
+
export declare const defaultTargetForKind: (kind: EffectKind) => EffectTarget;
|
|
3
|
+
export declare const resolveEffectTarget: (eff: EffectDefinition, actor: BattleFighter, target: BattleFighter) => {
|
|
4
|
+
primary: BattleFighter;
|
|
5
|
+
isSelf: boolean;
|
|
6
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 './events/index.js';
|
|
12
|
+
export * from './turn/resolveTurn.js';
|
package/dist/engine/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 PokemonSkin implements CombatSkin {
|
|
5
|
+
readonly id = "pokemon";
|
|
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 createPokemonSkin: () => CombatSkin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TypeDefinition, TypeEffectivenessMatrix, TypeId } from "../../core/index.js";
|
|
2
|
+
export declare const POKEMON_TYPE_IDS: {
|
|
3
|
+
readonly fire: "fire";
|
|
4
|
+
readonly water: "water";
|
|
5
|
+
readonly grass: "grass";
|
|
6
|
+
readonly electric: "electric";
|
|
7
|
+
readonly psychic: "psychic";
|
|
8
|
+
readonly rock: "rock";
|
|
9
|
+
};
|
|
10
|
+
export type PokemonTypeId = (typeof POKEMON_TYPE_IDS)[keyof typeof POKEMON_TYPE_IDS];
|
|
11
|
+
export declare const POKEMON_TYPES: TypeDefinition[];
|
|
12
|
+
export declare const POKEMON_TYPE_MATRIX: TypeEffectivenessMatrix;
|
|
13
|
+
export declare const getPokemonTypeEffectiveness: (attackerTypeId: TypeId, defenderTypeId: TypeId) => number;
|