open-optcg 0.2.1-next.39 → 0.2.1-next.40
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/dist/engine.js +1 -1
- package/dist/types/internal/decks/src/index.d.ts +3 -1
- package/dist/types/internal/engine-core/src/effects.d.ts +1 -1
- package/dist/types/internal/engine-core/src/engine.d.ts +2 -1
- package/dist/types/internal/engine-core/src/mechanic-dsl.d.ts +1 -0
- package/dist/types/internal/engine-core/src/model.d.ts +5 -0
- package/dist/types/internal/engine-core/src/recorded-shuffle.d.ts +18 -0
- package/dist/types/internal/engine-core/src/service.d.ts +2 -1
- package/dist/types/internal/engine-core/src/turn.d.ts +1 -0
- package/dist/types/internal/protocol/src/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DeckFormat } from "../../cards/src/index.js";
|
|
2
|
-
import type { ResolvedDeck } from "../../protocol/src/index.js";
|
|
2
|
+
import type { RecordedShuffles, ResolvedDeck } from "../../protocol/src/index.js";
|
|
3
3
|
export type { DeckFormat } from "../../cards/src/index.js";
|
|
4
4
|
export { copyLimit, isEventRestricted, validateDeck, type DeckValidation, type EditableDeck, } from "./legality.js";
|
|
5
5
|
export { exportDeckList, parseDeckList } from "./decklist.js";
|
|
@@ -58,8 +58,10 @@ export declare function resolveMatchDecks(config: {
|
|
|
58
58
|
p2Deck: string;
|
|
59
59
|
p1CustomDeck?: DeckManifest;
|
|
60
60
|
p2CustomDeck?: DeckManifest;
|
|
61
|
+
recordedShuffles?: RecordedShuffles;
|
|
61
62
|
}): {
|
|
62
63
|
p1: ResolvedDeck;
|
|
63
64
|
p2: ResolvedDeck;
|
|
65
|
+
recordedShuffles?: RecordedShuffles;
|
|
64
66
|
};
|
|
65
67
|
export declare function loadPreviewDeck(deckId: FormatDeckId): string[];
|
|
@@ -34,7 +34,7 @@ export declare function createOnEndOfYourTurnResult(state: GameState, playerId:
|
|
|
34
34
|
export declare function runEndOfTurnProgram(state: GameState, playerId: PlayerId, source: CardInstance, mechanicProgram: MechanicProgram, db?: CardDatabase, bindings?: Record<string, string[]>): OnPlayResult;
|
|
35
35
|
export declare function createOnStartOfYourTurnResult(state: GameState, playerId: PlayerId, source: CardInstance, db?: CardDatabase): OnPlayResult;
|
|
36
36
|
export declare function createTriggerResult(state: GameState, playerId: PlayerId, source: CardInstance, db?: CardDatabase, reactions?: readonly MechanicInvocation[], held?: readonly MechanicInvocation[]): OnPlayResult;
|
|
37
|
-
export declare function restEffect(state: GameState, playerId: PlayerId, source: CardInstance, maxCost: number, remaining?: number, afterRest?: "give-three-don-to-leader" | "schedule-active-don"): PendingEffect | null;
|
|
37
|
+
export declare function restEffect(state: GameState, playerId: PlayerId, source: CardInstance, maxCost: number, remaining?: number, afterRest?: "give-three-don-to-leader" | "schedule-active-don", costRead?: "current" | "base"): PendingEffect | null;
|
|
38
38
|
export declare function triggerPerona(state: GameState, playerId: PlayerId): PublicEvent[];
|
|
39
39
|
export declare function applyAfterRest(state: GameState, playerId: PlayerId, afterRest: "give-three-don-to-leader" | "schedule-active-don" | undefined): PublicEvent[];
|
|
40
40
|
export declare function queuePendingContinuations(state: GameState, invocations: readonly MechanicInvocation[]): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CardDatabase } from "../../cards/src/index.js";
|
|
2
|
-
import { type GameObservation, type LegalAction, type PlayerId, type ResolvedDeck, type TimeLimit } from "../../protocol/src/index.js";
|
|
2
|
+
import { type GameObservation, type LegalAction, type PlayerId, type ResolvedDeck, type RecordedShuffles, type TimeLimit } from "../../protocol/src/index.js";
|
|
3
3
|
import type { GameAction, GameState, TransitionResult } from "./model.js";
|
|
4
4
|
export interface Callback<T> {
|
|
5
5
|
handle(event: T): void;
|
|
@@ -22,6 +22,7 @@ export declare function createGame(input: {
|
|
|
22
22
|
startingPlayer?: PlayerId | "random";
|
|
23
23
|
cards?: CardDatabase;
|
|
24
24
|
timeLimit?: TimeLimit;
|
|
25
|
+
recordedShuffles?: RecordedShuffles;
|
|
25
26
|
}): GameState;
|
|
26
27
|
export declare function getLegalActions(state: GameState, playerId: PlayerId, db?: CardDatabase): LegalAction[];
|
|
27
28
|
export declare function canActivate(state: GameState, playerId: PlayerId, sourceInstanceId: string): boolean;
|
|
@@ -428,6 +428,7 @@ export type PendingEffect = {
|
|
|
428
428
|
revealed: CardInstance[];
|
|
429
429
|
eligibleInstanceIds: string[];
|
|
430
430
|
remaining: number;
|
|
431
|
+
drawAfter?: number;
|
|
431
432
|
} | {
|
|
432
433
|
kind: "reduce-power";
|
|
433
434
|
playerId: PlayerId;
|
|
@@ -630,6 +631,10 @@ export interface GameState {
|
|
|
630
631
|
lifeDrawnLast?: PlayerId;
|
|
631
632
|
decidedBy?: TimeLimitProcedure;
|
|
632
633
|
};
|
|
634
|
+
recordedShuffles?: {
|
|
635
|
+
orders: Record<PlayerId, string[][]>;
|
|
636
|
+
dealt: Record<PlayerId, string[][]>;
|
|
637
|
+
};
|
|
633
638
|
pendingEffect: PendingEffect | null;
|
|
634
639
|
pendingContinuations?: MechanicInvocation[];
|
|
635
640
|
pendingDamageReactions?: MechanicInvocation[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PlayerId, RecordedShuffles } from "../../protocol/src/index.js";
|
|
2
|
+
import type { GameState } from "./model.js";
|
|
3
|
+
import { type RngState } from "./rng.js";
|
|
4
|
+
interface Shuffled<T> {
|
|
5
|
+
items: T[];
|
|
6
|
+
state: RngState;
|
|
7
|
+
}
|
|
8
|
+
export declare function shuffleRecorded<T extends {
|
|
9
|
+
cardNumber: string;
|
|
10
|
+
}>(cards: readonly T[], rng: RngState, recorded: readonly string[] | undefined): Shuffled<T>;
|
|
11
|
+
export declare function initialRecordedShuffles(recorded: RecordedShuffles | undefined, opening: Record<PlayerId, readonly {
|
|
12
|
+
instanceId: string;
|
|
13
|
+
}[]>): GameState["recordedShuffles"];
|
|
14
|
+
export declare function shuffleCards<T extends {
|
|
15
|
+
instanceId: string;
|
|
16
|
+
cardNumber: string;
|
|
17
|
+
}>(state: GameState, playerId: PlayerId, cards: readonly T[]): T[];
|
|
18
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlayerId, ResolvedDeck, TimeLimit } from "../../protocol/src/index.js";
|
|
1
|
+
import type { PlayerId, RecordedShuffles, ResolvedDeck, TimeLimit } from "../../protocol/src/index.js";
|
|
2
2
|
import { type Callback, type GameTransitionEvent } from "./engine.js";
|
|
3
3
|
import type { GameState } from "./model.js";
|
|
4
4
|
import { type RulesStamp } from "./provenance.js";
|
|
@@ -19,6 +19,7 @@ export declare class GameService {
|
|
|
19
19
|
seedMode?: "seat" | "matchup";
|
|
20
20
|
startingPlayer?: PlayerId | "random";
|
|
21
21
|
timeLimit?: TimeLimit;
|
|
22
|
+
recordedShuffles?: RecordedShuffles;
|
|
22
23
|
}): import("../../protocol/src/index.js").GameObservation;
|
|
23
24
|
observe(gameId: string, playerId: PlayerId): import("../../protocol/src/index.js").GameObservation;
|
|
24
25
|
simulate(gameId: string, playerId: PlayerId, actionId: string): import("../../protocol/src/index.js").GameObservation | undefined;
|
|
@@ -5,5 +5,6 @@ export declare function activateRestedDonForRefresh(player: PlayerState): void;
|
|
|
5
5
|
export declare function drawForTurn(state: GameState, playerId: PlayerId, db?: CardDatabase): PublicEvent[];
|
|
6
6
|
export declare function completeEndTurn(state: GameState, events: PublicEvent[]): void;
|
|
7
7
|
export declare function resumeStartOfTurn(state: GameState, events: PublicEvent[]): void;
|
|
8
|
+
export declare function kidLeaderEndOfTurnKey(state: GameState, playerId: PlayerId): string;
|
|
8
9
|
export declare function endTurn(state: GameState, events: PublicEvent[], db?: CardDatabase): void;
|
|
9
10
|
export declare function offerDonReturnChoice(state: GameState): void;
|