@firestone-hs/simulate-bgs-battle 1.1.302 → 1.1.304
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.
|
@@ -16,7 +16,7 @@ const computeBattlecryMultiplier = (board, boardHero, sharedState) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.computeBattlecryMultiplier = computeBattlecryMultiplier;
|
|
18
18
|
const triggerBattlecry = (board, hero, entity, otherBoard, otherHero, allCards, cardsData, sharedState, spectator) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
20
|
const allMinions = [...board, ...otherBoard];
|
|
21
21
|
const totalTriggers = (0, exports.computeBattlecryMultiplier)(board, hero, sharedState);
|
|
22
22
|
for (let z = 0; z < totalTriggers; z++) {
|
|
@@ -285,6 +285,67 @@ const triggerBattlecry = (board, hero, entity, otherBoard, otherHero, allCards,
|
|
|
285
285
|
(0, utils_2.modifyHealth)(murkyTarget, murkyStats, board, allCards);
|
|
286
286
|
(0, utils_2.afterStatsUpdate)(murkyTarget, board, allCards);
|
|
287
287
|
break;
|
|
288
|
+
case "BGS_069":
|
|
289
|
+
case "TB_BaconUps_121":
|
|
290
|
+
const numberOfTribes = extractUniqueTribes(board, allCards).length;
|
|
291
|
+
const amalgadonMultiplier = entity.cardId === "BGS_069" ? 1 : 2;
|
|
292
|
+
const totalAdapts = amalgadonMultiplier * numberOfTribes;
|
|
293
|
+
for (let i = 0; i < totalAdapts; i++) {
|
|
294
|
+
const adapts = [
|
|
295
|
+
"UNG_999t3",
|
|
296
|
+
"UNG_999t2",
|
|
297
|
+
"UNG_999t14",
|
|
298
|
+
"UNG_999t4",
|
|
299
|
+
];
|
|
300
|
+
if (!entity.divineShield) {
|
|
301
|
+
adapts.push("UNG_999t8");
|
|
302
|
+
}
|
|
303
|
+
if (!entity.windfury) {
|
|
304
|
+
adapts.push("UNG_999t7");
|
|
305
|
+
}
|
|
306
|
+
if (!entity.taunt) {
|
|
307
|
+
adapts.push("UNG_999t6");
|
|
308
|
+
}
|
|
309
|
+
if (!entity.venomous && !entity.poisonous) {
|
|
310
|
+
adapts.push("UNG_999t13");
|
|
311
|
+
}
|
|
312
|
+
const adapt = (0, utils_1.pickRandom)(adapts);
|
|
313
|
+
switch (adapt) {
|
|
314
|
+
case "UNG_999t3":
|
|
315
|
+
(0, utils_2.modifyAttack)(entity, 3, board, allCards);
|
|
316
|
+
(0, utils_2.afterStatsUpdate)(entity, board, allCards);
|
|
317
|
+
break;
|
|
318
|
+
case "UNG_999t2":
|
|
319
|
+
entity.enchantments = (_j = entity.enchantments) !== null && _j !== void 0 ? _j : [];
|
|
320
|
+
entity.enchantments.push({
|
|
321
|
+
cardId: "UNG_999t2e",
|
|
322
|
+
timing: 0,
|
|
323
|
+
});
|
|
324
|
+
break;
|
|
325
|
+
case "UNG_999t7":
|
|
326
|
+
entity.windfury = true;
|
|
327
|
+
break;
|
|
328
|
+
case "UNG_999t6":
|
|
329
|
+
entity.taunt = true;
|
|
330
|
+
break;
|
|
331
|
+
case "UNG_999t13":
|
|
332
|
+
entity.poisonous = true;
|
|
333
|
+
break;
|
|
334
|
+
case "UNG_999t4":
|
|
335
|
+
(0, utils_2.modifyHealth)(entity, 3, board, allCards);
|
|
336
|
+
(0, utils_2.afterStatsUpdate)(entity, board, allCards);
|
|
337
|
+
break;
|
|
338
|
+
case "UNG_999t8":
|
|
339
|
+
entity.divineShield = true;
|
|
340
|
+
break;
|
|
341
|
+
case "UNG_999t14":
|
|
342
|
+
(0, utils_2.modifyAttack)(entity, 1, board, allCards);
|
|
343
|
+
(0, utils_2.modifyHealth)(entity, 1, board, allCards);
|
|
344
|
+
(0, utils_2.afterStatsUpdate)(entity, board, allCards);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
288
349
|
default:
|
|
289
350
|
hasTriggered = false;
|
|
290
351
|
break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AM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;oBAC1E,MAAM,SAAS,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;oBAC1C,YAAY,CAAC,IAAI,CAAC,qBAAI,CAAC,SAAS,CAAC,CAAC,CAAC;oBAEnC,KAAK,MAAM,CAAC,IAAI,gBAAgB,EAAE;wBACjC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;qBAEjD;oBACD,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;oBACrB,KAAK,GAAG,IAAI,CAAC;oBAEb,CAAC,GAAG,CAAC,CAAC;iBACN;aACD;SAED;KACD;IAED,YAAY,CAAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,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 { CardsData } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst multiplier = echoesOfArgus + (goldenBrann ? 3 : brann ? 2 : 1);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, razorFenCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(rockPoolTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, rockPoolTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, shellCollectorCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, nerubianDeathswarmerStats, 0, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(twilightEmissaryTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, twilightEmissaryTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(smoggerTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, smoggerTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 3 : 6,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, allCards, spectator);\r\n\t\t\t\tspectator.registerPowerTarget(entity, necrolyteTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, primalfinLookoutCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(target, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, target, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(vigilantStonebornTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, vigilantStonebornTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(bonemareTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, bonemareTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, generalDrakkisathCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 3 : 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, murozondCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, tavernTempestCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, mechaJaraxxusCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, oozelingCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(board);\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(livingConstellationTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, livingConstellationTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tconst emergentFlameStats = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(emergentFlameTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\tconst murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * (1 + murkyBattlecriesPlayed);\r\n\t\t\t\tconst murkyTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)));\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(murkyTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\thasTriggered = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, allCards, cardsData, spectator);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n) => {\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_BGS_041)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 1, 1, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 2, 2, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
|
|
1
|
+
{"version":3,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AAC,IAAI,CAChB,GAAG,uBAAuB;SACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,qBAAI,CAAC,qBAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/C,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACvB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,qBAAI,CAAC,CAAC,CAAC,CAAC,CAC7B,CAAC;IACF,OAAO,YAAY,CAAC;AACrB,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 { CardsData } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\taddCardsInHand,\r\n\taddStatsToBoard,\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\tgrantStatsToMinionsOfEachType,\r\n\thasCorrectTribe,\r\n\tisMinionGolden,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n} from '../utils';\r\nimport { playBloodGemsOn } from './blood-gems';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const computeBattlecryMultiplier = (\r\n\tboard: BoardEntity[],\r\n\tboardHero: BgsPlayerEntity,\r\n\tsharedState: SharedState,\r\n): number => {\r\n\tconst brann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_BG_LOE_077 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518,\r\n\t);\r\n\tconst goldenBrann = board.find(\r\n\t\t(entity) =>\r\n\t\t\tentity.cardId === CardIds.BrannBronzebeard_TB_BaconUps_045 ||\r\n\t\t\tentity.cardId === CardIds.MoiraBronzebeard_BG27_518_G,\r\n\t);\r\n\tconst echoesOfArgus = sharedState.anomalies.includes(CardIds.EchoesOfArgus_BG27_Anomaly_802) ? 1 : 0;\r\n\tconst multiplier = echoesOfArgus + (goldenBrann ? 3 : brann ? 2 : 1);\r\n\treturn multiplier;\r\n};\r\n\r\nexport const triggerBattlecry = (\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\tentity: BoardEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n) => {\r\n\tconst allMinions = [...board, ...otherBoard];\r\n\tconst totalTriggers = computeBattlecryMultiplier(board, hero, sharedState);\r\n\tfor (let z = 0; z < totalTriggers; z++) {\r\n\t\tlet hasTriggered = true;\r\n\t\tswitch (entity.cardId) {\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100:\r\n\t\t\tcase CardIds.RazorfenGeomancer_BG20_100_G:\r\n\t\t\t\tconst razorFenCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.RazorfenGeomancer_BG20_100\r\n\t\t\t\t\t\t? [CardIds.BloodGem]\r\n\t\t\t\t\t\t: [CardIds.BloodGem, CardIds.BloodGem];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, razorFenCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.RockpoolHunter_BG_UNG_073:\r\n\t\t\tcase CardIds.RockpoolHunter_TB_BaconUps_061:\r\n\t\t\t\tconst rockPoolTarget = getRandomAliveMinion(board, Race.MURLOC, allCards);\r\n\t\t\t\tconst rockpoolStats = entity.cardId === CardIds.RockpoolHunter_BG_UNG_073 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tmodifyHealth(rockPoolTarget, rockpoolStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(rockPoolTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, rockPoolTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ShellCollector_BG23_002:\r\n\t\t\tcase CardIds.ShellCollector_BG23_002_G:\r\n\t\t\t\tconst shellCollectorCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.ShellCollector_BG23_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, shellCollectorCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieMug_BGS_082:\r\n\t\t\tcase CardIds.MenagerieMug_TB_BaconUps_144:\r\n\t\t\t\tconst menagerieMugStats = entity.cardId === CardIds.MenagerieMug_BGS_082 ? 1 : 2;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tmenagerieMugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MenagerieJug_BGS_083:\r\n\t\t\tcase CardIds.MenagerieJug_TB_BaconUps_145:\r\n\t\t\t\tconst menagerieJugStats = entity.cardId === CardIds.MenagerieJug_BGS_083 ? 2 : 4;\r\n\t\t\t\tgrantStatsToMinionsOfEachType(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tmenagerieJugStats,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\t3,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011:\r\n\t\t\tcase CardIds.NerubianDeathswarmer_BG25_011_G:\r\n\t\t\t\tconst nerubianDeathswarmerStats = entity.cardId === CardIds.NerubianDeathswarmer_BG25_011 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.UndeadAttackBonus =\r\n\t\t\t\t\t(hero.globalInfo?.UndeadAttackBonus ?? 0) + nerubianDeathswarmerStats;\r\n\t\t\t\taddStatsToBoard(entity, board, nerubianDeathswarmerStats, 0, allCards, spectator, Race[Race.UNDEAD]);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069:\r\n\t\t\tcase CardIds.SparringPartner_BG_AT_069_G:\r\n\t\t\t\tconst sparringPartnersTargets = allMinions.filter((e) => !e.taunt);\r\n\t\t\t\tconst sparringPartnersTarget = pickRandom(sparringPartnersTargets);\r\n\t\t\t\tif (sparringPartnersTarget) {\r\n\t\t\t\t\tsparringPartnersTarget.taunt = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TwilightEmissary_BGS_038:\r\n\t\t\tcase CardIds.TwilightEmissary_TB_BaconUps_108:\r\n\t\t\t\tconst twilightEmissaryTarget = getRandomAliveMinion(board, Race.DRAGON, allCards);\r\n\t\t\t\tconst twilightEmissaryStats = entity.cardId === CardIds.TwilightEmissary_BGS_038 ? 2 : 4;\r\n\t\t\t\tmodifyAttack(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tmodifyHealth(twilightEmissaryTarget, twilightEmissaryStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(twilightEmissaryTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, twilightEmissaryTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.BloodsailCannoneer_BGS_053:\r\n\t\t\tcase CardIds.BloodsailCannoneer_TB_BaconUps_138:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.BloodsailCannoneer_BGS_053 ? 3 : 6,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.PIRATE],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_BG_EX1_103:\r\n\t\t\tcase CardIds.ColdlightSeerLegacy_TB_BaconUps_064:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\t0,\r\n\t\t\t\t\tentity.cardId === CardIds.ColdlightSeerLegacy_BG_EX1_103 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522:\r\n\t\t\tcase CardIds.KeyboardIgniter_BG26_522_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KeyboardIgniter_BG26_522 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DEMON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159:\r\n\t\t\tcase CardIds.MoonBaconJazzer_BG26_159_G:\r\n\t\t\t\tconst moonBaconJazzerStats = entity.cardId === CardIds.MoonBaconJazzer_BG26_159 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus =\r\n\t\t\t\t\t(hero.globalInfo?.BloodGemHealthBonus ?? 0) + moonBaconJazzerStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Smogger_BG21_021:\r\n\t\t\tcase CardIds.Smogger_BG21_021_G:\r\n\t\t\t\tconst smoggerLoops = entity.cardId === CardIds.Smogger_BG21_021 ? 1 : 2;\r\n\t\t\t\tfor (let i = 0; i < smoggerLoops; i++) {\r\n\t\t\t\t\tconst smoggerTarget = getRandomAliveMinion(board, Race.ELEMENTAL, allCards);\r\n\t\t\t\t\tconst smoggerStats = hero.tavernTier ?? 3;\r\n\t\t\t\t\tmodifyAttack(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(smoggerTarget, smoggerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(smoggerTarget, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, smoggerTarget, board);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_BGS_010:\r\n\t\t\tcase CardIds.AnnihilanBattlemaster_TB_BaconUps_083:\r\n\t\t\t\t// TODO: pass damage taken info\r\n\t\t\t\tconst startingHp = hero.cardId === CardIds.Patchwerk_TB_BaconShop_HERO_34 ? 60 : 30;\r\n\t\t\t\tconst hpMissing = startingHp - hero.hpLeft;\r\n\t\t\t\tconst annihilanStats = (entity.cardId === CardIds.AnnihilanBattlemaster_BGS_010 ? 2 : 4) * hpMissing;\r\n\t\t\t\tmodifyHealth(entity, annihilanStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, entity, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963:\r\n\t\t\tcase CardIds.ElectricSynthesizer_BG26_963_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 3 : 6,\r\n\t\t\t\t\tentity.cardId === CardIds.ElectricSynthesizer_BG26_963 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.DRAGON],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Necrolyte_BG20_202:\r\n\t\t\tcase CardIds.Necrolyte_BG20_202_G:\r\n\t\t\t\tconst necrolyteBloodGems = entity.cardId === CardIds.Necrolyte_BG20_202 ? 2 : 4;\r\n\t\t\t\tconst necrolyteTarget = pickRandom(board);\r\n\t\t\t\tplayBloodGemsOn(necrolyteTarget, necrolyteBloodGems, board, hero, allCards, spectator);\r\n\t\t\t\tspectator.registerPowerTarget(entity, necrolyteTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.PrimalfinLookout_BGS_020:\r\n\t\t\tcase CardIds.PrimalfinLookout_TB_BaconUps_089:\r\n\t\t\t\tconst primalfinLookoutCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.PrimalfinLookout_BGS_020\r\n\t\t\t\t\t\t? [cardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1)]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t\t\tcardsData.getRandomMinionForTribe(Race.MURLOC, hero.tavernTier ?? 1),\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, primalfinLookoutCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StrongshellScavenger_BG_ICC_807:\r\n\t\t\tcase CardIds.StrongshellScavenger_TB_BaconUps_072:\r\n\t\t\t\tconst strongshellScavengerStats = entity.cardId === CardIds.StrongshellScavenger_BG_ICC_807 ? 2 : 4;\r\n\t\t\t\tconst strongshellScavengerTargets = board\r\n\t\t\t\t\t.filter((e) => e.entityId != entity.entityId)\r\n\t\t\t\t\t.filter((e) => e.taunt);\r\n\t\t\t\tstrongshellScavengerTargets.forEach((target) => {\r\n\t\t\t\t\tmodifyAttack(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tmodifyHealth(target, strongshellScavengerStats, board, allCards);\r\n\t\t\t\t\tafterStatsUpdate(target, board, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(entity, target, board);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023:\r\n\t\t\tcase CardIds.VigilantStoneborn_BG24_023_G:\r\n\t\t\t\tconst vigilantStonebornTarget = pickRandom(board);\r\n\t\t\t\tconst vigilantStonebornStats = entity.cardId === CardIds.VigilantStoneborn_BG24_023 ? 6 : 12;\r\n\t\t\t\tvigilantStonebornTarget.taunt = true;\r\n\t\t\t\tmodifyHealth(vigilantStonebornTarget, vigilantStonebornStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(vigilantStonebornTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, vigilantStonebornTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705:\r\n\t\t\tcase CardIds.Bonemare_BG26_ICC_705_G:\r\n\t\t\t\tconst bonemareTarget = pickRandom(board);\r\n\t\t\t\tconst bonemareStats = entity.cardId === CardIds.Bonemare_BG26_ICC_705 ? 4 : 8;\r\n\t\t\t\tbonemareTarget.taunt = true;\r\n\t\t\t\tmodifyAttack(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tmodifyHealth(bonemareTarget, bonemareStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(bonemareTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, bonemareTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309:\r\n\t\t\tcase CardIds.GeneralDrakkisath_BG25_309_G:\r\n\t\t\t\tconst generalDrakkisathCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.GeneralDrakkisath_BG25_309\r\n\t\t\t\t\t\t? [CardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t]\r\n\t\t\t\t\t\t: [\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t\t\tCardIds.GeneralDrakkisath_SmolderwingToken_BG25_309t,\r\n\t\t\t\t\t\t ];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, generalDrakkisathCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.KingBagurgle_BGS_030:\r\n\t\t\tcase CardIds.KingBagurgle_TB_BaconUps_100:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.KingBagurgle_BGS_030 ? 3 : 6,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tRace[Race.MURLOC],\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\t// Not correct, but only used to trigger the \"add cards in hand\" effect\r\n\t\t\tcase CardIds.Murozond_BGS_043:\r\n\t\t\tcase CardIds.Murozond_TB_BaconUps_110:\r\n\t\t\t\tconst murozondCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.Murozond_BGS_043\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, murozondCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.TavernTempest_BGS_123:\r\n\t\t\tcase CardIds.TavernTempest_TB_BaconUps_162:\r\n\t\t\t\tconst tavernTempestCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.TavernTempest_BGS_123\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, tavernTempestCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807:\r\n\t\t\tcase CardIds.MechaJaraxxus_BG25_807_G:\r\n\t\t\t\tconst mechaJaraxxusCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.MechaJaraxxus_BG25_807\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, mechaJaraxxusCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002:\r\n\t\t\tcase CardIds.OozelingGladiator_BG27_002_G:\r\n\t\t\t\tconst oozelingCardsToAdd =\r\n\t\t\t\t\tentity.cardId === CardIds.OozelingGladiator_BG27_002\r\n\t\t\t\t\t\t? [CardIds.TheCoinCore, CardIds.TheCoinCore]\r\n\t\t\t\t\t\t: [CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore, CardIds.TheCoinCore];\r\n\t\t\t\taddCardsInHand(hero, board, allCards, spectator, oozelingCardsToAdd);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190:\r\n\t\t\tcase CardIds.UtherTheLightbringer_BG23_190_G:\r\n\t\t\t\tconst utherTarget = pickRandom(allMinions);\r\n\t\t\t\tconst utherStats = entity.cardId === CardIds.UtherTheLightbringer_BG23_190 ? 15 : 30;\r\n\t\t\t\tutherTarget.attack = utherStats;\r\n\t\t\t\tutherTarget.health = utherStats;\r\n\t\t\t\tutherTarget.maxHealth = utherStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000:\r\n\t\t\tcase CardIds.IronGroundskeeper_BG27_000_G:\r\n\t\t\t\tconst ironGroundskeeperTargets = allMinions;\r\n\t\t\t\tconst ironGroundskeeperTarget = pickRandom(ironGroundskeeperTargets);\r\n\t\t\t\tironGroundskeeperTarget.taunt = !ironGroundskeeperTarget.taunt;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001:\r\n\t\t\tcase CardIds.LivingConstellation_BG27_001_G:\r\n\t\t\t\tconst differentTypes = extractUniqueTribes(board, allCards);\r\n\t\t\t\tconst livingConstellationStats =\r\n\t\t\t\t\t(entity.cardId === CardIds.LivingConstellation_BG27_001 ? 1 : 2) * differentTypes.length;\r\n\t\t\t\tconst livingConstellationTarget = pickRandom(board);\r\n\t\t\t\tmodifyAttack(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tmodifyHealth(livingConstellationTarget, livingConstellationStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(livingConstellationTarget, board, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(entity, livingConstellationTarget, board);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001:\r\n\t\t\tcase CardIds.FairyTaleCaroler_BG26_001_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tentity.cardId === CardIds.FairyTaleCaroler_BG26_001 ? 2 : 4,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SparkLing_BG27_019:\r\n\t\t\tcase CardIds.SparkLing_BG27_019_G:\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\tboard.filter((e) => e.entityId != entity.entityId),\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\taddStatsToBoard(\r\n\t\t\t\t\tentity,\r\n\t\t\t\t\totherBoard,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tentity.cardId === CardIds.SparkLing_BG27_019 ? 1 : 2,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018:\r\n\t\t\tcase CardIds.EmergentFlame_BG27_018_G:\r\n\t\t\t\tconst emergentFlameTarget = pickRandom(\r\n\t\t\t\t\tboard.filter((e) => hasCorrectTribe(e, Race.ELEMENTAL, allCards)),\r\n\t\t\t\t);\r\n\t\t\t\tconst emergentFlameStats = entity.cardId === CardIds.EmergentFlame_BG27_018 ? 1 : 2;\r\n\t\t\t\tmodifyAttack(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tmodifyHealth(emergentFlameTarget, emergentFlameStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(emergentFlameTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.ArgentBraggart_BG_SCH_149:\r\n\t\t\tcase CardIds.ArgentBraggart_TB_BaconUps_308:\r\n\t\t\t\tconst highestAttack = Math.max(...allMinions.map((minion) => minion.attack));\r\n\t\t\t\tconst highestHealth = Math.max(...allMinions.map((minion) => minion.health));\r\n\t\t\t\tconst argentBraggartMultiplier = entity.cardId === CardIds.ArgentBraggart_BG_SCH_149 ? 1 : 2;\r\n\t\t\t\tentity.attack = argentBraggartMultiplier * highestAttack;\r\n\t\t\t\tentity.health = argentBraggartMultiplier * highestHealth;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034:\r\n\t\t\tcase CardIds.CaptainSanders_BG25_034_G:\r\n\t\t\t\tconst captainSandersTarget = pickRandom(board.filter((e) => !isMinionGolden(e, allCards)));\r\n\t\t\t\tif (captainSandersTarget) {\r\n\t\t\t\t\tmakeMinionGolden(captainSandersTarget, entity, board, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017:\r\n\t\t\tcase CardIds.SanguineChampion_BG23_017_G:\r\n\t\t\t\tconst sanguineChampionStats = entity.cardId === CardIds.SanguineChampion_BG23_017 ? 1 : 2;\r\n\t\t\t\thero.globalInfo.BloodGemAttackBonus += sanguineChampionStats;\r\n\t\t\t\thero.globalInfo.BloodGemHealthBonus += sanguineChampionStats;\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Murky_BG24_012:\r\n\t\t\tcase CardIds.Murky_BG24_012_G:\r\n\t\t\t\tconst murkyScale = entity.cardId === CardIds.Murky_BG24_012 ? 1 : 2;\r\n\t\t\t\tconst murkyBattlecriesPlayed = entity.scriptDataNum1 > 0 ? entity.scriptDataNum1 / murkyScale - 1 : 0;\r\n\t\t\t\tconst murkyStats = murkyScale * (1 + murkyBattlecriesPlayed);\r\n\t\t\t\tconst murkyTarget = pickRandom(board.filter((e) => hasCorrectTribe(e, Race.MURLOC, allCards)));\r\n\t\t\t\tmodifyAttack(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tmodifyHealth(murkyTarget, murkyStats, board, allCards);\r\n\t\t\t\tafterStatsUpdate(murkyTarget, board, allCards);\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.Amalgadon_BGS_069:\r\n\t\t\tcase CardIds.Amalgadon_TB_BaconUps_121:\r\n\t\t\t\tconst numberOfTribes = extractUniqueTribes(board, allCards).length;\r\n\t\t\t\tconst amalgadonMultiplier = entity.cardId === CardIds.Amalgadon_BGS_069 ? 1 : 2;\r\n\t\t\t\tconst totalAdapts = amalgadonMultiplier * numberOfTribes;\r\n\t\t\t\tfor (let i = 0; i < totalAdapts; i++) {\r\n\t\t\t\t\tconst adapts = [\r\n\t\t\t\t\t\tCardIds.FlamingClawsToken,\r\n\t\t\t\t\t\tCardIds.LivingSporesToken,\r\n\t\t\t\t\t\tCardIds.VolcanicMightToken,\r\n\t\t\t\t\t\tCardIds.RockyCarapaceToken,\r\n\t\t\t\t\t];\r\n\t\t\t\t\tif (!entity.divineShield) {\r\n\t\t\t\t\t\tadapts.push(CardIds.CracklingShieldToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.windfury) {\r\n\t\t\t\t\t\tadapts.push(CardIds.LightningSpeedToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.taunt) {\r\n\t\t\t\t\t\tadapts.push(CardIds.MassiveToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (!entity.venomous && !entity.poisonous) {\r\n\t\t\t\t\t\tadapts.push(CardIds.PoisonSpitToken);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst adapt = pickRandom(adapts);\r\n\t\t\t\t\tswitch (adapt) {\r\n\t\t\t\t\t\tcase CardIds.FlamingClawsToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LivingSporesToken:\r\n\t\t\t\t\t\t\tentity.enchantments = entity.enchantments ?? [];\r\n\t\t\t\t\t\t\tentity.enchantments.push({\r\n\t\t\t\t\t\t\t\tcardId: CardIds.LivingSpores_LivingSporesEnchantment,\r\n\t\t\t\t\t\t\t\ttiming: 0,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.LightningSpeedToken:\r\n\t\t\t\t\t\t\tentity.windfury = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.MassiveToken:\r\n\t\t\t\t\t\t\tentity.taunt = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.PoisonSpitToken:\r\n\t\t\t\t\t\t\tentity.poisonous = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.RockyCarapaceToken:\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 3, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.CracklingShieldToken:\r\n\t\t\t\t\t\t\tentity.divineShield = true;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tcase CardIds.VolcanicMightToken:\r\n\t\t\t\t\t\t\tmodifyAttack(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tmodifyHealth(entity, 1, board, allCards);\r\n\t\t\t\t\t\t\tafterStatsUpdate(entity, board, allCards);\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\thasTriggered = false;\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t\tif (hasTriggered) {\r\n\t\t\tafterBattlecryTriggered(entity, board, hero, otherBoard, otherHero, allCards, cardsData, spectator);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst afterBattlecryTriggered = (\r\n\tentity: BoardEntity,\r\n\tboard: BoardEntity[],\r\n\thero: BgsPlayerEntity,\r\n\totherBoard: BoardEntity[],\r\n\totherHero: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tspectator: Spectator,\r\n) => {\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_BGS_041)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 1, 1, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n\tboard\r\n\t\t.filter((e) => e.cardId === CardIds.KalecgosArcaneAspect_TB_BaconUps_109)\r\n\t\t.forEach((e) => {\r\n\t\t\taddStatsToBoard(entity, board, 2, 2, allCards, spectator, Race[Race.DRAGON]);\r\n\t\t});\r\n};\r\n\r\n// TODO: this is probably too slow\r\nconst extractUniqueTribes = (board: BoardEntity[], allCards: AllCardsService): readonly Race[] => {\r\n\tconst boardReferenceCards = board.map((m) => allCards.getCard(m.cardId));\r\n\tconst minionsPlayedWithTribes = boardReferenceCards.filter((c) => !!c.races?.length);\r\n\tconst minionsToProcess: /*Mutable<ReferenceCard & { picked?: boolean }>*/ any[] = [\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((c) => !c.races.includes(Race[Race.ALL]))\r\n\t\t\t.map((c) => ({ ...c, races: [...c.races] })),\r\n\t];\r\n\r\n\tconst uniqueTribes: Race[] = [];\r\n\tconst maxTribesPerMinion = 2;\r\n\tfor (let i = 1; i <= maxTribesPerMinion; i++) {\r\n\t\tlet dirty = true;\r\n\t\twhile (dirty) {\r\n\t\t\tdirty = false;\r\n\t\t\tfor (let j = 0; j < minionsToProcess.length; j++) {\r\n\t\t\t\tconst minion = minionsToProcess[j];\r\n\t\t\t\t// console.debug('considering minion', minion.name, minion.races);\r\n\t\t\t\tif (!minion.picked && minion.races.length > 0 && minion.races.length <= i) {\r\n\t\t\t\t\tconst raceToAdd: string = minion.races[0];\r\n\t\t\t\t\tuniqueTribes.push(Race[raceToAdd]);\r\n\t\t\t\t\t// console.debug('added', raceToAdd, uniqueTribes);\r\n\t\t\t\t\tfor (const m of minionsToProcess) {\r\n\t\t\t\t\t\tm.races = m.races.filter((r) => r !== raceToAdd);\r\n\t\t\t\t\t\t// console.debug('updates races', m.name, m.races, raceToAdd);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tminion.picked = true;\r\n\t\t\t\t\tdirty = true;\r\n\t\t\t\t\t// Restart the loop, so we're not dependant on the order in which we process things\r\n\t\t\t\t\tj = 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// minionsToProcess = minionsToProcess.filter((c) => !c.picked);\r\n\t\t}\r\n\t}\r\n\r\n\tuniqueTribes.push(\r\n\t\t...minionsPlayedWithTribes\r\n\t\t\t.filter((m) => m.races.includes(Race[Race.ALL]))\r\n\t\t\t.flatMap((m) => m.races)\r\n\t\t\t.map((r: string) => Race[r]),\r\n\t);\r\n\treturn uniqueTribes;\r\n};\r\n"]}
|
|
@@ -10,6 +10,7 @@ const deathrattle_effects_1 = require("./deathrattle-effects");
|
|
|
10
10
|
const deathrattle_spawns_1 = require("./deathrattle-spawns");
|
|
11
11
|
const handleStartOfCombat = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator) => {
|
|
12
12
|
currentAttacker = handleStartOfCombatQuestRewards(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
13
|
+
currentAttacker = handleStartOfCombatAnomalies(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
13
14
|
currentAttacker = handlePreCombatHeroPowers(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
14
15
|
const playerBoardBefore = playerBoard.map((e) => ({ ...e }));
|
|
15
16
|
const opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));
|
|
@@ -78,6 +79,11 @@ const handleStartOfCombatQuestRewards = (playerEntity, playerBoard, opponentEnti
|
|
|
78
79
|
currentAttacker = handleStartOfCombatQuestRewardsForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
79
80
|
return currentAttacker;
|
|
80
81
|
};
|
|
82
|
+
const handleStartOfCombatAnomalies = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator) => {
|
|
83
|
+
currentAttacker = handleStartOfCombatAnomaliesForPlayer(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
84
|
+
currentAttacker = handleStartOfCombatAnomaliesForPlayer(opponentEntity, opponentBoard, playerEntity, playerBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator);
|
|
85
|
+
return currentAttacker;
|
|
86
|
+
};
|
|
81
87
|
const handleStartOfCombatQuestRewardsForPlayer = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator) => {
|
|
82
88
|
var _a;
|
|
83
89
|
if (!((_a = playerEntity.questRewards) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -122,6 +128,25 @@ const handleStartOfCombatQuestRewardsForPlayer = (playerEntity, playerBoard, opp
|
|
|
122
128
|
}
|
|
123
129
|
return currentAttacker;
|
|
124
130
|
};
|
|
131
|
+
const handleStartOfCombatAnomaliesForPlayer = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, spawns, sharedState, gameState, spectator) => {
|
|
132
|
+
var _a;
|
|
133
|
+
if (!((_a = gameState.anomalies) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
134
|
+
return currentAttacker;
|
|
135
|
+
}
|
|
136
|
+
for (const anomaly of gameState.anomalies) {
|
|
137
|
+
switch (anomaly) {
|
|
138
|
+
case "BG27_Anomaly_726":
|
|
139
|
+
if (playerBoard.length > 0) {
|
|
140
|
+
const dsTarget = playerBoard[0];
|
|
141
|
+
(0, utils_2.updateDivineShield)(dsTarget, playerBoard, true, allCards);
|
|
142
|
+
const rebornTarget = playerBoard[playerBoard.length - 1];
|
|
143
|
+
rebornTarget.reborn = true;
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return currentAttacker;
|
|
149
|
+
};
|
|
125
150
|
const handleStartOfCombatHeroPowers = (playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, allCards, cardsData, sharedState, gameState, spectator) => {
|
|
126
151
|
if (Math.random() < 0.5) {
|
|
127
152
|
currentAttacker = handlePlayerStartOfCombatHeroPowers(playerEntity, playerBoard, opponentEntity, opponentBoard, currentAttacker, true, allCards, cardsData, sharedState, spectator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../src/simulation/start-of-combat.ts"],"names":[],"mappings":";;;AACA,iEAA4F;AAI5F,oDAA0E;AAC1E,6CAA+C;AAC/C,oCAUkB;AAClB,qCAOkB;AAClB,+DAK+B;AAC/B,6DAAqD;AAI9C,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,QAAyB,EACzB,MAAiB,EACjB,WAAwB,EACxB,SAAuB,EACvB,SAAoB,EACX,EAAE;IAEX,eAAe,GAAG,+BAA+B,CAChD,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM,EACN,WAAW,EACX,SAAS,EACT,SAAS,CACT,CAAC;IAKF,eAAe,GAAG,yBAAyB,CAC1C,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM,EACN,WAAW,EACX,SAAS,EACT,SAAS,CACT,CAAC;IAEF,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7D,MAAM,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,eAAe,GAAG,IAAA,+BAAuB,EACxC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,E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AAC;KAC5B;IACD,OAAO,IAAA,kBAAU,EAAC,aAAa,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { ALL_BG_RACES, AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsGameState } from '../bgs-battle-info';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData, START_OF_COMBAT_CARD_IDS } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tstringifySimple,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n\tprocessMinionDeath,\r\n\tsimulateAttack,\r\n} from './attack';\r\nimport {\r\n\tapplyEarthInvocationEnchantment,\r\n\tapplyFireInvocationEnchantment,\r\n\tapplyLightningInvocationEnchantment,\r\n\tapplyWaterInvocationEnchantment,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const handleStartOfCombat = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// https://twitter.com/DCalkosz/status/1564705111850434561\r\n\tcurrentAttacker = handleStartOfCombatQuestRewards(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\tcurrentAttacker = handlePreCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// Because start of combat powers like Red Whelp's use the board composition before Illidan's strike to know the amount of damage\r\n\tconst playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tconst opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tcurrentAttacker = handleIllidanHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatMinions(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tplayerBoardBefore,\r\n\t\topponentBoardBefore,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Some are part of the incoming board: Y'Shaarj, Lich King, Ozumat\r\n\t// Since the order is not important here, we just always do the player first\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.SwattingInsects && playerBoard.length > 0) {\r\n\t\t// Should be sent by the app, but it is an idempotent operation, so we can just reapply it here\r\n\t\thandleAlakirForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.EarthInvocationToken) {\r\n\t\tapplyEarthInvocationEnchantment(playerBoard, null, playerEntity, allCards, sharedState, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaterInvocationToken) {\r\n\t\tapplyWaterInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.FireInvocationToken) {\r\n\t\tapplyFireInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerHeroPowerId === CardIds.AllWillBurn) {\r\n\t\tapplyAllWillBurn(playerBoard, opponentBoard, playerEntity, allCards, spectator);\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\t// console.log('current attacker after', currentAttacker);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet attackerForStart = currentAttacker;\r\n\tconst playerAttackers = playerBoard.filter((entity) => START_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds));\r\n\tconst opponentAttackers = opponentBoard.filter((entity) =>\r\n\t\tSTART_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds),\r\n\t);\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewards = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tif (!playerEntity.questRewards?.length) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const reward of playerEntity.questRewards) {\r\n\t\tswitch (reward) {\r\n\t\t\tcase CardIds.EvilTwin:\r\n\t\t\t\tif (!!playerBoard.length && playerBoard.length < 7) {\r\n\t\t\t\t\tconst highestHealthMinion = [...playerBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t\t...highestHealthMinion,\r\n\t\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t\t};\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\thighestHealthMinion.friendly,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tcopy,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(highestHealthMinion) + 1);\r\n\t\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\thighestHealthMinion,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, copy, playerBoard);\r\n\t\t\t\t}\r\n\t\t\t\t// Recompute first attacker\r\n\t\t\t\t// See https://replays.firestoneapp.com/?reviewId=93229c4a-d864-4196-83dd-2fea2a5bf70a&turn=29&action=0\r\n\t\t\t\treturn playerBoard.length > opponentBoard.length\r\n\t\t\t\t\t? 0\r\n\t\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t\t? 1\r\n\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\t\tplayerBoard.forEach((entity) => {\r\n\t\t\t\t\tmodifyAttack(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, playerBoard, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, entity, playerBoard);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StolenGold:\r\n\t\t\t\tif (playerBoard.length > 0) {\r\n\t\t\t\t\tmakeMinionGolden(playerBoard[0], playerEntity, playerBoard, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tif (playerBoard.length > 1) {\r\n\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\tplayerBoard[playerBoard.length - 1],\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.Wingmen && playerBoard.length > 0) {\r\n\t\thandleIllidanForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\tmodifyAttack(firstAttacker, 2, playerBoard, allCards);\r\n\tmodifyHealth(firstAttacker, 1, playerBoard, allCards);\r\n\tafterStatsUpdate(firstAttacker, playerBoard, allCards);\r\n\tspectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard);\r\n\tif (\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy) ||\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy_G)\r\n\t) {\r\n\t\tfirstAttacker.immuneWhenAttackCharges = 1;\r\n\t}\r\n\tsimulateAttack(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tundefined,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t\t0,\r\n\t);\r\n\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyAttack(secondAttacker, 2, playerBoard, allCards);\r\n\t\tmodifyHealth(secondAttacker, 1, playerBoard, allCards);\r\n\t\tafterStatsUpdate(secondAttacker, playerBoard, allCards);\r\n\t\tspectator.registerPowerTarget(secondAttacker, secondAttacker, playerBoard);\r\n\t\tif (playerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy_G)) {\r\n\t\t\tsecondAttacker.immuneWhenAttackCharges = 1;\r\n\t\t}\r\n\t\tsimulateAttack(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tundefined,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tplayerBoard.length - 1,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleAlakirForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst firstEntity = playerBoard[0];\r\n\tfirstEntity.windfury = true;\r\n\tif (!firstEntity.divineShield) {\r\n\t\tupdateDivineShield(firstEntity, playerBoard, true, allCards);\r\n\t}\r\n\tfirstEntity.taunt = true;\r\n\tspectator.registerPowerTarget(firstEntity, firstEntity, playerBoard);\r\n};\r\n\r\nconst handleTamsinForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst lowestHealth = Math.min(...playerBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = playerBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\tif (!chosenEntity) {\r\n\t\tconsole.warn('could not pick any entity for tamsin', stringifySimple(entitiesWithLowestHealth, allCards));\r\n\t\treturn;\r\n\t}\r\n\tconst newBoard = playerBoard.filter((e) => e.entityId !== chosenEntity.entityId);\r\n\t// How to mark the minion as dead\r\n\tchosenEntity.definitelyDead = true;\r\n\tnewBoard.forEach((e) => {\r\n\t\tmodifyAttack(e, chosenEntity.attack, newBoard, allCards);\r\n\t\tmodifyHealth(e, chosenEntity.health, newBoard, allCards);\r\n\t\tafterStatsUpdate(e, newBoard, allCards);\r\n\t\tspectator.registerPowerTarget(chosenEntity, e, newBoard);\r\n\t});\r\n};\r\n\r\nconst handleTeronForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// The board state is snapshot after the minion dies\r\n\tconst deadMinionEntityId = playerEntity.heroPowerInfo;\r\n\tconst minionThatWillDie = playerBoard.find((e) => e.entityId === deadMinionEntityId);\r\n\tif (minionThatWillDie) {\r\n\t\tconst minionIndexFromRight = playerBoard.length - 1 - playerBoard.indexOf(minionThatWillDie);\r\n\t\tplayerEntity.rapidReanimationIndexFromRight = minionIndexFromRight;\r\n\t\tplayerEntity.rapidReanimationMinion = {\r\n\t\t\t...minionThatWillDie,\r\n\t\t\tenchantments: minionThatWillDie.enchantments.map((e) => ({ ...e })) ?? [],\r\n\t\t} as BoardEntity;\r\n\t\tminionThatWillDie.definitelyDead = true;\r\n\t\tspectator.registerPowerTarget(playerEntity, minionThatWillDie, playerBoard);\r\n\t}\r\n};\r\n\r\nconst handleWaxWarbandForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (playerBoard.length > 0) {\r\n\t\t// let tribesGranted = 0;\r\n\t\tlet boardCopy = [...playerBoard];\r\n\t\tlet racesLeft = [...ALL_BG_RACES];\r\n\t\twhile (racesLeft.length > 0) {\r\n\t\t\tconst tribe = pickRandom(racesLeft);\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, playerBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(playerEntity, validMinion, playerBoard);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t\t// tribesGranted++;\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tracesLeft = racesLeft.filter((r) => r !== tribe);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because of some interactions between start of combat hero powers, it can happen that Ozumat is already present\r\n\t// on the board when we receive the board state\r\n\tif (\r\n\t\tplayerBoard.length < 7 &&\r\n\t\t!playerBoard.some((e) => e.cardId === CardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt)\r\n\t) {\r\n\t\tconst tentacularSize = playerEntity.heroPowerInfo;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tspectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard);\r\n\t}\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TamsinRoame_FragrantPhylactery) {\r\n\t\thandleTamsinForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Tamsin's hero power somehow happens before the current attacker is chosen.\r\n\t\t// See http://replays.firestoneapp.com/?reviewId=bce94e6b-c807-48e4-9c72-2c5c04421213&turn=6&action=9\r\n\t\tshouldRecomputeCurrentAttacker = true;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TeronGorefiend_RapidReanimation) {\r\n\t\thandleTeronForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaxWarband) {\r\n\t\thandleWaxWarbandForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerHeroPowerId === CardIds.Ozumat_Tentacular) {\r\n\t\thandleOzumatForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tfriendly,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLeftToken) {\r\n\t\tconst target = opponentBoard[0];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimRightToken) {\r\n\t\tconst target = opponentBoard[opponentBoard.length - 1];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLowToken) {\r\n\t\tconst smallestHealthMinion = [...opponentBoard].sort((a, b) => a.health - b.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === smallestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimHighToken) {\r\n\t\tconst highestHealthMinion = [...opponentBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === highestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.LightningInvocationToken) {\r\n\t\tapplyLightningInvocationEnchantment(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tnull,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: currentAttacker;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrage_TB_BaconShop_HERO_08:\r\n\t\t\treturn CardIds.Wingmen;\r\n\t\tcase CardIds.TheLichKing_TB_BaconShop_HERO_22:\r\n\t\t\treturn CardIds.RebornRites;\r\n\t\tcase CardIds.ProfessorPutricide_BG25_HERO_100:\r\n\t\t\treturn CardIds.RagePotion;\r\n\t\tcase CardIds.Deathwing_TB_BaconShop_HERO_52:\r\n\t\t\treturn CardIds.AllWillBurn;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const performStartOfCombatMinionsForPlayer = (\r\n\tattacker: BoardEntity,\r\n\tattackingBoard: BoardEntity[],\r\n\tattackingBoardHero: BgsPlayerEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingBoardHero: BgsPlayerEntity,\r\n\t// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n\t// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n\t// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n\t// Tamsin's Phylactery.\r\n\tattackingBoardBefore: BoardEntity[],\r\n\tdefendingBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Don't forget to update START_OF_COMBAT_CARD_IDS\r\n\tif (attacker.cardId === CardIds.RedWhelp_BGS_019) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (attacker.cardId === CardIds.RedWhelp_TB_BaconUps_102) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake_BG21_014 ||\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake_BG21_014_G\r\n\t) {\r\n\t\tconst numberOfDragons = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.PrizedPromoDrake_BG21_014_G ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.ChoralMrrrglr_BG26_354 ||\r\n\t\tattacker.cardId === CardIds.ChoralMrrrglr_BG26_354_G\r\n\t) {\r\n\t\t// const statsOfMinionsInHand = attackingBoardHero.hand\r\n\t\t// \t.map((c) => (c.attack ?? 0) + (c.health ?? 0))\r\n\t\t// \t.reduce((a, b) => a + b, 0);\r\n\t\tconst multiplier = attacker.cardId === CardIds.ChoralMrrrglr_BG26_354_G ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralAttackBuff, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralHealthBuff, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.AmberGuardian_BG24_500 ||\r\n\t\tattacker.cardId === CardIds.AmberGuardian_BG24_500_G\r\n\t) {\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\tconst loops = attacker.cardId === CardIds.AmberGuardian_BG24_500_G ? 2 : 1;\r\n\t\tconst dragonsToConsider = otherDragons;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\tconst otherDragon =\r\n\t\t\t\tpickRandom(dragonsToConsider.filter((e) => !e.divineShield)) ?? pickRandom(dragonsToConsider);\r\n\t\t\tif (otherDragon) {\r\n\t\t\t\tif (!otherDragon.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(otherDragon, attackingBoard, true, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tmodifyAttack(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tmodifyHealth(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t\t\tdragonsToConsider.splice(dragonsToConsider.indexOf(otherDragon), 1);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.SanctumRester_BG26_356 ||\r\n\t\tattacker.cardId === CardIds.SanctumRester_BG26_356_G\r\n\t) {\r\n\t\tconst buff = attacker.cardId === CardIds.SanctumRester_BG26_356_G ? 16 : 8;\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\totherDragons.forEach((otherDragon) => {\r\n\t\t\tmodifyHealth(otherDragon, buff, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Soulsplitter_BG25_023 ||\r\n\t\tattacker.cardId === CardIds.Soulsplitter_BG25_023_G\r\n\t) {\r\n\t\tconst numberOfTargets = attacker.cardId === CardIds.Soulsplitter_BG25_023_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfTargets; i++) {\r\n\t\t\tconst undeadsWithoutReborn = attackingBoard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => !e.reborn);\r\n\t\t\tconst chosenUndead = pickRandom(undeadsWithoutReborn);\r\n\t\t\tif (chosenUndead) {\r\n\t\t\t\tchosenUndead.reborn = true;\r\n\t\t\t\tspectator.registerPowerTarget(attacker, chosenUndead, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy ||\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy_G\r\n\t) {\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy_G ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon_BG23_012 ||\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon_BG23_012_G\r\n\t) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.CorruptedMyrmidon_BG23_012_G ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attacker.attack, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attacker.health, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704 ||\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704_G\r\n\t) {\r\n\t\tif (defendingBoard.length > 0) {\r\n\t\t\tconst attackerIndex = attackingBoard.indexOf(attacker);\r\n\t\t\tconst defenderPosition = attackerIndex - (attackingBoard.length - defendingBoard.length) / 2;\r\n\t\t\tif (Math.round(defenderPosition) === defenderPosition) {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition], attacker, attackingBoard, spectator);\r\n\t\t\t} else {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition - 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition + 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.MantidQueen_BG22_402 || attacker.cardId === CardIds.MantidQueen_BG22_402_G) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.MantidQueen_BG22_402_G ? 2 : 1;\r\n\t\tconst allRaces = attackingBoardBefore\r\n\t\t\t.map((entity) => entity.cardId)\r\n\t\t\t.flatMap((cardId) => allCards.getCard(cardId).races)\r\n\t\t\t.filter((race) => !!race && race !== Race[Race.BLANK]);\r\n\t\tconst totalRaces =\r\n\t\t\t[...new Set(allRaces.filter((race) => race !== Race[Race.ALL]))].length +\r\n\t\t\tallRaces.filter((race) => race === Race[Race.ALL]).length;\r\n\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\tfor (let j = 0; j < totalRaces; j++) {\r\n\t\t\t\tconst buffType = getRandomMantidQueenBuffType(attacker);\r\n\t\t\t\tswitch (buffType) {\r\n\t\t\t\t\tcase 'stats':\r\n\t\t\t\t\t\tmodifyAttack(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tmodifyHealth(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'reborn':\r\n\t\t\t\t\t\tattacker.reborn = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'taunt':\r\n\t\t\t\t\t\tattacker.taunt = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'windfury':\r\n\t\t\t\t\t\tattacker.windfury = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CarbonicCopy_BG27_503 ||\r\n\t\tattacker.cardId === CardIds.CarbonicCopy_BG27_503_G\r\n\t) {\r\n\t\tconst numberOfCopies = attacker.cardId === CardIds.CarbonicCopy_BG27_503_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfCopies; i++) {\r\n\t\t\tif (!!attackingBoard.length && attackingBoard.length < 7) {\r\n\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t...attacker,\r\n\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t};\r\n\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tattackingBoard,\r\n\t\t\t\t\tattackingBoardHero,\r\n\t\t\t\t\tdefendingBoard,\r\n\t\t\t\t\tdefendingBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tattacker.friendly,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcopy,\r\n\t\t\t\t);\r\n\t\t\t\tconst indexFromRight = attackingBoard.length - (attackingBoard.indexOf(attacker) + 1);\r\n\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\tnewMinions,\r\n\t\t\t\t\tattackingBoard,\r\n\t\t\t\t\tattackingBoardHero,\r\n\t\t\t\t\tattacker,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdefendingBoard,\r\n\t\t\t\t\tdefendingBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, copy, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyAllWillBurn = (\r\n\tboard1: BoardEntity[],\r\n\tboard2: BoardEntity[],\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const entity of board1) {\r\n\t\tmodifyAttack(entity, 2, board1, allCards);\r\n\t\tafterStatsUpdate(entity, board1, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board1);\r\n\t}\r\n\tfor (const entity of board2) {\r\n\t\tmodifyAttack(entity, 2, board2, allCards);\r\n\t\tafterStatsUpdate(entity, board2, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board2);\r\n\t}\r\n};\r\n\r\nconst castImpure = (entity: BoardEntity, source: BoardEntity, board: BoardEntity[], spectator: Spectator) => {\r\n\tif (!entity) {\r\n\t\treturn;\r\n\t}\r\n\tconst multiplier = source.cardId === CardIds.InterrogatorWhitemane_BG24_704_G ? 3 : 2;\r\n\tentity.taunt = true;\r\n\tentity.damageMultiplier = entity.damageMultiplier ?? 1;\r\n\tentity.damageMultiplier *= multiplier;\r\n\tspectator.registerPowerTarget(source, entity, board);\r\n};\r\n\r\nconst getRandomMantidQueenBuffType = (entity: BoardEntity): 'stats' | 'reborn' | 'windfury' | 'taunt' => {\r\n\tconst possibilities: ('stats' | 'reborn' | 'windfury' | 'taunt')[] = ['stats'];\r\n\tif (!entity.reborn) {\r\n\t\tpossibilities.push('reborn');\r\n\t}\r\n\tif (!entity.windfury) {\r\n\t\tpossibilities.push('windfury');\r\n\t}\r\n\tif (!entity.taunt) {\r\n\t\tpossibilities.push('taunt');\r\n\t}\r\n\treturn pickRandom(possibilities);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"start-of-combat.js","sourceRoot":"","sources":["../../src/simulation/start-of-combat.ts"],"names":[],"mappings":";;;AACA,iEAA4F;AAI5F,oDAA0E;AAC1E,6CAA+C;AAC/C,oCAUkB;AAClB,qCAOkB;AAClB,+DAK+B;AAC/B,6DAAqD;AAI9C,MAAM,mBAAmB,GAAG,CAClC,YAA6B,EAC7B,WAA0B,EAC1B,cAA+B,EAC/B,aAA4B,EAC5B,eAAuB,EACvB,QAAyB,EACzB,MAAiB,EACjB,WAAwB,EACxB,SAAuB,EACvB,SAAoB,EACX,EAAE;IAEX,eAAe,GAAG,+BAA+B,CAChD,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM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,MAAM,iBAA6C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,gBAAgB,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,CAAC,CAAC;IACvD,MAAM,CAAC,gBAAgB,IAAI,UAAU,CAAC;IACtC,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAG,CAAC,MAAmB,EAA6C,EAAE;IACvG,MAAM,aAAa,GAAkD,CAAC,OAAO,CAAC,CAAC;IAC/E,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QACnB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAC7B;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrB,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC/B;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;QAClB,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC5B;IACD,OAAO,IAAA,kBAAU,EAAC,aAAa,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\r\nimport { ALL_BG_RACES, AllCardsService, CardIds, Race } from '@firestone-hs/reference-data';\r\nimport { BgsGameState } from '../bgs-battle-info';\r\nimport { BgsPlayerEntity } from '../bgs-player-entity';\r\nimport { BoardEntity } from '../board-entity';\r\nimport { CardsData, START_OF_COMBAT_CARD_IDS } from '../cards/cards-data';\r\nimport { pickRandom } from '../services/utils';\r\nimport {\r\n\tafterStatsUpdate,\r\n\tgetRandomAliveMinion,\r\n\thasCorrectTribe,\r\n\tisCorrectTribe,\r\n\tmakeMinionGolden,\r\n\tmodifyAttack,\r\n\tmodifyHealth,\r\n\tstringifySimple,\r\n\tupdateDivineShield,\r\n} from '../utils';\r\nimport {\r\n\tdealDamageToEnemy,\r\n\tdealDamageToRandomEnemy,\r\n\tgetNeighbours,\r\n\tperformEntitySpawns,\r\n\tprocessMinionDeath,\r\n\tsimulateAttack,\r\n} from './attack';\r\nimport {\r\n\tapplyEarthInvocationEnchantment,\r\n\tapplyFireInvocationEnchantment,\r\n\tapplyLightningInvocationEnchantment,\r\n\tapplyWaterInvocationEnchantment,\r\n} from './deathrattle-effects';\r\nimport { spawnEntities } from './deathrattle-spawns';\r\nimport { SharedState } from './shared-state';\r\nimport { Spectator } from './spectator/spectator';\r\n\r\nexport const handleStartOfCombat = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// https://twitter.com/DCalkosz/status/1564705111850434561\r\n\tcurrentAttacker = handleStartOfCombatQuestRewards(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatAnomalies(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// https://twitter.com/DCalkosz/status/1488361384320528388?s=20&t=1ECxRZFdjqwEa2fRsXk32Q\r\n\t// There’s a certain order for Start of Combat hero powers, rather than “coin flips” where\r\n\t// an unlucky trigger order could mess up some positioning you had planned for your own hero\r\n\t// power. “Precombat” (Al’Akir, Y’Shaarj), then Illidan, then others.\r\n\tcurrentAttacker = handlePreCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\t// Because start of combat powers like Red Whelp's use the board composition before Illidan's strike to know the amount of damage\r\n\tconst playerBoardBefore = playerBoard.map((e) => ({ ...e }));\r\n\tconst opponentBoardBefore = opponentBoard.map((e) => ({ ...e }));\r\n\tcurrentAttacker = handleIllidanHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatHeroPowers(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatMinions(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tplayerBoardBefore,\r\n\t\topponentBoardBefore,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handlePreCombatHeroPowersForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePreCombatHeroPowersForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Some are part of the incoming board: Y'Shaarj, Lich King, Ozumat\r\n\t// Since the order is not important here, we just always do the player first\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.SwattingInsects && playerBoard.length > 0) {\r\n\t\t// Should be sent by the app, but it is an idempotent operation, so we can just reapply it here\r\n\t\thandleAlakirForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.EarthInvocationToken) {\r\n\t\tapplyEarthInvocationEnchantment(playerBoard, null, playerEntity, allCards, sharedState, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaterInvocationToken) {\r\n\t\tapplyWaterInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.FireInvocationToken) {\r\n\t\tapplyFireInvocationEnchantment(playerBoard, null, playerEntity, allCards, spectator);\r\n\t} else if (playerHeroPowerId === CardIds.AllWillBurn) {\r\n\t\tapplyAllWillBurn(playerBoard, opponentBoard, playerEntity, allCards, spectator);\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// console.log('current attacker before', currentAttacker);\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerIllidanHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\t// console.log('current attacker after', currentAttacker);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatMinions = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tplayerBoardBefore: BoardEntity[],\r\n\topponentBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet attackerForStart = currentAttacker;\r\n\tconst playerAttackers = playerBoard.filter((entity) => START_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds));\r\n\tconst opponentAttackers = opponentBoard.filter((entity) =>\r\n\t\tSTART_OF_COMBAT_CARD_IDS.includes(entity.cardId as CardIds),\r\n\t);\r\n\twhile (playerAttackers.length > 0 || opponentAttackers.length > 0) {\r\n\t\tif (attackerForStart === 0 && playerAttackers.length > 0) {\r\n\t\t\tconst attacker = playerAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t} else if (attackerForStart === 1 && opponentAttackers.length > 0) {\r\n\t\t\tconst attacker = opponentAttackers.splice(0, 1)[0];\r\n\t\t\tperformStartOfCombatMinionsForPlayer(\r\n\t\t\t\tattacker,\r\n\t\t\t\topponentBoard,\r\n\t\t\t\topponentEntity,\r\n\t\t\t\tplayerBoard,\r\n\t\t\t\tplayerEntity,\r\n\t\t\t\topponentBoardBefore,\r\n\t\t\t\tplayerBoardBefore,\r\n\t\t\t\tallCards,\r\n\t\t\t\tspawns,\r\n\t\t\t\tsharedState,\r\n\t\t\t\tgameState,\r\n\t\t\t\tspectator,\r\n\t\t\t);\r\n\t\t}\r\n\t\tattackerForStart = (attackerForStart + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewards = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatQuestRewardsForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatAnomalies = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer(\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\tcurrentAttacker = handleStartOfCombatAnomaliesForPlayer(\r\n\t\topponentEntity,\r\n\t\topponentBoard,\r\n\t\tplayerEntity,\r\n\t\tplayerBoard,\r\n\t\tcurrentAttacker,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tgameState,\r\n\t\tspectator,\r\n\t);\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatQuestRewardsForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tif (!playerEntity.questRewards?.length) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const reward of playerEntity.questRewards) {\r\n\t\tswitch (reward) {\r\n\t\t\tcase CardIds.EvilTwin:\r\n\t\t\t\tif (!!playerBoard.length && playerBoard.length < 7) {\r\n\t\t\t\t\tconst highestHealthMinion = [...playerBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t\t...highestHealthMinion,\r\n\t\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t\t};\r\n\t\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t\t1,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t\thighestHealthMinion.friendly,\r\n\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tfalse,\r\n\t\t\t\t\t\tcopy,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tconst indexFromRight = playerBoard.length - (playerBoard.indexOf(highestHealthMinion) + 1);\r\n\t\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\t\tnewMinions,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\thighestHealthMinion,\r\n\t\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\t\topponentBoard,\r\n\t\t\t\t\t\topponentEntity,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspawns,\r\n\t\t\t\t\t\tsharedState,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, copy, playerBoard);\r\n\t\t\t\t}\r\n\t\t\t\t// Recompute first attacker\r\n\t\t\t\t// See https://replays.firestoneapp.com/?reviewId=93229c4a-d864-4196-83dd-2fea2a5bf70a&turn=29&action=0\r\n\t\t\t\treturn playerBoard.length > opponentBoard.length\r\n\t\t\t\t\t? 0\r\n\t\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t\t? 1\r\n\t\t\t\t\t: Math.round(Math.random());\r\n\t\t\tcase CardIds.StaffOfOrigination_BG24_Reward_312:\r\n\t\t\t\tplayerBoard.forEach((entity) => {\r\n\t\t\t\t\tmodifyAttack(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tmodifyHealth(entity, 15, playerBoard, allCards);\r\n\t\t\t\t\tafterStatsUpdate(entity, playerBoard, allCards);\r\n\t\t\t\t\tspectator.registerPowerTarget(playerEntity, entity, playerBoard);\r\n\t\t\t\t});\r\n\t\t\t\tbreak;\r\n\t\t\tcase CardIds.StolenGold:\r\n\t\t\t\tif (playerBoard.length > 0) {\r\n\t\t\t\t\tmakeMinionGolden(playerBoard[0], playerEntity, playerBoard, allCards, spectator);\r\n\t\t\t\t}\r\n\t\t\t\tif (playerBoard.length > 1) {\r\n\t\t\t\t\tmakeMinionGolden(\r\n\t\t\t\t\t\tplayerBoard[playerBoard.length - 1],\r\n\t\t\t\t\t\tplayerEntity,\r\n\t\t\t\t\t\tplayerBoard,\r\n\t\t\t\t\t\tallCards,\r\n\t\t\t\t\t\tspectator,\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handleStartOfCombatAnomaliesForPlayer = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tif (!gameState.anomalies?.length) {\r\n\t\treturn currentAttacker;\r\n\t}\r\n\tfor (const anomaly of gameState.anomalies) {\r\n\t\tswitch (anomaly) {\r\n\t\t\tcase CardIds.BlessedOrBlighted_BG27_Anomaly_726:\r\n\t\t\t\tif (playerBoard.length > 0) {\r\n\t\t\t\t\tconst dsTarget = playerBoard[0];\r\n\t\t\t\t\tupdateDivineShield(dsTarget, playerBoard, true, allCards);\r\n\t\t\t\t\tconst rebornTarget = playerBoard[playerBoard.length - 1];\r\n\t\t\t\t\trebornTarget.reborn = true;\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const handleStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\t// Apparently it's a toin coss about whether to handle Illidan first or Al'Akir first\r\n\t// Auras are only relevant for Illidan, and already applied there\r\n\tif (Math.random() < 0.5) {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else {\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\tfalse,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = handlePlayerStartOfCombatHeroPowers(\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerBoard,\r\n\t\t\topponentEntity,\r\n\t\t\topponentBoard,\r\n\t\t\tcurrentAttacker,\r\n\t\t\ttrue,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nconst handlePlayerIllidanHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerHeroPowerId === CardIds.Wingmen && playerBoard.length > 0) {\r\n\t\thandleIllidanForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tcurrentAttacker = (currentAttacker + 1) % 2;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\n// TODO: not exactly correct, because of \"attack immediately\", but it's close enough\r\nconst handleIllidanForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Otherwise, if the first minion dies on the attack, and the board has only 2 minions, we\r\n\t// miss the second one\r\n\tconst minionsAtStart = playerBoard.length;\r\n\tconst firstAttacker = playerBoard[0];\r\n\tconst secondAttacker = minionsAtStart > 1 ? playerBoard[playerBoard.length - 1] : null;\r\n\r\n\tmodifyAttack(firstAttacker, 2, playerBoard, allCards);\r\n\tmodifyHealth(firstAttacker, 1, playerBoard, allCards);\r\n\tafterStatsUpdate(firstAttacker, playerBoard, allCards);\r\n\tspectator.registerPowerTarget(firstAttacker, firstAttacker, playerBoard);\r\n\tif (\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy) ||\r\n\t\tplayerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy_G)\r\n\t) {\r\n\t\tfirstAttacker.immuneWhenAttackCharges = 1;\r\n\t}\r\n\tsimulateAttack(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tundefined,\r\n\t\tallCards,\r\n\t\tspawns,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t\t0,\r\n\t);\r\n\r\n\tif (!!secondAttacker && !secondAttacker.definitelyDead && secondAttacker.health > 0) {\r\n\t\tmodifyAttack(secondAttacker, 2, playerBoard, allCards);\r\n\t\tmodifyHealth(secondAttacker, 1, playerBoard, allCards);\r\n\t\tafterStatsUpdate(secondAttacker, playerBoard, allCards);\r\n\t\tspectator.registerPowerTarget(secondAttacker, secondAttacker, playerBoard);\r\n\t\tif (playerBoard.map((e) => e.cardId).includes(CardIds.EclipsionIllidari_TB_BaconShop_HERO_08_Buddy_G)) {\r\n\t\t\tsecondAttacker.immuneWhenAttackCharges = 1;\r\n\t\t}\r\n\t\tsimulateAttack(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tundefined,\r\n\t\t\tallCards,\r\n\t\t\tspawns,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tplayerBoard.length - 1,\r\n\t\t);\r\n\t}\r\n};\r\n\r\nconst handleAlakirForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst firstEntity = playerBoard[0];\r\n\tfirstEntity.windfury = true;\r\n\tif (!firstEntity.divineShield) {\r\n\t\tupdateDivineShield(firstEntity, playerBoard, true, allCards);\r\n\t}\r\n\tfirstEntity.taunt = true;\r\n\tspectator.registerPowerTarget(firstEntity, firstEntity, playerBoard);\r\n};\r\n\r\nconst handleTamsinForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tconst lowestHealth = Math.min(...playerBoard.map((e) => e.health));\r\n\tconst entitiesWithLowestHealth = playerBoard.filter((e) => e.health === lowestHealth);\r\n\tconst chosenEntity = pickRandom(entitiesWithLowestHealth);\r\n\tif (!chosenEntity) {\r\n\t\tconsole.warn('could not pick any entity for tamsin', stringifySimple(entitiesWithLowestHealth, allCards));\r\n\t\treturn;\r\n\t}\r\n\tconst newBoard = playerBoard.filter((e) => e.entityId !== chosenEntity.entityId);\r\n\t// How to mark the minion as dead\r\n\tchosenEntity.definitelyDead = true;\r\n\tnewBoard.forEach((e) => {\r\n\t\tmodifyAttack(e, chosenEntity.attack, newBoard, allCards);\r\n\t\tmodifyHealth(e, chosenEntity.health, newBoard, allCards);\r\n\t\tafterStatsUpdate(e, newBoard, allCards);\r\n\t\tspectator.registerPowerTarget(chosenEntity, e, newBoard);\r\n\t});\r\n};\r\n\r\nconst handleTeronForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tspawns: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// The board state is snapshot after the minion dies\r\n\tconst deadMinionEntityId = playerEntity.heroPowerInfo;\r\n\tconst minionThatWillDie = playerBoard.find((e) => e.entityId === deadMinionEntityId);\r\n\tif (minionThatWillDie) {\r\n\t\tconst minionIndexFromRight = playerBoard.length - 1 - playerBoard.indexOf(minionThatWillDie);\r\n\t\tplayerEntity.rapidReanimationIndexFromRight = minionIndexFromRight;\r\n\t\tplayerEntity.rapidReanimationMinion = {\r\n\t\t\t...minionThatWillDie,\r\n\t\t\tenchantments: minionThatWillDie.enchantments.map((e) => ({ ...e })) ?? [],\r\n\t\t} as BoardEntity;\r\n\t\tminionThatWillDie.definitelyDead = true;\r\n\t\tspectator.registerPowerTarget(playerEntity, minionThatWillDie, playerBoard);\r\n\t}\r\n};\r\n\r\nconst handleWaxWarbandForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tif (playerBoard.length > 0) {\r\n\t\t// let tribesGranted = 0;\r\n\t\tlet boardCopy = [...playerBoard];\r\n\t\tlet racesLeft = [...ALL_BG_RACES];\r\n\t\twhile (racesLeft.length > 0) {\r\n\t\t\tconst tribe = pickRandom(racesLeft);\r\n\t\t\tconst validMinion: BoardEntity = getRandomAliveMinion(boardCopy, tribe, allCards);\r\n\t\t\tif (validMinion) {\r\n\t\t\t\tmodifyAttack(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tmodifyHealth(validMinion, cardsData.getTavernLevel(validMinion.cardId), playerBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(validMinion, playerBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(playerEntity, validMinion, playerBoard);\r\n\t\t\t\tboardCopy = boardCopy.filter((e) => e !== validMinion);\r\n\t\t\t\t// tribesGranted++;\r\n\t\t\t} else {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tracesLeft = racesLeft.filter((r) => r !== tribe);\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst handleOzumatForPlayer = (\r\n\tplayerBoard: BoardEntity[],\r\n\tplayerEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Because of some interactions between start of combat hero powers, it can happen that Ozumat is already present\r\n\t// on the board when we receive the board state\r\n\tif (\r\n\t\tplayerBoard.length < 7 &&\r\n\t\t!playerBoard.some((e) => e.cardId === CardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt)\r\n\t) {\r\n\t\tconst tentacularSize = playerEntity.heroPowerInfo;\r\n\t\tconst tentacular = spawnEntities(\r\n\t\t\tCardIds.Tentacular_OzumatsTentacleToken_BG23_HERO_201pt,\r\n\t\t\t1,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t\tfriendly,\r\n\t\t\ttrue,\r\n\t\t\tfalse,\r\n\t\t\tfalse,\r\n\t\t);\r\n\t\ttentacular[0].attack = tentacularSize;\r\n\t\ttentacular[0].health = tentacularSize;\r\n\t\tconst indexFromRight = 0;\r\n\t\tperformEntitySpawns(\r\n\t\t\ttentacular,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tplayerEntity,\r\n\t\t\tindexFromRight,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tspectator.registerPowerTarget(playerEntity, tentacular[0], playerBoard);\r\n\t}\r\n};\r\n\r\nconst handlePlayerStartOfCombatHeroPowers = (\r\n\tplayerEntity: BgsPlayerEntity,\r\n\tplayerBoard: BoardEntity[],\r\n\topponentEntity: BgsPlayerEntity,\r\n\topponentBoard: BoardEntity[],\r\n\tcurrentAttacker: number,\r\n\tfriendly: boolean,\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tspectator: Spectator,\r\n): number => {\r\n\tlet shouldRecomputeCurrentAttacker = false;\r\n\tconst playerHeroPowerId = playerEntity.heroPowerId || getHeroPowerForHero(playerEntity.cardId);\r\n\tif (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TamsinRoame_FragrantPhylactery) {\r\n\t\thandleTamsinForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Tamsin's hero power somehow happens before the current attacker is chosen.\r\n\t\t// See http://replays.firestoneapp.com/?reviewId=bce94e6b-c807-48e4-9c72-2c5c04421213&turn=6&action=9\r\n\t\tshouldRecomputeCurrentAttacker = true;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.TeronGorefiend_RapidReanimation) {\r\n\t\thandleTeronForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.WaxWarband) {\r\n\t\thandleWaxWarbandForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerHeroPowerId === CardIds.Ozumat_Tentacular) {\r\n\t\thandleOzumatForPlayer(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tfriendly,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// Same as Tamsin? No, because the new minion should repop automatically\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLeftToken) {\r\n\t\tconst target = opponentBoard[0];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimRightToken) {\r\n\t\tconst target = opponentBoard[opponentBoard.length - 1];\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimLowToken) {\r\n\t\tconst smallestHealthMinion = [...opponentBoard].sort((a, b) => a.health - b.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === smallestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.AimHighToken) {\r\n\t\tconst highestHealthMinion = [...opponentBoard].sort((a, b) => b.health - a.health)[0];\r\n\t\tconst target = pickRandom(opponentBoard.filter((e) => e.health === highestHealthMinion.health));\r\n\t\tconst damageDone = dealDamageToEnemy(\r\n\t\t\ttarget,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tnull,\r\n\t\t\tplayerEntity.heroPowerInfo2 ?? 0,\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\t// processMinionDeath(playerBoard, playerEntity, opponentBoard, opponentEntity, allCards, cardsData, sharedState, spectator);\r\n\t\tplayerEntity.deadEyeDamageDone = damageDone;\r\n\t} else if (playerEntity.heroPowerUsed && playerHeroPowerId === CardIds.LightningInvocationToken) {\r\n\t\tapplyLightningInvocationEnchantment(\r\n\t\t\tplayerBoard,\r\n\t\t\tplayerEntity,\r\n\t\t\tnull,\r\n\t\t\topponentBoard,\r\n\t\t\topponentEntity,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t}\r\n\tprocessMinionDeath(\r\n\t\tplayerBoard,\r\n\t\tplayerEntity,\r\n\t\topponentBoard,\r\n\t\topponentEntity,\r\n\t\tallCards,\r\n\t\tcardsData,\r\n\t\tsharedState,\r\n\t\tspectator,\r\n\t);\r\n\tif (shouldRecomputeCurrentAttacker) {\r\n\t\tcurrentAttacker =\r\n\t\t\tplayerBoard.length > opponentBoard.length\r\n\t\t\t\t? 0\r\n\t\t\t\t: opponentBoard.length > playerBoard.length\r\n\t\t\t\t? 1\r\n\t\t\t\t: currentAttacker;\r\n\t}\r\n\treturn currentAttacker;\r\n};\r\n\r\nexport const getHeroPowerForHero = (heroCardId: string): string => {\r\n\tswitch (heroCardId) {\r\n\t\tcase CardIds.IllidanStormrage_TB_BaconShop_HERO_08:\r\n\t\t\treturn CardIds.Wingmen;\r\n\t\tcase CardIds.TheLichKing_TB_BaconShop_HERO_22:\r\n\t\t\treturn CardIds.RebornRites;\r\n\t\tcase CardIds.ProfessorPutricide_BG25_HERO_100:\r\n\t\t\treturn CardIds.RagePotion;\r\n\t\tcase CardIds.Deathwing_TB_BaconShop_HERO_52:\r\n\t\t\treturn CardIds.AllWillBurn;\r\n\t\tcase CardIds.TeronGorefiend_BG25_HERO_103:\r\n\t\t\treturn CardIds.TeronGorefiend_RapidReanimation;\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nexport const performStartOfCombatMinionsForPlayer = (\r\n\tattacker: BoardEntity,\r\n\tattackingBoard: BoardEntity[],\r\n\tattackingBoardHero: BgsPlayerEntity,\r\n\tdefendingBoard: BoardEntity[],\r\n\tdefendingBoardHero: BgsPlayerEntity,\r\n\t// Apparently, the board composition used for start of combat minion effects (like Red Whelp, and I assume it works the\r\n\t// same way for others like Prized Promo Drake or Mantid Queen) is the one that is used before Illidan's effect is handled.\r\n\t// Since this also runs before HP start of combat, we probably also use the state as it was before HP were triggered, like\r\n\t// Tamsin's Phylactery.\r\n\tattackingBoardBefore: BoardEntity[],\r\n\tdefendingBoardBefore: BoardEntity[],\r\n\tallCards: AllCardsService,\r\n\tcardsData: CardsData,\r\n\tsharedState: SharedState,\r\n\tgameState: BgsGameState,\r\n\tspectator: Spectator,\r\n): void => {\r\n\t// Don't forget to update START_OF_COMBAT_CARD_IDS\r\n\tif (attacker.cardId === CardIds.RedWhelp_BGS_019) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (attacker.cardId === CardIds.RedWhelp_TB_BaconUps_102) {\r\n\t\tconst damage = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tdealDamageToRandomEnemy(\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tattacker,\r\n\t\t\tdamage,\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t\tprocessMinionDeath(\r\n\t\t\tattackingBoard,\r\n\t\t\tattackingBoardHero,\r\n\t\t\tdefendingBoard,\r\n\t\t\tdefendingBoardHero,\r\n\t\t\tallCards,\r\n\t\t\tcardsData,\r\n\t\t\tsharedState,\r\n\t\t\tspectator,\r\n\t\t);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake_BG21_014 ||\r\n\t\tattacker.cardId === CardIds.PrizedPromoDrake_BG21_014_G\r\n\t) {\r\n\t\tconst numberOfDragons = attackingBoardBefore\r\n\t\t\t.map((entity) => allCards.getCard(entity.cardId).races)\r\n\t\t\t.filter((races) => isCorrectTribe(races, Race.DRAGON)).length;\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.PrizedPromoDrake_BG21_014_G ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * numberOfDragons, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.ChoralMrrrglr_BG26_354 ||\r\n\t\tattacker.cardId === CardIds.ChoralMrrrglr_BG26_354_G\r\n\t) {\r\n\t\t// const statsOfMinionsInHand = attackingBoardHero.hand\r\n\t\t// \t.map((c) => (c.attack ?? 0) + (c.health ?? 0))\r\n\t\t// \t.reduce((a, b) => a + b, 0);\r\n\t\tconst multiplier = attacker.cardId === CardIds.ChoralMrrrglr_BG26_354_G ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralAttackBuff, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attackingBoardHero.globalInfo?.ChoralHealthBuff, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.AmberGuardian_BG24_500 ||\r\n\t\tattacker.cardId === CardIds.AmberGuardian_BG24_500_G\r\n\t) {\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\tconst loops = attacker.cardId === CardIds.AmberGuardian_BG24_500_G ? 2 : 1;\r\n\t\tconst dragonsToConsider = otherDragons;\r\n\t\tfor (let i = 0; i < loops; i++) {\r\n\t\t\tconst otherDragon =\r\n\t\t\t\tpickRandom(dragonsToConsider.filter((e) => !e.divineShield)) ?? pickRandom(dragonsToConsider);\r\n\t\t\tif (otherDragon) {\r\n\t\t\t\tif (!otherDragon.divineShield) {\r\n\t\t\t\t\tupdateDivineShield(otherDragon, attackingBoard, true, allCards);\r\n\t\t\t\t}\r\n\t\t\t\tmodifyAttack(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tmodifyHealth(otherDragon, 2, attackingBoard, allCards);\r\n\t\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t\t\tdragonsToConsider.splice(dragonsToConsider.indexOf(otherDragon), 1);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.SanctumRester_BG26_356 ||\r\n\t\tattacker.cardId === CardIds.SanctumRester_BG26_356_G\r\n\t) {\r\n\t\tconst buff = attacker.cardId === CardIds.SanctumRester_BG26_356_G ? 16 : 8;\r\n\t\t// First try to get a target without divine shield, and if none is available, pick one with divine shield\r\n\t\tconst otherDragons = attackingBoard\r\n\t\t\t.filter((e) => hasCorrectTribe(e, Race.DRAGON, allCards))\r\n\t\t\t.filter((e) => e.entityId !== attacker.entityId);\r\n\t\totherDragons.forEach((otherDragon) => {\r\n\t\t\tmodifyHealth(otherDragon, buff, attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(otherDragon, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, otherDragon, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Soulsplitter_BG25_023 ||\r\n\t\tattacker.cardId === CardIds.Soulsplitter_BG25_023_G\r\n\t) {\r\n\t\tconst numberOfTargets = attacker.cardId === CardIds.Soulsplitter_BG25_023_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfTargets; i++) {\r\n\t\t\tconst undeadsWithoutReborn = attackingBoard\r\n\t\t\t\t.filter((e) => hasCorrectTribe(e, Race.UNDEAD, allCards))\r\n\t\t\t\t.filter((e) => !e.reborn);\r\n\t\t\tconst chosenUndead = pickRandom(undeadsWithoutReborn);\r\n\t\t\tif (chosenUndead) {\r\n\t\t\t\tchosenUndead.reborn = true;\r\n\t\t\t\tspectator.registerPowerTarget(attacker, chosenUndead, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy ||\r\n\t\tattacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy_G\r\n\t) {\r\n\t\tconst neighbours = getNeighbours(attackingBoard, attacker);\r\n\t\tconst multiplier = attacker.cardId === CardIds.Crabby_BG22_HERO_000_Buddy_G ? 2 : 1;\r\n\t\tneighbours.forEach((entity) => {\r\n\t\t\tmodifyAttack(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tmodifyHealth(entity, multiplier * (attackingBoardHero.deadEyeDamageDone ?? 0), attackingBoard, allCards);\r\n\t\t\tafterStatsUpdate(entity, attackingBoard, allCards);\r\n\t\t\tspectator.registerPowerTarget(attacker, entity, attackingBoard);\r\n\t\t});\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon_BG23_012 ||\r\n\t\tattacker.cardId === CardIds.CorruptedMyrmidon_BG23_012_G\r\n\t) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.CorruptedMyrmidon_BG23_012_G ? 2 : 1;\r\n\t\tmodifyAttack(attacker, multiplier * attacker.attack, attackingBoard, allCards);\r\n\t\tmodifyHealth(attacker, multiplier * attacker.health, attackingBoard, allCards);\r\n\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704 ||\r\n\t\tattacker.cardId === CardIds.InterrogatorWhitemane_BG24_704_G\r\n\t) {\r\n\t\tif (defendingBoard.length > 0) {\r\n\t\t\tconst attackerIndex = attackingBoard.indexOf(attacker);\r\n\t\t\tconst defenderPosition = attackerIndex - (attackingBoard.length - defendingBoard.length) / 2;\r\n\t\t\tif (Math.round(defenderPosition) === defenderPosition) {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition], attacker, attackingBoard, spectator);\r\n\t\t\t} else {\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition - 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t\tcastImpure(defendingBoard[defenderPosition + 0.5], attacker, attackingBoard, spectator);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (attacker.cardId === CardIds.MantidQueen_BG22_402 || attacker.cardId === CardIds.MantidQueen_BG22_402_G) {\r\n\t\tconst multiplier = attacker.cardId === CardIds.MantidQueen_BG22_402_G ? 2 : 1;\r\n\t\tconst allRaces = attackingBoardBefore\r\n\t\t\t.map((entity) => entity.cardId)\r\n\t\t\t.flatMap((cardId) => allCards.getCard(cardId).races)\r\n\t\t\t.filter((race) => !!race && race !== Race[Race.BLANK]);\r\n\t\tconst totalRaces =\r\n\t\t\t[...new Set(allRaces.filter((race) => race !== Race[Race.ALL]))].length +\r\n\t\t\tallRaces.filter((race) => race === Race[Race.ALL]).length;\r\n\t\tfor (let i = 0; i < multiplier; i++) {\r\n\t\t\tfor (let j = 0; j < totalRaces; j++) {\r\n\t\t\t\tconst buffType = getRandomMantidQueenBuffType(attacker);\r\n\t\t\t\tswitch (buffType) {\r\n\t\t\t\t\tcase 'stats':\r\n\t\t\t\t\t\tmodifyAttack(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tmodifyHealth(attacker, 5, attackingBoard, allCards);\r\n\t\t\t\t\t\tafterStatsUpdate(attacker, attackingBoard, allCards);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'reborn':\r\n\t\t\t\t\t\tattacker.reborn = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'taunt':\r\n\t\t\t\t\t\tattacker.taunt = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 'windfury':\r\n\t\t\t\t\t\tattacker.windfury = true;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t\tspectator.registerPowerTarget(attacker, attacker, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t} else if (\r\n\t\tattacker.cardId === CardIds.CarbonicCopy_BG27_503 ||\r\n\t\tattacker.cardId === CardIds.CarbonicCopy_BG27_503_G\r\n\t) {\r\n\t\tconst numberOfCopies = attacker.cardId === CardIds.CarbonicCopy_BG27_503_G ? 2 : 1;\r\n\t\tfor (let i = 0; i < numberOfCopies; i++) {\r\n\t\t\tif (!!attackingBoard.length && attackingBoard.length < 7) {\r\n\t\t\t\tconst copy: BoardEntity = {\r\n\t\t\t\t\t...attacker,\r\n\t\t\t\t\tlastAffectedByEntity: null,\r\n\t\t\t\t};\r\n\t\t\t\tconst newMinions = spawnEntities(\r\n\t\t\t\t\tcopy.cardId,\r\n\t\t\t\t\t1,\r\n\t\t\t\t\tattackingBoard,\r\n\t\t\t\t\tattackingBoardHero,\r\n\t\t\t\t\tdefendingBoard,\r\n\t\t\t\t\tdefendingBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t\tattacker.friendly,\r\n\t\t\t\t\ttrue,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tfalse,\r\n\t\t\t\t\tcopy,\r\n\t\t\t\t);\r\n\t\t\t\tconst indexFromRight = attackingBoard.length - (attackingBoard.indexOf(attacker) + 1);\r\n\t\t\t\tperformEntitySpawns(\r\n\t\t\t\t\tnewMinions,\r\n\t\t\t\t\tattackingBoard,\r\n\t\t\t\t\tattackingBoardHero,\r\n\t\t\t\t\tattacker,\r\n\t\t\t\t\tindexFromRight,\r\n\t\t\t\t\tdefendingBoard,\r\n\t\t\t\t\tdefendingBoardHero,\r\n\t\t\t\t\tallCards,\r\n\t\t\t\t\tcardsData,\r\n\t\t\t\t\tsharedState,\r\n\t\t\t\t\tspectator,\r\n\t\t\t\t);\r\n\t\t\t\tspectator.registerPowerTarget(attacker, copy, attackingBoard);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\nconst applyAllWillBurn = (\r\n\tboard1: BoardEntity[],\r\n\tboard2: BoardEntity[],\r\n\tsourceEntity: BgsPlayerEntity | BoardEntity,\r\n\tallCards: AllCardsService,\r\n\tspectator: Spectator,\r\n): void => {\r\n\tfor (const entity of board1) {\r\n\t\tmodifyAttack(entity, 2, board1, allCards);\r\n\t\tafterStatsUpdate(entity, board1, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board1);\r\n\t}\r\n\tfor (const entity of board2) {\r\n\t\tmodifyAttack(entity, 2, board2, allCards);\r\n\t\tafterStatsUpdate(entity, board2, allCards);\r\n\t\tspectator.registerPowerTarget(sourceEntity, entity, board2);\r\n\t}\r\n};\r\n\r\nconst castImpure = (entity: BoardEntity, source: BoardEntity, board: BoardEntity[], spectator: Spectator) => {\r\n\tif (!entity) {\r\n\t\treturn;\r\n\t}\r\n\tconst multiplier = source.cardId === CardIds.InterrogatorWhitemane_BG24_704_G ? 3 : 2;\r\n\tentity.taunt = true;\r\n\tentity.damageMultiplier = entity.damageMultiplier ?? 1;\r\n\tentity.damageMultiplier *= multiplier;\r\n\tspectator.registerPowerTarget(source, entity, board);\r\n};\r\n\r\nconst getRandomMantidQueenBuffType = (entity: BoardEntity): 'stats' | 'reborn' | 'windfury' | 'taunt' => {\r\n\tconst possibilities: ('stats' | 'reborn' | 'windfury' | 'taunt')[] = ['stats'];\r\n\tif (!entity.reborn) {\r\n\t\tpossibilities.push('reborn');\r\n\t}\r\n\tif (!entity.windfury) {\r\n\t\tpossibilities.push('windfury');\r\n\t}\r\n\tif (!entity.taunt) {\r\n\t\tpossibilities.push('taunt');\r\n\t}\r\n\treturn pickRandom(possibilities);\r\n};\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firestone-hs/simulate-bgs-battle",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.304",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint --color --fix --ext .ts .",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@firestone-hs/hs-replay-xml-parser": "0.0.46",
|
|
26
|
-
"@firestone-hs/reference-data": "^1.0.
|
|
26
|
+
"@firestone-hs/reference-data": "^1.0.102"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/aws-lambda": "8.10.31",
|
|
@@ -46,4 +46,4 @@
|
|
|
46
46
|
"webpack-cli": "^5.0.2",
|
|
47
47
|
"yaml-cfn": "^0.2.2"
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|