@champions-digital-game/mod-sdk 0.51.0 → 0.53.0

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.
Files changed (36) hide show
  1. package/README.md +8 -4
  2. package/dist/build.js +1 -1
  3. package/dist/chunks/{chunk-TUJLFNR7.js → chunk-3SR23UJ7.js} +1 -1
  4. package/dist/chunks/chunk-3YMCANI3.js +1 -0
  5. package/dist/chunks/{chunk-EKR67REN.js → chunk-ACT4TJXC.js} +6 -6
  6. package/dist/chunks/{chunk-Y6B5ZZGK.js → chunk-D5S6EHFQ.js} +1 -1
  7. package/dist/chunks/{chunk-JR3ALXBR.js → chunk-DX44O32N.js} +1 -1
  8. package/dist/chunks/{chunk-S3DCO2A6.js → chunk-S3JH4WL4.js} +1 -1
  9. package/dist/chunks/{chunk-GK7LCLI7.js → chunk-WFEXO5DU.js} +1 -1
  10. package/dist/import.js +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/mc-pack.js +7 -5
  13. package/dist/testing.js +1 -1
  14. package/package.json +3 -2
  15. package/types/cards/src/dsl/abilities.d.ts +60 -9
  16. package/types/cards/src/dsl/effects.d.ts +14 -0
  17. package/types/cards/src/wave11/luke_cage/leadership.d.ts +2 -1
  18. package/types/content/src/index.d.ts +1 -1
  19. package/types/content/src/schema/sets.d.ts +6 -0
  20. package/types/engine/src/choices.d.ts +8 -0
  21. package/types/engine/src/effects.d.ts +39 -2
  22. package/types/engine/src/events.d.ts +4 -2
  23. package/types/engine/src/index.d.ts +2 -1
  24. package/types/engine/src/legal.d.ts +2 -0
  25. package/types/engine/src/query.d.ts +9 -2
  26. package/types/engine/src/resolve/discarded-card.d.ts +84 -0
  27. package/types/engine/src/resolve/hand-discard.d.ts +20 -0
  28. package/types/engine/src/resolve/target-validity.d.ts +14 -1
  29. package/types/engine/src/resolve/triggers.d.ts +1 -1
  30. package/types/engine/src/search-findable.d.ts +41 -0
  31. package/types/engine/src/select.d.ts +5 -0
  32. package/types/engine/src/spec.d.ts +7 -0
  33. package/types/engine/src/state.d.ts +16 -0
  34. package/types/engine/src/trigger-events.d.ts +45 -5
  35. package/types/mod-sdk/src/typecheck.d.ts +23 -0
  36. package/dist/chunks/chunk-6F73M3HY.js +0 -1
@@ -2877,6 +2877,21 @@ export declare const on: {
2877
2877
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
2878
2878
  readonly yours?: boolean;
2879
2879
  }) => EventPattern;
2880
+ /**
2881
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
2882
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
2883
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
2884
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
2885
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
2886
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
2887
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
2888
+ */
2889
+ readonly cardDiscardedFromHand: (opts?: {
2890
+ readonly card?: TargetQuery;
2891
+ readonly by?: LeaveCauseSide;
2892
+ readonly how?: "effect" | "cost";
2893
+ readonly yours?: boolean;
2894
+ }) => EventPattern;
2880
2895
  /**
2881
2896
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
2882
2897
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -2902,7 +2917,9 @@ export declare const on: {
2902
2917
  * "After you discard a card from the top of your deck" (The Painted Lady, `next_evol` 40045; docs/phase7-wave7.md
2903
2918
  * §3.55), on a card in play: each card discarded from its controller's deck, by any card's effect or cost (§4.1
2904
2919
  * Q31). "That card" is `eventTarget`, in the discard pile, or in the new deck when its discard emptied the deck.
2905
- * Once another response has moved that card (its own "add it to your hand") this one is no longer offered for it.
2920
+ * Once another response has moved that card (its own "add it to your hand") a response whose every part acts on that
2921
+ * card is no longer offered for it; one that does something else ("draw 1 card") still is (issue #928). Nothing to
2922
+ * mark: the engine reads it from the effects.
2906
2923
  */
2907
2924
  readonly youDiscardFromYourDeck: () => EventPattern;
2908
2925
  /**
@@ -2929,8 +2946,8 @@ export declare const on: {
2929
2946
  * A response only, on a card in play. The cards one effect or cost discarded share one response window (RRG 1.8
2930
2947
  * "Triggering Condition", p. 45), which resolves before the discarding ability's next effect, or before its effects
2931
2948
  * for a cost. A card the response moves is no longer among that ability's cards "discarded this way" (wave 7 §4.1
2932
- * Q32), and no other response is offered for it. The card whose discard emptied the deck is in the new deck when
2933
- * the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
2949
+ * Q32), and no response whose every part needs it is offered for it (issue #928). The card whose discard emptied
2950
+ * the deck is in the new deck when the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
2934
2951
  */
