@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,167 @@
1
+ /**
2
+ * Trigger Helpers for Lorcana Abilities
3
+ *
4
+ * Provides a fluent API for building trigger definitions.
5
+ * These helpers make it easy to construct common trigger patterns.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const trigger = Triggers.WhenYouPlay();
10
+ * const trigger = Triggers.WheneverThisQuests();
11
+ * const trigger = Triggers.AtStartOfYourTurn();
12
+ * ```
13
+ */
14
+
15
+ import type { Trigger, TriggerSubject, TriggerTiming } from "../trigger-types";
16
+
17
+ export const Triggers = {
18
+ /**
19
+ * "When you play this character"
20
+ */
21
+ WhenYouPlay: (on: TriggerSubject = "SELF"): Trigger => ({
22
+ event: "play",
23
+ timing: "when",
24
+ on,
25
+ }),
26
+
27
+ /**
28
+ * "Whenever this character quests"
29
+ */
30
+ WheneverThisQuests: (): Trigger => ({
31
+ event: "quest",
32
+ timing: "whenever",
33
+ on: "SELF",
34
+ }),
35
+
36
+ /**
37
+ * "When this character is banished"
38
+ */
39
+ WhenBanished: (on: TriggerSubject = "SELF"): Trigger => ({
40
+ event: "banish",
41
+ timing: "when",
42
+ on,
43
+ }),
44
+
45
+ /**
46
+ * "When this character is banished in a challenge"
47
+ */
48
+ BanishInChallenge: (params: {
49
+ timing: TriggerTiming;
50
+ on: TriggerSubject;
51
+ }): Trigger => ({
52
+ event: "banish-in-challenge",
53
+ ...params,
54
+ }),
55
+
56
+ /**
57
+ * "At the start of your turn"
58
+ */
59
+ AtStartOfYourTurn: (): Trigger => ({
60
+ event: "start-turn",
61
+ timing: "at",
62
+ on: "YOU",
63
+ }),
64
+
65
+ /**
66
+ * "At the end of your turn"
67
+ */
68
+ AtEndOfYourTurn: (): Trigger => ({
69
+ event: "end-turn",
70
+ timing: "at",
71
+ on: "YOU",
72
+ }),
73
+
74
+ /**
75
+ * "Whenever you play a character"
76
+ */
77
+ WheneverYouPlayCharacter: (): Trigger => ({
78
+ event: "play",
79
+ timing: "whenever",
80
+ on: { controller: "you", cardType: "character" },
81
+ }),
82
+
83
+ /**
84
+ * "Whenever you play a song"
85
+ */
86
+ WheneverYouPlaySong: (): Trigger => ({
87
+ event: "play",
88
+ timing: "whenever",
89
+ on: { controller: "you", cardType: "song" },
90
+ }),
91
+
92
+ /**
93
+ * "Whenever you play a Floodborn character"
94
+ */
95
+ WheneverYouPlayFloodborn: (): Trigger => ({
96
+ event: "play",
97
+ timing: "whenever",
98
+ on: {
99
+ controller: "you",
100
+ cardType: "character",
101
+ classification: "Floodborn",
102
+ },
103
+ }),
104
+
105
+ /**
106
+ * "When this character leaves play"
107
+ */
108
+ WhenLeavePlay: (): Trigger => ({
109
+ event: "leave-play",
110
+ timing: "when",
111
+ on: "SELF",
112
+ }),
113
+
114
+ /**
115
+ * "Whenever one of your other characters is banished"
116
+ */
117
+ WheneverYourOtherCharacterBanished: (): Trigger => ({
118
+ event: "banish",
119
+ timing: "whenever",
120
+ on: "YOUR_OTHER_CHARACTERS",
121
+ }),
122
+
123
+ /**
124
+ * "Whenever an opposing character is banished"
125
+ */
126
+ WheneverOpponentCharacterBanished: (): Trigger => ({
127
+ event: "banish",
128
+ timing: "whenever",
129
+ on: "OPPONENT_CHARACTERS",
130
+ }),
131
+
132
+ /**
133
+ * "Whenever you draw a card"
134
+ */
135
+ WheneverYouDraw: (): Trigger => ({
136
+ event: "draw",
137
+ timing: "whenever",
138
+ on: "YOU",
139
+ }),
140
+
141
+ /**
142
+ * "Whenever you gain lore"
143
+ */
144
+ WheneverYouGainLore: (): Trigger => ({
145
+ event: "gain-lore",
146
+ timing: "whenever",
147
+ on: "YOU",
148
+ }),
149
+
150
+ /**
151
+ * "Whenever this character challenges"
152
+ */
153
+ WheneverThisChallenges: (): Trigger => ({
154
+ event: "challenge",
155
+ timing: "whenever",
156
+ on: "SELF",
157
+ }),
158
+
159
+ /**
160
+ * "Whenever this character is challenged"
161
+ */
162
+ WheneverThisChallenged: (): Trigger => ({
163
+ event: "challenged",
164
+ timing: "whenever",
165
+ on: "SELF",
166
+ }),
167
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Lorcana Ability Helpers
3
+ *
4
+ * Fluent API for building ability definitions with type safety.
5
+ * These helpers provide a convenient way to construct abilities without
6
+ * manually creating nested objects.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { Abilities, Triggers, Effects, Targets, Conditions, Costs } from "@drmxrcy/tcg-lorcana-types";
11
+ *
12
+ * // Simple keyword
13
+ * const rush = Abilities.Keyword("Rush");
14
+ *
15
+ * // Triggered ability
16
+ * const heroism = Abilities.Triggered({
17
+ * name: "HEROISM",
18
+ * trigger: Triggers.BanishInChallenge({ timing: "when", on: "SELF" }),
19
+ * effect: Effects.Banish({
20
+ * target: Targets.ChallengedCharacter(),
21
+ * optional: true
22
+ * })
23
+ * });
24
+ *
25
+ * // Static ability with condition
26
+ * const camouflage = Abilities.Static({
27
+ * name: "CAMOUFLAGE",
28
+ * condition: Conditions.HasAnotherCharacter(),
29
+ * effect: Effects.GainKeyword({
30
+ * keyword: "Evasive",
31
+ * target: Targets.Self()
32
+ * })
33
+ * });
34
+ * ```
35
+ */
36
+
37
+ export { Abilities } from "./Abilities";
38
+ export { Conditions } from "./Conditions";
39
+ export { Costs } from "./Costs";
40
+ export { Effects } from "./Effects";
41
+ export { Targets } from "./Targets";
42
+ export { Triggers } from "./Triggers";
@@ -0,0 +1,401 @@
1
+ /**
2
+ * Lorcana Ability Types
3
+ *
4
+ * Complete type system for Lorcana card abilities.
5
+ */
6
+
7
+ // Ability Types
8
+ export type {
9
+ // Main ability types
10
+ Ability,
11
+ AbilityWithText,
12
+ ActionAbility,
13
+ ActivatedAbility,
14
+ ActivatedRestriction,
15
+ ComplexKeywordType,
16
+ // Keyword types
17
+ KeywordAbility,
18
+ KeywordType,
19
+ ParameterizedKeywordAbility,
20
+ ParameterizedKeywordType,
21
+ ReplacementAbility,
22
+ // Supporting types
23
+ Restriction,
24
+ ShiftKeywordAbility,
25
+ SimpleKeywordAbility,
26
+ SimpleKeywordType,
27
+ StaticAbility,
28
+ StaticAffects,
29
+ // Other ability types
30
+ TriggeredAbility,
31
+ ValueKeywordAbility,
32
+ ValueKeywordType,
33
+ } from "./ability-types";
34
+
35
+ export {
36
+ actionAbility,
37
+ activated,
38
+ boost,
39
+ challenger,
40
+ isActionAbility,
41
+ isActivatedAbility,
42
+ isComplexKeyword,
43
+ // Type guards
44
+ isKeywordAbility,
45
+ isNamedAbility,
46
+ isParameterizedKeyword,
47
+ isParameterizedKeywordAbility,
48
+ isReplacementAbility,
49
+ isShiftKeyword,
50
+ isShiftKeywordAbility,
51
+ isSimpleKeyword,
52
+ isSimpleKeywordAbility,
53
+ isStaticAbility,
54
+ isTriggeredAbility,
55
+ isValueKeyword,
56
+ isValueKeywordAbility,
57
+ // Builders
58
+ keyword,
59
+ resist,
60
+ shift,
61
+ shiftInk,
62
+ singer,
63
+ singTogether,
64
+ staticAbility,
65
+ triggered,
66
+ } from "./ability-types";
67
+
68
+ // Condition Types
69
+ export type {
70
+ // Logical conditions
71
+ AndCondition,
72
+ AtLocationCondition,
73
+ ClassificationCharacterCountCondition,
74
+ // Comparison conditions
75
+ ComparisonCondition,
76
+ ComparisonValue,
77
+ Condition,
78
+ CountableResource,
79
+ // Count conditions
80
+ CountCondition,
81
+ DamageComparisonCondition,
82
+ FirstThisTurnCondition,
83
+ HasAnyDamageCondition,
84
+ HasCardUnderCondition,
85
+ // Character existence conditions
86
+ HasCharacterCondition,
87
+ HasCharacterCountCondition,
88
+ HasCharacterHereCondition,
89
+ HasCharacterWithClassificationCondition,
90
+ HasCharacterWithKeywordCondition,
91
+ // Damage conditions
92
+ HasDamageCondition,
93
+ // Item existence conditions
94
+ HasItemCondition,
95
+ HasItemCountCondition,
96
+ // Location conditions
97
+ HasLocationCondition,
98
+ HasLocationCountCondition,
99
+ HasNamedCharacterCondition,
100
+ HasNamedItemCondition,
101
+ HasNamedLocationCondition,
102
+ // Parser catch-all
103
+ IfCondition,
104
+ // Combat conditions
105
+ InChallengeCondition,
106
+ // Zone presence conditions
107
+ InInkwellCondition,
108
+ InPlayCondition,
109
+ // State conditions
110
+ IsExertedCondition,
111
+ IsReadyCondition,
112
+ KeywordCharacterCountCondition,
113
+ NoDamageCondition,
114
+ NotCondition,
115
+ OrCondition,
116
+ // Choice conditions
117
+ PlayerChoiceCondition,
118
+ // Legacy resolution (deprecated)
119
+ ResolutionCondition,
120
+ ResourceCountCondition,
121
+ RevealedMatchesNamedCondition,
122
+ // This-turn conditions
123
+ ThisTurnCondition,
124
+ ThisTurnCountCondition,
125
+ ThisTurnEvent,
126
+ ThisTurnHappenedCondition,
127
+ // Turn conditions
128
+ TurnCondition,
129
+ // Game state conditions
130
+ UsedShiftCondition,
131
+ // Zone conditions
132
+ ZoneCondition,
133
+ } from "./condition-types";
134
+
135
+ export {
136
+ and,
137
+ hasCharacterCount,
138
+ // Condition builders
139
+ hasCharacterNamed,
140
+ hasCharacterWithClassification,
141
+ hasCharacterWithKeyword,
142
+ ifUsedShift,
143
+ inChallenge,
144
+ isCountCondition,
145
+ // Type guards
146
+ isLogicalCondition,
147
+ isPlayerChoice,
148
+ or,
149
+ resourceCount,
150
+ thisTurnHappened,
151
+ whileHasDamage,
152
+ whileNoDamage,
153
+ youMay,
154
+ } from "./condition-types";
155
+
156
+ // Cost Types
157
+ export type {
158
+ AbilityCost,
159
+ BanishCost,
160
+ CostComponent,
161
+ DamageSelfCost,
162
+ DiscardCost,
163
+ ExertCost,
164
+ ExertOtherCost,
165
+ InkCost,
166
+ PutUnderCost,
167
+ ReturnToHandCost,
168
+ } from "./cost-types";
169
+
170
+ export {
171
+ banishSelfCost,
172
+ discardCost,
173
+ exertAndBanishItemCost,
174
+ exertAndInkCost,
175
+ // Cost builders
176
+ exertCost,
177
+ getInkCost,
178
+ isFreeCost,
179
+ requiresBanish,
180
+ requiresDiscard,
181
+ // Type guards
182
+ requiresExert,
183
+ requiresInk,
184
+ } from "./cost-types";
185
+
186
+ // Effect Types
187
+ export type {
188
+ // Amount types
189
+ Amount,
190
+ BanishEffect,
191
+ ChoiceEffect,
192
+ ConditionalEffect,
193
+ CostReductionEffect,
194
+ // Damage effects
195
+ DealDamageEffect,
196
+ DiscardEffect,
197
+ // Draw/Discard effects
198
+ DrawEffect,
199
+ DrawUntilHandSizeEffect,
200
+ // Core effect union types
201
+ Effect,
202
+ // Duration type
203
+ EffectDuration,
204
+ EnablePlayFromUnderEffect,
205
+ // Special state modification effects
206
+ EntersPlayEffect,
207
+ // Card state effects
208
+ ExertEffect,
209
+ ForEachCounter,
210
+ ForEachEffect,
211
+ // Keyword effects
212
+ GainKeywordEffect,
213
+ // Lore effects
214
+ GainLoreEffect,
215
+ GrantAbilityEffect,
216
+ LoseKeywordEffect,
217
+ LoseLoreEffect,
218
+ // Stat modification effects
219
+ ModifyStatEffect,
220
+ MoveDamageEffect,
221
+ // Location movement effects
222
+ MoveToLocationEffect,
223
+ NameACardEffect,
224
+ OptionalEffect,
225
+ // Play card effects
226
+ PlayCardEffect,
227
+ PropertyModificationEffect,
228
+ PutDamageEffect,
229
+ PutIntoInkwellEffect,
230
+ PutOnBottomEffect,
231
+ PutOnTopEffect,
232
+ PutUnderEffect,
233
+ ReadyEffect,
234
+ RemoveDamageEffect,
235
+ RepeatEffect,
236
+ // Restriction effects
237
+ RestrictionEffect,
238
+ ReturnFromDiscardEffect,
239
+ // Zone movement effects
240
+ ReturnToHandEffect,
241
+ RevealHandEffect,
242
+ // Reveal effects
243
+ RevealTopCardEffect,
244
+ // Scry effect (look at top X cards)
245
+ ScryAndFilter,
246
+ ScryCardFilter,
247
+ ScryCardOrdering,
248
+ ScryCardTypeFilter,
249
+ ScryClassificationFilter,
250
+ ScryCostComparisonFilter,
251
+ ScryDeckBottomDestination,
252
+ ScryDeckTopDestination,
253
+ ScryDestination,
254
+ ScryDiscardDestination,
255
+ ScryEffect,
256
+ ScryFloodbornFilter,
257
+ ScryHandDestination,
258
+ ScryInkwellDestination,
259
+ ScryKeywordFilter,
260
+ ScryNameFilter,
261
+ ScryNotFilter,
262
+ ScryOrFilter,
263
+ ScryPlayDestination,
264
+ ScrySongFilter,
265
+ // Search effects
266
+ SearchDeckEffect,
267
+ // Control flow effects
268
+ SequenceEffect,
269
+ SetStatEffect,
270
+ ShuffleIntoDeckEffect,
271
+ StaticEffect,
272
+ VariableAmount,
273
+ WinConditionEffect,
274
+ } from "./effect-types";
275
+
276
+ export {
277
+ // Type guards
278
+ isControlFlowEffect,
279
+ isScryDeckBottomDestination,
280
+ isScryDeckTopDestination,
281
+ isScryDiscardDestination,
282
+ isScryEffect,
283
+ isScryHandDestination,
284
+ isScryInkwellDestination,
285
+ isScryPlayDestination,
286
+ isScryRemainderDestination,
287
+ isVariableAmount,
288
+ targetsCharacters,
289
+ } from "./effect-types";
290
+ // Helpers
291
+ export {
292
+ Abilities,
293
+ Conditions,
294
+ Costs,
295
+ Effects,
296
+ Targets,
297
+ Triggers,
298
+ } from "./helpers";
299
+ // Target Types
300
+ export type {
301
+ AllMatchingCharacterQuery,
302
+ AllMatchingItemQuery,
303
+ AllMatchingLocationQuery,
304
+ AttributeBooleanFilter,
305
+ // Attribute filter
306
+ AttributeFilter,
307
+ AttributeNumericFilter,
308
+ AttributeStringFilter,
309
+ // Filters
310
+ CardFilter,
311
+ // Card references
312
+ CardReference,
313
+ // Card targeting
314
+ CardTarget,
315
+ CardTargetEnum,
316
+ ChallengeRoleFilter,
317
+ CharacterFilter,
318
+ CharacterQueryBase,
319
+ // Character targeting
320
+ CharacterTarget,
321
+ CharacterTargetEnum,
322
+ CharacterTargetQuery,
323
+ ComparisonOperator,
324
+ // Numeric filters
325
+ CostComparisonFilter,
326
+ // State filters
327
+ DamagedFilter,
328
+ ExactCountCharacterQuery,
329
+ ExactCountItemQuery,
330
+ ExactCountLocationQuery,
331
+ ExertedFilter,
332
+ HasClassificationFilter,
333
+ // Property filters
334
+ HasKeywordFilter,
335
+ HasNameFilter,
336
+ ItemFilter,
337
+ ItemQueryBase,
338
+ // Item targeting
339
+ ItemTarget,
340
+ ItemTargetEnum,
341
+ ItemTargetQuery,
342
+ LocationFilter,
343
+ LocationQueryBase,
344
+ // Location targeting
345
+ LocationTarget,
346
+ LocationTargetEnum,
347
+ LocationTargetQuery,
348
+ // Context
349
+ LorcanaContext,
350
+ LoreComparisonFilter,
351
+ MoveCostComparisonFilter,
352
+ OwnerFilter,
353
+ // Player targeting
354
+ PlayerTarget,
355
+ ReadyFilter,
356
+ // Source filters
357
+ SourceFilter,
358
+ StrengthComparisonFilter,
359
+ TargetController,
360
+ // Zone/Controller types
361
+ TargetZone,
362
+ UndamagedFilter,
363
+ UpToCountCharacterQuery,
364
+ UpToCountItemQuery,
365
+ UpToCountLocationQuery,
366
+ WillpowerComparisonFilter,
367
+ // Zone/Owner filters
368
+ ZoneFilter,
369
+ } from "./target-types";
370
+ export {
371
+ // Type guards
372
+ isCardReference,
373
+ isCharacterTargetQuery,
374
+ isItemTargetQuery,
375
+ isLocationTargetQuery,
376
+ } from "./target-types";
377
+ // Trigger Types
378
+ export type {
379
+ BaseTrigger,
380
+ ChallengeTrigger,
381
+ ChallengeTriggerContext,
382
+ Trigger,
383
+ TriggerCardType,
384
+ TriggerEvent,
385
+ TriggerRestriction,
386
+ TriggerSourceReference,
387
+ TriggerSubject,
388
+ TriggerSubjectEnum,
389
+ TriggerSubjectQuery,
390
+ TriggerTiming,
391
+ } from "./trigger-types";
392
+ export {
393
+ // Common triggers
394
+ COMMON_TRIGGERS,
395
+ hasRestriction,
396
+ // Type guards
397
+ isChallengeTrigger,
398
+ isPhaseTrigger,
399
+ isSelfTrigger,
400
+ isTriggerSubjectQuery,
401
+ } from "./trigger-types";