gotchi-battler-game-logic 2.0.0 → 2.0.2

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.
@@ -5,575 +5,26 @@ const teamSchema = require('../../schemas/team.json')
5
5
 
6
6
  const { GameError } = require('../../utils/errors')
7
7
 
8
- let {
8
+ const {
9
9
  PASSIVES,
10
- BUFF_MULT_EFFECTS,
11
- BUFF_FLAT_EFFECTS,
12
- DEBUFF_MULT_EFFECTS,
13
- DEBUFF_FLAT_EFFECTS,
14
10
  DEBUFFS,
15
11
  BUFFS,
16
12
  MULTS
17
13
  } = require('./constants')
18
14
 
19
- // Get only alive gotchis in a team
20
- const getAlive = (team, row) => {
21
- if (row) {
22
- return team.formation[row].filter(x => x).filter(x => x.health > 0)
23
- }
24
-
25
- return [...team.formation.front, ...team.formation.back].filter(x => x).filter(x => x.health > 0)
26
- }
27
-
28
- /**
29
- * Get the formation position of a gotchi
30
- * @param {Object} team1 An in-game team object
31
- * @param {Object} team2 An in-game team object
32
- * @param {Number} gotchiId The id of the gotchi
33
- * @returns {Object} position The formation position of the gotchi
34
- * @returns {Number} position.team The team the gotchi is on
35
- * @returns {String} position.row The row the gotchi is on
36
- * @returns {Number} position.position The position of the gotchi in the row
37
- * @returns {null} position null if the gotchi is not found
38
- **/
39
- const getFormationPosition = (team1, team2, gotchiId) => {
40
- const team1FrontIndex = team1.formation.front.findIndex(x => x && x.id === gotchiId)
41
-
42
- if (team1FrontIndex !== -1) return {
43
- team: 1,
44
- row: 'front',
45
- position: team1FrontIndex,
46
- name: team1.formation.front[team1FrontIndex].name
47
- }
48
-
49
- const team1BackIndex = team1.formation.back.findIndex(x => x && x.id === gotchiId)
50
-
51
- if (team1BackIndex !== -1) return {
52
- team: 1,
53
- row: 'back',
54
- position: team1BackIndex,
55
- name: team1.formation.back[team1BackIndex].name
56
- }
57
-
58
- const team2FrontIndex = team2.formation.front.findIndex(x => x && x.id === gotchiId)
59
-
60
- if (team2FrontIndex !== -1) return {
61
- team: 2,
62
- row: 'front',
63
- position: team2FrontIndex,
64
- name: team2.formation.front[team2FrontIndex].name
65
- }
66
-
67
- const team2BackIndex = team2.formation.back.findIndex(x => x && x.id === gotchiId)
68
-
69
- if (team2BackIndex !== -1) return {
70
- team: 2,
71
- row: 'back',
72
- position: team2BackIndex,
73
- name: team2.formation.back[team2BackIndex].name
74
- }
75
-
76
- return null
77
- }
78
-
79
- /**
80
- * Get the leader gotchi of a team
81
- * @param {Object} team An in-game team object
82
- * @returns {Object} gotchi The leader gotchi
83
- * @returns {Number} leader.id The id of the gotchi
84
- * @returns {String} leader.special The special object of the gotchi
85
- * @returns {String} leader.special.class The class of the special
86
- **/
87
- const getLeaderGotchi = (team) => {
88
- const leader = [...team.formation.front, ...team.formation.back].find(x => x && x.id === team.leader)
89
-
90
- if (!leader) throw new Error('Leader not found')
91
-
92
- return leader
93
- }
94
-
95
- /**
96
- * Get the next gotchi to act
97
- * @param {Object} team1 An in-game team object
98
- * @param {Object} team2 An in-game team object
99
- * @param {Function} rng The random number generator
100
- * @returns {Object} position The formation position of the gotchi
101
- **/
102
- const getNextToAct = (team1, team2, rng) => {
103
- const aliveGotchis = [...getAlive(team1), ...getAlive(team2)]
104
-
105
- aliveGotchis.sort((a, b) => a.actionDelay - b.actionDelay)
106
-
107
- let toAct = aliveGotchis.filter(gotchi => gotchi.actionDelay === aliveGotchis[0].actionDelay)
108
-
109
- // If only one gotchi can act then return it
110
- if (toAct.length === 1) return getFormationPosition(team1, team2, toAct[0].id)
111
-
112
- // Lowest speeds win tiebreaker
113
- toAct.sort((a, b) => a.speed - b.speed)
114
- toAct = toAct.filter(gotchi => gotchi.speed === toAct[0].speed)
115
-
116
- // If only one gotchi can act then return it
117
-
118
- if (toAct.length === 1) return getFormationPosition(team1, team2, toAct[0].id)
119
-
120
- // If still tied then randomly choose
121
- const randomIndex = Math.floor(rng() * toAct.length)
122
-
123
- if (!toAct[randomIndex]) throw new Error(`No gotchi found at index ${randomIndex}`)
124
-
125
- toAct = toAct[randomIndex]
126
- return getFormationPosition(team1, team2, toAct.id)
127
- }
128
-
129
- const getTarget = (defendingTeam, rng) => {
130
- // Check for taunt gotchis
131
- const taunt = [...getAlive(defendingTeam, 'front'), ...getAlive(defendingTeam, 'back')].filter(gotchi => gotchi.statuses && gotchi.statuses.includes("taunt"))
132
-
133
- if (taunt.length) {
134
- if (taunt.length === 1) return taunt[0]
135
-
136
- // If multiple taunt gotchis then randomly choose one
137
- return taunt[Math.floor(rng() * taunt.length)]
138
- }
139
-
140
- // Target gotchis in the front row first
141
- const frontRow = getAlive(defendingTeam, 'front')
142
-
143
- if (frontRow.length) {
144
- return frontRow[Math.floor(rng() * frontRow.length)]
145
- }
146
-
147
- // If no gotchis in front row then target back row
148
- const backRow = getAlive(defendingTeam, 'back')
149
-
150
- if (backRow.length) {
151
- return backRow[Math.floor(rng() * backRow.length)]
152
- }
153
-
154
- throw new Error('No gotchis to target')
155
- }
156
-
157
- const applySpeedPenalty = (gotchi, penalty) => {
158
- const speedPenalty = (gotchi.speed - 100) * penalty
159
-
160
- return {
161
- ...gotchi,
162
- magic: gotchi.magic - speedPenalty,
163
- physical: gotchi.physical - speedPenalty
164
- }
165
- }
166
-
167
- /**
168
- * Get the damage of an attack
169
- * @param {Object} attackingTeam The attacking team
170
- * @param {Object} defendingTeam The defending team
171
- * @param {Object} attackingGotchi The gotchi attacking
172
- * @param {Object} defendingGotchi The gotchi defending
173
- * @param {Number} multiplier The damage multiplier
174
- * @param {Boolean} ignoreArmor Whether to ignore armor
175
- * @param {Number} speedPenalty The speed penalty to apply
176
- * @returns {Number} damage The damage of the attack
177
- **/
178
- const getDamage = (attackingTeam, defendingTeam, attackingGotchi, defendingGotchi, multiplier, ignoreArmor, speedPenalty) => {
179
-
180
- const attackerWithSpeedPenalty = speedPenalty ? applySpeedPenalty(attackingGotchi, speedPenalty) : attackingGotchi
181
-
182
- // Apply any status effects
183
- const modifiedAttackingGotchi = getModifiedStats(attackerWithSpeedPenalty)
184
- const modifiedDefendingGotchi = getModifiedStats(defendingGotchi)
185
-
186
- let attackValue = modifiedAttackingGotchi.attack === 'magic' ? modifiedAttackingGotchi.magic : modifiedAttackingGotchi.physical
187
-
188
- // If attacking gotchi is in the front row then apply front row attack bonus
189
- if (getFormationPosition(attackingTeam, defendingTeam, attackingGotchi.id).row === 'front') {
190
- attackValue = Math.round(attackValue * MULTS.FRONT_ROW_ATK_BONUS)
191
- }
192
-
193
- let defenseValue = modifiedAttackingGotchi.attack === 'magic' ? modifiedDefendingGotchi.magic : modifiedDefendingGotchi.physical
194
-
195
- // If defending gotchi is in the front row then apply front row defence penalty
196
- if (getFormationPosition(attackingTeam, defendingTeam, defendingGotchi.id).row === 'front') {
197
- defenseValue = Math.round(defenseValue * MULTS.FRONT_ROW_DEF_NERF)
198
- }
199
-
200
- // Add armor to defense value
201
- if (!ignoreArmor) defenseValue += modifiedDefendingGotchi.armor
202
-
203
- // Calculate damage
204
- let damage = Math.round((attackValue / defenseValue) * 100)
205
-
206
- // Apply multiplier
207
- if (multiplier) damage = Math.round(damage * multiplier)
208
-
209
- // check for environment effects
210
- if (defendingGotchi.environmentEffects && defendingGotchi.environmentEffects.length > 0) {
211
- damage = Math.round(damage * (1 + (defendingGotchi.environmentEffects.length * 0.5)))
212
- }
213
-
214
- return damage
215
- }
216
-
217
- /**
218
- * Apply status effects to a gotchi
219
- * @param {Object} gotchi An in-game gotchi object
220
- * @returns {Object} gotchi An in-game gotchi object with modified stats
221
- */
222
- const getModifiedStats = (gotchi) => {
223
- const statMods = {}
224
-
225
- gotchi.statuses.forEach(status => {
226
- const statusStatMods = {}
227
-
228
- // apply any modifier from BUFF_MULT_EFFECTS
229
- if (BUFF_MULT_EFFECTS[status]) {
230
- Object.keys(BUFF_MULT_EFFECTS[status]).forEach(stat => {
231
- const modifier = Math.round(gotchi[stat] * BUFF_MULT_EFFECTS[status][stat])
232
-
233
- statusStatMods[stat] = modifier
234
- })
235
- }
236
-
237
- // apply any modifier from BUFF_FLAT_EFFECTS
238
- if (BUFF_FLAT_EFFECTS[status]) {
239
- Object.keys(BUFF_FLAT_EFFECTS[status]).forEach(stat => {
240
- if (statusStatMods[stat]) {
241
- // If a mod for this status already exists, only add if the new mod is greater
242
- if (BUFF_FLAT_EFFECTS[status][stat] > statusStatMods[stat]) statusStatMods[stat] = BUFF_FLAT_EFFECTS[status][stat]
243
- } else {
244
- statusStatMods[stat] = BUFF_FLAT_EFFECTS[status][stat]
245
- }
246
- })
247
- }
248
-
249
- // apply any modifier from DEBUFF_MULT_EFFECTS
250
- if (DEBUFF_MULT_EFFECTS[status]) {
251
- Object.keys(DEBUFF_MULT_EFFECTS[status]).forEach(stat => {
252
- const modifier = Math.round(gotchi[stat] * DEBUFF_MULT_EFFECTS[status][stat])
253
-
254
- statusStatMods[stat] = -modifier
255
- })
256
- }
257
-
258
- // apply any modifier from DEBUFF_FLAT_EFFECTS
259
- if (DEBUFF_FLAT_EFFECTS[status]) {
260
- Object.keys(DEBUFF_FLAT_EFFECTS[status]).forEach(stat => {
261
- if (statusStatMods[stat]) {
262
- // If a mod for this status already exists, only add if the new mod is greater
263
- if (DEBUFF_FLAT_EFFECTS[status][stat] < statusStatMods[stat]) statusStatMods[stat] = DEBUFF_FLAT_EFFECTS[status][stat]
264
- } else {
265
- statusStatMods[stat] = -DEBUFF_FLAT_EFFECTS[status][stat]
266
- }
267
- })
268
- }
269
-
270
- // apply status mods
271
- Object.keys(statusStatMods).forEach(stat => {
272
- statMods[stat] = statMods[stat] ? statMods[stat] + statusStatMods[stat] : statusStatMods[stat]
273
- })
274
- })
275
-
276
- const modifiedGotchi = {
277
- ...gotchi
278
- }
279
-
280
- // apply stat mods
281
- Object.keys(statMods).forEach(stat => {
282
- if (statMods[stat] < 0) {
283
- modifiedGotchi[stat] = modifiedGotchi[stat] + statMods[stat] < 0 ? 0 : modifiedGotchi[stat] + statMods[stat]
284
- } else {
285
- modifiedGotchi[stat] += statMods[stat]
286
- }
287
-
288
- })
289
-
290
- // Recalculate attack type
291
- modifiedGotchi.attack = modifiedGotchi.magic > modifiedGotchi.physical ? 'magic' : 'physical'
292
-
293
- return modifiedGotchi
294
- }
295
-
296
- const calculateActionDelay = (gotchi) => {
297
- // Calculate action delay and round to 3 decimal places
298
- return Math.round(((100 / getModifiedStats(gotchi).speed) + Number.EPSILON) * 1000) / 1000
299
- }
300
-
301
- const getNewActionDelay = (gotchi) => {
302
- // Calculate new action delay and round to 3 decimal places
303
- return Math.round((gotchi.actionDelay + calculateActionDelay(gotchi) + Number.EPSILON) * 1000) / 1000
304
- }
305
-
306
- /**
307
- * Simplify a team object for storage
308
- * @param {Object} team An in-game team object
309
- * @returns {Object} simplifiedTeam A simplified team object
310
- */
311
- const simplifyTeam = (team) => {
312
- return {
313
- name: team.name,
314
- owner: team.owner,
315
- leaderId: team.leader,
316
- rows: [
317
- {
318
- slots: team.formation.front.map((x) => {
319
- return {
320
- isActive: x ? true : false,
321
- id: x ? x.id : null
322
- }
323
- })
324
- },
325
- {
326
- slots: team.formation.back.map((x) => {
327
- return {
328
- isActive: x ? true : false,
329
- id: x ? x.id : null
330
- }
331
- })
332
- }
333
- ],
334
- uiOrder: getUiOrder(team)
335
- }
336
- }
337
-
338
- /**
339
- * Get the UI order of a team (used for the front end)
340
- * @param {Object} team An in-game team object
341
- * @returns {Array} uiOrder An array of gotchi ids in the order they should be displayed
342
- **/
343
- const getUiOrder = (team) => {
344
- const uiOrder = []
345
-
346
- if (team.formation.front[0]) uiOrder.push(team.formation.front[0].id)
347
- if (team.formation.back[0]) uiOrder.push(team.formation.back[0].id)
348
- if (team.formation.front[1]) uiOrder.push(team.formation.front[1].id)
349
- if (team.formation.back[1]) uiOrder.push(team.formation.back[1].id)
350
- if (team.formation.front[2]) uiOrder.push(team.formation.front[2].id)
351
- if (team.formation.back[2]) uiOrder.push(team.formation.back[2].id)
352
- if (team.formation.front[3]) uiOrder.push(team.formation.front[3].id)
353
- if (team.formation.back[3]) uiOrder.push(team.formation.back[3].id)
354
- if (team.formation.front[4]) uiOrder.push(team.formation.front[4].id)
355
- if (team.formation.back[4]) uiOrder.push(team.formation.back[4].id)
356
-
357
- return uiOrder
358
- }
359
-
360
- /**
361
- * Add the leader statuses to a team
362
- * @param {Object} team An in-game team object
363
- **/
364
- const addLeaderToTeam = (team) => {
365
- // Add passive leader abilities
366
- const teamLeader = getLeaderGotchi(team)
367
-
368
- team.leaderPassive = teamLeader.special.id
369
-
370
- // Apply leader passive statuses
371
- switch (team.leaderPassive) {
372
- case 1:
373
- // Sharpen blades - all allies gain 'sharp_blades' status
374
- getAlive(team).forEach(x => {
375
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
376
- })
377
- break
378
- case 2:
379
- // Cloud of Zen - Leader get 'cloud_of_zen' status
380
- teamLeader.statuses.push(PASSIVES[team.leaderPassive - 1])
381
- break
382
- case 3:
383
- // Frenzy - all allies get 'frenzy' status
384
- getAlive(team).forEach(x => {
385
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
386
- })
387
- break
388
- case 4:
389
- // All allies get 'fortify' status
390
- getAlive(team).forEach(x => {
391
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
392
- })
393
-
394
- break
395
- case 5:
396
- // Spread the fear - all allies get 'spread_the_fear' status
397
- getAlive(team).forEach(x => {
398
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
399
- })
400
- break
401
- case 6:
402
- // Cleansing aura - every healer ally and every tank ally gets 'cleansing_aura' status
403
- getAlive(team).forEach(x => {
404
- if (x.special.id === 6 || x.special.id === 4) x.statuses.push(PASSIVES[team.leaderPassive - 1])
405
- })
406
- break
407
- case 7:
408
- // All allies get 'channel_the_coven' status
409
- getAlive(team).forEach(x => {
410
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
411
- })
412
- break
413
- case 8:
414
- // All allies get 'clan_momentum' status
415
- getAlive(team).forEach(x => {
416
- x.statuses.push(PASSIVES[team.leaderPassive - 1])
417
- })
418
- break
419
- }
420
- }
421
-
422
- const removeLeaderPassivesFromTeam = (team) => {
423
- let statusesRemoved = []
424
- if (!team.leaderPassive) return statusesRemoved
425
-
426
- // Remove leader passive statuses from team
427
- getAlive(team).forEach(x => {
428
- // add effects for each status removed
429
- x.statuses.forEach(status => {
430
- if (status === PASSIVES[team.leaderPassive - 1]) {
431
- statusesRemoved.push({
432
- target: x.id,
433
- status: status
434
- })
435
- }
436
- })
437
-
438
- x.statuses = x.statuses.filter(x => x !== PASSIVES[team.leaderPassive - 1])
439
- })
440
-
441
- team.leaderPassive = null
442
-
443
- return statusesRemoved
444
- }
445
-
446
- const getExpiredStatuses = (team1, team2) => {
447
- // If leader is dead, remove leader passive
448
- let statusesExpired = []
449
- if (team1.leaderPassive && !getAlive(team1).find(x => x.id === team1.leader)) {
450
- // Remove leader passive statuses
451
- statusesExpired = removeLeaderPassivesFromTeam(team1)
452
- }
453
- if (team2.leaderPassive && !getAlive(team2).find(x => x.id === team2.leader)) {
454
- // Remove leader passive statuses
455
- statusesExpired = removeLeaderPassivesFromTeam(team2)
456
- }
457
-
458
- return statusesExpired
459
- }
460
-
461
- /**
462
- * Add a status to a gotchi
463
- * @param {Object} gotchi An in-game gotchi object
464
- * @param {String} status The status to add
465
- * @returns {Boolean} success A boolean to determine if the status was added
466
- **/
467
- const addStatusToGotchi = (gotchi, status) => {
468
- // Check that gotchi doesn't already have max number of statuses
469
- if (gotchi.statuses.filter(item => item === status).length >= MULTS.MAX_STATUSES) return false
470
-
471
- gotchi.statuses.push(status)
472
-
473
- return true
474
- }
475
-
476
- const scrambleGotchiIds = (allAliveGotchis, team1, team2) => {
477
- // check there's no duplicate gotchis
478
- const gotchiIds = allAliveGotchis.map(x => x.id)
479
-
480
- if (gotchiIds.length !== new Set(gotchiIds).size) {
481
- // scramble gotchi ids
482
- allAliveGotchis.forEach(x => {
483
- const newId = Math.floor(Math.random() * 10000000)
484
-
485
- // find gotchi in team1 or team2
486
- const position = getFormationPosition(team1, team2, x.id)
487
-
488
- // change gotchi id
489
- if (position) {
490
- if (position.team === 1) {
491
- if (x.id === team1.leader) team1.leader = newId
492
- team1.formation[position.row][position.position].id = newId
493
- } else {
494
- if (x.id === team2.leader) team2.leader = newId
495
- team2.formation[position.row][position.position].id = newId
496
- }
497
- } else {
498
- throw new Error('Gotchi not found in team1 or team2')
499
- }
500
- })
501
-
502
- // check again
503
- const newGotchiIds = allAliveGotchis.map(x => x.id)
504
- if (newGotchiIds.length !== new Set(newGotchiIds).size) {
505
- // Scramble again
506
- scrambleGotchiIds(allAliveGotchis, team1, team2)
507
- }
508
- }
509
- }
510
-
511
- /**
512
- * Prepare teams for battle
513
- * @param {Array} allAliveGotchis An array of all alive gotchis
514
- * @param {Object} team1 An in-game team object
515
- * @param {Object} team2 An in-game team object
516
- **/
517
- const prepareTeams = (allAliveGotchis, team1, team2) => {
518
- // check there's no duplicate gotchis
519
- scrambleGotchiIds(allAliveGotchis, team1, team2);
520
-
521
- allAliveGotchis.forEach(x => {
522
- // Add statuses property to all gotchis
523
- x.statuses = []
524
-
525
- // Calculate initial action delay for all gotchis
526
- x.actionDelay = calculateActionDelay(x)
527
-
528
- // Calculate attack type
529
- x.attack = x.magic > x.physical ? 'magic' : 'physical'
530
-
531
- // Add original stats to all gotchis
532
- // Do a deep copy of the gotchi object to avoid modifying the original object
533
- x.originalStats = JSON.parse(JSON.stringify(x))
534
-
535
- // Add environmentEffects to all gotchis
536
- x.environmentEffects = []
537
- })
538
-
539
- // Add leader passive to team
540
- addLeaderToTeam(team1)
541
- addLeaderToTeam(team2);
542
- }
543
-
544
- /**
545
- * Get log gotchi object for battle logs
546
- * @param {Array} allAliveGotchis An array of all alive gotchis
547
- * @returns {Array} logGotchis An array of gotchi objects for logs
548
- */
549
- const getLogGotchis = (allAliveGotchis) => {
550
- const logGotchis = JSON.parse(JSON.stringify(allAliveGotchis))
551
-
552
- logGotchis.forEach(x => {
553
- // Change gotchi.special.class to gotchi.special.gotchiClass to avoid conflicts with class keyword
554
- x.special.gotchiClass = x.special.class
555
-
556
- // Remove unnecessary properties to reduce log size
557
- delete x.special.class
558
- delete x.snapshotBlock
559
- delete x.onchainId
560
- delete x.brs
561
- delete x.nrg
562
- delete x.agg
563
- delete x.spk
564
- delete x.brn
565
- delete x.eyc
566
- delete x.eys
567
- delete x.kinship
568
- delete x.xp
569
- delete x.actionDelay
570
- delete x.attack
571
- delete x.originalStats
572
- delete x.environmentEffects
573
- })
574
-
575
- return logGotchis
576
- }
15
+ const {
16
+ getAlive,
17
+ getNextToAct,
18
+ getTarget,
19
+ getDamage,
20
+ getModifiedStats,
21
+ getNewActionDelay,
22
+ simplifyTeam,
23
+ getExpiredStatuses,
24
+ addStatusToGotchi,
25
+ prepareTeams,
26
+ getLogGotchis
27
+ } = require('./helpers')
577
28
 
578
29
  /**
579
30
  * Run a battle between two teams
@@ -855,28 +306,6 @@ const handleStatusEffects = (attackingGotchi, attackingTeam, defendingTeam, rng)
855
306
 
856
307
  const modifiedAttackingGotchi = getModifiedStats(attackingGotchi)
857
308
 
858
- // Check for cleansing_aura
859
- // if (attackingGotchi.statuses.includes('cleansing_aura')) {
860
- // // Remove all debuffs from all allies
861
- // const aliveAllies = getAlive(attackingTeam)
862
- // aliveAllies.forEach((ally) => {
863
- // ally.statuses.forEach((status) => {
864
- // if (DEBUFFS.includes(status)) {
865
- // passiveEffects.push({
866
- // source: attackingGotchi.id,
867
- // target: ally.id,
868
- // status,
869
- // damage: 0,
870
- // remove: true
871
- // })
872
- // }
873
- // })
874
-
875
- // // Remove status effects
876
- // ally.statuses = ally.statuses.filter((status) => !DEBUFFS.includes(status))
877
- // })
878
- // }
879
-
880
309
  // Check for global status effects
881
310
  const allAliveGotchis = [...getAlive(attackingTeam), ...getAlive(defendingTeam)]
882
311
 
@@ -977,24 +406,6 @@ const handleStatusEffects = (attackingGotchi, attackingTeam, defendingTeam, rng)
977
406
 
978
407
  break
979
408
  }
980
-
981
- // Stun
982
- // if (status === 'stun') {
983
- // // Skip turn
984
- // statusEffects.push({
985
- // target: attackingGotchi.id,
986
- // status,
987
- // damage: 0,
988
- // remove: true
989
- // })
990
-
991
- // skipTurn = 'STUN'
992
-
993
- // // Remove first instance of stun
994
- // attackingGotchi.statuses.splice(i, 1)
995
-
996
- // break
997
- // }
998
409
  }
999
410
 
1000
411
  return {
@@ -1036,8 +447,6 @@ const executeTurn = (team1, team2, rng) => {
1036
447
  let specialDone = false
1037
448
  // Check if special attack is ready
1038
449
  if (attackingGotchi.special.cooldown === 0) {
1039
- // TODO: Check if special attack should be used
1040
-
1041
450
  // Execute special attack
1042
451
  const specialResults = specialAttack(attackingGotchi, attackingTeam, defendingTeam, rng)
1043
452
 
@@ -1383,7 +792,5 @@ const specialAttack = (attackingGotchi, attackingTeam, defendingTeam, rng) => {
1383
792
  }
1384
793
 
1385
794
  module.exports = {
1386
- getFormationPosition,
1387
- getModifiedStats,
1388
795
  gameLoop
1389
796
  }
package/index.js CHANGED
@@ -6,7 +6,7 @@ const teamSchema = require('./schemas/team')
6
6
  const { webappTeamToInGameTeam, inGameTeamToWebappTeam } = require('./utils/transforms')
7
7
 
8
8
  module.exports = {
9
- game: currentVersion.gameLoop,
9
+ battle: currentVersion.gameLoop,
10
10
  teamSchema,
11
11
  webappTeamToInGameTeam,
12
12
  inGameTeamToWebappTeam
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gotchi-battler-game-logic",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"