@drmxrcy/tcg-lorcana 0.0.0-202602060544
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 +160 -0
- package/package.json +45 -0
- package/src/__tests__/integration/move-enumeration.test.ts +256 -0
- package/src/__tests__/rules/section-01-concepts.test.ts +426 -0
- package/src/__tests__/rules/section-03-gameplay.test.ts +298 -0
- package/src/__tests__/rules/section-04-turn-structure.test.ts +708 -0
- package/src/__tests__/rules/section-05-cards.test.ts +158 -0
- package/src/__tests__/rules/section-06-card-types.test.ts +342 -0
- package/src/__tests__/rules/section-07-abilities.test.ts +333 -0
- package/src/__tests__/rules/section-08-zones.test.ts +231 -0
- package/src/__tests__/rules/section-09-damage.test.ts +148 -0
- package/src/__tests__/rules/section-10-keywords.test.ts +469 -0
- package/src/__tests__/spec-01-foundation-types.test.ts +534 -0
- package/src/__tests__/spec-02-zones-card-states.test.ts +295 -0
- package/src/card-utils.ts +302 -0
- package/src/cards/README.md +296 -0
- package/src/cards/abilities/index.ts +175 -0
- package/src/cards/index.ts +10 -0
- package/src/deck-validation.ts +175 -0
- package/src/engine/lorcana-engine.ts +625 -0
- package/src/game-definition/__tests__/core-zone-integration.test.ts +553 -0
- package/src/game-definition/__tests__/zone-operations.test.ts +362 -0
- package/src/game-definition/__tests__/zones.test.ts +176 -0
- package/src/game-definition/definition.ts +45 -0
- package/src/game-definition/flow/turn-flow.ts +216 -0
- package/src/game-definition/index.ts +31 -0
- package/src/game-definition/moves/abilities/activate-ability.ts +51 -0
- package/src/game-definition/moves/core/__tests__/move-parameter-enumeration.test.ts +316 -0
- package/src/game-definition/moves/core/challenge.test.ts +545 -0
- package/src/game-definition/moves/core/challenge.ts +81 -0
- package/src/game-definition/moves/core/play-card.ts +83 -0
- package/src/game-definition/moves/core/quest.test.ts +448 -0
- package/src/game-definition/moves/core/quest.ts +49 -0
- package/src/game-definition/moves/debug/manual-exert.ts +36 -0
- package/src/game-definition/moves/effects/resolve-bag.ts +35 -0
- package/src/game-definition/moves/effects/resolve-effect.ts +34 -0
- package/src/game-definition/moves/index.ts +85 -0
- package/src/game-definition/moves/locations/move-character-to-location.ts +42 -0
- package/src/game-definition/moves/resources/put-card-into-inkwell.test.ts +462 -0
- package/src/game-definition/moves/resources/put-card-into-inkwell.ts +51 -0
- package/src/game-definition/moves/setup/alter-hand.test.ts +395 -0
- package/src/game-definition/moves/setup/alter-hand.ts +210 -0
- package/src/game-definition/moves/setup/choose-first-player.test.ts +450 -0
- package/src/game-definition/moves/setup/choose-first-player.ts +105 -0
- package/src/game-definition/moves/setup/draw-cards.ts +37 -0
- package/src/game-definition/moves/songs/sing-together.ts +47 -0
- package/src/game-definition/moves/songs/sing.ts +56 -0
- package/src/game-definition/moves/standard/concede.test.ts +189 -0
- package/src/game-definition/moves/standard/concede.ts +72 -0
- package/src/game-definition/moves/standard/pass-turn.ts +49 -0
- package/src/game-definition/setup/game-setup.ts +19 -0
- package/src/game-definition/trackers/tracker-config.ts +23 -0
- package/src/game-definition/win-conditions/lore-victory.ts +26 -0
- package/src/game-definition/zone-operations.ts +405 -0
- package/src/game-definition/zones/zone-configs.ts +59 -0
- package/src/game-definition/zones.ts +283 -0
- package/src/index.ts +189 -0
- package/src/operations/index.ts +7 -0
- package/src/operations/lorcana-operations.ts +288 -0
- package/src/queries/README.md +56 -0
- package/src/resolvers/__tests__/condition-resolver.test.ts +301 -0
- package/src/resolvers/condition-registry.ts +70 -0
- package/src/resolvers/condition-resolver.ts +85 -0
- package/src/resolvers/conditions/basic.ts +81 -0
- package/src/resolvers/conditions/card-state.ts +12 -0
- package/src/resolvers/conditions/comparison.ts +102 -0
- package/src/resolvers/conditions/existence.ts +219 -0
- package/src/resolvers/conditions/history.ts +68 -0
- package/src/resolvers/conditions/index.ts +15 -0
- package/src/resolvers/conditions/logical.ts +55 -0
- package/src/resolvers/conditions/resolution.ts +41 -0
- package/src/resolvers/conditions/revealed.ts +42 -0
- package/src/resolvers/conditions/zone.ts +84 -0
- package/src/setup.test.ts +18 -0
- package/src/targeting/__tests__/filter-resolver.test.ts +294 -0
- package/src/targeting/__tests__/real-cards-targeting.test.ts +303 -0
- package/src/targeting/__tests__/targeting-dsl.test.ts +386 -0
- package/src/targeting/enum-expansion.ts +387 -0
- package/src/targeting/filter-registry.ts +322 -0
- package/src/targeting/filter-resolver.ts +145 -0
- package/src/targeting/index.ts +91 -0
- package/src/targeting/lorcana-target-dsl.ts +495 -0
- package/src/targeting/targeting-ui.ts +407 -0
- package/src/testing/index.ts +14 -0
- package/src/testing/lorcana-test-engine.ts +813 -0
- package/src/types/README.md +303 -0
- package/src/types/__tests__/lorcana-state.test.ts +168 -0
- package/src/types/__tests__/move-enumeration.test.ts +179 -0
- package/src/types/branded-types.ts +106 -0
- package/src/types/game-state.ts +184 -0
- package/src/types/index.ts +87 -0
- package/src/types/keywords.ts +187 -0
- package/src/types/lorcana-state.ts +260 -0
- package/src/types/move-enumeration.ts +126 -0
- package/src/types/move-params.ts +216 -0
- package/src/validators/index.ts +7 -0
- package/src/validators/move-validators.ts +374 -0
- package/src/zones/card-state.ts +234 -0
- package/src/zones/index.ts +42 -0
- package/src/zones/zone-config.ts +150 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zone Configuration (Section 8)
|
|
3
|
+
*
|
|
4
|
+
* Lorcana has 5 zones with distinct visibility and ordering rules:
|
|
5
|
+
* - Deck (8.2): Private, ordered, facedown
|
|
6
|
+
* - Hand (8.3): Private, unordered
|
|
7
|
+
* - Play (8.4): Public, unordered
|
|
8
|
+
* - Inkwell (8.5): Public count, facedown cards
|
|
9
|
+
* - Discard (8.6): Public, unordered
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const ZONE_IDS = ["deck", "hand", "play", "inkwell", "discard"] as const;
|
|
13
|
+
export type LorcanaZoneId = (typeof ZONE_IDS)[number];
|
|
14
|
+
|
|
15
|
+
export type ZoneVisibility = "public" | "private" | "hidden_identity";
|
|
16
|
+
|
|
17
|
+
export interface ZoneConfig {
|
|
18
|
+
id: LorcanaZoneId;
|
|
19
|
+
visibility: ZoneVisibility;
|
|
20
|
+
ordered: boolean;
|
|
21
|
+
faceDown: boolean;
|
|
22
|
+
maxSize?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Zone configurations for Lorcana
|
|
27
|
+
*/
|
|
28
|
+
export const LORCANA_ZONES: Record<LorcanaZoneId, ZoneConfig> = {
|
|
29
|
+
/**
|
|
30
|
+
* Deck (Rule 8.2)
|
|
31
|
+
* - Private to owner
|
|
32
|
+
* - Ordered (has top and bottom)
|
|
33
|
+
* - Face down
|
|
34
|
+
*/
|
|
35
|
+
deck: {
|
|
36
|
+
id: "deck",
|
|
37
|
+
visibility: "private",
|
|
38
|
+
ordered: true,
|
|
39
|
+
faceDown: true,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Hand (Rule 8.3)
|
|
44
|
+
* - Private to owner
|
|
45
|
+
* - Unordered
|
|
46
|
+
* - Face down to opponents
|
|
47
|
+
*/
|
|
48
|
+
hand: {
|
|
49
|
+
id: "hand",
|
|
50
|
+
visibility: "private",
|
|
51
|
+
ordered: false,
|
|
52
|
+
faceDown: false,
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Play (Rule 8.4)
|
|
57
|
+
* - Public to all players
|
|
58
|
+
* - Unordered
|
|
59
|
+
* - Face up
|
|
60
|
+
*/
|
|
61
|
+
play: {
|
|
62
|
+
id: "play",
|
|
63
|
+
visibility: "public",
|
|
64
|
+
ordered: false,
|
|
65
|
+
faceDown: false,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Inkwell (Rule 8.5)
|
|
70
|
+
* - Count is public
|
|
71
|
+
* - Card identity is hidden (facedown)
|
|
72
|
+
* - Unordered
|
|
73
|
+
*/
|
|
74
|
+
inkwell: {
|
|
75
|
+
id: "inkwell",
|
|
76
|
+
visibility: "hidden_identity",
|
|
77
|
+
ordered: false,
|
|
78
|
+
faceDown: true,
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Discard (Rule 8.6)
|
|
83
|
+
* - Public to all players
|
|
84
|
+
* - Unordered (but order of discard may be tracked)
|
|
85
|
+
* - Face up
|
|
86
|
+
*/
|
|
87
|
+
discard: {
|
|
88
|
+
id: "discard",
|
|
89
|
+
visibility: "public",
|
|
90
|
+
ordered: false,
|
|
91
|
+
faceDown: false,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Check if a zone ID is valid
|
|
97
|
+
*/
|
|
98
|
+
export function isLorcanaZoneId(value: unknown): value is LorcanaZoneId {
|
|
99
|
+
return typeof value === "string" && ZONE_IDS.includes(value as LorcanaZoneId);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get zone configuration by ID
|
|
104
|
+
*/
|
|
105
|
+
export function getZoneConfig(zoneId: LorcanaZoneId): ZoneConfig {
|
|
106
|
+
return LORCANA_ZONES[zoneId];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Check if a zone is visible to a specific player
|
|
111
|
+
*/
|
|
112
|
+
export function isZoneVisibleTo(
|
|
113
|
+
zoneId: LorcanaZoneId,
|
|
114
|
+
zoneOwnerId: string,
|
|
115
|
+
viewerId: string,
|
|
116
|
+
): boolean {
|
|
117
|
+
const config = LORCANA_ZONES[zoneId];
|
|
118
|
+
|
|
119
|
+
if (config.visibility === "public") {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (config.visibility === "private") {
|
|
124
|
+
return zoneOwnerId === viewerId;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// hidden_identity - count is public, but not the cards themselves
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Check if zone card identities are visible to a player
|
|
133
|
+
*/
|
|
134
|
+
export function areCardsVisibleIn(
|
|
135
|
+
zoneId: LorcanaZoneId,
|
|
136
|
+
zoneOwnerId: string,
|
|
137
|
+
viewerId: string,
|
|
138
|
+
): boolean {
|
|
139
|
+
const config = LORCANA_ZONES[zoneId];
|
|
140
|
+
|
|
141
|
+
if (config.visibility === "public") {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (config.visibility === "private" && zoneOwnerId === viewerId) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return false;
|
|
150
|
+
}
|