@champions-digital-game/mod-sdk 0.54.0 → 1.0.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 (61) hide show
  1. package/README.md +3 -3
  2. package/dist/build.js +1 -1
  3. package/dist/chunks/{chunk-DX44O32N.js → chunk-MRZL7PHD.js} +1 -1
  4. package/dist/chunks/{chunk-S3JH4WL4.js → chunk-N2HMNYPQ.js} +1 -1
  5. package/dist/chunks/{chunk-ACT4TJXC.js → chunk-NHQRL3H2.js} +3 -3
  6. package/dist/chunks/{chunk-3SR23UJ7.js → chunk-PHTEP3BC.js} +1 -1
  7. package/dist/chunks/{chunk-WFEXO5DU.js → chunk-RBTO2IFX.js} +1 -1
  8. package/dist/chunks/chunk-SCRIASBU.js +1 -0
  9. package/dist/chunks/{chunk-7NRC6TLV.js → chunk-SG4DMEG6.js} +1 -1
  10. package/dist/import.js +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/mc-pack.js +2 -2
  13. package/dist/testing.js +1 -1
  14. package/package.json +1 -1
  15. package/types/cards/src/dsl/abilities.d.ts +6 -3
  16. package/types/cards/src/dsl/effects.d.ts +22 -2
  17. package/types/cards/src/dsl/values.d.ts +11 -0
  18. package/types/cards/src/index.d.ts +3 -2
  19. package/types/cards/src/testing/driver.d.ts +16 -1
  20. package/types/cards/src/wave10/competitive.d.ts +49 -0
  21. package/types/cards/src/wave10/cw/competitive/leader-cards.d.ts +5 -7
  22. package/types/cards/src/wave10/cw/competitive/standard-pvp.d.ts +3 -3
  23. package/types/cards/src/wave10/cw/leaders/captain-marvel.d.ts +4 -2
  24. package/types/cards/src/wave10/cw/modular/dangerous-recruits.d.ts +0 -29
  25. package/types/cards/src/wave10/cw/modular/secret-avengers.d.ts +3 -4
  26. package/types/cards/src/wave10/cw/modular/the-initiative.d.ts +0 -31
  27. package/types/cards/src/wave10/index.d.ts +2 -0
  28. package/types/cards/src/wave10/setup.d.ts +7 -0
  29. package/types/cards/src/wave10/synthezoid/competitive/leader-cards.d.ts +22 -11
  30. package/types/cards/src/wave9/index.d.ts +1 -1
  31. package/types/cards/src/wave9/setup.d.ts +20 -1
  32. package/types/content/src/index.d.ts +1 -1
  33. package/types/engine/src/actions.d.ts +5 -0
  34. package/types/engine/src/commands.d.ts +53 -1
  35. package/types/engine/src/competitive-outcome.d.ts +159 -0
  36. package/types/engine/src/competitive-setup.d.ts +73 -0
  37. package/types/engine/src/effects.d.ts +32 -6
  38. package/types/engine/src/errors.d.ts +18 -2
  39. package/types/engine/src/event-sides.d.ts +21 -0
  40. package/types/engine/src/events.d.ts +127 -3
  41. package/types/engine/src/flow.d.ts +1 -1
  42. package/types/engine/src/game-fingerprint.d.ts +2 -2
  43. package/types/engine/src/index.d.ts +12 -4
  44. package/types/engine/src/lasting.d.ts +6 -1
  45. package/types/engine/src/pod-commands.d.ts +81 -0
  46. package/types/engine/src/pod-coordinator.d.ts +136 -0
  47. package/types/engine/src/pod.d.ts +276 -2
  48. package/types/engine/src/query.d.ts +7 -0
  49. package/types/engine/src/resolve/pod.d.ts +67 -1
  50. package/types/engine/src/resolve/triggers.d.ts +11 -0
  51. package/types/engine/src/select.d.ts +27 -7
  52. package/types/engine/src/setup-steps.d.ts +8 -0
  53. package/types/engine/src/setup.d.ts +10 -2
  54. package/types/engine/src/spec.d.ts +83 -10
  55. package/types/engine/src/state.d.ts +120 -2
  56. package/types/engine/src/team-phases.d.ts +106 -0
  57. package/types/engine/src/team.d.ts +34 -0
  58. package/types/engine/src/trigger-events.d.ts +50 -3
  59. package/types/engine/src/villain/authority.d.ts +16 -3
  60. package/types/engine/src/villain-phase-begun.d.ts +24 -0
  61. package/dist/chunks/chunk-3YMCANI3.js +0 -1
@@ -6,8 +6,8 @@
6
6
  * own group of 1–4 players") is a pod of one group whose engine is its own coordinator. Everything here is pure: no
