gotchi-battler-game-logic 2.0.6 → 2.0.8

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 (45) hide show
  1. package/.vscode/settings.json +4 -4
  2. package/Dockerfile +9 -9
  3. package/README.md +49 -49
  4. package/cloudbuild.yaml +27 -27
  5. package/constants/tournamentManagerAbi.json +208 -208
  6. package/game-logic/index.js +6 -6
  7. package/game-logic/v1.4/constants.js +114 -114
  8. package/game-logic/v1.4/index.js +1366 -1366
  9. package/game-logic/v1.6/constants.js +123 -123
  10. package/game-logic/v1.6/index.js +1406 -1406
  11. package/game-logic/v1.7/constants.js +142 -140
  12. package/game-logic/v1.7/helpers.js +595 -593
  13. package/game-logic/v1.7/index.js +802 -795
  14. package/index.js +12 -12
  15. package/package.json +26 -26
  16. package/schemas/team.json +349 -343
  17. package/scripts/balancing/createCSV.js +126 -126
  18. package/scripts/balancing/fixTrainingGotchis.js +155 -259
  19. package/scripts/balancing/processSims.js +229 -229
  20. package/scripts/balancing/sims.js +278 -278
  21. package/scripts/balancing/v1.7/class_combos.js +43 -43
  22. package/scripts/balancing/v1.7/setTeamPositions.js +105 -105
  23. package/scripts/balancing/v1.7/training_gotchis.json +20161 -20161
  24. package/scripts/balancing/v1.7/trait_combos.json +9 -9
  25. package/scripts/balancing/v1.7.1/class_combos.js +43 -43
  26. package/scripts/balancing/v1.7.1/setTeamPositions.js +122 -122
  27. package/scripts/balancing/v1.7.1/training_gotchis.json +22401 -22401
  28. package/scripts/balancing/v1.7.1/trait_combos.json +9 -9
  29. package/scripts/balancing/v1.7.2/class_combos.js +44 -0
  30. package/scripts/balancing/v1.7.2/setTeamPositions.js +122 -0
  31. package/scripts/balancing/v1.7.2/training_gotchis.json +22402 -0
  32. package/scripts/balancing/v1.7.2/trait_combos.json +10 -0
  33. package/scripts/data/team1.json +213 -213
  34. package/scripts/data/team2.json +200 -200
  35. package/scripts/data/tournaments.json +66 -66
  36. package/scripts/{runBattle.js → runLocalBattle.js} +18 -18
  37. package/scripts/runRealBattle.js +52 -0
  38. package/scripts/simRealBattle.js +121 -0
  39. package/scripts/validateBattle.js +74 -70
  40. package/scripts/validateTournament.js +101 -101
  41. package/utils/contracts.js +12 -12
  42. package/utils/errors.js +29 -29
  43. package/utils/mapGotchi.js +119 -0
  44. package/utils/transforms.js +89 -88
  45. package/utils/validations.js +39 -39
