@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.
- package/README.md +3 -3
- package/dist/build.js +1 -1
- package/dist/chunks/{chunk-DX44O32N.js → chunk-MRZL7PHD.js} +1 -1
- package/dist/chunks/{chunk-S3JH4WL4.js → chunk-N2HMNYPQ.js} +1 -1
- package/dist/chunks/{chunk-ACT4TJXC.js → chunk-NHQRL3H2.js} +3 -3
- package/dist/chunks/{chunk-3SR23UJ7.js → chunk-PHTEP3BC.js} +1 -1
- package/dist/chunks/{chunk-WFEXO5DU.js → chunk-RBTO2IFX.js} +1 -1
- package/dist/chunks/chunk-SCRIASBU.js +1 -0
- package/dist/chunks/{chunk-7NRC6TLV.js → chunk-SG4DMEG6.js} +1 -1
- package/dist/import.js +1 -1
- package/dist/index.js +1 -1
- package/dist/mc-pack.js +2 -2
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/types/cards/src/dsl/abilities.d.ts +6 -3
- package/types/cards/src/dsl/effects.d.ts +22 -2
- package/types/cards/src/dsl/values.d.ts +11 -0
- package/types/cards/src/index.d.ts +3 -2
- package/types/cards/src/testing/driver.d.ts +16 -1
- package/types/cards/src/wave10/competitive.d.ts +49 -0
- package/types/cards/src/wave10/cw/competitive/leader-cards.d.ts +5 -7
- package/types/cards/src/wave10/cw/competitive/standard-pvp.d.ts +3 -3
- package/types/cards/src/wave10/cw/leaders/captain-marvel.d.ts +4 -2
- package/types/cards/src/wave10/cw/modular/dangerous-recruits.d.ts +0 -29
- package/types/cards/src/wave10/cw/modular/secret-avengers.d.ts +3 -4
- package/types/cards/src/wave10/cw/modular/the-initiative.d.ts +0 -31
- package/types/cards/src/wave10/index.d.ts +2 -0
- package/types/cards/src/wave10/setup.d.ts +7 -0
- package/types/cards/src/wave10/synthezoid/competitive/leader-cards.d.ts +22 -11
- package/types/cards/src/wave9/index.d.ts +1 -1
- package/types/cards/src/wave9/setup.d.ts +20 -1
- package/types/content/src/index.d.ts +1 -1
- package/types/engine/src/actions.d.ts +5 -0
- package/types/engine/src/commands.d.ts +53 -1
- package/types/engine/src/competitive-outcome.d.ts +159 -0
- package/types/engine/src/competitive-setup.d.ts +73 -0
- package/types/engine/src/effects.d.ts +32 -6
- package/types/engine/src/errors.d.ts +18 -2
- package/types/engine/src/event-sides.d.ts +21 -0
- package/types/engine/src/events.d.ts +127 -3
- package/types/engine/src/flow.d.ts +1 -1
- package/types/engine/src/game-fingerprint.d.ts +2 -2
- package/types/engine/src/index.d.ts +12 -4
- package/types/engine/src/lasting.d.ts +6 -1
- package/types/engine/src/pod-commands.d.ts +81 -0
- package/types/engine/src/pod-coordinator.d.ts +136 -0
- package/types/engine/src/pod.d.ts +276 -2
- package/types/engine/src/query.d.ts +7 -0
- package/types/engine/src/resolve/pod.d.ts +67 -1
- package/types/engine/src/resolve/triggers.d.ts +11 -0
- package/types/engine/src/select.d.ts +27 -7
- package/types/engine/src/setup-steps.d.ts +8 -0
- package/types/engine/src/setup.d.ts +10 -2
- package/types/engine/src/spec.d.ts +83 -10
- package/types/engine/src/state.d.ts +120 -2
- package/types/engine/src/team-phases.d.ts +106 -0
- package/types/engine/src/team.d.ts +34 -0
- package/types/engine/src/trigger-events.d.ts +50 -3
- package/types/engine/src/villain/authority.d.ts +16 -3
- package/types/engine/src/villain-phase-begun.d.ts +24 -0
- package/dist/chunks/chunk-3YMCANI3.js +0 -1
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import type { AbilityRegistry } from "../../../../../engine/src/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Modular encounter set `the_initiative` (Civil War, Registration side; docs/phase7-wave10.md section 3.23). Guard,
|
|
4
|
-
* Quickstrike, Hinder 1[per_hero] and the crisis icon are data keywords and data fields.
|
|
5
|
-
*
|
|
6
|
-
* **Doc Samson (56078)** and **Hellcat (56079)**: the status the text gives is read before the card's own status is
|
|
7
|
-
* given, so "if you were already confused / stunned" looks at the player's identity as it was (the same shape as Bomb
|
|
8
|
-
* Scare and False Alarm). Doc Samson: confused, and 2 threat on the main scheme if already confused. Hellcat: stunned,
|
|
9
|
-
* and 2 indirect damage (divided by the player among the characters they control) if already stunned. Each Boost
|
|
10
|
-
* gives the status alone.
|
|
11
|
-
*
|
|
12
|
-
* **Drafted (56080)**: the attached minion gets +2 hit points and the Avenger trait. When Revealed, in a cooperative
|
|
13
|
-
* game: cards are discarded from the encounter deck until a minion is discarded, that minion is revealed, then Drafted
|
|
14
|
-
* is attached to it. The competitive sentence is the true branch of `inCompetitiveMode()` and is never resolved here
|
|
15
|
-
* (docs/phase7-wave10.md section 3.4); it has no attach data of its own, so the card attaches through this When
|
|
16
|
-
* Revealed (RRG 1.8 "Reveal", p. 38, step 2). A minion that does not enter play (the unique rule discards it) takes no
|
|
17
|
-
* Drafted, which is then discarded (RRG 1.8 "Attach To", p. 8).
|
|
18
|
-
*
|
|
19
|
-
* **Mighty Avengers (56081)**: the "When Revealed" ability of each minion in play is resolved, a minion's incite and
|
|
20
|
-
* surge included (FFG ruling, September 22, 2026; owner decision 2026-10-20, revising docs/phase7-wave4.md §4 Q23,
|
|
21
|
-
* section 3.56); with none resolved the card gains surge.
|
|
22
|
-
*
|
|
23
|
-
* **The Fifty State Initiative (56082)**: When Defeated: each Avenger minion in the encounter discard pile is shuffled
|
|
24
|
-
* into the encounter deck.
|
|
25
|
-
*
|
|
26
|
-
* Cards (5):
|
|
27
|
-
* - 56078 Doc Samson (minion)
|
|
28
|
-
* - 56079 Hellcat (minion)
|
|
29
|
-
* - 56080 Drafted (attachment)
|
|
30
|
-
* - 56081 Mighty Avengers (treachery)
|
|
31
|
-
* - 56082 The Fifty State Initiative (side_scheme)
|
|
32
|
-
*/
|
|
33
2
|
export declare const MODULAR_THE_INITIATIVE: AbilityRegistry;
|
|
34
3
|
/** Refs of this module's cards deliberately left unscripted, each with its written reason. Delete a line as its ref is scripted. */
|
|
35
4
|
export declare const MODULAR_THE_INITIATIVE_SKIPPED: Readonly<Record<string, string>>;
|
|
@@ -33,3 +33,5 @@ export { WAVE10_MODULES, wave10ModulesOf } from "./modules.js";
|
|
|
33
33
|
export type { Wave10Module } from "./modules.js";
|
|
34
34
|
export { WAVE10_GAME_ENCOUNTER_SETS, wave10MainSchemeCard, wave10Scenario, wave10ScenarioRecord, wave10StarterDeckSetup, } from "./setup.js";
|
|
35
35
|
export type { Wave10Difficulty, Wave10ScenarioOptions } from "./setup.js";
|
|
36
|
+
export { civilWarCompetitive, competitiveModularSetProblem, leaderPlayerCardIds } from "./competitive.js";
|
|
37
|
+
export type { CivilWarCompetitiveOptions, CivilWarCompetitiveTeam } from "./competitive.js";
|
|
@@ -65,3 +65,10 @@ export declare function wave10StarterDeckSetup(starterDeckId: string): PlayerSet
|
|
|
65
65
|
* cooperative game, so no seat is refused for it.
|
|
66
66
|
*/
|
|
67
67
|
export declare function wave10Scenario(scenarioId: string, options: Wave10ScenarioOptions): GameSetupConfig;
|
|
68
|
+
/**
|
|
69
|
+
* The scenario a team builds for the other team to face in competitive mode (MC56 pp. 4-5, 14; docs/competitive-mode-
|
|
70
|
+
* plan.md M1): the same choices as `wave10Scenario`, with the Standard PvP set of the leader's side in place of the
|
|
71
|
+
* Standard set (MC56 p. 3: "used instead of the Standard encounter set"; each scenario holds its own copy, Q15).
|
|
72
|
+
* `options.players` are the players who will face it. Used by `civilWarCompetitive`, never as a game of its own.
|
|
73
|
+
*/
|
|
74
|
+
export declare function wave10CompetitiveScenario(scenarioId: string, options: Wave10ScenarioOptions): GameSetupConfig;
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import type { AbilityRegistry } from "../../../../../engine/src/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* The eight leader player cards (She-Hulk 57032 to 57035, Vision 57074 to 57077) of Synthezoid Smackdown (MC57;
|
|
4
|
-
* docs/phase7-synthezoid.md section 8.3 item 14). Competitive only
|
|
5
|
-
*
|
|
4
|
+
* docs/phase7-synthezoid.md section 8.3 item 14). Competitive only (the data's `specificTo`), so "your leader" always
|
|
5
|
+
* resolves in a game that seats one; cooperatively a clause aimed at it does nothing (MC56 p. 6).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
7
|
+
* "The main scheme" is the main scheme of the card controller's own game area (the one the enemy leader's scenario
|
|
8
|
+
* puts in front of the team); "your leader's main scheme" is the other team's (MC56 p. 16).
|
|
9
|
+
*
|
|
10
|
+
* She-Hulk
|
|
11
|
+
* - 57032 You're Out of Order!: Interrupt to threat placed on the main scheme, prevent 3 of it.
|
|
12
|
+
* - 57033 She-Hulk Smash: the leader-versus-leader attack; with a [physical] resource paid, stun the enemy leader.
|
|
13
|
+
* - 57034 Make Me Angry: attaches to your leader (card data); after a hero or leader attacks her, she attacks that
|
|
14
|
+
* character (a leader-versus-leader attack if it is a leader), then this is discarded.
|
|
15
|
+
* - 57035 Legal Counsel: after you spend it, move 1 threat from the main scheme to your leader's main scheme.
|
|
16
|
+
*
|
|
17
|
+
* Vision
|
|
18
|
+
* - 57074 Calculated Risk: search the top 5 of your leader's encounter deck (in the other team's area) for a card, deal
|
|
19
|
+
* it facedown to the first player on the enemy team (that team's token holder), then shuffle that deck.
|
|
20
|
+
* - 57075 Synthezoid Strike: the leader-versus-leader attack; a Dense Vision gets +1 ATK and piercing for it, an
|
|
21
|
+
* Intangible one flips to Dense first (reading A, docs/competitive-mode-plan.md section 1.10).
|
|
22
|
+
* - 57076 Phased Out: discard an attachment on the enemy leader printing Hero Action or Hero Response (current text,
|
|
23
|
+
* errata RRG v1.8 p. 70 and the March 19, 2026 ruling: the printed "Hero Interrupt" is "Hero Action").
|
|
24
|
+
* - 57077 Android Assistance: when you spend it, flip your leader's mass form attachment.
|
|
25
|
+
*
|
|
26
|
+
* All eight are scripted.
|
|
16
27
|
*/
|
|
17
28
|
export declare const SYNTHEZOID_COMPETITIVE_LEADER_CARDS: AbilityRegistry;
|
|
18
29
|
/**
|
|
@@ -23,5 +23,5 @@ export declare const WAVE9_ABILITIES: AbilityRegistry;
|
|
|
23
23
|
export declare const WAVE9_DEPS: EngineDeps;
|
|
24
24
|
export { WAVE9_CARDS } from "./cards.js";
|
|
25
25
|
export { CARD_GROUPS } from "./card-groups.js";
|
|
26
|
-
export { wave9Scenario, wave9StarterDeckSetup } from "./setup.js";
|
|
26
|
+
export { epicGroupScenario, wave9Scenario, wave9StarterDeckSetup, type EpicGroupPlacement } from "./setup.js";
|
|
27
27
|
export type { Wave9Difficulty, Wave9ScenarioOptions } from "./setup.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CardId } from "../../../content/src/index.js";
|
|
2
|
-
import { type GameSetupConfig, type PlayerSetup } from "../../../engine/src/index.js";
|
|
2
|
+
import { type GameSetupConfig, type GroupId, type PlayerSetup } from "../../../engine/src/index.js";
|
|
3
3
|
import { type CoreDifficulty, type CoreScenarioOptions } from "../core/setup.js";
|
|
4
4
|
export type Wave9Difficulty = CoreDifficulty;
|
|
5
5
|
export interface Wave9ScenarioOptions extends Omit<CoreScenarioOptions, "cardPool" | "difficulty"> {
|
|
@@ -25,3 +25,22 @@ export declare function wave9StarterDeckSetup(starterDeckId: string): PlayerSetu
|
|
|
25
25
|
* `thunderbolts`, `baron-zemo`, `enchantress`, `god-of-lies`). Throws for any other id.
|
|
26
26
|
*/
|
|
27
27
|
export declare function wave9Scenario(scenarioId: string, options: Wave9ScenarioOptions): GameSetupConfig;
|
|
28
|
+
/** Where one group sits in an Epic Multiplayer game (docs/epic-multiplayer-plan.md §1.2, §4 item 4). */
|
|
29
|
+
export interface EpicGroupPlacement {
|
|
30
|
+
readonly groupId: GroupId;
|
|
31
|
+
/** Every group of this group's pod, it included, in the pod's order (what "choose a group in your pod" offers). */
|
|
32
|
+
readonly groupIdsInPod: readonly GroupId[];
|
|
33
|
+
/** Every group of the game, all pods. */
|
|
34
|
+
readonly groupsInGame: number;
|
|
35
|
+
/** Every player of the game, all groups. */
|
|
36
|
+
readonly playersInGame: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One group's `GameSetupConfig` in Epic Multiplayer Mode: a scenario with neutral cards (`god-of-lies`) set up as a
|
|
40
|
+
* group of a pod whose coordinator is outside this engine (`coordinator: "remote"`; plan §2 option B). MC55 p. 11 and
|
|
41
|
+
* 55028b: one Loki, God of Lies and one Worlds Collide per game; pods only scope "your pod" abilities (MC55 pp. 4, 13).
|
|
42
|
+
* So the shared record every group builds counts the whole game (Loki's hit points and flip per player in the game,
|
|
43
|
+
* Worlds Collide's target per group in the game; Q3), and a per group icon in a group's area counts its pod: Epic
|
|
44
|
+
* Multiplayer Reminder card: groups that began the scenario in that pod (cf. RRG Per Player Icon p. 32).
|
|
45
|
+
*/
|
|
46
|
+
export declare function epicGroupScenario(scenarioId: string, options: Wave9ScenarioOptions, placement: EpicGroupPlacement): GameSetupConfig;
|
|
@@ -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.
|
|
6
|
+
export declare const SCHEMA_VERSION = "1.0.0";
|
|
7
7
|
export * from "./schema/index.js";
|
|
8
8
|
export * from "./data/index.js";
|
|
9
9
|
export * from "./import/index.js";
|
|
@@ -11,6 +11,7 @@ import { type FrameId, type InstanceId, type PlayerId } from "./ids.js";
|
|
|
11
11
|
import { printedResources, type PaidTypesRead, type ResolvedRequirement, type ResourcePool, type ResourceType, type TypedResource } from "./resources.js";
|
|
12
12
|
import { type Bindings, type ReportTarget, type UndeclaredWilds, type Vars } from "./stack.js";
|
|
13
13
|
import type { GameState } from "./state.js";
|
|
14
|
+
export declare function requireActivePlayer(state: GameState, playerId: PlayerId, command: Command): EngineError | null;
|
|
14
15
|
export declare function changeForm(ctx: Ctx, command: Command & {
|
|
15
16
|
type: "changeForm";
|
|
16
17
|
}): EngineError | null;
|
|
@@ -1083,6 +1084,9 @@ export declare const useLateForcedAction: (ctx: Ctx, command: Command & {
|
|
|
1083
1084
|
export declare function useAbility(ctx: Ctx, command: Command & {
|
|
1084
1085
|
type: "useAbility";
|
|
1085
1086
|
}, timed?: boolean): EngineError | null;
|
|
1087
|
+
export declare function usableCharacter(ctx: Ctx, playerId: PlayerId, characterId: InstanceId, command: Command,
|
|
1088
|
+
/** `BasicPowerTerms.withoutExhausting`: "(even if you are exhausted)" (Grapnel Launcher 61023, §H3.14). */
|
|
1089
|
+
evenIfExhausted?: boolean): EngineError | null;
|
|
1086
1090
|
/**
|
|
1087
1091
|
* RRG "Consequential Damage": tier 5 of the timing chart, after the attack fully resolves.
|
|
1088
1092
|
*
|
|
@@ -1097,6 +1101,7 @@ export declare function useAbility(ctx: Ctx, command: Command & {
|
|
|
1097
1101
|
* `column`: the stat the damage is printed under, when it is not the power's own (a thwart made with ATK).
|
|
1098
1102
|
*/
|
|
1099
1103
|
export declare function pushConsequentialDamage(ctx: Ctx, characterId: InstanceId, kind: "attack" | "thwart", column?: "attack" | "thwart"): ReportTarget | null;
|
|
1104
|
+
export declare const consequentialDamageEvent: (characterId: InstanceId, amount: number, kind: "attack" | "thwart") => TriggerEvent;
|
|
1100
1105
|
/**
|
|
1101
1106
|
* "Havok takes +1 consequential damage for this attack" (Havok, `storm` 36014) when his consequential damage is 0: the
|
|
1102
1107
|
* one-shot `modifyConsequentialDamage` has no pending damage event to change, because `pushConsequentialDamage` pushes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AbilityId } from "../../content/src/index.js";
|
|
2
|
-
import type { ChoiceId, InstanceId, PlayerId } from "./ids.js";
|
|
2
|
+
import type { ChoiceId, GroupId, InstanceId, PlayerId } from "./ids.js";
|
|
3
|
+
import type { PodInboundEvent, RemotePower } from "./pod.js";
|
|
3
4
|
import type { ResourceType } from "./resources.js";
|
|
4
5
|
/**
|
|
5
6
|
* One source of resources toward a cost: a card discarded from hand, or a
|
|
@@ -275,10 +276,17 @@ export type Command =
|
|
|
275
276
|
* - **Any seated, non-eliminated player may concede, and it ends the game for the whole table**, because a co-op
|
|
276
277
|
* table shares one outcome. If a future build wants every seat to confirm first, that is a client/netcode wrapper
|
|
277
278
|
* that gathers confirmations and then issues this one command — not engine behavior.
|
|
279
|
+
* - **Competitive play** (N12 A per owner decision 2026-11-20): it is the conceding player's **team's** forfeit, and
|
|
280
|
+
* ends the game at once: that team loses and the other wins, with no equal phases and no tie-breaks
|
|
281
|
+
* (`competitiveConcession`). With `alone`, a player of a team that still has another seat in the game gives up
|
|
282
|
+
* only their own seat: they are eliminated (RRG 1.8 "Player Elimination", p. 34) and their team plays on; the last
|
|
283
|
+
* seat of a team conceding alone is its team's forfeit. Neither is a defeat: no "when defeated" effect hears it.
|
|
284
|
+
* `alone` is ignored in a cooperative game.
|
|
278
285
|
*/
|
|
279
286
|
| {
|
|
280
287
|
readonly type: "concede";
|
|
281
288
|
readonly playerId: PlayerId;
|
|
289
|
+
readonly alone?: true;
|
|
282
290
|
}
|
|
283
291
|
/**
|
|
284
292
|
* A manual correction of the game state, from the pause menu, after a bug or a misclick (issue #791). **Not an RRG
|
|
@@ -295,7 +303,51 @@ export type Command =
|
|
|
295
303
|
readonly playerId: PlayerId;
|
|
296
304
|
readonly choiceId: ChoiceId;
|
|
297
305
|
readonly selectedOptionIds: readonly string[];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* An event of the pod's coordinator for this group (Epic Multiplayer; docs/phase7-wave9.md §3.68,
|
|
309
|
+
* docs/epic-multiplayer-plan.md §2 option B): recorded in this group's log at its place, so the group replays alone.
|
|
310
|
+
* Issued only by the group's authority, never by a seat (`isAuthorityCommand`); `legalActions` never offers it.
|
|
311
|
+
* `playerId` is the group's first player, the seat it is recorded under and who resolves what it brings as "you"
|
|
312
|
+
* (plan §1.8 M2). `sequence` is the coordinator's number for this group: exactly one more than the last accepted.
|
|
313
|
+
* Refused in a game without a remote coordinator. Exempt from the pending-choice gate: it waits in state for the
|
|
314
|
+
* resolution in progress to finish (MC55 p. 20), except as `PodInboundEvent` says.
|
|
315
|
+
*/
|
|
316
|
+
| {
|
|
317
|
+
readonly type: "externalEvent";
|
|
318
|
+
readonly playerId: PlayerId;
|
|
319
|
+
readonly sequence: number;
|
|
320
|
+
readonly event: PodInboundEvent;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* A basic attack or thwart on a card in another group's area of the pod "as if it were in their game area" (The
|
|
324
|
+
* Mangog 55041, Door Between Worlds 55046; MC55 p. 16; plan §1.8 M6: only these two powers): a real basic power made
|
|
325
|
+
* here, against a stand-in for the card (`pod-commands.ts` `remotePower`), with the basic power's own `payment` and
|
|
326
|
+
* `costChoices`. `targetInstanceId` is the card's id in the owning group, as `PodState.reachable` reports it.
|
|
327
|
+
*/
|
|
328
|
+
| {
|
|
329
|
+
readonly type: "remotePower";
|
|
330
|
+
readonly playerId: PlayerId;
|
|
331
|
+
readonly characterInstanceId: InstanceId;
|
|
332
|
+
readonly power: RemotePower;
|
|
333
|
+
readonly toGroupId: GroupId;
|
|
334
|
+
readonly targetInstanceId: InstanceId;
|
|
335
|
+
readonly payment?: readonly Payment[];
|
|
336
|
+
readonly costChoices?: CostChoices;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The group's authority ends a wait for a pod coordinator that is gone (`PodState.awaiting`; docs/live-game-rooms.md
|
|
340
|
+
* §10). Issued only by the authority after a timeout (`isAuthorityCommand`), under the first player's seat.
|
|
341
|
+
*/
|
|
342
|
+
| {
|
|
343
|
+
readonly type: "podRelease";
|
|
344
|
+
readonly playerId: PlayerId;
|
|
298
345
|
};
|
|
346
|
+
/**
|
|
347
|
+
* A command only a group's authority (its host) issues, never a seat: `externalEvent` and `podRelease`. The engine has
|
|
348
|
+
* no notion of who sent a command; a host refuses these from a seat (docs/phase7-wave9.md §3.68).
|
|
349
|
+
*/
|
|
350
|
+
export declare const isAuthorityCommand: (command: Command) => boolean;
|
|
299
351
|
export type CommandType = Command["type"];
|
|
300
352
|
/** A status card a manual adjustment gives or removes. */
|
|
301
353
|
export type AdjustableStatus = "stunned" | "confused" | "tough";
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a competitive game ends (docs/competitive-mode-plan.md §1.7, milestone M5).
|
|
3
|
+
*
|
|
4
|
+
* MC56 pp. 16-17, 20 (scenario rules override RRG per Golden Rule, RRG p. 4). Three ways to win: defeat the enemy
|
|
5
|
+
* leader first; have your leader complete its main scheme first (the scheme in the enemy team's area, whose final
|
|
6
|
+
* stage reads "If this stage is completed, the players lose the game"); have your leader defeat all your opponents'
|
|
7
|
+
* identities first (any cause, Q8 A). "The game does not end until both sides have played an equal number of phases":
|
|
8
|
+
* when one team wins or loses, play continues through the end of the resistance team's next phase (Q7, settled by the
|
|
9
|
+
* rules expert 2026-11-20: the game ends once both sides have played the same number of phases); a team that wins
|
|
10
|
+
* plays on to the end of its current phase. If both teams lose in that time, both lose; if both defeat their enemy
|
|
11
|
+
* leaders, it is a tie. Owner decisions of 2026-11-20: different win conditions met in that window are a tie too (N4),
|
|
12
|
+
* never decided by who acted first; a leader defeated by a leader-versus-leader attack counts for the team whose area
|
|
13
|
+
* holds it (N3); a tie is settled by MC56 p. 17's tie-breaks in printed order when the table chose them (Q9 C, the
|
|
14
|
+
* lobby's `tieBreaks` option, on by default), and stays a tie when it did not.
|
|
15
|
+
*
|
|
16
|
+
* The phase order is registration hero, resistance hero, registration villain, resistance villain (MC56 p. 16; Q3 B), so
|
|
17
|
+
* the phase a game closes after is always the last team's phase of the kind being played when the first result came:
|
|
18
|
+
* its current phase when it is active, else its next one, of the same kind and round.
|
|
19
|
+
*
|
|
20
|
+
* Every cooperative game is untouched: nothing here runs without stored teams (`GameState.teams`).
|
|
21
|
+
*/
|
|
22
|
+
import { type Ctx } from "./ctx.js";
|
|
23
|
+
import type { EncounterDeckId, InstanceId, PlayerId, TeamId } from "./ids.js";
|
|
24
|
+
import { maxHitPoints } from "./query.js";
|
|
25
|
+
import type { GameState } from "./state.js";
|
|
26
|
+
import { type TeamSide, type TeamState } from "./team.js";
|
|
27
|
+
/**
|
|
28
|
+
* A win condition one team met (MC56 p. 17), named from that team's side of the table:
|
|
29
|
+
* - `enemyLeaderDefeated`: the leader in its own area, the one it fights, was defeated;
|
|
30
|
+
* - `leaderSchemeCompleted`: its leader completed its main scheme (the final stage of the scheme in the enemy team's
|
|
31
|
+
* area), which is the enemy team losing;
|
|
32
|
+
* - `opponentsDefeated`: every identity of the enemy team was defeated, by any cause (Q8 A);
|
|
33
|
+
* - `opponentsLost`: the enemy team lost some other way the rules name for one team (a card's own "the players lose":
|
|
34
|
+
* MC56 p. 20 QR, "the players" is that team only; the encounter deck in its area emptied with its discard pile
|
|
35
|
+
* empty too: RRG v1.8 "Encounter Deck" p. 17, to which MC56 adds no exception, `loseIfEncounterCardsExhausted`).
|
|
36
|
+
* Engine reading (authority step 5): MC56 names only the three above, and a loss of one team is read as the other's
|
|
37
|
+
* win, as for the scheme.
|
|
38
|
+
*/
|
|
39
|
+
export type CompetitiveCondition = "enemyLeaderDefeated" | "leaderSchemeCompleted" | "opponentsDefeated" | "opponentsLost";
|
|
40
|
+
/** One condition met, by which team, and when. */
|
|
41
|
+
export interface CompetitiveTrigger {
|
|
42
|
+
readonly teamId: TeamId;
|
|
43
|
+
readonly condition: CompetitiveCondition;
|
|
44
|
+
readonly round: number;
|
|
45
|
+
/** The phase it was met in, and whose phase that was. */
|
|
46
|
+
readonly phase: "player" | "villain";
|
|
47
|
+
readonly activeTeamId: TeamId | null;
|
|
48
|
+
/** The card behind it when there is one: the defeated leader, the completed scheme, the card whose text lost. */
|
|
49
|
+
readonly instanceId?: InstanceId;
|
|
50
|
+
}
|
|
51
|
+
/** The phase the game closes after: the last team's phase of `phase` in `round` (MC56 p. 17; Q7). */
|
|
52
|
+
export interface CompetitiveClose {
|
|
53
|
+
readonly teamId: TeamId;
|
|
54
|
+
readonly round: number;
|
|
55
|
+
readonly phase: "player" | "villain";
|
|
56
|
+
}
|
|
57
|
+
/** `GameState.competitive`. */
|
|
58
|
+
export interface CompetitiveState {
|
|
59
|
+
/** MC56 p. 17's tie-breaks are applied to a tie (Q9 C per owner decision 2026-11-20; the lobby option, default on). */
|
|
60
|
+
readonly tieBreaks: boolean;
|
|
61
|
+
/** Present once a team has won or lost: every condition met so far, in order, and when the game closes. */
|
|
62
|
+
readonly end?: {
|
|
63
|
+
readonly triggers: readonly CompetitiveTrigger[];
|
|
64
|
+
readonly closesAfter: CompetitiveClose;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** MC56 p. 17's tie-breaks, in printed order. */
|
|
68
|
+
export type TieBreakMeasure =
|
|
69
|
+
/** 1) "the team whose enemy main scheme deck did not advance past 1B": 1 if the scheme in its area advanced, else 0. */
|
|
70
|
+
"mainSchemeAdvanced"
|
|
71
|
+
/** 2) "the fewest minions and side schemes in your game area". */
|
|
72
|
+
| "minionsAndSideSchemes"
|
|
73
|
+
/** 3) "the least threat on your main scheme". */
|
|
74
|
+
| "mainSchemeThreat"
|
|
75
|
+
/** 4) "the most remaining hit points on your identities". */
|
|
76
|
+
| "identityHitPoints"
|
|
77
|
+
/** 5) "the fewest attachments on the leader in your area". */
|
|
78
|
+
| "leaderAttachments";
|
|
79
|
+
export declare const TIE_BREAK_ORDER: readonly TieBreakMeasure[];
|
|
80
|
+
/** What the tie-breaks read and which one decided, for the game-over screen. */
|
|
81
|
+
export interface TieBreakReport {
|
|
82
|
+
/** Each measure read, in order, until one separated the teams (all five when none did). */
|
|
83
|
+
readonly measures: readonly {
|
|
84
|
+
readonly measure: TieBreakMeasure;
|
|
85
|
+
readonly values: Readonly<Record<string, number>>;
|
|
86
|
+
}[];
|
|
87
|
+
/** The measure that decided, or null when the teams were still tied after all five. */
|
|
88
|
+
readonly decidedBy: TieBreakMeasure | null;
|
|
89
|
+
}
|
|
90
|
+
export interface CompetitiveTeamResult {
|
|
91
|
+
readonly teamId: TeamId;
|
|
92
|
+
readonly side: TeamSide | null;
|
|
93
|
+
readonly result: "win" | "loss" | "tie";
|
|
94
|
+
/** The win conditions this team met before the game closed (MC56 p. 17), in the order met. */
|
|
95
|
+
readonly conditions: readonly CompetitiveCondition[];
|
|
96
|
+
}
|
|
97
|
+
/** `GameOutcome` for a competitive game (MC56 p. 17). */
|
|
98
|
+
export interface CompetitiveOutcome {
|
|
99
|
+
readonly result: "teams";
|
|
100
|
+
/** `teamConceded`: a team forfeited (N12 A, `competitiveConcession`); `competitiveEnded`: every other end. */
|
|
101
|
+
readonly reason: "competitiveEnded" | "teamConceded";
|
|
102
|
+
/** With `teamConceded`: the seat whose concession it was. */
|
|
103
|
+
readonly concededBy?: PlayerId;
|
|
104
|
+
readonly decision: "win" | "tie" | "bothLose";
|
|
105
|
+
readonly teams: readonly CompetitiveTeamResult[];
|
|
106
|
+
/** Present when the teams were tied on win conditions: the tie-break the table chose (Q9 C), or `applied: false`. */
|
|
107
|
+
readonly tieBreak?: {
|
|
108
|
+
readonly applied: boolean;
|
|
109
|
+
} & Partial<TieBreakReport>;
|
|
110
|
+
}
|
|
111
|
+
/** Whether this game's end is decided by teams (a game with stored teams: competitive mode). */
|
|
112
|
+
export declare const hasTeamOutcome: (state: GameState) => boolean;
|
|
113
|
+
/** Where a result comes from, to name the team it belongs to. */
|
|
114
|
+
export interface ResultSide {
|
|
115
|
+
readonly instanceId?: InstanceId | null;
|
|
116
|
+
readonly deckId?: EncounterDeckId | null;
|
|
117
|
+
readonly playerId?: PlayerId | null;
|
|
118
|
+
}
|
|
119
|
+
/** The team whose side of the table `side` is on, or null. */
|
|
120
|
+
export declare function teamOfSide(state: GameState, side: ResultSide): TeamState | null;
|
|
121
|
+
/**
|
|
122
|
+
* The kind of phase being played now. During a phase's end (its "when/after the phase ends" effects) the step is
|
|
123
|
+
* already the `teamHandover` naming the next phase, so the phase still ending is read from it instead: a handover to
|
|
124
|
+
* the next team's hero phase, or to the first team's villain phase (after the last team's hero phase), ends a hero
|
|
125
|
+
* phase; a handover to a later team's villain phase ends a villain phase (MC56 p. 16; Q3 B).
|
|
126
|
+
*/
|
|
127
|
+
export declare function phaseBeingPlayed(state: GameState): "player" | "villain";
|
|
128
|
+
/**
|
|
129
|
+
* Records that `teamId` met `condition` (MC56 p. 17). The first result opens the window: the game then closes after
|
|
130
|
+
* the last team's phase of the kind being played (`closesAfter`). A condition a team has already met is not recorded
|
|
131
|
+
* again (a completed scheme stays completed). Logged `teamResultRecorded`.
|
|
132
|
+
*/
|
|
133
|
+
export declare function recordTeamCondition(ctx: Ctx, teamId: TeamId, condition: CompetitiveCondition, instanceId?: InstanceId): void;
|
|
134
|
+
/** Records a loss of `teamId` as the other team's win condition. */
|
|
135
|
+
export declare function recordTeamLoss(ctx: Ctx, teamId: TeamId, condition: Exclude<CompetitiveCondition, "enemyLeaderDefeated">, instanceId?: InstanceId): void;
|
|
136
|
+
/** Whether every seat of a team is eliminated. */
|
|
137
|
+
export declare const teamEliminated: (state: GameState, team: TeamState) => boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the game closes now, after a phase of `ended.teamId` of kind `ended.phase` in `ended.round` has ended, or at
|
|
140
|
+
* once when no seat is left to play a phase. MC56 p. 17: "The game does not end until both sides have played an equal
|
|
141
|
+
* number of phases."
|
|
142
|
+
*/
|
|
143
|
+
export declare function competitiveCloseDue(state: GameState, ended: {
|
|
144
|
+
readonly teamId: TeamId;
|
|
145
|
+
readonly phase: "player" | "villain";
|
|
146
|
+
readonly round: number;
|
|
147
|
+
} | null): boolean;
|
|
148
|
+
/** The decision from the triggers met (MC56 p. 17; N4). */
|
|
149
|
+
export declare function competitiveOutcome(state: GameState, deps?: Parameters<typeof maxHitPoints>[2]): CompetitiveOutcome;
|
|
150
|
+
/**
|
|
151
|
+
* A team's forfeit (N12 A per owner decision 2026-11-20; MC56 p. 17 has no concession, so this is the engine's): the
|
|
152
|
+
* game ends at once, the conceding team loses and the other wins, with no equal phases and no tie-breaks. The
|
|
153
|
+
* conditions each team met before it are kept for the record.
|
|
154
|
+
*/
|
|
155
|
+
export declare function competitiveConcession(state: GameState, teamId: TeamId, byPlayerId: PlayerId): CompetitiveOutcome;
|
|
156
|
+
/** One tie-break measure for a team, read on its own side of the table (MC56 p. 17). */
|
|
157
|
+
export declare function tieBreakValue(state: GameState, team: TeamState, measure: TieBreakMeasure, deps?: Parameters<typeof maxHitPoints>[2]): number;
|
|
158
|
+
/** MC56 p. 17's tie-breaks in printed order, until one separates the two teams. */
|
|
159
|
+
export declare function tieBreakReport(state: GameState, deps?: Parameters<typeof maxHitPoints>[2]): TieBreakReport;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup of a game with two teams: Civil War's competitive mode (docs/competitive-mode-plan.md §1.2, milestone M1).
|
|
3
|
+
*
|
|
4
|
+
* MC56 p. 14 (scenario rules override RRG per Golden Rule, RRG p. 4): each team builds the scenario the other team
|
|
5
|
+
* will face (a leader of its own side, its main scheme deck, its encounter deck with the Standard PvP set in place of
|
|
6
|
+
* the Standard set), the teams trade, "Then the normal setup rules apply". So a competitive `GameSetupConfig` carries
|
|
7
|
+
* the two traded scenarios on `competitive.teams`, each on the team that **faces** it, and `createGame` builds the game
|
|
8
|
+
* the same way it builds one with several villains (`GameSetupConfig.villains`): one leader with its own encounter
|
|
9
|
+
* deck per team, the first team's main scheme as `GameState.mainScheme` and the second's beside it, then a game area per
|
|
10
|
+
* team (`GameAreaState`) holding its players and the leader it faces, and the teams (`GameState.teams`).
|
|
11
|
+
*
|
|
12
|
+
* Owner decisions of 2026-11-20: each area sets up on its own, registration's first wherever one order is needed (Q4
|
|
13
|
+
* A); each identity's obligation goes into the encounter deck of its player's own game area (Q16 A, MC56 FAQ p. 20);
|
|
14
|
+
* teams of 1 or 2 players, the same number on each (Q14, MC56 p. 14: "1v1 or 2v2").
|
|
15
|
+
*/
|
|
16
|
+
import type { CardId } from "../../content/src/index.js";
|
|
17
|
+
import type { GameSetupConfig, VillainSetup } from "./setup.js";
|
|
18
|
+
import type { TeamSide } from "./team.js";
|
|
19
|
+
/** One scenario of a competitive game, as the team that built it handed it over (MC56 pp. 4-5, 14). */
|
|
20
|
+
export interface CompetitiveScenarioSetup {
|
|
21
|
+
/**
|
|
22
|
+
* The leader and its encounter deck: the leader's set, the modular sets of its side and the Standard PvP set in
|
|
23
|
+
* place of the Standard set (MC56 pp. 3, 14), plus the Expert set in expert mode. Each team's identities'
|
|
24
|
+
* obligations are added by setup (Q16 A), not listed here.
|
|
25
|
+
*/
|
|
26
|
+
readonly villain: VillainSetup;
|
|
27
|
+
/** The main scheme deck: one stage 1 and one stage 2 of the leader's side (MC56 p. 5), as for a cooperative game. */
|
|
28
|
+
readonly mainSchemeCardId: CardId;
|
|
29
|
+
readonly mainSchemeStageIndexes?: readonly number[];
|
|
30
|
+
}
|
|
31
|
+
/** One team of a competitive game (MC56 p. 14). */
|
|
32
|
+
export interface CompetitiveTeamSetup {
|
|
33
|
+
readonly side: TeamSide;
|
|
34
|
+
/**
|
|
35
|
+
* How many seats the team has: the first team's are the first `playerCount` entries of `GameSetupConfig.players`,
|
|
36
|
+
* the second team's the rest. 1 or 2 (Q14).
|
|
37
|
+
*/
|
|
38
|
+
readonly playerCount: number;
|
|
39
|
+
/** The scenario this team faces, which the **other** team built (MC56 p. 14: "the teams trade scenarios"). */
|
|
40
|
+
readonly faces: CompetitiveScenarioSetup;
|
|
41
|
+
/**
|
|
42
|
+
* This team's own leader's four basic player cards (MC56 p. 14: "Each team finds the four basic player cards for
|
|
43
|
+
* their chosen leader and sets them aside"), created set aside, never in a deck (p. 16: earned by defeating Choosing
|
|
44
|
+
* Sides). Absent or empty: none.
|
|
45
|
+
*/
|
|
46
|
+
readonly leaderPlayerCardIds?: readonly CardId[];
|
|
47
|
+
/** Which of the team's seats holds its first player token at the start, 0 for its first seat. Default 0. */
|
|
48
|
+
readonly firstPlayerIndex?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The two teams, the registration team first: it "always goes first each round" (MC56 p. 16), and its game area sets
|
|
52
|
+
* up first (Q4 A). Its team id is `t1`, the other's `t2`; their game areas `a1` and `a2`.
|
|
53
|
+
*/
|
|
54
|
+
export interface CompetitiveSetup {
|
|
55
|
+
readonly teams: readonly [CompetitiveTeamSetup, CompetitiveTeamSetup];
|
|
56
|
+
/**
|
|
57
|
+
* Apply MC56 p. 17's tie-breaks to a tie, in printed order, and report the deciding one (Q9 C per owner decision
|
|
58
|
+
* 2026-11-20: a lobby option, on by default). `false`: a tie is reported as a tie. Default true.
|
|
59
|
+
*/
|
|
60
|
+
readonly tieBreaks?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Why a competitive config is malformed, or null. Read before any card is created. */
|
|
63
|
+
export declare function competitiveSetupFault(config: GameSetupConfig): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* The config `createGame` builds a competitive game from: the two leaders as `villains` in team order, the first
|
|
66
|
+
* team's main scheme as the game's. The second team's main scheme, the teams and their areas are made from
|
|
67
|
+
* `competitive` itself.
|
|
68
|
+
*/
|
|
69
|
+
export declare function competitiveAsVillainsConfig(config: GameSetupConfig): GameSetupConfig;
|
|
70
|
+
/** The index of the team (0 or 1) that seat `seatIndex` is on. */
|
|
71
|
+
export declare function teamIndexOfSeat(competitive: CompetitiveSetup, seatIndex: number): number;
|
|
72
|
+
/** The seat index of team `teamIndex`'s first player. */
|
|
73
|
+
export declare function teamFirstSeat(competitive: CompetitiveSetup, teamIndex: number): number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CardId, VillainSideLetter } from "../../content/src/index.js";
|
|
2
2
|
import type { EngineDeps } from "./abilities.js";
|
|
3
|
-
import type { EncounterDeckId, FrameId, InstanceId, PlayerId } from "./ids.js";
|
|
3
|
+
import type { EncounterDeckId, FrameId, InstanceId, PlayerId, TeamId } from "./ids.js";
|
|
4
|
+
import { type ResultSide } from "./competitive-outcome.js";
|
|
4
5
|
import { type Ctx } from "./ctx.js";
|
|
5
6
|
import type { GameEvent, StatusDiscardCause } from "./events.js";
|
|
6
7
|
import { type EncounterDealSource, type HostStep, type LeaveCauseSide, type LeavePatch, type LeaveRequest, type TriggerEvent, type TuckHostKind } from "./trigger-events.js";
|
|
@@ -34,7 +35,22 @@ export declare function changeIdentityForm(ctx: Ctx, playerId: PlayerId, to: "he
|
|
|
34
35
|
* and the old version sits set aside in the new one's place. Returns false when there is no next version set aside.
|
|
35
36
|
*/
|
|
36
37
|
export declare function swapIdentity(ctx: Ctx, playerId: PlayerId): boolean;
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Ends the game with `outcome`. In a competitive game (stored teams) a win or loss belongs to one team (`side` names
|
|
40
|
+
* where it comes from: the defeated leader, the completed scheme, the eliminated player, the card whose text lost, the
|
|
41
|
+
* exhausted deck): it is recorded for that team instead, and the game goes on until both sides have played an equal
|
|
42
|
+
* number of phases (MC56 p. 17; `competitive-outcome.ts`), unless no seat is left to play one.
|
|
43
|
+
*/
|
|
44
|
+
export declare function endGame(ctx: Ctx, outcome: GameOutcome, side?: ResultSide): void;
|
|
45
|
+
/**
|
|
46
|
+
* Ends a competitive game whose window has closed: after the phase `ended` (the last team's phase the first result
|
|
47
|
+
* named), or at once when every seat is eliminated (MC56 p. 17). Returns whether it ended.
|
|
48
|
+
*/
|
|
49
|
+
export declare function closeCompetitiveIfDue(ctx: Ctx, ended: {
|
|
50
|
+
readonly teamId: TeamId;
|
|
51
|
+
readonly phase: "player" | "villain";
|
|
52
|
+
readonly round: number;
|
|
53
|
+
} | null): boolean;
|
|
38
54
|
/**
|
|
39
55
|
* The rest of RRG 1.8 "Player Elimination" (p. 34) step 5 for a hand `eliminatePlayer` left cards in (an ability still
|
|
40
56
|
* resolving had chosen them; #816): each card still in an eliminated player's hand goes to their discard pile, as the
|
|
@@ -705,20 +721,30 @@ export declare function applyLeavePatch(ctx: Ctx, id: InstanceId, patch: LeavePa
|
|
|
705
721
|
export declare function leavePlayAtOnce(ctx: Ctx, id: InstanceId, requested: ZoneId, position?: "top" | "bottom", discarded?: boolean, withHost?: boolean): void;
|
|
706
722
|
/** The id of the lasting effect created at `GameState.nextLastingSeq` = `seq`. */
|
|
707
723
|
export declare const lastingEffectIdOf: (seq: number) => string;
|
|
708
|
-
export declare function addLastingEffect(ctx: Ctx, body: LastingEffectBody, duration: LastingDuration, whileAttached?: AttachmentBound): LastingEffect;
|
|
724
|
+
export declare function addLastingEffect(ctx: Ctx, body: LastingEffectBody, duration: LastingDuration, whileAttached?: AttachmentBound, creator?: LastingCreator): LastingEffect;
|
|
709
725
|
export declare function endLastingEffect(ctx: Ctx, id: string, reason: "expired" | "consumed" | "sourceLeftPlay" | "fired" | "detached" | "targetLeftPlay"): void;
|
|
710
726
|
/** Removes every lasting effect whose duration ends at this boundary (delayed effects are fired by the caller). */
|
|
711
727
|
export declare function expireLastingEffects(ctx: Ctx, boundary: "endOfPhase" | "endOfRound" | "endOfTurn" | "endOfPlayerPhase"): void;
|
|
712
|
-
/** The
|
|
728
|
+
/** The ability that made a lasting effect: its controller and its card (`EffectContext`). */
|
|
729
|
+
export interface LastingCreator {
|
|
730
|
+
readonly controllerId: PlayerId | null;
|
|
731
|
+
readonly selfInstanceId: InstanceId | null;
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* The lasting effects that end when the villain phase next begins (`LastingDuration nextVillainPhaseBegins`). With two
|
|
735
|
+
* teams, those of the team whose villain phase it is (`teamId`): a team's skipped phase never begins, so the effect
|
|
736
|
+
* lasts to its own next unskipped one (61020 "(unskipped)"; RRG 1.8 "Lasting Effects", p. 26; MC56 pp. 16, 20 + N8).
|
|
737
|
+
*/
|
|
713
738
|
export declare const untilNextVillainPhase: (state: GameState) => readonly LastingEffect[];
|
|
714
739
|
/**
|
|
715
740
|
* "Until the next villain phase begins" (docs/phase7-wave8.md §3.13): the villain phase is beginning, so every lasting
|
|
716
741
|
* effect waiting on that ends. Reached twice by design, and the second finds nothing unless something was made in
|
|
717
742
|
* between: once beneath the player phase's end (`finishPlayerPhase`, the `villainPhaseBegins` step), so the effect is
|
|
718
743
|
* gone before anything answers the phase beginning; and as step one starts (`executePlaceThreat`), for an effect made
|
|
719
|
-
* while the player phase's end was still resolving.
|
|
744
|
+
* while the player phase's end was still resolving. `keep` are the ids that call leaves: effects made once the phase
|
|
745
|
+
* had begun (by its beginning), which last to the next villain phase (`GameState.madeSinceVillainPhaseBegan`).
|
|
720
746
|
*/
|
|
721
|
-
export declare function expireNextVillainPhaseEffects(ctx: Ctx): void;
|
|
747
|
+
export declare function expireNextVillainPhaseEffects(ctx: Ctx, keep?: readonly string[]): void;
|
|
722
748
|
/**
|
|
723
749
|
* `characterId` is using basic power `power`, whose event frames are `frameIds` (`resolve`s last-to-first, so the last
|
|
724
750
|
* is the one that finishes last): every lasting effect waiting on that character's next basic power of that kind
|
|
@@ -31,12 +31,28 @@ export type EngineErrorCode = "invalid_setup"
|
|
|
31
31
|
* (docs/phase7-wave10.md §1.9). Raised by `createGame` before anything else is judged, so the message never depends
|
|
32
32
|
* on what else is wrong. `message` is written to be shown verbatim.
|
|
33
33
|
*/
|
|
34
|
-
| "mode_unavailable" | "game_over" | "choice_pending" | "no_choice_pending" | "invalid_choice" | "wrong_phase" | "not_active_player"
|
|
34
|
+
| "mode_unavailable" | "game_over" | "choice_pending" | "no_choice_pending" | "invalid_choice" | "wrong_phase" | "not_active_player"
|
|
35
|
+
/**
|
|
36
|
+
* A player of the inactive team tried to act during the other team's phase (MC56 p. 16: "During the other team's
|
|
37
|
+
* phases, your side of the table is inactive"; Q11 A per owner decision 2026-11-20). Only a game with two teams
|
|
38
|
+
* raises it; that team still answers the choices addressed to it (`resolveChoice`). `message` is shown verbatim.
|
|
39
|
+
*/
|
|
40
|
+
| "inactive_team" | "unknown_player" | "unknown_instance" | "unknown_card" | "card_not_in_zone" | "wrong_form" | "already_changed_form" | "already_exhausted" | "no_valid_target" | "insufficient_resources" | "card_type_not_playable" | "unknown_ability" | "limit_reached"
|
|
35
41
|
/**
|
|
36
42
|
* `endTurn` while the ending player has a "Forced Action" they could trigger (RRG 1.8 "Action", p. 6: it "must be
|
|
37
43
|
* resolved before the player phase can end"; docs/phase7-wave9.md §3.53). `EngineError.forcedActions` names them.
|
|
38
44
|
*/
|
|
39
|
-
| "forced_action_outstanding"
|
|
45
|
+
| "forced_action_outstanding"
|
|
46
|
+
/** `externalEvent` or `remotePower` in a game whose pod has no remote coordinator (docs/phase7-wave9.md §3.68). */
|
|
47
|
+
| "no_remote_coordinator"
|
|
48
|
+
/** `externalEvent` whose `sequence` is not the next one: a re-send already applied, or a gap the host must fill. */
|
|
49
|
+
| "external_event_out_of_order"
|
|
50
|
+
/** `externalEvent` whose `sequence` was applied already: a re-send, which a host drops. */
|
|
51
|
+
| "external_event_already_applied"
|
|
52
|
+
/** An action while this group has stopped play after the shared scheme's completion (MC55 p. 21; `PodState.halted`). */
|
|
53
|
+
| "pod_halted"
|
|
54
|
+
/** An action while this group waits for the coordinator to answer its shared event (`PodState.awaiting`). */
|
|
55
|
+
| "pod_waiting" | "internal_error";
|
|
40
56
|
export interface EngineError {
|
|
41
57
|
readonly code: EngineErrorCode;
|
|
42
58
|
readonly message: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sides of a split table an event happened on (`TriggerEvent.sides`), read by `heardOnThisSide`
|
|
3
|
+
* (`resolve/triggers.ts`): in a two-team game, "card abilities on your side of the table completely ignore cards on the
|
|
4
|
+
* other side" (MC56 pp. 16-17); in The Once and Future Kang's separate game areas, "cards and components in one game
|
|
5
|
+
* area cannot affect another game area" (Kang insert, docs/phase7-wave2.md §3.1).
|
|
6
|
+
*
|
|
7
|
+
* An event's sides are the game areas of the cards and players it names (`eventSubjects`), plus the area of the
|
|
8
|
+
* encounter deck an encounter `deckRanOut` names. A card in every area (an environment, Kang's stage 2B, an encounter
|
|
9
|
+
* card in a shared deck, a set-aside card: `areaOfCard` null) puts the event on no side. Read when the event is made
|
|
10
|
+
* and stamped on it, so a card that moves afterwards (a defeated minion going to the discard pile of the area it came
|
|
11
|
+
* from) does not move the event with it.
|
|
12
|
+
*/
|
|
13
|
+
import type { GameAreaId, InstanceId, PlayerId } from "./ids.js";
|
|
14
|
+
import type { GameState } from "./state.js";
|
|
15
|
+
import { type TriggerEvent } from "./trigger-events.js";
|
|
16
|
+
/** The distinct game areas of these cards and players, in the order first named. Empty with no split table. */
|
|
17
|
+
export declare function sidesOf(state: GameState, cards: readonly InstanceId[], players: readonly PlayerId[]): readonly GameAreaId[];
|
|
18
|
+
/** The sides `event` is on now: its stamp when it has one, else read from where what it names is now. */
|
|
19
|
+
export declare function eventSides(state: GameState, event: TriggerEvent): readonly GameAreaId[];
|
|
20
|
+
/** `event` with its sides stamped (`TriggerEvent.sides`), on a split table only; the event itself otherwise. */
|
|
21
|
+
export declare function withSides<E extends TriggerEvent>(state: GameState, event: E): E;
|