7
7
  * `Ctx`, no card names, no randomness, so the reducer can move into a pod coordinator unchanged.
8
8
  */
9
- import type { CardId, ScalingValue } from "../../content/src/index.js";
10
- import { groupId, type GroupId, type InstanceId } from "./ids.js";
9
+ import type { AbilityId, CardId, ScalingValue } from "../../content/src/index.js";
10
+ import { groupId, type GroupId, type InstanceId, type PlayerId } from "./ids.js";
11
11
  export { groupId, type GroupId };
12
12
  /** The one group of a game with no pod, and of Single Group Mode. */
13
13
  export declare const SINGLE_GROUP: GroupId;
@@ -33,6 +33,11 @@ export interface SharedPodState {
33
33
  * are final.
34
34
  */
35
35
  readonly status: "playing" | "schemeCompleted" | "won" | "lost";
36
+ /**
37
+ * The group whose shared event took the shared villain's last hit points (`applySharedEvent`): the table that dealt
38
+ * the final damage. Informational only (achievements; no rule reads it). Absent until the villain is defeated.
39
+ */
40
+ readonly defeatedByGroup?: GroupId;
36
41
  }
37
42
  /** Why threat was placed on the shared scheme (MC55 p. 21, the "two ways"). */
38
43
  export type SharedThreatCause = "schemeCompleted" | "identityDefeated";
