@champions-digital-game/mod-sdk 0.52.0 → 0.54.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.
- package/README.md +8 -4
- package/dist/build.js +1 -1
- package/dist/chunks/{chunk-3ZP7JFBM.js → chunk-3SR23UJ7.js} +1 -1
- package/dist/chunks/{chunk-STQU5RJP.js → chunk-3YMCANI3.js} +1 -1
- package/dist/chunks/{chunk-XDNO5DKC.js → chunk-7NRC6TLV.js} +1 -1
- package/dist/chunks/{chunk-GIPUMXZ5.js → chunk-ACT4TJXC.js} +5 -5
- package/dist/chunks/{chunk-DH3FUEOQ.js → chunk-DX44O32N.js} +1 -1
- package/dist/chunks/{chunk-KWTX5B5J.js → chunk-S3JH4WL4.js} +1 -1
- package/dist/chunks/{chunk-RRZU6F4D.js → chunk-WFEXO5DU.js} +1 -1
- package/dist/import.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mc-pack.js +7 -5
- package/dist/testing.js +1 -1
- package/package.json +3 -2
- package/types/cards/src/dsl/abilities.d.ts +15 -9
- package/types/cards/src/wave11/luke_cage/leadership.d.ts +2 -1
- package/types/content/src/index.d.ts +1 -1
- package/types/content/src/schema/sets.d.ts +6 -0
- package/types/engine/src/choices.d.ts +6 -0
- package/types/engine/src/events.d.ts +4 -2
- package/types/engine/src/index.d.ts +2 -1
- package/types/engine/src/legal.d.ts +2 -0
- package/types/engine/src/query.d.ts +3 -3
- package/types/engine/src/resolve/discarded-card.d.ts +84 -0
- package/types/engine/src/resolve/target-validity.d.ts +14 -1
- package/types/engine/src/resolve/triggers.d.ts +1 -1
- package/types/engine/src/search-findable.d.ts +41 -0
- package/types/engine/src/select.d.ts +5 -0
- package/types/engine/src/trigger-events.d.ts +6 -5
- package/types/mod-sdk/src/smoke.d.ts +44 -0
- package/types/mod-sdk/src/typecheck.d.ts +23 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ENGINE_VERSION = "0.
|
|
1
|
+
export declare const ENGINE_VERSION = "0.54.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:
|
|
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;
|
|
@@ -506,7 +506,7 @@ export declare function deckDiscardStillThere(state: GameState, discard: {
|
|
|
506
506
|
}): boolean;
|
|
507
507
|
/**
|
|
508
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
|
|
509
|
+
* response that took it away leaves nothing for another response that needs the card (`lostWithDiscardedCard`).
|
|
510
510
|
*/
|
|
511
511
|
export declare function handDiscardStillThere(state: GameState, discard: {
|
|
512
512
|
readonly instanceId: InstanceId;
|
|
@@ -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;
|
|
@@ -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
|
|
@@ -1580,10 +1580,10 @@ export type TriggerEventBody = {
|
|
|
1580
1580
|
*
|
|
1581
1581
|
* Response only: the card is already in the discard pile. Recorded only when an ability in the registry listens, and
|
|
1582
1582
|
* announced between frames, so the cards one effect or cost discarded share one response window (RRG 1.8 "Triggering
|
|
1583
|
-
* Condition", p. 45) that resolves before the discarding ability's next effect.
|
|
1584
|
-
*
|
|
1585
|
-
*
|
|
1586
|
-
* 4, answer 1; §4.1 Q32; `settleDeckDiscards`), unless the response that took it says it stays counted
|
|
1583
|
+
* Condition", p. 45) that resolves before the discarding ability's next effect. Once a response has taken the card
|
|
1584
|
+
* away (`deckDiscardStillThere`), a response that needs that card is no longer offered for it, and one that does not
|
|
1585
|
+
* still is (`lostWithDiscardedCard`, issue #928); the discarding ability no longer counts it (ruling, April 30, 2026 -
|
|
1586
|
+
* Ruling 4, answer 1; §4.1 Q32; `settleDeckDiscards`), unless the response that took it says it stays counted
|
|
1587
1587
|
* (`AbilityDefinition.discardsStayCounted`, docs/phase7-wave10-box-heroes.md B3.3).
|
|
1588
1588
|
*
|
|
1589
1589
|
* `at`: where the discard left the card. `"discard"`: the player's discard pile. `"deck"`: the discard emptied the
|
|
@@ -1645,7 +1645,8 @@ export type TriggerEventBody = {
|
|
|
1645
1645
|
* Response only: announced after the card has reached its discard pile, between frames (`announceHandDiscards`), so
|
|
1646
1646
|
* the cards one effect or one cost discarded share one response window (RRG 1.8 "Discard", p. 16: "Responses to the
|
|
1647
1647
|
* discarding of any of those cards are resolved after all discards are made"; "Triggering Condition", p. 45). A
|
|
1648
|
-
* response that takes the card out of the discard pile leaves nothing for another
|
|
1648
|
+
* response that takes the card out of the discard pile leaves nothing for another response that needs that card
|
|
1649
|
+
* (`handDiscardStillThere`, `lostWithDiscardedCard`, issue #928); one that does not need it is still offered.
|
|
1649
1650
|
* Recorded (`recordHandDiscard`) only when an ability in the registry listens.
|
|
1650
1651
|
*/
|
|
1651
1652
|
| {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type StarterDeck } from "../../content/src/index.js";
|
|
1
2
|
import { type EngineDeps } from "../../engine/src/index.js";
|
|
2
3
|
import type { PackCampaign } from "./campaigns.js";
|
|
3
4
|
import type { PackInput } from "./validate.js";
|
|
@@ -50,6 +51,49 @@ export interface SmokeResult {
|
|
|
50
51
|
/** Not failures: what the run could not cover (a hero with no deck, no pack card played). */
|
|
51
52
|
readonly notes: readonly string[];
|
|
52
53
|
}
|
|
54
|
+
/** One kind of smoke game: who sits, at which scenario, with which modular pick. Each is played once per seed. */
|
|
55
|
+
export interface SmokePlan {
|
|
56
|
+
/** The deck seated: a pack precon's id, or the base precon's. */
|
|
57
|
+
readonly name: string;
|
|
58
|
+
/** The pack precon seated; absent seats `SMOKE_BASE_DECK`. */
|
|
59
|
+
readonly deck?: StarterDeck;
|
|
60
|
+
readonly scenario: string;
|
|
61
|
+
/** The pack's modular set this plan is about. */
|
|
62
|
+
readonly modularSet?: string;
|
|
63
|
+
readonly difficulty?: "expert";
|
|
64
|
+
/** The modular sets to pick; absent is the scenario's recommendation. */
|
|
65
|
+
readonly modularSetIds?: readonly string[];
|
|
66
|
+
}
|
|
67
|
+
/** What `smokeTestPack` plays for a pack: its game plans and its campaigns, each once per seed `1..games`. */
|
|
68
|
+
export interface SmokeSchedule {
|
|
69
|
+
readonly scenario: string;
|
|
70
|
+
readonly games: number;
|
|
71
|
+
readonly maxCommands: number;
|
|
72
|
+
readonly plans: readonly SmokePlan[];
|
|
73
|
+
readonly campaigns: readonly PackCampaign[];
|
|
74
|
+
/** Not failures: what the plans could not cover (a hero with no deck). */
|
|
75
|
+
readonly notes: readonly string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Plans a pack's smoke run without playing it, so a caller (a test file) can play each game on its own: the pack's hero
|
|
79
|
+
* precons at the Core scenario, each of its scenarios standard and expert, each of its modular sets at the Core
|
|
80
|
+
* scenario, and each of its campaigns. Throws on bad options.
|
|
81
|
+
*/
|
|
82
|
+
export declare function smokeSchedule(pack: PackInput, options?: SmokeOptions): SmokeSchedule;
|
|
83
|
+
/**
|
|
84
|
+
* Plays one smoke game of `plan` at `seed` to an outcome and replays its log. `deps` is
|
|
85
|
+
* `gameDepsWithPack(PLAYABLE_DEPS, pack)`, made once by the caller for all of the pack's games. Never throws for a
|
|
86
|
+
* broken pack: the game says what failed.
|
|
87
|
+
*/
|
|
88
|
+
export declare function playSmokeGame(pack: PackInput, deps: EngineDeps, plan: SmokePlan, seed: number, maxCommands?: number): SmokeGame;
|
|
89
|
+
/**
|
|
90
|
+
* Plays a pack campaign once per seed `1..games` through `playCampaign`. With `failOnAlwaysLost`, adds a failed game
|
|
91
|
+
* when every seed lost at the same node.
|
|
92
|
+
*/
|
|
93
|
+
export declare function smokeTestCampaign(pack: PackInput, campaign: PackCampaign, deps: EngineDeps, options?: Pick<SmokeOptions, "games" | "maxCommands" | "failOnAlwaysLost" | "onGame">): {
|
|
94
|
+
readonly games: readonly SmokeGame[];
|
|
95
|
+
readonly notes: readonly string[];
|
|
96
|
+
};
|
|
53
97
|
/** Plays `options.games` headless games per deck the pack can field. Never throws for a broken pack. */
|
|
54
98
|
export declare function smokeTestPack(pack: PackInput, options?: SmokeOptions): SmokeResult;
|
|
55
99
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PackIssue } from "./validate.js";
|
|
2
|
+
/** tsc could not be found or could not run: the pack was not checked (not a defect in the pack). */
|
|
3
|
+
export declare class TypecheckUnavailableError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export interface TypecheckOptions {
|
|
6
|
+
/** The tsc entry script (`typescript/bin/tsc`) to run with Node. Default: found as described above. */
|
|
7
|
+
readonly tsc?: string;
|
|
8
|
+
/** The `.ts` / `.d.ts` file the SDK's import names resolve to. Default: the SDK package's `types`. */
|
|
9
|
+
readonly sdkTypes?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The SDK's type entry: `types` of the package this module is part of (`./src/index.ts` in this repo,
|
|
13
|
+
* `./types/mod-sdk/src/index.d.ts` in the published package, whose bundle runs from `dist/` or `dist/chunks/`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function sdkTypesEntry(): string;
|
|
16
|
+
/** `typescript/bin/tsc`, resolved from the SDK first, then from the pack's folder. */
|
|
17
|
+
export declare function findTsc(packDir: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Type-checks the pack in `packDir` (its `abilities/**\/*.ts`, and what they import) and returns one issue per type
|
|
20
|
+
* error in the pack's own files, at `abilities/<file>:<line>:<col>`. A pack with no `abilities/` folder has nothing to
|
|
21
|
+
* check. Throws `TypecheckUnavailableError` when tsc is missing or fails to run.
|
|
22
|
+
*/
|
|
23
|
+
export declare function typecheckPack(packDir: string, options?: TypecheckOptions): readonly PackIssue[];
|