open-optcg 0.1.1-next.1 → 0.2.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/INTEGRATING.md +245 -0
- package/README.md +3 -0
- package/dist/cards.js +1 -1
- package/dist/chunks/{chunk-4I54H2QI.js → chunk-CRP6FDKG.js} +1 -1
- package/dist/decks.js +1 -1
- package/dist/engine.js +1 -1
- package/dist/types/cards.d.ts +1 -1
- package/dist/types/engine.d.ts +1 -1
- package/dist/types/internal/cards/src/index.d.ts +1 -0
- package/dist/types/internal/engine-core/src/errors.d.ts +2 -2
- package/dist/types/internal/engine-core/src/index.d.ts +1 -1
- package/dist/types/internal/engine-core/src/service.d.ts +11 -0
- package/package.json +3 -2
package/dist/types/cards.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cardFormatLegality, cardRegistry,
|
|
1
|
+
export { cardFormatLegality, cardRegistry, isStandardLegal, loadPrintedText, parsePrintedTextPack, printedText, registerCards, requireKnownCard, type CardDatabase, type CardDefinition, type CardRecord, } from "./internal/cards/src/index.js";
|
package/dist/types/engine.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { applyAction, createGame, describeStampMismatch, donCountReaders, EngineError, GameService, getLegalActions, hashState, observe, replayActions, RULES_VERSION, rulesStamp, type DonCountReaders, type GameState, type GameTransitionEvent, type ReplayCheckpoint, type ReplayFixture, type RulesStamp, } from "./internal/engine-core/src/index.js";
|
|
1
|
+
export { applyAction, createGame, describeStampMismatch, donCountReaders, EngineError, GameService, getLegalActions, hashState, observe, replayActions, RULES_VERSION, rulesStamp, type DonCountReaders, type GameState, type GameTransitionEvent, type ReplayCheckpoint, type ReplayFixture, type RulesStamp, type SavedGame, } from "./internal/engine-core/src/index.js";
|
|
@@ -41,6 +41,7 @@ export interface CardDatabase {
|
|
|
41
41
|
}
|
|
42
42
|
export declare function createCardDatabase(sets: readonly (readonly CardRecord[])[]): CardDatabase;
|
|
43
43
|
export declare const cards: CardDatabase;
|
|
44
|
+
export declare function registerCards(records: readonly CardRecord[]): void;
|
|
44
45
|
export declare function printedText(cardNumber: string): PrintedText | undefined;
|
|
45
46
|
export declare function clauseText(cardNumber: string, marker: ClauseMarker): string | undefined;
|
|
46
47
|
export declare function counterClauseParts(cardNumber: string): ClauseParts | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class EngineError extends Error {
|
|
2
|
-
readonly code: "STALE_ACTION" | "ILLEGAL_ACTION" | "GAME_FINISHED";
|
|
3
|
-
constructor(code: "STALE_ACTION" | "ILLEGAL_ACTION" | "GAME_FINISHED", message: string);
|
|
2
|
+
readonly code: "STALE_ACTION" | "ILLEGAL_ACTION" | "GAME_FINISHED" | "INCOMPATIBLE_SAVE";
|
|
3
|
+
constructor(code: "STALE_ACTION" | "ILLEGAL_ACTION" | "GAME_FINISHED" | "INCOMPATIBLE_SAVE", message: string);
|
|
4
4
|
}
|
|
@@ -3,7 +3,7 @@ export { applyAction, applyOfferedAction, createGame, getLegalActions, observe,
|
|
|
3
3
|
export { canAttack, counterEventPower, couldAttackThisTurn, hasKeyword, } from "./board.js";
|
|
4
4
|
export type { ResolvedDeck } from "../../protocol/src/index.js";
|
|
5
5
|
export type { ActiveAttack, BoardCard, CardInstance, GameState, RngState, } from "./model.js";
|
|
6
|
-
export { GameService } from "./service.js";
|
|
6
|
+
export { GameService, type SavedGame } from "./service.js";
|
|
7
7
|
export { battleAttackPower, currentPower, donPowerApplies, effectiveCost, recordDeckTopKnowledge, searchRevealIsPublic, } from "./queries.js";
|
|
8
8
|
export { fieldDonCount, returnDonToDeck } from "./don.js";
|
|
9
9
|
export { playCostFromHand } from "./hand-price.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { PlayerId, ResolvedDeck, TimeLimit } from "../../protocol/src/index.js";
|
|
2
2
|
import { type Callback, type GameTransitionEvent } from "./engine.js";
|
|
3
|
+
import type { GameState } from "./model.js";
|
|
4
|
+
import { type RulesStamp } from "./provenance.js";
|
|
3
5
|
import { type Plan, type Simulate } from "./simulate.js";
|
|
6
|
+
export interface SavedGame {
|
|
7
|
+
rules: RulesStamp;
|
|
8
|
+
state: GameState;
|
|
9
|
+
}
|
|
4
10
|
export declare class GameService {
|
|
5
11
|
#private;
|
|
6
12
|
constructor(options?: {
|
|
@@ -19,6 +25,11 @@ export declare class GameService {
|
|
|
19
25
|
simulatorFor(gameId: string, playerId: PlayerId): Simulate;
|
|
20
26
|
plannerFor(gameId: string, playerId: PlayerId): Plan;
|
|
21
27
|
act(gameId: string, revision: number, actionId: string): import("../../protocol/src/index.js").GameObservation;
|
|
28
|
+
save(gameId: string): SavedGame;
|
|
29
|
+
restore(saved: {
|
|
30
|
+
rules?: RulesStamp;
|
|
31
|
+
state: GameState;
|
|
32
|
+
}): import("../../protocol/src/index.js").GameObservation;
|
|
22
33
|
private observeActive;
|
|
23
34
|
private legalActions;
|
|
24
35
|
private requireGame;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-optcg",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"README.md"
|
|
16
|
+
"README.md",
|
|
17
|
+
"INTEGRATING.md"
|
|
17
18
|
],
|
|
18
19
|
"description": "A deterministic rules engine for the One Piece Card Game: legal actions, transitions, hidden information and replay.",
|
|
19
20
|
"keywords": [
|