@drmxrcy/tcg-lorcana-types 0.0.0-202602060544

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.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Lorcana Card Types
3
+ *
4
+ * Card definitions, ink types, and classifications.
5
+ */
6
+
7
+ // Card Types
8
+ export type {
9
+ // Ability definitions
10
+ AbilityDefinition,
11
+ ActionAbilityDefinition,
12
+ ActionCard,
13
+ ActionSubtype,
14
+ ActivatedAbilityDefinition,
15
+ BaseAbilityDefinition,
16
+ // Base card properties
17
+ BaseCardProperties,
18
+ // Card type constants
19
+ CardType,
20
+ CharacterCard,
21
+ ItemCard,
22
+ KeywordAbilityDefinition,
23
+ LocationCard,
24
+ // Discriminated union card types
25
+ LorcanaCard,
26
+ // Unified card definition
27
+ LorcanaCardDefinition,
28
+ ReplacementAbilityDefinition,
29
+ StaticAbilityDefinition,
30
+ TriggeredAbilityDefinition,
31
+ } from "./card-types";
32
+
33
+ export {
34
+ // Constants
35
+ CARD_TYPES,
36
+ // Utilities
37
+ getFullName,
38
+ getInkTypes,
39
+ isActionCard,
40
+ isCardType,
41
+ // Type guards
42
+ isCharacterCard,
43
+ isDualInk,
44
+ isItemCard,
45
+ isLocationCard,
46
+ } from "./card-types";
47
+ // Classifications
48
+ export type { Classification } from "./classifications";
49
+ export {
50
+ CLASSIFICATIONS,
51
+ isClassification,
52
+ isDreamborn,
53
+ isFloodborn,
54
+ isStoryborn,
55
+ } from "./classifications";
56
+ // Deck Validation
57
+ export type {
58
+ DeckStats,
59
+ DeckValidationError,
60
+ DeckValidationResult,
61
+ TooFewCardsError,
62
+ TooManyCopiesError,
63
+ TooManyInkTypesError,
64
+ } from "./deck-validation";
65
+ export {
66
+ MAX_COPIES_PER_CARD,
67
+ MAX_INK_TYPES,
68
+ MIN_DECK_SIZE,
69
+ } from "./deck-validation";
70
+ // Ink Types
71
+ export type { InkType } from "./ink-types";
72
+ export {
73
+ getInkColor,
74
+ INK_COLORS,
75
+ INK_TYPES,
76
+ isValidInkType,
77
+ } from "./ink-types";
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Ink Types (Rule 2.1.1.2)
3
+ *
4
+ * Six ink colors that define card identity and deck building constraints.
5
+ * A deck can contain cards of at most 2 different ink types.
6
+ */
7
+
8
+ export const INK_TYPES = [
9
+ "amber",
10
+ "amethyst",
11
+ "emerald",
12
+ "ruby",
13
+ "sapphire",
14
+ "steel",
15
+ ] as const;
16
+
17
+ export type InkType = (typeof INK_TYPES)[number];
18
+
19
+ /**
20
+ * Ink color display values for UI
21
+ */
22
+ export const INK_COLORS: Record<InkType, string> = {
23
+ amber: "#F5A623",
24
+ amethyst: "#9B59B6",
25
+ emerald: "#27AE60",
26
+ ruby: "#C0392B",
27
+ sapphire: "#2980B9",
28
+ steel: "#7F8C8D",
29
+ };
30
+
31
+ /**
32
+ * Check if a value is a valid ink type
33
+ */
34
+ export function isValidInkType(value: unknown): value is InkType {
35
+ return typeof value === "string" && INK_TYPES.includes(value as InkType);
36
+ }
37
+
38
+ /**
39
+ * Alias for backwards compatibility
40
+ */
41
+ export const isInkType = isValidInkType;
42
+
43
+ /**
44
+ * Get the display color for an ink type
45
+ */
46
+ export function getInkColor(inkType: InkType): string {
47
+ return INK_COLORS[inkType];
48
+ }
49
+
50
+ /**
51
+ * Get all ink types
52
+ */
53
+ export function getAllInkTypes(): readonly InkType[] {
54
+ return INK_TYPES;
55
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Lorcana Game State Types
3
+ *
4
+ * Domain types for game state structure and card states.
5
+ */
6
+
7
+ export type {
8
+ ChallengeState,
9
+ CharacterState,
10
+ LorcanaPhase,
11
+ LorcanaState,
12
+ PermanentState,
13
+ TurnMetadata,
14
+ } from "./state-types";
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Lorcana Game State Types
3
+ *
4
+ * Complete type definition for Disney Lorcana game state following official rules:
5
+ * - Lore tracking for win condition (Rule 1.9.1.1 - win at 20 lore)
6
+ * - Ink management (total capacity and available per turn)
7
+ * - Character states (drying status, damage, exerted)
8
+ * - Turn metadata (cards played, characters questing, ink used)
9
+ * - Challenge state for combat resolution
10
+ * - Location and item states
11
+ *
12
+ * References:
13
+ * - Rule 3.1.4 (Lore starts at 0)
14
+ * - Rule 4.2.2.1 (Drying characters)
15
+ * - Rule 4.3.3 (Inkwell - once per turn)
16
+ * - Rule 4.3.6 (Challenge mechanics)
17
+ * - Rule 9 (Damage counters)
18
+ */
19
+
20
+ import type { CardId, PlayerId } from "@drmxrcy/tcg-core";
21
+
22
+ /**
23
+ * Lorcana Phase
24
+ *
25
+ * Three-phase turn structure (Rule 4.1.1):
26
+ * - beginning: Ready, Set, Draw steps
27
+ * - main: Player can take turn actions
28
+ * - end: End of turn cleanup
29
+ */
30
+ export type LorcanaPhase = "beginning" | "main" | "end";
31
+
32
+ /**
33
+ * Character State
34
+ *
35
+ * Runtime state for a character card in play.
36
+ * Tracks damage, exerted status, and "drying" state.
37
+ *
38
+ * Rule 4.2.2.1: Characters are "drying" the turn they're played
39
+ * Rule 6.1.4: Must be dry to quest, challenge, or exert
40
+ * Rule 9: Damage represented by counters
41
+ */
42
+ export type CharacterState = {
43
+ /**
44
+ * "Drying" status - true if played this turn
45
+ *
46
+ * Characters that are "drying" cannot:
47
+ * - Quest (Rule 4.3.5)
48
+ * - Challenge (Rule 4.3.6.6)
49
+ * - Be exerted to pay costs (Rule 6.1.4)
50
+ *
51
+ * Becomes false at Set step of next turn (Rule 4.2.2.1)
52
+ */
53
+ playedThisTurn: boolean;
54
+
55
+ /**
56
+ * Damage counters on this character
57
+ *
58
+ * Rule 9.1: Each counter represents 1 damage
59
+ * Rule 1.9.1.3: Banished when damage >= Willpower
60
+ */
61
+ damage: number;
62
+
63
+ /**
64
+ * Exerted status - true if turned sideways
65
+ *
66
+ * Rule 5.1.2: Exerted cards turned sideways
67
+ * Rule 4.2.1.1: Readied at start of turn
68
+ */
69
+ exerted: boolean;
70
+ };
71
+
72
+ /**
73
+ * Permanent State
74
+ *
75
+ * Runtime state for locations and items in play.
76
+ * Currently only tracks damage (for locations).
77
+ */
78
+ export type PermanentState = {
79
+ /**
80
+ * Damage counters (for locations)
81
+ *
82
+ * Rule 4.3.6.19-22: Locations can be challenged
83
+ * Rule 6.5: Locations have Willpower
84
+ */
85
+ damage: number;
86
+ };
87
+
88
+ /**
89
+ * Challenge State
90
+ *
91
+ * Temporary state during challenge resolution.
92
+ *
93
+ * Rule 4.3.6: Challenge mechanics
94
+ * - Attacker declared and exerted
95
+ * - Defender chosen
96
+ * - Damage calculated and dealt
97
+ * - Challenge ends
98
+ */
99
+ export type ChallengeState = {
100
+ /**
101
+ * Attacking character
102
+ */
103
+ attacker: CardId;
104
+
105
+ /**
106
+ * Defending character or location
107
+ */
108
+ defender: CardId;
109
+
110
+ /**
111
+ * Calculated damage attacker will deal
112
+ *
113
+ * Rule 4.3.6.14: Based on Strength with modifiers
114
+ * Rule 10.3: Challenger +N applies
115
+ */
116
+ attackerDamage: number;
117
+
118
+ /**
119
+ * Calculated damage defender will deal
120
+ *
121
+ * Rule 4.3.6.14: Based on Strength with modifiers
122
+ * Rule 4.3.6.22: Locations deal no damage
123
+ */
124
+ defenderDamage: number;
125
+ };
126
+
127
+ /**
128
+ * Turn Metadata
129
+ *
130
+ * Tracks actions taken this turn for validation and cleanup.
131
+ * Reset at start of each turn.
132
+ */
133
+ export type TurnMetadata = {
134
+ /**
135
+ * Cards played this turn
136
+ *
137
+ * Tracked for effects that reference "cards played this turn"
138
+ */
139
+ cardsPlayedThisTurn: CardId[];
140
+
141
+ /**
142
+ * Characters that quested this turn
143
+ *
144
+ * Rule 4.3.5: Each character can quest once per turn
145
+ * Tracked for effects that reference "whenever quests"
146
+ */
147
+ charactersQuesting: CardId[];
148
+
149
+ /**
150
+ * Whether player has put a card into inkwell this turn
151
+ *
152
+ * Rule 4.3.3: Limited to once per turn
153
+ */
154
+ inkedThisTurn: boolean;
155
+ };
156
+
157
+ /**
158
+ * Lorcana-specific Game State
159
+ *
160
+ * Complete game state for Disney Lorcana extending base game state structure.
161
+ * All Lorcana-specific data nested under `lorcana` property.
162
+ */
163
+ export type LorcanaState = {
164
+ /**
165
+ * Players in the game
166
+ *
167
+ * Rule 2.1: Standard format is 2 players
168
+ */
169
+ players: PlayerId[];
170
+
171
+ /**
172
+ * Current player index (into players array)
173
+ *
174
+ * Rule 1.3: Active player takes their turn
175
+ */
176
+ currentPlayerIndex: number;
177
+
178
+ /**
179
+ * Turn number (starts at 1)
180
+ *
181
+ * Rule 3.1: First turn determined randomly
182
+ * Rule 4.2.3.2: Starting player skips draw on turn 1
183
+ */
184
+ turnNumber: number;
185
+
186
+ /**
187
+ * Current phase
188
+ *
189
+ * Rule 4.1: Three phases - Beginning, Main, End
190
+ */
191
+ phase: LorcanaPhase;
192
+
193
+ /**
194
+ * Lorcana-specific game state
195
+ */
196
+ lorcana: {
197
+ /**
198
+ * Lore totals for each player
199
+ *
200
+ * Rule 1.9.1.1: Win condition - first to 20 lore
201
+ * Rule 3.1.4: Starts at 0
202
+ * Rule 4.2.2.2: Gained from locations during Set step
203
+ * Rule 4.3.5.8: Gained from questing
204
+ */
205
+ lore: Record<PlayerId, number>;
206
+
207
+ /**
208
+ * Ink management
209
+ *
210
+ * Rule 4.3.3: Put card into inkwell once per turn
211
+ * Rule 8.5.1: Each ink card represents 1 ink
212
+ */
213
+ ink: {
214
+ /**
215
+ * Available ink this turn (can be spent)
216
+ *
217
+ * Replenished when cards readied at start of turn
218
+ */
219
+ available: Record<PlayerId, number>;
220
+
221
+ /**
222
+ * Total ink capacity (total cards in inkwell)
223
+ *
224
+ * Never decreases, only increases when inking
225
+ */
226
+ total: Record<PlayerId, number>;
227
+ };
228
+
229
+ /**
230
+ * Turn metadata - reset each turn
231
+ *
232
+ * Tracks what actions player has taken this turn
233
+ */
234
+ turnMetadata: TurnMetadata;
235
+
236
+ /**
237
+ * Character states
238
+ *
239
+ * Keyed by CardId, tracks runtime state of each character in play
240
+ */
241
+ characterStates: Record<CardId, CharacterState>;
242
+
243
+ /**
244
+ * Permanent states (locations and items)
245
+ *
246
+ * Keyed by CardId, tracks runtime state of non-character permanents
247
+ */
248
+ permanentStates: Record<CardId, PermanentState>;
249
+
250
+ /**
251
+ * Challenge state (only present during challenge)
252
+ *
253
+ * Rule 4.3.6: Challenge mechanics
254
+ * Optional - only set during challenge resolution
255
+ */
256
+ challengeState?: ChallengeState;
257
+ };
258
+ };
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @drmxrcy/tcg-lorcana-types
3
+ *
4
+ * Complete type definitions for Disney Lorcana TCG.
5
+ * This package provides types without runtime dependencies,
6
+ * allowing type-safe card definitions without coupling to the game engine.
7
+ */
8
+
9
+ // Re-export all ability types
10
+ export * from "./abilities";
11
+
12
+ // Re-export all card types
13
+ export * from "./cards";
14
+
15
+ // Re-export all game state types
16
+ export * from "./game";