@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.
- package/package.json +46 -0
- package/src/abilities/ability-types.ts +766 -0
- package/src/abilities/condition-types.ts +1202 -0
- package/src/abilities/cost-types.ts +344 -0
- package/src/abilities/effect-types/amount-types.ts +115 -0
- package/src/abilities/effect-types/basic-effects.ts +200 -0
- package/src/abilities/effect-types/combined-types.ts +564 -0
- package/src/abilities/effect-types/control-flow.ts +317 -0
- package/src/abilities/effect-types/index.ts +136 -0
- package/src/abilities/effect-types/modifier-effects.ts +248 -0
- package/src/abilities/effect-types/movement-effects.ts +216 -0
- package/src/abilities/effect-types/scry-effects.ts +269 -0
- package/src/abilities/helpers/Abilities.ts +172 -0
- package/src/abilities/helpers/Conditions.ts +266 -0
- package/src/abilities/helpers/Costs.ts +83 -0
- package/src/abilities/helpers/Effects.ts +182 -0
- package/src/abilities/helpers/Targets.ts +193 -0
- package/src/abilities/helpers/Triggers.ts +167 -0
- package/src/abilities/helpers/index.ts +42 -0
- package/src/abilities/index.ts +401 -0
- package/src/abilities/target-types.ts +791 -0
- package/src/abilities/trigger-types.ts +530 -0
- package/src/cards/card-types.ts +502 -0
- package/src/cards/classifications.ts +86 -0
- package/src/cards/deck-validation.ts +71 -0
- package/src/cards/index.ts +77 -0
- package/src/cards/ink-types.ts +55 -0
- package/src/game/index.ts +14 -0
- package/src/game/state-types.ts +258 -0
- package/src/index.ts +16 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combined Effect Types
|
|
3
|
+
*
|
|
4
|
+
* Aggregates all effect types into the main Effect union type,
|
|
5
|
+
* and provides shared type guards.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Import all effect types
|
|
9
|
+
import type { Condition } from "../condition-types";
|
|
10
|
+
import type { CharacterTarget } from "../target-types";
|
|
11
|
+
import type { EffectDuration } from "./amount-types";
|
|
12
|
+
import type {
|
|
13
|
+
BanishEffect,
|
|
14
|
+
DealDamageEffect,
|
|
15
|
+
DiscardEffect,
|
|
16
|
+
DrawEffect,
|
|
17
|
+
ExertEffect,
|
|
18
|
+
GainLoreEffect,
|
|
19
|
+
LookAtCardsEffect,
|
|
20
|
+
LoseLoreEffect,
|
|
21
|
+
MoveDamageEffect,
|
|
22
|
+
PutDamageEffect,
|
|
23
|
+
PutInHandEffect,
|
|
24
|
+
ReadyEffect,
|
|
25
|
+
RemoveDamageEffect,
|
|
26
|
+
} from "./basic-effects";
|
|
27
|
+
import type {
|
|
28
|
+
ChoiceEffect,
|
|
29
|
+
CompoundEffect,
|
|
30
|
+
ConditionalEffect,
|
|
31
|
+
CostEffectEffect,
|
|
32
|
+
DelayedEffect,
|
|
33
|
+
ForEachEffect,
|
|
34
|
+
ForEachOpponentEffect,
|
|
35
|
+
ForEachPlayerEffect,
|
|
36
|
+
GainAbilityEffect,
|
|
37
|
+
GrantKeywordEffect,
|
|
38
|
+
GrantKeywordsEffect,
|
|
39
|
+
LookEffect,
|
|
40
|
+
OptionalEffect,
|
|
41
|
+
PlayForFreeEffect,
|
|
42
|
+
PreventDamageEffect,
|
|
43
|
+
PutIntoHandEffect,
|
|
44
|
+
PutOnDeckEffect,
|
|
45
|
+
RedirectDamageEffect,
|
|
46
|
+
RepeatEffect,
|
|
47
|
+
RevealAndConditionalEffect,
|
|
48
|
+
SequenceEffect,
|
|
49
|
+
} from "./control-flow";
|
|
50
|
+
import type {
|
|
51
|
+
CostReductionEffect,
|
|
52
|
+
DrawUntilHandSizeEffect,
|
|
53
|
+
EntersPlayEffect,
|
|
54
|
+
GainKeywordEffect,
|
|
55
|
+
GrantAbilityEffect,
|
|
56
|
+
LoseKeywordEffect,
|
|
57
|
+
ModifyStatEffect,
|
|
58
|
+
NameACardEffect,
|
|
59
|
+
PropertyModificationEffect,
|
|
60
|
+
PutOnTopEffect,
|
|
61
|
+
RestrictionEffect,
|
|
62
|
+
RevealHandEffect,
|
|
63
|
+
RevealTopCardEffect,
|
|
64
|
+
SearchDeckEffect,
|
|
65
|
+
SetStatEffect,
|
|
66
|
+
WinConditionEffect,
|
|
67
|
+
} from "./modifier-effects";
|
|
68
|
+
import type {
|
|
69
|
+
EnablePlayFromUnderEffect,
|
|
70
|
+
GrantAbilitiesWhileHereEffect,
|
|
71
|
+
MoveCostReductionEffect,
|
|
72
|
+
MoveToLocationEffect,
|
|
73
|
+
PlayCardEffect,
|
|
74
|
+
PutIntoInkwellEffect,
|
|
75
|
+
PutOnBottomEffect,
|
|
76
|
+
PutUnderEffect,
|
|
77
|
+
ReturnFromDiscardEffect,
|
|
78
|
+
ReturnToHandEffect,
|
|
79
|
+
ShuffleIntoDeckEffect,
|
|
80
|
+
} from "./movement-effects";
|
|
81
|
+
import type { ScryEffect } from "./scry-effects";
|
|
82
|
+
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// Combined Effect Type
|
|
85
|
+
// ============================================================================
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* All possible effects
|
|
89
|
+
*/
|
|
90
|
+
export type Effect =
|
|
91
|
+
// Draw/Discard
|
|
92
|
+
| DrawEffect
|
|
93
|
+
| DiscardEffect
|
|
94
|
+
| ScryEffect
|
|
95
|
+
// Damage
|
|
96
|
+
| DealDamageEffect
|
|
97
|
+
| PutDamageEffect
|
|
98
|
+
| RemoveDamageEffect
|
|
99
|
+
| MoveDamageEffect
|
|
100
|
+
// Lore
|
|
101
|
+
| GainLoreEffect
|
|
102
|
+
| LoseLoreEffect
|
|
103
|
+
// Card State
|
|
104
|
+
| ExertEffect
|
|
105
|
+
| ReadyEffect
|
|
106
|
+
| BanishEffect
|
|
107
|
+
// Zone Movement
|
|
108
|
+
| ReturnToHandEffect
|
|
109
|
+
| ReturnFromDiscardEffect
|
|
110
|
+
| PutIntoInkwellEffect
|
|
111
|
+
| PutUnderEffect
|
|
112
|
+
| ShuffleIntoDeckEffect
|
|
113
|
+
| PutOnBottomEffect
|
|
114
|
+
// Play Card
|
|
115
|
+
| PlayCardEffect
|
|
116
|
+
| EnablePlayFromUnderEffect
|
|
117
|
+
// Location Movement
|
|
118
|
+
| MoveToLocationEffect
|
|
119
|
+
| MoveCostReductionEffect
|
|
120
|
+
| GrantAbilitiesWhileHereEffect
|
|
121
|
+
// Stat Modification
|
|
122
|
+
| ModifyStatEffect
|
|
123
|
+
| SetStatEffect
|
|
124
|
+
// Keywords
|
|
125
|
+
| GainKeywordEffect
|
|
126
|
+
| LoseKeywordEffect
|
|
127
|
+
// Restrictions
|
|
128
|
+
| RestrictionEffect
|
|
129
|
+
| GrantAbilityEffect
|
|
130
|
+
| CostReductionEffect
|
|
131
|
+
| NameACardEffect
|
|
132
|
+
| RevealTopCardEffect
|
|
133
|
+
| PutOnTopEffect
|
|
134
|
+
| DrawUntilHandSizeEffect
|
|
135
|
+
// Control Flow
|
|
136
|
+
| SequenceEffect
|
|
137
|
+
| ChoiceEffect
|
|
138
|
+
| ConditionalEffect
|
|
139
|
+
| OptionalEffect
|
|
140
|
+
| ForEachEffect
|
|
141
|
+
| RepeatEffect
|
|
142
|
+
// Reveal/Search
|
|
143
|
+
| RevealHandEffect
|
|
144
|
+
| SearchDeckEffect
|
|
145
|
+
| LookAtCardsEffect
|
|
146
|
+
| PutInHandEffect
|
|
147
|
+
// Special State Modifications
|
|
148
|
+
| EntersPlayEffect
|
|
149
|
+
| WinConditionEffect
|
|
150
|
+
| PropertyModificationEffect
|
|
151
|
+
// Additional effects for parser support
|
|
152
|
+
| CostEffectEffect
|
|
153
|
+
| RevealAndConditionalEffect
|
|
154
|
+
| GrantKeywordEffect
|
|
155
|
+
| GrantKeywordsEffect
|
|
156
|
+
| DelayedEffect
|
|
157
|
+
| PlayForFreeEffect
|
|
158
|
+
| PutOnDeckEffect
|
|
159
|
+
| LookEffect
|
|
160
|
+
| PutIntoHandEffect
|
|
161
|
+
| CompoundEffect
|
|
162
|
+
| ChallengeReadyEffect
|
|
163
|
+
| ReplacementEffect
|
|
164
|
+
| ForEachOpponentEffect
|
|
165
|
+
| ForEachPlayerEffect
|
|
166
|
+
| PreventDamageEffect
|
|
167
|
+
| GainAbilityEffect
|
|
168
|
+
| GainKeywordsEffect
|
|
169
|
+
| EntersPlayWithEffect
|
|
170
|
+
| RedirectDamageEffect
|
|
171
|
+
// Extended effects for card text coverage
|
|
172
|
+
| AdditionalInkwellEffect
|
|
173
|
+
| MoveEffect
|
|
174
|
+
| TriggeredEffectWrapper
|
|
175
|
+
| LookAtTopEffect
|
|
176
|
+
| ModalEffect
|
|
177
|
+
| AddToInkwellEffect
|
|
178
|
+
| RevealTopEffect
|
|
179
|
+
// Additional effect types for parser support
|
|
180
|
+
| PutCardUnderEffect
|
|
181
|
+
| PayCostEffect
|
|
182
|
+
| LookAtDeckEffect
|
|
183
|
+
| PreventionEffect
|
|
184
|
+
| CountEffect
|
|
185
|
+
| MoveToInkwellEffect
|
|
186
|
+
| EntersWithDamageEffect
|
|
187
|
+
| RevealEffect
|
|
188
|
+
| TakeDamageEffect
|
|
189
|
+
| SupportEffect
|
|
190
|
+
| ProtectionEffect
|
|
191
|
+
| LoreLossEffect
|
|
192
|
+
| HealEffect
|
|
193
|
+
// More additional effect types
|
|
194
|
+
| SearchEffect
|
|
195
|
+
| RevealDeckEffect
|
|
196
|
+
| DrawUntilEffect
|
|
197
|
+
| DiscardUntilEffect;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Static effects (always active, used in static abilities)
|
|
201
|
+
* These don't "happen" - they modify the game state
|
|
202
|
+
*
|
|
203
|
+
* Note: Some complex static abilities use control flow (sequence, conditional)
|
|
204
|
+
* to describe multi-step effects that should apply continuously.
|
|
205
|
+
*/
|
|
206
|
+
export type StaticEffect =
|
|
207
|
+
| ModifyStatEffect
|
|
208
|
+
| GainKeywordEffect
|
|
209
|
+
| RestrictionEffect
|
|
210
|
+
| GrantAbilityEffect
|
|
211
|
+
| EntersPlayEffect
|
|
212
|
+
| WinConditionEffect
|
|
213
|
+
| PropertyModificationEffect
|
|
214
|
+
| CostReductionEffect
|
|
215
|
+
// Extended types for complex static abilities (generated by parser)
|
|
216
|
+
| SequenceEffect
|
|
217
|
+
| ConditionalEffect
|
|
218
|
+
| OptionalEffect
|
|
219
|
+
| PlayCardEffect
|
|
220
|
+
| SearchDeckEffect
|
|
221
|
+
// Additional static effects for parser support
|
|
222
|
+
| ChallengeReadyEffect
|
|
223
|
+
| ReplacementEffect
|
|
224
|
+
| GrantKeywordEffect
|
|
225
|
+
| GrantKeywordsEffect
|
|
226
|
+
| GainKeywordsEffect
|
|
227
|
+
| EntersPlayWithEffect
|
|
228
|
+
// Extended static effects for card text coverage
|
|
229
|
+
| AdditionalInkwellEffect
|
|
230
|
+
| ForEachEffect
|
|
231
|
+
| CompoundEffect
|
|
232
|
+
| MoveCostReductionEffect
|
|
233
|
+
| GrantAbilitiesWhileHereEffect
|
|
234
|
+
| EntersWithDamageEffect
|
|
235
|
+
| LookAtTopEffect
|
|
236
|
+
| ModalEffect
|
|
237
|
+
| PropertyModificationEffect;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Gain multiple keywords effect (for static abilities)
|
|
241
|
+
*/
|
|
242
|
+
export interface GainKeywordsEffect {
|
|
243
|
+
type: "gain-keywords";
|
|
244
|
+
keywords: Array<{ keyword: string; value?: number }>;
|
|
245
|
+
target: CharacterTarget;
|
|
246
|
+
duration?: EffectDuration;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Enters play with effect
|
|
251
|
+
*/
|
|
252
|
+
export interface EntersPlayWithEffect {
|
|
253
|
+
type: "enters-play-with";
|
|
254
|
+
modification?: "damage" | "exerted" | "cards-under";
|
|
255
|
+
amount?: number;
|
|
256
|
+
damage?: number;
|
|
257
|
+
target?: CharacterTarget;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Challenge ready effect - allows challenging ready characters
|
|
262
|
+
*/
|
|
263
|
+
export interface ChallengeReadyEffect {
|
|
264
|
+
type: "challenge-ready";
|
|
265
|
+
target: CharacterTarget;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Replacement effect - replaces one event with another
|
|
270
|
+
*/
|
|
271
|
+
export interface ReplacementEffect {
|
|
272
|
+
type: "replacement";
|
|
273
|
+
replaces: "damage" | "banish" | "quest" | "damage-to-character";
|
|
274
|
+
with?: Effect | "prevent";
|
|
275
|
+
replacement?: Effect | "prevent";
|
|
276
|
+
condition?: Condition;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Additional inkwell effect - allows putting additional cards into inkwell
|
|
281
|
+
*/
|
|
282
|
+
export interface AdditionalInkwellEffect {
|
|
283
|
+
type: "additional-inkwell";
|
|
284
|
+
amount?: number;
|
|
285
|
+
target?: CharacterTarget;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Move effect - move a character to a location
|
|
290
|
+
*/
|
|
291
|
+
export interface MoveEffect {
|
|
292
|
+
type: "move";
|
|
293
|
+
target?: CharacterTarget;
|
|
294
|
+
to?: string;
|
|
295
|
+
cost?: "free" | "normal";
|
|
296
|
+
free?: boolean;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Triggered effect wrapper - for effects that contain triggered abilities
|
|
301
|
+
* @deprecated Use TriggeredAbility instead
|
|
302
|
+
*/
|
|
303
|
+
export interface TriggeredEffectWrapper {
|
|
304
|
+
type: "triggered";
|
|
305
|
+
trigger?: unknown;
|
|
306
|
+
effect?: Effect;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Look at top effect - look at top cards of deck
|
|
311
|
+
*/
|
|
312
|
+
export interface LookAtTopEffect {
|
|
313
|
+
type: "look-at-top";
|
|
314
|
+
amount?: number;
|
|
315
|
+
target?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Modal effect - choose from multiple options
|
|
320
|
+
*/
|
|
321
|
+
export interface ModalEffect {
|
|
322
|
+
type: "modal";
|
|
323
|
+
options?: Effect[];
|
|
324
|
+
chooser?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Add to inkwell effect - alias for put-into-inkwell
|
|
329
|
+
*/
|
|
330
|
+
export interface AddToInkwellEffect {
|
|
331
|
+
type: "add-to-inkwell";
|
|
332
|
+
source?: string;
|
|
333
|
+
target?: string;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Reveal top effect - reveal top card of deck
|
|
338
|
+
*/
|
|
339
|
+
export interface RevealTopEffect {
|
|
340
|
+
type: "reveal-top";
|
|
341
|
+
amount?: number;
|
|
342
|
+
target?: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Put card under effect - put a card under another card
|
|
347
|
+
*/
|
|
348
|
+
export interface PutCardUnderEffect {
|
|
349
|
+
type: "put-card-under";
|
|
350
|
+
source?: string;
|
|
351
|
+
under?: CharacterTarget | string;
|
|
352
|
+
cardType?: string;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Pay cost effect - pay a cost as part of an effect
|
|
357
|
+
*/
|
|
358
|
+
export interface PayCostEffect {
|
|
359
|
+
type: "pay-cost";
|
|
360
|
+
cost?: { ink?: number; exert?: boolean };
|
|
361
|
+
effect?: Effect;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Look at deck effect - look at cards in deck
|
|
366
|
+
*/
|
|
367
|
+
export interface LookAtDeckEffect {
|
|
368
|
+
type: "look-at-deck";
|
|
369
|
+
amount?: number;
|
|
370
|
+
target?: string;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Prevention effect - prevent something from happening
|
|
375
|
+
*/
|
|
376
|
+
export interface PreventionEffect {
|
|
377
|
+
type: "prevention";
|
|
378
|
+
prevents?: string;
|
|
379
|
+
target?: CharacterTarget;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Count effect - count something
|
|
384
|
+
*/
|
|
385
|
+
export interface CountEffect {
|
|
386
|
+
type: "count";
|
|
387
|
+
what?: string;
|
|
388
|
+
controller?: string;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Move to inkwell effect
|
|
393
|
+
*/
|
|
394
|
+
export interface MoveToInkwellEffect {
|
|
395
|
+
type: "move-to-inkwell";
|
|
396
|
+
target?: CharacterTarget | string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Enters with damage effect
|
|
401
|
+
*/
|
|
402
|
+
export interface EntersWithDamageEffect {
|
|
403
|
+
type: "enters-with-damage";
|
|
404
|
+
amount?: number;
|
|
405
|
+
target?: CharacterTarget;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Reveal effect - reveal cards
|
|
410
|
+
*/
|
|
411
|
+
export interface RevealEffect {
|
|
412
|
+
type: "reveal";
|
|
413
|
+
source?: string;
|
|
414
|
+
amount?: number;
|
|
415
|
+
target?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Take damage effect - character takes damage
|
|
420
|
+
*/
|
|
421
|
+
export interface TakeDamageEffect {
|
|
422
|
+
type: "take-damage";
|
|
423
|
+
amount?: number;
|
|
424
|
+
target?: CharacterTarget;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Support effect - support ability
|
|
429
|
+
*/
|
|
430
|
+
export interface SupportEffect {
|
|
431
|
+
type: "support";
|
|
432
|
+
target?: CharacterTarget;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Protection effect - protect from something
|
|
437
|
+
*/
|
|
438
|
+
export interface ProtectionEffect {
|
|
439
|
+
type: "protection";
|
|
440
|
+
from?: string;
|
|
441
|
+
target?: CharacterTarget;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Lore loss effect - lose lore
|
|
446
|
+
*/
|
|
447
|
+
export interface LoreLossEffect {
|
|
448
|
+
type: "lore-loss";
|
|
449
|
+
amount?: number;
|
|
450
|
+
target?: string;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Heal effect - remove damage
|
|
455
|
+
*/
|
|
456
|
+
export interface HealEffect {
|
|
457
|
+
type: "heal";
|
|
458
|
+
amount?: number;
|
|
459
|
+
target?: CharacterTarget;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Search effect - search for cards
|
|
464
|
+
*/
|
|
465
|
+
export interface SearchEffect {
|
|
466
|
+
type: "search";
|
|
467
|
+
cardType?: string;
|
|
468
|
+
target?: string;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Reveal deck effect - reveal cards from deck
|
|
473
|
+
*/
|
|
474
|
+
export interface RevealDeckEffect {
|
|
475
|
+
type: "reveal-deck";
|
|
476
|
+
amount?: number;
|
|
477
|
+
target?: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Draw until effect - draw until a condition is met
|
|
482
|
+
*/
|
|
483
|
+
export interface DrawUntilEffect {
|
|
484
|
+
type: "draw-until";
|
|
485
|
+
condition?: string;
|
|
486
|
+
target?: string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Discard until effect - discard until a condition is met
|
|
491
|
+
*/
|
|
492
|
+
export interface DiscardUntilEffect {
|
|
493
|
+
type: "discard-until";
|
|
494
|
+
condition?: string;
|
|
495
|
+
target?: string;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// ============================================================================
|
|
499
|
+
// Type Guards
|
|
500
|
+
// ============================================================================
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Check if effect is a control flow effect
|
|
504
|
+
*/
|
|
505
|
+
export function isControlFlowEffect(
|
|
506
|
+
effect: Effect,
|
|
507
|
+
): effect is
|
|
508
|
+
| SequenceEffect
|
|
509
|
+
| ChoiceEffect
|
|
510
|
+
| ConditionalEffect
|
|
511
|
+
| OptionalEffect
|
|
512
|
+
| ForEachEffect
|
|
513
|
+
| RepeatEffect {
|
|
514
|
+
return (
|
|
515
|
+
effect.type === "sequence" ||
|
|
516
|
+
effect.type === "choice" ||
|
|
517
|
+
effect.type === "conditional" ||
|
|
518
|
+
effect.type === "optional" ||
|
|
519
|
+
effect.type === "for-each" ||
|
|
520
|
+
effect.type === "repeat"
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Check if effect targets characters
|
|
526
|
+
*
|
|
527
|
+
* Handles both string character targets and query-based character targets.
|
|
528
|
+
* Query objects can be identified by character-specific properties like
|
|
529
|
+
* `owner` (yours/opponent) or the presence of character filters.
|
|
530
|
+
*/
|
|
531
|
+
export function targetsCharacters(effect: Effect): boolean {
|
|
532
|
+
if (!("target" in effect)) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
const target = effect.target;
|
|
537
|
+
|
|
538
|
+
// String character targets
|
|
539
|
+
if (typeof target === "string") {
|
|
540
|
+
return (
|
|
541
|
+
target.includes("CHARACTER") ||
|
|
542
|
+
target === "SELF" ||
|
|
543
|
+
target === "THIS_CHARACTER"
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Query-based character targets - check for character-specific properties
|
|
548
|
+
// Character queries have 'owner' property or character filters
|
|
549
|
+
if (typeof target === "object" && target !== null) {
|
|
550
|
+
// Check for character query indicators
|
|
551
|
+
return (
|
|
552
|
+
"owner" in target || ("filter" in target && Array.isArray(target.filter))
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Check if effect is a scry effect
|
|
561
|
+
*/
|
|
562
|
+
export function isScryEffect(effect: Effect): effect is ScryEffect {
|
|
563
|
+
return effect.type === "scry";
|
|
564
|
+
}
|