gotchi-battler-game-logic 4.0.2 → 4.0.3

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.
@@ -264,11 +264,18 @@ const getDamage = (attackingGotchi, defendingGotchi, multiplier) => {
264
264
  return damage
265
265
  }
266
266
 
267
- const getHealFromMultiplier = (healingGotchi, multiplier) => {
267
+ const getHealFromMultiplier = (healingGotchi, target, multiplier) => {
268
+ // % of original target health
269
+ let amountToHeal = Math.round(target.fullHealth * multiplier)
268
270
 
269
- const modifiedHealingGotchi = getModifiedStats(healingGotchi)
271
+ // Don't allow amountToHeal to be more than the difference between current health and max health
272
+ if (amountToHeal > target.fullHealth - target.health) {
273
+ amountToHeal = target.fullHealth - target.health
274
+ }
270
275
 
271
- const amountToHeal = Math.round(modifiedHealingGotchi.resist * multiplier)
276
+ // Handle stats
277
+ healingGotchi.stats.healGiven += amountToHeal
278
+ target.stats.healReceived += amountToHeal
272
279
 
273
280
  return amountToHeal
274
281
  }
@@ -414,7 +414,7 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
414
414
  target.stats.dmgReceived += damage
415
415
 
416
416
  } else if (action === 'heal') {
417
- const amountToHeal = getHealFromMultiplier(attackingGotchi, actionMultipler)
417
+ const amountToHeal = getHealFromMultiplier(attackingGotchi, target, actionMultipler)
418
418
 
419
419
  targetActionEffect = {
420
420
  target: target.id,
@@ -426,10 +426,6 @@ const attack = (attackingGotchi, attackingTeam, defendingTeam, rng, isSpecial =
426
426
  // Handle healing
427
427
  target.health += amountToHeal
428
428
 
429
- // Handle stats
430
- attackingGotchi.stats.healGiven += amountToHeal
431
- target.stats.healReceived += amountToHeal
432
-
433
429
  } else if (action === 'none') {
434
430
  // Do nothing
435
431
  } else {
@@ -647,9 +643,8 @@ const handleSpecialEffects = (attackingTeam, attackingGotchi, target, specialEff
647
643
  break
648
644
  }
649
645
  case 'heal': {
650
- const amountToHeal = getHealFromMultiplier(target, specialEffect.actionMultiplier)
651
- target.health += amountToHeal
652
-
646
+ const amountToHeal = getHealFromMultiplier(attackingGotchi, target, specialEffect.actionMultiplier)
647
+
653
648
  // Add another effect for the healing
654
649
  additionalEffects.push({
655
650
  target: target.id,
@@ -658,9 +653,8 @@ const handleSpecialEffects = (attackingTeam, attackingGotchi, target, specialEff
658
653
  outcome: 'success'
659
654
  })
660
655
 
661
- // Handle stats
662
- attackingGotchi.stats.healGiven += amountToHeal
663
- target.stats.healReceived += amountToHeal
656
+ target.health += amountToHeal
657
+
664
658
  break
665
659
  }
666
660
  case 'remove_buff': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gotchi-battler-game-logic",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "mocha \"tests/**/*.test.js\"",