2935
2952
  /**
2936
2953
  * "When a card is put into Damnation from a player's deck" (Exposing Intentions, community pack `mephisto-nep` 14):
@@ -3822,6 +3839,21 @@ export declare const when: {
3822
3839
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
3823
3840
  readonly yours?: boolean;
3824
3841
  }) => EventPattern;
3842
+ /**
3843
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
3844
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
3845
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
3846
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
3847
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
3848
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
3849
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
3850
+ */
3851
+ readonly cardDiscardedFromHand: (opts?: {
3852
+ readonly card?: TargetQuery;
3853
+ readonly by?: LeaveCauseSide;
3854
+ readonly how?: "effect" | "cost";
3855
+ readonly yours?: boolean;
3856
+ }) => EventPattern;
3825
3857
  /**
3826
3858
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
3827
3859
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -3847,7 +3879,9 @@ export declare const when: {
3847
3879
  * "After you discard a card from the top of your deck" (The Painted Lady, `next_evol` 40045; docs/phase7-wave7.md
3848
3880
  * §3.55), on a card in play: each card discarded from its controller's deck, by any card's effect or cost (§4.1
3849
3881
  * Q31). "That card" is `eventTarget`, in the discard pile, or in the new deck when its discard emptied the deck.
3850
- * Once another response has moved that card (its own "add it to your hand") this one is no longer offered for it.
3882
+ * Once another response has moved that card (its own "add it to your hand") a response whose every part acts on that
3883
+ * card is no longer offered for it; one that does something else ("draw 1 card") still is (issue #928). Nothing to
3884
+ * mark: the engine reads it from the effects.
3851
3885
  */
3852
3886
  readonly youDiscardFromYourDeck: () => EventPattern;
3853
3887
  /**
@@ -3874,8 +3908,8 @@ export declare const when: {
3874
3908
  * A response only, on a card in play. The cards one effect or cost discarded share one response window (RRG 1.8
3875
3909
  * "Triggering Condition", p. 45), which resolves before the discarding ability's next effect, or before its effects
3876
3910
  * for a cost. A card the response moves is no longer among that ability's cards "discarded this way" (wave 7 §4.1
3877
- * Q32), and no other response is offered for it. The card whose discard emptied the deck is in the new deck when
3878
- * the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
3911
+ * Q32), and no response whose every part needs it is offered for it (issue #928). The card whose discard emptied
3912
+ * the deck is in the new deck when the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
3879
3913
  */
3880
3914
  /**
3881
3915
  * "When a card is put into Damnation from a player's deck" (Exposing Intentions, community pack `mephisto-nep` 14):
@@ -4767,6 +4801,21 @@ export declare const after: {
4767
4801
  readonly how?: TuckedDiscardCause | readonly TuckedDiscardCause[];
4768
4802
  readonly yours?: boolean;
4769
4803
  }) => EventPattern;
4804
+ /**
4805
+ * "After a card is discarded [from a hand] by an ability" (issue #922; the Hulk house rule pack's "Don't Make Me
4806
+ * Angry!"), on a card in play: each card a card's ability discards from a hand, by its effect or its cost, "that card"
4807
+ * being `eventTarget` in its discard pile and the hand's player `eventPlayer`. Not the cards spent to pay, the discard
4808
+ * down to hand size or a mulligan. `card` narrows the discarded card; `by` the side of the discarding card, `how`
4809
+ * its effect or its cost; `yours`: only from this card's controller's hand. A response only: the cards one effect or
4810
+ * cost discarded share one window, which resolves before that ability goes on. Merge it with the deck and play
4811
+ * patterns in one `on: [...]` list to give one ability one limit for every place a card is discarded from.
4812
+ */
4813
+ readonly cardDiscardedFromHand: (opts?: {
4814
+ readonly card?: TargetQuery;
4815
+ readonly by?: LeaveCauseSide;
4816
+ readonly how?: "effect" | "cost";
4817
+ readonly yours?: boolean;
4818
+ }) => EventPattern;
4770
4819
  /**
4771
4820
  * "After this card enters your hand" (Infiltration, Shapeshifter Surprise, `mut_gen` 32082-32083;
4772
4821
  * docs/phase7-wave6.md §3.10): however it enters a hand (drawn, searched for, returned, moved there). Pair with
@@ -4792,7 +4841,9 @@ export declare const after: {
4792
4841
  * "After you discard a card from the top of your deck" (The Painted Lady, `next_evol` 40045; docs/phase7-wave7.md
4793
4842
  * §3.55), on a card in play: each card discarded from its controller's deck, by any card's effect or cost (§4.1
4794
4843
  * Q31). "That card" is `eventTarget`, in the discard pile, or in the new deck when its discard emptied the deck.
4795
- * Once another response has moved that card (its own "add it to your hand") this one is no longer offered for it.
4844
+ * Once another response has moved that card (its own "add it to your hand") a response whose every part acts on that
4845
+ * card is no longer offered for it; one that does something else ("draw 1 card") still is (issue #928). Nothing to
4846
+ * mark: the engine reads it from the effects.
4796
4847
  */
4797
4848
  readonly youDiscardFromYourDeck: () => EventPattern;
4798
4849
  /**
@@ -4819,8 +4870,8 @@ export declare const after: {
4819
4870
  * A response only, on a card in play. The cards one effect or cost discarded share one response window (RRG 1.8
4820
4871
  * "Triggering Condition", p. 45), which resolves before the discarding ability's next effect, or before its effects
4821
4872
  * for a cost. A card the response moves is no longer among that ability's cards "discarded this way" (wave 7 §4.1
4822
- * Q32), and no other response is offered for it. The card whose discard emptied the deck is in the new deck when
4823
- * the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
4873
+ * Q32), and no response whose every part needs it is offered for it (issue #928). The card whose discard emptied
4874
+ * the deck is in the new deck when the response resolves (RRG 1.8 "Encounter Deck", p. 17), and is taken from there.
4824
4875
  */