@@ -124,6 +129,275 @@ export interface PodState {
124
129
  * group in the middle of a player phase may finish that phase as normal"). Absent otherwise.
125
130
  */
126
131
  readonly finalPlayerPhase?: true;
132
+ /**
133
+ * Inbound events a pod coordinator sent (`Command externalEvent`) waiting for the resolution in progress to finish
134
+ * (MC55 p. 20, as `pendingResults`), oldest first. Absent when none waits.
135
+ */
136
+ readonly pendingInbound?: readonly PodInboundEvent[];
137
+ /**
138
+ * This group has stopped play after the shared scheme's completion (MC55 p. 21: "stop play immediately", or a player
139
+ * phase finished "as normal"). Every command but `externalEvent` and `concede` is refused (`pod_halted`) until the
140
+ * coordinator ends the game. Absent while the group plays.
141
+ */
142
+ readonly halted?: true;
143
+ /**
144
+ * The outbound number of this group's last shared event the coordinator has not yet acknowledged (`sharedAck`).
145
+ * While set, play pauses at the next quiet point: the ability resolving finishes, but no further step is taken and
146
+ * actions are refused (`pod_waiting`), so what the event brought about (a flip, the shared scheme's completion) is
147
+ * heard before this group plays on (MC55 p. 20: the group must "immediately inform the event organizer"; p. 21: a
148
+ * group in a villain phase "stop[s] play immediately"). Absent otherwise; never set with a local coordinator.
149
+ */
150
+ readonly awaiting?: number;
151
+ /**
152
+ * The cards of the other groups of this pod that this group's players may attack or thwart (their last reports,
153
+ * relayed by the coordinator as `podReachable`), by group id: what `Command remotePower` checks before anything is
154
+ * paid. Absent until a report arrives.
155
+ */
156
+ readonly reachable?: Readonly<Record<string, readonly ReachableCard[]>>;
157
+ /**
158
+ * Remote powers made here and not yet answered by the owning group, oldest first: what a refusal refunds. Absent when
159
+ * none is waiting.
160
+ */
161
+ readonly inFlight?: readonly RemotePowerInFlight[];
162
+ /**
163
+ * Remote powers of other groups this group accepted against its cards (inbound `remotePower`), until the first quiet
164
+ * point after their hit, where each is reported back as `remotePowerSettled` (`settlePod`). Oldest first; absent when
165
+ * none waits. Informational only: no rule reads it.
166
+ */
167
+ readonly remoteHitsSettling?: readonly RemoteHitSettling[];
168
+ }
169
+ /**
170
+ * Another group's remote power this group accepted (`PodState.remoteHitsSettling`), until its outcome here is known:
171
+ * whether the hit left the card out of play once what it brought about had resolved.
172
+ */
173
+ export interface RemoteHitSettling {
174
+ /** The attacker's group's stand-in, which names the power there. */
175
+ readonly ref: InstanceId;
176
+ readonly fromGroupId: GroupId;
177
+ readonly playerId: PlayerId;
178
+ readonly targetInstanceId: InstanceId;
179
+ readonly cardId: CardId;
180
+ readonly power: RemotePower;
181
+ /** The hit applied with the card in play (`reportRemoteHit`); one never applied is dropped without a report. */
182
+ readonly hit?: true;
183
+ }
184
+ /** A remote power this group made, until the owning group answers (`PodState.inFlight`). */
185
+ export interface RemotePowerInFlight {
186
+ /** The stand-in it was made against (`CardInstance.remoteOf`), which names it in the answer. */
187
+ readonly ref: InstanceId;
188
+ readonly characterInstanceId: InstanceId;
189
+ /** The player who made the power (the character's controller). */
190
+ readonly playerId: PlayerId;
191
+ readonly toGroupId: GroupId;
192
+ /** The consequential damage the power put on the character (an ally), refunded with the exhaust on a refusal. */
193
+ readonly consequential: number;
194
+ /** Hand cards spent paying the power's costs, returned on a refusal if still in their discard pile. */
195
+ readonly spent: readonly InstanceId[];
196
+ /** Whether its damage or threat removal was sent; one never sent (a stunned attacker's) is dropped when quiet. */
197
+ readonly sent: boolean;
198
+ }
199
+ /** Where a group of a pod stands, as its coordinator reads it (MC55 p. 21; the stop rule M4). */
200
+ export interface GroupStatus {
201
+ readonly phase: "setup" | "player" | "villain" | "over";
202
+ readonly round: number;
203
+ /** `PodState.halted`: the group stopped play after the shared scheme's completion. */
204
+ readonly halted: boolean;
205
+ }
206
+ /** A remote basic power: "attack" or "thwart" (M6: the only two another group may use; 55041, 55046, MC55 p. 12). */
207
+ export type RemotePower = "attack" | "thwart";
208
+ /**
209
+ * A card in this group's game area that players of other groups of the pod may attack or thwart "as if it were in
210
+ * their game area" (`RuleSpec reachableFromPod`; The Mangog 55041, Door Between Worlds 55046; MC55 p. 16).
211
+ */
212
+ export interface ReachableCard {
213
+ readonly instanceId: InstanceId;
214
+ readonly cardId: CardId;
215
+ readonly by: RemotePower;
216
+ /** An attackable card's hit points left; absent for a thwartable one. */
217
+ readonly remainingHitPoints?: number;
218
+ /** A thwartable card's threat; absent for an attackable one. */
219
+ readonly threat?: number;
220
+ }
221
+ /**
222
+ * What a group tells its pod's coordinator (docs/epic-multiplayer-plan.md §2 option B, §4 items 1 and 3). Each is
223
+ * numbered by the group (`PodState.outboundSeq`), so the coordinator applies it once however often it is re-sent. Only
224
+ * a group with a remote coordinator emits any; `podOutboundOf` reads them from a command's events.
225
+ */
226
+ export type PodOutboundEvent = SharedEvent
227
+ /** An `inGroup` block for another group of the pod (`GameEvent podEffectRequested`; a synergy offer). */
228
+ | {
229
+ readonly type: "podEffectRequested";
230
+ readonly groupId: GroupId;
231
+ readonly toGroupId: GroupId;
232
+ readonly sourceCardId: CardId;
233
+ readonly abilityId: AbilityId;
234
+ readonly block: number;
235
+ }
236
+ /** The group's phase, round or halt changed over the command. */
237
+ | {
238
+ readonly type: "groupStatus";
239
+ readonly groupId: GroupId;
240
+ readonly status: GroupStatus;
241
+ }
242
+ /** The cards of this group's area the pod may reach changed over the command (entered, left, damage or threat). */
243
+ | {
244
+ readonly type: "reachableCards";
245
+ readonly groupId: GroupId;
246
+ readonly cards: readonly ReachableCard[];
247
+ }
248
+ /**
249
+ * A basic attack or thwart made here against a stand-in for another group's card reached that card: the damage the
250
+ * attack deals it (after this group's modifiers) with the attack's keywords, or the threat the thwart removes.
251
+ */
252
+ | {
253
+ readonly type: "remotePowerUsed";
254
+ readonly groupId: GroupId;
255
+ readonly playerId: PlayerId;
256
+ readonly toGroupId: GroupId;
257
+ readonly targetInstanceId: InstanceId;
258
+ readonly ref: InstanceId;
259
+ readonly power: RemotePower;
260
+ readonly amount: number;
261
+ readonly overkill: boolean;
262
+ readonly piercing: boolean;
263
+ }
264
+ /** This group dealt another group's remote power to its card (inbound `remotePower`), or refused it. */
265
+ | {
266
+ readonly type: "remotePowerResolved";
267
+ readonly groupId: GroupId;
268
+ readonly toGroupId: GroupId;
269
+ readonly ref: InstanceId;
270
+ readonly targetInstanceId: InstanceId;
271
+ readonly power: RemotePower;
272
+ /** The attacked card's retaliate, owed to the attacker (RRG 1.8 "Retaliate X", p. 37); 0 for a thwart. */
273
+ readonly retaliate: number;
274
+ /** Why the card could not be reached any more (it left play, or no longer allows it); absent when it was. */
275
+ readonly refused?: string;
276
+ /** The card left play while the accepted hit was resolving (`reportRemoteHit`): costs stand, no consequential damage. */
277
+ readonly lost?: true;
278
+ }
279
+ /**
280
+ * Another group's accepted remote power, settled here: once nothing was resolving after its hit (the damage, a defeat
281
+ * and what answered them), whether the card it was made against had left play (`defeated`: the attack defeated it,
282
+ * or the thwart cleared it). Sent after `remotePowerResolved`, which goes as the hit applies, before its outcome is
283
+ * known. Informational only (achievements): the attacker's group logs it and nothing else changes.
284
+ */
285
+ | {
286
+ readonly type: "remotePowerSettled";
287
+ readonly groupId: GroupId;
288
+ readonly toGroupId: GroupId;
289
+ readonly ref: InstanceId;
290
+ readonly playerId: PlayerId;
291
+ readonly targetInstanceId: InstanceId;
292
+ readonly cardId: CardId;
293
+ readonly power: RemotePower;
294
+ readonly defeated: boolean;
295
+ }
296
+ /**
297
+ * A remote attack with Overkill defeated the card here: the excess, measured after its damage resolved (RRG 1.8
298
+ * "Overkill", p. 31), owed to the attacker's group (owner question pending, option A: the attacker's own Avatar of
299
+ * Loki).
300
+ */
301
+ | {
302
+ readonly type: "overkillExcess";
303
+ readonly groupId: GroupId;
304
+ readonly toGroupId: GroupId;
305
+ readonly ref: InstanceId;
306
+ readonly amount: number;
307
+ };
308
+ /**
309
+ * What a pod coordinator tells one group (`Command externalEvent`; docs/live-game-rooms.md §10's `lokiFlipped`,
310
+ * `gameWon`, `gameLost`, `synergyGranted` and `stopAfterPhase`, in the engine's card-neutral words). Each waits for
311
+ * the group's next quiet point, after what is resolving has finished (MC55 p. 20; M3), except as `externalEvent` says.
312
+ */
313
+ export type PodInboundEvent =
314
+ /** The coordinator's shared record changed: this group's copy is replaced (bookkeeping only, takes no draw). */
315
+ {
316
+ readonly kind: "sharedStateChanged";
317
+ readonly shared: SharedPodState;
318
+ }
319
+ /** The shared villain flipped (MC55 p. 20; Q5: every group resolves its When Revealed). */
320
+ | {
321
+ readonly kind: "sharedVillainFlipped";
322
+ }
323
+ /** The shared scheme was completed: stop play, or finish the player phase first (MC55 p. 21; M4). */
324
+ | {
325
+ readonly kind: "stopAfterPhase";
326
+ }
327
+ /** The shared villain was defeated: all players in all groups win (55027b; MC55 p. 21; Q6). */
328
+ | {
329
+ readonly kind: "gameWon";
330
+ }
331
+ /** Every player phase ended with the shared scheme complete: all players in all groups lose (MC55 p. 21). */
332
+ | {
333
+ readonly kind: "gameLost";
334
+ }
335
+ /**
336
+ * The coordinator has applied this group's shared event `seq` and sent everything it brought about (sent after
337
+ * those): the pause of `PodState.awaiting` ends once it is applied.
338
+ */
339
+ | {
340
+ readonly kind: "sharedAck";
341
+ readonly seq: number;
342
+ }
343
+ /** Another group of the pod reported its reachable cards (bookkeeping, `PodState.reachable`; takes no draw). */
344
+ | {
345
+ readonly kind: "podReachable";
346
+ readonly groupId: GroupId;
347
+ readonly cards: readonly ReachableCard[];
348
+ }
349
+ /** Resolve block `block` of `abilityId` in this group's area (`GameEvent podEffectRequested`; a synergy grant). */
350
+ | {
351
+ readonly kind: "podEffect";
352
+ readonly fromGroupId: GroupId;
353
+ readonly sourceCardId: CardId;
354
+ readonly abilityId: AbilityId;
355
+ readonly block: number;
356
+ }
357
+ /** A player of another group attacked or thwarted a reachable card here "as if it were in their game area" (M6). */
358
+ | {
359
+ readonly kind: "remotePower";
360
+ readonly fromGroupId: GroupId;
361
+ readonly playerId: PlayerId;
362
+ readonly targetInstanceId: InstanceId;
363
+ readonly ref: InstanceId;
364
+ readonly power: RemotePower;
365
+ readonly amount: number;
366
+ readonly overkill: boolean;
367
+ readonly piercing: boolean;
368
+ }
369
+ /** This group's remote power was dealt where its target is (with the target's retaliate), or refused. */
370
+ | {
371
+ readonly kind: "remotePowerResolved";
372
+ readonly fromGroupId: GroupId;
373
+ readonly ref: InstanceId;
374
+ readonly targetInstanceId: InstanceId;
375
+ readonly power: RemotePower;
376
+ readonly retaliate: number;
377
+ readonly refused?: string;
378
+ readonly lost?: true;
379
+ }
380
+ /** How this group's remote power ended where its target is (outbound `remotePowerSettled`); logged, nothing more. */
381
+ | {
382
+ readonly kind: "remotePowerSettled";
383
+ readonly fromGroupId: GroupId;
384
+ readonly ref: InstanceId;
385
+ readonly playerId: PlayerId;
386
+ readonly cardId: CardId;
387
+ readonly power: RemotePower;
388
+ readonly defeated: boolean;
389
+ }
390
+ /** Overkill's excess from this group's remote attack, dealt to this group's villain (owner question, option A). */
391
+ | {
392
+ readonly kind: "overkillExcess";
393
+ readonly fromGroupId: GroupId;
394
+ readonly ref: InstanceId;
395
+ readonly amount: number;
396
+ };
397
+ /** A numbered outbound event, as a host forwards it: `seq` is the group's own count, from 1. */
398
+ export interface PodOutbound {
399
+ readonly seq: number;
400
+ readonly event: PodOutboundEvent;
127
401
  }
