gotchi-battler-game-logic 4.0.4 → 4.0.6
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/.vscode/settings.json +6 -0
- package/game-logic/v2.0/index.js +17 -16
- package/game-logic/v2.0/statuses.json +438 -438
- package/package.json +32 -32
- package/scripts/data/enlightened.json +12706 -0
- package/scripts/rerunBattle.js +4 -4
package/.vscode/settings.json
CHANGED
package/game-logic/v2.0/index.js
CHANGED
|
@@ -75,7 +75,7 @@ const gameLoop = (team1, team2, seed, options = { debug: false, type: 'training'
|
|
|
75
75
|
while (getAlive(team1).length && getAlive(team2).length) {
|
|
76
76
|
// Check if turnCounter is ready for environment effects (99,149,199, etc)
|
|
77
77
|
let isEnvironmentTurn = [
|
|
78
|
-
99, 149, 199, 249, 299, 349, 399, 449, 499,
|
|
78
|
+
99, 149, 199, 249, 299, 349, 399, 449, 499,
|
|
79
79
|
549, 599, 649, 699, 749, 799, 849, 899, 949, 999].includes(turnCounter)
|
|
80
80
|
if (isEnvironmentTurn) {
|
|
81
81
|
allAliveGotchis.forEach(x => {
|
|
@@ -119,7 +119,7 @@ const gameLoop = (team1, team2, seed, options = { debug: false, type: 'training'
|
|
|
119
119
|
team1: getTeamStats(team1),
|
|
120
120
|
team2: getTeamStats(team2)
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
logs.result.winner = getAlive(team1).length ? 1 : 2
|
|
124
124
|
logs.result.winningTeam = logs.result.winner === 1 ? getTeamGotchis(team1) : getTeamGotchis(team2)
|
|
125
125
|
logs.result.winningTeam = logs.result.winningTeam.map((gotchi) => {
|
|
@@ -191,7 +191,7 @@ const executeTurn = (team1, team2, rng) => {
|
|
|
191
191
|
// Execute special attack
|
|
192
192
|
actionName = attackingGotchi.specialExpanded.code
|
|
193
193
|
const specialResults = attack(attackingGotchi, attackingTeam, defendingTeam, rng, true)
|
|
194
|
-
|
|
194
|
+
|
|
195
195
|
actionEffects = specialResults.actionEffects
|
|
196
196
|
additionalEffects = specialResults.additionalEffects
|
|
197
197
|
statusesExpired = specialResults.statusesExpired
|
|
@@ -201,7 +201,7 @@ const executeTurn = (team1, team2, rng) => {
|
|
|
201
201
|
repeatAttack = true
|
|
202
202
|
} else {
|
|
203
203
|
// Reset specialBar
|
|
204
|
-
attackingGotchi.specialBar = Math.round((100/6) * (6 - attackingGotchi.specialExpanded.cooldown))
|
|
204
|
+
attackingGotchi.specialBar = Math.round((100 / 6) * (6 - attackingGotchi.specialExpanded.cooldown))
|
|
205
205
|
}
|
|
206
206
|
} else {
|
|
207
207
|
// Do an auto attack
|
|
@@ -212,7 +212,7 @@ const executeTurn = (team1, team2, rng) => {
|
|
|
212
212
|
statusesExpired = attackResults.statusesExpired
|
|
213
213
|
|
|
214
214
|
// Increase specialBar by 1/6th
|
|
215
|
-
attackingGotchi.specialBar = Math.round(attackingGotchi.specialBar + (100/6))
|
|
215
|
+
attackingGotchi.specialBar = Math.round(attackingGotchi.specialBar + (100 / 6))
|
|
216
216
|
if (attackingGotchi.specialBar > 100) attackingGotchi.specialBar = 100
|
|
217
217
|
}
|
|
218
218
|
|
|
@@ -377,13 +377,13 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
|
|
|
377
377
|
const targetCode = isSpecial ? attackingGotchi.specialExpanded.target : 'enemy_random'
|
|
378
378
|
const targets = getTargetsFromCode(targetCode, attackingGotchi, attackingTeam, defendingTeam, rng)
|
|
379
379
|
|
|
380
|
-
|
|
380
|
+
const actionMultipler = isSpecial ? attackingGotchi.specialExpanded.actionMultiplier : 1
|
|
381
381
|
|
|
382
382
|
const actionEffects = []
|
|
383
383
|
const additionalEffects = []
|
|
384
384
|
const statusesExpired = []
|
|
385
385
|
let repeatAttack = false
|
|
386
|
-
|
|
386
|
+
|
|
387
387
|
targets.forEach((target) => {
|
|
388
388
|
// The effect for the main action of the attack
|
|
389
389
|
let targetActionEffect
|
|
@@ -391,13 +391,14 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
|
|
|
391
391
|
// For an additional effects that come for the special attack e.g. heals
|
|
392
392
|
const targetAdditionalEffects = []
|
|
393
393
|
|
|
394
|
+
// Roll for crit multiplier
|
|
395
|
+
const critMultiplier = getCritMultiplier(attackingGotchi, rng)
|
|
396
|
+
const isCrit = critMultiplier > 1
|
|
397
|
+
const totalMultiplier = actionMultipler * critMultiplier
|
|
398
|
+
|
|
394
399
|
// Handle action first
|
|
395
400
|
if (action === 'attack') {
|
|
396
|
-
const
|
|
397
|
-
const isCrit = critMultiplier > 1
|
|
398
|
-
actionMultipler *= critMultiplier
|
|
399
|
-
|
|
400
|
-
const damage = getDamage(attackingGotchi, target, actionMultipler)
|
|
401
|
+
const damage = getDamage(attackingGotchi, target, totalMultiplier)
|
|
401
402
|
|
|
402
403
|
targetActionEffect = {
|
|
403
404
|
target: target.id,
|
|
@@ -416,7 +417,7 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
|
|
|
416
417
|
target.stats.dmgReceived += damage
|
|
417
418
|
|
|
418
419
|
} else if (action === 'heal') {
|
|
419
|
-
const amountToHeal = getHealFromMultiplier(attackingGotchi, target,
|
|
420
|
+
const amountToHeal = getHealFromMultiplier(attackingGotchi, target, totalMultiplier)
|
|
420
421
|
|
|
421
422
|
targetActionEffect = {
|
|
422
423
|
target: target.id,
|
|
@@ -588,7 +589,7 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
|
|
|
588
589
|
if (specialEffect.target !== 'same_as_attack') {
|
|
589
590
|
const targets = getTargetsFromCode(specialEffect.target, attackingGotchi, attackingTeam, defendingTeam, rng)
|
|
590
591
|
|
|
591
|
-
targets.forEach((target) => {
|
|
592
|
+
targets.forEach((target) => {
|
|
592
593
|
const specialEffectResults = handleSpecialEffects(attackingTeam, attackingGotchi, target, specialEffect, rng)
|
|
593
594
|
|
|
594
595
|
additionalEffects.push(specialEffectResults.actionEffect)
|
|
@@ -652,7 +653,7 @@ const handleSpecialEffects = (attackingTeam, attackingGotchi, target, specialEff
|
|
|
652
653
|
}
|
|
653
654
|
case 'heal': {
|
|
654
655
|
const amountToHeal = getHealFromMultiplier(attackingGotchi, target, specialEffect.actionMultiplier)
|
|
655
|
-
|
|
656
|
+
|
|
656
657
|
// Add another effect for the healing
|
|
657
658
|
additionalEffects.push({
|
|
658
659
|
target: target.id,
|
|
@@ -662,7 +663,7 @@ const handleSpecialEffects = (attackingTeam, attackingGotchi, target, specialEff
|
|
|
662
663
|
})
|
|
663
664
|
|
|
664
665
|
target.health += amountToHeal
|
|
665
|
-
|
|
666
|
+
|
|
666
667
|
break
|
|
667
668
|
}
|
|
668
669
|
case 'remove_buff': {
|