4825
4876
  /**
4826
4877
  * "When a card is put into Damnation from a player's deck" (Exposing Intentions, community pack `mephisto-nep` 14):
@@ -354,7 +354,21 @@ export declare const chooseTarget: (slot: string, q: TargetQuery, opts?: {
354
354
  readonly upTo?: boolean;
355
355
  readonly optional?: boolean;
356
356
  readonly count?: Amount;
357
+ /**
358
+ * The question the client asks, for a pick whose role the plain "Choose a target" doesn't say ("FROM" / "TO"): a
359
+ * client message key (`choicePrompt.*`, translated), or plain text.
360
+ */
361
+ readonly prompt?: string;
357
362
  }) => EffectSpec;
363
+ /**
364
+ * "Choose a player" whose effects act on the minions (or, with `kind: "enemy"`, the enemies) engaged with that player:
365
+ * Explosive Arrow, Multi-Gun, Spray Fire and the like (issue #911, Quin 2026-11-20). Only players with one engaged are
366
+ * offered, and one such player is chosen without asking (`choosePlayer`'s `among`). With none engaged anywhere no
367
+ * player is chosen, so the effects on that player's minions find nothing while the rest of the ability (the villain's
368
+ * damage) resolves. Engine reading (authority step 5), the owner's decision: naming a player with no engaged minion
369
+ * changes nothing the card does.
370
+ */
371
+ export declare const choosePlayerWithEngaged: (slot?: string, kind?: "minion" | "enemy") => EffectSpec;
358
372
  export declare const bindTargets: (slot: string, target: TargetRef) => EffectSpec;
359
373
  /**
360
374
  * "Rhino attacks you" / "Green Goblin attacks with +X ATK" (Death from Above).
@@ -24,7 +24,8 @@ import type { AbilityRegistry } from "../../../../engine/src/index.js";
24
24
  *
25
25
  * **62015 Take a Stand**: "until the end of the player phase" is `endOfPlayerPhase`. Owner question Q104 = B (the owner,
26
26
  * 2026-10-18), RRG 1.8 "Lasting Effects" (p. 26): such an effect "can only be initiated during that time period", so
27
- * used after a villain-phase defense it gives nothing; used in a player phase it lasts to that phase's end. A live
27
+ * after a villain-phase defense it would give nothing and is not offered (RRG 1.8 "Initiating Abilities", p. 24, step 2;
28
+ * `lastingPeriodClosed`, issue #970); used in a player phase it lasts to that phase's end. A live
28
29
  * query, so allies that arrive later in that phase get the bonus too.
29
30
  */
30
31
  export declare const LUKE_CAGE_LEADERSHIP: AbilityRegistry;
@@ -3,7 +3,7 @@ export declare const CONTENT_VERSION = "0.0.0";
3
3
  * Schema version for the card data shape itself (independent of how many
4
4
  * cards/cycles have been ingested). Bump when a breaking shape change lands.
5
5
  */
6
- export declare const SCHEMA_VERSION = "0.51.0";
6
+ export declare const SCHEMA_VERSION = "0.53.0";
7
7
  export * from "./schema/index.js";
8
8
  export * from "./data/index.js";
9
9
  export * from "./import/index.js";
@@ -593,6 +593,12 @@ export interface Scenario {
593
593
  * is restricted.
594
594
  */
595
595
  readonly setAsideModularSetCount?: number | PerPlayerCount;
596
+ /**
597
+ * The modular sets a scenario's authors set aside by default, as `recommendedModularSetIds` names the shuffled-in ones
598
+ * (#943: The Rose sets aside Running Interference, its mini-boss Tombstone). Only with a fixed-number
599
+ * `setAsideModularSetCount`, and exactly that many; the table may still choose others. Absent: chosen at random.
600
+ */
601
+ readonly recommendedSetAsideModularSetIds?: readonly EncounterSetId[];
596
602
  /** Where the modular sets (and set-aside modular sets) come from. Absent: any modular set. See `ModularSetPool`. */
597
603
  readonly modularSetPool?: ModularSetPool;
598
604
  /**
@@ -186,6 +186,8 @@ export type ChoicePrompt = {
186
186
  readonly kind: "chooseTarget";
187
187
  readonly slot: string;
188
188
  readonly abilityId: AbilityId | null;
189
+ /** The card's own question for this pick (`EffectSpec chooseTarget.prompt`, issue #911); absent: "Choose a target". */
190
+ readonly title?: string;
189
191
  } | {
190
192
  readonly kind: "chooseAttachmentTarget";
191
193
  readonly instanceId: InstanceId;
@@ -651,6 +653,12 @@ export interface ChoiceOption {
651
653
  * zone (a villain, a main scheme).
652
654
  */
653
655
  readonly zone?: ZoneId;
656
+ /**
657
+ * A resource ability's option whose cost picks "any number" (or "up to N", N > 1) of cards in play: one option per
658
+ * set (Enhanced Combat Sense: "exhaust any number of Weapon or Tech upgrades"), which a payment sheet shows as one
659
+ * card per candidate (issue #966). Absent for a single pick (Sync Ratio) and every other option.
660
+ */
661
+ readonly picksMany?: true;
654
662
  }
655
663
  /**
656
664
  * Why this player is the one deciding. There is no villain player: the
@@ -340,6 +340,10 @@ export declare function takeTopOfDeck(ctx: Ctx, playerId: PlayerId): InstanceId
340
340
  export interface DeckDiscarder {
341
341
  readonly sourceInstanceId: InstanceId | null;
342
342
  readonly boundOn?: DeckDiscard["boundOn"];
343
+ /** Whether that card's ability discarded it as its effect or as its cost (`cardDiscardedFromDeck.how`). */
344
+ readonly how?: "effect" | "cost";
345
+ /** The effects frame making the discard, for a card of a hand it moves (`HandDiscard.madeBy`). */
346
+ readonly madeBy?: FrameId | undefined;
343
347
  }
