@firestone-hs/simulate-bgs-battle 1.1.344 → 1.1.345
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/dist/simulation/attack.js +10 -3
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +8 -0
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/start-of-combat.js +7 -2
- package/dist/simulation/start-of-combat.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ const simulateAttack = (attackingBoard, attackingBoardHero, defendingBoard, defe
|
|
|
20
20
|
}
|
|
21
21
|
const attackingEntity = forceAttackingEntityIndex != null
|
|
22
22
|
? attackingBoard[forceAttackingEntityIndex]
|
|
23
|
-
: getAttackingEntity(attackingBoard, lastAttackerEntityId);
|
|
23
|
+
: getAttackingEntity(attackingBoard, lastAttackerEntityId, allCards);
|
|
24
24
|
const attackingEntityIndex = attackingBoard.map((e) => e.entityId).indexOf(attackingEntity === null || attackingEntity === void 0 ? void 0 : attackingEntity.entityId);
|
|
25
25
|
if (attackingEntity) {
|
|
26
26
|
attackingEntity.attacking = true;
|
|
@@ -237,7 +237,8 @@ const triggerRandomDeathrattle = (sourceEntity, attackingBoard, attackingBoardHe
|
|
|
237
237
|
const indexFromRight = attackingBoard.length - (attackingBoard.indexOf(targetEntity) + 1);
|
|
238
238
|
(0, exports.buildBoardAfterDeathrattleSpawns)(attackingBoard, attackingBoardHero, targetEntity, indexFromRight, defendingBoard, defendingBoardHero, [], allCards, spawns, sharedState, spectator);
|
|
239
239
|
};
|
|
240
|
-
const getAttackingEntity = (attackingBoard, lastAttackerIndex) => {
|
|
240
|
+
const getAttackingEntity = (attackingBoard, lastAttackerIndex, allCards) => {
|
|
241
|
+
lastAttackerIndex = Math.max(0, lastAttackerIndex);
|
|
241
242
|
let validAttackers = attackingBoard.filter((entity) => (0, entity_utils_1.canAttack)(entity));
|
|
242
243
|
if (validAttackers.length === 0) {
|
|
243
244
|
return null;
|
|
@@ -253,12 +254,18 @@ const getAttackingEntity = (attackingBoard, lastAttackerIndex) => {
|
|
|
253
254
|
}
|
|
254
255
|
let attackingEntity = validAttackers[0];
|
|
255
256
|
let minNumberOfAttacks = attackingEntity.attacksPerformed || 0;
|
|
256
|
-
|
|
257
|
+
let index = 0;
|
|
258
|
+
for (let i = 0; i < validAttackers.length; i++) {
|
|
259
|
+
const entity = validAttackers[i];
|
|
257
260
|
if ((entity.attacksPerformed || 0) < minNumberOfAttacks) {
|
|
258
261
|
attackingEntity = entity;
|
|
259
262
|
minNumberOfAttacks = entity.attacksPerformed;
|
|
263
|
+
index = i;
|
|
260
264
|
}
|
|
261
265
|
}
|
|
266
|
+
for (let i = 0; i < index; i++) {
|
|
267
|
+
validAttackers[i].attacksPerformed = (validAttackers[i].attacksPerformed || 0) + 1;
|
|
268
|
+
}
|
|
262
269
|
if (!attackingEntity.attackImmediately) {
|
|
263
270
|
attackingEntity.attacksPerformed = (attackingEntity.attacksPerformed || 0) + 1;
|
|
264
271
|
}
|