@firestone-hs/simulate-bgs-battle 1.1.465 → 1.1.467
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/bgs-player-entity.d.ts +1 -0
- package/dist/bgs-player-entity.js.map +1 -1
- package/dist/simulation/attack.js +5 -1
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +2 -2
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/start-of-combat.d.ts +1 -1
- package/dist/simulation/start-of-combat.js +35 -6
- package/dist/simulation/start-of-combat.js.map +1 -1
- package/dist/simulation/summon-when-space.js +2 -2
- package/dist/simulation/summon-when-space.js.map +1 -1
- package/dist/utils.js +4 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,16 @@ const stats_1 = require("./stats");
|
|
|
15
15
|
const summon_when_space_1 = require("./summon-when-space");
|
|
16
16
|
const golden_1 = require("./utils/golden");
|
|
17
17
|
const handleStartOfCombat = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
18
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
19
|
+
const shouldRecomputeCurrentAttacker = true;
|
|
20
|
+
if (shouldRecomputeCurrentAttacker) {
|
|
21
|
+
currentAttacker =
|
|
22
|
+
playerBoard.length > opponentBoard.length
|
|
23
|
+
? 0
|
|
24
|
+
: opponentBoard.length > playerBoard.length
|
|
25
|
+
? 1
|
|
26
|
+
: Math.round(Math.random());
|
|
27
|
+
}
|
|
18
28
|
currentAttacker = handleStartOfCombatQuestRewards(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState);
|
|
19
29
|
currentAttacker = handleStartOfCombatAnomalies(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState);
|
|
20
30
|
currentAttacker = handlePreCombatHeroPowers(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState);
|
|
@@ -39,6 +49,7 @@ const handlePreCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, op
|
|
|
39
49
|
currentAttacker = handlePreCombatHeroPowersForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, false, gameState);
|
|
40
50
|
currentAttacker = handlePreCombatHeroPowersForPlayer(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, true, gameState);
|
|
41
51
|
}
|
|
52
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
42
53
|
return currentAttacker;
|
|
43
54
|
};
|
|
44
55
|
const handlePreCombatHeroPowersForPlayer = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, friendly, gameState) => {
|
|
@@ -111,29 +122,39 @@ const handleIllidanHeroPowers = (playerEntity, playerBoard, opponentEntity, oppo
|
|
|
111
122
|
currentAttacker = handlePlayerIllidanHeroPowers(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, true, gameState);
|
|
112
123
|
}
|
|
113
124
|
(0, attack_1.processMinionDeath)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
125
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
114
126
|
return currentAttacker;
|
|
115
127
|
};
|
|
116
128
|
exports.handleIllidanHeroPowers = handleIllidanHeroPowers;
|
|
117
129
|
const handleStartOfCombatMinions = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, playerBoardBefore, opponentBoardBefore, gameState) => {
|
|
118
|
-
let attackerForStart =
|
|
130
|
+
let attackerForStart = Math.random() < 0.5 ? 0 : 1;
|
|
119
131
|
const playerAttackers = [...playerBoard];
|
|
120
132
|
const opponentAttackers = [...opponentBoard];
|
|
121
133
|
while (playerAttackers.length > 0 || opponentAttackers.length > 0) {
|
|
134
|
+
let shouldUpdateNextPlayer = false;
|
|
122
135
|
if (attackerForStart === 0 && playerAttackers.length > 0) {
|
|
123
136
|
const attacker = playerAttackers.splice(0, 1)[0];
|
|
124
137
|
if (attacker.health <= 0 || attacker.definitelyDead) {
|
|
125
138
|
continue;
|
|
126
139
|
}
|
|
127
|
-
(0, exports.performStartOfCombatMinionsForPlayer)(attacker, playerBoard, playerEntity, opponentBoard, opponentEntity, playerBoardBefore, opponentBoardBefore, gameState);
|
|
140
|
+
shouldUpdateNextPlayer = (0, exports.performStartOfCombatMinionsForPlayer)(attacker, playerBoard, playerEntity, opponentBoard, opponentEntity, playerBoardBefore, opponentBoardBefore, gameState);
|
|
141
|
+
}
|
|
142
|
+
else if (attackerForStart === 0 && playerAttackers.length === 0) {
|
|
143
|
+
shouldUpdateNextPlayer = true;
|
|
128
144
|
}
|
|
129
145
|
else if (attackerForStart === 1 && opponentAttackers.length > 0) {
|
|
130
146
|
const attacker = opponentAttackers.splice(0, 1)[0];
|
|
131
147
|
if (attacker.health <= 0 || attacker.definitelyDead) {
|
|
132
148
|
continue;
|
|
133
149
|
}
|
|
134
|
-
(0, exports.performStartOfCombatMinionsForPlayer)(attacker, opponentBoard, opponentEntity, playerBoard, playerEntity, opponentBoardBefore, playerBoardBefore, gameState);
|
|
150
|
+
shouldUpdateNextPlayer = (0, exports.performStartOfCombatMinionsForPlayer)(attacker, opponentBoard, opponentEntity, playerBoard, playerEntity, opponentBoardBefore, playerBoardBefore, gameState);
|
|
151
|
+
}
|
|
152
|
+
else if (attackerForStart === 1 && opponentAttackers.length === 0) {
|
|
153
|
+
shouldUpdateNextPlayer = true;
|
|
154
|
+
}
|
|
155
|
+
if (shouldUpdateNextPlayer) {
|
|
156
|
+
attackerForStart = (attackerForStart + 1) % 2;
|
|
135
157
|
}
|
|
136
|
-
attackerForStart = (attackerForStart + 1) % 2;
|
|
137
158
|
}
|
|
138
159
|
return currentAttacker;
|
|
139
160
|
};
|
|
@@ -146,6 +167,7 @@ const handleStartOfCombatQuestRewards = (playerEntity, playerBoard, opponentEnti
|
|
|
146
167
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, gameState, false);
|
|
147
168
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState, true);
|
|
148
169
|
}
|
|
170
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
149
171
|
return currentAttacker;
|
|
150
172
|
};
|
|
151
173
|
const handleStartOfCombatSpells = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
@@ -157,11 +179,13 @@ const handleStartOfCombatSpells = (playerEntity, playerBoard, opponentEntity, op
|
|
|
157
179
|
currentAttacker = handleStartOfCombatSpellsForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, gameState);
|
|
158
180
|
currentAttacker = handleStartOfCombatSpellsForPlayer(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState);
|
|
159
181
|
}
|
|
182
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
160
183
|
return currentAttacker;
|
|
161
184
|
};
|
|
162
185
|
const handleStartOfCombatAnomalies = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState) => {
|
|
163
186
|
currentAttacker = handleStartOfCombatAnomaliesForPlayer(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState);
|
|
164
187
|
currentAttacker = handleStartOfCombatAnomaliesForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, gameState);
|
|
188
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
165
189
|
return currentAttacker;
|
|
166
190
|
};
|
|
167
191
|
const handleStartOfCombatQuestRewardsForPlayer = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, gameState, playerIsFriendly) => {
|
|
@@ -231,7 +255,6 @@ const handleStartOfCombatSpellsForPlayer = (playerEntity, playerBoard, opponentE
|
|
|
231
255
|
break;
|
|
232
256
|
case "BG28_603":
|
|
233
257
|
secret.scriptDataNum1 = (_b = secret.scriptDataNum1) !== null && _b !== void 0 ? _b : 1;
|
|
234
|
-
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
235
258
|
break;
|
|
236
259
|
case "BG28_519":
|
|
237
260
|
(0, utils_2.addStatsToBoard)(secret, playerBoard, playerEntity, 2, 1, gameState);
|
|
@@ -292,6 +315,7 @@ const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity
|
|
|
292
315
|
currentAttacker = handlePlayerStartOfCombatHeroPowers(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, false, gameState);
|
|
293
316
|
currentAttacker = handlePlayerStartOfCombatHeroPowers(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, true, gameState);
|
|
294
317
|
}
|
|
318
|
+
(0, summon_when_space_1.handleSummonsWhenSpace)(playerBoard, playerEntity, opponentBoard, opponentEntity, gameState);
|
|
295
319
|
return currentAttacker;
|
|
296
320
|
};
|
|
297
321
|
exports.handleStartOfCombatHeroPowers = handleStartOfCombatHeroPowers;
|
|
@@ -532,8 +556,9 @@ exports.getHeroPowerForHero = getHeroPowerForHero;
|
|
|
532
556
|
const performStartOfCombatMinionsForPlayer = (attacker, attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, attackingBoardBefore, defendingBoardBefore, gameState) => {
|
|
533
557
|
var _a, _b, _c, _d;
|
|
534
558
|
if (attackingBoardHero.startOfCombatDone) {
|
|
535
|
-
return;
|
|
559
|
+
return false;
|
|
536
560
|
}
|
|
561
|
+
let hasProcessed = true;
|
|
537
562
|
if (attacker.cardId === "BGS_019") {
|
|
538
563
|
const damage = attackingBoardBefore
|
|
539
564
|
.map((entity) => gameState.allCards.getCard(entity.cardId).races)
|
|
@@ -864,7 +889,11 @@ const performStartOfCombatMinionsForPlayer = (attacker, attackingBoard, attackin
|
|
|
864
889
|
gameState.spectator.registerPowerTarget(attacker, attacker, attackingBoard, attackingBoardHero, defendingBoardHero);
|
|
865
890
|
}
|
|
866
891
|
}
|
|
892
|
+
else {
|
|
893
|
+
hasProcessed = false;
|
|
894
|
+
}
|
|
867
895
|
(0, attack_1.processMinionDeath)(attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, gameState);
|
|
896
|
+
return hasProcessed;
|
|
868
897
|
};
|
|
869
898
|
exports.performStartOfCombatMinionsForPlayer = performStartOfCombatMinionsForPlayer;
|
|
870
899
|
const applyAllWillBurn = (board1, board1Hero, board2, board2Hero, sourceEntity, gameState) => {
|