@firestone-hs/simulate-bgs-battle 1.1.320 → 1.1.322
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/add-minion-to-board.d.ts +1 -0
- package/dist/simulation/add-minion-to-board.js +95 -76
- package/dist/simulation/add-minion-to-board.js.map +1 -1
- package/dist/simulation/attack.d.ts +2 -0
- package/dist/simulation/attack.js +29 -46
- package/dist/simulation/attack.js.map +1 -1
- package/dist/simulation/deathrattle-effects.d.ts +1 -0
- package/dist/simulation/deathrattle-effects.js +33 -1
- package/dist/simulation/deathrattle-effects.js.map +1 -1
- package/dist/simulation/deathrattle-spawns.js +15 -0
- package/dist/simulation/deathrattle-spawns.js.map +1 -1
- package/dist/simulation/remove-minion-from-board.d.ts +1 -1
- package/dist/simulation/remove-minion-from-board.js +4 -4
- package/dist/simulation/remove-minion-from-board.js.map +1 -1
- package/dist/simulation/spectator/spectator.js +11 -4
- package/dist/simulation/spectator/spectator.js.map +1 -1
- package/dist/simulation/start-of-combat.js +67 -0
- package/dist/simulation/start-of-combat.js.map +1 -1
- package/dist/utils.js +2 -2
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,4 +5,5 @@ import { SharedState } from './shared-state';
|
|
|
5
5
|
import { Spectator } from './spectator/spectator';
|
|
6
6
|
export declare const addMinionsToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionsToAdd: readonly BoardEntity[], allCards: AllCardsService, spectator: Spectator, sharedState: SharedState) => void;
|
|
7
7
|
export declare const addMinionToBoard: (board: BoardEntity[], boardHero: BgsPlayerEntity, otherHero: BgsPlayerEntity, index: number, minionToAdd: BoardEntity, allCards: AllCardsService, spectator: Spectator, sharedState: SharedState, performAfterSpawnEffects?: boolean) => void;
|
|
8
|
+
export declare const handleAddedMinionAuraEffect: (board: BoardEntity[], boardHero: BgsPlayerEntity, spawned: BoardEntity, allCards: AllCardsService, spectator: Spectator, sharedState: SharedState) => void;
|
|
8
9
|
export declare const handleMinionAddedAuraEffect: (spawnedCardId: string, spawned: BoardEntity, board: BoardEntity[], boardHero: BgsPlayerEntity, allCards: AllCardsService, spectator: Spectator, sharedState: SharedState) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleMinionAddedAuraEffect = exports.addMinionToBoard = exports.addMinionsToBoard = void 0;
|
|
3
|
+
exports.handleMinionAddedAuraEffect = exports.handleAddedMinionAuraEffect = exports.addMinionToBoard = exports.addMinionsToBoard = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
5
|
const cards_data_1 = require("../cards/cards-data");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
@@ -15,13 +15,14 @@ exports.addMinionsToBoard = addMinionsToBoard;
|
|
|
15
15
|
const addMinionToBoard = (board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, performAfterSpawnEffects = true) => {
|
|
16
16
|
board.splice(index, 0, minionToAdd);
|
|
17
17
|
handleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);
|
|
18
|
+
(0, exports.handleAddedMinionAuraEffect)(board, boardHero, minionToAdd, allCards, spectator, sharedState);
|
|
18
19
|
if (performAfterSpawnEffects) {
|
|
19
20
|
handleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
exports.addMinionToBoard = addMinionToBoard;
|
|
23
24
|
const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spectator, sharedState) => {
|
|
24
|
-
var _a
|
|
25
|
+
var _a;
|
|
25
26
|
switch (boardHero.heroPowerId) {
|
|
26
27
|
case "TB_BaconShop_HP_107":
|
|
27
28
|
spawned.taunt = true;
|
|
@@ -29,46 +30,8 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
|
|
|
29
30
|
(0, utils_1.modifyHealth)(spawned, 2, board, allCards);
|
|
30
31
|
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
31
32
|
break;
|
|
32
|
-
case "BG20_HERO_280p3":
|
|
33
|
-
(0, utils_1.modifyAttack)(spawned, 2, board, allCards);
|
|
34
|
-
(0, utils_1.modifyHealth)(spawned, 2, board, allCards);
|
|
35
|
-
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
36
|
-
break;
|
|
37
|
-
case "TB_BaconShop_HP_015":
|
|
38
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MECH, allCards)) {
|
|
39
|
-
(0, utils_1.modifyAttack)(spawned, 2, board, allCards);
|
|
40
|
-
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
if (!!((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
45
|
-
for (const quest of boardHero.questRewards) {
|
|
46
|
-
switch (quest) {
|
|
47
|
-
case "BG24_Reward_364":
|
|
48
|
-
spawned.attack += 7;
|
|
49
|
-
spawned.health += 7;
|
|
50
|
-
spawned.enchantments.push({
|
|
51
|
-
cardId: "BG24_Reward_364e",
|
|
52
|
-
originEntityId: undefined,
|
|
53
|
-
timing: sharedState.currentEntityId++,
|
|
54
|
-
});
|
|
55
|
-
break;
|
|
56
|
-
case "BG24_Reward_125":
|
|
57
|
-
spawned.attack += 4;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const cardIds = [spawned.cardId, ...((_b = spawned.additionalCards) !== null && _b !== void 0 ? _b : [])];
|
|
63
|
-
for (const spawnedCardId of cardIds) {
|
|
64
|
-
(0, exports.handleMinionAddedAuraEffect)(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);
|
|
65
|
-
}
|
|
66
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, allCards)) {
|
|
67
|
-
if (boardHero.globalInfo.UndeadAttackBonus > 0) {
|
|
68
|
-
(0, utils_1.modifyAttack)(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);
|
|
69
|
-
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
70
|
-
}
|
|
71
33
|
}
|
|
34
|
+
const cardIds = [spawned.cardId, ...((_a = spawned.additionalCards) !== null && _a !== void 0 ? _a : [])];
|
|
72
35
|
if (cardIds.some((cardId) => cards_data_1.WHELP_CARD_IDS.includes(cardId))) {
|
|
73
36
|
const manyWhelps = board.filter((entity) => entity.cardId === "BG22_HERO_305_Buddy");
|
|
74
37
|
const goldenManyWhelps = board.filter((entity) => entity.cardId === "BG22_HERO_305_Buddy_G");
|
|
@@ -85,41 +48,6 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
|
|
|
85
48
|
}
|
|
86
49
|
for (const entity of board) {
|
|
87
50
|
switch (entity.cardId) {
|
|
88
|
-
case "BG_EX1_507":
|
|
89
|
-
case "TB_BaconUps_008":
|
|
90
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {
|
|
91
|
-
spawned.attack += entity.cardId === "TB_BaconUps_008" ? 4 : 2;
|
|
92
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
case "BG26_805":
|
|
95
|
-
case "BG26_805_G":
|
|
96
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {
|
|
97
|
-
spawned.attack += entity.cardId === "BG26_805_G" ? 4 : 2;
|
|
98
|
-
}
|
|
99
|
-
break;
|
|
100
|
-
case "BG_NEW1_027":
|
|
101
|
-
case "TB_BaconUps_136":
|
|
102
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {
|
|
103
|
-
spawned.attack += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
|
|
104
|
-
spawned.health += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
|
|
105
|
-
}
|
|
106
|
-
break;
|
|
107
|
-
case "TB_BaconShop_HERO_52_Buddy":
|
|
108
|
-
case "TB_BaconShop_HERO_52_Buddy_G":
|
|
109
|
-
spawned.attack += entity.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
|
|
110
|
-
break;
|
|
111
|
-
case "BG21_039":
|
|
112
|
-
case "BG21_039_G":
|
|
113
|
-
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {
|
|
114
|
-
spawned.attack += entity.cardId === "BG21_039_G" ? 2 : 1;
|
|
115
|
-
}
|
|
116
|
-
break;
|
|
117
|
-
case "BG25_043":
|
|
118
|
-
case "BG25_043_G":
|
|
119
|
-
if (spawned.divineShield) {
|
|
120
|
-
spawned.attack += entity.cardId === "BG25_043_G" ? 12 : 6;
|
|
121
|
-
}
|
|
122
|
-
break;
|
|
123
51
|
case "TB_BaconShop_HERO_92_Buddy":
|
|
124
52
|
case "TB_BaconShop_HERO_92_Buddy_G":
|
|
125
53
|
if (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {
|
|
@@ -189,6 +117,89 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
|
|
|
189
117
|
spectator.registerPowerTarget(entity, entity, board);
|
|
190
118
|
}
|
|
191
119
|
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const handleAddedMinionAuraEffect = (board, boardHero, spawned, allCards, spectator, sharedState) => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
switch (boardHero.heroPowerId) {
|
|
126
|
+
case "BG20_HERO_280p3":
|
|
127
|
+
(0, utils_1.modifyAttack)(spawned, 2, board, allCards);
|
|
128
|
+
(0, utils_1.modifyHealth)(spawned, 2, board, allCards);
|
|
129
|
+
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
130
|
+
break;
|
|
131
|
+
case "TB_BaconShop_HP_015":
|
|
132
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MECH, allCards)) {
|
|
133
|
+
(0, utils_1.modifyAttack)(spawned, 2, board, allCards);
|
|
134
|
+
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
if (!!((_a = boardHero.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
139
|
+
for (const quest of boardHero.questRewards) {
|
|
140
|
+
switch (quest) {
|
|
141
|
+
case "BG24_Reward_364":
|
|
142
|
+
spawned.attack += 7;
|
|
143
|
+
spawned.health += 7;
|
|
144
|
+
spawned.enchantments.push({
|
|
145
|
+
cardId: "BG24_Reward_364e",
|
|
146
|
+
originEntityId: undefined,
|
|
147
|
+
timing: sharedState.currentEntityId++,
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
case "BG24_Reward_125":
|
|
151
|
+
spawned.attack += 4;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const cardIds = [spawned.cardId, ...((_b = spawned.additionalCards) !== null && _b !== void 0 ? _b : [])];
|
|
157
|
+
for (const spawnedCardId of cardIds) {
|
|
158
|
+
(0, exports.handleMinionAddedAuraEffect)(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);
|
|
159
|
+
}
|
|
160
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, allCards)) {
|
|
161
|
+
if (boardHero.globalInfo.UndeadAttackBonus > 0) {
|
|
162
|
+
(0, utils_1.modifyAttack)(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);
|
|
163
|
+
(0, utils_1.afterStatsUpdate)(spawned, board, allCards);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (const entity of board) {
|
|
167
|
+
switch (entity.cardId) {
|
|
168
|
+
case "BG_EX1_507":
|
|
169
|
+
case "TB_BaconUps_008":
|
|
170
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {
|
|
171
|
+
spawned.attack += entity.cardId === "TB_BaconUps_008" ? 4 : 2;
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case "BG26_805":
|
|
175
|
+
case "BG26_805_G":
|
|
176
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {
|
|
177
|
+
spawned.attack += entity.cardId === "BG26_805_G" ? 4 : 2;
|
|
178
|
+
}
|
|
179
|
+
break;
|
|
180
|
+
case "BG_NEW1_027":
|
|
181
|
+
case "TB_BaconUps_136":
|
|
182
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {
|
|
183
|
+
spawned.attack += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
|
|
184
|
+
spawned.health += entity.cardId === "TB_BaconUps_136" ? 2 : 1;
|
|
185
|
+
}
|
|
186
|
+
break;
|
|
187
|
+
case "TB_BaconShop_HERO_52_Buddy":
|
|
188
|
+
case "TB_BaconShop_HERO_52_Buddy_G":
|
|
189
|
+
spawned.attack += entity.cardId === "TB_BaconShop_HERO_52_Buddy_G" ? 6 : 3;
|
|
190
|
+
break;
|
|
191
|
+
case "BG21_039":
|
|
192
|
+
case "BG21_039_G":
|
|
193
|
+
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {
|
|
194
|
+
spawned.attack += entity.cardId === "BG21_039_G" ? 2 : 1;
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
case "BG25_043":
|
|
198
|
+
case "BG25_043_G":
|
|
199
|
+
if (spawned.divineShield) {
|
|
200
|
+
spawned.attack += entity.cardId === "BG25_043_G" ? 12 : 6;
|
|
201
|
+
}
|
|
202
|
+
break;
|
|
192
203
|
case "BG27_030":
|
|
193
204
|
case "BG27_030_G":
|
|
194
205
|
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {
|
|
@@ -198,6 +209,7 @@ const handleSpawnEffect = (board, boardHero, otherHero, spawned, allCards, spect
|
|
|
198
209
|
}
|
|
199
210
|
}
|
|
200
211
|
};
|
|
212
|
+
exports.handleAddedMinionAuraEffect = handleAddedMinionAuraEffect;
|
|
201
213
|
const handleMinionAddedAuraEffect = (spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState) => {
|
|
202
214
|
switch (spawnedCardId) {
|
|
203
215
|
case "BG_NEW1_027":
|
|
@@ -346,6 +358,13 @@ const handleAfterSpawnEffect = (board, spawned, allCards, spectator) => {
|
|
|
346
358
|
(0, utils_1.afterStatsUpdate)(entity, board, allCards);
|
|
347
359
|
}
|
|
348
360
|
break;
|
|
361
|
+
case "BG_TTN_078":
|
|
362
|
+
case "BG_TTN_078_G":
|
|
363
|
+
if (spawned.attack > entity.attack) {
|
|
364
|
+
const observerBuff = entity.cardId === "BG_TTN_078_G" ? 2 : 1;
|
|
365
|
+
(0, utils_1.addStatsToBoard)(entity, board, observerBuff, 0, allCards, spectator);
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
349
368
|
case "BG26_RLK_824":
|
|
350
369
|
if ((0, utils_1.hasCorrectTribe)(spawned, reference_data_1.Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {
|
|
351
370
|
(0, utils_1.modifyAttack)(spawned, 1, board, allCards);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAOkB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ACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE;oBAC5F,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\t// if (otherHero.heroPowerId === CardIds.AllWillBurnBattlegrounds) {\r\n\t// \tspawned.attack += 3;\r\n\t// }\r\n\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\t// case CardIds.AllWillBurnBattlegrounds:\r\n\t\t// \tspawned.attack += 3;\r\n\t\t// \tbreak;\r\n\t\tcase CardIds.SproutItOut:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Tinker_TB_BaconShop_HP_015:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack += entity.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot_BGS_071:\r\n\t\t\tcase CardIds.DeflectOBot_TB_BaconUps_123:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBot_TB_BaconUps_123 ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal_BGS_204:\r\n\t\t\tcase CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\tboard.forEach((e) => {\r\n\t\t\t\te.attack += spawned.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\t// case CardIds.MurlocTidecallerLegacy:\r\n\t\t\t// case CardIds.MurlocTidecallerCore:\r\n\t\t\t// \tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t// \tconst buffAmount =\r\n\t\t\t// \t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t// \tif (buffAmount > 0) {\r\n\t\t\t// \t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t// \t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t// \t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.Swampstriker_BG22_401:\r\n\t\t\tcase CardIds.Swampstriker_BG22_401_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst multiplier2 = entity.cardId === CardIds.Swampstriker_BG22_401_G ? 2 : 1;\r\n\t\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper_BG25_042:\r\n\t\t\tcase CardIds.Felstomper_BG25_042_G:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.Felstomper_BG25_042_G ? 6 : 3;\r\n\t\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 6 : 3;\r\n\t\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370:\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjaw_BG26_370_G ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"add-minion-to-board.js","sourceRoot":"","sources":["../../src/simulation/add-minion-to-board.ts"],"names":[],"mappings":";;;AAAA,iEAA8E;AAG9E,oDAAqD;AACrD,oCAQkB;AAIX,MAAM,iBAAiB,GAAG,CAChC,KAAoB,EACpB,SAA0B,EAC1B,SAA0B,EAC1B,KAAa,EACb,YAAoC,EACpC,QAAyB,EACzB,SAAoB,EACpB,WAAwB,EACjB,EAAE;IACT,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC;IACxC,KAAK,MAAM,WAAW,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;QACtD,IAAA,wBAAgB,EAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;KAC3G;IACD,uBAAuB,CAAC,KAAK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AAE,QAAQ,CAAC,CAAC;iBAC1C;gBACD,MAAM;YACP,kBAAwC;YACxC;gBACC,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE;oBACnC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,mBAAyC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACpF,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;iBACrE;gBACD,MAAM;YAGP;gBACC,IAAI,IAAA,uBAAe,EAAC,OAAO,EAAE,qBAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ,EAAE;oBAC5F,IAAA,oBAAY,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,IAAA,wBAAgB,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;oBAC1C,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;iBACrD;gBACD,MAAM;SACP;KACD;AACF,CAAC,CAAC","sourcesContent":["import { AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { WHELP_CARD_IDS } from '../cards/cards-data';\r\nimport {\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const addMinionsToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionsToAdd: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tboard.splice(index, 0, ...minionsToAdd);\r\n\tfor (const minionToAdd of [...minionsToAdd].reverse()) {\r\n\t\taddMinionToBoard(board, boardHero, otherHero, index, minionToAdd, allCards, spectator, sharedState, false);\r\n\t}\r\n\thandleAfterSpawnEffects(board, minionsToAdd, allCards, spectator);\r\n};\r\n\r\nexport const addMinionToBoard = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tindex: number,\r\n\tminionToAdd: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n\tperformAfterSpawnEffects = true,\r\n): void => {\r\n\tboard.splice(index, 0, minionToAdd);\r\n\t// Minion has already been removed from the board in the previous step\r\n\thandleSpawnEffect(board, boardHero, otherHero, minionToAdd, allCards, spectator, sharedState);\r\n\thandleAddedMinionAuraEffect(board, boardHero, minionToAdd, allCards, spectator, sharedState);\r\n\tif (performAfterSpawnEffects) {\r\n\t\thandleAfterSpawnEffects(board, [minionToAdd], allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\totherHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.SproutItOut:\r\n\t\t\tspawned.taunt = true;\r\n\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\r\n\t// https://twitter.com/LoewenMitchell/status/1491879869457879040\r\n\tif (cardIds.some((cardId) => WHELP_CARD_IDS.includes(cardId as CardIds))) {\r\n\t\tconst manyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy);\r\n\t\tconst goldenManyWhelps = board.filter((entity) => entity.cardId === CardIds.ManyWhelps_BG22_HERO_305_Buddy_G);\r\n\t\tmanyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\tmodifyHealth(entity, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t\tgoldenManyWhelps.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, 4, board, allCards);\r\n\t\t\tmodifyHealth(entity, 4, board, allCards);\r\n\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t});\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy:\r\n\t\t\tcase CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G:\r\n\t\t\t\tif (allCards.getCard(spawned.cardId).techLevel === boardHero.tavernTier) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.BabyYshaarj_TB_BaconShop_HERO_92_Buddy_G ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\t// This has to happen after greybough's hero power kicks in\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy:\r\n\t\t\tcase CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G:\r\n\t\t\t\tif (spawned.taunt) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.WanderingTreant_TB_BaconShop_HERO_95_Buddy_G ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CobaltGuardian:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, 2, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.DeflectOBot_BGS_071:\r\n\t\t\tcase CardIds.DeflectOBot_TB_BaconUps_123:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.DeflectOBot_TB_BaconUps_123 ? 4 : 2;\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tupdateDivineShield(entity, board, true, allCards);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bigfernal_BGS_204:\r\n\t\t\tcase CardIds.Bigfernal_TB_BaconUps_304:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.Bigfernal_TB_BaconUps_304 ? 2 : 1;\r\n\t\t\t\t\tmodifyAttack(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MamaBear_BGS_021:\r\n\t\t\tcase CardIds.MamaBear_TB_BaconUps_090:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.MamaBear_TB_BaconUps_090 ? 8 : 4;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tmodifyHealth(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PackLeader_BGS_017:\r\n\t\t\tcase CardIds.PackLeader_TB_BaconUps_086:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards)) {\r\n\t\t\t\t\tconst statsBonus = entity.cardId === CardIds.PackLeader_TB_BaconUps_086 ? 4 : 2;\r\n\t\t\t\t\tmodifyAttack(spawned, statsBonus, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\nexport const handleAddedMinionAuraEffect = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (boardHero.heroPowerId) {\r\n\t\tcase CardIds.KurtrusAshfallen_CloseThePortal:\r\n\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\tmodifyHealth(spawned, 2, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Tinker_TB_BaconShop_HP_015:\r\n\t\t\tif (hasCorrectTribe(spawned, Race.MECH, allCards)) {\r\n\t\t\t\tmodifyAttack(spawned, 2, board, allCards);\r\n\t\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t}\r\n\r\n\tif (!!boardHero.questRewards?.length) {\r\n\t\tfor (const quest of boardHero.questRewards) {\r\n\t\t\tswitch (quest) {\r\n\t\t\t\tcase CardIds.VolatileVenom:\r\n\t\t\t\t\tspawned.attack += 7;\r\n\t\t\t\t\tspawned.health += 7;\r\n\t\t\t\t\tspawned.enchantments.push({\r\n\t\t\t\t\t\tcardId: CardIds.VolatileVenom_VolatileEnchantment,\r\n\t\t\t\t\t\toriginEntityId: undefined,\r\n\t\t\t\t\t\ttiming: sharedState.currentEntityId++,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase CardIds.TheSmokingGun:\r\n\t\t\t\t\tspawned.attack += 4;\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tconst cardIds = [spawned.cardId, ...(spawned.additionalCards ?? [])];\r\n\tfor (const spawnedCardId of cardIds) {\r\n\t\thandleMinionAddedAuraEffect(spawnedCardId, spawned, board, boardHero, allCards, spectator, sharedState);\r\n\t}\r\n\r\n\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards)) {\r\n\t\tif (boardHero.globalInfo.UndeadAttackBonus > 0) {\r\n\t\t\tmodifyAttack(spawned, boardHero.globalInfo.UndeadAttackBonus, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t}\r\n\t}\r\n\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.MURLOC, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.PIRATE, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\tspawned.health += entity.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\t\tspawned.attack += entity.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.DEMON, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.Kathranatir_BG21_039_G ? 2 : 1;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\t\tif (spawned.divineShield) {\r\n\t\t\t\t\tspawned.attack += entity.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tspawned.attack += (entity.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n\r\nexport const handleMinionAddedAuraEffect = (\r\n\tspawnedCardId: string,\r\n\tspawned: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n\tsharedState: SharedState,\r\n): void => {\r\n\tswitch (spawnedCardId) {\r\n\t\tcase CardIds.SouthseaCaptainLegacy_BG_NEW1_027:\r\n\t\tcase CardIds.SouthseaCaptainLegacy_TB_BaconUps_136:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.PIRATE, allCards))\r\n\t\t\t\t// Other\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t\te.health += spawned.cardId === CardIds.SouthseaCaptainLegacy_TB_BaconUps_136 ? 2 : 1;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.MurlocWarleaderLegacy_BG_EX1_507:\r\n\t\tcase CardIds.MurlocWarleaderLegacy_TB_BaconUps_008:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.MurlocWarleaderLegacy_TB_BaconUps_008 ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.HummingBird_BG26_805:\r\n\t\tcase CardIds.HummingBird_BG26_805_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.BEAST, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.HummingBird_BG26_805_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy:\r\n\t\tcase CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G:\r\n\t\t\tboard.forEach((e) => {\r\n\t\t\t\te.attack += spawned.cardId === CardIds.LadySinestra_TB_BaconShop_HERO_52_Buddy_G ? 6 : 3;\r\n\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.Kathranatir_BG21_039:\r\n\t\tcase CardIds.Kathranatir_BG21_039_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.DEMON, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.Kathranatir_BG21_039_G ? 4 : 2;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t\tcase CardIds.CyborgDrake_BG25_043:\r\n\t\tcase CardIds.CyborgDrake_BG25_043_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => e.divineShield)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += spawned.cardId === CardIds.CyborgDrake_BG25_043_G ? 12 : 6;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\r\n\t\tcase CardIds.EternalKnight_BG25_008:\r\n\t\tcase CardIds.EternalKnight_BG25_008_G:\r\n\t\t\tconst multiplierKnight = spawned.cardId === CardIds.EternalKnight_BG25_008_G ? 2 : 1;\r\n\t\t\tconst statsBonusKnight = multiplierKnight * boardHero.globalInfo.EternalKnightsDeadThisGame;\r\n\t\t\tmodifyAttack(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tmodifyHealth(spawned, statsBonusKnight, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537:\r\n\t\tcase CardIds.FlourishingFrostling_BG26_537_G:\r\n\t\t\tconst multiplierFrostling = spawned.cardId === CardIds.FlourishingFrostling_BG26_537_G ? 2 : 1;\r\n\t\t\tconst statsBonusFrostling = multiplierFrostling * boardHero.globalInfo.FrostlingBonus;\r\n\t\t\tmodifyAttack(spawned, statsBonusFrostling, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.RotHideGnoll_BG25_013:\r\n\t\tcase CardIds.RotHideGnoll_BG25_013_G:\r\n\t\t\tconst multiplierGnoll = spawned.cardId === CardIds.RotHideGnoll_BG25_013_G ? 2 : 1;\r\n\t\t\tconst statsBonusGnoll =\r\n\t\t\t\tmultiplierGnoll * sharedState.deaths.filter((e) => e.friendly === spawned.friendly).length;\r\n\t\t\tmodifyAttack(spawned, statsBonusGnoll, board, allCards);\r\n\t\t\tafterStatsUpdate(spawned, board, allCards);\r\n\t\t\tbreak;\r\n\t\tcase CardIds.SoreLoser_BG27_030:\r\n\t\tcase CardIds.SoreLoser_BG27_030_G:\r\n\t\t\tboard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => e.entityId !== spawned.entityId)\r\n\t\t\t\t.forEach((e) => {\r\n\t\t\t\t\te.attack += (spawned.cardId === CardIds.SoreLoser_BG27_030_G ? 2 : 1) * boardHero.tavernTier;\r\n\t\t\t\t});\r\n\t\t\tbreak;\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffects = (\r\n\tboard: BoardEntity[],\r\n\tallSpawned: readonly BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const spawned of allSpawned) {\r\n\t\thandleAfterSpawnEffect(board, spawned, allCards, spectator);\r\n\t}\r\n};\r\n\r\nconst handleAfterSpawnEffect = (\r\n\tboard: BoardEntity[],\r\n\tspawned: BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// console.debug('after spawn', stringifySimpleCard(spawned, allCards), stringifySimple(board, allCards));\r\n\tfor (const entity of board) {\r\n\t\tswitch (entity.cardId) {\r\n\t\t\t// case CardIds.MurlocTidecallerLegacy:\r\n\t\t\t// case CardIds.MurlocTidecallerCore:\r\n\t\t\t// \tconst multiplier = entity.cardId === CardIds.MurlocTidecallerBattlegrounds ? 2 : 1;\r\n\t\t\t// \tconst buffAmount =\r\n\t\t\t// \t\tmultiplier * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t// \tif (buffAmount > 0) {\r\n\t\t\t// \t\tmodifyAttack(entity, buffAmount, board, allCards);\r\n\t\t\t// \t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t// \t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t// \t}\r\n\t\t\t// \tbreak;\r\n\t\t\tcase CardIds.Swampstriker_BG22_401:\r\n\t\t\tcase CardIds.Swampstriker_BG22_401_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst multiplier2 = entity.cardId === CardIds.Swampstriker_BG22_401_G ? 2 : 1;\r\n\t\t\t\t\tconst buffAmount2 =\r\n\t\t\t\t\t\tmultiplier2 * (isCorrectTribe(allCards.getCard(spawned.cardId).races, Race.MURLOC) ? 1 : 0);\r\n\t\t\t\t\tif (buffAmount2 > 0) {\r\n\t\t\t\t\t\tmodifyAttack(entity, buffAmount2, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Felstomper_BG25_042:\r\n\t\t\tcase CardIds.Felstomper_BG25_042_G:\r\n\t\t\t\t// console.debug('felstomper');\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst felstomperBuff = entity.cardId === CardIds.Felstomper_BG25_042_G ? 6 : 3;\r\n\t\t\t\t\tboard.forEach((e) => {\r\n\t\t\t\t\t\tmodifyAttack(e, felstomperBuff, board, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(e, board, allCards);\r\n\t\t\t\t\t\tspectator.registerPowerTarget(entity, e, board);\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.XyloBones_BG26_172:\r\n\t\t\tcase CardIds.XyloBones_BG26_172_G:\r\n\t\t\t\tif (entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst xylobonesBuff = entity.cardId === CardIds.XyloBones_BG26_172_G ? 6 : 3;\r\n\t\t\t\t\tmodifyHealth(entity, xylobonesBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804:\r\n\t\t\tcase CardIds.OctosariWrapGod_BG26_804_G:\r\n\t\t\t\tconst octoStats = entity.cardId === CardIds.OctosariWrapGod_BG26_804_G ? 4 : 2;\r\n\t\t\t\tentity.scriptDataNum1 += octoStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802:\r\n\t\t\tcase CardIds.BananaSlamma_BG26_802_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst bananaStatBuff = entity.cardId === CardIds.BananaSlamma_BG26_802_G ? 3 : 2;\r\n\t\t\t\t\tspawned.attack = spawned.attack * bananaStatBuff;\r\n\t\t\t\t\tspawned.health = spawned.health * bananaStatBuff;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370:\r\n\t\t\tcase CardIds.HungrySnapjaw_BG26_370_G:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.BEAST, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tconst snapjawBuff = entity.cardId === CardIds.HungrySnapjaw_BG26_370_G ? 2 : 1;\r\n\t\t\t\t\tmodifyHealth(entity, snapjawBuff, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078:\r\n\t\t\tcase CardIds.ObserverOfMyths_BG_TTN_078_G:\r\n\t\t\t\tif (spawned.attack > entity.attack) {\r\n\t\t\t\t\tconst observerBuff = entity.cardId === CardIds.ObserverOfMyths_BG_TTN_078_G ? 2 : 1;\r\n\t\t\t\t\taddStatsToBoard(entity, board, observerBuff, 0, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t// Putricide-only\r\n\t\t\tcase CardIds.ArmsDealer_BG26_RLK_824:\r\n\t\t\t\tif (hasCorrectTribe(spawned, Race.UNDEAD, allCards) && entity.entityId !== spawned.entityId) {\r\n\t\t\t\t\tmodifyAttack(spawned, 1, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n};\r\n"]}
|
|
@@ -5,6 +5,7 @@ import { CardsData } from '../cards/cards-data';
|
|
|
5
5
|
import { SharedState } from './shared-state';
|
|
6
6
|
import { Spectator } from './spectator/spectator';
|
|
7
7
|
export declare const simulateAttack: (attackingBoard: BoardEntity[], attackingBoardHero: BgsPlayerEntity, defendingBoard: BoardEntity[], defendingBoardHero: BgsPlayerEntity, lastAttackerEntityId: number, allCards: AllCardsService, spawns: CardsData, sharedState: SharedState, spectator: Spectator, forceAttackingEntityIndex?: number) => number;
|
|
8
|
+
export declare const doFullAttack: (attackingEntity: BoardEntity, attackingBoard: BoardEntity[], attackingBoardHero: BgsPlayerEntity, defendingEntity: BoardEntity, defendingBoard: BoardEntity[], defendingBoardHero: BgsPlayerEntity, allCards: AllCardsService, spawns: CardsData, sharedState: SharedState, spectator: Spectator) => void;
|
|
8
9
|
export declare const findNearestEnemies: (attackingBoard: BoardEntity[], entity: BoardEntity, entityIndexFromRight: number, defendingBoard: BoardEntity[], numberOfTargets: number, allCards: AllCardsService) => BoardEntity[];
|
|
9
10
|
export declare const getNeighbours: (board: BoardEntity[], entity: BoardEntity, deadEntityIndexFromRight?: number) => readonly BoardEntity[];
|
|
10
11
|
export declare const dealDamageToRandomEnemy: (boardToBeDamaged: BoardEntity[], boardToBeDamagedHero: BgsPlayerEntity, damageSource: BoardEntity, damage: number, boardWithAttackOrigin: BoardEntity[], boardWithAttackOriginHero: BgsPlayerEntity, allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => void;
|
|
@@ -14,4 +15,5 @@ export declare const bumpEntities: (entity: BoardEntity, bumpInto: BoardEntity,
|
|
|
14
15
|
export declare const processMinionDeath: (board1: BoardEntity[], board1Hero: BgsPlayerEntity, board2: BoardEntity[], board2Hero: BgsPlayerEntity, allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => void;
|
|
15
16
|
export declare const applyOnAttackBuffs: (attacker: BoardEntity, attackingBoard: BoardEntity[], allCards: AllCardsService, spectator: Spectator) => void;
|
|
16
17
|
export declare const applyOnBeingAttackedBuffs: (attackerEntity: BoardEntity, defendingEntity: BoardEntity, defendingBoard: BoardEntity[], allCards: AllCardsService, spectator: Spectator) => void;
|
|
18
|
+
export declare const buildBoardAfterDeathrattleSpawns: (boardWithKilledMinion: BoardEntity[], boardWithKilledMinionHero: BgsPlayerEntity, deadEntity: BoardEntity, deadMinionIndexFromRight2: number, opponentBoard: BoardEntity[], opponentBoardHero: BgsPlayerEntity, entitiesDeadThisAttack: readonly BoardEntity[], allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => void;
|
|
17
19
|
export declare const performEntitySpawns: (candidateEntities: readonly BoardEntity[], boardWithKilledMinion: BoardEntity[], boardWithKilledMinionHero: BgsPlayerEntity, spawnSourceEntity: BoardEntity | BgsPlayerEntity, spawnSourceEntityIndexFromRight: number, opponentBoard: BoardEntity[], opponentBoardHero: BgsPlayerEntity, allCards: AllCardsService, cardsData: CardsData, sharedState: SharedState, spectator: Spectator) => readonly BoardEntity[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.performEntitySpawns = exports.applyOnBeingAttackedBuffs = exports.applyOnAttackBuffs = exports.processMinionDeath = exports.bumpEntities = exports.getDefendingEntity = exports.dealDamageToEnemy = exports.dealDamageToRandomEnemy = exports.getNeighbours = exports.findNearestEnemies = exports.simulateAttack = void 0;
|
|
3
|
+
exports.performEntitySpawns = exports.buildBoardAfterDeathrattleSpawns = exports.applyOnBeingAttackedBuffs = exports.applyOnAttackBuffs = exports.processMinionDeath = exports.bumpEntities = exports.getDefendingEntity = exports.dealDamageToEnemy = exports.dealDamageToRandomEnemy = exports.getNeighbours = exports.findNearestEnemies = exports.doFullAttack = exports.simulateAttack = void 0;
|
|
4
4
|
const reference_data_1 = require("@firestone-hs/reference-data");
|
|
5
5
|
const utils_1 = require("../services/utils");
|
|
6
6
|
const simulate_bgs_battle_1 = require("../simulate-bgs-battle");
|
|
@@ -30,23 +30,9 @@ const simulateAttack = (attackingBoard, attackingBoardHero, defendingBoard, defe
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
if (attackingBoard.find((entity) => entity.entityId === attackingEntity.entityId)) {
|
|
33
|
-
(0, exports.applyOnAttackBuffs)(attackingEntity, attackingBoard, allCards, spectator);
|
|
34
33
|
const defendingEntity = (0, exports.getDefendingEntity)(defendingBoard, attackingEntity);
|
|
35
34
|
if (defendingEntity) {
|
|
36
|
-
|
|
37
|
-
(0, exports.applyOnBeingAttackedBuffs)(attackingEntity, defendingEntity, defendingBoard, allCards, spectator);
|
|
38
|
-
performAttack(attackingEntity, defendingEntity, attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator);
|
|
39
|
-
applyAfterAttackEffects(attackingEntity, attackingBoard, attackingBoardHero, allCards, spectator);
|
|
40
|
-
(0, exports.processMinionDeath)(attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator);
|
|
41
|
-
if (defendingEntity.health > 0 &&
|
|
42
|
-
!defendingEntity.definitelyDead &&
|
|
43
|
-
(defendingEntity.cardId === "BGS_060" ||
|
|
44
|
-
defendingEntity.cardId === "TB_BaconUps_150")) {
|
|
45
|
-
defendingEntity.attackImmediately = true;
|
|
46
|
-
if (defendingEntity.attackImmediately) {
|
|
47
|
-
(0, exports.simulateAttack)(defendingBoard, defendingBoardHero, attackingBoard, attackingBoardHero, null, allCards, spawns, sharedState, spectator);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
35
|
+
(0, exports.doFullAttack)(attackingEntity, attackingBoard, attackingBoardHero, defendingEntity, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator);
|
|
50
36
|
}
|
|
51
37
|
else {
|
|
52
38
|
attackingEntity.attackImmediately = false;
|
|
@@ -58,6 +44,24 @@ const simulateAttack = (attackingBoard, attackingBoardHero, defendingBoard, defe
|
|
|
58
44
|
return attackingEntityIndex;
|
|
59
45
|
};
|
|
60
46
|
exports.simulateAttack = simulateAttack;
|
|
47
|
+
const doFullAttack = (attackingEntity, attackingBoard, attackingBoardHero, defendingEntity, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator) => {
|
|
48
|
+
(0, exports.applyOnAttackBuffs)(attackingEntity, attackingBoard, allCards, spectator);
|
|
49
|
+
spectator.registerAttack(attackingEntity, defendingEntity, attackingBoard, defendingBoard);
|
|
50
|
+
(0, exports.applyOnBeingAttackedBuffs)(attackingEntity, defendingEntity, defendingBoard, allCards, spectator);
|
|
51
|
+
performAttack(attackingEntity, defendingEntity, attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator);
|
|
52
|
+
applyAfterAttackEffects(attackingEntity, attackingBoard, attackingBoardHero, allCards, spectator);
|
|
53
|
+
(0, exports.processMinionDeath)(attackingBoard, attackingBoardHero, defendingBoard, defendingBoardHero, allCards, spawns, sharedState, spectator);
|
|
54
|
+
if (defendingEntity.health > 0 &&
|
|
55
|
+
!defendingEntity.definitelyDead &&
|
|
56
|
+
(defendingEntity.cardId === "BGS_060" ||
|
|
57
|
+
defendingEntity.cardId === "TB_BaconUps_150")) {
|
|
58
|
+
defendingEntity.attackImmediately = true;
|
|
59
|
+
if (defendingEntity.attackImmediately) {
|
|
60
|
+
(0, exports.simulateAttack)(defendingBoard, defendingBoardHero, attackingBoard, attackingBoardHero, null, allCards, spawns, sharedState, spectator);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.doFullAttack = doFullAttack;
|
|
61
65
|
const applyAfterAttackEffects = (attackingEntity, attackingBoard, attackingBoardHero, allCards, spectator) => {
|
|
62
66
|
var _a;
|
|
63
67
|
if (attackingEntity.cardId === "BG20_104" || attackingEntity.cardId === "BG20_104_G") {
|
|
@@ -231,7 +235,7 @@ const triggerRandomDeathrattle = (sourceEntity, attackingBoard, attackingBoardHe
|
|
|
231
235
|
}
|
|
232
236
|
spectator.registerPowerTarget(sourceEntity, targetEntity, attackingBoard);
|
|
233
237
|
const indexFromRight = attackingBoard.length - (attackingBoard.indexOf(targetEntity) + 1);
|
|
234
|
-
buildBoardAfterDeathrattleSpawns(attackingBoard, attackingBoardHero, targetEntity, indexFromRight, defendingBoard, defendingBoardHero, [], allCards, spawns, sharedState, spectator);
|
|
238
|
+
(0, exports.buildBoardAfterDeathrattleSpawns)(attackingBoard, attackingBoardHero, targetEntity, indexFromRight, defendingBoard, defendingBoardHero, [], allCards, spawns, sharedState, spectator);
|
|
235
239
|
};
|
|
236
240
|
const getAttackingEntity = (attackingBoard, lastAttackerIndex) => {
|
|
237
241
|
let validAttackers = attackingBoard.filter((entity) => (0, entity_utils_1.canAttack)(entity));
|
|
@@ -495,8 +499,8 @@ const processMinionDeath = (board1, board1Hero, board2, board2Hero, allCards, ca
|
|
|
495
499
|
if (deadEntities1.length === 0 && deadEntities2.length === 0) {
|
|
496
500
|
return;
|
|
497
501
|
}
|
|
498
|
-
sharedState.deaths.push(...deadEntities1);
|
|
499
|
-
sharedState.deaths.push(...deadEntities2);
|
|
502
|
+
sharedState.deaths.push(...deadEntities1.map((e) => ({ ...e })));
|
|
503
|
+
sharedState.deaths.push(...deadEntities2.map((e) => ({ ...e })));
|
|
500
504
|
board1Hero.globalInfo.EternalKnightsDeadThisGame =
|
|
501
505
|
board1Hero.globalInfo.EternalKnightsDeadThisGame +
|
|
502
506
|
deadEntities1.filter((e) => e.cardId === "BG25_008" || e.cardId === "BG25_008_G").length;
|
|
@@ -568,7 +572,7 @@ const handleDeathrattlesForFirstBoard = (firstBoard, firstBoardHero, otherBoard,
|
|
|
568
572
|
const entity = deadEntities[i];
|
|
569
573
|
const indexFromRight = deadMinionIndexesFromRight[i];
|
|
570
574
|
if (entity.health <= 0 || entity.definitelyDead) {
|
|
571
|
-
buildBoardAfterDeathrattleSpawns(firstBoard, firstBoardHero, entity, indexFromRight, otherBoard, otherBoardHero, deadEntities, allCards, cardsData, sharedState, spectator);
|
|
575
|
+
(0, exports.buildBoardAfterDeathrattleSpawns)(firstBoard, firstBoardHero, entity, indexFromRight, otherBoard, otherBoardHero, deadEntities, allCards, cardsData, sharedState, spectator);
|
|
572
576
|
}
|
|
573
577
|
else if (firstBoard.length > 0) {
|
|
574
578
|
firstBoard.splice(firstBoard.length - indexFromRight, 1, entity);
|
|
@@ -610,8 +614,9 @@ const applyOnAttackBuffs = (attacker, attackingBoard, allCards, spectator) => {
|
|
|
610
614
|
});
|
|
611
615
|
}
|
|
612
616
|
if ((0, utils_2.isCorrectTribe)(allCards.getCard(attacker.cardId).races, reference_data_1.Race.PIRATE)) {
|
|
613
|
-
const elizas = attackingBoard.filter((e) => e.cardId === "BGS_047");
|
|
614
|
-
const elizasTB = attackingBoard.filter((e) => e.cardId === "TB_BaconUps_134"
|
|
617
|
+
const elizas = attackingBoard.filter((e) => e.cardId === "BGS_047" || e.cardId === "BG27_555");
|
|
618
|
+
const elizasTB = attackingBoard.filter((e) => e.cardId === "TB_BaconUps_134" ||
|
|
619
|
+
e.cardId === "BG27_555_G");
|
|
615
620
|
elizas.forEach((eliza) => {
|
|
616
621
|
attackingBoard.forEach((entity) => {
|
|
617
622
|
(0, utils_2.modifyAttack)(entity, 2, attackingBoard, allCards);
|
|
@@ -748,37 +753,15 @@ const makeMinionsDie = (board, boardHero, allCards, spectator) => {
|
|
|
748
753
|
return [blockIndexesFromRight, deadEntities];
|
|
749
754
|
};
|
|
750
755
|
const buildBoardAfterDeathrattleSpawns = (boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, entitiesDeadThisAttack, allCards, cardsData, sharedState, spectator) => {
|
|
751
|
-
var _a, _b;
|
|
752
756
|
if (deadMinionIndexFromRight2 >= 0) {
|
|
753
757
|
(0, deathrattle_effects_1.applyMinionDeathEffect)(deadEntity, deadMinionIndexFromRight2, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
754
758
|
}
|
|
755
|
-
|
|
756
|
-
const entitiesFromEnchantments = (0, deathrattle_spawns_1.spawnEntitiesFromEnchantments)(deadEntity, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
757
|
-
const candidateEntities = [...entitiesFromNativeDeathrattle, ...entitiesFromEnchantments];
|
|
758
|
-
(0, exports.performEntitySpawns)(candidateEntities, boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
759
|
-
(0, deathrattle_effects_1.handleDeathrattleEffects)(boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
760
|
-
if ((_a = deadEntity.rememberedDeathrattles) === null || _a === void 0 ? void 0 : _a.length) {
|
|
761
|
-
for (const deathrattle of deadEntity.rememberedDeathrattles) {
|
|
762
|
-
const entityToProcess = {
|
|
763
|
-
...deadEntity,
|
|
764
|
-
rememberedDeathrattles: undefined,
|
|
765
|
-
cardId: deathrattle.cardId,
|
|
766
|
-
enchantments: [
|
|
767
|
-
{
|
|
768
|
-
cardId: deathrattle.cardId,
|
|
769
|
-
originEntityId: deadEntity.entityId,
|
|
770
|
-
repeats: (_b = deathrattle.repeats) !== null && _b !== void 0 ? _b : 1,
|
|
771
|
-
timing: deathrattle.timing,
|
|
772
|
-
},
|
|
773
|
-
],
|
|
774
|
-
};
|
|
775
|
-
buildBoardAfterDeathrattleSpawns(boardWithKilledMinion, boardWithKilledMinionHero, entityToProcess, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, entitiesDeadThisAttack, allCards, cardsData, sharedState, spectator);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
759
|
+
(0, deathrattle_effects_1.handleDeathrattles)(boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, entitiesDeadThisAttack, allCards, cardsData, sharedState, spectator);
|
|
778
760
|
(0, avenge_1.applyAvengeEffects)(deadEntity, deadMinionIndexFromRight2, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
779
761
|
const entitiesFromAfterDeath = (0, death_effects_1.applyOnDeathEffects)(deadEntity, deadMinionIndexFromRight2, boardWithKilledMinion, boardWithKilledMinionHero, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
780
762
|
(0, exports.performEntitySpawns)(entitiesFromAfterDeath, boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight2, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator);
|
|
781
763
|
};
|
|
764
|
+
exports.buildBoardAfterDeathrattleSpawns = buildBoardAfterDeathrattleSpawns;
|
|
782
765
|
const buildBoardAfterRebornSpawns = (boardWithKilledMinion, boardWithKilledMinionHero, deadEntity, deadMinionIndexFromRight, opponentBoard, opponentBoardHero, allCards, cardsData, sharedState, spectator) => {
|
|
783
766
|
const numberOfReborns = 1;
|
|
784
767
|
if (!deadEntity.cardId) {
|