128
402
  /** The pod's neutral cards as a setup config names them (`Scenario.neutralCards`). */
129
403
  export interface PodNeutralSetup {
@@ -333,6 +333,13 @@ export declare const areaOfPlayer: (state: GameState, playerId: PlayerId) => Gam
333
333
  * and tucked cards in their host's, an area's scheme, villains and side schemes in that area.
334
334
  */
335
335
  export declare function areaOfCard(state: GameState, id: InstanceId): GameAreaState | null;
336
+ /**
337
+ * The game area an encounter deck and its discard pile are in, in a game with two teams: the area of the team that
338
+ * faces the leader drawing from it (MC56 p. 15: each half of the table holds "the enemy leader, the encounter deck, the
339
+ * main scheme deck"; p. 20: "Cards in your opponent's game area are not in play in your game area"). Null in every
340
+ * other game: with separate game areas (Kang) an encounter deck is in every area, as before.
341
+ */
342
+ export declare function encounterDeckArea(state: GameState, deckId: EncounterDeckId): GameAreaState | null;
336
343
  /**
337
344
  * The number a per player icon on this card multiplies by (RRG 1.8 "Per Player Icon", p. 32): the players who started
338
345
  * the scenario on the team whose game area the card is in (`perPlayerCount`; MC56 p. 20). The players who started the
@@ -7,9 +7,13 @@
7
7
  * The record itself changes in one place, the pure reducer (`applySharedEvent`, `pod.ts`). With a local coordinator
8
8
  * (Single Group Mode) this engine calls it; with a remote one it only emits, and the results arrive from outside.
9
9
  */
10
+ import type { EngineDeps } from "../abilities.js";
10
11
  import { type Ctx } from "../ctx.js";
11
- import { type SharedResult, type SharedThreatCause } from "../pod.js";
12
+ import type { GroupId, InstanceId } from "../ids.js";
13
+ import { type PodInboundEvent, type PodOutboundEvent, type ReachableCard, type RemotePower, type SharedPodState, type SharedResult, type SharedThreatCause } from "../pod.js";
12
14
  import type { EffectSpec } from "../spec.js";
15
+ import type { GameState } from "../state.js";
16
+ import type { RemoteHit } from "../trigger-events.js";
13
17
  import { type Frame } from "./frames.js";
14
18
  /**
15
19
  * `EffectSpec sharedEvent`: a script deals damage to the shared villain or places threat on the shared scheme. Always
@@ -39,6 +43,68 @@ export declare function applyInbound(ctx: Ctx, result: SharedResult): void;
39
43
  * A game with no pod record returns at once.
40
44
  */
41
45
  export declare function settlePod(ctx: Ctx): boolean;
46
+ /**
47
+ * `PodOutboundEvent` other than a shared event (those are `sharedEventEmitted`): numbered with this group's next
48
+ * outbound number and logged as `podEventEmitted`, which a host forwards to the coordinator. Only with a remote
49
+ * coordinator; a pod of one group has nobody to tell.
50
+ */
51
+ export declare function emitPodEvent(ctx: Ctx, event: PodOutboundEvent): void;
52
+ /**
53
+ * The game ends at once in this group, whatever is resolving (Q6: "Groups stop at their next command boundary";
54
+ * 55027b "all players in all groups win the game"; MC55 p. 21, every player phase ended: "all players in all groups
55
+ * lose"). The neutral cards' own lines would record the same outcome (`conclude`); they are not waited for, since a
56
+ * choice may be open and nothing more resolves here.
57
+ */
58
+ export declare function concludeFromCoordinator(ctx: Ctx, result: "gameWon" | "gameLost"): void;
59
+ /** `PodInboundEvent sharedStateChanged`: this group's copy of the record is replaced. Bookkeeping: no draw, no rule. */
60
+ export declare function replaceSharedCopy(ctx: Ctx, shared: SharedPodState): void;
61
+ /** This group stops play (MC55 p. 21; M4). The next `groupStatus` tells the coordinator. */
62
+ export declare function haltGroup(ctx: Ctx): void;
63
+ /**
64
+ * The cards of this group's area other groups of the pod may reach (`RuleSpec reachableFromPod`), in play order, with
65
+ * the numbers their players need: hit points left for an attack, threat for a thwart. A stand-in for another group's
66
+ * card (`CardInstance.remoteOf`) is never one.
67
+ */
68
+ export declare function reachableCardsOf(state: GameState, deps: EngineDeps): readonly ReachableCard[];
69
+ /** Why `id` cannot be reached here by another group's `power` now, or null. */
70
+ export declare function remoteTargetFault(state: GameState, deps: EngineDeps, id: InstanceId, power: RemotePower): string | null;
71
+ /**
72
+ * An accepted remote power's hit applies here (the damage or threat removal of `resolveRemotePower`, at its apply
73
+ * step): its answer goes back to the attacker's group, with the card's retaliate. A card that left play while the hit
74
+ * was resolving is reported `lost` (implementation convention, not an official ruling; owner answer 2026-11-20,
75
+ * option A): the attacker's costs and exhaust stand, but it takes no consequential damage and did not attack or
76
+ * thwart, so no retaliate.
77
+ */
78
+ export declare function reportRemoteHit(ctx: Ctx, hit: RemoteHit, target: InstanceId, power: RemotePower): void;
79
+ /**
80
+ * A remote attack's excess, at the defeat of the card it attacked (`beginDefeat`; RRG 1.8 "Overkill", p. 31): sent to
81
+ * the attacker's group rather than spilled onto this group's villain (owner question pending, option A).
82
+ */
83
+ export declare function sendOverkillExcess(ctx: Ctx, hit: RemoteHit, amount: number): void;
84
+ /**
85
+ * Where a stand-in's power goes (`CardInstance.remoteOf`): damage dealt to it, or threat removed from it, is not dealt
86
+ * here but sent to the group whose card it stands for, as `remotePowerUsed` with the amount this group's modifiers
87
+ * made it and the attack's keywords. True when `targetId` is a stand-in (the caller then does nothing more).
88
+ */
89
+ export declare function divertToRemote(ctx: Ctx, targetId: InstanceId, power: RemotePower, amount: number, keywords: {
90
+ readonly overkill: boolean;
91
+ readonly piercing: boolean;
92
+ },
93
+ /** The card the damage or removal comes from, and whether it is an attack's damage. */
94
+ from: {
95
+ readonly sourceInstanceId: InstanceId | null;
96
+ readonly fromAttack: boolean;
97
+ }): boolean;
98
+ /**
99
+ * A stand-in for another group's card, in this group's villain area for one basic power (`Command remotePower`):
100
+ * "as if it were in their game area". It has no text box here (`CardInstance.remoteOf`); its numbers are the last
101
+ * report's: the threat on a side scheme, the hit points left on a minion (its damage set to match).
102
+ */
103
+ export declare function placeStandIn(ctx: Ctx, groupId: GroupId, card: ReachableCard): InstanceId;
104
+ /** `PodInboundEvent podReachable`: another group's reachable cards, kept for `Command remotePower` (bookkeeping). */
105
+ export declare function recordPodReachable(ctx: Ctx, event: Extract<PodInboundEvent, {
106
+ kind: "podReachable";
107
+ }>): void;
42
108
  /**
43
109
  * `EffectSpec inGroup` (docs/phase7-wave9.md §3.67): the block resolves in each group it names. For this group, as a
44
110
  * frame of its own with this group's first player as "you" and nothing of the ability around it (no slot, var or
@@ -24,6 +24,17 @@ export declare function defenseBarredCandidates(state: GameState, deps: EngineDe
24
24
  readonly candidate: TriggerCandidate;
25
25
  readonly reason: DefenseBar;
26
26
  }[];
27
+ /**
28
+ * A leader attacking the other leader in competitive play (`enemyAttacksEnemy` between two villains of a two-team
29
+ * game; MC56 p. 16). N11 A per owner decision 2026-11-20: it is an attack, so the attacker's own "when/after [X]
30
+ * attacks" abilities (`enemyAttack` patterns) hear it, though it is no activation (patterns asking for one do not);
31
+ * every other game keeps wave 3 Q12 (an enemy attacking an enemy is heard by no "when [enemy] attacks").
32
+ * MC56 p. 16 (no defender: defense-labelled abilities unusable, RRG v1.8 Defend p. 14), p. 20 FAQ (Energy Channel
33
+ * fires on leader-vs-leader); RRG v1.8 Attack p. 8 ("attacks you" needs an attacked player): the event names no
34
+ * player, so a pattern for an attack against "you" never matches it, and `gatherCandidates` drops defense-labelled
35
+ * abilities.
36
+ */
37
+ export declare function leaderAttacksLeader(state: GameState, event: TriggerEvent): boolean;
27
38
  /** Why an optional ability that answered an event was not offered (`unofferedAbilities`). */
28
39
  export type UnofferedReason = "noTarget" | "cannotPay" | "period";
29
40
  /** An optional interrupt or response that answered an event but could not be initiated (`unofferedAbilities`). */
@@ -2,7 +2,7 @@ import type { AbilityId, AbilityReference, AnyCard, CardId, Trait } from "../../
2
2
  import { type TeamState } from "./team.js";
3
3
  import { type AbilityDefinition, type AbilityTriggerSpec, type EngineDeps, type RuleSpec } from "./abilities.js";
4
4
  import { type RulesCardType } from "./card-types.js";
5
- import type { InstanceId, PlayerId } from "./ids.js";
5
+ import type { EncounterDeckId, InstanceId, PlayerId } from "./ids.js";
6
6
  import type { LogValue } from "./campaign.js";
7
7
  import { type ResourcePool } from "./resources.js";
8
8
  import { type Bindings, type Vars } from "./stack.js";
@@ -60,6 +60,12 @@ export interface EffectContext {
60
60
  readonly reaches?: "all" | {
61
61
  readonly scenarioPlayArea: string;
62
62
  };
63
+ /**
64
+ * The context of an event pattern being matched (the trigger matcher). Only such a context matches a stand-in for
65
+ * another group's card (`CardInstance.remoteOf`): "after you attack a minion" sees the remote power made against it,
66
+ * while a count, a condition or a choice in this group does not see the card at all (MC55 p. 12).
67
+ */
68
+ readonly watching?: true;
63
69
  /**
64
70
  * Last known information about cards that may have left play, by card: what was attached to each, the status
65
71
  * cards it held and whom it was engaged with (`LastKnownCard`). A query's `hasAttachment`, `hasStatus`,
@@ -330,7 +336,7 @@ export declare function gliderMainSchemeId(state: GameState, deps: EngineDeps):
330
336
  * §3.4). RRG 1.8 "Acceleration Token" (p. 5): they "still add threat to the main scheme during step one" — to "the main
331
337
  * scheme", so to the glider's when there is one (MC27 p. 17), else the central one.
332
338
  */
333
- export declare function offSchemeAccelerationTokens(state: GameState): number;
339
+ export declare function offSchemeAccelerationTokens(state: GameState, area?: GameAreaState): number;
334
340
  /**
335
341
  * Acceleration tokens on one card in play: a main scheme's `accelerationTokens`, any other card's `acceleration`
336
342
  * counter (docs/phase7-wave5.md §3.4). None on a card out of play.
@@ -542,6 +548,13 @@ export declare function contextArea(state: GameState, context: EffectContext): G
542
548
  * no player the team that plays in the game area of the effect's card. Null when neither names a team: an area-neutral
543
549
  * card resolving for no player, for which the words name nobody.
544
550
  */
551
+ /**
552
+ * "The encounter deck" for an effect: the active villain's deck, and with two teams the deck of the leader in the
553
+ * effect's own game area (MC56 p. 16: each side of the table has its own encounter deck; a card on the inactive side
554
+ * resolves for its own side, Q11 A per owner decision 2026-11-20). The active deck for an effect in no area, and in
555
+ * every game without stored teams.
556
+ */
557
+ export declare function effectEncounterDeckId(state: GameState, context: EffectContext): EncounterDeckId;
545
558
  export declare function contextTeam(state: GameState, context: EffectContext): TeamState | null;
546
559
  /**
547
560
  * Who makes a choice a card gives to "the enemy team" (docs/competitive-mode-plan.md §3.4, §4 task 7; `PlayerRef
@@ -705,13 +718,20 @@ export declare function shownDeckTop(state: GameState, deps: EngineDeps, playerI
705
718
  * docs/phase7-wave9.md §3.42): one rule in force is enough, and a second adds nothing. Read from the rules in force,
706
719
  * never from anything stored.
707
720
  */
708
- export declare const encounterTopFaceup: (state: GameState, deps: EngineDeps) => boolean;
721
+ export declare const encounterTopFaceup: (state: GameState, deps: EngineDeps, deckId?: EncounterDeckId) => boolean;
722
+ /**
723
+ * The encounter decks whose top card is kept faceup right now: each `topOfDeckFaceup { deck: "encounter" }` rule in
724
+ * force shows "the encounter deck" of its own card's side of the table (`effectEncounterDeckId`; MC56 p. 16: each side
725
+ * has its own encounter deck, and a card ignores the other side's unless it names it), so with two teams Falcon's
726
+ * rule shows his own area's deck whichever team is active. Every game without teams: the active villain's deck.
727
+ */
728
+ export declare function encounterDecksFaceup(state: GameState, deps: EngineDeps): readonly EncounterDeckId[];
709
729
  /**
710
- * The card showing on top of the encounter deck under that rule: the first card of the active villain's encounter deck
711
- * while the rule holds, null when it does not or the deck is empty. The single derivation `faceVisible`, the
712
- * `topOfDeckFaceup` predicate and the log (`announceDeckTops`) agree on.
730
+ * The card showing on top of encounter deck `deckId` (the active villain's unless named) under that rule: its first
731
+ * card while the rule holds for it, null when it does not or the deck is empty. The single derivation `faceVisible`,
732
+ * the `topOfDeckFaceup` predicate and the log (`announceDeckTops`) agree on.
713
733
  */
714
- export declare function shownEncounterTop(state: GameState, deps: EngineDeps): InstanceId | null;
734
+ export declare function shownEncounterTop(state: GameState, deps: EngineDeps, deckId?: EncounterDeckId): InstanceId | null;
715
735
  /**
716
736
  * The players a rule's `player` ref binds, with "you" read as the rule's speaker (`ActiveRule.context`), less any who
717
737
  * treat the rule's card as blank (`ActiveRule.blankedFor`, a per-player blank).
@@ -32,6 +32,14 @@ export declare function resolveScenarioSetup(ctx: Ctx): void;
32
32
  * villain in play from the start keeps exactly the step sequence it had.
33
33
  */
34
34
  export declare const stepAfterScenarioSetupAbilities: (state: GameState, after: GameStep) => GameStep;
35
+ /**
36
+ * `GameStep teamScenarioSetup`: the next team's game area sets up (it becomes the active team, and its step 12
37
+ * abilities go on the stack), or, with every area set up, the first team is active again and setup goes on to the
38
+ * scenario's rulebook instructions or the draw. A competitive game is never a campaign game (`competitiveSetupFault`).
39
+ */
40
+ export declare function executeTeamScenarioSetup(ctx: Ctx, step: Extract<GameStep, {
41
+ kind: "teamScenarioSetup";
42
+ }>): void;
35
43
  /**
36
44
  * The step after Appendix II step 12 when the scenario has rulebook-printed setup instructions
37
45
  * (`ScenarioRules.setupInstructions`), else `after`. A game without any keeps exactly the step sequence it had.
@@ -6,6 +6,7 @@ import type { OutsideFacts } from "./outside-facts.js";
6
6
  import { type InstanceId, type PlayerId } from "./ids.js";
7
7
  import { type PodSetup } from "./pod.js";
8
8
  import { type GameMode } from "./game-mode.js";
9
+ import { type CompetitiveSetup } from "./competitive-setup.js";
9
10
  import { type GameState, type ScenarioSetupInstruction, type SetupOption, type SetAsideUntilCalled, type TableRules } from "./state.js";
10
11
  import type { GameEvent } from "./events.js";
11
12
  export interface PlayerSetup {
@@ -329,10 +330,17 @@ export interface GameSetupConfig {
329
330
  */
330
331
  readonly pod?: PodSetup;
331
332
  /**
332
- * The game mode (docs/phase7-wave10.md §1.9, §3.4). Absent: cooperative. `"competitive"` is refused with
333
- * `mode_unavailable`, before anything else about the config is judged.
333
+ * The game mode (docs/phase7-wave10.md §1.9, §3.4). Absent: cooperative. `"competitive"` needs `competitive`, the two
334
+ * teams' traded scenarios; without it (a single scenario's builder) it is refused with `mode_unavailable`, before
335
+ * anything else about the config is judged.
334
336
  */
335
337
  readonly gameMode?: GameMode;
338
+ /**
339
+ * The two teams of a competitive game and the scenario each faces (`CompetitiveSetup`; docs/competitive-mode-plan.md
340
+ * M1). Only with `gameMode: "competitive"`. `villainCardId` and `mainSchemeCardId` are then read from the teams'
341
+ * scenarios, and `encounterDeck` must be empty.
342
+ */
343
+ readonly competitive?: CompetitiveSetup;
336
344
  }
337
345
  /**
338
346
  * The villain deck and set-aside villains a scenario uses at a difficulty (docs/phase7-wave2.md §3.4). The Once and