gotchi-battler-game-logic 3.0.0 → 4.0.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.
- package/.cursor/rules/cursor-rules.mdc +67 -0
- package/.cursor/rules/directory-structure.mdc +63 -0
- package/.cursor/rules/self-improvement.mdc +64 -0
- package/.cursor/rules/tech-stack.mdc +99 -0
- package/README.md +4 -0
- package/eslint.config.js +31 -0
- package/game-logic/index.js +2 -6
- package/game-logic/v1.4/constants.js +0 -23
- package/game-logic/v1.4/index.js +64 -56
- package/game-logic/v1.5/constants.js +0 -23
- package/game-logic/v1.5/index.js +27 -21
- package/game-logic/v1.6/constants.js +0 -23
- package/game-logic/v1.6/index.js +27 -21
- package/game-logic/v1.7/constants.js +0 -23
- package/game-logic/v1.7/helpers.js +2 -2
- package/game-logic/v1.7/index.js +24 -18
- package/game-logic/v1.8/constants.js +0 -23
- package/game-logic/v1.8/helpers.js +2 -2
- package/game-logic/v1.8/index.js +25 -19
- package/game-logic/v2.0/constants.js +112 -0
- package/game-logic/v2.0/helpers.js +713 -0
- package/game-logic/v2.0/index.js +782 -0
- package/game-logic/v2.0/statuses.json +439 -0
- package/package.json +11 -4
- package/schemas/crystal.js +14 -0
- package/schemas/effect.js +25 -0
- package/schemas/gotchi.js +53 -0
- package/schemas/ingameteam.js +14 -0
- package/schemas/item.js +13 -0
- package/schemas/leaderskill.js +15 -0
- package/schemas/leaderskillstatus.js +12 -0
- package/schemas/special.js +22 -0
- package/schemas/team.js +24 -0
- package/schemas/team.json +252 -114
- package/scripts/balancing/createTrainingGotchis.js +44 -44
- package/scripts/balancing/extractOnchainTraits.js +3 -3
- package/scripts/balancing/fixTrainingGotchis.js +41 -41
- package/scripts/balancing/processSims.js +5 -5
- package/scripts/balancing/sims.js +8 -15
- package/scripts/balancing/v1.7/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7.1/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7.2/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7.3/setTeamPositions.js +2 -2
- package/scripts/data/dungeon_mob_1.json +87 -0
- package/scripts/data/dungeon_mob_2.json +87 -0
- package/scripts/data/immaterialTeam1.json +374 -0
- package/scripts/data/immaterialTeam2.json +365 -0
- package/scripts/generateAllSpecialsLogs.js +93 -0
- package/scripts/generateSpecialLogs.js +94 -0
- package/scripts/runCampaignBattles.js +41 -0
- package/scripts/runLocalBattle.js +6 -3
- package/scripts/runLocalDungeon.js +52 -0
- package/scripts/runPvPBattle.js +15 -0
- package/scripts/runRealBattle.js +8 -8
- package/scripts/simRealBattle.js +8 -8
- package/scripts/validateBattle.js +12 -14
- package/scripts/validateTournament.js +9 -9
- package/tests/getModifiedStats.test.js +78 -0
- package/utils/errors.js +13 -13
- package/utils/transforms.js +2 -8
- package/scripts/output/.gitkeep +0 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"code": "spd_up",
|
|
4
|
+
"name": "Speed Buff",
|
|
5
|
+
"description": "+12% SPD per stack",
|
|
6
|
+
"category": "stat_modifier",
|
|
7
|
+
"isBuff": true,
|
|
8
|
+
"statModifiers": [
|
|
9
|
+
{
|
|
10
|
+
"statName": "speed",
|
|
11
|
+
"value": 12,
|
|
12
|
+
"valueType": "percent"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"code": "atk_up",
|
|
18
|
+
"name": "Attack Buff",
|
|
19
|
+
"description": "+12% ATK per stack",
|
|
20
|
+
"category": "stat_modifier",
|
|
21
|
+
"isBuff": true,
|
|
22
|
+
"statModifiers": [
|
|
23
|
+
{
|
|
24
|
+
"statName": "attack",
|
|
25
|
+
"value": 12,
|
|
26
|
+
"valueType": "percent"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"code": "def_up",
|
|
32
|
+
"name": "Defense Buff",
|
|
33
|
+
"description": "+16% DEF per stack",
|
|
34
|
+
"category": "stat_modifier",
|
|
35
|
+
"isBuff": true,
|
|
36
|
+
"statModifiers": [
|
|
37
|
+
{
|
|
38
|
+
"statName": "defense",
|
|
39
|
+
"value": 16,
|
|
40
|
+
"valueType": "percent"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"code": "crt_up",
|
|
46
|
+
"name": "Critical-Rate Buff",
|
|
47
|
+
"description": "+12 CRT per stack",
|
|
48
|
+
"category": "stat_modifier",
|
|
49
|
+
"isBuff": true,
|
|
50
|
+
"statModifiers": [
|
|
51
|
+
{
|
|
52
|
+
"statName": "criticalRate",
|
|
53
|
+
"value": 12,
|
|
54
|
+
"valueType": "flat"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"code": "crd_up",
|
|
60
|
+
"name": "Critical-Damage Buff",
|
|
61
|
+
"description": "+30 CRD per stack",
|
|
62
|
+
"category": "stat_modifier",
|
|
63
|
+
"isBuff": true,
|
|
64
|
+
"statModifiers": [
|
|
65
|
+
{
|
|
66
|
+
"statName": "criticalDamage",
|
|
67
|
+
"value": 30,
|
|
68
|
+
"valueType": "flat"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"code": "res_up",
|
|
74
|
+
"name": "Resistance Buff",
|
|
75
|
+
"description": "+18 RES per stack",
|
|
76
|
+
"category": "stat_modifier",
|
|
77
|
+
"isBuff": true,
|
|
78
|
+
"statModifiers": [
|
|
79
|
+
{
|
|
80
|
+
"statName": "resist",
|
|
81
|
+
"value": 18,
|
|
82
|
+
"valueType": "flat"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"code": "foc_up",
|
|
88
|
+
"name": "Focus Buff",
|
|
89
|
+
"description": "+15 FOC per stack",
|
|
90
|
+
"category": "stat_modifier",
|
|
91
|
+
"isBuff": true,
|
|
92
|
+
"statModifiers": [
|
|
93
|
+
{
|
|
94
|
+
"statName": "focus",
|
|
95
|
+
"value": 15,
|
|
96
|
+
"valueType": "flat"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"code": "spd_down",
|
|
102
|
+
"name": "Speed Debuff",
|
|
103
|
+
"description": "-12% SPD per stack",
|
|
104
|
+
"category": "stat_modifier",
|
|
105
|
+
"isBuff": false,
|
|
106
|
+
"statModifiers": [
|
|
107
|
+
{
|
|
108
|
+
"statName": "speed",
|
|
109
|
+
"value": -12,
|
|
110
|
+
"valueType": "percent"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"code": "atk_down",
|
|
116
|
+
"name": "Attack Debuff",
|
|
117
|
+
"description": "-12% ATK per stack",
|
|
118
|
+
"category": "stat_modifier",
|
|
119
|
+
"isBuff": false,
|
|
120
|
+
"statModifiers": [
|
|
121
|
+
{
|
|
122
|
+
"statName": "attack",
|
|
123
|
+
"value": -12,
|
|
124
|
+
"valueType": "percent"
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"code": "def_down",
|
|
130
|
+
"name": "Defense Debuff",
|
|
131
|
+
"description": "-16% DEF per stack",
|
|
132
|
+
"category": "stat_modifier",
|
|
133
|
+
"isBuff": false,
|
|
134
|
+
"statModifiers": [
|
|
135
|
+
{
|
|
136
|
+
"statName": "defense",
|
|
137
|
+
"value": -16,
|
|
138
|
+
"valueType": "percent"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"code": "crt_down",
|
|
144
|
+
"name": "Critical-Rate Debuff",
|
|
145
|
+
"description": "-12 CRT per stack",
|
|
146
|
+
"category": "stat_modifier",
|
|
147
|
+
"isBuff": false,
|
|
148
|
+
"statModifiers": [
|
|
149
|
+
{
|
|
150
|
+
"statName": "criticalRate",
|
|
151
|
+
"value": -12,
|
|
152
|
+
"valueType": "flat"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"code": "crd_down",
|
|
158
|
+
"name": "Critical-Damage Debuff",
|
|
159
|
+
"description": "-30 CRD per stack",
|
|
160
|
+
"category": "stat_modifier",
|
|
161
|
+
"isBuff": false,
|
|
162
|
+
"statModifiers": [
|
|
163
|
+
{
|
|
164
|
+
"statName": "criticalDamage",
|
|
165
|
+
"value": -30,
|
|
166
|
+
"valueType": "flat"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"code": "res_down",
|
|
172
|
+
"name": "Resistance Debuff",
|
|
173
|
+
"description": "-18 RES per stack",
|
|
174
|
+
"category": "stat_modifier",
|
|
175
|
+
"isBuff": false,
|
|
176
|
+
"statModifiers": [
|
|
177
|
+
{
|
|
178
|
+
"statName": "resist",
|
|
179
|
+
"value": -18,
|
|
180
|
+
"valueType": "flat"
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"code": "foc_down",
|
|
186
|
+
"name": "Focus Debuff",
|
|
187
|
+
"description": "-15 FOC per stack",
|
|
188
|
+
"category": "stat_modifier",
|
|
189
|
+
"isBuff": false,
|
|
190
|
+
"statModifiers": [
|
|
191
|
+
{
|
|
192
|
+
"statName": "focus",
|
|
193
|
+
"value": -15,
|
|
194
|
+
"valueType": "flat"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"code": "regenerate",
|
|
200
|
+
"name": "Regeneration",
|
|
201
|
+
"description": "Heals a small amount each turn",
|
|
202
|
+
"category": "turn_effect",
|
|
203
|
+
"isBuff": true,
|
|
204
|
+
"turnEffects": [
|
|
205
|
+
{
|
|
206
|
+
"type": "heal",
|
|
207
|
+
"value": 15,
|
|
208
|
+
"valueType": "flat"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"code": "taunt",
|
|
214
|
+
"name": "Taunt",
|
|
215
|
+
"description": "Forces enemies to target this Gotchi; enables counter-attack",
|
|
216
|
+
"category": "custom",
|
|
217
|
+
"isBuff": true
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"code": "fear",
|
|
221
|
+
"name": "Fear",
|
|
222
|
+
"description": "Gotchi skips its next turn",
|
|
223
|
+
"category": "turn_effect",
|
|
224
|
+
"isBuff": false,
|
|
225
|
+
"turnEffects": [
|
|
226
|
+
{
|
|
227
|
+
"type": "skip_turn"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"code": "bleed",
|
|
233
|
+
"name": "Bleed",
|
|
234
|
+
"description": "Loses a small amount of HP each turn",
|
|
235
|
+
"category": "turn_effect",
|
|
236
|
+
"isBuff": false,
|
|
237
|
+
"turnEffects": [
|
|
238
|
+
{
|
|
239
|
+
"type": "damage",
|
|
240
|
+
"value": 8,
|
|
241
|
+
"valueType": "flat"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"code": "wounding_strike",
|
|
247
|
+
"name": "Wounding Strike",
|
|
248
|
+
"description": "Attacks may apply Bleed (30%) to the target",
|
|
249
|
+
"category": "attack_effect",
|
|
250
|
+
"isBuff": true,
|
|
251
|
+
"attackEffects": [
|
|
252
|
+
{
|
|
253
|
+
"type": "apply_status",
|
|
254
|
+
"effectStatus": "bleed",
|
|
255
|
+
"effectChance": 0.30
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"code": "weakening_strike",
|
|
261
|
+
"name": "Weakening Strike",
|
|
262
|
+
"description": "Attacks may apply -ATK (30%) to the target",
|
|
263
|
+
"category": "attack_effect",
|
|
264
|
+
"isBuff": true,
|
|
265
|
+
"attackEffects": [
|
|
266
|
+
{
|
|
267
|
+
"type": "apply_status",
|
|
268
|
+
"effectStatus": "atk_down",
|
|
269
|
+
"effectChance": 0.30
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"code": "enlightening_strike",
|
|
275
|
+
"name": "Enlightening Strike",
|
|
276
|
+
"description": "Attacks may apply +FOC (30%) to the target",
|
|
277
|
+
"category": "attack_effect",
|
|
278
|
+
"isBuff": false,
|
|
279
|
+
"attackEffects": [
|
|
280
|
+
{
|
|
281
|
+
"type": "apply_status",
|
|
282
|
+
"effectStatus": "foc_up",
|
|
283
|
+
"effectChance": 0.30
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"code": "cleansing_strike",
|
|
289
|
+
"name": "Cleansing Strike",
|
|
290
|
+
"description": "Attacks may remove a debuff from the attacker (30%)",
|
|
291
|
+
"category": "attack_effect",
|
|
292
|
+
"isBuff": true,
|
|
293
|
+
"attackEffects": [
|
|
294
|
+
{
|
|
295
|
+
"type": "cleanse_self",
|
|
296
|
+
"effectChance": 0.30
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"code": "piercing_strike",
|
|
302
|
+
"name": "Piercing Strike",
|
|
303
|
+
"description": "Attacks may apply -DEF (30%) to the target",
|
|
304
|
+
"category": "attack_effect",
|
|
305
|
+
"isBuff": true,
|
|
306
|
+
"attackEffects": [
|
|
307
|
+
{
|
|
308
|
+
"type": "apply_status",
|
|
309
|
+
"effectStatus": "def_down",
|
|
310
|
+
"effectChance": 0.30
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"code": "confusing_strike",
|
|
316
|
+
"name": "Confusing Strike",
|
|
317
|
+
"description": "Attacks may apply -FOC (30%) to the target",
|
|
318
|
+
"category": "attack_effect",
|
|
319
|
+
"isBuff": true,
|
|
320
|
+
"attackEffects": [
|
|
321
|
+
{
|
|
322
|
+
"type": "apply_status",
|
|
323
|
+
"effectStatus": "foc_down",
|
|
324
|
+
"effectChance": 0.30
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"code": "lucky_strike",
|
|
330
|
+
"name": "Lucky Strike",
|
|
331
|
+
"description": "Attacks may apply +CRD (30%) to the target",
|
|
332
|
+
"category": "attack_effect",
|
|
333
|
+
"isBuff": false,
|
|
334
|
+
"attackEffects": [
|
|
335
|
+
{
|
|
336
|
+
"type": "apply_status",
|
|
337
|
+
"effectStatus": "crd_up",
|
|
338
|
+
"effectChance": 0.30
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"code": "terrifying_strike",
|
|
344
|
+
"name": "Terrifying Strike",
|
|
345
|
+
"description": "Attacks may apply Fear (25%) to the target",
|
|
346
|
+
"category": "attack_effect",
|
|
347
|
+
"isBuff": true,
|
|
348
|
+
"attackEffects": [
|
|
349
|
+
{
|
|
350
|
+
"type": "apply_status",
|
|
351
|
+
"effectStatus": "fear",
|
|
352
|
+
"effectChance": 0.25
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"code": "nurturing_strike",
|
|
358
|
+
"name": "Nurturing Strike",
|
|
359
|
+
"description": "Attacks may apply Regeneration (30%) to the target",
|
|
360
|
+
"category": "attack_effect",
|
|
361
|
+
"isBuff": false,
|
|
362
|
+
"attackEffects": [
|
|
363
|
+
{
|
|
364
|
+
"type": "apply_status",
|
|
365
|
+
"effectStatus": "regenerate",
|
|
366
|
+
"effectChance": 0.30
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"code": "slowing_strike",
|
|
372
|
+
"name": "Slowing Strike",
|
|
373
|
+
"description": "Attacks may apply -SPD (30%) to the target",
|
|
374
|
+
"category": "attack_effect",
|
|
375
|
+
"isBuff": true,
|
|
376
|
+
"attackEffects": [
|
|
377
|
+
{
|
|
378
|
+
"type": "apply_status",
|
|
379
|
+
"effectStatus": "spd_down",
|
|
380
|
+
"effectChance": 0.30
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"code": "blinding_strike",
|
|
386
|
+
"name": "Blinding Strike",
|
|
387
|
+
"description": "Attacks may apply -CRT (30%) to the target",
|
|
388
|
+
"category": "attack_effect",
|
|
389
|
+
"isBuff": true,
|
|
390
|
+
"attackEffects": [
|
|
391
|
+
{
|
|
392
|
+
"type": "apply_status",
|
|
393
|
+
"effectStatus": "crt_down",
|
|
394
|
+
"effectChance": 0.30
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"code": "empowering_strike",
|
|
400
|
+
"name": "Empowering Strike",
|
|
401
|
+
"description": "Attacks may apply +ATK (30%) to the attacker",
|
|
402
|
+
"category": "attack_effect",
|
|
403
|
+
"isBuff": true,
|
|
404
|
+
"attackEffects": [
|
|
405
|
+
{
|
|
406
|
+
"type": "gain_status",
|
|
407
|
+
"effectStatus": "atk_up",
|
|
408
|
+
"effectChance": 0.30
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"code": "corrosive_strike",
|
|
414
|
+
"name": "Corrosive Strike",
|
|
415
|
+
"description": "Attacks may apply -RES (30%) to the target",
|
|
416
|
+
"category": "attack_effect",
|
|
417
|
+
"isBuff": true,
|
|
418
|
+
"attackEffects": [
|
|
419
|
+
{
|
|
420
|
+
"type": "apply_status",
|
|
421
|
+
"effectStatus": "res_down",
|
|
422
|
+
"effectChance": 0.30
|
|
423
|
+
}
|
|
424
|
+
]
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"code": "dispelling_strike",
|
|
428
|
+
"name": "Dispelling Strike",
|
|
429
|
+
"description": "Attacks may remove a buff (35%) from the target",
|
|
430
|
+
"category": "attack_effect",
|
|
431
|
+
"isBuff": true,
|
|
432
|
+
"attackEffects": [
|
|
433
|
+
{
|
|
434
|
+
"type": "remove_buff",
|
|
435
|
+
"effectChance": 0.35
|
|
436
|
+
}
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
]
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gotchi-battler-game-logic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "
|
|
6
|
+
"test": "mocha \"tests/**/*.test.js\"",
|
|
7
|
+
"test:watch": "mocha --watch \"tests/**/*.test.js\"",
|
|
8
|
+
"test:report": "mocha \"tests/**/*.test.js\" --reporter spec",
|
|
9
|
+
"lint": "npx eslint .",
|
|
10
|
+
"lint:fix": "npx eslint . --fix"
|
|
7
11
|
},
|
|
8
12
|
"author": "Galaxy Brain Studios",
|
|
9
13
|
"description": "The game logic for the Gotchi Battler game",
|
|
@@ -13,14 +17,17 @@
|
|
|
13
17
|
},
|
|
14
18
|
"dependencies": {
|
|
15
19
|
"seedrandom": "^3.0.5",
|
|
16
|
-
"
|
|
20
|
+
"zod": "^4.1.12"
|
|
17
21
|
},
|
|
18
22
|
"devDependencies": {
|
|
19
23
|
"@google-cloud/storage": "^7.13.0",
|
|
20
24
|
"axios": "^1.7.4",
|
|
21
25
|
"axios-retry": "^4.5.0",
|
|
26
|
+
"chai": "^4.3.10",
|
|
22
27
|
"dotenv": "^16.4.5",
|
|
28
|
+
"eslint": "^9.30.1",
|
|
23
29
|
"ethers": "^6.13.4",
|
|
24
|
-
"json-csv": "^4.0.18"
|
|
30
|
+
"json-csv": "^4.0.18",
|
|
31
|
+
"mocha": "^11.7.1"
|
|
25
32
|
}
|
|
26
33
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
|
|
3
|
+
const CrystalSchema = z.object({
|
|
4
|
+
code: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
slot: z.number().int().min(1).max(6),
|
|
7
|
+
rarity: z.enum(['common', 'uncommon', 'rare', 'legendary', 'mythical', 'godlike']),
|
|
8
|
+
stat: z.enum(['speed', 'health', 'attack', 'defense', 'criticalRate', 'criticalDamage', 'resist', 'focus']),
|
|
9
|
+
statValue: z.number().int(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
module.exports = { CrystalSchema }
|
|
13
|
+
|
|
14
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
|
|
3
|
+
const EffectTypeEnum = z.enum([
|
|
4
|
+
'status',
|
|
5
|
+
'heal',
|
|
6
|
+
'remove_buff',
|
|
7
|
+
'remove_debuff',
|
|
8
|
+
'remove_all_buffs',
|
|
9
|
+
'remove_all_debuffs',
|
|
10
|
+
'repeat_attack'
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
const EffectSchema = z.object({
|
|
14
|
+
id: z.number().int().optional(),
|
|
15
|
+
effectType: EffectTypeEnum,
|
|
16
|
+
value: z.number().nullable(),
|
|
17
|
+
chance: z.number().min(0).max(1).default(1.0),
|
|
18
|
+
special: z.string().nullable(),
|
|
19
|
+
target: z.string().nullable(),
|
|
20
|
+
status: z.string().nullable()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
module.exports = { EffectSchema, EffectTypeEnum }
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
const { SpecialSchema } = require('./special')
|
|
3
|
+
const { LeaderSkillSchema } = require('./leaderskill')
|
|
4
|
+
const { ItemSchema } = require('./item')
|
|
5
|
+
const { CrystalSchema } = require('./crystal')
|
|
6
|
+
|
|
7
|
+
const GotchiSchema = z.object({
|
|
8
|
+
id: z.number().int(),
|
|
9
|
+
onchainId: z.number().int(),
|
|
10
|
+
name: z.string(),
|
|
11
|
+
type: z.enum(['gotchi', 'spirit', 'monster']),
|
|
12
|
+
visualCode: z.string(),
|
|
13
|
+
level: z.number().int(),
|
|
14
|
+
speed: z.number().int(),
|
|
15
|
+
health: z.number().int(),
|
|
16
|
+
attack: z.number().int(),
|
|
17
|
+
defense: z.number().int(),
|
|
18
|
+
criticalRate: z.number(),
|
|
19
|
+
criticalDamage: z.number().int(),
|
|
20
|
+
resist: z.number().int(),
|
|
21
|
+
focus: z.number().int(),
|
|
22
|
+
|
|
23
|
+
// Foreign keys
|
|
24
|
+
gotchiClass: z.string(),
|
|
25
|
+
special: z.string(),
|
|
26
|
+
leaderSkill: z.string(),
|
|
27
|
+
item: z.string().nullable(),
|
|
28
|
+
crystalSlot1: z.string().nullable(),
|
|
29
|
+
crystalSlot2: z.string().nullable(),
|
|
30
|
+
crystalSlot3: z.string().nullable(),
|
|
31
|
+
crystalSlot4: z.string().nullable(),
|
|
32
|
+
crystalSlot5: z.string().nullable(),
|
|
33
|
+
crystalSlot6: z.string().nullable(),
|
|
34
|
+
|
|
35
|
+
// Expanded
|
|
36
|
+
specialExpanded: SpecialSchema,
|
|
37
|
+
leaderSkillExpanded: LeaderSkillSchema,
|
|
38
|
+
itemExpanded: ItemSchema.optional(),
|
|
39
|
+
crystalSlot1Expanded: CrystalSchema.optional(),
|
|
40
|
+
crystalSlot2Expanded: CrystalSchema.optional(),
|
|
41
|
+
crystalSlot3Expanded: CrystalSchema.optional(),
|
|
42
|
+
crystalSlot4Expanded: CrystalSchema.optional(),
|
|
43
|
+
crystalSlot5Expanded: CrystalSchema.optional(),
|
|
44
|
+
crystalSlot6Expanded: CrystalSchema.optional(),
|
|
45
|
+
|
|
46
|
+
// Timestamps
|
|
47
|
+
createdAt: z.iso.datetime().optional(),
|
|
48
|
+
updatedAt: z.iso.datetime().optional(),
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
module.exports = { GotchiSchema }
|
|
52
|
+
|
|
53
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
const { GotchiSchema } = require('./gotchi')
|
|
3
|
+
|
|
4
|
+
const InGameTeamSchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
owner: z.string(),
|
|
7
|
+
formation: z.object({
|
|
8
|
+
front: z.array(GotchiSchema.nullable()).min(5).max(5),
|
|
9
|
+
back: z.array(GotchiSchema.nullable()).min(5).max(5)
|
|
10
|
+
}),
|
|
11
|
+
leader: z.number().int()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
module.exports = { InGameTeamSchema }
|
package/schemas/item.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
|
|
3
|
+
const ItemSchema = z.object({
|
|
4
|
+
code: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
description: z.string(),
|
|
7
|
+
image: z.string(),
|
|
8
|
+
rarity: z.enum(['common', 'uncommon', 'rare', 'legendary', 'mythical', 'godlike']),
|
|
9
|
+
stat: z.enum(['speed', 'health', 'attack', 'defense', 'criticalRate', 'criticalDamage', 'resist', 'focus']),
|
|
10
|
+
statValue: z.number().int()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
module.exports = { ItemSchema }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
const { LeaderSkillStatusSchema } = require('./leaderskillstatus')
|
|
3
|
+
|
|
4
|
+
const LeaderSkillSchema = z.object({
|
|
5
|
+
code: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
monstersOnly: z.boolean().default(false),
|
|
9
|
+
gotchiClass: z.string(),
|
|
10
|
+
statuses: z.array(LeaderSkillStatusSchema).optional(),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
module.exports = { LeaderSkillSchema }
|
|
14
|
+
|
|
15
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
|
|
3
|
+
const LeaderSkillStatusSchema = z.object({
|
|
4
|
+
stackCount: z.number().int().min(1).default(1),
|
|
5
|
+
leaderSkill: z.string(),
|
|
6
|
+
status: z.string(),
|
|
7
|
+
leaderSkillExpanded: z.object({}).optional()
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
module.exports = { LeaderSkillStatusSchema }
|
|
11
|
+
|
|
12
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
const { EffectSchema } = require('./effect')
|
|
3
|
+
|
|
4
|
+
const ActionTypeEnum = z.enum(['attack', 'heal', 'none'])
|
|
5
|
+
|
|
6
|
+
const SpecialSchema = z.object({
|
|
7
|
+
code: z.string(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
initialCooldown: z.number().int(),
|
|
10
|
+
cooldown: z.number().int(),
|
|
11
|
+
actionType: ActionTypeEnum.default('none'),
|
|
12
|
+
actionMultiplier: z.number().nullable(),
|
|
13
|
+
monstersOnly: z.boolean().default(false),
|
|
14
|
+
notes: z.string().optional(),
|
|
15
|
+
gotchiClass: z.string().nullable(),
|
|
16
|
+
target: z.string().nullable(),
|
|
17
|
+
effects: z.array(EffectSchema).optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
module.exports = { SpecialSchema, ActionTypeEnum }
|
|
21
|
+
|
|
22
|
+
|
package/schemas/team.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { z } = require('zod')
|
|
2
|
+
const { GotchiSchema } = require('./gotchi')
|
|
3
|
+
|
|
4
|
+
const TeamSchema = z.object({
|
|
5
|
+
id: z.number().int().optional(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
leader: z.enum(['front1','front2','front3','front4','front5','back1','back2','back3','back4','back5']),
|
|
8
|
+
|
|
9
|
+
// Gotchis
|
|
10
|
+
front1Gotchi: GotchiSchema.nullable(),
|
|
11
|
+
front2Gotchi: GotchiSchema.nullable(),
|
|
12
|
+
front3Gotchi: GotchiSchema.nullable(),
|
|
13
|
+
front4Gotchi: GotchiSchema.nullable(),
|
|
14
|
+
front5Gotchi: GotchiSchema.nullable(),
|
|
15
|
+
back1Gotchi: GotchiSchema.nullable(),
|
|
16
|
+
back2Gotchi: GotchiSchema.nullable(),
|
|
17
|
+
back3Gotchi: GotchiSchema.nullable(),
|
|
18
|
+
back4Gotchi: GotchiSchema.nullable(),
|
|
19
|
+
back5Gotchi: GotchiSchema.nullable()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
module.exports = { TeamSchema }
|
|
23
|
+
|
|
24
|
+
|