344
348
  /**
345
349
  * Whether any ability in the registry triggers on `tuckedCardDiscarded` (docs/phase7-wave9.md §3.40 (b)); cached per
@@ -398,6 +402,32 @@ export declare function listensForDeckDiscard(deps: EngineDeps): boolean;
398
402
  * is recorded only in a game with an ability that hears one (`listensForDeckDiscard`).
399
403
  */
400
404
  export declare function recordDeckDiscard(ctx: Ctx, playerId: PlayerId, id: InstanceId, by: DeckDiscarder): void;
405
+ /**
406
+ * Whether any ability in the registry triggers on `cardDiscardedFromHand` (issue #922); cached per registry. Cards are
407
+ * discarded from hands in most games, so nothing is recorded or announced for a registry with no such ability: its
408
+ * games keep their state and their log.
409
+ */
410
+ export declare function listensForHandDiscard(deps: EngineDeps): boolean;
411
+ /**
412
+ * What discarded a card from a hand (`TriggerEvent cardDiscardedFromHand`, issue #922): the card whose ability did, and
413
+ * whether as its effect or its cost. `sourceCardId` when the caller already has it; otherwise it is read from
414
+ * `sourceInstanceId`.
415
+ */
416
+ export interface HandDiscarder {
417
+ readonly sourceInstanceId: InstanceId | null;
418
+ readonly sourceCardId?: CardId | undefined;
419
+ readonly how: "effect" | "cost";
420
+ /** The effects frame making the discard (`HandDiscard.madeBy`); absent for a cost. */
421
+ readonly madeBy?: FrameId | undefined;
422
+ }
423
+ /**
424
+ * The one place a card's discard from a hand by an ability is recorded for its `cardDiscardedFromHand` announcement
425
+ * (issue #922; `GameState.pendingHandDiscards`, announced between frames by `announceHandDiscards`). Called right after
426
+ * the move by `discardFromHand` when its caller names the discarding ability, and by `moveCardsTo` for a card it moved
427
+ * from a hand to a discard pile. A card that did not reach a discard pile was not discarded, and nothing is recorded;
428
+ * nor is anything in a game with no ability that hears one (`listensForHandDiscard`).
429
+ */
430
+ export declare function recordHandDiscard(ctx: Ctx, playerId: PlayerId, id: InstanceId, cause: HandDiscarder): void;
401
431
  /**
402
432
  * Whether any ability in the registry triggers on a card discarded from the top of an encounter deck
403
433
  * (docs/phase7-wave9.md §3.43 (b)); cached per registry. Encounter cards are discarded from the deck in most games, so
@@ -480,13 +510,20 @@ export declare function releaseRefillEncounterCards(ctx: Ctx, refill: string): v
480
510
  * Control" (p. 31), "That card is discarded from a player's hand, it is placed in its owner's discard pile". The log's
481
511
  * `cardDiscardedFromHand` names the player whose hand it left either way.
482
512
  */
483
- export declare function discardFromHand(ctx: Ctx, playerId: PlayerId, id: InstanceId): void;
513
+ export declare function discardFromHand(ctx: Ctx, playerId: PlayerId, id: InstanceId,
514
+ /**
515
+ * The ability whose effect or cost discards the card, which makes the discard one `cardDiscardedFromHand` hears
516
+ * (issue #922). Absent for the game's own discards and for spent resources, which are not heard.
517
+ */
518
+ by?: HandDiscarder): void;
484
519
  /**
485
520
  * "Discard N cards at random from your hand", one card at a time with the game's seeded RNG, so a replay discards the
486
521
  * same cards. Stops early when no eligible card is left; a hand of one still discards it (ruling, Feb 28, 2026 (4)).
487
522
  * `exclude` keeps cards out of the pick (the card whose cost this is). Returns the discarded cards in order.
488
523
  */
489
- export declare function discardRandomFromHand(ctx: Ctx, playerId: PlayerId, amount: number, exclude?: readonly InstanceId[]): readonly InstanceId[];
524
+ export declare function discardRandomFromHand(ctx: Ctx, playerId: PlayerId, amount: number, exclude?: readonly InstanceId[],
525
+ /** The discarding ability (`discardFromHand`'s `by`). */
526
+ by?: HandDiscarder): readonly InstanceId[];
490
527
  /**
491
528
  * Sends a card in play to the discard pile its `home` names (its owner's, or its encounter deck's). `sourceCardId`: the
492
529
  * card whose ability discards it, if any (`permanentStopsLeaving`); `asCost`: as that ability's cost (`leaveCauseSide`).
@@ -1920,7 +1920,9 @@ export type GameEvent = {
1920
1920
  }
1921
1921
  /**
1922
1922
  * An optional interrupt or response on a player's card in play answered `event` but was not offered: it has no valid
1923
- * target (`noTarget`) or its cost cannot be paid (`cannotPay`; RRG 1.8 "Initiating Abilities", p. 24, step 2). Said
1923
+ * target (`noTarget`), its cost cannot be paid (`cannotPay`; RRG 1.8 "Initiating Abilities", p. 24, step 2), or all
1924
+ * it gives would last to the end of a turn or player phase not in progress (`period`; RRG 1.8 "Lasting Effects",
1925
+ * p. 26; `lastingPeriodClosed`, #970). Said
1924
1926
  * so the client can tell its player why nothing was asked (#431; `unofferedAbilities`). It changes nothing.
1925
1927
  */