package/schemas/team.json CHANGED
@@ -1,344 +1,350 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "formation": {
5
- "type": "object",
6
- "required": [
7
- "front",
8
- "back"
9
- ],
10
- "properties": {
11
- "front": {
12
- "type": "array",
13
- "minItems": 5,
14
- "maxItems": 5,
15
- "items": {
16
- "oneOf": [
17
- {
18
- "$ref": "#/definitions/gotchi"
19
- },
20
- {
21
- "type": "null"
22
- }
23
- ]
24
- }
25
- },
26
- "back": {
27
- "type": "array",
28
- "minItems": 5,
29
- "maxItems": 5,
30
- "items": {
31
- "oneOf": [
32
- {
33
- "$ref": "#/definitions/gotchi"
34
- },
35
- {
36
- "type": "null"
37
- }
38
- ]
39
- }
40
- }
41
- }
42
- },
43
- "leader": {
44
- "type": "integer"
45
- },
46
- "name": {
47
- "type": "string"
48
- },
49
- "owner": {
50
- "type": "string",
51
- "pattern": "^0x[a-fA-F0-9]{40}$"
52
- }
53
- },
54
- "required": [
55
- "formation",
56
- "leader",
57
- "name",
58
- "owner"
59
- ],
60
- "additionalProperties": false,
61
- "definitions": {
62
- "gotchi": {
63
- "type": "object",
64
- "properties": {
65
- "id": {
66
- "type": "integer"
67
- },
68
- "snapshotBlock": {
69
- "type": "integer"
70
- },
71
- "onchainId": {
72
- "type": "integer"
73
- },
74
- "name": {
75
- "type": "string"
76
- },
77
- "brs": {
78
- "type": "integer"
79
- },
80
- "nrg": {
81
- "type": "integer"
82
- },
83
- "agg": {
84
- "type": "integer"
85
- },
86
- "spk": {
87
- "type": "integer"
88
- },
89
- "brn": {
90
- "type": "integer"
91
- },
92
- "eyc": {
93
- "type": "integer"
94
- },
95
- "eys": {
96
- "type": "integer"
97
- },
98
- "kinship": {
99
- "type": "integer"
100
- },
101
- "xp": {
102
- "type": "integer"
103
- },
104
- "speed": {
105
- "type": "integer"
106
- },
107
- "health": {
108
- "type": "integer"
109
- },
110
- "crit": {
111
- "type": "integer"
112
- },
113
- "armor": {
114
- "type": "integer"
115
- },
116
- "evade": {
117
- "type": "integer"
118
- },
119
- "resist": {
120
- "type": "integer"
121
- },
122
- "magic": {
123
- "type": "integer"
124
- },
125
- "physical": {
126
- "type": "integer"
127
- },
128
- "accuracy": {
129
- "type": "number"
130
- },
131
- "attack": {
132
- "type": "string",
133
- "enum": [
134
- "physical",
135
- "magic"
136
- ]
137
- },
138
- "actionDelay": {
139
- "type": "number"
140
- },
141
- "svgFront": {
142
- "type": "string",
143
- "format": "uri"
144
- },
145
- "svgBack": {
146
- "type": "string",
147
- "format": "uri"
148
- },
149
- "svgLeft": {
150
- "type": "string",
151
- "format": "uri"
152
- },
153
- "svgRight": {
154
- "type": "string",
155
- "format": "uri"
156
- },
157
- "specialId": {
158
- "type": "integer"
159
- },
160
- "hauntId": {
161
- "type": ["integer", "null"]
162
- },
163
- "collateralType": {
164
- "type": ["string", "null"]
165
- },
166
- "eyeShape": {
167
- "type": ["string", "null"]
168
- },
169
- "eyeColor": {
170
- "type": ["string", "null"]
171
- },
172
- "wearableBody": {
173
- "type": ["integer", "null"]
174
- },
175
- "wearableFace": {
176
- "type": ["integer", "null"]
177
- },
178
- "wearableEyes": {
179
- "type": ["integer", "null"]
180
- },
181
- "wearableHead": {
182
- "type": ["integer", "null"]
183
- },
184
- "wearableHandLeft": {
185
- "type": ["integer", "null"]
186
- },
187
- "wearableHandRight": {
188
- "type": ["integer", "null"]
189
- },
190
- "wearablePet": {
191
- "type": ["integer", "null"]
192
- },
193
- "special": {
194
- "type": "object",
195
- "properties": {
196
- "id": {
197
- "type": "integer"
198
- },
199
- "class": {
200
- "type": "string"
201
- },
202
- "gotchiClass": {
203
- "type": "string"
204
- },
205
- "name": {
206
- "type": "string"
207
- },
208
- "cooldown": {
209
- "type": "integer"
210
- },
211
- "leaderPassive": {
212
- "type": "string"
213
- }
214
- },
215
- "required": [
216
- "id",
217
- "name",
218
- "cooldown",
219
- "leaderPassive"
220
- ],
221
- "additionalProperties": false
222
- },
223
- "itemId": {
224
- "type": [
225
- "integer",
226
- "null"
227
- ]
228
- },
229
- "item": {
230
- "type": [
231
- "object",
232
- "null"
233
- ],
234
- "properties": {
235
- "id": {
236
- "type": "integer"
237
- },
238
- "name": {
239
- "type": "string"
240
- },
241
- "description": {
242
- "type": "string"
243
- },
244
- "image": {
245
- "type": "string",
246
- "format": "uri"
247
- },
248
- "rarity": {
249
- "type": "string",
250
- "enum": [
251
- "common",
252
- "uncommon",
253
- "rare",
254
- "legendary",
255
- "mythical",
256
- "godlike"
257
- ]
258
- },
259
- "cost": {
260
- "type": "number"
261
- },
262
- "stat": {
263
- "type": "string",
264
- "enum": [
265
- "speed",
266
- "health",
267
- "crit",
268
- "armor",
269
- "evade",
270
- "resist",
271
- "magic",
272
- "physical",
273
- "accuracy"
274
- ]
275
- },
276
- "statValue": {
277
- "type": "integer"
278
- },
279
- "createdAt": {
280
- "type": "string"
281
- },
282
- "updatedAt": {
283
- "type": "string"
284
- }
285
- },
286
- "required": [
287
- "id",
288
- "name",
289
- "description",
290
- "image",
291
- "rarity",
292
- "cost",
293
- "stat",
294
- "statValue"
295
- ],
296
- "example": {
297
- "id": 1,
298
- "name": "Speed +",
299
- "description": "Increase speed by 1",
300
- "image": "https://gotchibattler.com/apple-touch-icon.png",
301
- "rarity": "common",
302
- "cost": 0.2,
303
- "stat": "speed",
304
- "statValue": 1,
305
- "createdAt": "2022-02-22T22:22:22Z",
306
- "updatedAt": "2022-02-22T22:22:22Z"
307
- }
308
- },
309
- "statuses": {
310
- "type": "array",
311
- "items": {
312
- "type": "string"
313
- }
314
- },
315
- "createdAt": {
316
- "type": "string"
317
- },
318
- "updatedAt": {
319
- "type": "string"
320
- }
321
- },
322
- "additionalProperties": false,
323
- "required": [
324
- "id",
325
- "name",
326
- "speed",
327
- "health",
328
- "crit",
329
- "armor",
330
- "evade",
331
- "resist",
332
- "magic",
333
- "physical",
334
- "accuracy",
335
- "svgFront",
336
- "svgBack",
337
- "svgLeft",
338
- "svgRight",
339
- "specialId",
340
- "special"
341
- ]
342
- }
343
- }
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "formation": {
5
+ "type": "object",
6
+ "required": [
7
+ "front",
8
+ "back"
9
+ ],
10
+ "properties": {
11
+ "front": {
12
+ "type": "array",
13
+ "minItems": 5,
14
+ "maxItems": 5,
15
+ "items": {
16
+ "oneOf": [
17
+ {
18
+ "$ref": "#/definitions/gotchi"
19
+ },
20
+ {
21
+ "type": "null"
22
+ }
23
+ ]
24
+ }
25
+ },
26
+ "back": {
27
+ "type": "array",
28
+ "minItems": 5,
29
+ "maxItems": 5,
30
+ "items": {
31
+ "oneOf": [
32
+ {
33
+ "$ref": "#/definitions/gotchi"
34
+ },
35
+ {
36
+ "type": "null"
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ },
43
+ "leader": {
44
+ "type": "integer"
45
+ },
46
+ "name": {
47
+ "type": "string"
48
+ },
49
+ "owner": {
50
+ "type": "string",
51
+ "pattern": "^0x[a-fA-F0-9]{40}$"
52
+ }
53
+ },
54
+ "required": [
55
+ "formation",
56
+ "leader",
57
+ "name",
58
+ "owner"
59
+ ],
60
+ "additionalProperties": false,
61
+ "definitions": {
62
+ "gotchi": {
63
+ "type": "object",
64
+ "properties": {
65
+ "id": {
66
+ "type": "integer"
67
+ },
68
+ "snapshotBlock": {
69
+ "type": "integer"
70
+ },
71
+ "onchainId": {
72
+ "type": "integer"
73
+ },
74
+ "name": {
75
+ "type": "string"
76
+ },
77
+ "brs": {
78
+ "type": "integer"
79
+ },
80
+ "nrg": {
81
+ "type": "integer"
82
+ },
83
+ "agg": {
84
+ "type": "integer"
85
+ },
86
+ "spk": {
87
+ "type": "integer"
88
+ },
89
+ "brn": {
90
+ "type": "integer"
91
+ },
92
+ "eyc": {
93
+ "type": "integer"
94
+ },
95
+ "eys": {
96
+ "type": "integer"
97
+ },
98
+ "kinship": {
99
+ "type": "integer"
100
+ },
101
+ "xp": {
102
+ "type": "integer"
103
+ },
104
+ "speed": {
105
+ "type": "integer"
106
+ },
107
+ "health": {
108
+ "type": "integer"
109
+ },
110
+ "crit": {
111
+ "type": "integer"
112
+ },
113
+ "armor": {
114
+ "type": "integer"
115
+ },
116
+ "evade": {
117
+ "type": "integer"
118
+ },
119
+ "resist": {
120
+ "type": "integer"
121
+ },
122
+ "magic": {
123
+ "type": "integer"
124
+ },
125
+ "physical": {
126
+ "type": "integer"
127
+ },
128
+ "accuracy": {
129
+ "type": "number"
130
+ },
131
+ "attack": {
132
+ "type": "string",
133
+ "enum": [
134
+ "physical",
135
+ "magic"
136
+ ]
137
+ },
138
+ "actionDelay": {
139
+ "type": "number"
140
+ },
141
+ "svgFront": {
142
+ "type": "string",
143
+ "format": "uri"
144
+ },
145
+ "svgBack": {
146
+ "type": "string",
147
+ "format": "uri"
148
+ },
149
+ "svgLeft": {
150
+ "type": "string",
151
+ "format": "uri"
152
+ },
153
+ "svgRight": {
154
+ "type": "string",
155
+ "format": "uri"
156
+ },
157
+ "specialId": {
158
+ "type": "integer"
159
+ },
160
+ "hauntId": {
161
+ "type": ["integer", "null"]
162
+ },
163
+ "collateralType": {
164
+ "type": ["string", "null"]
165
+ },
166
+ "eyeShape": {
167
+ "type": ["string", "null"]
168
+ },
169
+ "eyeColor": {
170
+ "type": ["string", "null"]
171
+ },
172
+ "wearableBody": {
173
+ "type": ["integer", "null"]
174
+ },
175
+ "wearableFace": {
176
+ "type": ["integer", "null"]
177
+ },
178
+ "wearableEyes": {
179
+ "type": ["integer", "null"]
180
+ },
181
+ "wearableHead": {
182
+ "type": ["integer", "null"]
183
+ },
184
+ "wearableHandLeft": {
185
+ "type": ["integer", "null"]
186
+ },
187
+ "wearableHandRight": {
188
+ "type": ["integer", "null"]
189
+ },
190
+ "wearablePet": {
191
+ "type": ["integer", "null"]
192
+ },
193
+ "special": {
194
+ "type": "object",
195
+ "properties": {
196
+ "id": {
197
+ "type": "integer"
198
+ },
199
+ "class": {
200
+ "type": "string"
201
+ },
202
+ "gotchiClass": {
203
+ "type": "string"
204
+ },
205
+ "name": {
206
+ "type": "string"
207
+ },
208
+ "cooldown": {
209
+ "type": "integer"
210
+ },
211
+ "leaderPassive": {
212
+ "type": "string"
213
+ },
214
+ "createdAt": {
215
+ "type": "string"
216
+ },
217
+ "updatedAt": {
218
+ "type": "string"
219
+ }
220
+ },
221
+ "required": [
222
+ "id",
223
+ "name",
224
+ "cooldown",
225
+ "leaderPassive"
226
+ ],
227
+ "additionalProperties": false
228
+ },
229
+ "itemId": {
230
+ "type": [
231
+ "integer",
232
+ "null"
233
+ ]
234
+ },
235
+ "item": {
236
+ "type": [
237
+ "object",
238
+ "null"
239
+ ],
240
+ "properties": {
241
+ "id": {
242
+ "type": "integer"
243
+ },
244
+ "name": {
245
+ "type": "string"
246
+ },
247
+ "description": {
248
+ "type": "string"
249
+ },
250
+ "image": {
251
+ "type": "string",
252
+ "format": "uri"
253
+ },
254
+ "rarity": {
255
+ "type": "string",
256
+ "enum": [
257
+ "common",
258
+ "uncommon",
259
+ "rare",
260
+ "legendary",
261
+ "mythical",
262
+ "godlike"
263
+ ]
264
+ },
265
+ "cost": {
266
+ "type": "number"
267
+ },
268
+ "stat": {
269
+ "type": "string",
270
+ "enum": [
271
+ "speed",
272
+ "health",
273
+ "crit",
274
+ "armor",
275
+ "evade",
276
+ "resist",
277
+ "magic",
278
+ "physical",
279
+ "accuracy"
280
+ ]
281
+ },
282
+ "statValue": {
283
+ "type": "integer"
284
+ },
285
+ "createdAt": {
286
+ "type": "string"
287
+ },
288
+ "updatedAt": {
289
+ "type": "string"
290
+ }
291
+ },
292
+ "required": [
293
+ "id",
294
+ "name",
295
+ "description",
296
+ "image",
297
+ "rarity",
298
+ "cost",
299
+ "stat",
300
+ "statValue"
301
+ ],
302
+ "example": {
303
+ "id": 1,
304
+ "name": "Speed +",
305
+ "description": "Increase speed by 1",
306
+ "image": "https://gotchibattler.com/apple-touch-icon.png",
307
+ "rarity": "common",
308
+ "cost": 0.2,
309
+ "stat": "speed",
310
+ "statValue": 1,
311
+ "createdAt": "2022-02-22T22:22:22Z",
312
+ "updatedAt": "2022-02-22T22:22:22Z"
313
+ }
314
+ },
315
+ "statuses": {
316
+ "type": "array",
317
+ "items": {
318
+ "type": "string"
319
+ }
320
+ },
321
+ "createdAt": {
322
+ "type": "string"
323
+ },
324
+ "updatedAt": {
325
+ "type": "string"
326
+ }
327
+ },
328
+ "additionalProperties": false,
329
+ "required": [
330
+ "id",
331
+ "name",
332
+ "speed",
333
+ "health",
334
+ "crit",
335
+ "armor",
336
+ "evade",
337
+ "resist",
338
+ "magic",
339
+ "physical",
340
+ "accuracy",
341
+ "svgFront",
342
+ "svgBack",
343
+ "svgLeft",
344
+ "svgRight",
345
+ "specialId",
346
+ "special"
347
+ ]
348
+ }
349
+ }
344
350
  }