@firestone-hs/simulate-bgs-battle 1.1.587 → 1.1.588

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.
@@ -58,6 +58,7 @@ const spawnEntities = (cardId, quantity, boardToSpawnInto, boardToSpawnIntoHero,
58
58
  exports.spawnEntities = spawnEntities;
59
59
  const spawnEntitiesFromDeathrattle = (deadEntity, deadEntityIndexFromRight, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, entitiesDeadThisAttack, gameState) => {
60
60
  var _a, _b, _c, _d, _e, _f;
61
+ const finalSpawns = [];
61
62
  const multiplier = (0, deathrattle_effects_1.computeDeathrattleMultiplier)([...boardWithDeadEntity], boardWithDeadEntityHero, deadEntity, gameState.sharedState);
62
63
  const deathrattleTriggeredInput = {
63
64
  boardWithDeadEntity,
@@ -68,12 +69,12 @@ const spawnEntitiesFromDeathrattle = (deadEntity, deadEntityIndexFromRight, boar
68
69
  otherBoardHero,
69
70
  gameState,
70
71
  };
71
- const spawnedEntities = [];
72
72
  const enchantments = [
73
73
  ...((_a = deadEntity.enchantments) !== null && _a !== void 0 ? _a : []),
74
74
  ].sort((a, b) => a.timing - b.timing);
75
75
  const cardIds = [deadEntity.cardId, ...((_b = deadEntity.additionalCards) !== null && _b !== void 0 ? _b : []), ...enchantments.map((e) => e.cardId)];
76
76
  for (const deadEntityCardId of cardIds) {
77
+ const spawnedEntities = [];
77
78
  for (let i = 0; i < multiplier; i++) {
78
79
  let hasTriggered = true;
79
80
  const spawnEntityImpl = _card_mappings_1.cardMappings[deadEntityCardId];
@@ -663,12 +664,14 @@ const spawnEntitiesFromDeathrattle = (deadEntity, deadEntityIndexFromRight, boar
663
664
  break;
664
665
  }
665
666
  }
667
+ const actualSpawns = (0, spawns_1.performEntitySpawns)(spawnedEntities, boardWithDeadEntity, boardWithDeadEntityHero, deadEntity, deadEntityIndexFromRight, otherBoard, otherBoardHero, gameState);
668
+ finalSpawns.push(...actualSpawns);
666
669
  if (hasTriggered) {
667
670
  (0, deathrattle_on_trigger_1.onDeathrattleTriggered)(deathrattleTriggeredInput);
668
671
  }
669
672
  }
670
673
  }
671
- return spawnedEntities;
674
+ return finalSpawns;
672
675
  };
673
676
  exports.spawnEntitiesFromDeathrattle = spawnEntitiesFromDeathrattle;
674
677
  const spawnEntitiesFromEnchantments = (deadEntity, boardWithDeadEntity, boardWithDeadEntityHero, otherBoard, otherBoardHero, gameState) => {