@bct-app/game-model 0.1.0 → 0.1.1

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.
Files changed (43) hide show
  1. package/README.md +14 -10
  2. package/dist/index.d.ts +1172 -30
  3. package/dist/json-schema/ability-execution-timing.schema.json +8 -0
  4. package/dist/json-schema/ability.schema.json +2268 -0
  5. package/dist/json-schema/alignment-enum.schema.json +8 -0
  6. package/dist/json-schema/base-source.schema.json +64 -0
  7. package/dist/{schemas → json-schema}/character-basic-kind.schema.json +1 -1
  8. package/dist/{schemas → json-schema}/character-kind.schema.json +1 -1
  9. package/dist/json-schema/character.schema.json +123 -0
  10. package/dist/json-schema/chat-message-content.schema.json +65 -0
  11. package/dist/json-schema/chat-message-group.schema.json +37 -0
  12. package/dist/json-schema/chat-message-operation.schema.json +30 -0
  13. package/dist/json-schema/chat-message.schema.json +133 -0
  14. package/dist/json-schema/conversation.schema.json +252 -0
  15. package/dist/{schemas → json-schema}/effect.schema.json +375 -133
  16. package/dist/{schemas → json-schema}/game.schema.json +3 -16
  17. package/dist/json-schema/index.json +36 -0
  18. package/dist/{schemas → json-schema}/input.schema.json +108 -89
  19. package/dist/{schemas → json-schema}/message.schema.json +259 -35
  20. package/dist/json-schema/nomination.schema.json +29 -0
  21. package/dist/json-schema/operation.schema.json +28 -0
  22. package/dist/json-schema/player-display-format.schema.json +13 -0
  23. package/dist/json-schema/player-reminder.schema.json +19 -0
  24. package/dist/json-schema/player.schema.json +104 -0
  25. package/dist/json-schema/populated-character.schema.json +2344 -0
  26. package/dist/json-schema/populated-script.schema.json +2397 -0
  27. package/dist/json-schema/reminder.schema.json +24 -0
  28. package/dist/json-schema/room-create.schema.json +23 -0
  29. package/dist/json-schema/room-defaults.schema.json +72 -0
  30. package/dist/json-schema/room.schema.json +24 -0
  31. package/dist/json-schema/runtime-game.schema.json +162 -0
  32. package/dist/json-schema/script.schema.json +57 -0
  33. package/dist/json-schema/seat-side-enum.schema.json +9 -0
  34. package/dist/json-schema/special-message-kind.schema.json +7 -0
  35. package/dist/json-schema/target.schema.json +305 -0
  36. package/dist/json-schema/timeline.schema.json +87 -0
  37. package/dist/{schemas → json-schema}/view.schema.json +68 -42
  38. package/dist/zod.d.mts +4038 -0
  39. package/dist/zod.d.ts +4038 -0
  40. package/dist/zod.js +1129 -0
  41. package/dist/zod.mjs +1058 -0
  42. package/package.json +30 -15
  43. package/dist/schemas/index.json +0 -9
@@ -1,12 +1,12 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
5
  "targets": {
6
- "$ref": "#/definitions/__schema0"
6
+ "$ref": "#/$defs/__schema0"
7
7
  },
8
8
  "content": {
9
- "$ref": "#/definitions/__schema4"
9
+ "$ref": "#/$defs/__schema6"
10
10
  }
11
11
  },