1926
1928
  | {
@@ -1929,7 +1931,7 @@ export type GameEvent = {
1929
1931
  readonly abilityId: AbilityId;
1930
1932
  readonly playerId: PlayerId;
1931
1933
  readonly timing: "interrupt" | "response";
1932
- readonly reason: "noTarget" | "cannotPay";
1934
+ readonly reason: "noTarget" | "cannotPay" | "period";
1933
1935
  readonly event: TriggerEvent;
1934
1936
  }
1935
1937
  /**
@@ -1,4 +1,4 @@
1
- export declare const ENGINE_VERSION = "0.51.0";
1
+ export declare const ENGINE_VERSION = "0.53.0";
2
2
  export type { PlayerId, InstanceId, ChoiceId, EncounterDeckId, FrameId, GroupId, TeamId } from "./ids.js";
3
3
  export { playerId, instanceId, choiceId, encounterDeckId, frameId, groupId, teamId } from "./ids.js";
4
4
  export type { GroupRef, PodNeutralArea, PodNeutralSetup, PodSetup, PodState, SharedEvent, SharedPodState, SharedResult, SharedThreatCause, } from "./pod.js";
@@ -121,3 +121,4 @@ export { collectionCandidates } from "./resolve/collection.js";
121
121
  export { scenarioDeckCards, scenarioDeckWithTop } from "./resolve/scenario-deck-top.js";
122
122
  export { REPORT_NO, REPORT_YES, REPORTED_FACT_ANSWER, reportedNumberOf, type OutsideFacts, type ReportedFact, type ReportedFactAnswer, type SetupOutsideFact, } from "./outside-facts.js";
123
123
  export { generatedResources, handCardResources, paymentOptionsPool, resourcesNotFor } from "./actions.js";
124
+ export { searchFindableIfSpent, type SearchFindableIfSpent } from "./search-findable.js";
@@ -310,6 +310,8 @@ export interface PaymentSource {
310
310
  * (`SpentCardAbilityUse.costSelection`); the option id holds it too ("#damageSelf=<n>").
311
311
  */
312
312
  readonly costSelection?: CostSelection;
313
+ /** Its ability's cost picks a set of cards, one source per set (`ChoiceOption.picksMany`, issue #966). */
314
+ readonly picksMany?: true;
313
315
  /**
314
316
  * This `resourceAbility` source is a card in hand spent with its own "Interrupt: When you spend this card, [cost] →
315
317
  * generate …" (`Payment.whenSpent`; option id "hand:<id>:<abilityId>…"): `instanceId` is the hand card, choosing it
@@ -495,8 +495,8 @@ export declare function encounterDeckDiscardAt(state: GameState, deckId: Encount
495
495
  /**
496
496
  * Whether a card discarded from a player's deck is still where the discard left it: in that player's discard pile, or,
497
497
  * when the discard emptied the deck, in the new deck its reset shuffled it into (`at: "deck"`). False once a response
498
- * moved it: nothing more answers its discard, and the discarding ability no longer counts it (docs/phase7-wave7.md
499
- * §3.55, §4.1 Q32 and Q33).
498
+ * moved it: no response that needs the card answers its discard any more (`lostWithDiscardedCard`, issue #928), and
499
+ * the discarding ability no longer counts it (docs/phase7-wave7.md §3.55, §4.1 Q32 and Q33).
500
500
  */
501
501
  export declare function deckDiscardStillThere(state: GameState, discard: {
502
502
  readonly instanceId: InstanceId;
@@ -504,6 +504,13 @@ export declare function deckDiscardStillThere(state: GameState, discard: {
504
504
  readonly at: "discard" | "deck";
505
505
  readonly encounterDeckId?: EncounterDeckId;
506
506
  }): boolean;
507
+ /**
508
+ * Whether a card discarded from a hand is still in a discard pile (`TriggerEvent cardDiscardedFromHand`, issue #922): a
509
+ * response that took it away leaves nothing for another response that needs the card (`lostWithDiscardedCard`).
510
+ */
511
+ export declare function handDiscardStillThere(state: GameState, discard: {
512
+ readonly instanceId: InstanceId;
513
+ }): boolean;
507
514
  /** Where a card currently is. Linear scan; the number of cards in a game is small. */
508
515
  export declare function locateCard(state: GameState, id: InstanceId): ZoneId | null;
509
516
  /** The in-play scenario area a card is in: its own, or the one the card it is attached to is in. Null outside one. */
@@ -0,0 +1,84 @@
1
+ /**
2
+ * A response to a card's discard once another response has moved that card (issue #928): a discard from a deck
3
+ * (`cardDiscardedFromDeck`, docs/phase7-wave7.md §3.55) or from a hand (`cardDiscardedFromHand`, issue #922).
4
+ *
5
+ * The discard happened, so every response to it is still offered (RRG 1.8 "Response", p. 38; "Triggering Condition",
6
+ * p. 45: the condition was met by the occurrence). Only interrupts lose a trigger that did not happen ("Interrupt",
7
+ * p. 25). A response is dropped in two cases only:
8
+ *
9
+ * - **its own card left the zone it works from**: the discarded card answering its own discard (Jackpot!, White Fox,
10
+ * `activeIn: "discard"`), taken out of the pile first. RRG 1.8 FAQ "Honey Badger" (p. 64);
11
+ * - **every part of it needs that card**, and the card is gone: "attach that card facedown here" (The Painted Lady),
12
+ * "tuck that card under here" (Don't Make Me Angry!), "deal that card as an encounter card" (Serpent Solutions).
13
+ * RRG 1.8 "Ability" (p. 4: it "can only be initiated if it has at least one valid target"), "Choose" (p. 12) and the FAQ
14
+ * "Redwing" (p. 65).
15
+ *
16
+ * A response that does something else ("draw 1 card", "deal 1 damage to an enemy") keeps it, as ruling June 2, 2026 -
17
+ * Ruling 4 (Energy Channel) reads a response whose triggering card is gone.
18
+ *
19
+ * The cards of a `together` answer are read the same way: the frame binds only those still where their discard left
20
+ * them (`stillDiscardedTargets`, `resolve/frames.ts`), so a kept response does not follow a moved card either. A
21
+ * mission attempt's card a response took "does not count" for it (April 30, 2026 - Ruling 4, answer 1), so Mikhail
22
+ * Rasputin (45183a) no longer counts a card Abyss took.
23
+ *
24
+ * Which parts need the card is read from the ability's effects (`needsDiscardedCard`), so a card script or a community
25
+ * pack marks nothing: an effect needs the card when it names the discarded card (`eventTarget`, or the cards of an
26
+ * `EventPattern.together` answer), or a card a choice of the ability picked from among them.
27
+ */
28
+ import type { AbilityDefinition, EngineDeps } from "../abilities.js";
29
+ import type { InstanceId, PlayerId } from "../ids.js";
30
+ import { type EffectContext } from "../select.js";
31
+ import type { EffectSpec, Predicate } from "../spec.js";
32
+ import type { GameState } from "../state.js";
33
+ import { type TriggerEvent } from "../trigger-events.js";
34
+ /** A discard whose card a response has since taken out of where the discard left it; false for any other event. */
35
+ export declare function discardedCardGone(state: GameState, event: TriggerEvent): boolean;
36
+ /**
37
+ * Whether this response to a discard can no longer be initiated because the discarded card has gone: it answers only
38
+ * discards whose cards are gone (`together`: every discard of the occurrence it answers once), and either it is the
39
+ * discarded card's own ability or every part of it needs that card (`needsDiscardedCard`).
40
+ */
41
+ export declare function lostWithDiscardedCard(state: GameState, deps: EngineDeps, candidate: {
42
+ readonly instanceId: InstanceId;
43
+ readonly abilityId: string;
44
+ readonly controllerId?: PlayerId | null;
45
+ readonly forced?: boolean;
46
+ readonly together?: readonly TriggerEvent[];
47
+ }, event: TriggerEvent): boolean;
48
+ /**
49
+ * Whether every part of an ability acts on the discarded card it answers, so it can do nothing once that card has
50
+ * gone. Its parts are its effects after its printed cost (`costEffects`), sentences read inline. Not parts: a choice
51
+ * (it does nothing until an effect uses what it chose), post-"then" text (it resolves only if the text before it did,
52
+ * RRG 1.8 "'Then'", p. 44). A part needs the card when it names it (`eventTarget`, the `together` targets) or the slot
53
+ * of a choice that does, wherever in it. A branch or a "choose one" needs it when each of its branches or options with
54
+ * effects does (`partNeedsCard`). An ability with no part is kept. Without `judge`, read from the effects alone and
55
+ * remembered per definition; `lostWithDiscardedCard` passes one, to read a condition on the card as the game stands.
56
+ *
57
+ * An amount read from the card does not make a part need it (`AMOUNT_KINDS`): the part resolves with the amount
58
+ * left. So The Shadow King (45180a) and Sugar Man (45182a) still resolve after Abyss (45181a) took a card, counting
59
+ * nothing for it: a mission attempt's card a response took "does not count" (April 30, 2026 - Ruling 4, answer 1).
60
+ */
61
+ export declare function needsDiscardedCard(definition: AbilityDefinition | undefined, judge?: Judge, gone?: readonly string[]): boolean;
62
+ /**
63
+ * Reads a branch's condition on the game as it stands, once the card has gone. Without one (`needsDiscardedCard`'s
64
+ * remembered reading) a condition on the card could pick either branch.
65
+ */
66
+ export type Judge = (condition: Predicate) => boolean | undefined;
67
+ /** In a list of slots that hold nothing: "that card" itself (`eventTarget`) names nothing either. */
68
+ export declare const EVENT_TARGET = "event.target";
69
+ /**
70
+ * Whether a condition reads a binding the ability has not made yet: a var, a slot or a payment `context` does not hold.
71
+ * At an option (`executeChooseOne`) the ability's earlier choices are known and read; one made inside the option is not.
72
+ */
73
+ export declare function readsUnbound(value: unknown, context: EffectContext): boolean;
74
+ /** The targets of the discards a `together` answer answers, without those whose cards have since gone (#928). */
75
+ export declare function stillDiscardedTargets(state: GameState, events: readonly TriggerEvent[]): readonly InstanceId[];
76
+ /**
77
+ * Whether every part of a "choose one" option acts on the discarded card (`everyPartNeedsCard`): once another response
78
+ * has moved it before this ability was initiated, `executeChooseOne` does not offer the option (#928). `slots`: the
79
+ * slots that hold nothing now (a choice made among "that card" before the option, the `together` targets once all have
80
+ * gone). `judge`: reads a condition at the start of the option on the game as it stands.
81
+ */
82
+ export declare function optionNeedsDiscardedCard(option: {
83
+ readonly effects: readonly EffectSpec[];
84
+ }, slots: readonly string[], judge?: Judge): boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Announcing cards discarded from a hand by a card's ability (`TriggerEvent cardDiscardedFromHand`, issue #922): the
3
+ * hand's counterpart of `announceDeckDiscards` and `announceTuckedDiscards`.
4
+ */
5
+ import type { Ctx } from "../ctx.js";
6
+ /**
7
+ * Announces each card discarded from a hand by an ability since the last look (recorded by `recordHandDiscard`), when
8
+ * an ability hears it, and empties the list; the first discarded resolves first. Those recorded since the last look
9
+ * were discarded by one effect or one cost payment, so they share one response window (RRG 1.8 "Discard", p. 16:
10
+ * "Responses to the discarding of any of those cards are resolved after all discards are made"; "Triggering
11
+ * Condition", p. 45). The flow looks here between frames, so the window resolves before the discarding ability's next
12
+ * effect, or, for a cost, before the ability's effects. A card no longer in a discard pile is not announced. Returns
13
+ * true when it pushed a frame.
14
+ *
15
+ * A card whose discarding effect is still making its discards stays recorded for a later look (`discardStillMaking`):
16
+ * "each player discards" asks one player at a time, and a card some ability may replace waits in its own "would be
17
+ * discarded" window, but the discards are one simultaneous set whose responses come after all of them (RRG 1.8
18
+ * "Discard", p. 16).
19
+ */
20
+ export declare function announceHandDiscards(ctx: Ctx): boolean;
@@ -231,7 +231,7 @@ export declare function divisionCanRemoveThreat(state: GameState, deps: EngineDe
231
231
  * could take the threat from (`moveThreatLacksSource`); `tuckFull`, the card it tucks under holds its maximum
232
232
  * (`tuckUnderFullHost`).
233
233
  */
234
- export type TargetFault = "target" | "moveSource" | "tuckFull";
234
+ export type TargetFault = "target" | "moveSource" | "tuckFull" | "period";
235
235
  /**
236
236
  * Why this player-initiated ability cannot be initiated for want of a valid target, or null: RRG 1.8 "Target" (p. 42),
237
237
  * "If an ability or game function requires one or more targets, that ability or game function can only be initiated
@@ -249,6 +249,19 @@ export type TargetFault = "target" | "moveSource" | "tuckFull";
249
249
  * interrupts and responses): an encounter card or a forced ability resolves as far as it can.
250
250
  */
251
251
  export declare function abilityTargetFault(state: GameState, deps: EngineDeps, definition: AbilityDefinition | undefined, sourceId: InstanceId, playerId: PlayerId | null, event?: TriggerEvent | null): TargetFault | null;
252
+ /**
253
+ * Why an optional ability a player initiates cannot be initiated now: every part of its effect is a lasting effect
254
+ * whose period is not in progress (issue #970, Take a Stand used after a villain-phase defense). RRG 1.8 "Lasting
255
+ * Effects" (p. 26): "A lasting effect that expires at the end of a specified time period can only be initiated during
256
+ * that time period", so such an effect is not made (`apply-effect.ts`), and an ability made only of them would change
257
+ * nothing; it is not offered rather than played for nothing. "Until the end of the player phase" outside one follows
258
+ * owner answer Q104 = B (`endOfPlayerPhaseCanStart`). The card is not played either (p. 24, step 2: "can the card be
259
+ * played, or the ability initiated, at this time?"); older FFG rulings agree that an ability that cannot change the game
260
+ * state cannot be initiated (Flow Like Water; Boggs on War Machine's Gauntlet). A forced ability resolves as far as it
261
+ * can and is not judged.
262
+ * Returns the period, or null when the ability can be initiated.
263
+ */
264
+ export declare function lastingPeriodClosed(state: GameState, definition: AbilityDefinition | undefined): "endOfTurn" | "endOfPlayerPhase" | null;
252
265
  /**
253
266
  * Whether one option of a "choose one" cannot be chosen for want of a valid target, read as the option would resolve
254
267
  * (`context`: the resolving ability's, with what it has bound so far). RRG 1.8 "Choose (Option)" (p. 12): "When a
@@ -25,7 +25,7 @@ export declare function defenseBarredCandidates(state: GameState, deps: EngineDe
25
25
  readonly reason: DefenseBar;
26
26
  }[];
27
27
  /** Why an optional ability that answered an event was not offered (`unofferedAbilities`). */
28
- export type UnofferedReason = "noTarget" | "cannotPay";
28
+ export type UnofferedReason = "noTarget" | "cannotPay" | "period";
29
29
  /** An optional interrupt or response that answered an event but could not be initiated (`unofferedAbilities`). */
30
30
  export interface UnofferedAbility {
31
31
  readonly instanceId: InstanceId;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * What a card's search of the discard pile could find if the player paid with a card from hand: a read-only query for
3
+ * the payment step (#966). "Search your deck and discard pile for a Team-Up card …" (Dynamic Duo) is legal to play with
4
+ * nothing to find (RRG 1.8 "Target", p. 43: a search is not a target), and a card spent to pay is in its owner's
5
+ * discard pile before the effect resolves (RRG 1.8 "Initiating Abilities", p. 24, steps 3 and 5; "Resources", p. 36),
6
+ * so paying with the card the search wants lets the search find it. The engine already resolves that; this tells the
7
+ * client which cards in hand it applies to, so the payment can say so.
8
+ *
9
+ * Only the ability's first card choice over its player's discard pile is read: later choices usually depend on what
10
+ * the first one chose ("an ally named by that card's Team-Up keyword"), and cannot be judged before it. Any deterministic
11
+ * card choice over the discard pile counts, not only text that says "Search" ("choose an ally in your discard pile"):
12
+ * paying with the card it wants is the same advice. Only hand cards are tried; a card spent from under its host
13
+ * (`spendableFromTucked`) is not.
14
+ */
15
+ import type { EngineDeps } from "./abilities.js";
16
+ import type { AbilityId } from "../../content/src/index.js";
17
+ import type { InstanceId, PlayerId } from "./ids.js";
18
+ import type { GameState } from "./state.js";
19
+ export interface SearchFindableIfSpent {
20
+ /**
21
+ * Whether the search's first choice has a candidate in a discard pile as things stand (the deck is hidden, so it never
22
+ * counts). True when there is no such search.
23
+ */
24
+ readonly found: boolean;
25
+ /** Cards in the player's hand (the played card aside) that the choice would find once spent to pay, in hand order. */
26
+ readonly findableIfSpent: readonly InstanceId[];
27
+ }
28
+ /**
29
+ * For the card `playerId` is playing (`playedCardInstanceId`): whether its search of the discard pile finds anything
30
+ * now, and which other cards in their hand it would find if spent to pay for it.
31
+ *
32
+ * The ability read is `abilityId` when given, else the first ability printed on an event that has such a search (an
33
+ * event's Action, Interrupt or Response: the text playing it resolves). Any other card, or an ability with no such
34
+ * search, answers `{ found: true, findableIfSpent: [] }`.
35
+ *
36
+ * Pure: each "as if spent" state is a throwaway copy with that one card moved to its discard pile the way a payment
37
+ * moves it; `state` is never changed. Candidates come from `selectCards`, the same reader the choice uses as it
38
+ * resolves (`executeChooseCards`) and as initiation judges it (`choiceCandidates`). The played card itself is never a
39
+ * candidate: it is out of play while it resolves (RRG 1.8 "Event", p. 18).
40
+ */
41
+ export declare function searchFindableIfSpent(state: GameState, deps: EngineDeps, playerId: PlayerId, playedCardInstanceId: InstanceId, abilityId?: AbilityId): SearchFindableIfSpent;
@@ -155,6 +155,11 @@ export declare const PLAYED_VIA_SLOT = "playedVia";
155
155
  * in the discard pile, whichever of them the answer is listed under.
156
156
  */
157
157
  export declare const TOGETHER_TARGETS_SLOT = "together.targets";
158
+ /**
159
+ * Bound (empty) on a response to a discard initiated once another response had moved the discarded card
160
+ * (`resolve/discarded-card.ts`, #928): its "that card" (`eventTarget`) then names nothing.
161
+ */
162
+ export declare const DISCARD_MOVED_SLOT = "discard.moved";
158
163
  /**
159
164
  * The slot a lasting stat modifier's `amount` reads the card whose stat is being read from (`EffectSpec
160
165
  * modifyStatUntil`, docs/phase7-wave6.md §3.43: "while Wolverine or Jubilee is making a basic attack …, **they** get
@@ -6580,6 +6580,13 @@ export type EffectSpec =
6580
6580
  readonly count?: number | ValueSpec;
6581
6581
  readonly upTo?: true;
6582
6582
  readonly optional?: boolean;
6583
+ /**
6584
+ * What the client asks in place of "Choose a target" when the printed text picks two cards for different roles
6585
+ * ("Move a counter FROM which support?" then "... TO which support?", Maria Hill's Reassignment 50001a; issue
6586
+ * #911). Display only: the engine passes it to the pending choice as `title` and never reads it. A message key of the client's
6587
+ * catalog (`choicePrompt.*`) is shown translated; any other text is shown as it is.
6588
+ */
6589
+ readonly prompt?: string;
6583
6590
  } | {
6584
6591
  readonly kind: "if";
6585
6592
  readonly condition: Predicate;
@@ -532,6 +532,15 @@ export interface ScenarioDeckState {
532
532
  export type TuckedDiscard = Omit<Extract<TriggerEvent, {
533
533
  kind: "tuckedCardDiscarded";
534
534
  }>, "kind">;
535
+ /**
536
+ * A card discarded from a hand by an ability, waiting to be announced: the fields of `cardDiscardedFromHand`, and the
537
+ * effects frame that made it (`madeBy`), whose other discards it waits for (issue #922). Absent for a cost.
538
+ */
539
+ export type HandDiscard = Omit<Extract<TriggerEvent, {
540
+ kind: "cardDiscardedFromHand";
541
+ }>, "kind"> & {
542
+ readonly madeBy?: FrameId;
543
+ };
535
544
  /** A facedown encounter card dealt to a player, waiting to be announced (`TriggerEvent encounterCardDealt`). */
536
545
  export interface DealtEncounterCard {
537
546
  readonly playerId: PlayerId;
@@ -1301,6 +1310,13 @@ export interface GameState {
1301
1310
  * shared response window, and empties the list. Absent until one is first recorded. docs/phase7-wave9.md §3.40.
1302
1311
  */
1303
1312
  readonly pendingTuckedDiscards?: readonly TuckedDiscard[];
1313
+ /**
1314
+ * Cards discarded from a hand by a card's ability since the flow last looked, oldest first, recorded by
1315
+ * `recordHandDiscard` only when some ability in the registry triggers on it: the flow announces them as
1316
+ * `cardDiscardedFromHand` between frames, in one shared response window, and empties the list. Absent until one is
1317
+ * first recorded. Issue #922.
1318
+ */
1319
+ readonly pendingHandDiscards?: readonly HandDiscard[];
1304
1320
  /**
1305
1321
  * Facedown boost cards given since the flow last looked, oldest first, recorded by `recordBoostGiven` only when some
1306
1322
  * ability in the registry triggers on it: the flow announces each as `boostCardGiven` between frames, with a