12
12
  "required": [
@@ -17,29 +17,32 @@
17
17
  "id": "Message",
18
18
  "title": "技能消息模型",
19
19
  "description": "技能消息模型定义了技能执行过程中需要展示的信息内容和相关的目标",
20
- "definitions": {
20
+ "$defs": {
21
21
  "__schema0": {
22
22
  "minItems": 1,
23
23
  "type": "array",
24
24
  "items": {
25
- "$ref": "#/definitions/TargetModel"
25
+ "$ref": "#/$defs/TargetModel"
26
26
  }
27
27
  },
28
28
  "TargetModel": {
29
29
  "oneOf": [
30
30
  {
31
- "$ref": "#/definitions/__schema1"
31
+ "$ref": "#/$defs/__schema1"
32
32
  },
33
33
  {
34
- "$ref": "#/definitions/__schema2"
34
+ "$ref": "#/$defs/__schema2"
35
35
  },
36
36
  {
37
- "$ref": "#/definitions/__schema3"
37
+ "$ref": "#/$defs/__schema3"
38
+ },
39
+ {
40
+ "$ref": "#/$defs/__schema5"
38
41
  }
39
42
  ],
40
43
  "id": "TargetModel",
41
44
  "title": "目标模型",
42
- "description": "表示技能效果的目标,包含来自技能载荷、技能施放者和自定义三种来源"
45
+ "description": "表示技能效果的目标,包含来自技能载荷、技能施放者和动态规则三种来源"
43
46
  },
44
47
  "__schema1": {
45
48
  "type": "object",
@@ -88,13 +91,218 @@
88
91
  "properties": {
89
92
  "from": {
90
93
  "type": "string",
91
- "const": "CUSTOM"
94
+ "const": "DYNAMIC"
92
95
  },
93
- "value": {
96
+ "anchor": {
97
+ "oneOf": [
98
+ {
99
+ "type": "object",
100
+ "properties": {
101
+ "from": {
102
+ "type": "string",
103
+ "const": "EFFECTOR"
104
+ }
105
+ },
106
+ "required": [
107
+ "from"
108
+ ],
109
+ "additionalProperties": false
110
+ },
111
+ {
112
+ "type": "object",
113
+ "properties": {
114
+ "from": {
115
+ "type": "string",
116
+ "const": "PAYLOAD"
117
+ },
118
+ "value": {
119
+ "anyOf": [
120
+ {
121
+ "type": "number",
122
+ "minimum": 0
123
+ },
124
+ {
125
+ "type": "array",
126
+ "items": {
127
+ "type": "number",
128
+ "minimum": 0
129
+ }
130
+ }
131
+ ]
132
+ }
133
+ },
134
+ "required": [
135
+ "from",
136
+ "value"
137
+ ],
138
+ "additionalProperties": false
139
+ },
140
+ {
141
+ "type": "object",
142
+ "properties": {
143
+ "from": {
144
+ "type": "string",
145
+ "const": "STATIC"
146
+ },
147
+ "value": {
148
+ "type": "number",
149
+ "minimum": 1
150
+ }
151
+ },
152
+ "required": [
153
+ "from",
154
+ "value"
155
+ ],
156
+ "additionalProperties": false
157
+ }
158
+ ]
159
+ },
160
+ "selector": {
161
+ "type": "object",
162
+ "properties": {
163
+ "scope": {
164
+ "default": "BOTH_SIDES",
165
+ "anyOf": [
166
+ {
167
+ "type": "string",
168
+ "enum": [
169
+ "BOTH_SIDES",
170
+ "LEFT_SIDE",
171
+ "RIGHT_SIDE"
172
+ ]
173
+ },
174
+ {
175
+ "$ref": "#/$defs/__schema4"
176
+ }
177
+ ]
178
+ }
179
+ },
180
+ "required": [
181
+ "scope"
182
+ ],
183
+ "additionalProperties": false
184
+ },
185
+ "where": {
186
+ "type": "object",
187
+ "properties": {
188
+ "mode": {
189
+ "default": "ALL",
190
+ "type": "string",
191
+ "enum": [
192
+ "ALL",
193
+ "ANY"
194
+ ]
195
+ },
196
+ "conditions": {
197
+ "default": [],
198
+ "type": "array",
199
+ "items": {
200
+ "type": "object",
201
+ "properties": {
202
+ "field": {
203
+ "type": "string",
204
+ "enum": [
205
+ "CHARACTER_KIND",
206
+ "IS_DEAD",
207
+ "SEAT"
208
+ ]
209
+ },
210
+ "operator": {
211
+ "default": "EQ",
212
+ "type": "string",
213
+ "enum": [
214
+ "EQ",
215
+ "IN"
216
+ ]
217
+ },
218
+ "value": {
219
+ "anyOf": [
220
+ {
221
+ "anyOf": [
222
+ {
223
+ "type": "string"
224
+ },
225
+ {
226
+ "type": "boolean"
227
+ },
228
+ {
229
+ "type": "number",
230
+ "minimum": 1
231
+ },
232
+ {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "string"
236
+ }
237
+ },
238
+ {
239
+ "type": "array",
240
+ "items": {
241
+ "type": "number",
242
+ "minimum": 1
243
+ }
244
+ }
245
+ ]
246
+ },
247
+ {
248
+ "$ref": "#/$defs/__schema4"
249
+ }
250
+ ]
251
+ }
252
+ },
253
+ "required": [
254
+ "field",
255
+ "operator",
256
+ "value"
257
+ ],
258
+ "additionalProperties": false
259
+ }
260
+ }
261
+ },
262
+ "required": [
263
+ "mode",
264
+ "conditions"
265
+ ],
266
+ "additionalProperties": false
267
+ },
268
+ "limit": {
269
+ "anyOf": [
270
+ {
271
+ "type": "integer",
272
+ "exclusiveMinimum": 0,
273
+ "maximum": 9007199254740991
274
+ },
275
+ {
276
+ "$ref": "#/$defs/__schema4"
277
+ }
278
+ ]
279
+ }
280
+ },
281
+ "required": [
282
+ "from"
283
+ ],
284
+ "additionalProperties": false
285
+ },
286
+ "__schema4": {
287
+ "type": "object",
288
+ "properties": {
289
+ "from": {
94
290
  "type": "string",
95
- "enum": [
96
- "ALL_TOWNSFOLK",
97
- "ALL_PLAYERS"
291
+ "const": "PAYLOAD"
292
+ },
293
+ "value": {
294
+ "anyOf": [
295
+ {
296
+ "type": "number",
297
+ "minimum": 0
298
+ },
299
+ {
300
+ "type": "array",
301
+ "items": {
302
+ "type": "number",
303
+ "minimum": 0
304
+ }
305
+ }
98
306
  ]
99
307
  }
100
308
  },
@@ -104,33 +312,48 @@
104
312
  ],
105
313
  "additionalProperties": false
106
314
  },
107
- "__schema4": {
315
+ "__schema5": {
316
+ "type": "object",
317
+ "properties": {
318
+ "from": {
319
+ "type": "string",
320
+ "const": "CUSTOM"
321
+ },
322
+ "value": {}
323
+ },
324
+ "required": [
325
+ "from",
326
+ "value"
327
+ ],
328
+ "additionalProperties": false
329
+ },
330
+ "__schema6": {
108
331
  "minItems": 1,
109
332
  "type": "array",
110
333
  "items": {
111
- "$ref": "#/definitions/MessageTemplateSegmentModel"
334
+ "$ref": "#/$defs/MessageTemplateSegmentModel"
112
335
  }
113
336
  },
114
337
  "MessageTemplateSegmentModel": {
115
338
  "anyOf": [
116
339
  {
117
- "$ref": "#/definitions/__schema5"
340
+ "$ref": "#/$defs/__schema7"
118
341
  },
119
342
  {
120
- "$ref": "#/definitions/__schema6"
343
+ "$ref": "#/$defs/__schema8"
121
344
  },
122
345
  {
123
- "$ref": "#/definitions/__schema9"
346
+ "$ref": "#/$defs/__schema11"
124
347
  },
125
348
  {
126
- "$ref": "#/definitions/__schema10"
349
+ "$ref": "#/$defs/__schema12"
127
350
  }
128
351
  ],
129
352
  "id": "MessageTemplateSegmentModel",
130
353
  "title": "消息模板段模型",
131
354
  "description": "消息模板段模型定义了技能消息中每个段的内容和类型,可以是纯文本、带有特定格式的玩家信息、其他类型的数值信息,或者特殊的预设信息"
132
355
  },
133
- "__schema5": {
356
+ "__schema7": {
134
357
  "type": "object",
135
358
  "properties": {
136
359
  "type": {
@@ -147,7 +370,7 @@
147
370
  ],
148
371
  "additionalProperties": false
149
372
  },
150
- "__schema6": {
373
+ "__schema8": {
151
374
  "oneOf": [
152
375
  {
153
376
  "type": "object",
@@ -157,14 +380,14 @@
157
380
  "const": "PAYLOAD"
158
381
  },
159
382
  "value": {
160
- "$ref": "#/definitions/__schema7"
383
+ "$ref": "#/$defs/__schema9"
161
384
  },
162
385
  "payloadType": {
163
386
  "type": "string",
164
387
  "const": "PLAYER"
165
388
  },
166
389
  "options": {
167
- "$ref": "#/definitions/__schema8"
390
+ "$ref": "#/$defs/__schema10"
168
391
  }
169
392
  },
170
393
  "required": [
@@ -183,7 +406,7 @@
183
406
  "const": "PAYLOAD"
184
407
  },
185
408
  "value": {
186
- "$ref": "#/definitions/__schema7"
409
+ "$ref": "#/$defs/__schema9"
187
410
  },
188
411
  "payloadType": {
189
412
  "type": "string",
@@ -194,7 +417,7 @@
194
417
  "properties": {
195
418
  "texts": {
196
419
  "type": "array",
197
- "items": [
420
+ "prefixItems": [
198
421
  {
199
422
  "type": "string"
200
423
  },
@@ -215,7 +438,7 @@
215
438
  },
216
439
  "colors": {
217
440
  "type": "array",
218
- "items": [
441
+ "prefixItems": [
219
442
  {
220
443
  "type": "string"
221
444
  },
@@ -243,7 +466,7 @@
243
466
  "const": "PAYLOAD"
244
467
  },
245
468
  "value": {
246
- "$ref": "#/definitions/__schema7"
469
+ "$ref": "#/$defs/__schema9"
247
470
  },
248
471
  "payloadType": {
249
472
  "type": "string",
@@ -255,7 +478,8 @@
255
478
  "TEXT",
256
479
  "STATUS",
257
480
  "REMINDER",
258
- "PLAYER_REMINDER"
481
+ "PLAYER_REMINDER",
482
+ "SEAT_SIDE"
259
483
  ]
260
484
  },
261
485
  "options": {
@@ -275,7 +499,7 @@
275
499
  }
276
500
  ]
277
501
  },
278
- "__schema7": {
502
+ "__schema9": {
279
503
  "anyOf": [
280
504
  {
281
505
  "type": "number",
@@ -290,14 +514,14 @@
290
514
  }
291
515
  ]
292
516
  },
293
- "__schema8": {
517
+ "__schema10": {
294
518
  "default": {
295
519
  "format": "NUMBER_AND_CHARACTER"
296
520
  },
297
521
  "type": "object",
298
522
  "properties": {
299
523
  "format": {
300
- "$ref": "#/definitions/PlayerDisplayFormat"
524
+ "$ref": "#/$defs/PlayerDisplayFormat"
301
525
  }
302
526
  },
303
527
  "required": [
@@ -317,7 +541,7 @@
317
541
  "title": "玩家显示格式",
318
542
  "description": "定义了玩家信息在技能消息中的显示格式"
319
543
  },
320
- "__schema9": {
544
+ "__schema11": {
321
545
  "type": "object",
322
546
  "properties": {
323
547
  "type": {
@@ -325,7 +549,7 @@
325
549
  "const": "EFFECTOR"
326
550
  },
327
551
  "options": {
328
- "$ref": "#/definitions/__schema8"
552
+ "$ref": "#/$defs/__schema10"
329
553
  }
330
554
  },
331
555
  "required": [
@@ -334,7 +558,7 @@
334
558
  ],
335
559
  "additionalProperties": false
336
560
  },
337
- "__schema10": {
561
+ "__schema12": {
338
562
  "type": "object",
339
563
  "properties": {
340
564
  "type": {
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "nominator": {
6
+ "type": "number"
7
+ },
8
+ "nominee": {
9
+ "type": "number"
10
+ },
11
+ "voterSeats": {
12
+ "default": [],
13
+ "type": "array",
14
+ "items": {
15
+ "type": "number"
16
+ }
17
+ },
18
+ "inRack": {
19
+ "default": false,
20
+ "type": "boolean"
21
+ }
22
+ },
23
+ "required": [
24
+ "nominator",
25
+ "nominee",
26
+ "voterSeats"
27
+ ],
28
+ "additionalProperties": false
29
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "abilityId": {
6
+ "type": "string",
7
+ "minLength": 1
8
+ },
9
+ "effector": {
10
+ "type": "number"
11
+ },
12
+ "payloads": {
13
+ "default": [],
14
+ "type": "array",
15
+ "items": {}
16
+ },
17
+ "visible": {
18
+ "default": false,
19
+ "type": "boolean"
20
+ }
21
+ },
22
+ "required": [
23
+ "abilityId",
24
+ "effector",
25
+ "payloads"
26
+ ],
27
+ "additionalProperties": false
28
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "string",
4
+ "enum": [
5
+ "NUMBER_AND_CHARACTER",
6
+ "NUMBER_ONLY",
7
+ "CHARACTER_ONLY",
8
+ "ALIGNMENT_ONLY"
9
+ ],
10
+ "id": "PlayerDisplayFormat",
11
+ "title": "玩家显示格式",
12
+ "description": "定义了玩家信息在技能消息中的显示格式"
13
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "playerSeat": {
6
+ "type": "number",
7
+ "minimum": 1
8
+ },
9
+ "index": {
10
+ "type": "number",
11
+ "minimum": 0
12
+ }
13
+ },
14
+ "required": [
15
+ "playerSeat",
16
+ "index"
17
+ ],
18
+ "additionalProperties": false
19
+ }
@@ -0,0 +1,104 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "seat": {
6
+ "type": "number",
7
+ "minimum": 1
8
+ },
9
+ "user": {
10
+ "type": "object",
11
+ "properties": {
12
+ "userId": {
13
+ "type": "string"
14
+ },
15
+ "ready": {
16
+ "type": "boolean"
17
+ }
18
+ },
19
+ "required": [
20
+ "userId",
21
+ "ready"
22
+ ],
23
+ "additionalProperties": false
24
+ },
25
+ "characterId": {
26
+ "type": "string"
27
+ },
28
+ "perceivedCharacter": {
29
+ "type": "object",
30
+ "properties": {
31
+ "characterId": {
32
+ "type": "string"
33
+ },
34
+ "abilities": {
35
+ "default": [],
36
+ "type": "array",
37
+ "items": {
38
+ "type": "string"
39
+ }
40
+ },
41
+ "asCharacter": {
42
+ "type": "boolean"
43
+ }
44
+ },
45
+ "required": [
46
+ "characterId",
47
+ "abilities"
48
+ ],
49
+ "additionalProperties": false
50
+ },
51
+ "abilities": {
52
+ "default": [],
53
+ "type": "array",
54
+ "items": {
55
+ "type": "string"
56
+ }
57
+ },
58
+ "reminders": {
59
+ "type": "array",
60
+ "items": {
61
+ "type": "object",
62
+ "properties": {
63
+ "mark": {
64
+ "type": "string",
65
+ "minLength": 1
66
+ },
67
+ "color": {
68
+ "type": "string"
69
+ },
70
+ "description": {
71
+ "type": "string"
72
+ },
73
+ "duration": {
74
+ "type": "number",
75
+ "minimum": 0
76
+ }
77
+ },
78
+ "required": [
79
+ "mark"
80
+ ],
81
+ "additionalProperties": false
82
+ }
83
+ },
84
+ "alignment": {
85
+ "type": "string",
86
+ "enum": [
87
+ "GOOD",
88
+ "EVIL"
89
+ ]
90
+ },
91
+ "isDead": {
92
+ "type": "boolean"
93
+ },
94
+ "hasUsedDeadVote": {
95
+ "type": "boolean"
96
+ }
97
+ },
98
+ "required": [
99
+ "seat",
100
+ "characterId",
101
+ "abilities"
102
+ ],
103
+ "additionalProperties": false
104
+ }